# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1265068993 -7200 # Node ID c40eb8fe8501db64aca3f263e4f2a678477509f2 Revision: 201003 Kit: 201005 diff -r 000000000000 -r c40eb8fe8501 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build information file for project wlan +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +#include "../wlan_bearer/group/bld.inf" +#include "../wlan_plat/group/bld.inf" +#include "../wlan_pub/group/bld.inf" + +PRJ_TESTMMPFILES diff -r 000000000000 -r c40eb8fe8501 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,15 @@ + + +]> + + + + + + + + + + + diff -r 000000000000 -r c40eb8fe8501 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r c40eb8fe8501 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build information file for project wlan_bearer +*/ + +/* +* %version: tr1cfwln#14 % +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +#include "../wlanpsmplugin/group/bld.inf" +#include "../wlanagent/group/bld.inf" +#include "../wlandbif_cd/group/bld.inf" +#include "../wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/bld.inf" +#include "../wlanldd/wlan_symbian/wlanldd_symbian/group/bld.inf" +#include "../wlannwif/group/bld.inf" + +PRJ_TESTMMPFILES diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project WLAN Agent +* +*/ + +/* +* %version: 12 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// DOMAIN EXPORTS + +// Export iby file +../rom/wlanagt.iby CORE_OS_LAYER_IBY_EXPORT_PATH(wlanagt.iby) + +PRJ_MMPFILES +wlanagt.mmp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/group/wlanagt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/group/wlanagt.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project WLAN Agent +* +*/ + +/* +* %version: 15 % +*/ + +#include + +TARGET wlanagt.agt +TARGETTYPE dll +UID 0x10003d39 0x101f8e18 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src + +SOURCE wlanagt.cpp +SOURCE wlanagtsm.cpp +SOURCE wlanagtstates.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY commsdat.lib +LIBRARY charconv.lib +LIBRARY nifman.lib +LIBRARY wlmserver.lib +LIBRARY wlandbif.lib +LIBRARY bafl.lib +STATICLIBRARY wlanscanlist.lib + +#if defined( ARMCC ) +DEFFILE /epoc32/include/def/eabi/agent.def +#else +DEFFILE /epoc32/release/wins/agent.def +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/inc/wlanagt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/inc/wlanagt.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN Agent class +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef _WLANAGT_H_ +#define _WLANAGT_H_ + +#include +#include + +const TInt KMajorVersionNumber=0; +const TInt KMinorVersionNumber=0; +const TInt KBuildVersionNumber=0; + +_LIT(KWlanAgentName,"wlanagt"); + +/** + * WLAN agent factory + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanAgentFactory ) : public CNifAgentFactory + { +protected: + + /** + * InstallL + * + * @since S60 v3.0 + */ + void InstallL(); + + /** + * NewAgentL + * + * @since S60 v3.0 + * @param aName of the agent + * @return instance of the requested agent + */ + CNifAgentBase* NewAgentL(const TDesC& aName); + + /** + * Info + * + * @since S60 v3.0 + * @param aInfo + * @param aIndex + * @return + */ + TInt Info(TNifAgentInfo& aInfo, TInt aIndex) const; + }; + +/** + * WLAN agent + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanAgent ): public CStateMachineAgentBase + { +public: + + /** + * NewL + * + * @since S60 v3.0 + * @return instance of the requested agent + */ + static CWlanAgent* NewL(); + + /** + * destructor + */ + virtual ~CWlanAgent(); + +protected: + + /** + * ConstructL + * + * @since S60 v3.0 + */ + void ConstructL(); + + /** + * constructor + * + * @since S60 v3.0 + */ + CWlanAgent(); + +public: // From CStateMachineAgentBase + + /** + * Info + * + * @since S60 v3.0 + * @param aInfo + */ + void Info(TNifAgentInfo& aInfo) const; + + /** + * CreateAgentSML + * + * @since S60 v3.0 + * @param aObserver + * @param aDlgPrc + * @param aDb + * @param aDir + * @return instance of the requested agent statemachine + */ + CAgentSMBase* CreateAgentSML( + MAgentNotify& aObserver, + CDialogProcessor* aDlgPrc, + CCommsDbAccess& aDb, + TCommDbConnectionDirection aDir ); + + /** + * Retrieve the bearer information to the Agent CPR. + * + * @return Bearer information to the Agent CPR. + */ + TUint32 GetBearerInfo() const; + }; + +#endif // _WLANAGT_H_ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/inc/wlanagtsm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/inc/wlanagtsm.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wlan agent's state machine +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef _WLANSM_H_ +#define _WLANSM_H_ + +#include +#include "rwlmserver.h" + +struct SWLANSettings; + +/** + * WLAN agent statemachine + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanSM ): public CAgentSMBase +{ +public: + + /** + * NewL + * + * @since S60 v3.0 + * @param aObserver + * @param aDlgPrc + * @param aDbAccess + * @return instance of statemachine + */ + static CWlanSM* NewL( + MAgentNotify& aObserver, + CDialogProcessor* aDlgPrc, + CCommsDbAccess& aDbAccess ); + + /** + * destructor + * + * @since S60 v3.0 + */ + ~CWlanSM(); + +public: // From CAgentSMBase + + /** + * GetExcessData + * + * @since S60 v3.0 + * @param aBuffer + * @return + */ + virtual TInt GetExcessData( TDes8& aBuffer ); + + /** + * Notification + * + * @since S60 v3.0 + * @param aEvent + * @param aInfo + */ + virtual TInt Notification( TNifToAgentEventType aEvent, TAny* aInfo ); + + + /** + * SetOverrideSettingsL + * + * @since S60 v3.0 + * @param aWLMOverrideSettings + */ + void SetOverrideSettingsL( const TWLMOverrideSettings& aWLMOverrideSettings ); + + /** + * WlanSettings + * + * @since S60 v3.0 + * @return pointer to SWLANSettings structure + */ + const SWLANSettings* WlanSettings() const; + + /** + * SettingsId + * + * @since S60 v3.0 + * @return Id of the chosen IAP + */ + TUint32 SettingsId() const; + + /** + * IapId + * + * @since S60 v3.0 + * @return Id of the chosen IAP + */ + TUint32 IapId() const; + + /** + * OverrideSettings + * + * @since S60 v3.0 + * @param overridesettings object + */ + TWLMOverrideSettings* OverrideSettings() const; + + /** + * SetHotSpotAP + * + * @since S60 v3.2 + * @Sets the flag indicating if the AP is HotSpot AP or Normal AP + */ + void SetHotSpotAP(TBool aHotSpotAP); + + /** + * IsHotSpotAP + * + * @since S60 v3.2 + * @Returns the flag indicating if the AP is HotSpot AP or Normal AP + */ + TBool IsHotSpotAP() const; + + +protected: + + /** + * constructor + * + * @since S60 v3.0 + * @param aObserver + * @param aDlgPrc + * @param aDbAccess + */ + CWlanSM( + MAgentNotify& aObserver, + CDialogProcessor* aDlgPrc, + CCommsDbAccess& aDbAccess ); + + /** + * ConstructL + * + * @since S60 v3.0 + */ + void ConstructL(); + +private: + + /** + * DoConstructL + * + * @since S60 v3.0 + */ + void DoConstructL(); + +private: + /** Client API instance of the WLAN Engine */ + RWLMServer iWLMServer; + /** WLAN Settings of the IAP from CommsDat*/ + SWLANSettings* iWlanSettings; + /** An index for accessing IAP specific WLAN settings from CommsDat */ + TUint32 iServiceId; + /** + * Structure that can convey connection parameters which should override + * the ones in CommsDat + */ + TWLMOverrideSettings* iWLMOverrideSettings; + /** Identifier of the IAP */ + TUint32 iIapId; + + /** HotSpot related variable + */ + TBool iIsHotSpotAP; +}; + +#endif // _WLANSM_H_ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/inc/wlanagtstates.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/inc/wlanagtstates.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,575 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: States for WLAN Agent's state machine +* +*/ + +/* +* %version: 19 % +*/ + +#ifndef _WLANSTATES_H_ +#define _WLANSTATES_H_ + +#include +#include "rwlmserver.h" +#include "wlanmgmtcommon.h" +#include "wlanagthotspotclient.h" + + // WLAN uids + +// ID of SelectWLan dialog +const TUid KUidSelectWLanDlg = { 0x10207373 }; + +// ID of OfflineWlanNote dialog +const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 }; + +// ID of OfflineWlanDisabledNote dialog +const TUid KUidCOfflineWlanDisabledNoteDlg = { 0x101FD672 }; + +// ID of Easy Wep dialog +const TUid KUidEasyWepDlg = { 0x101FD673 }; + +// ID of Easy Wpa dialog +const TUid KUidEasyWpaDlg = { 0x101FD674 }; + +// ID of WLANNetworkUnavailableNote dialog +const TUid KUidWLANNetworkUnavailableNoteDlg = { 0x101FD67F }; + +// ID of Connecting Note dialog +const TUid KUidConnectingNoteDlg = { 0x101FD681 }; + +const TInt KEasyWepQuery256BitMaxLength = 58; + +// Values of TWlanagtProgress are limited by the following (from nifvar.h): +//const TInt KMinAgtProgress = 2500; +//const TInt KConnectionOpen = 3500; // From an Agent +//const TInt KConnectionClosed = 4500; // From an Agent +//const TInt KMaxAgtProgress = 5500; +enum TWlanagtProgress + { + EModeCheck = 3000, + EEasyConn = 3020, + EEasyWpa = 3022, + EEasyWep = 3024, + EAttemptingToJoin = 3030, + EOpeningConnection = 3040, + EDisconnecting = 4000 + }; + +class CWlanSM; +class ScanInfo; + +/** + * CWlanStateBase is the baseclass of all the WLAN Agent concrete states + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanStateBase ) : public CAgentStateBase, public MWLMNotify + { +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanStateBase( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); + +public: // From CAgentStateBase + + /** + * StartState is called by the framework after new state has been instantiated + * + * @since S60 v3.0 + */ + virtual void StartState(); + +public: // From MWLMNotify + + /** + * ConnectionStateChanged notification is received when change + * in connection state occurs + * + * @since S60 v3.0 + */ + virtual void ConnectionStateChanged( TWlanConnectionState aNewState ); + +protected: + /** pointer to agent's statemachine */ + CWlanSM* iWlanSM; + /** reference to WLAN Engine client interface */ + RWLMServer& iWLMServer; + }; + + +/** + * CWlanStartState is used when starting a connection + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanStartState ) : public CWlanStateBase + { + enum TNextState + { + EWlanAgtNextStateUnknown, + EWlanAgtNextStateJoin, + EWlanAgtNextStateOpen, + EWlanAgtNextStateEasyConn + }; + +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanStartState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); + +public: // From CAgentStateBase + + /** + * NextStateL + * + * @since S60 v3.0 + * @param aContinue specifies whether to continue normally or not + * @return instance of the state that is entered next + * (depends on the aContinue parameter) + */ + virtual CAgentStateBase* NextStateL( TBool aContinue ); + +protected: // From CActive + + /** + * RunL + * + * @since S60 v3.0 + */ + virtual void RunL(); + + /** + * DoCancel + * + * @since S60 v3.0 + */ + virtual void DoCancel(); + +private: + /** + * PrepareEasyWlanParamsL + * + * @since S60 v3.2 + */ + void PrepareEasyWlanParamsL(); + +private: + /** specifies the next state */ + TNextState iNextState; + }; + + + + + + +/** + * CWlanJoinState handles the connection attempt to WlanEngine + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanJoinState ): public CWlanStateBase + { + + enum TActiveObjectContext + { + EHotSpotInProgress, + EHotSpotFailure, + EHotSpotNormalAP, + EHotSpotWLMServerHS, + EHotSpotWLMServerNormal + }; + +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanJoinState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); + + // Destructor + ~CWlanJoinState(); + + // From CAgentStateBase + /** + * StartState is called by the framework after new state has been instantiated + * + * @since S60 v3.0 + */ + virtual void StartState(); + + /** + * NextStateL + * + * @since S60 v3.0 + * @param aContinue specifies whether to continue normally or not + * @return instance of the state that is entered next + * (depends on the aContinue parameter) + */ + virtual CAgentStateBase* NextStateL( TBool aContinue ); + + +protected: // From CActive + + /** + * RunL + * + * @since S60 v3.0 + */ + virtual void RunL(); + + /** + * DoCancel + * + * @since S60 v3.0 + */ + virtual void DoCancel(); + +private: + + /** + * DoStartStateL + * + * @since S60 v3.0 + */ + void DoStartStateL(); + +private: + + //indicates the Active Object context of the state + TActiveObjectContext iContext; + + // pointer to ECOM plug-in instance + CWlanAgtHotSpotClient *iAgtHotSpotClient; + }; + +/** + * CWlanOpenState is active when there is an active connection + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanOpenState ): public CWlanStateBase + { + enum TSubState + { + EWlanOpenSubStateOpening, + EWlanOpenSubStateOpened, + EWlanOpenSubStateRenewingDHCP + }; + +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanOpenState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); + + /** + * destructor + * + * @since S60 v3.0 + */ + virtual ~CWlanOpenState(); + +public: // From CAgentStateBase + /** + * StartState is called by the framework after new state has been instantiated + * + * @since S60 v3.0 + */ + virtual void StartState(); + + /** + * NextStateL + * + * @since S60 v3.0 + * @param aContinue specifies whether to continue normally or not + * @return instance of the state that is entered next + * (depends on the aContinue parameter) + */ + virtual CAgentStateBase* NextStateL( TBool aContinue ); + +public: // From MWLMNotify + /** + * ConnectionStateChanged notification tells about chnages in the connection state + * + * @since S60 v3.0 + * @param aNewState specifies the new state + */ + virtual void ConnectionStateChanged( TWlanConnectionState aNewState ); + +protected: // From CActive + + /** + * RunL + * + * @since S60 v3.0 + */ + virtual void RunL(); + + /** + * DoCancel + * + * @since S60 v3.0 + */ + virtual void DoCancel(); + +private: + + /** + * DoStartStateL + * + * @since S60 v3.0 + */ + void DoStartStateL(); + + /** + * DisconnectCb + * + * @since S60 v3.0 + * @param aThisPtr pointer to 'this' + */ + static TInt DisconnectCb( TAny* aThisPtr ); + +private: + /** substate of the connection */ + TSubState iSubState; + /** callback pointer */ + CAsyncCallBack* iDisconnectCb; + //Interfce to Notifier + //RNotifier iNotifier; + }; + +/** + * CWlanDisconnectState initiaes disconnection towards WlanEngine + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanDisconnectState ): public CWlanStateBase + { +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanDisconnectState(CWlanSM* aWlanSM, RWLMServer& aWLMServer); + + /** + * destructor + * + * @since S60 v3.0 + */ + virtual ~CWlanDisconnectState(); + + // From CAgentStateBase + // + /* StartState is called by the framework after new state has been instantiated + * + * @since S60 v3.0 + */ + virtual void StartState(); + + /** + * NextStateL + * + * @since S60 v3.0 + * @param aContinue specifies whether to continue normally or not + * @return instance of the state that is entered next + * (depends on the aContinue parameter) + */ + virtual CAgentStateBase* NextStateL(TBool aContinue); + +protected: // From CActive + + /** + * RunL + * + * @since S60 v3.0 + */ + virtual void RunL(); + + /** + * DoCancel + * + * @since S60 v3.0 + */ + virtual void DoCancel(); + +private: + + /** pointer to ECOM plug-in instance */ + CWlanAgtHotSpotClient *iAgtHotSpotClient; + }; + +/** + * CWlanErrorState is a "Dummy state" used when the CWlanSM cannot + * be constructed properly. + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanErrorState ): public CAgentStateBase + { +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanErrorState( CWlanSM* aWlanSM, TInt aError ); + + // From CAgentStateBase + /** + * StartState is called by the framework after new state has been instantiated + * + * @since S60 v3.0 + */ + virtual void StartState(); + + /** + * NextStateL + * + * @since S60 v3.0 + * @param aContinue specifies whether to continue normally or not + * @return instance of the state that is entered next + * (depends on the aContinue parameter) + */ + virtual CAgentStateBase* NextStateL(TBool aContinue); + +protected: // From CActive + + /** + * RunL + * + * @since S60 v3.0 + */ + virtual void RunL(); + + /** + * DoCancel + * + * @since S60 v3.0 + */ + virtual void DoCancel(); + +protected: + /** pointer to WLAN agent's state machine */ + CWlanSM* iWlanSM; + +private: + /** error code */ + TInt iError; + }; + +/** + * CWlanWaitConnectionState is used for waiting previous connection to close down. + * + * @lib wlanagt.agt + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CWlanWaitConnectionState ): public CWlanStateBase + { +public: + + /** + * constructor + * + * @since S60 v3.0 + * @param aWlanSM pointer to WLAN Agent's statemachine framework + * @param aWLMServer reference to WLAN Engine client interface + */ + CWlanWaitConnectionState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ); + + /** + * destructor + * + * @since S60 v3.0 + */ + virtual ~CWlanWaitConnectionState(); + +public: // From CAgentStateBase + + /** + * StartState is called by the framework after new state has been instantiated + * + * @since S60 v3.0 + */ + void StartState(); + + /** + * NextStateL + * + * @since S60 v3.0 + * @param aContinue specifies whether to continue normally or not + * @return instance of the state that is entered next + * (depends on the aContinue parameter) + */ + CAgentStateBase* NextStateL(TBool aContinue); + +protected: // From CActive + + /** + * RunL + * + * @since S60 v3.0 + */ + void RunL(); + + /** + * DoCancel + * + * @since S60 v3.0 + */ + void DoCancel(); + +private: + /** Timer for waiting */ + RTimer iTimer; + }; + +#endif // _WLANSTATES_H_ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/rom/wlanagt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/rom/wlanagt.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project WLAN Agent +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef __WLANAGT_IBY__ +#define __WLANAGT_IBY__ +#include + +#ifdef __PROTOCOL_WLAN +file=ABI_DIR\BUILD_DIR\wlanagt.agt SHARED_LIB_DIR\wlanagt.agt +#endif // __PROTOCOL_WLAN + +#endif // __WLANAGT_IBY__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/src/wlanagt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/src/wlanagt.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WLAN Agent +* +*/ + +/* +* %version: 8 % +*/ + +#include "am_debug.h" +#include "wlanagt.h" +#include "wlanagtsm.h" + +// WLAN bearer type +const TUint32 KWlanAgentBearerType = 0x3C; + +// +// First ordinal export +// +extern "C" EXPORT_C CNifAgentFactory* NewAgentFactoryL() + { + return new(ELeave) CWlanAgentFactory; + } + +// ======== WLAN agent factory MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWlanAgentFactory::InstallL +// --------------------------------------------------------------------------- +// +void CWlanAgentFactory::InstallL() + { + } + +// --------------------------------------------------------------------------- +// CWlanAgentFactory::NewAgentL +// --------------------------------------------------------------------------- +// +CNifAgentBase* CWlanAgentFactory::NewAgentL(const TDesC& /*aName*/) + { + DEBUG( "CWlanAgentFactory::NewAgentL()" ); + return CWlanAgent::NewL(); + } + +// --------------------------------------------------------------------------- +// CWlanAgentFactory::Info +// --------------------------------------------------------------------------- +// +TInt CWlanAgentFactory::Info( + TNifAgentInfo& aInfo, + TInt /*aIndex*/) const + { + aInfo.iName = KWlanAgentName; + aInfo.iName.AppendFormat(_L("-AgentFactory[0x%08x]"), this); + aInfo.iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + return KErrNone; + } + +// ======== WLAN agent MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWlanAgent::CWlanAgent +// --------------------------------------------------------------------------- +// +CWlanAgent::CWlanAgent() + { + } + +// --------------------------------------------------------------------------- +// CWlanAgent::CWlanAgent +// --------------------------------------------------------------------------- +// +CWlanAgent::~CWlanAgent() + { + } + +// --------------------------------------------------------------------------- +// CWlanAgent::CWlanAgent +// --------------------------------------------------------------------------- +// +CWlanAgent* CWlanAgent::NewL() + { + CWlanAgent* self = new (ELeave) CWlanAgent(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CWlanAgent::CWlanAgent +// --------------------------------------------------------------------------- +// +void CWlanAgent::ConstructL() + { + CStateMachineAgentBase::ConstructL(); + } + +// --------------------------------------------------------------------------- +// CWlanAgent::CWlanAgent +// --------------------------------------------------------------------------- +// +CAgentSMBase* CWlanAgent::CreateAgentSML( + MAgentNotify& aObserver, + CDialogProcessor* aDlgPrc, + CCommsDbAccess& aDbAccess, + TCommDbConnectionDirection aDirection ) + { + if( aDirection == ECommDbConnectionDirectionIncoming ) + { + User::Leave( KErrNotSupported ); + } + + return CWlanSM::NewL( aObserver, aDlgPrc, aDbAccess ); + } + +// --------------------------------------------------------------------------- +// CWlanAgent::CWlanAgent +// --------------------------------------------------------------------------- +// +void CWlanAgent::Info( TNifAgentInfo& aInfo ) const + { + aInfo.iName = KWlanAgentName; + aInfo.iName.AppendFormat(_L("-Agent[0x%08x]"), this); + aInfo.iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + } + +// --------------------------------------------------------------------------- +// CWlanAgent::GetBearerInfo +// --------------------------------------------------------------------------- +// +TUint32 CWlanAgent::GetBearerInfo() const + { + return KWlanAgentBearerType; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/src/wlanagtsm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/src/wlanagtsm.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WLAN Agent statemachine framework +* +*/ + +/* +* %version: 11 % +*/ + +#include +#include +#include "am_debug.h" +#include "wlanagtsm.h" +#include "wlanagtstates.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlanSM::NewL +// ----------------------------------------------------------------------------- +// +CWlanSM* CWlanSM::NewL( + MAgentNotify& aObserver, + CDialogProcessor* aDlgPrc, + CCommsDbAccess& aDbAccess ) + { + DEBUG( "CWlanSM::NewL()" ); + CWlanSM* self = new (ELeave) CWlanSM(aObserver, aDlgPrc, aDbAccess); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::CWlanSM +// ----------------------------------------------------------------------------- +// +CWlanSM::CWlanSM( + MAgentNotify& aObserver, + CDialogProcessor* aDlgPrc, + CCommsDbAccess& aDbAccess ) : + CAgentSMBase( aObserver, aDlgPrc, aDbAccess ), + iWlanSettings( NULL ), + iServiceId( 0 ), + iWLMOverrideSettings( NULL ), + iIapId( 0 ), + iIsHotSpotAP (EFalse) + { + DEBUG( "CWlanSM constructor" ); + } + +// ----------------------------------------------------------------------------- +// CWlanSM::ConstructL +// ----------------------------------------------------------------------------- +// +void CWlanSM::ConstructL() + { + DEBUG( "CWlanSM::ConstructL()" ); + + TRAPD( err, DoConstructL() ); + + if( err == KErrNone ) + { + TWlanConnectionState state = iWLMServer.GetConnectionState(); + + DEBUG1( "CWlanSM::ConstructL() - WLAN engine state is %u", state ); + + if( state == EWlanStateNotConnected ) + { + iState = new(ELeave) CWlanStartState( this, iWLMServer ); + } + else + { + iState = new(ELeave) CWlanWaitConnectionState( this, iWLMServer ); + } + } + else + { +#ifdef _DEBUG + User::InfoPrint(_L("wlanagt: state machine creation error")); +#endif + iState = new(ELeave) CWlanErrorState( this, KErrCouldNotConnect ); + } + } + +// ----------------------------------------------------------------------------- +// CWlanSM::DoConstructL +// ----------------------------------------------------------------------------- +// +void CWlanSM::DoConstructL() + { + DEBUG( "CWlanSM::DoConstructL()" ); + User::LeaveIfError(iWLMServer.Connect()); + + // Check the service type in current IAP, must be LANService. + TBuf serviceType; + Db()->GetDesL( TPtrC( IAP ), TPtrC( IAP_SERVICE_TYPE ), serviceType ); + if( serviceType != TPtrC( LAN_SERVICE ) ) + { + User::Leave(KErrCorrupt); + } + + // Get the current IAP id + Db()->GetIntL( TPtrC( IAP ), TPtrC( COMMDB_ID ), iIapId ); + DEBUG1("iap id:%d", iIapId); + + // Get the service ID from the IAP table + Db()->GetIntL( TPtrC( IAP ), TPtrC( IAP_SERVICE ), iServiceId ); + DEBUG1("service id:%d", iServiceId); + + iWlanSettings = new (ELeave) SWLANSettings; + + CWLanSettings* wlansettings = new (ELeave) CWLanSettings(); + CleanupStack::PushL( wlansettings ); + User::LeaveIfError( wlansettings->Connect() ); + + // Get the "IAP specific WLAN settings" for this LAN service ID + TInt err = wlansettings->GetWlanSettingsForService( iServiceId, *iWlanSettings ); + wlansettings->Disconnect(); + + // wlansettings->Disconnect() need to be called also if wlansettings-> + // GetWlanSettingsForService() returns an error. This is why we didn't use + // User::LeaveIfError() above directly. + User::LeaveIfError(err); + + CleanupStack::PopAndDestroy( wlansettings ); + } + +// ----------------------------------------------------------------------------- +// CWlanSM::GetExcessData +// ----------------------------------------------------------------------------- +// +TInt CWlanSM::GetExcessData(TDes8& /*aBuffer*/) + { + DEBUG( "CWlanSM::GetExcessData()" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::Notification +// ----------------------------------------------------------------------------- +// +TInt CWlanSM::Notification(TNifToAgentEventType /*aEvent*/, TAny* /*aInfo*/) + { + DEBUG( "CWlanSM::Notification()" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::SetOverrideSettingsL +// ----------------------------------------------------------------------------- +// +void CWlanSM::SetOverrideSettingsL(const TWLMOverrideSettings& aWLMOverrideSettings) + { + if(!iWLMOverrideSettings) + { + iWLMOverrideSettings = new (ELeave) TWLMOverrideSettings; + } + + iWLMOverrideSettings->settingsMask = aWLMOverrideSettings.settingsMask; + iWLMOverrideSettings->ssid = aWLMOverrideSettings.ssid; + iWLMOverrideSettings->bssid = aWLMOverrideSettings.bssid; + iWLMOverrideSettings->wep = aWLMOverrideSettings.wep; + iWLMOverrideSettings->wpaPsk = aWLMOverrideSettings.wpaPsk; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::~CWlanSM +// ----------------------------------------------------------------------------- +// +CWlanSM::~CWlanSM() + { + DEBUG( "CWlanSM destructor" ); + + delete iWlanSettings; + delete iWLMOverrideSettings; + + iWLMServer.Close(); + + } + +// ----------------------------------------------------------------------------- +// CWlanSM::WlanSettings +// ----------------------------------------------------------------------------- +// +const SWLANSettings* CWlanSM::WlanSettings() const + { + return iWlanSettings; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::SettingsId +// ----------------------------------------------------------------------------- +// +TUint32 CWlanSM::SettingsId() const + { + return iServiceId; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::IapId +// ----------------------------------------------------------------------------- +// +TUint32 CWlanSM::IapId() const + { + return iIapId; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::SetHotSpotAP +// ----------------------------------------------------------------------------- +// +void CWlanSM::SetHotSpotAP(TBool aHotSpotAP) + { + iIsHotSpotAP = aHotSpotAP; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::IsHotSpotAP +// ----------------------------------------------------------------------------- +// +TBool CWlanSM::IsHotSpotAP() const + { + return iIsHotSpotAP; + } + +// ----------------------------------------------------------------------------- +// CWlanSM::OverrideSettings +// ----------------------------------------------------------------------------- +// +TWLMOverrideSettings* CWlanSM::OverrideSettings() const + { + return iWLMOverrideSettings; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanagent/src/wlanagtstates.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanagent/src/wlanagtstates.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,831 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN Agent state machine's state implementations +* +*/ + +/* +* %version: 35 % +*/ + +#include +#include +#include +#include +#include +#include +#include +#include "am_debug.h" +#include "genscanlist.h" +#include "genscaninfo.h" +#include "wlanagtstates.h" +#include "wlanagtsm.h" +#include "wlanagthotspotclient.inl" + +static const TUint KConnectionEndWaitTime = 2*1000000; // 2 seconds + +// ----------------------------------------------------------------------------- +// CWlanStateBase::CWlanStateBase +// ----------------------------------------------------------------------------- +// +CWlanStateBase::CWlanStateBase( CWlanSM* aWlanSM, RWLMServer& aWLMServer ) : + CAgentStateBase( *aWlanSM ), + iWlanSM( aWlanSM ), + iWLMServer( aWLMServer ) + { + } + +// ----------------------------------------------------------------------------- +// CWlanStateBase::StartState +// ----------------------------------------------------------------------------- +// +void CWlanStateBase::StartState() + { + JumpToRunl( KErrNone ); + } + +// Default implementations for the functions from MWLMNotify don't do anything. +// If a state is interested in the notifications, it should 'activate' notifications +// and override these. + +// ----------------------------------------------------------------------------- +// CWlanStateBase::ConnectionStateChanged +// ----------------------------------------------------------------------------- +// +void CWlanStateBase::ConnectionStateChanged( TWlanConnectionState /* aNewState */ ) + { + DEBUG( "CWlanStateBase::ConnectionStateChanged()" ); + } + +// ----------------------------------------------------------------------------- +// CWlanStartState::CWlanStartState +// ----------------------------------------------------------------------------- +// +CWlanStartState::CWlanStartState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ) : + CWlanStateBase( aWlanSM, aWLMServer ), + iNextState( EWlanAgtNextStateUnknown ) + { + DEBUG( "CWlanStartState constructor" ); + } + +// ----------------------------------------------------------------------------- +// CWlanStartState::RunL +// ----------------------------------------------------------------------------- +// +void CWlanStartState::RunL() + { + if( iWlanSM->WlanSettings()->SSID.Length() == 0 ) + { + PrepareEasyWlanParamsL(); + } + + DEBUG( "CWlanStartState: next state: EWlanAgtNextStateJoin" ); + iNextState = EWlanAgtNextStateJoin; + + iWlanSM->CompleteState( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CWlanStartState::PrepareEasyWlanParamsL +// ----------------------------------------------------------------------------- +// +void CWlanStartState::PrepareEasyWlanParamsL() + { + DEBUG( "CWlanStartState::PrepareEasyWlanParamsL()" ); + TPckgBuf iWep; + TPtr8 wepPtr( &iWep().KeyMaterial[0], KWLMMaxWEPKeyLength ); + TPckgBuf iPsk; + TPtr8 pskPtr( &iPsk().KeyMaterial[0], KWLMMaxWpaPskLength ); + TWLMOverrideSettings overrides; + Mem::FillZ(&overrides, sizeof(overrides)); + + TBuf8 ssid8; + CnvUtfConverter::ConvertFromUnicodeToUtf8( ssid8, iWlanSM->WlanSettings()->UsedSSID ); + + overrides.settingsMask = EOverrideSsidMask; + overrides.ssid.ssidLength = ssid8.Length(); + Mem::Copy(overrides.ssid.ssid, ssid8.Ptr(), overrides.ssid.ssidLength); + + if ( (iWlanSM->WlanSettings())->ConnectionMode == Adhoc ) + { + DEBUG( "CWlanStartState::PrepareEasyWlanParamsL(), conn mode: Adhoc" ); + overrides.settingsMask |= EOverrideIbssMask; + } + + // Set security mode and parameters + switch( iWlanSM->WlanSettings()->SecurityMode ) + { + case AllowUnsecure: + DEBUG( "CWlanStartState::PrepareEasyWlanParamsL(), security mode: Open" ); + break; + case Wep: + DEBUG( "CWlanStartState::PrepareEasyWlanParamsL(), security mode: Wep" ); + overrides.settingsMask |= EOverrideWepMask; + + Mem::Copy(&iWep().KeyMaterial[0], &((iWlanSM->WlanSettings()->WepKey1).KeyMaterial[0]), (iWlanSM->WlanSettings()->WepKey1).KeyLength); + iWep().KeyIndex = (iWlanSM->WlanSettings()->WepKey1).KeyIndex; + iWep().KeyLength = (iWlanSM->WlanSettings()->WepKey1).KeyLength; + + overrides.wep = iWep(); + break; + case Wlan8021x: + case Wpa: + case Wpa2Only: + if ( iWlanSM->WlanSettings()->EnableWpaPsk ) + { + DEBUG1( "CWlanStartState::PrepareEasyWlanParamsL(), security mode: Wpa-psk,len:%d", + iWlanSM->WlanSettings()->WPAKeyLength ); + + overrides.settingsMask |= EOverrideWpaPskMask; + pskPtr.Copy( iWlanSM->WlanSettings()->WPAPreSharedKey ); + iPsk().KeyLength = iWlanSM->WlanSettings()->WPAKeyLength; + + overrides.wpaPsk = iPsk(); + } + else + { + DEBUG( "CWlanStartState::PrepareEasyWlanParamsL(), security mode: Wpa" ); + overrides.settingsMask |= EOverrideWpaMask; + } + break; + default: + DEBUG1( "CWlanStartState::PrepareEasyWlanParamsL(), wrong security mode value in commsdat:%d", + iWlanSM->WlanSettings()->SecurityMode ); + User::LeaveIfError(KErrGeneral); + return; + } + + iWlanSM->SetOverrideSettingsL( overrides ); + } + + +// ----------------------------------------------------------------------------- +// CWlanStartState::NextStateL +// ----------------------------------------------------------------------------- +// +CAgentStateBase* CWlanStartState::NextStateL(TBool aContinue) + { + DEBUG( "CWlanStartState::NextStateL()" ); + + if( aContinue ) + { + switch(iNextState) + { + case EWlanAgtNextStateJoin: + return new (ELeave) CWlanJoinState(iWlanSM, iWLMServer); + case EWlanAgtNextStateOpen: + return new (ELeave) CWlanOpenState(iWlanSM, iWLMServer); + default: + return new(ELeave) CWlanErrorState( iWlanSM, KErrCouldNotConnect ); + } + } + else + { + return new(ELeave) CWlanErrorState( iWlanSM, KErrCouldNotConnect ); + } + } + +// ----------------------------------------------------------------------------- +// CWlanStartState::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlanStartState::DoCancel() + { + } + + +// ----------------------------------------------------------------------------- +// CWlanJoinState::CWlanJoinState +// ----------------------------------------------------------------------------- +// +CWlanJoinState::CWlanJoinState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ) : + CWlanStateBase( aWlanSM, aWLMServer ) + { + DEBUG( "CWlanJoinState constructor" ); + } + +// ----------------------------------------------------------------------------- +// CWlanJoinState::~CWlanJoinState +// ----------------------------------------------------------------------------- +// +CWlanJoinState::~CWlanJoinState() + { + DEBUG( "CWlanJoinState destructor" ); + Cancel(); + if ( iAgtHotSpotClient ) + { + delete iAgtHotSpotClient; + } + } + +// ----------------------------------------------------------------------------- +// CWlanJoinState::StartState +// ----------------------------------------------------------------------------- +// +void CWlanJoinState::StartState() + { + DEBUG( "CWlanJoinState::StartState()" ); + TRAPD( ret, DoStartStateL() ); + if( ret != KErrNone ) + { + iContext = EHotSpotFailure; + JumpToRunl( ret ); + } + } + +// ----------------------------------------------------------------------------- +// CWlanJoinState::DoStartStateL +// ----------------------------------------------------------------------------- +// +void CWlanJoinState::DoStartStateL() + { + DEBUG( "CWlanJoinState::DoStartStateL()" ); + + // check if plug-in is available + TRAPD( ret, iAgtHotSpotClient = CWlanAgtHotSpotClient::NewL() ); + + if ( ret == KErrNone ) + { + DEBUG( "CWlanJoinState::DoStartStateL(), AgtHotSpot plugin available" ); + + //Assume that AP is HotSpot AP. Later if HS Server says its not HS AP, then it will be set as normal AP + iWlanSM->SetHotSpotAP( ETrue ); + + // talk to hotspot server + DEBUG( "CWlanJoinState::DoStartStateL(), Sending Start message to HotSpot Server" ); + iAgtHotSpotClient->HotSpotStart( iWlanSM->IapId(), iStatus ); + iContext = EHotSpotInProgress; + SetActive(); + } + else + { + iAgtHotSpotClient = NULL; + DEBUG( "CWlanJoinState::DoStartStateL(), Couldn't find AgtHotSpot plug-in,defaulting to normal procedure" ); + + iWLMServer.Join( iStatus, iWlanSM->SettingsId(), iWlanSM->OverrideSettings() ); + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// CWlanJoinState::NextStateL +// ----------------------------------------------------------------------------- +// +CAgentStateBase* CWlanJoinState::NextStateL( TBool aContinue ) + { + DEBUG( "CWlanJoinState::NextStateL()" ); + + if( aContinue ) + { + return new (ELeave) CWlanOpenState( iWlanSM, iWLMServer ); + } + else if( iStatus.Int() == KErrWlanConnAlreadyActive ) + { + return new(ELeave) CWlanErrorState( iWlanSM, KErrWlanConnAlreadyActive ); + } + else + { + return new(ELeave) CWlanErrorState( iWlanSM, KErrCouldNotConnect ); + } + } + +// ----------------------------------------------------------------------------- +// CWlanJoinState::RunL +// ----------------------------------------------------------------------------- +// +void CWlanJoinState::RunL() + { + DEBUG1( "CWlanJoinState::RunL(), iStatus = %i", iStatus.Int() ); + + if( iAgtHotSpotClient ) + { + switch( iContext ) + { + case EHotSpotInProgress: + if( iStatus != KErrNone ) + { + if( iStatus == KErrNotSupported ) + { + DEBUG( "CWlanJoinState::RunL(), HotSpot Server returned KErrNotSupported, treating it as normal AP" ); + iWlanSM->SetHotSpotAP( EFalse ); + iContext = EHotSpotNormalAP; + } + else + { + DEBUG( "CWlanJoinState::RunL(), Error returned by HotSpot Server" ); + iContext = EHotSpotFailure; + } + iAgtHotSpotClient->HotSpotCloseConnection( iWlanSM->IapId(), iStatus ); + SetActive(); + } + else + { + // send Join request to WLM server + DEBUG( "CWlanJoinState::RunL(), Sending Join request to Engine" ); + iWLMServer.Join( iStatus, iWlanSM->SettingsId(), iWlanSM->OverrideSettings() ); + iContext = EHotSpotWLMServerHS; + SetActive(); + } + break; + + case EHotSpotWLMServerHS: + if(iStatus != KErrNone) + { + DEBUG( "CWlanJoinState::RunL(), Join failed, Continue trying with HOTSPOT Server" ); + iAgtHotSpotClient->HotSpotStartAgain( iWlanSM->IapId(), iStatus ); + iContext = EHotSpotInProgress; + SetActive(); + } + else + { + DEBUG( "CWlanJoinState::RunL(), Successfully joined to network, CloseConnection will be called from Disconnect State"); + DEBUG( "CWlanJoinState::RunL(), Sending ServiceStarted indication to NIFMAN" ); + iSMObserver->ServiceStarted(); + iWlanSM->CompleteState( KErrNone ); + } + break; + + case EHotSpotNormalAP: + // send Join request to WLM server + DEBUG( "CWlanJoinState::RunL(), Sending Join request to Engine" ); + iWLMServer.Join( iStatus, iWlanSM->SettingsId(), iWlanSM->OverrideSettings() ); + iContext = EHotSpotWLMServerNormal; + SetActive(); + break; + + case EHotSpotWLMServerNormal: + if(iStatus != KErrNone) + { + DEBUG1( "CWlanJoinState::RunL(), Join failed(%d), not retrying with HotSpot Server, as this is normal AP", iStatus.Int() ); + iSMObserver->ConnectionComplete( EAttemptingToJoin, iStatus.Int() ); + } + else + { + DEBUG( "CWlanJoinState::RunL(), Successfully joined to network,Sending ServiceStarted indication to NIFMAN" ); + iSMObserver->ServiceStarted(); + iWlanSM->CompleteState( KErrNone ); + } + break; + + case EHotSpotFailure: + DEBUG( "CWlanJoinState::RunL(), Cancelling the Join operation" ); + iSMObserver->ConnectionComplete( EAttemptingToJoin, KErrCouldNotConnect ); + break; + + default: + DEBUG( "CWlanJoinState::RunL(), Unknown Active Object context, Panicing.." ); + User::Panic( _L("wlanagt"), KErrGeneral ); + break; + } + } + + else + { + //Normal AP + if(iStatus != KErrNone) + { + iSMObserver->ConnectionComplete( EAttemptingToJoin, iStatus.Int() ); + return; + } + else + { + DEBUG( "CWlanJoinState::RunL(), Successfully joined to network" ); + + // Nifman loads the NIF after a ServiceStarted() call + iSMObserver->ServiceStarted(); + iWlanSM->CompleteState( KErrNone ); + } + } + + } + +// CWlanJoinState::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlanJoinState::DoCancel() + { + DEBUG( "CWlanJoinState::DoCancel()" ); + if ( iAgtHotSpotClient ) + { + //Cancel is sent to HSS even if there is no pending request, so that CloseConnection is not + //required to be called seperately + DEBUG( "CWlanJoinState::DoCancel(), Sending Cancel to HotSpot Server" ); + iAgtHotSpotClient->HotSpotCancel( iWlanSM->IapId() ); + } + + // If Join request is sent to Engine, cancel it by sending Release request + if ( !(iAgtHotSpotClient) || iContext == EHotSpotWLMServerHS || + iContext == EHotSpotWLMServerNormal ) + { + DEBUG( "CWlanJoinState::DoCancel(), Sending Release to WLM Server" ); + iWLMServer.Release(); + } + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::CWlanOpenState +// ----------------------------------------------------------------------------- +// +CWlanOpenState::CWlanOpenState( CWlanSM* aWlanSM, RWLMServer& aWLMServer ) : + CWlanStateBase( aWlanSM, aWLMServer ), + iSubState( EWlanOpenSubStateOpening ) + { + DEBUG( "CWlanOpenState constructor" ); + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::StartState +// ----------------------------------------------------------------------------- +// +void CWlanOpenState::StartState() + { + DEBUG( "CWlanOpenState::StartState()" ); + TRAPD( ret, DoStartStateL() ); + JumpToRunl( ret ); + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::DoStartStateL +// ----------------------------------------------------------------------------- +// +void CWlanOpenState::DoStartStateL() + { + DEBUG( "CWlanOpenState::DoStartStateL()" ); + + // @to do: whether this callback system is needed anymore or not, + // should be checked. + + // Create a callback for handling the "disconnect" notification from + // WLM. We must use async callback to avoid deleting iNotify of RWLMServer + // "too early" (ConnectionStateChanged() notification call from WLM must + // not result to calling CancelNotifies() of RWLMServer synchronously). + TCallBack callback( DisconnectCb, this ); + iDisconnectCb = new (ELeave) CAsyncCallBack( callback, CActive::EPriorityStandard ); + + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::NextStateL +// ----------------------------------------------------------------------------- +// +CAgentStateBase* CWlanOpenState::NextStateL( TBool /*aContinue*/ ) + { + DEBUG( "CWlanOpenState::NextStateL(), calling RWLMServer::CancelNotifies()" ); + iWLMServer.CancelNotifies(); + return new (ELeave) CWlanDisconnectState( iWlanSM, iWLMServer ); + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::RunL +// ----------------------------------------------------------------------------- +// +void CWlanOpenState::RunL() + { + DEBUG( "CWlanOpenState::RunL()" ); + + switch( iSubState ) + { + case EWlanOpenSubStateOpening: + if( iStatus != KErrNone ) + { + iSMObserver->ConnectionComplete( EOpeningConnection, iStatus.Int() ); + return; + } + DEBUG( "CWlanOpenState::RunL(), Connection Complete with KErrNone" ); + iSMObserver->ConnectionComplete( KConnectionOpen, KErrNone ); + iSubState = EWlanOpenSubStateOpened; + + DEBUG( "CWlanOpenState::RunL(), calling RWLMServer::ActivateNotifiesL()" ); + iWLMServer.ActivateNotifiesL( *this, EWlmNotifyConnectionStateChanged ); + break; + case EWlanOpenSubStateOpened: + User::Panic( _L("wlanagt"), KErrGeneral ); + break; + default: + User::Panic( _L("wlanagt"), KErrGeneral ); + break; + } + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlanOpenState::DoCancel() + { + DEBUG( "CWlanOpenState::DoCancel()" ); + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::DisconnectCb +// ----------------------------------------------------------------------------- +// +TInt CWlanOpenState::DisconnectCb( TAny* aThisPtr ) + { + DEBUG( "CCWlanOpenState::DisconnectCb()" ); + + CWlanOpenState* self = static_cast( aThisPtr ); + + // Send a "vendor specific" notification to wlannif. This is the only + // agent-to-nif notification we use, and always means that interface should + // be stopped. + self->iSMObserver->Notification( EAgentToNifEventVendorSpecific, NULL ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::ConnectionStateChanged +// ----------------------------------------------------------------------------- +// +void CWlanOpenState::ConnectionStateChanged( TWlanConnectionState aNewState ) + { + DEBUG1( "CWlanOpenState::ConnectionStateChanged(), new state %i", aNewState ); + + // EWlanStateNotConnected is the only connection state we are interested in. + if( aNewState == EWlanStateNotConnected ) + { + DEBUG( "CWlanOpenState::ConnectionStateChanged(), calling iDisconnectCb->CallBack()" ); + + iDisconnectCb->CallBack(); + } + } + +// ----------------------------------------------------------------------------- +// CWlanOpenState::~CWlanOpenState +// ----------------------------------------------------------------------------- +// +CWlanOpenState::~CWlanOpenState() + { + DEBUG( "CWlanOpenState destructor" ); + delete iDisconnectCb; + } + +// ----------------------------------------------------------------------------- +// CWlanDisconnectState::CWlanDisconnectState +// ----------------------------------------------------------------------------- +// +CWlanDisconnectState::CWlanDisconnectState(CWlanSM* aWlanSM, RWLMServer& aWLMServer) : + CWlanStateBase(aWlanSM, aWLMServer) + { + DEBUG( "CWlanDisconnectState constructor" ); + } + +// ----------------------------------------------------------------------------- +// CWlanDisconnectState::~CWlanDisconnectState +// ----------------------------------------------------------------------------- +// +CWlanDisconnectState::~CWlanDisconnectState() + { + DEBUG( "CWlanDisconnectState destructor" ); + Cancel(); + if ( iAgtHotSpotClient ) + { + delete iAgtHotSpotClient; + } + } + +// ----------------------------------------------------------------------------- +// CWlanDisconnectState::StartState +// ----------------------------------------------------------------------------- +// +void CWlanDisconnectState::StartState() + { + DEBUG( "CWlanDisconnectState::StartState()" ); + // check if plug-in is available + TRAPD( ret, iAgtHotSpotClient = CWlanAgtHotSpotClient::NewL() ); + + if( ret == KErrNone ) + { + DEBUG( "CWlanDisconnectState::StartState(), AgtHotSpot plugin is available" ); + + if ( iWlanSM->IsHotSpotAP() ) + { + // talk to hospot server + DEBUG( "CWlanDisconnectState::StartState(), Sending CloseConnection message to HotSpot Server" ); + iAgtHotSpotClient->HotSpotCloseConnection( iWlanSM->IapId(), iStatus ); + SetActive(); + return; + } + } + else + { + iAgtHotSpotClient = NULL; + } + JumpToRunl( KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CWlanDisconnectState::NextStateL +// ----------------------------------------------------------------------------- +// +CAgentStateBase* CWlanDisconnectState::NextStateL( TBool /*aContinue*/ ) + { + DEBUG( "CWlanDisconnectState::NextStateL()" ); + return new (ELeave) CWlanDisconnectState( iWlanSM, iWLMServer ); + } + +// ----------------------------------------------------------------------------- +// CWlanDisconnectState::RunL +// ----------------------------------------------------------------------------- +// +void CWlanDisconnectState::RunL() + { + DEBUG( "CWlanDisconnectState::RunL()" ); + iSMObserver->UpdateProgress( EDisconnecting, KErrNone ); + DEBUG( "CWlanDisconnectState::RunL(), calling RWLMServer::Release()" ); + + // Only call iWLMServer.Release() and assume that disconnect is complete. + iWLMServer.Release(); + iSMObserver->DisconnectComplete(); + } + +// ----------------------------------------------------------------------------- +// CWlanDisconnectState::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlanDisconnectState::DoCancel() + { + DEBUG( "CWlanDisconnectState::DoCancel()" ); + if( iAgtHotSpotClient ) + { + iAgtHotSpotClient->HotSpotCancel( iWlanSM->IapId() ); + } + } + +// ----------------------------------------------------------------------------- +// CWlanErrorState::CWlanErrorState +// ----------------------------------------------------------------------------- +// +// CWlanErrorState +// +// "Dummy state" that only reports an error. +// Currently only used when the CWlanSM cannot be constructed properly. +// +CWlanErrorState::CWlanErrorState( CWlanSM* aWlanSM, TInt aError ) : + CAgentStateBase( *aWlanSM ), + iWlanSM( aWlanSM ), + iError( aError ) + { + DEBUG( "CWlanErrorState constructor" ); + } + +// ----------------------------------------------------------------------------- +// CWlanErrorState::StartState +// ----------------------------------------------------------------------------- +// +void CWlanErrorState::StartState() + { + DEBUG( "CWlanErrorState::StartState()" ); + JumpToRunl( KErrNone ); + } + +// ----------------------------------------------------------------------------- +// CWlanErrorState::NextStateL +// ----------------------------------------------------------------------------- +// +CAgentStateBase* CWlanErrorState::NextStateL( TBool /*aContinue*/ ) + { + DEBUG( "CWlanErrorState::NextStateL()" ); + return new (ELeave) CWlanErrorState( iWlanSM, iError ); + } + +// ----------------------------------------------------------------------------- +// CWlanErrorState::RunL +// ----------------------------------------------------------------------------- +// +void CWlanErrorState::RunL() + { + DEBUG( "CWlanErrorState::RunL()" ); + iWlanSM->CompleteState( iError ); + } + +// ----------------------------------------------------------------------------- +// CWlanErrorState::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlanErrorState::DoCancel() + { + DEBUG( "CWlanErrorState::DoCancel" ); + } + +// ----------------------------------------------------------------------------- +// CWlanWaitConnectionState::CWlanWaitConnectionState +// ----------------------------------------------------------------------------- +// +CWlanWaitConnectionState::CWlanWaitConnectionState( + CWlanSM* aWlanSM, + RWLMServer& aWLMServer ) : + CWlanStateBase( aWlanSM, aWLMServer ) + { + DEBUG( "CWlanWaitConnectionState::CWlanWaitConnectionState()" ); + } + +// ----------------------------------------------------------------------------- +// CWlanWaitConnectionState::~CWlanWaitConnectionState +// ----------------------------------------------------------------------------- +// +CWlanWaitConnectionState::~CWlanWaitConnectionState() + { + DEBUG( "CWlanWaitConnectionState::~CWlanWaitConnectionState()" ); + iTimer.Close(); + } + +// ----------------------------------------------------------------------------- +// CWlanWaitConnectionState::StartState +// ----------------------------------------------------------------------------- +// +void CWlanWaitConnectionState::StartState() + { + DEBUG( "CWlanWaitConnectionState::StartState()" ); + + DEBUG1( "CWlanWaitConnectionState::StartState() - setting the timer to %u microseconds", + KConnectionEndWaitTime ); + + TInt ret = iTimer.CreateLocal(); + if ( ret != KErrNone ) + { + DEBUG1( "CWlanWaitConnectionState::StartState() - unable to create the timer (%d)", + ret ); + + JumpToRunl( ret ); + } + + iTimer.After( iStatus, KConnectionEndWaitTime ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CWlanWaitConnectionState::NextStateL +// ----------------------------------------------------------------------------- +// +CAgentStateBase* CWlanWaitConnectionState::NextStateL(TBool aContinue) + { + DEBUG( "CWlanWaitConnectionState::NextStateL()" ); + DEBUG1( "CWlanWaitConnectionState::NextStateL() - aContinue %u", + aContinue ); + + if( aContinue ) + { + return new (ELeave) CWlanStartState( iWlanSM, iWLMServer ); + } + + return new (ELeave) CWlanErrorState( iWlanSM, KErrWlanConnAlreadyActive ); + } + +// ----------------------------------------------------------------------------- +// CWlanWaitConnectionState::RunL +// ----------------------------------------------------------------------------- +// +void CWlanWaitConnectionState::RunL() + { + DEBUG( "CWlanWaitConnectionState::RunL()" ); + DEBUG1( "CWlanWaitConnectionState::RunL() - iStatus %d" , iStatus.Int() ); + + if ( iStatus.Int()!= KErrNone ) + { + iSMObserver->ConnectionComplete( EAttemptingToJoin, iStatus.Int() ); + } + else + { + TWlanConnectionState state = iWLMServer.GetConnectionState(); + + DEBUG1( "CWlanWaitConnectionState::RunL() - WLAN engine state is %u", + state ); + + if ( state != EWlanStateNotConnected ) + { + DEBUG( "CWlanWaitConnectionState::RunL() - connection is still open" ); + DEBUG( "CWlanWaitConnectionState::RunL() - completing request with KErrWlanConnAlreadyActive" ); + + iSMObserver->ConnectionComplete( EAttemptingToJoin, KErrWlanConnAlreadyActive ); + } + else + { + DEBUG( "CWlanWaitConnectionState::RunL() - connection has closed, continuing with request" ); + iWlanSM->CompleteState( KErrNone ); + } + } + } + +// ----------------------------------------------------------------------------- +// CWlanWaitConnectionState::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlanWaitConnectionState::DoCancel() + { + DEBUG( "CWlanWaitConnectionState::DoCancel()" ); + iTimer.Cancel(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/bwins/wlandbifU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/bwins/wlandbifU.DEF Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,29 @@ +EXPORTS + ??0CLanSettings@@QAE@XZ @ 1 NONAME ; CLanSettings::CLanSettings(void) + ??0CWLanSettings@@QAE@XZ @ 2 NONAME ; CWLanSettings::CWLanSettings(void) + ??1CLanSettings@@UAE@XZ @ 3 NONAME ; CLanSettings::~CLanSettings(void) + ??1CWLanSettings@@UAE@XZ @ 4 NONAME ; CWLanSettings::~CWLanSettings(void) + ?AddWlanTableL@CWLanSettings@@QAEXXZ @ 5 NONAME ; void CWLanSettings::AddWlanTableL(void) + ?Connect@CLanSettings@@QAEHXZ @ 6 NONAME ; int CLanSettings::Connect(void) + ?Connect@CWLanSettings@@QAEHXZ @ 7 NONAME ; int CWLanSettings::Connect(void) + ?DeleteLanSettings@CLanSettings@@QAEHK@Z @ 8 NONAME ; int CLanSettings::DeleteLanSettings(unsigned long) + ?DeleteWlanSettings@CWLanSettings@@QAEHK@Z @ 9 NONAME ; int CWLanSettings::DeleteWlanSettings(unsigned long) + ?DeleteWlanSettingsForService@CWLanSettings@@QAEHK@Z @ 10 NONAME ; int CWLanSettings::DeleteWlanSettingsForService(unsigned long) + ?Disconnect@CLanSettings@@QAEXXZ @ 11 NONAME ; void CLanSettings::Disconnect(void) + ?Disconnect@CWLanSettings@@QAEXXZ @ 12 NONAME ; void CWLanSettings::Disconnect(void) + ?GetEapDataL@CWLanSettings@@QAEXAAV?$RPointerArray@U_TEap@@@@@Z @ 13 NONAME ; void CWLanSettings::GetEapDataL(class RPointerArray &) + ?GetFirstSettings@CWLanSettings@@QAEHAAUSWLANSettings@@@Z @ 14 NONAME ; int CWLanSettings::GetFirstSettings(struct SWLANSettings &) + ?GetIAPWlanServicesL@CWLanSettings@@QAEXAAV?$RArray@USWlanIAPId@@@@@Z @ 15 NONAME ; void CWLanSettings::GetIAPWlanServicesL(class RArray &) + ?GetLanSettings@CLanSettings@@QAEHKAAUSLanSettings@@@Z @ 16 NONAME ; int CLanSettings::GetLanSettings(unsigned long, struct SLanSettings &) + ?GetNextSettings@CWLanSettings@@QAEHAAUSWLANSettings@@@Z @ 17 NONAME ; int CWLanSettings::GetNextSettings(struct SWLANSettings &) + ?GetSecondarySsidsForService@CWLanSettings@@QAEHKAAV?$RArray@UTWlanSecondarySsid@@@@@Z @ 18 NONAME ; int CWLanSettings::GetSecondarySsidsForService(unsigned long, class RArray &) + ?GetWlanSettings@CWLanSettings@@QAEHKAAUSWLANSettings@@@Z @ 19 NONAME ; int CWLanSettings::GetWlanSettings(unsigned long, struct SWLANSettings &) + ?GetWlanSettingsForService@CWLanSettings@@QAEHKAAUSWLANSettings@@@Z @ 20 NONAME ; int CWLanSettings::GetWlanSettingsForService(unsigned long, struct SWLANSettings &) + ?IsEasyWlan@CWLanSettings@@QAEHIAAH@Z @ 21 NONAME ; int CWLanSettings::IsEasyWlan(unsigned int, int &) + ?SetEapDataL@CWLanSettings@@QAEXABV?$RPointerArray@U_TEap@@@@@Z @ 22 NONAME ; void CWLanSettings::SetEapDataL(class RPointerArray const &) + ?WriteLanSettings@CLanSettings@@QAEHAAUSLanSettings@@@Z @ 23 NONAME ; int CLanSettings::WriteLanSettings(struct SLanSettings &) + ?WriteWlanSettings@CWLanSettings@@QAEHAAUSWLANSettings@@@Z @ 24 NONAME ; int CWLanSettings::WriteWlanSettings(struct SWLANSettings &) + ?GetEapDataL@CWLanSettings@@QAEXAAV?$RPointerArray@USEapExpandedType@@@@0@Z @ 25 NONAME ; void CWLanSettings::GetEapDataL(class RPointerArray &, class RPointerArray &) + ?SetEapDataL@CWLanSettings@@QAEXAAV?$RPointerArray@USEapExpandedType@@@@0@Z @ 26 NONAME ; void CWLanSettings::SetEapDataL(class RPointerArray &, class RPointerArray &) + ?GetWlanSettingsForIap@CWLanSettings@@QAEHKAAUSWLANSettings@@@Z @ 27 NONAME ; int CWLanSettings::GetWlanSettingsForIap(unsigned long, struct SWLANSettings &) + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/eabi/wlandbifU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/eabi/wlandbifU.DEF Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,35 @@ +EXPORTS + _ZN12CLanSettings10DisconnectEv @ 1 NONAME + _ZN12CLanSettings14GetLanSettingsEmR12SLanSettings @ 2 NONAME + _ZN12CLanSettings16WriteLanSettingsER12SLanSettings @ 3 NONAME + _ZN12CLanSettings17DeleteLanSettingsEm @ 4 NONAME + _ZN12CLanSettings7ConnectEv @ 5 NONAME + _ZN12CLanSettingsC1Ev @ 6 NONAME + _ZN12CLanSettingsC2Ev @ 7 NONAME + _ZN12CLanSettingsD0Ev @ 8 NONAME + _ZN12CLanSettingsD1Ev @ 9 NONAME + _ZN12CLanSettingsD2Ev @ 10 NONAME + _ZN13CWLanSettings10DisconnectEv @ 11 NONAME + _ZN13CWLanSettings10IsEasyWlanEjRi @ 12 NONAME + _ZN13CWLanSettings11GetEapDataLER13RPointerArrayI5_TEapE @ 13 NONAME + _ZN13CWLanSettings11SetEapDataLERK13RPointerArrayI5_TEapE @ 14 NONAME + _ZN13CWLanSettings13AddWlanTableLEv @ 15 NONAME + _ZN13CWLanSettings15GetNextSettingsER13SWLANSettings @ 16 NONAME + _ZN13CWLanSettings15GetWlanSettingsEmR13SWLANSettings @ 17 NONAME + _ZN13CWLanSettings16GetFirstSettingsER13SWLANSettings @ 18 NONAME + _ZN13CWLanSettings17WriteWlanSettingsER13SWLANSettings @ 19 NONAME + _ZN13CWLanSettings18DeleteWlanSettingsEm @ 20 NONAME + _ZN13CWLanSettings19GetIAPWlanServicesLER6RArrayI10SWlanIAPIdE @ 21 NONAME + _ZN13CWLanSettings25GetWlanSettingsForServiceEmR13SWLANSettings @ 22 NONAME + _ZN13CWLanSettings27GetSecondarySsidsForServiceEmR6RArrayI18TWlanSecondarySsidE @ 23 NONAME + _ZN13CWLanSettings28DeleteWlanSettingsForServiceEm @ 24 NONAME + _ZN13CWLanSettings7ConnectEv @ 25 NONAME + _ZN13CWLanSettingsC1Ev @ 26 NONAME + _ZN13CWLanSettingsC2Ev @ 27 NONAME + _ZN13CWLanSettingsD0Ev @ 28 NONAME + _ZN13CWLanSettingsD1Ev @ 29 NONAME + _ZN13CWLanSettingsD2Ev @ 30 NONAME + _ZN13CWLanSettings11GetEapDataLER13RPointerArrayI16SEapExpandedTypeES3_ @ 31 NONAME + _ZN13CWLanSettings11SetEapDataLER13RPointerArrayI16SEapExpandedTypeES3_ @ 32 NONAME + _ZN13CWLanSettings21GetWlanSettingsForIapEmR13SWLANSettings @ 33 NONAME + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project WLAN DBIF +* +*/ + +/* +* %version: 10 % +*/ + +#include + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_EXPORTS +// Internal exports +../inc/wdbifwlandefs.h |../../inc/wdbifwlandefs.h + +// DOMAIN EXPORTS + +// Export iby file +../rom/wlandbif.iby CORE_OS_LAYER_IBY_EXPORT_PATH(wlandbif.iby) + +PRJ_MMPFILES +wlandbif.mmp // WLAN & LAN commsdat interface classes diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/group/wlandbif.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/group/wlandbif.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project WLAN DBIF +* +*/ + +/* +* %version: 10 % +*/ + +#include + +TARGET wlandbif.dll +TARGETTYPE dll + +UID 0x1000008d 0x101FD699 + +CAPABILITY ALL -Tcb +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wdbifwlansettings.cpp +SOURCE wdbiflansettings.cpp + +USERINCLUDE ../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY commsdat.lib +LIBRARY commdb.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/inc/gendebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/inc/gendebug.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: debug trace utility header +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef GENDEBUG_H +#define GENDEBUG_H + +#include + +/** @file gendebug.h + @brief Common helper file for debugging. + + The file contains methods for adding traces and hardcoded breakpoint. + + @page page1 A documentation for general helper module for doing debugging and tracing. + + @subsection subsec1 This subsection describes the usage of hardcoded breakpoints. + + Hardcoded breakpoints are usefull for allowing the execution to stop in right places + without bringing the OS down like using general assertions would do. Hardcoded breakpoints + must be used together with debugger. The hardcoded breakpoints are used by inserting + macro _DBG_MUST_BREAK into source code. + + @note This feature has not been implemented yet. + + @subsection subsec2 This subsection describes the usage of trace utilities. + + Tracing is the most important way of doing HW level debugging (after looking the source of course). + Most of times users don't have access to debuggers and doing debugging in the field can be greatly + improved if there are great variety of configurable traces available. + + In order to use the macro in kernel space, ALWAYS_KERNEL must be defined in the MMP-file of the module. + + To use static tracing the module using these utilities must have defined DEBUG_LEVEL (this is integer constant) in + MMP-file. This constant defines the bit-mask for the set of traces, which are put into code at the compile time. See + the macro definitions for details. + + The other way to do tracing is to use run-time tracing, which requires from user to put class member variable iDbgLevel + into their class. This variable is used the same way as the static flag by using bit-mask to define enabled traces. See + the macro definitions for details. +*/ + +#if defined(_DEBUG) +#define _DBG_MUST_BREAK +#else +#define _DBG_MUST_BREAK +#endif + +/** Critical trace-level is used when system is about to down very soon because of critical error. + In most cases this trace level can be replaced by using assert with trace but in some cases + more information can be provided by using this debug level +*/ +#define CRIT_LEVEL 0x00000001 + +/** Serious trace-level is used when something bad and unexpected has happened but system might be + able to recover. In another words, software is not going to bring system forcefully down but + that's exactly what might happen due to an error. +*/ +#define SERIOUS_LEVEL 0x00000002 + +/* Error level is used to trace various errors, which are due to legal errors in normal operation. */ +#define ERROR_LEVEL 0x00000004 + +/* Warning level is used to trace various warning, which are due to abnormal behaviour. */ +#define WARNING_LEVEL 0x00000008 + +/* Info level is used to trace all general information. */ +#define INFO_LEVEL 0x00000010 + +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_1 0x000010000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_2 0x000020000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_3 0x000040000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_4 0x000080000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_5 0x000100000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_6 0x000200000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_7 0x000400000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_8 0x000800000 + +#define DEVICE_1_MASK 0x0000f000 +#define DEVICE_2_MASK 0x000f0000 +#define DEVICE_3_MASK 0x00f00000 +#define DEVICE_4_MASK 0x0f000000 + +// Override debug-level definition for your own in MMP file +#ifndef DEBUG_LEVEL +//#define DEBUG_LEVEL 0 +#define DEBUG_LEVEL WARNING_LEVEL +//#define DEBUG_LEVEL WARNING_LEVEL | ERROR_LEVEL +#endif + +#pragma warning(disable : 4127) // conditional expression is constant + +#if defined(_DEBUG) || defined(TRACES) + +// Do not directly use this macro +//lint -emacro({717}, UtilDump) do while(0) +//lint -emacro({774}, UtilDump) conditional expression is constant +#define UtilDump(PFUNCTION,SRCLEVEL,TRGLEVEL,STRING) \ + do { \ + TUint32 _level = (TRGLEVEL); \ + if (SRCLEVEL & _level) { \ + PFUNCTION STRING; \ + } \ + } while (0) + + +#if defined __MOMAP15XX__ || defined ALWAYS_KERNEL + +/** Macro for static tracing. + The first parameters defines the trace level set where this trace belongs to + and the second parameter contains the trace string used in ordinary RDebug::Print + command. Example: + TraceDump(INFO_LEVEL,(_L("My %d trace",1))); + */ + +#define TraceDump(LEVEL,STRING) UtilDump(Kern::Printf,DEBUG_LEVEL,LEVEL,STRING) + + +/** Macro for dynamic tracing. + The first parameters defines the trace level set where this trace belongs to + and the second parameter contains the trace string used in ordinary RDebug::Print + command. Example: + TraceDump(INFO_LEVEL,(_L("My %d trace",1))); + */ + +#define RTraceDump(LEVEL,STRING) UtilDump(Kern::Printf,iDbgLevel,LEVEL,STRING) +#else +#define TraceDump(LEVEL,STRING) UtilDump(RDebug::Print,DEBUG_LEVEL,LEVEL,STRING) +#define RTraceDump(LEVEL,STRING) UtilDump(RDebug::Print,iDbgLevel,LEVEL,STRING) +#endif // __MOMAP15XX__ || ALWAYS_KERNEL + +#else +//lint -emacro({717}, TraceDump) do while(0) +#define TraceDump(LEVEL,STRING) do {} while (0) +//lint -emacro({717}, RTraceDump) do while(0) +#define RTraceDump(LEVEL,STRING) do {} while (0) +#endif // _DEBUG + +#endif // GENDEBUG_H + +// End of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/inc/wdbifwlandefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/inc/wdbifwlandefs.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Custom CommsDat id's for WLANServiceTable +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WDBIFDEFS_H +#define WDBIFDEFS_H + +// CONSTANTS + +#define WLAN_SECONDARY_SSID _S("SecondarySSID") + +#define WLAN_SEC_SSID_SERVICE_ID _S("ServiceId") +#define WLAN_SEC_SSID_NAME _S("SecSSIDName") +#define WLAN_SEC_SSID_SCANNED_SSID _S("ScannedSSID") +#define WLAN_SEC_SSID_USED_SSID _S("UsedSSID") +#define WLAN_SEC_SSID_ID _S("SecSSIDID") +#define KWlanUserSettings 1 +#define WLAN_DEVICE_SETTINGS _S("WLANDeviceTable") +#define WLAN_DEVICE_SETTINGS_TYPE _S("WlanDeviceSettingsType") +#define WLAN_BG_SCAN_INTERVAL _S("WlanBgScanInterval") + +const TMDBElementId KCDTIdWlanServiceId = 0x00030000; //EUint32 +const TMDBElementId KCDTIdWlanConnMode = 0x00040000; //EUint32 + +const TMDBElementId KCDTIdWlanSSID = 0x00050000; //EText +const TMDBElementId KCDTIdWlanWepKey1 = 0x00060000; //EDesC8 +const TMDBElementId KCDTIdWlanWepKey2 = 0x00070000; //EDesC8 +const TMDBElementId KCDTIdWlanWepKey3 = 0x00080000; //EDesC8 +const TMDBElementId KCDTIdWlanWepKey4 = 0x00090000; //EDesC8 +const TMDBElementId KCDTIdWlanWepIndex = 0x000A0000; //EUint32 +const TMDBElementId KCDTIdWlanSecMode = 0x000B0000; //EUint32 +const TMDBElementId KCDTIdWlanAuthMode = 0x000C0000; //EUint32 +const TMDBElementId KCDTIdWlanEnableWpaPsk = 0x000D0000; //EUint32 +const TMDBElementId KCDTIdWlanWpaPreSharedKey = 0x000E0000; //EDesC8 +const TMDBElementId KCDTIdWlanFormatKey1 = 0x00140000; //EUint32 + +const TMDBElementId KCDTIdWlanWpaKeyLength = 0x000F0000; //EUint32 +const TMDBElementId KCDTIdWlanEaps = 0x00100000; //ELongText + +const TMDBElementId KCDTIdWlanScanSSID = 0x00110000; //EBool +const TMDBElementId KCDTIdWlanChannelID = 0x00120000; //EUint32 +const TMDBElementId KCDTIdWlanUsedSSID = 0x00130000; //EText + +const TMDBElementId KCDTIdWlanEapsExtEnabled = 0x00190000; //EDesC8 +const TMDBElementId KCDTIdWlanEapsExtDisabled = 0x001A0000; //EDesC8 + +#endif // WDBIFDEFS_H + +// end of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/rom/wlandbif.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/rom/wlandbif.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project wlandbif_cd. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANDBIF_IBY +#define WLANDBIF_IBY +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\WLANDBIF.dll SHARED_LIBS_DIR\WLANDBIF.dll + +#endif // __PROTOCOL_WLAN +#endif // WLANDBIF_IBY + +// end of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/src/wdbiflansettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/src/wdbiflansettings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles the LANService table in CommsDat +* +*/ + +/* +* %version: 3 % +*/ + +// INCLUDE FILES +#include + +#include "wdbiflansettings.h" +#include "gendebug.h" + +// --------------------------------------------------------- +// Class CLanSettings +// --------------------------------------------------------- + +// MEMBER FUNCTIONS + +// --------------------------------------------------------- +// CLanSettings::CLanSettings() +// C++ default constructor can NOT contain any code, that +// might leave +// --------------------------------------------------------- +EXPORT_C CLanSettings::CLanSettings() : iLANServiceRecord( NULL), iDBSession( NULL) + { + + } + +// Destructor +// +EXPORT_C CLanSettings::~CLanSettings() + { + delete iDBSession; + delete iLANServiceRecord; + } + +// --------------------------------------------------------- +// TInt CLanSettings::Connect() +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CLanSettings::Connect() + { + TraceDump(WARNING_LEVEL,_L("CLanSettings::Connect()")); + + TRAPD(err,DoConnectL()); + return err; + } + +// --------------------------------------------------------- +// TInt CLanSettings::Disconnect() +// --------------------------------------------------------- +// +EXPORT_C void CLanSettings::Disconnect() + { + TraceDump(WARNING_LEVEL,_L("CLanSettings::Disconnect()")); + + delete iDBSession; + iDBSession = NULL; + + delete iLANServiceRecord; + iLANServiceRecord = NULL; + } + + + +// --------------------------------------------------------- +// TInt CLanSettings::GetLanSettings( TUint32 aId,SLanSettings &aSettings) +// returns KErrNone on success, LAN settings in aSettings +// --------------------------------------------------------- +// +EXPORT_C TInt CLanSettings::GetLanSettings( TUint32 aId,SLanSettings &aSettings) + { + TraceDump(WARNING_LEVEL,_L("CLanSettings::GetLanSettings()")); + + if( iLANServiceRecord) + { + delete iLANServiceRecord; + iLANServiceRecord = NULL; + } + + TRAPD( err, iLANServiceRecord = static_cast( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord))); + + if( !err) + { + iLANServiceRecord->SetRecordId( aId); + TRAP( err, iLANServiceRecord->LoadL( *iDBSession)); + + if( !err) + { + aSettings.Name = iLANServiceRecord->iRecordName; + aSettings.Id = iLANServiceRecord->RecordId(); + aSettings.AddrFromServer = iLANServiceRecord->iIpAddrFromServer; + aSettings.Addr = iLANServiceRecord->iIpAddr; + } + } + return err; + } + + + +// --------------------------------------------------------- +// TInt CLanSettings::WriteLanSettings( SLanSettings &aSettings) +// returns KErrNone on success, writes LAN settings from aSettings +// --------------------------------------------------------- +// +EXPORT_C TInt CLanSettings::WriteLanSettings( SLanSettings &aSettings) + { + TraceDump(WARNING_LEVEL,_L("CLanSettings::WriteLanSettings()")); + + if( iLANServiceRecord) + { + delete iLANServiceRecord; + iLANServiceRecord = NULL; + } + + TRAPD( err, iLANServiceRecord = static_cast( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord))); + + if( !err) + { + if( aSettings.Id) // updating existing + { + iLANServiceRecord->SetRecordId( aSettings.Id); + TRAP( err, iLANServiceRecord->LoadL( *iDBSession)); + if( err) + { + return err; + } + } + + TRAP( err, iLANServiceRecord->iRecordName.SetL( aSettings.Name)); + if( err) + { + return err; + } + TRAP( err, iLANServiceRecord->iIpAddrFromServer.SetL( aSettings.AddrFromServer)); + if( err) + { + return err; + } + TRAP( err, iLANServiceRecord->iIpAddr.SetL( aSettings.Addr)); + if( err) + { + return err; + } + + if( aSettings.Id == 0) // create new + { + iLANServiceRecord->SetRecordId( KCDNewRecordRequest); + TRAP( err, iLANServiceRecord->StoreL( *iDBSession)); + aSettings.Id = iLANServiceRecord->RecordId(); // return new id to caller + } + else + { + TRAP( err, iLANServiceRecord->ModifyL( *iDBSession)); + } + + } + + return err; + } + + +// --------------------------------------------------------- +// TInt CLanSettings::DeleteLanSettings( TUint32 aId) +// returns KErrNone on success, deletes LANService record with ID aId +// --------------------------------------------------------- +// +EXPORT_C TInt CLanSettings::DeleteLanSettings( TUint32 aId) + { + TraceDump(WARNING_LEVEL,_L("CLanSettings::DeleteLanSettings()")); + + if( iLANServiceRecord) + { + delete iLANServiceRecord; + iLANServiceRecord = NULL; + } + + TRAPD( err, iLANServiceRecord = static_cast( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord))); + + if( !err) + { + iLANServiceRecord->SetRecordId( aId); + TRAP( err, iLANServiceRecord->DeleteL( *iDBSession)); + } + return err; + + } + +// +// L-methods called and trapped by the public non-leaving methods +// + +// --------------------------------------------------------- +// void CLanSettings::DoConnectL() +// Connects to the CommsDat storage server +// --------------------------------------------------------- +// +void CLanSettings::DoConnectL() + { + TraceDump(ERROR_LEVEL,_L("CLanSettings::DoConnectL()")); + + if( !iDBSession) + { + iDBSession = CMDBSession::NewL( KCDCurrentVersion); + } + + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlandbif_cd/src/wdbifwlansettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlandbif_cd/src/wdbifwlansettings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1320 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles the custom WLANServiceTable in CommsDat +* +*/ + +/* +* %version: 12 % +*/ + +// INCLUDE FILES + +#include +#include +#include +#include "wdbifwlansettings.h" +#include "wdbifwlandefs.h" +#include "gendebug.h" + +// LOCAL CONSTANTS + +_LIT( KGenericTable, "WLANServiceTable"); + +const int KMaxEapDataBufLength = 128; +const int KOldStyleMaxEapTypeValue = 100; + +// --------------------------------------------------------- +// Class CWlanSettings +// --------------------------------------------------------- + +// MEMBER FUNCTIONS + +// ----------------------------------------------------------------------------- +// CWLanSettings::CWLanSettings() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C CWLanSettings::CWLanSettings() : iCurrentRecord( KErrNotFound), + iWLANRecord( 0), + iDBSession( 0) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::CWlanSettings()"))); + } + +// Destructor +// +EXPORT_C CWLanSettings::~CWLanSettings() + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::~CWlanSettings()"))); + delete iDBSession; + delete iWLANRecord; + } + +// --------------------------------------------------------- +// TInt CWLanSettings::Connect() +// Connects to the CommsDat storage server +// Wraps around leavable function DoConnectL +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::Connect() + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::Connect"))); + + TRAPD(err,DoConnectL()); + return err; + } + +// --------------------------------------------------------- +// void CWLanSettings::Disconnect() +// Disconnects from the CommsDat storage server +// --------------------------------------------------------- +// +EXPORT_C void CWLanSettings::Disconnect() + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::Disconnect"))); + + delete iDBSession; + iDBSession = NULL; + + delete iWLANRecord; + iWLANRecord = NULL; + + iCurrentRecord = KErrNotFound; + } + +// --------------------------------------------------------- +// void CWLanSettings::GetDataL( SWLANSettings& aSettings) +// Reads data from a WLANServiceTable record which has previously +// been fetched (= current record) from the CommsDat. +// returns settings in aSettings +// --------------------------------------------------------- +// +void CWLanSettings::GetDataL( SWLANSettings& aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL start"))); + + ClearWepKeys( aSettings); + + aSettings.Id = iWLANRecord->RecordId(); + + aSettings.Name = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdRecordName)); + + aSettings.ServiceID = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanServiceId)); + + aSettings.ConnectionMode = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanConnMode)); + + aSettings.SSID = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanSSID)); + + // new + aSettings.UsedSSID = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanUsedSSID)); + + aSettings.ScanSSID = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanScanSSID)); + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL ScanSSID = %d"),aSettings.ScanSSID)); + + aSettings.ChannelID = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanChannelID)); + // end new + + aSettings.AuthenticationMode = EWepAuthModeOpen; // defaults to open (in case of wep, the value will be read from db later) + aSettings.EnableWpaPsk = EFalse; + aSettings.WPAKeyLength = 0; + + aSettings.SecurityMode = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanSecMode)); + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL, SecurityMode = %d"),aSettings.SecurityMode)); + + if( aSettings.SecurityMode == Wep) + { + // authentication mode can be != open only when WEP in use + aSettings.AuthenticationMode = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)); + + aSettings.WepIndex = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWepIndex)); + ReadWepKeysL(aSettings); + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL, Wep keys succesfully read"))); + } + else if( aSettings.SecurityMode > Wep) + { + aSettings.WPAKeyLength = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)); + aSettings.EnableWpaPsk = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)); + aSettings.PresharedKeyFormat = EWlanPresharedKeyFormatAscii; + aSettings.WPAPreSharedKey.Zero(); + CMDBField* wpaKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey)); + + aSettings.WPAPreSharedKey.Append( *wpaKey); + + // In WPA-PSK case the preshared key can be either 8 - 63 characters in ASCII + // or 64 characters in hex. + // + // In WAPI case the preshared key format is stored in WEP key #1 format field. + if( aSettings.EnableWpaPsk ) + { + if( aSettings.SecurityMode == Wapi ) + { + TRAP_IGNORE( + aSettings.PresharedKeyFormat = *(CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey1 ) ); + } + else if( aSettings.WPAKeyLength == KWLMMaxWpaPskLength ) + { + aSettings.PresharedKeyFormat = EWlanPresharedKeyFormatHex; + } + } + } + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetDataL end"))); + } + + + +void CWLanSettings::ClearWepKeys( SWLANSettings &aSettings) + { + // it is enough to set the keylengths to zero, the key is not attempted to read if length == 0 + aSettings.WepKey1.KeyLength = 0; + aSettings.WepKey2.KeyLength = 0; + aSettings.WepKey3.KeyLength = 0; + aSettings.WepKey4.KeyLength = 0; + } + +// --------------------------------------------------------- +// void CWLanSettings::WriteDataL( SWLANSettings& aSettings) +// Writes data from aSettings to a WLANServiceTable record which has +// previously been fetched (or newly created) from the CommsDat. +// --------------------------------------------------------- +// +void CWLanSettings::WriteDataL(SWLANSettings& aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteDataL start"))); + + CMDBField* textField = (CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdRecordName); + textField->SetMaxLengthL(aSettings.Name.Length()); + textField->SetL( aSettings.Name); + + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanServiceId)) = aSettings.ServiceID; + + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanConnMode)) = aSettings.ConnectionMode; + + textField = (CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanSSID); + textField->SetMaxLengthL( aSettings.SSID.Length()); + textField->SetL( aSettings.SSID); + + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.AuthenticationMode; + + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanSecMode)) = aSettings.SecurityMode; + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteDataL, SecurityMode = %d"),aSettings.SecurityMode)); + + if( aSettings.SecurityMode == Wep) + { + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWepIndex)) = aSettings.WepIndex; + + // + // never write wep keys + // + //WriteWepKeysL( aSettings); + } + else if( aSettings.SecurityMode > Wep) + { + // + // never write wpa psk key + // + /* + TBuf8 buf; + + TInt len = aSettings.WPAPreSharedKey.Length(); + + for( TInt i=0; i* binField = (CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey); + binField->SetMaxLengthL( len); + binField->SetL( buf); + */ + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.WPAKeyLength; + *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.EnableWpaPsk; + } + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteDataL end"))); + } + + +// --------------------------------------------------------- +// TInt CWLanSettings::GetWlanSettings(TUint32 aId,SWLANSettings &aSettings) +// Gets a WLANServiceTable record from CommsDat with record ID aId +// writes record data to aSettings; the record ID of the fetched record is set as the +// current record +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::GetWlanSettings(TUint32 aId,SWLANSettings &aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetWlanSettings %d"),aId)); + + TRAPD( err, CreateWLANServiceRecordL( aId, EWlanRecordId)); + + if( !err) + { + TRAP( err, GetDataL( aSettings)); + if( !err) + { + iCurrentRecord = aId; + } + } + + return err; + } + +// --------------------------------------------------------- +// TInt CWLanSettings::GetWlanSettingsForService(TUint32 aId,SWLANSettings &aSettings) +// Gets a WLANServiceTable record from CommsDat with service ID aId +// writes record data to aSettings; the record ID of the fetched record is set as the +// current record +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::GetWlanSettingsForService(TUint32 aId,SWLANSettings &aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetWlanSettingsForService %d"),aId)); + + TRAPD( err, CreateWLANServiceRecordL( aId, EWlanServiceId)); + + if( !err) + { + TRAP( err, GetDataL( aSettings)); + if( !err) + { + iCurrentRecord = aSettings.Id; + } + } + + return err; + } + +// --------------------------------------------------------- +// TInt CWLanSettings::GetWlanSettingsForIap( const TUint32 aId, SWLANSettings &aSettings ) +// Gets a WLANServiceTable record from CommsDat with IAP ID aId +// writes record data to aSettings; the record ID of the fetched record is set as the +// current record +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::GetWlanSettingsForIap(TUint32 aId,SWLANSettings &aSettings) + { + TraceDump( WARNING_LEVEL, ( _L("CWlanSettings::GetWlanSettingsForIap %d"), aId ) ); + + TRAPD( err, CreateWLANServiceRecordL( aId, EWlanIapId ) ); + if ( !err ) + { + TRAP( err, GetDataL( aSettings ) ); + if ( !err ) + { + iCurrentRecord = aSettings.Id; + } + } + + return err; + } + +// --------------------------------------------------------- +// TInt CWLanSettings::GetFirstSettings( SWLANSettings &aSettings ) +// +// Not implemented (never used) +// +// returns KErrNotSupported +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::GetFirstSettings(SWLANSettings& /*aSettings*/) // implemented if needed + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetFirstSettings"))); + + return KErrNotSupported; + } + +// --------------------------------------------------------- +// TInt CWLanSettings::GetNextSettings( SWLANSettings &aSettings) +// +// Not implemented (never used) +// +// returns KErrNotSupported +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::GetNextSettings(SWLANSettings& /*aSettings*/) // implemented if needed + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetNextSettings"))); + + return KErrNotSupported; + } + +// --------------------------------------------------------- +// TInt CWLanSettings::AddWlanTable( ) +// +// Not implemented (WLAN table is created by UI) +// +// leaves with KErrNotSupported +// --------------------------------------------------------- +// +EXPORT_C void CWLanSettings::AddWlanTableL() + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::AddWlanTableL"))); + + User::Leave( KErrNotSupported); + } + + +// --------------------------------------------------------- +// TInt CWLanSettings::WriteWlanSettings( SWLANSettings &aSettings) +// Writes settings from aSettings to a WLANServiceTable record in CommsDat +// If aSettings.Id == 0, creates a new record, given new record ID +// is returned in aSettings.Id; otherwise modifies an existing record +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::WriteWlanSettings( SWLANSettings& aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWlanSettings start"))); + + TInt id = ( aSettings.Id == 0 ? KCDNewRecordRequest : aSettings.Id); + + TRAPD( err, CreateWLANServiceRecordL( id, EWlanRecordId)); + + if( !err) + { + if( aSettings.Id == 0) // create new + { // store first (placeholder for a new generic wlan record) + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWlanSettings() creating new record"))); + TRAP( err, iWLANRecord->StoreL( *iDBSession)); + if( err) + { + return err; + } + aSettings.Id = iWLANRecord->RecordId(); // return new id to caller + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWlanSettings() new record id %d"),aSettings.Id)); + } + + TRAP( err, WriteDataL( aSettings)); // write from SWLANSettings to iWLANRecord + if( err) + { + TRAP_IGNORE( iWLANRecord->DeleteL( *iDBSession)); // get rid of the placeholder + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWlanSettings(), error writing to record; nothing stored"))); + return err; + } + // modify the placeholder or an existing record + TRAP( err, iWLANRecord->ModifyL( *iDBSession)); + } + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWlanSettings end"))); + return err; + } + + +// --------------------------------------------------------- +// void CWLanSettings::ReadWepKeysL( SWLANSettings &aSettings) +// Reads WEP keys from current WLANServiceTable record; the +// record from which data is read must be fetched from CommsDat +// before calling ReadWepKeysL() +// --------------------------------------------------------- +// + + +void CWLanSettings::ReadWepKeysL( SWLANSettings &aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::ReadWepKeysL start"))); + + // 1 + CMDBField* wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey1)); + UnPackWepKey( wepKey->GetL(), aSettings.WepKey1, 0); + + // 2 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey2)); + UnPackWepKey( wepKey->GetL(), aSettings.WepKey2, 1); + + // 3 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey3)); + UnPackWepKey( wepKey->GetL(), aSettings.WepKey3, 2); + + // 4 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey4)); + UnPackWepKey( wepKey->GetL(), aSettings.WepKey4, 3); + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::ReadWepKeysL end"))); + } + + +// --------------------------------------------------------- +// void CWLanSettings::WriteWepKeysL( SWLANSettings &aSettings) +// Writes WEP keys from aSettings to current WLANServiceTable record +// The record which the data is written to must be fetched from CommsDat +// before calling WriteWepKeysL() +// --------------------------------------------------------- +// +void CWLanSettings::WriteWepKeysL( SWLANSettings &aSettings) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWepKeys start"))); + + // 1 + CMDBField* wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey1)); + + ASSERT( aSettings.WepKey1.KeyLength <= KWLMMaxWEPKeyLength); + PackWepKeyL( aSettings.WepKey1, wepKey); + + // 2 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey2)); + + ASSERT( aSettings.WepKey2.KeyLength <= KWLMMaxWEPKeyLength); + PackWepKeyL( aSettings.WepKey2, wepKey); + + // 3 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey3)); + + ASSERT( aSettings.WepKey3.KeyLength <= KWLMMaxWEPKeyLength); + PackWepKeyL( aSettings.WepKey3, wepKey); + + // 4 + wepKey = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanWepKey4)); + + ASSERT( aSettings.WepKey4.KeyLength <= KWLMMaxWEPKeyLength); + PackWepKeyL( aSettings.WepKey4, wepKey); + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::WriteWepKeys end"))); + } + + +// --------------------------------------------------------- +// void CWLanSettings::PackWepKeyL( const TWep& aInputKey, CMDBField& aPackedKey) +// Copies wepkey string from wepkey structs TUint8 buffer to a WLANServiceTable +// record's WEP key field descriptor +// --------------------------------------------------------- +// +void CWLanSettings::PackWepKeyL( const TWep& aInputKey, CMDBField* aPackedKey) + { + TraceDump(ERROR_LEVEL,(_L("CWlanSettings::PackWepKeyL %d"),aInputKey.KeyIndex)); + + if( aInputKey.KeyLength > KWLMMaxWEPKeyLength) + { + User::Leave( KErrArgument); + } + + TBuf8 wepBuf; + + for (TUint i = 0 ; iSetL( wepBuf); + } + + +void CWLanSettings::AsciiToHexValue( TUint8& aValue) + { + // 0-9 = [48(0x30) - 57(0x39)], A-F = [65(0x41) - 70(0x46)], a-f = [97(0x61)-102(0x66)] + + if( aValue >= '0' && aValue <= '9') // 0..9 + { + aValue -= '0'; + } + else if( aValue >= 'A' && aValue <= 'F') // A..F + { + aValue -= ('A' - 10); + } + else if( aValue >= 'a' && aValue <= 'f') // a..f + { + aValue -= ('a' - 10); + } + } + +// --------------------------------------------------------- +// void CWLanSettings::UnPackWepKeyL( const TDesC& aInputKey, TWep& aUnpackedKey, TInt aKeyIndex ) +// Copies 8 bit wepkey string to TWep structs TUint8 buffer from a WLANServiceTable +// record's WEP key field descriptor +// --------------------------------------------------------- +// +void CWLanSettings::UnPackWepKey( TDesC8& aInputKey, TWep& aUnpackedKey, TInt aKeyIndex ) + { + TraceDump(ERROR_LEVEL,(_L("CWlanSettings::UnPackWepKey %d"),aKeyIndex)); + + TUint length = aInputKey.Length() / 2; // in aInputKey, 0xXY numbers are represented as ascii(X)ascii(Y) + // -> actual length is half of the length of aInputKey + + if( length == 0 || length > KWLMMaxWEPKeyLength) + { + aUnpackedKey.KeyLength = 0; + return; + } + + for( TUint i=0, j=0; iDeleteL( *iDBSession)); + } + return err; + } + + +// --------------------------------------------------------- +// TInt CWLanSettings::DeleteWlanSettingsForService( TUint32 aId) +// Deletes a WLANServiceTable record with service ID aId +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::DeleteWlanSettingsForService( TUint32 aId) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::DeleteWlanSettingsForService"))); + + TRAPD( err, CreateWLANServiceRecordL( aId, EWlanServiceId)); + + if( !err) + { + TRAP( err, iWLANRecord->DeleteL( *iDBSession)); + } + + return err; + } + + +// --------------------------------------------------------- +// void CWLanSettings::SetEapDataL( const TEapArray &aEaps) +// Sets EAP data to current WLANServiceTable record +// Format "+123,- 34", + means enabled, - disabled, then id, +// id is always 3 characters for easy parsing +// +// GetWlanSettings() or GetWlanSettingsForService() must be called prior to +// calling SetEapDataL() so that current record is set +// --------------------------------------------------------- +// +EXPORT_C void CWLanSettings::SetEapDataL( const TEapArray &aEaps) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::SetEapDataL start"))); + + // the behaviour has been that first user calls GetWlanSettingsForService() + // and then writes EAP data.. + + if( iCurrentRecord == KErrNotFound) + { + User::Leave( KErrNotReady); + } + + TInt num( aEaps.Count()); + + if( num == 0) + { + return; + } + + HBufC16* DbText = HBufC16::NewLC( 5*num); // 5 chars per eap entry + ',' + TPtr16 ptr( DbText->Des()); + TBuf16<3+1> UidTmp; // 4 chars per eap entry + + ptr = _L(""); + for( TInt i=0 ; iUID); + if( i > 0) + { + ptr.Append(','); + } + ptr.AppendFormat( _L("%c%3s"), aEaps[i]->Enabled ? '+' : '-', UidTmp.PtrZ()); + } + + DoSetEapDataL( ptr); + + CleanupStack::PopAndDestroy(DbText); + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::SetEapDataL end"))); + } + + +EXPORT_C void CWLanSettings::SetEapDataL( RExpandedEapTypeArray &aEapsEnabled, RExpandedEapTypeArray &aEapsDisabled ) + { + TraceDump( WARNING_LEVEL, ( _L("CWlanSettings::SetEapDataL start") ) ); + + // the behaviour has been that first user calls GetWlanSettingsForService() + // and then writes EAP data.. + + if ( iCurrentRecord == KErrNotFound ) + { + User::Leave( KErrNotReady ); + } + + HBufC8* const DbDataEnabled = HBufC8::NewLC( aEapsEnabled.Count() * KExpandedEapTypeSize ); // 8 bytes per eap entry + TPtr8 enabledPtr( DbDataEnabled->Des() ); + for ( TInt i = 0 ; i < aEapsEnabled.Count(); i++ ) + { + enabledPtr.Append( aEapsEnabled[i]->EapExpandedType ); + } + + HBufC8* const DbDataDisabled = HBufC8::NewLC( aEapsDisabled.Count() * KExpandedEapTypeSize ); // 8 bytes per eap entry + TPtr8 disabledPtr( DbDataDisabled->Des() ); + for ( TInt i = 0 ; i < aEapsDisabled.Count(); i++ ) + { + disabledPtr.Append( aEapsDisabled[i]->EapExpandedType ); + } + + DoSetEapDataL( enabledPtr, disabledPtr ); + + CleanupStack::PopAndDestroy( DbDataDisabled ); + CleanupStack::PopAndDestroy( DbDataEnabled ); + + TraceDump( WARNING_LEVEL, ( _L("CWlanSettings::SetEapDataL end") ) ); + } + +// --------------------------------------------------------- +// void CWLanSettings::DoSetEapDataL( TDesC& aData) +// Sets EAP data to current WLANServiceTable record +// --------------------------------------------------------- +// +void CWLanSettings::DoSetEapDataL( TDesC& aData) + { + + ASSERT( iCurrentRecord > 0); + + CMDBField* eapList = (CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEaps); + eapList->SetMaxLengthL( aData.Length()); + eapList->SetL( aData); + iWLANRecord->ModifyL( *iDBSession); + + } + +// --------------------------------------------------------- +// void CWLanSettings::DoSetEapDataL( TDesC8& aEnabledData, TDesC8& aDisabledData ) +// Sets EAP data to current WLANServiceTable record +// --------------------------------------------------------- +// +void CWLanSettings::DoSetEapDataL( TDesC8& aEnabledData, TDesC8& aDisabledData ) + { + ASSERT( iCurrentRecord > 0 ); + + CMDBField* const eapEnabledList = (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEapsExtEnabled ); + eapEnabledList->SetMaxLengthL( aEnabledData.Length() ); + eapEnabledList->SetL( aEnabledData ); + + CMDBField* const eapDisabledList = (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEapsExtDisabled ); + eapDisabledList->SetMaxLengthL( aDisabledData.Length() ); + eapDisabledList->SetL( aDisabledData ); + + iWLANRecord->ModifyL( *iDBSession ); + + } + +// --------------------------------------------------------- +// HBufC* CWLanSettings::DoGetEapDataLC() +// Gets eap data from current WLANServiceTable record +// returns buffer which contains the data +// --------------------------------------------------------- +// +HBufC* CWLanSettings::DoGetEapDataLC() + { + + ASSERT( iCurrentRecord > 0); + + HBufC* temp = HBufC::NewLC( KMaxEapDataBufLength); + + TPtr ptr( temp->Des()); + + ptr = *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEaps)); + + return temp; + } + +// --------------------------------------------------------- +// HBufC* CWLanSettings::DoGetEapDataLC( HBufC8*& enabledEapsData, HBufC8*& disabledEapsData ) +// Gets eap data from current WLANServiceTable record +// returns buffer which contains the data +// --------------------------------------------------------- +// +void CWLanSettings::DoGetEapDataLC( HBufC8*& enabledEapsData, HBufC8*& disabledEapsData ) + { + ASSERT( iCurrentRecord > 0 ); + + enabledEapsData = HBufC8::NewLC( KMaxEapDataBufLength ); + disabledEapsData = HBufC8::NewLC( KMaxEapDataBufLength ); + + TPtr8 ptr( enabledEapsData->Des() ); + TPtr8 ptr2( disabledEapsData->Des() ); + ptr = *( (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEapsExtEnabled) ); + // ptr2 = disabledEapsData->Des(); + ptr2 = *( (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEapsExtDisabled) ); + } + +// --------------------------------------------------------- +// void CWLanSettings::GetEapDataL( TEapArray &aEaps) +// Gets EAP data from current WLANServiceTable record +// see format in SetEapDataL() +// +// GetWlanSettings() or GetWlanSettingsForService() must be called prior to +// calling GetEapDataL() so that current record is set +// --------------------------------------------------------- +// +EXPORT_C void CWLanSettings::GetEapDataL( TEapArray &aEaps) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetEapDataL start"))); + + if( iCurrentRecord == KErrNotFound) + { + User::Leave( KErrNotReady); + } + + HBufC* eapData = 0; + + eapData = DoGetEapDataLC(); + + aEaps.Reset(); + + TUint Length = eapData->Length(); + + if( Length == 0) + { + CleanupStack::PopAndDestroy( eapData); + return; + } + + TPtr16 ptr( eapData->Des()); + TEap* eapTmp; + TUint x = 0; + + while( x < Length) + { + eapTmp = new (ELeave) TEap; + if( (ptr[x++]) == '+') + { + eapTmp->Enabled = ETrue; + } + + else + { + eapTmp->Enabled=EFalse; + } + + eapTmp->UID.Zero(); + eapTmp->UID.Append( ptr[x++]); + eapTmp->UID.Append( ptr[x++]); + eapTmp->UID.Append( ptr[x++]); + eapTmp->UID.Trim(); + x++; // skip ',' if there is one + aEaps.Append( eapTmp); + } + CleanupStack::PopAndDestroy( eapData); + } +// --------------------------------------------------------- +// void CWLanSettings::GetEapDataL( RExpandedEapTypeArray &aEapsEnabled, RExpandedEapTypeArray &aEapsDisabled ) +// Gets EAP data from current WLANServiceTable record +// see format in SetEapDataL() +// +// GetWlanSettings() or GetWlanSettingsForService() must be called prior to +// calling GetEapDataL() so that current record is set +// --------------------------------------------------------- +// +EXPORT_C void CWLanSettings::GetEapDataL( RExpandedEapTypeArray &aEapsEnabled, RExpandedEapTypeArray &aEapsDisabled ) + { + TraceDump( WARNING_LEVEL, ( _L("CWlanSettings::GetEapDataL start") ) ); + + if ( iCurrentRecord == KErrNotFound ) + { + User::Leave( KErrNotReady ); + } + + aEapsEnabled.Reset(); + aEapsDisabled.Reset(); + + HBufC* const eapData = DoGetEapDataLC(); + + const TUint Length = eapData->Length(); + + if ( Length == 0 ) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::start getting data"))); + + // No old-style EAP data + CleanupStack::PopAndDestroy( eapData ); + + // Get EAP data as in new format + HBufC8* enabledEapsData; + HBufC8* disabledEapsData; + DoGetEapDataLC( enabledEapsData, disabledEapsData ); + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::data taken"))); + + // Array pointer + TPtr8 ptr( enabledEapsData->Des() ); + + TInt i = 0; + for ( i = 0; i<(enabledEapsData->Length() / KExpandedEapTypeSize); i++ ) + { + SEapExpandedType* const expandedEap = new (ELeave) SEapExpandedType(); + CleanupStack::PushL(expandedEap); + expandedEap->EapExpandedType = ptr.Mid( i * KExpandedEapTypeSize, KExpandedEapTypeSize ); + aEapsEnabled.AppendL( expandedEap ); + CleanupStack::Pop( expandedEap ); + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::inloop1"))); + } + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::first loop ok"))); + + ptr = disabledEapsData->Des(); + for ( i = 0; i<(disabledEapsData->Length() / KExpandedEapTypeSize); i++ ) + { + SEapExpandedType* const expandedEap = new (ELeave) SEapExpandedType(); + CleanupStack::PushL(expandedEap); + expandedEap->EapExpandedType = ptr.Mid( i * KExpandedEapTypeSize, KExpandedEapTypeSize ); + aEapsDisabled.AppendL( expandedEap ); + CleanupStack::Pop( expandedEap ); + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::inloop2"))); + } + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::second loop ok"))); + + CleanupStack::PopAndDestroy( disabledEapsData ); + CleanupStack::PopAndDestroy( enabledEapsData ); + + TraceDump( WARNING_LEVEL,( _L("CWlanSettings::GetEapDataL end") ) ); + return; + } + + else + { + // Convert to new format. This part should be removed after old-atyle EAP list support is not needed anymore + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetEapDataL - old style data"))); + + TUint16 x = 0; + TUint16 newEapValue; + TBool enableEapType; + + // Array pointer + const TPtrC16 ptr( eapData->Des() ); + + while ( (x+3) < Length ) + { + TBool addToList = ETrue; + if ( ptr[x] == '+' ) + { + // Append into enabled list + enableEapType = ETrue; + } + else if ( ptr[x] == '-' ) + { + // Append into disabled list + enableEapType = EFalse; + } + else + { + // Unknown value + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetEapDataL - unknown value"))); + enableEapType = EFalse; + addToList = EFalse; + } + + ++x; + TChar tens( ptr[x+1] ); + TChar ones( ptr[x+2] ); + + newEapValue = KOldStyleMaxEapTypeValue; + + if( tens.IsDigit() && ones.IsDigit() ) + { + newEapValue = tens.GetNumericValue() * 10 + ones.GetNumericValue(); + } + + if( addToList && ptr[x] == '0' && newEapValue < KOldStyleMaxEapTypeValue ) + { + SEapExpandedType* const expandedEap = new (ELeave) SEapExpandedType(); + CleanupStack::PushL( expandedEap ); + + expandedEap->EapExpandedType.Zero(); + + expandedEap->EapExpandedType.Append( 0xFE ); + + if ( newEapValue == 99 ) + { + // Plain MSCHAPv2 + expandedEap->EapExpandedType.Append( 0xFF ); + expandedEap->EapExpandedType.Append( 0xFF ); + expandedEap->EapExpandedType.Append( 0xFF ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x1A ); + } + else + { + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( 0x00 ); + expandedEap->EapExpandedType.Append( newEapValue ); + } + + if ( enableEapType ) + { + aEapsEnabled.AppendL( expandedEap ); + } + else + { + aEapsDisabled.AppendL( expandedEap ); + } + + CleanupStack::Pop( expandedEap ); + } + + x += 4; + } + + // Store new-style EAP list + HBufC8* const DbDataEnabled = HBufC8::NewLC( aEapsEnabled.Count() * KExpandedEapTypeSize ); // 8 bytes per eap entry + TPtr8 enabledPtr( DbDataEnabled->Des() ); + for ( TInt i = 0 ; i < aEapsEnabled.Count(); i++ ) + { + enabledPtr.Append( aEapsEnabled[i]->EapExpandedType ); + } + + HBufC8* const DbDataDisabled = HBufC8::NewLC( aEapsDisabled.Count() * KExpandedEapTypeSize ); // 8 bytes per eap entry + TPtr8 disabledPtr( DbDataDisabled->Des() ); + for ( TInt i = 0 ; i < aEapsDisabled.Count(); i++ ) + { + disabledPtr.Append( aEapsDisabled[i]->EapExpandedType ); + } + + CMDBField* const eapEnabledList = (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEapsExtEnabled ); + eapEnabledList->SetMaxLengthL( enabledPtr.Length() ); + eapEnabledList->SetL( enabledPtr ); + + CMDBField* const eapDisabledList = (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEapsExtDisabled ); + eapDisabledList->SetMaxLengthL( disabledPtr.Length() ); + eapDisabledList->SetL( disabledPtr ); + + // Empty old-style EAP list + CMDBField* const eapList = (CMDBField*) iWLANRecord->GetFieldByIdL( KCDTIdWlanEaps ); + eapList->SetMaxLengthL( 0 ); + + iWLANRecord->ModifyL( *iDBSession ); + + CleanupStack::PopAndDestroy( DbDataDisabled ); + CleanupStack::PopAndDestroy( DbDataEnabled ); + + CleanupStack::PopAndDestroy( eapData ); + } + + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetEapDataL end"))); + } + + +// --------------------------------------------------------- +// TInt CWLanSettings::IsEasyWlan( TUint aServiceId, TBool &aEasyWlan) +// Checks if wlan settings with given ServiceId is easywlan iap +// returns KErrNone on success +// --------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::IsEasyWlan( TUint aServiceId, TBool &aEasyWlan) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::IsEasyWlan %d"),aServiceId)); + + aEasyWlan = EFalse; + + TRAPD( err, CreateWLANServiceRecordL( aServiceId, EWlanServiceId)); + + if( !err) + { + CMDBField* ssid = NULL; + TRAP(err, ssid = static_cast*>(iWLANRecord->GetFieldByIdL(KCDTIdWlanSSID))); + if (err) + { + return err; + } + + TPtrC pSsid; + TRAP(err, pSsid.Set(ssid->GetL())); + if (err) + { + return err; + } + + if( pSsid.Length() == 0) + { + aEasyWlan = ETrue; + } + + + } + return err; + } + +// ---------------------------------------------------------- +// void CWLanSettings::GetIAPWlanServicesL( RArray& aServices) +// Find all WLANServiceTable records which correspond to wlan IAPs +// returns ID's to both WLANServiceTable records and IAP records in aServices +// ---------------------------------------------------------- +// + +EXPORT_C void CWLanSettings::GetIAPWlanServicesL( RArray& aServices) + { + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetIAPWlanServicesL start"))); + + CMDBRecordSet* iapRecSet = new (ELeave) CMDBRecordSet(KCDTIdIAPRecord); + CleanupStack::PushL( iapRecSet); + + CCDIAPRecord* iapPrimer = static_cast + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord)); + CleanupStack::PushL( iapPrimer); + + // prime record set for service type "LANService" + TPtrC servType( KCDTypeNameLANService); + iapPrimer->iServiceType.SetL( servType); + iapRecSet->iRecords.AppendL( iapPrimer); + + CleanupStack::Pop( ); // iapPrimer + iapPrimer = 0; + + TBool found( EFalse); + + // get all iap records with service type "LANService" + found = iapRecSet->FindL( *iDBSession); + + // find all such WLANServiceTable records that have a ServiceID that match some lanId + if( found) + { + TraceDump(WARNING_LEVEL, (_L("\tfound %d IAPs with LANService type"),iapRecSet->iRecords.Count())); + for( TInt i=0; iiRecords.Count(); i++) + { + TRAPD( error, CreateWLANServiceRecordL( (*iapRecSet)[i]->iService, EWlanServiceId)); + + if( error == KErrNone) + { // found a WLANServiceTable record with ServiceID that matches a LANService record id + SWlanIAPId id; + id.iWLANRecordId = iWLANRecord->RecordId(); // WLANServiceTable record ID (not the value of ServiceID of the found record) + id.iIAPId = (*iapRecSet)[i]->RecordId(); // IAP record id + User::LeaveIfError( aServices.Append( id)); + } + } + } + CleanupStack::PopAndDestroy( ); // iapRecSet + TraceDump(WARNING_LEVEL,(_L("CWlanSettings::GetIAPWlanServicesL end"))); + } + +// ----------------------------------------------------------------------------- +// CWLanSettings::GetSecondarySsidsForService +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CWLanSettings::GetSecondarySsidsForService( + TUint32 aId, + RArray& aSsids ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanSettings::GetSecondarySsidsForService()" ) ) ); + + aSsids.Reset(); + + /** + * This is done using the old commdb interface because Symbian + * doesn't have a class definition for WLAN Secondary SSID table. + */ + CCommsDatabase* db = NULL; + TRAPD( ret, db = CCommsDatabase::NewL() ); + if ( ret != KErrNone ) + { + TraceDump( ERROR_LEVEL, + ( _L( "CWlanSettings::GetSecondarySsidsForService() - unable to create CCommsDatabase" ) ) ); + + return ret; + } + + TraceDump(INFO_LEVEL, + ( _L( "CWlanSettings::GetSecondarySsidsForService() - searching for WLAN ID %u" ), aId ) ); + + CCommsDbTableView* table = NULL; + TRAP( ret, table = db->OpenViewMatchingUintLC( + TPtrC( WLAN_SECONDARY_SSID ), + TPtrC( WLAN_SEC_SSID_SERVICE_ID ), + aId ); CleanupStack::Pop( table ) ); + if ( ret != KErrNone ) + { + TraceDump( ERROR_LEVEL, + ( _L( "CWlanSettings::GetSecondarySsidsForService() - unable to create CCommsDbTableView" ) ) ); + delete db; + + return ret; + } + + ret = table->GotoFirstRecord(); + while ( ret == KErrNone ) + { + TWlanSecondarySsid entry; + TRAPD( err, table->ReadUintL( TPtrC( WLAN_SEC_SSID_ID ), entry.id ) ); + + if ( err == KErrNone ) + { + TraceDump( INFO_LEVEL, + ( _L( "CWlanSettings::GetSecondarySsidsForService() - reading ID %u" ), entry.id ) ); + + TRAP( err, table->ReadTextL( TPtrC( WLAN_SEC_SSID_SCANNED_SSID ), entry.ssid ) ); + } + + if ( err == KErrNone ) + { + TRAP( err, table->ReadTextL( TPtrC( WLAN_SEC_SSID_USED_SSID ), entry.usedSsid ) ); + } + + if ( err == KErrNone ) + { + TraceDump( ERROR_LEVEL, + ( _L( "CWlanSettings::GetSecondarySsidsForService() - appending entry" ) ) ); + aSsids.Append( entry ); + } + else + { + TraceDump( ERROR_LEVEL, + ( _L( "CWlanSettings::GetSecondarySsidsForService() - unable to read, discarding" ) ) ); + } + ret = table->GotoNextRecord(); + } + + delete table; + delete db; + + return KErrNone; + } + +// --------------------------------------------------------- +// void CWLanSettings::CreateWLANServiceRecordL( TUint32 aId, TWlanRecIdType aType) +// Fetches a WLANServiceTable record from CommsDat or creates a new record if +// aId == KCDNewRecordRequest +// if aType == EWlanRecordId, fetches record using record ID as criteria (can be LoadL'd) +// if aType == EWlanServiceId, fetches record using service ID as criteria (must be FindL'd) +// on success, iWLANRecord points to the fetched or created record +// on failure, iWLANRecord remains NULL +// --------------------------------------------------------- +// +void CWLanSettings::CreateWLANServiceRecordL( TUint32 aId, TWlanRecIdType aType) + { + if( iWLANRecord) + { + delete iWLANRecord; + iWLANRecord = NULL; + } + + if ( aType == EWlanIapId ) + { + /** + * Load the IAP record and get the service ID that should point + * to the WLAN service table. + */ + CCDIAPRecord *iapRecord = static_cast + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); + CleanupStack::PushL( iapRecord ); + + TraceDump( INFO_LEVEL, + ( _L( "CWlanSettings::CreateWLANServiceRecordL() - searching for IAP ID %u" ), aId ) ); + + iapRecord->SetRecordId( aId ); + TRAPD( ret, iapRecord->LoadL( *iDBSession ) ); + if ( ret != KErrNone ) + { + TraceDump( ERROR_LEVEL, + ( _L( "CWlanSettings::CreateWLANServiceRecordL() - LoadL leaved with %d" ), ret ) ); + + User::Leave( ret ); + } + + if ( TPtrC( iapRecord->iServiceType ) != TPtrC( KCDTypeNameLANService ) || + TPtrC( iapRecord->iBearerType ) != TPtrC( KCDTypeNameLANBearer ) ) + { + TraceDump( ERROR_LEVEL, + ( _L( "CWlanSettings::CreateWLANServiceRecordL() - IAP doesn't point to LANService table" ) ) ); + + User::Leave( KErrNotFound ); + } + aId = iapRecord->iService; + + TraceDump( INFO_LEVEL, + ( _L( "CWlanSettings::CreateWLANServiceRecordL() - WLAN ServiceID is %u" ), aId ) ); + + CleanupStack::PopAndDestroy( iapRecord ); + } + + CMDBGenericRecord* const genRec = static_cast ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( genRec ); + + genRec->InitializeL( KGenericTable(),NULL); + + if( aType == EWlanRecordId) + { + genRec->SetRecordId( aId); + genRec->LoadL( *iDBSession); + } + else // EWlanServiceId + { + genRec->LoadL( *iDBSession); + + CMDBField* sidField = static_cast*> + (genRec->GetFieldByIdL( KCDTIdWlanServiceId)); + // prime with service id + *sidField = aId; + + TBool found = genRec->FindL( *iDBSession); + + if( !found) + { + User::Leave( KErrNotFound); + } + + } + + CleanupStack::Pop(); //genRec + iWLANRecord = genRec; + } + +// +// L-methods called and trapped by the public non-leaving methods +// + +// --------------------------------------------------------- +// void CWLanSettings::DoConnectL() +// Connects to the CommsDat storage server +// --------------------------------------------------------- +// +void CWLanSettings::DoConnectL() + { + TraceDump(ERROR_LEVEL,(_L("CWlanSettings::DoConnectL"))); + + if( !iDBSession) + { + iDBSession = CMDBSession::NewL( KCDCurrentVersion); + } + + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_driverif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_driverif.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,444 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface implemented by lower adaptation. Core server uses +* these services. +* +*/ + + +#ifndef ABS_CORE_DRIVERIF_H +#define ABS_CORE_DRIVERIF_H + +#include "core_types.h" + +class abs_core_driverif_callback_c; + +/** + * Abstract adaptation layer interface class for low-level management functionality. + * + * This interface is implemented by the adaptation layer and a reference + * to the class implementing it is passed as a parameter to the core server + * constructor. + * + * @since S60 v3.1 + */ +class abs_core_driverif_c + { + +public: + + /** + * Destructor. + */ + virtual ~abs_core_driverif_c() {}; + + /** + * Initialisation between core server - driverIf + * + * @since S60 v3.1 + * @param core_callback delivers callback interface to driverIf + */ + virtual void init( + abs_core_driverif_callback_c* core_callback ) = 0; + + /** + * Start an IBSS network. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param ssid Name of the network. + * @param beacon_interval Beacon interval in TUs. + * @param channel Used channel (1 - 11). + * @param encrypt_level Used encryption level. + */ + virtual void start_ibss( + u32_t request_id, + const core_ssid_s& ssid, + u32_t beacon_interval, + u32_t channel, + core_encryption_mode_e encrypt_level ) = 0; + + /** + * Request available networks with the given SSID. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param scan_mode Defines whether active or passive scan is performed. + * @param scan_ssid Name of the network to scan for. + * @param scan_rate Scan rate in units of 500kbit/second. + * @param scan_channels Channels to scan. + * @param scan_min_ch_time Minimum time to listen for beacons/probe responses on a channel. + * @param scan_max_ch_time Maximum time to listen for beacons/probe responses on a channel. + * @param is_split_scan Whether the scan should be performed as a split-scan. + * @note If the length of the SSID is zero, a broadcast scan is performed. + */ + virtual void scan( + u32_t request_id, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + int_t scan_rate, + const core_scan_channels_s& scan_channels, + u32_t scan_min_ch_time, + u32_t scan_max_ch_time, + bool_t is_split_scan ) = 0; + + /** + * Request an ongoing scan to be stopped. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void stop_scan( + u32_t request_id ) = 0; + + /** + * Connect (authenticate and associate) to a BSS. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param status The status code from the connection attempt is stored here. + * @param ssid Name of the network. + * @param bssid BSSID of the access point. + * @param auth_algorithm Authentication algorithm number. + * @param encryption_level Used encryption level. + * @param pairwise_key_type Pairwise cipher key type to be used. + * @param is_infra Whether the network is an IBSS or an infra network. + * @param ie_data_length Length of IE data. + * @param ie_data IE data. + * @param scan_frame_length Length of beacon/probe response frame from the BSS. + * @param scan_frame Pointer to beacon/probe response frame from the BSS. + * @param is_pairwise_key_invalidated Whether the pairwise key should be invalidated. + * @param is_group_key_invalidated Whether the group key should be invalidated + * @param is_radio_measurement_supported Whether the radio measurement is supported + */ + virtual void connect( + u32_t request_id, + core_management_status_e& status, + const core_ssid_s& ssid, + const core_mac_address_s& bssid, + u16_t auth_algorithm, + core_encryption_mode_e encryption_level, + core_cipher_key_type_e pairwise_key_type, + bool_t is_infra, + u32_t ie_data_length, + const u8_t* ie_data, + u32_t scan_frame_length, + const u8_t* scan_frame, + bool_t is_pairwise_key_invalidated, + bool_t is_group_key_invalidated, + bool_t is_radio_measurement_supported ) = 0; + + /** + * Disconnect from the current network. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void disconnect( + u32_t request_id ) = 0; + + /** + * Set WLAN power mode. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param mode Power mode to use. + */ + virtual void set_power_mode( + u32_t request_id, + const core_power_mode_s& mode ) = 0; + + /** + * Set transmission power level. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param tx_level Transmission power level in dBm. + */ + virtual void set_tx_power_level( + u32_t request_id, + u32_t tx_level ) = 0; + + /** + * Add a cipher key. + * + * @since S60 v3.1 + * @param cipher_suite The cipher suite of the key. + * @param key_index Index of the key. + * @param key_length Length of the cipher key. + * @param key_data Cipher key data. + * @param mac Defines the MAC address the key is used for. + * @param use_as_default in case of wep, whether the key is used as default cipher key + */ + virtual void add_cipher_key( + core_cipher_key_type_e cipher_suite, + u8_t key_index, + u16_t key_length, + const u8_t* key_data, + const core_mac_address_s& mac, + bool_t use_as_default ) = 0; + + /** + * Get the current RCPI value. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param rcpi The current RCPI value. + */ + virtual void get_current_rcpi( + u32_t request_id, + u32_t& rcpi ) = 0; + + /** + * Delivers multicast MAC address to drivers. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param join_group is set true_t if adding a multicast address + * otherwise the address will be removed. + * @param multicast_addr contains the MAC address to add/remove + */ + virtual void configure_multicast_group( + u32_t request_id, + bool_t join_group, + const core_mac_address_s& multicast_addr ) = 0; + + /** + * Set the parameters related to BSS lost indication. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param parameters Parameters to set. + */ + virtual void set_bss_lost_parameters( + u32_t request_id, + const core_bss_lost_parameters_s& parameters ) = 0; + + /** + * Set the parameters related to TX rate adaptation algorithm. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param parameters Parameters to set. + */ + virtual void set_tx_rate_adaptation_parameters( + u32_t request_id, + const core_tx_rate_adaptation_parameters_s& parameters ) = 0; + + /** + * Set the parameters related to power mode management. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param parameters Parameters to set. + */ + virtual void set_power_mode_mgmt_parameters( + u32_t request_id, + const core_power_mode_mgmt_parameters_s& parameters ) = 0; + + /** + * Set the parameters related to TX rate policies. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param policies TX rate policies to set. + * @param mappings Mappings between Access Classes and TX rate policies. + */ + virtual void set_tx_rate_policies( + u32_t request_id, + const core_tx_rate_policies_s& policies, + const core_tx_rate_policy_mappings_s& mappings ) = 0; + + /** + * Get packet statistics for the currently active connection. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param statistics Packet statistics for the currently active connection. + */ + virtual void get_packet_statistics( + u32_t request_id, + core_packet_statistics_by_access_category_s& statistics ) = 0; + + /** + * Set the RCPI trigger level. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param rcpi_trigger The RCPI trigger level. + */ + virtual void set_rcpi_trigger_level( + u32_t request_id, + u8_t rcpi_trigger ) = 0; + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param settings Current U-APSD settings to be set. + */ + virtual void set_uapsd_settings( + u32_t request_id, + const core_uapsd_settings_s& settings ) = 0; + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param settings Current power save settings to be set. + */ + virtual void set_power_save_settings( + u32_t request_id, + const core_power_save_settings_s& settings ) = 0; + + /** + * Set the parameters of a tx queue. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param queue_id Queue to be configured. + * @param medium_time Medium time to be used. + * @param max_tx_msdu_lifetime Maximum Transmit MSDU Lifetime to be used. + */ + virtual void set_tx_queue_parameters( + u32_t request_id, + core_access_class_e queue_id, + u16_t medium_time, + u32_t max_tx_msdu_lifetime ) = 0; + + /** + * Allow sending of user data. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void enable_user_data( + u32_t request_id ) = 0; + + /** + * Prevent sending of user data. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void disable_user_data( + u32_t request_id ) = 0; + + /** + * Unload the drivers and power down the WLAN hardware. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void unload_drivers( + u32_t request_id ) = 0; + + /** + * Load the drivers and power up the WLAN hardware. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param rts_threshold Determines the maximum packet size that can be sent without RTS/CTS protocol. + * @param max_tx_msdu_lifetime Maximum time to (re-)send the whole MSDU packet in TUs. + * @param qos_null_frame_entry_timeout Defines the time period in microseconds which is used + * to evaluate whether QoS NULL data frame sending should be started. + * @param qos_null_frame_entry_tx_count Defines how many Voice AC packets must be sent during the time + * period defined in qos_null_frame_entry_timeout before QoS NULL + * data frame sending is started. + * @param qos_null_frame_interval Defines how often a QoS NULL data frame is sent. + * @param qos_null_frame_exit_timeout Defines how soon after the last Voice AC packet QoS NULL data + * frame sending is stopped. + * @param keep_alive_interval Defines how often NULL data frames are sent if there are no other frames + * to send. + * @param sp_rcpi_target Defines the signal predictor algorithm "target" RCPI value for roam indication. + * @param sp_time_target Defines the signal predictor algorithm "target" time for roam indication + * (in microseconds). + * @param sp_min_indication_interval Defines the minimum time interval for consecutive roam + * indications from the signal predictor algorithm (in microseconds). + */ + virtual void load_drivers( + u32_t request_id, + uint_t rts_threshold, + u32_t max_tx_msdu_lifetime, + u32_t qos_null_frame_entry_timeout, + u32_t qos_null_frame_entry_tx_count, + u32_t qos_null_frame_interval, + u32_t qos_null_frame_exit_timeout, + u32_t keep_alive_interval, + u32_t sp_rcpi_target, + u32_t sp_time_target, + u32_t sp_min_indication_interval ) = 0; + + /** + * Send a frame. + * + * @since S60 v3.1 + * @param frame_type The type of the frame to send. + * @param frame_length The length of the frame. + * @param frame_data Pointer to the frame data. + * @param frame_priority User priority to use for sending the frame. + * @param destination Destination MAC address. + * @param send_unencrypted Whether the frame must be sent unencrypted. + */ + virtual void send_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + u8_t frame_priority, + const core_mac_address_s& destination, + bool_t send_unencrypted ) = 0; + + /** + * Cancel a pending asynchronous request. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + */ + virtual void cancel_request( + u32_t request_id ) = 0; + + /** + * Set the ARP filter. + * + * @since S60 v5.0 + * @param request_id Identification of the corresponding request. + * @param filter Current ARP filter to be set. + */ + virtual void set_arp_filter( + u32_t request_id, + const core_arp_filter_s& filter ) = 0; + + /** + * Set block ACK usage per traffic stream. + * + * @since S60 v5.1 + * @param request_id Identification of the corresponding request. + * @param usage Block ACK usage information. + */ + virtual void set_block_ack_usage( + u32_t request_id, + const core_block_ack_usage_s& usage ) = 0; + + /** + * Set the SNAP header of frames to receive. + */ + virtual void set_snap_header_filter( + u32_t request_id, + const core_snap_header_s& header ) = 0; + + }; + +#endif // ABS_CORE_DRIVERIF_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_driverif_callback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_driverif_callback.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface implemented by core server. Lower adaptation can use +* these services. +* +*/ + + +#ifndef ABS_CORE_DRIVERIF_CALLBACK_H +#define ABS_CORE_DRIVERIF_CALLBACK_H + +#include "core_types.h" + +/** + * Abstract core server interface for low-level adaptation layer callbacks. + * + * This interface is implemented by the core server and it provides a callback + * interface for the low-level adaptation layer. + * + * @since S60 v3.1 + * @see abs_core_driverif_c + */ +class abs_core_driverif_callback_c + { + +public: + + /** + * Destructor. + */ + virtual ~abs_core_driverif_callback_c() {}; + + /** + * Inform the core server about a new received frame. + * + * @since S60 v3.1 + * @param frame_type The type of the frame received. + * @param frame_length The length of the frame. + * @param frame_data Pointer to the frame data. + * @param frame_rcpi RCPI value of the frame. + */ + virtual void receive_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + u8_t frame_rcpi ) = 0; + + /** + * Notify the core server about an adaptation layer event. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + */ + virtual void notify( + core_am_indication_e indication ) = 0; + + /** + * An asynchronous request from the core server has been completed. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param status Completion status of the request. + */ + virtual void request_complete( + u32_t request_id, + core_error_e status ) = 0; + + }; + +#endif // ABS_CORE_DRIVERIF_CALLBACK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_event_handler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_event_handler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for operations registered as event handlers +* +*/ + + +#ifndef ABS_CORE_EVENT_HANDLER_H +#define ABS_CORE_EVENT_HANDLER_H + +#include "am_platform_libraries.h" +#include "core_types.h" + +/** + * Abstract interface for operations wanting to handle events themselves. + * + * @since S60 v3.1 + */ +class abs_core_event_handler_c + { +public: + + /** + * Destructor. + */ + virtual ~abs_core_event_handler_c() {}; + + /** + * Called by the core server when an indication has been received. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + * @return true_t if the indication was handled, false_t if not handled. + */ + virtual bool_t notify( + core_am_indication_e indication ) = 0; + + }; + +#endif // ABS_CORE_EVENT_HANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_frame_handler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_frame_handler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for operations registered as frame handlers +* +*/ + + +#ifndef ABS_CORE_FRAME_HANDLER_H +#define ABS_CORE_FRAME_HANDLER_H + +#include "am_platform_libraries.h" +#include "core_types.h" + +class core_frame_dot11_c; +class core_frame_ethernet_c; +class core_frame_echo_test_c; + +/** + * Abstract interface for operations wanting to handle frames themselves. + * + * @since S60 v3.1 + */ +class abs_core_frame_handler_c + { +public: + + /** + * Destructor. + */ + virtual ~abs_core_frame_handler_c() {}; + + /** + * Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + virtual bool_t receive_frame( + const core_frame_dot11_c* /* frame */, + u8_t /* rcpi */ ) { return false_t; } + + /** + * Called by the core server when an echo test frame has been received. + * + * @since S60 v3.2 + * @param frame Pointer to an echo test frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + virtual bool_t receive_test_frame( + const core_frame_echo_test_c* /* frame */, + u8_t /* rcpi */ ) { return false_t; } + }; + +#endif // ABS_CORE_FRAME_HANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_protected_setup_handler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_protected_setup_handler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for operations handling protected setup events. +* +*/ + + +#ifndef ABS_CORE_PROTECTED_SETUP_HANDLER_H +#define ABS_CORE_PROTECTED_SETUP_HANDLER_H + +#include "am_platform_libraries.h" +#include "core_types.h" + +/** + * Abstract interface for operations handling protected setup events. + * + * @since S60 v3.2 + */ +class abs_core_protected_setup_handler_c + { +public: + + /** + * Destructor. + */ + virtual ~abs_core_protected_setup_handler_c() {}; + + /** + * Called by the core server when a network has been configured via + * Protected Setup. + * + * @since S60 v3.2 + * @param iap_data Results of a successful Protected Setup operation. + */ + virtual void handle_protected_setup_network( + const core_iap_data_s& iap_data ) = 0; + + }; + +#endif // ABS_CORE_PROTECTED_SETUP_HANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_scan_list_iterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_scan_list_iterator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for scan list iterators +* +*/ + + +#ifndef ABS_CORE_SCAN_LIST_ITERATOR_H +#define ABS_CORE_SCAN_LIST_ITERATOR_H + +#include "core_types.h" + +class core_ap_data_c; + +/** + * This class acts as the abstract base class for the iterators. + */ +NONSHARABLE_CLASS( abs_core_scan_list_iterator_c ) + { + +public: + + /** + * Destructor. + */ + virtual ~abs_core_scan_list_iterator_c() {}; + + /** + * Return the first entry in the list that matches the iterator type. + * + * @since S60 v3.1 + * @return NULL if the list empty, pointer to the first entry otherwise. + * @note This method will reset the internal iterator. + */ + virtual core_ap_data_c* first() = 0; + + /** + * Return the next entry in the list. + * + * @since S60 v3.1 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + virtual core_ap_data_c* next() = 0; + + /** + * Return the current entry in the list. + * + * @since S60 v3.1 + * @return pointer to the current entry. + */ + virtual core_ap_data_c* current() = 0; + + }; + +#endif // ABS_CORE_SCAN_LIST_ITERATOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,495 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface implemented by core server. +* Adaptation layer can use core services through this interface. +* +*/ + +/* +* %version: 30 % +*/ + +#ifndef ABS_CORE_SERVER_H +#define ABS_CORE_SERVER_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_type_list.h" + +class ScanList; + +/** + * Abstract core server interface class for WLAN management functionality. + * + * This interface is implemented by the core server and it provides + * methods for the adaptation layer. + * + * @since S60 v3.1 + */ +class abs_core_server_c + { + +public: + + /** + * Destructor. + */ + virtual ~abs_core_server_c() {}; + + /** + * Asynchronous methods that the core server will complete by calling + * abs_core_server_callback_c::request_complete. + */ + + /** + * Connect to a network. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param settings The settings used for establishing the connection. + * @param connect_status contains the error code of connection attempt + * on completion + * @param ssid_list List of possible secondary SSIDs. + */ + virtual void connect( + u32_t request_id, + const core_iap_data_s& settings, + core_connect_status_e& connect_status, + core_type_list_c* ssid_list = NULL ) = 0; + + /** + * Disconnect an active connection. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void release( + u32_t request_id ) = 0; + + /** + * Request available networks with the given SSID. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param scan_mode Defines whether active or passive scan is performed. + * @param scan_ssid Name of the network to scan for. + * @param scan_channels Channels to scan. + * @param scan_data Scan results are stored here. + * @param scan_max_age Maximum age of returned scan results in seconds. + * @param is_current_ap_added Whether the current AP needs to be added during an ongoing + * connection if not otherwise found in the scan. + * @note If the length of the SSID is zero, a broadcast scan is performed. + */ + virtual void get_scan_result( + u32_t request_id, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + u8_t scan_max_age, + ScanList& scan_data, + bool_t is_current_ap_added = true_t ) = 0; + + /** + * Find which iaps from the given list are currently available. + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param is_active_scan_allowed specifies whether active scanning is allowed. + * @param iap_data_list containing list of iap data structures. + * @param iap_id_list list of iap ids are stored here on completion. + * @param iap_ssid_list List of possible secondary SSIDs. + * @param scan_data contains the scan results + */ + virtual void get_available_iaps( + u32_t request_id, + bool_t is_active_scan_allowed, + core_type_list_c& iap_data_list, + core_type_list_c& iap_id_list, + core_type_list_c* iap_ssid_list, + ScanList& scan_data ) = 0; + + /** + * Get the current RCPI value of the connection. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param rcpi Current channel power indicator (RCPI). + */ + virtual void get_current_rcpi( + u32_t request_id, + u32_t& rcpi ) = 0; + + /** + * Disable all WLAN activity. + * + * Disconnects the active connection and prevents any further + * WLAN activity until enable_wlan() is called. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void disable_wlan( + u32_t request_id ) = 0; + + /** + * Allow WLAN activity after disabled_wlan(). + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + virtual void enable_wlan( + u32_t request_id ) = 0; + + /** + * Get packet statistics of the current connection. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param statistics Packet statistics of the current connection. + */ + virtual void get_packet_statistics( + u32_t request_id, + core_packet_statistics_s& statistics ) = 0; + + /** + * Request creation of a virtual traffic stream. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param tid TID of the virtual traffic stream. + * @param user_priority User Priority of the virtual traffic stream. + * @param is_automatic_stream Whether the virtual traffic stream + * has been created automatically. + * @param params Parameters of the virtual traffic stream. + * @param stream_id ID assigned to this virtual traffic stream on + * successful completion. + * @param stream_status Status of the virtual traffic stream on + * successful completion. + * @note If the TID has been defined as TRAFFIC_STREAM_ID_NONE, + * core server will select the next free ID. + */ + virtual void create_traffic_stream( + u32_t request_id, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e& stream_status ) = 0; + + /** + * Request deletion of a virtual traffic stream. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param stream_id ID of the virtual traffic stream. + */ + virtual void delete_traffic_stream( + u32_t request_id, + u32_t stream_id ) = 0; + + /** + * Start Protected Setup. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param iap_data IAP data used for running Protected Setup. + * @param iap_data_list IAP data results from a successful Protected Setup operation. + * @param protected_setup_status contains the error code of Protected Setup attempt + * on completion. + */ + virtual void run_protected_setup( + u32_t request_id, + const core_iap_data_s& iap_data, + core_type_list_c& iap_data_list, + core_protected_setup_status_e& protected_setup_status ) = 0; + + /** + * Initiate a roam to the given BSSID. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param bssid BSSID to roam to. If BSSID is set to BROADCAST_MAC_ADDR, + * search for a better BSS is initiated. + * @note This method does not guarantee that the a roam to the given BSSID + * will occur. If the roam succeeds, the request will be completed + * with core_error_ok, otherwise with an error code. + */ + virtual void directed_roam( + u32_t request_id, + const core_mac_address_s& bssid ) = 0; + + /** + * Synchronous methods. + */ + + /** + * Get the BSSID of the access point currently connected to. + * + * @since S60 v3.1 + * @param bssid BSSID of the access point. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_current_bssid( + core_mac_address_s& bssid ) = 0; + + /** + * Get the name of the network (SSID) currently connected to. + * + * @since S60 v3.1 + * @param ssid Current SSID. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_current_ssid( + core_ssid_s& ssid ) = 0; + + /** + * Get the current security mode of the connection. + * + * @since S60 v3.1 + * @param mode Current security mode. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_current_security_mode( + core_connection_security_mode_e& mode ) = 0; + + /** + * Get the current connection state. + * + * @since S60 v3.1 + * @param state Current connection state. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_current_connection_state( + core_connection_state_e& state ) = 0; + + /** + * Inform core server about updated device settings. + * + * @since S60 v3.1 + * @param settings Updated device settings. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + virtual core_error_e update_device_settings( + core_device_settings_s& settings ) = 0; + + /** + * Set the preferred power save mode. + * + * @since S60 v3.1 + * @param mode Preferred power save mode. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + virtual core_error_e set_power_save_mode( + const core_power_save_mode_s& mode ) = 0; + + /** + * Add a BSSID to the rogue list. + * + * Prevents roaming to the given BSSID and hides it from + * the scan results. + * + * @since S60 v3.1 + * @param bssid BSSID to add to the list. + * @return core_error_ok if success, an error code otherwise. + * @note The list entry will be persistent, meaning it will not + * be cleared when the connection is closed. + */ + virtual core_error_e add_bssid_to_rogue_list( + const core_mac_address_s& bssid ) = 0; + + /** + * Remove a BSSID from the rogue list. + * + * @since S60 v3.1 + * @param bssid BSSID to remove from the list. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e remove_bssid_from_rogue_list( + const core_mac_address_s& bssid ) = 0; + + /** + * Return a list of BSSIDs on the rogue list. + * + * @since S60 v3.2 + * @param rogue_list List of BSSIDs on the rogue list. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_rogue_list( + core_type_list_c& rogue_list ) = 0; + + /** + * Set the RCP level notification boundary. + * + * When the signal strength is getting worse (RCPI value is getting smaller), + * the core server will indicate core_notification_e::core_notification_rcp_changed + * when the RCPI value gets smaller than the the rcp_level_boundary value. + * + * When the signal strength is getting better, the core server will indicate + * core_notification_e::core_notification_rcp_changed when the RCPI value + * gets bigger than the combined value of rcp_level_boundary and hysteresis. + * + * @since S60 v3.1 + * @param rcp_level_boundary RCP level notification boundary. + * @param hysteresis Specifies the difference between boundaries when + * the RCP level is rising vs. descending + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e set_rcp_level_notification_boundary( + const i32_t rcp_level_boundary, + const i32_t hysteresis ) = 0; + + /** + * Clear packet statistics of the current connection. + * + * @since S60 v3.2 + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e clear_packet_statistics() = 0; + + /** + * Get the current U-APSD settings. + * + * @since S60 v3.2 + * @param settings Current U-APSD settings. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_uapsd_settings( + core_uapsd_settings_s& settings ) = 0; + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param settings Current U-APSD settings to be set. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + virtual core_error_e set_uapsd_settings( + const core_uapsd_settings_s& settings ) = 0; + + /** + * Get the current power save settings. + * + * @since S60 v3.2 + * @param settings Current power save settings. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_power_save_settings( + core_power_save_settings_s& settings ) = 0; + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param settings Current power save settings to be set. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + virtual core_error_e set_power_save_settings( + const core_power_save_settings_s& settings ) = 0; + + /** + * Get information about the current AP. + * + * @since S60 v3.2 + * @param info Information about the current AP. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_current_ap_info( + core_ap_information_s& info ) = 0; + + /** + * Get roam metrics of the current connection. + * + * @since S60 v3.2 + * @param roam_metrics Roam metrics of the current connection. + */ + virtual void get_roam_metrics( + core_roam_metrics_s& roam_metrics ) = 0; + + /** + * Set the arp filter. + * + * @since S60 v5.0 + * @param filter Current ARP filter to be set. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new filter + * is taken into use immediately. + */ + virtual core_error_e set_arp_filter( + const core_arp_filter_s& filter ) = 0; + + /** + * Delivers multicast MAC address to drivers. + * + * @since S60 v3.1 + * @param join_group is set true_t if adding a multicast address + * otherwise the address will be removed. + * @param multicast_addr contains the MAC address to add/remove + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new address + * is taken into use immediately. + */ + virtual core_error_e configure_multicast_group( + bool_t join_group, + const core_mac_address_s& multicast_addr ) = 0; + + /** + * Get information about current traffic statuses and traffic modes for + * access classes. + * + * @since S60 v3.2 + * @param info Information about the current traffic statuses and traffic modes. + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e get_current_ac_traffic_info( + core_ac_traffic_information_s& info ) = 0; + + /** + * Schedule an immediate driver unload. + * + * @since S60 v3.1 + * @return core_error_ok if success, an error code otherwise. + */ + virtual core_error_e unload_drivers() = 0; + + /** + * An asynchronous request from the core server has been completed. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param status Completion status of the request. + */ + virtual void request_complete( + u32_t request_id, + core_error_e status ) = 0; + + /** + * Cancel a pending asynchronous request. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + */ + virtual void cancel_request( + u32_t request_id ) = 0; + + }; + +#endif // ABS_CORE_SERVER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server_callback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_server_callback.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Callback interface from core server +* +*/ + + +#ifndef ABS_CORE_SERVER_CALLBACK_H +#define ABS_CORE_SERVER_CALLBACK_H + +#include "am_platform_libraries.h" +#include "core_types.h" + +class abs_wlan_eapol_callback_c; + +/** + * Abstract adaptation layer interface for core server callbacks. + * + * This interface is implemented by the adaptation layer and a reference + * to the class implementing it is passed as a parameter to the core server + * constructor. + * + * @since S60 v3.1 + * @see abs_core_server_c + */ +class abs_core_server_callback_c + { +public: + + /** + * Destructor. + */ + virtual ~abs_core_server_callback_c() {}; + + /** + * Notify about country information received from APs. + * @param request_id An unique identification for the request. + * @param found_region WLAN region information obtained from the AP's country information. + * @param inconsistent_info Information whether different APs gave inconsistent country information. + */ + virtual void store_ap_country_info( + u32_t request_id, + const core_wlan_region_e& found_region, + bool_t inconsistent_info ) = 0; + + /** + * Get current regulatory domain. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param region Current regulatory domain. + * @param mcc_known Information whether the WLAN region and MCC is currently known. + */ + virtual void get_regulatory_domain( + u32_t request_id, + core_wlan_region_e& region, + bool_t& mcc_known ) = 0; + + /** + * Send a notification to the adaptation layer. + * + * @since S60 v3.1 + * @param notification The notification to be sent. + * @param data_length Length of optional data. + * @param data Pointer to optional data. + */ + virtual void notify( + core_notification_e notification, + int_t data_length, + const u8_t* data ) = 0; + + /** + * An asynchronous request from the adaptation layer has been completed. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param status Completion status of the request. + */ + virtual void request_complete( + u32_t request_id, + core_error_e status ) = 0; + + /** + * Cancel a pending asynchronous request. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + */ + virtual void cancel_request( + u32_t request_id ) = 0; + + /** + * Initialize interface to EAPOL. + * + * @since S60 v3.2 + * @param mode Operating mode to use. + * @param partner Pointer to partner instance. + * @return Status value of operation. + */ + virtual u32_t load_eapol( + core_eapol_operating_mode_e mode, + abs_wlan_eapol_callback_c* const partner ) = 0; + + /** + * Shutdown EAPOL. + * + * @since S60 v3.2 + * @return Status value of operation. + */ + virtual u32_t shutdown() = 0; + + /** + * Configure EAPOL. + * + * @since S60 v3.2 + * @param header_offset Offset of EAP-header in packet_send. + * @param MTU Maximum transfer unit (MTU). + * @param trailer_length Length of trailer needed by lower levels.. + * @return Status value of operation. + */ + virtual u32_t configure( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ) = 0; + + /** + * Send data to EAPOL. + * + * @since S60 v3.2 + * @param data Pointer to data to be send. + * @param length Length of data to be send. + * @return Status value of operation. + */ + virtual u32_t process_data( + const void* const data, + const u32_t length ) = 0; + + }; + +#endif // ABS_CORE_SERVER_CALLBACK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_timer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_timer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Abstract interface for a generic timer class +* +*/ + + +#ifndef ABS_CORE_TIMER_H +#define ABS_CORE_TIMER_H + +#include "am_platform_libraries.h" +#include "core_types.h" + +/** +* Abstract interface class for a generic timer. +* +* Timers implementing this interface are created using +* the timer factory. +* @see core_timer_factory_c::create_timer +*/ +class abs_core_timer_c + { +public: // New functions + + /** + * Destructor. + */ + virtual ~abs_core_timer_c() {}; + + /** + * Start the timer. + * @param delay Expiration time in micro seconds. + */ + virtual void start( + u32_t delay ) = 0; + + /** + * Stop the timer. + */ + virtual void stop() = 0; + + /** + * Check whether the timer is active. + * @return Whether the timer is active. + */ + virtual bool_t is_active() const = 0; + }; + +#endif // ABS_CORE_TIMER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_wpx_adaptation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_core_wpx_adaptation.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to WPX adaptation. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef ABS_CORE_WPX_ADAPTATION_H +#define ABS_CORE_WPX_ADAPTATION_H + +#include "core_types.h" +#include "core_type_list.h" + +class core_iap_data_c; +class core_ap_data_c; +class core_server_c; +class abs_core_driverif_c; +class abs_core_server_callback_c; +class core_frame_dot11_ie_c; +class core_frame_beacon_c; +class core_frame_assoc_resp_c; +class core_frame_dot11_c; +class core_operation_base_c; + +/** + * This class hides WPX specific functionality. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( abs_core_wpx_adaptation_c ) + { + +public: + + /** + * Destructor. + */ + virtual ~abs_core_wpx_adaptation_c() {}; + + /** + * Returns the WPX key management suite from the given OUI. + * + * @since S60 v3.1 + * @param oui OUI to check for key management suite. + * @return core_key_management_none if no supported WPX key management suite found, + * otherwise the defined suite + */ + virtual core_key_management_e wpx_key_management_suite( + const u8_t* oui ) = 0; + + /** + * Convert the given key management suite to WPX specific OUI. + * + * @since S60 v3.1 + * @param key_management Key management suite to convert. + * @param data_length Length of the OUI element. + * @param data Pointer to the buffer for storing the OUI element. + * @return code_error_ok on success, an error code otherwise. + * @note On successful execution data_length parameter is changed + * to the size of data stored. + */ + virtual core_error_e get_wpx_key_management_oui( + core_key_management_e key_management, + u8_t& data_length, + u8_t* data ) = 0; + + /** + * Check whether the given AP has compatible WPX settings with the connection settings. + * + * @since S60 v3.1 + * @param reason The reason AP failed the check. + * @param ap_data AP data to compare. + * @param iap_data IAP data to compare. + * @return Whether further checking is allowed. + */ + virtual bool_t is_ap_wpx_compatible_with_iap( + core_connect_status_e& reason, + const core_ap_data_c& ap_data, + const core_iap_data_c& iap_data ) = 0; + + /** + * Process the given WPX frame. + * + * @since S60 v3.1 + * @param frame_type Type of the frame. + * @param frame_length Length of frame data. + * @param frame_data Pointer to the frame data. + * @return Whether the frame was handled. + */ + virtual bool_t handle_wpx_frame( + core_frame_type_e frame_type, + u16_t frame_length, + const u8_t* frame_data ) = 0; + + /** + * Handle a successful roam to WPX AP. + * + * @since S60 v3.1 + * @param ap_data AP information. + */ + virtual void handle_wpx_roam_success( + const core_ap_data_c& ap_data ) = 0; + + /** + * Handle a connection stop. + * + * @since S60 v3.2 + */ + virtual void handle_wpx_connection_stop() = 0; + + /** + * Handle the starting of WPX fast-roam reassociation. + * + * @since S60 v3.1 + * @param ap_data AP information. + * @param assoc_ie_list IEs added to be added to reassociation request. + * @return code_error_ok on success, an error code otherwise. + */ + virtual core_error_e handle_fast_roam_start_reassociation( + core_ap_data_c& ap_data, + core_type_list_c& assoc_ie_list ) = 0; + + /** + * Process the WPX fast-roam reassociation response frame. + * + * @since S60 v3.1 + * @param server Pointer to the core_server instance. + * @param frame Received reassociation response. + */ + virtual void handle_fast_roam_reassoc_resp( + core_frame_assoc_resp_c* frame ) = 0; + + /** + * Return the WPX specific IEs for the association request. + * + * @since S60 v3.1 + * @param ap_data AP being connected to. + * @param assoc_ie_list WPX IEs are added to this list. + */ + virtual void get_association_request_wpx_ie( + core_ap_data_c& ap_data, + core_type_list_c& assoc_ie_list ) = 0; + + /** + * Return the WPX version number. + * + * @since S60 v3.1 + * @param frame Frame to search for WPX version number. + * @return The WPX version number. Zero if none. + */ + virtual u8_t wpx_version( + core_frame_beacon_c* frame ) = 0; + + /** + * Return the maximum tx power level. + * + * @since S60 v3.1 + * @param frame Frame to search for maximum tx power level. + * @return Maximum tx power level, MAX_TX_POWER_LEVEL_NOT_DEFINED if none. + */ + virtual u8_t max_tx_power_level( + core_frame_beacon_c* frame ) = 0; + + /** + * Handle the WPX-specific features in traffic stream creation. + * + * @since S60 v3.2 + * @param ap_data AP being connected to. + * @param frame Frame containing the TSPEC parameters. + * @param tid TID of the traffic stream. + * @param tspec TSPEC parameters of the traffic stream. + */ + virtual void handle_ts_create_request( + const core_ap_data_c& ap_data, + core_frame_dot11_c* frame, + u8_t tid, + const core_traffic_stream_params_s& tspec ) = 0; + + /** + * Get the WPX-specific traffic stream parameters. + * + * @since S60 v3.2 + * @param frame Frame to be parsed. + * @param tid TID of the traffic stream. + * @param tspec Parameters are stored here. + */ + virtual void get_wpx_traffic_stream_params( + core_frame_dot11_c* frame, + u8_t tid, + core_traffic_stream_params_s& tspec ) = 0; + + /** + * Get the WPX-specific traffic stream status. + * + * @since S60 v3.2 + * @param status Status Code field from the ADDTS Response. + * @return The WPX-specific traffic stream status. + */ + virtual core_traffic_stream_status_e get_wpx_traffic_stream_status( + u8_t status ) = 0; + + /** + * Handle the WPX-specific features in association response. + * + * @since S60 v3.2 + * @param ap_data AP being connected to. + * @param frame Received reassociation response. + */ + virtual void handle_association_response( + core_ap_data_c& ap_data, + core_frame_assoc_resp_c* frame ) = 0; + + /** + * Handle the WPX-specific operations after successful traffic stream creation. + * + * @since S60 v3.2 + * @param frame Frame containing the TSPEC parameters. + * @param tid TID of the traffic stream. + * @param user_priority User Priority of the traffic stream. + */ + virtual void handle_ts_create_success( + core_frame_dot11_c* frame, + u8_t tid, + u8_t user_priority ) = 0; + + /** + * Handle the WPX-specific operations after traffic stream deletion. + * + * @since S60 v3.2 + * @param tid TID of the traffic stream. + * @param user_priority User Priority of the traffic stream. + */ + virtual void handle_ts_delete( + u8_t tid, + u8_t user_priority ) = 0; + + /** + * Check whether the given management status code is WPX-specific. + * + * @since S60 v3.2 + * @param management_status Management status code to check. + * @return Whether the given status code is WPX-specific. + */ + virtual bool_t is_wpx_management_status( + u32_t management_status ) = 0; + + /** + * Check whether the given WPX-specific management status code is considered fatal. + * + * @since S60 v3.2 + * @param management_status Management status code to check. + * @return Whether the given status code is considered fatal. + */ + virtual bool_t is_fatal_wpx_management_status( + u32_t management_status ) = 0; + + /** + * Get the encryption mode used for connection. + * + * @since S60 v3.2 + * @param ap_data AP being connected to. + * @param mode Suggested encryption mode. + * @return The encryption mode used for connection. + */ + virtual core_encryption_mode_e encryption_mode( + core_ap_data_c& ap_data, + core_encryption_mode_e mode ) = 0; + + /** + * Get the authentication algorithm number used for connection. + * + * @since S60 v3.2 + * @param eapol_auth_type The type of authentication. + * @param eapol_auth_mode The authentication mode requested by EAPOL. + * @return The authentication algorithm number used for connection. + */ + virtual u16_t authentication_algorithm( + wlan_eapol_if_eapol_key_authentication_type_e eapol_auth_type, + wlan_eapol_if_eapol_key_authentication_mode_e eapol_auth_mode ) = 0; + + /** + * Return a WPX specific operation to be run during loading of drivers. + * + * @since S60 v3.2 + * @return Pointer to the operation instance, NULL if none. + */ + virtual core_operation_base_c* get_wpx_load_drivers_operation() = 0; + + }; + +#endif // ABS_CORE_WPX_ADAPTATION_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_wlan_eapol_callback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_wlan_eapol_callback.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Callback interface from WLM server to eapol_handler +* +*/ + + +#ifndef ABS_WLAN_EAPOL_CALLBACK_H +#define ABS_WLAN_EAPOL_CALLBACK_H + +#include "am_platform_libraries.h" + +/** + * Abstract adaptation layer interface for eapol callbacks. + * + * @since S60 v3.2 + */ +class abs_wlan_eapol_callback_c + { +public: + + /** + * Destructor. + */ + virtual ~abs_wlan_eapol_callback_c() {}; + + /** + * Callback interface to partner. + * + * @since S60 v3.2 + * @param data Pointer to the data to be sent. + * @param length Length of the data to be sent. + * @return Return value is specified in interface specification. + */ + virtual u32_t send_data( + const void * const data, + const u32_t length ) = 0; + + }; + +#endif // ABS_WLAN_EAPOL_CALLBACK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_wlan_eapol_callback_interface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/abs_wlan_eapol_callback_interface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2001-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to EAPOL authentication protocols. +* +*/ + + +#ifndef ABS_WLAN_EAPOL_CALLBACK_INTERFACE_H +#define ABS_WLAN_EAPOL_CALLBACK_INTERFACE_H + +#include "core_type_list.h" +#include "core_wlan_eapol_if_message.h" + + +/// The abs_wlan_eapol_callback_interface_c class defines the interface the EAPOL +/// will use with the partner class. +class abs_wlan_eapol_callback_interface_c +{ +public: + //-------------------------------------------------- + + // Destructor + virtual ~abs_wlan_eapol_callback_interface_c() + { + } + + // Constructor + abs_wlan_eapol_callback_interface_c() + { + } + + /** + * EAPOL could send packets to partner class with this function. + */ + virtual core_error_e packet_send( + network_id_c * send_network_id, + u8_t * packet_data, + u32_t packet_data_length, + bool_t send_unencrypted ) = 0; + + /** + * This function call tells lower layer to associate with the selected 802.11 authentication mode. + */ + virtual core_error_e associate( + wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ) = 0; + + /** + * Lower layer must return value of self_disassociation when it calls disassociation(). + * This tells the cause of disassociation. + */ + virtual core_error_e disassociate( + network_id_c * receive_network_id, + const bool_t self_disassociation) = 0; + + /** + * The packet_data_session_key() function passes one traffic encryption key to + * the lower layers. Ultimately the key can end up to the WLAN hardware. + */ + virtual core_error_e packet_data_session_key( + network_id_c * send_network_id, + session_key_c * key + ) = 0; + + /** + * This is notification of internal state transition. + * This is used for notifications, debugging and protocol testing. + * The primal notifications are wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull + * and wlan_eapol_if_eap_state_authentication_terminated_unsuccessfully. + * These two notifications are sent from EAP-protocol layer (wlan_eapol_if_eap_protocol_layer_eap). + */ + virtual void state_notification( + state_notification_c * state ) = 0; + + /** + * This function call tells lower layer to re-associate with the selected network ID, + * authentication type and PMKID. + */ + virtual core_error_e reassociate( + network_id_c * send_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e authentication_type, + u8_t * PMKID, + u32_t PMKID_length ) = 0; + + /** + * The complete_check_pmksa_cache() function completes check_pmksa_cache query. + */ + virtual core_error_e complete_check_pmksa_cache( + core_type_list_c & network_id_list ) = 0; + + /** + * The complete_start_wpx_fast_roam_reassociation() function completes start_wpx_fast_roam_reassociation function. + */ + virtual core_error_e complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ) = 0; + + /** + * The new_protected_setup_credentials() function gives credentials got from + * Protected Setup negotiation. + */ + virtual core_error_e new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ) = 0; + + /** + * The handle_error() function tells about error from EAPOL side. + */ + virtual void handle_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ) = 0; + + //-------------------------------------------------- +}; // class abs_wlan_eapol_callback_interface_c + +#endif //#ifndef ABS_WLAN_EAPOL_CALLBACK_INTERFACE_H + +//-------------------------------------------------- + + +// End. diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_am_tools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_am_tools.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definitions for small utilities implemented by the adaptation +* +*/ + + +#ifndef CORE_AM_TOOLS_H +#define CORE_AM_TOOLS_H + +#include "core_types.h" + +/** + * Class for small platform-dependant helper methods. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_am_tools_c ) + { + +public: + + /** + * Return the current moment of time. + * + * @since S60 v3.1 + * @return The moment of time. + */ + static u64_t timestamp(); + + /** + * Return random number. + * + * @since S60 v5.2 + * @return Random number. + */ + static u32_t random(); + + }; + +#endif // CORE_AM_TOOLS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_ap_data.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_ap_data.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,491 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class holding access point specific information +* +*/ + +/* +* %version: 23 % +*/ + +#ifndef CORE_AP_DATA_H +#define CORE_AP_DATA_H + +#include "core_types.h" +#include "core_scan_channels.h" +#include "core_frame_mgmt_ie.h" +#include "abs_core_wpx_adaptation.h" + +const u32_t CORE_EAPOL_WPAIE_DATA_OFFSET = 2; + +class core_frame_dot11_c; +class core_frame_dot11_ie_c; +class core_frame_rsn_ie_c; +class core_frame_wpa_ie_c; +class core_frame_wsc_ie_c; +class core_frame_beacon_c; +class core_frame_wmm_ie_parameter_c; +class core_frame_qbss_load_ie_c; +class core_frame_wapi_ie_c; + +/** + * Class encapsulating a single AP parsed from the scan results. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_ap_data_c ) + { + +public: + + typedef enum _core_am_ap_data_capability + { + core_am_ap_data_capability_rsn_ie_present = 1, + core_am_ap_data_capability_wpa_ie_present = 2, + core_am_ap_data_capability_wmm_ie_present = 4, + core_am_ap_data_capability_uapsd_supported = 8, + core_am_ap_data_capability_wapi_ie_present = 16 + } core_am_ap_data_capability; + + /** + * Factory method used for creating an instance of core_ap_data_c + * encapsulating the copy of the given core_ap_data_c instance. + * + * @since S60 v3.1 + * @param copy Instance to be copied. + * @return Instance of the class, NULL if parsing failed. + */ + static core_ap_data_c* instance( + const core_ap_data_c& copy ); + + /** + * Factory method used for creating an instance of core_ap_data_c + * encapsulating the given beacon/probe response frame. + * + * @since S60 v3.1 + * @param wpx_adaptation WPX adaptation. + * @param frame Beacon/probe response frame to be encapsulated. + * @param rcpi RCPI value of the frame. + * @param is_copied Whether the object should take a copy of the frame data. + * @return Instance of the class, NULL if parsing failed. + */ + static core_ap_data_c* instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + const core_frame_dot11_c* frame, + u8_t rcpi, + bool_t is_copied ); + + /** + * Destructor. + */ + virtual ~core_ap_data_c(); + + /** + * Get BSSID of the AP. + * + * @since S60 v3.1 + * @return BSSID of the AP. + */ + core_mac_address_s bssid() const; + + /** + * Get the SSID of the AP. + */ + core_ssid_s ssid(); + + /** + * Get the capabilities field of the AP. + * + * @since S60 v3.1 + * @return Capabilities field of the AP. + */ + u16_t capabilities() const; + + /** + * Get the maximum allowed tx power level. + * + * @since S60 v3.1 + * @return Maximum allowed tx power level, + * MAX_TX_POWER_LEVEL_NOT_DEFINED if not defined. + */ + u8_t max_tx_power_level() const; + + /** + * Get the country information. + * + * @since S60 v5.0 + * @return Country information, country information is zero if not defined. + */ + core_country_string_s country_info() const; + + /** + * Get the privacy field of the AP. + * + * @since S60 v3.1 + * @return Privacy field of the AP. + */ + bool_t is_privacy_enabled() const; + + /** + * whether short preamble is allowed or not. If not, long must be used. + * + * @since S60 v3.1 + * @return true if short is allowed + */ + bool_t is_short_preamble_allowed() const; + + /** + * whether short slot time is allowed or not. If not, long must be used. + * + * @since S60 v3.1 + * @return true if short is allowed + */ + bool_t is_short_slot_time_used() const; + + /** + * whether accesspoint (i.e. infra) or ad hoc network + * + * @since S60 v3.1 + * @return true if infrastrcture network + */ + bool_t is_infra() const; + + /** + * Whether radio measurement is supported. + * + * @since S60 v5.2 + * @return Whether radio measurement is supported + */ + bool_t is_radio_measurement_supported() const; + + /** + * is WPA IE present or not + * + * @since S60 v3.1 + * @return true if present + */ + bool_t is_wpa_ie_present() const; + + /** + * is RSN IE present or not + * + * @since S60 v3.1 + * @return true if present + */ + bool_t is_rsn_ie_present() const; + + /** + * is WMM IE present or not + * + * @since S60 v3.2 + * @return true if present + */ + bool_t is_wmm_ie_present() const; + + /** + * Whether U-APSD is supported. + * + * @since S60 v3.2 + * @return Whether U-APSD is supported. + */ + bool_t is_uapsd_supported() const; + + /** + * Return whether Admission Control is mandatory for the given access class. + * @return Whether Admission Control is mandatory for the given access class. + */ + bool_t is_admission_control_required( + core_access_class_e access_class ) const; + + /** + * is WAPI IE present or not + * + * @since S60 v3.2 + * @return true if present + */ + bool_t is_wapi_ie_present() const; + + /** + * pairwise_ciphers + * + * @since S60 v3.1 + * @return pairwise key + */ + u8_t pairwise_ciphers() const; + + /** + * group_cipher + * + * @since S60 v3.1 + * @return group key + */ + u8_t group_cipher() const; + + /** + * key_management_suites of the AP + * + * @since S60 v3.1 + * @return + */ + u8_t key_management_suites() const; + + /** + * best_pairwise_cipher + * + * @since S60 v3.1 + * @return + */ + core_cipher_suite_e best_pairwise_cipher() const; + + /** + * best_group_cipher + * + * @since S60 v3.1 + * @return + */ + core_cipher_suite_e best_group_cipher() const; + + /** + * is wpx supported or not by the AP + * + * @since S60 v3.1 + * @return + */ + bool_t is_wpx() const; + + /** + * Return the WPX version. + * + * @since S60 v3.2 + * @return The WPX version. + */ + u8_t wpx_version() const; + + /** + * channel where AP operates + * + * @since S60 v3.1 + * @return + */ + u8_t channel() const; + + /** + * is_wpx_fast_roam_available + * + * @since S60 v3.1 + * @return + */ + bool_t is_wpx_fast_roam_available() const; + + /** + * timestamp + * + * @since S60 v3.1 + * @return + */ + core_tsf_value_s timestamp() const; + + /** + * band + * + * @since S60 v3.1 + * @return + */ + u8_t band() const; + + /** + * Get RCPI value of the frame. + * + * @since S60 v3.1 + * @return RCPI value of the frame. + */ + u8_t rcpi() const; + + /** + * Return the beacon interval of the frame. + * + * @since S60 v3.1 + * @return The beacon interval of the frame. + */ + u16_t beacon_interval() const; + + /** + * Return the DTIM period of the AP. + * + * @since S60 v3.2 + * @return The DTIM period of the AP. + */ + u8_t dtim_period() const; + + /** + * Set the DTIM period of the AP. + * + * @since S60 v3.2 + * @param dtim_period The DTIM period of the AP. + */ + void set_dtim_period( + u8_t dtim_period ); + + /** + * Get the actual beacon/probe response frame of the AP. + * + * @since S60 v3.1 + * @return The actual beacon/probe response frame of the AP. + */ + core_frame_beacon_c* frame() const; + + /** + * Return an WPA IE parser instance. + * @return NULL if no WPA IE present, pointer to instance otherwise. + */ + const core_frame_wpa_ie_c* wpa_ie(); + + /** + * Return an RSN IE parser instance. + * @return NULL if no RSN IE present, pointer to instance otherwise. + */ + const core_frame_rsn_ie_c* rsn_ie(); + + /** + * Return an WSC IE parser instance. + * @return NULL if no WSC IE present, pointer to instance otherwise. + */ + const core_frame_wsc_ie_c* wsc_ie(); + + /** + * Return a WMM Parameter Element IE parser instance. + * @return NULL if no WMM Parameter Element IE present, pointer to instance otherwise. + */ + const core_frame_wmm_ie_parameter_c* wmm_parameter_ie(); + + /** + * Return an 802.11e QBSS Load IE parser instance. + * @return NULL if no 802.11e QBSS Load IE present, pointer to instance otherwise. + */ + const core_frame_qbss_load_ie_c* qbss_load_ie(); + + /** + * Process AP channel report information elements. + * + * @since S60 v5.1 + * @return + */ + core_scan_channels_c ap_channel_report(); + + /** + * Return a WAPI IE parser instance. + * @return NULL if no WAPI IE present, pointer to instance otherwise. + */ + const core_frame_wapi_ie_c* wapi_ie(); + + /** + * Get an 802.11k Admission Capacities. + * @param admission_capacities Admission Capacities. + */ + void admission_capacity( + medium_time_s& admission_capacities ); + + /** + * Return power capability. + * @return power capability. + */ + u8_t power_capability(); + + /** + * Return RRM capabilities. + * @return RRM capabilities. + */ + u64_t rrm_capabilities(); + + /** + * Get reported frame body. + * @param reported_frame_body_length Reported frame body length. + * @param reported_frame_body Reported frame body. + */ + void get_reported_frame_body( + u16_t* reported_frame_body_length, + u8_t* reported_frame_body ); + + /** + * Get Request IE. + * @param reported_frame_body_length Reported frame body length. + * @param reported_frame_body Reported frame body. + * @param ie_id_list IE ID list. + * @param ie_id_list_length IE ID list length. + */ + void request_ie( + u16_t* reported_frame_body_length, + u8_t* reported_frame_body, + u8_t* ie_id_list, + u8_t ie_id_list_length ); + + /** + * Assignment operator. + */ + core_ap_data_c& operator=( + const core_ap_data_c& src ); + +private: + + /** + * Constructor. + * + * @param wpx_adaptation WPX adaptation. + */ + core_ap_data_c( + abs_core_wpx_adaptation_c& wpx_adaptation ); + + /** + * Return the most secure cipher from the given list. + * @param ciphers List of ciphers to choose from. + * @return The most secure cipher from the given list. + */ + core_cipher_suite_e best_cipher( + u32_t ciphers ) const; + +private: // data + + /** WPX adaptation instance. */ + abs_core_wpx_adaptation_c& wpx_adaptation_m; + + /** Beacon/Probe response frame. */ + core_frame_beacon_c* frame_m; + + /** RCPI value of the frame. */ + u8_t rcpi_m; + + /** Supported pairwise ciphers. */ + u8_t pairwise_cipher_m; + + /** Supported group ciphers. */ + u8_t group_cipher_m; + + /** Supported key management suites. */ + u8_t key_management_m; + + /** The WPX version supported by the AP. */ + u8_t wpx_version_m; + + /** Bitmap of different boolean capabilities. */ + u8_t capabilities_bitmap_m; + + /** Bitmap of AC classes that require admission control. */ + u8_t is_ac_required_bitmap_m; + + /** DTIM period. */ + u8_t dtim_period_m; + + }; + +#endif // CORE_AP_DATA_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_callback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_callback.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class wrapping necessary information for a callback method. +* +*/ + + +#ifndef CORE_CALLBACK_H +#define CORE_CALLBACK_H + +/** + * Class wrapping necessary information for a callback method. + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS(core_callback_c) + { +public: + + inline core_callback_c(void (*function)(void* ptr), void* ptr ); + + /** + * A pointer to the callback function. + */ + void (*func_m)(void* ptr); + + /** + * A pointer that is passed to the callback function when + * the function is called. + */ + void* ptr_m; + }; + +inline core_callback_c::core_callback_c(void (*function)(void* ptr), void* ptr ) + : func_m(function), ptr_m(ptr) + {} + +#endif // CORE_CALLBACK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_connection_data.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_connection_data.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,794 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class holding all connection related data +* +*/ + +/* +* %version: 33 % +*/ + +#ifndef CORE_CONNECTION_DATA_H +#define CORE_CONNECTION_DATA_H + +#include "genscaninfo.h" +#include "core_types.h" +#include "core_type_list.h" +#include "core_ap_data.h" +#include "core_iap_data.h" +#include "core_scan_channels.h" +#include "core_traffic_stream_list.h" +#include "core_virtual_traffic_stream_list.h" + +/** + * Structure for storing AP failure count. + */ +struct core_ap_failure_count_s + { + core_mac_address_s bssid; ///< BSSID of the AP. + u8_t count; ///< The number of failures. + }; + +/** + * Structure for storing AP authentication failure count. + */ +struct core_ap_auth_failure_count_s + { + core_mac_address_s bssid; ///< BSSID of the AP. + u8_t count; ///< The number of authentication failures. + }; + +/** + * Structure for storing AP power save test verdicts. + */ +struct core_ap_power_save_test_verdict_s + { + core_mac_address_s bssid; ///< BSSID of the AP. + bool_t is_success; ///< Whether power save test was successful + }; + +/** + * Class holding all connection related data + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_connection_data_c ) + { + +public: + + /** + * Constructor + */ + core_connection_data_c( + const core_iap_data_s& iap_data, + const core_device_settings_s& device_settings ); + + /** + * Destructor + */ + ~core_connection_data_c(); + + /** + * Return IAP specific data for the current connection. + * + * @since S60 v3.1 + * @return IAP specific data of the connection + */ + core_iap_data_c& iap_data(); + + /** + * connect_status + * + * @since S60 v3.1 + * @return connect status of the connection + */ + core_connect_status_e connect_status() const; + + /** + * set_connect_status + * + * @since S60 v3.1 + * @param connect_status specifying the status of the connection + * (either OK or an error code) + */ + void set_connect_status( + core_connect_status_e connect_status ); + + /** + * set_current_ap_data + * + * @since S60 v3.1 + * @param access point specific data + */ + void set_current_ap_data( + const core_ap_data_c& ap_data ); + + /** + * current_ap_data + * + * @since S60 v3.1 + * @return access point specific data + */ + core_ap_data_c* current_ap_data(); + + /** + * set_previous_ap_data + * + * @since S60 v3.1 + * @param access point specific data + */ + void set_previous_ap_data( + const core_ap_data_c& ap_data ); + + /** + * previous_ap_data + * + * @since S60 v3.1 + * @return access point specific data + */ + core_ap_data_c* previous_ap_data(); + + /** + * ssid + * + * @since S60 v3.1 + * return SSID of the connection + */ + const core_ssid_s& ssid() const; + + /** + * set_ssid + * + * @since S60 v3.1 + * @param SSID of the connection + */ + void set_ssid( const core_ssid_s& ssid ); + + /** + * Check whether the given MAC address is permanently blacklisted. + * + * @since S60 v3.1 + * @param mac MAC address to be checked. + * @return Whether the given MAC address is permanently blacklisted. + */ + bool_t is_mac_in_temporary_blacklist( + const core_mac_address_s& mac ); + + /** + * Add a MAC address to the permanent blacklist. + * + * @since S60 v3.1 + * @param mac MAC address to be added. + * @param reason Reason for the blacklist. + */ + void add_mac_to_temporary_blacklist( + const core_mac_address_s& mac, + core_ap_blacklist_reason_e reason ); + + /** + * Remove a MAC address from the permanent blacklist. + * + * @since S60 v3.1 + * @param mac MAC address to be removed. + */ + void remove_mac_from_temporary_blacklist( + const core_mac_address_s& mac ); + + /** + * Return the temporary blacklist. + * + * @since S60 v3.2 + * @return The temporary blacklist. + */ + core_type_list_c& temporary_blacklist(); + + /** + * Remove the entries blacklisted with one of the given reasons. + * + * @since S60 v3.1 + * @param reasons Bitmap of reasons to remove. + */ + void remove_temporary_blacklist_entries( + u32_t reasons ); + + /** + * Return the last RCPI class notified to the clients. + * + * @since S60 v3.1 + * @return The last RCPI class notified to the clients. + */ + core_rcp_class_e last_rcp_class() const; + + /** + * Set the last RCPI class notified to the clients. + * + * @since S60 v3.1 + * @param type The last RCPI class notified to the clients. + */ + void set_last_rcp_class( + core_rcp_class_e type ); + + /** + * Return the last TX level notified to the clients. + * + * @since S60 v3.1 + * @return The last TX level notified to the clients. + */ + u32_t last_tx_level() const; + + /** + * Set the last TX level notified to the clients. + * + * @since S60 v3.1 + * @param type The last TX level notified to the clients. + */ + void set_last_tx_level( + u32_t tx_level ); + + /** + * Return the last BSSID notified to the clients. + * + * @since S60 v3.1 + * @return The last BSSID notified to the clients. + */ + const core_mac_address_s& last_bssid() const; + + /** + * Set the last BSSID notified to the clients. + * + * @since S60 v3.1 + * @param type The last BSSID notified to the clients. + */ + void set_last_bssid( + const core_mac_address_s& bssid ); + + /** + * Return the connection state. + * NOTE: This should only be called when there exists some connection. + * + * @since S60 v3.1 + * @return type of the connection: {secure|insecure} {infrastructure|ad hoc} network + */ + core_connection_state_e connection_state() const; + + /** + * Return the last connection state notified to the clients. + * NOTE: This should not be considered as the actual/official WLAN connection state + * (use core_settings_c::connection_state() instead). + * + * @since S60 v3.1 + * @return The last connection state notified to the clients. + */ + core_connection_state_e last_connection_state() const; + + /** + * Set the last connection state notified to the clients. + * NOTE: This should not be considered as the actual/official WLAN connection state + * (use core_settings_c::set_connection_state() instead). + * + * @since S60 v3.1 + * @param type The last connection state notified to the clients. + */ + void set_last_connection_state( + core_connection_state_e state ); + + /** + * Return the number of association failures to the given AP. + * + * @param bssid BSSID of the AP to check. + * @return The number of association failures. + */ + u8_t ap_association_failure_count( + const core_mac_address_s& bssid ); + + /** + * Increase the given AP association failure count by one. + * + * @param bssid BSSID of the AP. + */ + void increase_ap_association_failure_count( + const core_mac_address_s& bssid ); + + /** + * Clear the association failure count for the given AP. + */ + void clear_ap_association_failure_count( + const core_mac_address_s& bssid ); + + /** + * Return the number of authentication failures to the given AP. + * + * @param bssid BSSID of the AP to check. + * @return The number of association failures. + */ + u8_t ap_authentication_failure_count( + const core_mac_address_s& bssid ); + + /** + * Increase the given AP authentication failure count by one. + * + * @param bssid BSSID of the AP. + */ + void increase_ap_authentication_failure_count( + const core_mac_address_s& bssid ); + + /** + * Clear all authentication failure counts. + */ + void clear_all_authentication_failure_counts(); + + + /** + * Return the number of deauthentications. + * + * @param bssid BSSID of the AP to check. + * @return The number of deauthentications. + */ + u8_t ap_deauthentication_count( + const core_mac_address_s& bssid ); + + /** + * Increase the given AP's deauthentication count. + * + * @param bssid BSSID of the AP. + */ + void increase_ap_deauthentication_count( + const core_mac_address_s& bssid ); + + /** + * Get the last failed EAP-type. + * + * @since S60 v3.1 + * @return The last failed EAP-type. + */ + u32_t last_failed_eap_type() const; + + /** + * Set the last failed EAP-type. + * + * @since S60 v3.1 + * @param type The last failed EAP-type. + */ + void set_last_failed_eap_type( + u32_t type ); + + /** + * Get the last EAP-specific error code. + * + * @since S60 v3.1 + * @return The last EAP-specific error code. + */ + u32_t last_eap_error() const; + + /** + * Set the last EAP-specific error code. + * + * @since S60 v3.1 + * @param error The last EAP-specific error code. + */ + void set_last_eap_error( + u32_t error ); + + /** + * Return a channel mask of suitable APs based on the + * information received from an AP. + * + * @since S60 v3.1 + * @return A channel mask of suitable APs. + */ + const core_scan_channels_c& adjacent_ap_channels() const; + + /** + * Store a channel mask of suitable APs based on the + * information received from an AP. + * + * @since S60 v3.1 + * @param channels A channel mask of suitable APs. + */ + void set_adjacent_ap_channels( + const core_scan_channels_c& channels ); + + /** + * Merge a channel mask of suitable APs based on the + * information received from an AP. + * + * @since S60 v5.2 + * @param channels A channel mask of suitable APs. + */ + void merge_adjacent_ap_channels( + const core_scan_channels_c& channels ); + + /** + * Check whether EAPOL authentication has been started. + * + * @since S60 v3.1 + * @return Whether EAPOL authentication has been started. + */ + bool_t is_eapol_authentication_started() const; + + /** + * Set the status of EAPOL authentication. + * + * This status indicates whether WLAN engine has called + * start_reassociation() or start_authentication(). + * + * @since S60 v3.1 + * @param is_authentication_started Whether EAPOL authentication has been started. + */ + void set_eapol_authentication_started( + bool_t is_authentication_started ); + + /** + * Check whether EAPOL is running an authentication. + * + * @since S60 v3.1 + * @return Whether EAPOL is running an authentication. + */ + bool_t is_eapol_authenticating() const; + + /** + * Set the status of EAPOL authentication. + * + * This status indicates whether EAPOL has signaled it has + * started running EAP authentication and/or 4-way handshake. + * + * @since S60 v3.1 + * @param is_authenticating Whether EAPOL is running an authentication. + */ + void set_eapol_authenticating( + bool_t is_authenticating ); + + /** + * Get the BSSID currently being authenticated against. + * + * @since S60 v3.1 + * @return The BSSID currently being authenticated against. + */ + const core_mac_address_s& eapol_auth_bssid() const; + + /** + * Get the BSSID currently being authenticated against. + * + * @since S60 v3.1 + * @param bssid The BSSID currently being authenticated against. + */ + void set_eapol_auth_bssid( + const core_mac_address_s& bssid ); + + /** + * Return the list of active traffic streams. + * + * @since S60 v3.2 + * @return The list of active traffic streams. + */ + core_traffic_stream_list_c& traffic_stream_list(); + + /** + * Return the list of virtual traffic streams. + * + * @since S60 v3.2 + * @return The list of active traffic streams. + */ + core_virtual_traffic_stream_list_c& virtual_traffic_stream_list(); + + /** + * Check whether EAPOL is connecting. + * + * @since S60 v3.1 + * @return Whether EAPOL is connecting. + */ + bool_t is_eapol_connecting() const; + + /** + * Set the status of EAPOL connection. + * + * @since S60 v3.1 + * @param is_eapol_connecting Whether EAPOL is connecting. + */ + void set_eapol_connecting( + bool_t is_eapol_connecting ); + + /** + * Check whether disconnection is ongoing. + * + * @since S60 v3.2 + * @return Whether disconnection is ongoing. + */ + bool_t is_disconnecting() const; + + /** + * Set the status of disconnection. + * + * @since S60 v3.2 + * @param is_disconnecting Whether disconnection is ongoing. + */ + void set_disconnecting( + bool_t is_disconnecting ); + + /** + * Get the current RCPI roam check interval values. + * + * @since S60 v3.2 + * @return The current RCPI roam check interval values. + */ + const core_rcpi_roam_interval_s& rcpi_roam_interval() const; + + /** + * Set the current RCPI roam check interval values back to initial values. + * + * @since S60 v3.2 + */ + void reset_rcpi_roam_interval(); + + /** + * Set the current RCPI roam check interval values. + * + * @since S60 v3.2 + * @param interval The current RCPI roam check interval values. + */ + void set_core_rcpi_roam_interval( + const core_rcpi_roam_interval_s& interval ); + + /** + * Get the reason for the last roam. + * + * @since S60 v3.2 + * @return The reason for the last roam. + */ + core_roam_reason_e last_roam_reason() const; + + /** + * Set the reason for the last roam. + * + * @since S60 v3.2 + * @param reason The reason for the last roam. + */ + void set_last_roam_reason( + core_roam_reason_e reason ); + + /** + * Get the reason for the last roam failure. + * + * @since S60 v3.2 + * @return The reason for the last roam failure. + */ + core_roam_failed_reason_e last_roam_failed_reason() const; + + /** + * Set the reason for the last roam failure. + * + * @since S60 v3.2 + * @param reason The reason for the last roam failure. + */ + void set_last_roam_failed_reason( + core_roam_failed_reason_e reason ); + + /** + * Check whether power save test has been run on the given AP. + * + * @param bssid BSSID of the AP to check. + * @param is_success Whether the test was successful or not. + * @return Whether power save test has been run on the given AP. + */ + bool_t is_ap_power_save_test_run( + const core_mac_address_s& bssid, + bool_t& is_success ); + + /** + * Set the power save test verdict on the given the AP. + * + * @param bssid BSSID of the AP. + * @param is_success Whether the test was successful or not. + */ + void add_ap_power_save_test_verdict( + const core_mac_address_s& bssid, + bool_t is_success ); + + /** + * Check whether EAPOL requires to do new connect right after failed authentication. + * + * @since S60 v3.2 + * @return Whether immediate reconnect is required. + */ + bool_t is_eapol_require_immediate_reconnect() const; + + /** + * Set the state that EAPOL requires to do new connect right after failed authentication. + * + * @since S60 v3.2 + * @param is_immediate_reconnect_required Whether EAPOL requires immediate reconnect + * after failed authentication. + */ + void set_eapol_require_immediate_reconnect( + bool_t is_immediate_reconnect_required ); + + /** + * Check whether voice call is currently on. + * + * @since S60 v5.2 + * @return Whether voice call is on. + */ + bool_t voice_call_state() const; + + /** + * Set voice call state. + * + * @since S60 v5.2 + * @param is_voice_call_on Voice call state to set. + */ + void set_voice_call_state( const bool_t& is_voice_call_on ); + + /** + * Get previous RRM Measurement Request time. + * + * @since S60 v5.2 + * @return Timestamp when the previous request + * was received. + */ + const u64_t& get_previous_rrm_measurement_request_time() const; + + /** + * Set previous RRM Measurement Request time. + * + * @since S60 v5.2 + * @param timestamp Timestamp to set. + */ + void set_previous_rrm_measurement_request_time( const u64_t& timestamp ); + + /** + * Get the current traffic status for the given access class. + * + * @since S60 v5.2 + * @param access_class Access class to get. + * @return Current traffic status for the given access class. + */ + core_access_class_traffic_status_e ac_traffic_status( + core_access_class_e access_class ) const; + + /** + * Set the current traffic status for the given access class. + * + * @since S60 v5.2 + * @param access_class Access class to set. + * @param status Traffic status to set. + */ + void set_ac_traffic_status( + core_access_class_e access_class, + core_access_class_traffic_status_e status ); + + /** + * Get the current traffic mode for the given access class. + * + * @since S60 v5.2 + * @param access_class Access class to get. + * @return Current traffic mode for the given access class. + */ + core_access_class_traffic_mode_e ac_traffic_mode( + core_access_class_e access_class ) const; + + /** + * Set the current traffic mode for the given access class. + * + * @since S60 v5.2 + * @param access_class Access class to set. + * @param status Traffic mode to set. + */ + void set_ac_traffic_mode( + core_access_class_e access_class, + core_access_class_traffic_mode_e mode ); + +private: // data + + /** Adaptation side data about the WLAN connection */ + core_iap_data_c iap_data_m; + + /** Handle to device settings. */ + const core_device_settings_s& device_settings_m; + + /** Connect status from adaptation */ + core_connect_status_e connect_status_m; + + /** Previous AP data */ + core_ap_data_c* previous_ap_m; + + /** Current AP data */ + core_ap_data_c* current_ap_m; + + /** SSID */ + core_ssid_s ssid_m; + + /** Temporary blacklist of APs. */ + core_type_list_c temp_blacklist_m; + + /** The RCPI class last notified. */ + core_rcp_class_e last_rcp_class_m; + + /** The TX level last notified. */ + u32_t last_tx_level_m; + + /** The BSSID last notified. */ + core_mac_address_s last_bssid_m; + + /** The connection state last notified. */ + core_connection_state_e last_connection_state_m; + + /** List for storing AP association failure counts. */ + core_type_list_c association_failure_count_m; + + /** List for storing AP authentication failure counts. */ + core_type_list_c authentication_failure_count_m; + + /** List for storing AP deauthentication counts. */ + core_type_list_c deauthentication_count_m; + + /** The last failed EAP type. */ + u32_t last_eap_type_m; + + /** The last EAP-specific error code. */ + u32_t last_eap_error_code_m; + + /** A channel mask of suitable APs. */ + core_scan_channels_c adjacent_ap_channels_m; + + /** Whether EAPOL authentication has been started. */ + bool_t is_eapol_authentication_started_m; + + /** Whether EAPOL is running an authentication. */ + bool_t is_eapol_authenticating_m; + + /** The BSSID currently being authenticated against. */ + core_mac_address_s eapol_auth_bssid_m; + + /** List of active traffic streams. */ + core_traffic_stream_list_c traffic_stream_list_m; + + /** List of virtual traffic streams. */ + core_virtual_traffic_stream_list_c virtual_traffic_stream_list_m; + + /** Whether EAPOL is connecting. */ + bool_t is_eapol_connecting_m; + + /** Whether disconnection is ongoing. */ + bool_t is_disconnecting_m; + + /** The reason for the last roam. */ + core_roam_reason_e last_roam_reason_m; + + /** The reason for the last roam failure. */ + core_roam_failed_reason_e last_roam_failed_reason_m; + + /** The current RCPI roam check interval values. */ + core_rcpi_roam_interval_s rcpi_roam_interval_m; + + /** Power save test verdicts. */ + core_type_list_c power_save_test_verdict_m; + + /** Whether EAPOL requires to do new connect right after failed authentication. */ + bool_t is_eapol_require_immediate_reconnect_m; + + /** Whether voice call is on. */ + bool_t is_voice_call_on_m; + + /** Previous RRM Measurement Request time. */ + u64_t previous_rrm_measurement_request_time_m; + + /** Current traffic status for access classes. */ + core_access_class_traffic_status_e ac_traffic_status_m[MAX_QOS_ACCESS_CLASS]; + + /** Current traffic mode for access classes. */ + core_access_class_traffic_mode_e ac_traffic_mode_m[MAX_QOS_ACCESS_CLASS]; + }; + +#endif // CORE_CONNECTION_DATA_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_eapol_handler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_eapol_handler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handler to EAPOL callbacks. +* +*/ + + +#ifndef CORE_EAPOL_HANDLER_H +#define CORE_EAPOL_HANDLER_H + +#include "abs_wlan_eapol_callback_interface.h" +#include "abs_wlan_eapol_callback.h" +#include "am_platform_libraries.h" +#include "core_types.h" + +class core_server_c; +class abs_core_driverif_c; +class abs_core_server_callback_c; +class abs_core_protected_setup_handler_c; +class network_id_c; + +/** + * This class acts as handler to EAPOL callbacks. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_eapol_handler_c ) : + public abs_wlan_eapol_callback_interface_c, + public abs_wlan_eapol_callback_c + { + +public: + + /** + * constructor + * + * @since S60 v3.1 + * @param server pointer to core_server + * @param drivers pointer to lower adaptation + * @param adaptation pointer to upper adaptation + */ + core_eapol_handler_c( + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * destructor + */ + virtual ~core_eapol_handler_c(); + + /** + * eapol_handler + * @since S60 v3.1 + * @return handler for EAPOL callbacks. + */ + abs_wlan_eapol_callback_interface_c* eapol_handler(); + + /** + * Function to convert core_error_e to interface status + * @since S60 v3.2 + * @param core_error + * @return interface status + */ + static u32_t convert_core_error_to_if_status( + core_error_e core_error ); + + /** + * Direct the callbacks from EAPOL to the given handler. + * + * @since S60 v3.1 + * @param New handler of EAPOL callbacks. + */ + void set_eapol_handler( + abs_wlan_eapol_callback_interface_c* handler ); + + /** + * Direct the Protected Setup events to the given handler. + * + * @since S60 v3.2 + * @param New handler of Protected Setup events. + */ + void set_protected_setup_handler( + abs_core_protected_setup_handler_c* handler ); + +// from base class abs_wlan_eapol_callback_interface_c + + /** + * packet_send sends a frame given by EAPOL + * + * @since S60 v3.1 + * @param send_network_id + * @param packet_data contains the data of the frame + * @param packet_data_length contains the length of the data + * @param send_unencrypted Whether the frame must be sent unencrypted. + * @return status value + */ + core_error_e packet_send( + network_id_c * send_network_id, + u8_t * packet_data, + u32_t packet_data_length, + bool_t send_unencrypted ); + + /** + * associate + * + * @since S60 v3.1 + * @param authentication_mode + * @return status value + */ + core_error_e associate( + wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ); + + /** + * disassociate + * + * @since S60 v3.1 + * @param receive_network_id + * @param self_disassociation + * @return status value + */ + core_error_e disassociate( + network_id_c * receive_network_id, + const bool_t self_disassociation ); + + /** + * packet_data_session_key + * + * @since S60 v3.1 + * @param send_network_id + * @param key + * @return status value + */ + core_error_e packet_data_session_key( + network_id_c * send_network_id, + session_key_c * key ); + + /** + * state_notification + * + * @since S60 v3.1 + * @param state + */ + void state_notification( + state_notification_c * state ); + + /** + * reassociate + * + * @since S60 v3.1 + * @param send_network_id + * @param authentication_type + * @param PMKID + * @param PMKID_length + * @return status value + */ + virtual core_error_e reassociate( + network_id_c * send_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e authentication_type, + u8_t * PMKID, + u32_t PMKID_length ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + virtual core_error_e complete_check_pmksa_cache( + core_type_list_c & network_id_list ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + virtual core_error_e complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + virtual core_error_e new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + virtual void handle_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ); + + +// from base class abs_wlan_eapol_callback_c + + /** + * Callback interface to partner. + * + * @since S60 v3.2 + * @param data Pointer to the data to be sent. + * @param length Length of the data to be sent. + * @return Return value is specified in interface specification. + */ + u32_t send_data( + const void * const data, + const u32_t length ); + +private: + + /** + * Handle a authentication state notification. + * + * @param state Current EAPOL authentication state. + * @param bssid The BSSID the notification is about. + */ + void handle_wlan_authentication_state( + u32_t state, + const core_mac_address_s& bssid ); + + /** + * Convert an EAPOL state notification to a core error code. + * + * @param state State notification to be converted. + * @return Core error code. + */ + core_error_e eapol_wlan_authentication_state_to_error( + u32_t state ) const; + + /** + * Check whether the given EAPOL state notification is an error. + */ + bool_t is_eapol_wlan_authentication_state_failure( + u32_t state ) const; + + /** + * Check whether the given EAPOL state notification is a success. + */ + bool_t is_eapol_wlan_authentication_state_success( + u32_t state ) const; + + +private: // data + + /** Handle to the core server. */ + core_server_c* server_m; + + /** Handle to adaptation interface. */ + abs_core_driverif_c* drivers_m; + + /** Handle to WLM. */ + abs_core_server_callback_c* adaptation_m; + + /** The actual handler of EAPOL callbacks. */ + abs_wlan_eapol_callback_interface_c* handler_m; + + /** Handler for protected setup indications. */ + abs_core_protected_setup_handler_c* protected_setup_handler_m; + + }; + +#endif // CORE_EAPOL_HANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames. +* +*/ + + +#ifndef CORE_FRAME_ACTION_H +#define CORE_FRAME_ACTION_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_dot11.h" + +/** + * Class for parsing and generating 802.11 action frames. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_action_c ) : public core_frame_dot11_c + { + +public: + + /** + * Defines the possible Category values + */ + enum core_dot11_action_category_e + { + core_dot11_action_category_spectrum_mgmt = 0, + core_dot11_action_category_qos = 1, + core_dot11_action_category_rm = 5, + core_dot11_action_category_wmm_qos = 17 + }; + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.1 + * @param frame Frame to be parsed. + * @return Pointer to the created parser instance. + */ + static core_frame_action_c* instance( + const core_frame_dot11_c& frame ); + + /** + * Destructor. + */ + virtual ~core_frame_action_c(); + + /** + * Return the Category field of the header. + */ + u8_t category() const; + + /** + * Set the Category field of the header. + * + * @since S60 v5.2 + * @param cat New value for the Category field of the header. + */ + void set_category( u8_t cat ); + +protected: + + /** + * Generate a 802.11 action frame. + * + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param Category field of the frame. + */ + void generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t category ); + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_action_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_ACTION_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action_nr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action_nr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames for Neighbor Reports. +* +*/ + + +#ifndef CORE_FRAME_ACTION_NR_H +#define CORE_FRAME_ACTION_NR_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_action.h" + +class core_frame_nr_ie_c; + +/** + * Class for parsing and generating 802.11 action frames for Neighbor Reports. + * + * @lib wlmserversrv.lib + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_action_nr_c ) : public core_frame_action_c + { + +public: + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v5.2 + * @param frame Frame to be parsed. + * @param is_copied Frame is copied. + * @return Pointer to the created parser instance. + */ + static core_frame_action_nr_c* instance( + const core_frame_action_c& frame, + bool_t is_copied ); + + /** + * Generate a 802.11 action frame in RM category. + * + * @since S60 v5.2 + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param action_type Action Type field of the frame. + * @param dialog_token The Dialog Token field of the frame. + * @param nr_ie Reference to the NR information element of the frame. + * @return Pointer to the created frame instance. + */ + static core_frame_action_nr_c* instance( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_nr_ie_c* nr_ie ); + + /** + * Destructor. + * + * @since S60 v5.2 + */ + virtual ~core_frame_action_nr_c(); + + /** + * Return the Dialog Token field of the header. + * + * @since S60 v5.2 + */ + u8_t dialog_token() const; + +private: + + /** + * Generate a 802.11 neighbor report request frame. + * + * @since S60 v5.2 + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param action_type Action Type field of the frame. + * @param dialog_token The Dialog Token field of the frame. + * @param nr_ie Reference to the NR information element of the frame. + */ + void generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_nr_ie_c* nr_ie ); + + /** + * Constructor. + * + * @since S60 v5.2 + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_action_nr_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +protected: + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + virtual u16_t first_ie_offset() const; + + }; + +#endif // CORE_FRAME_ACTION_NR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action_rm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action_rm.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames in RM category. +* +*/ + + +#ifndef CORE_FRAME_ACTION_RM_H +#define CORE_FRAME_ACTION_RM_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_action.h" + +class core_frame_rm_ie_c; + +/** + * Class for parsing and generating 802.11 action frames in RM category. + * + * @lib wlmserversrv.lib + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_action_rm_c ) : public core_frame_action_c + { + +public: + + /** + * Defines the possible Type values. + */ + enum core_dot11_action_rm_type_e + { + core_dot11_action_rm_type_meas_req = 0, + core_dot11_action_rm_type_meas_resp = 1, + core_dot11_action_rm_type_neighbor_req = 4, + core_dot11_action_rm_type_neighbor_resp = 5 + }; + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v5.2 + * @param frame Frame to be parsed. + * @param is_copied Frame is copied. + * @return Pointer to the created parser instance. + */ + static core_frame_action_rm_c* instance( + const core_frame_action_c& frame, + bool_t is_copied ); + + /** + * Generate a 802.11 action frame in RM category. + * + * @since S60 v5.2 + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param action_type Action Type field of the frame. + * @param dialog_token The Dialog Token field of the frame. + * @param rm_ie Reference to the RM information element of the frame + * @return Pointer to the created frame instance. + */ + static core_frame_action_rm_c* instance( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_rm_ie_c* rm_ie ); + + /** + * Destructor. + * + * @since S60 v5.2 + */ + virtual ~core_frame_action_rm_c(); + + /** + * Return the Dialog Token field of the header. + * + * @since S60 v5.2 + */ + u8_t dialog_token() const; + + /** + * Return the Number of Repetitions field of the header. + * + * @since S60 v5.2 + */ + u16_t nbr_of_repetitions() const; + +private: + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + * + * @since S60 v5.2 + */ + u16_t first_ie_offset() const; + + /** + * Generate a 802.11 RM request frame. + * + * @since S60 v5.2 + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param action_type Action Type field of the frame. + * @param dialog_token The Dialog Token field of the frame. + * @param rm_ie The RM element of the frame. + */ + void generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_rm_ie_c* rm_ie ); + + /** + * Constructor. + * + * @since S60 v5.2 + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_action_rm_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_ACTION_RM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action_wmm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_action_wmm.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames in WMM category. +* +*/ + + +#ifndef CORE_FRAME_ACTION_WMM_H +#define CORE_FRAME_ACTION_WMM_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_action.h" + +class core_frame_wmm_ie_tspec_c; + +/** + * Class for parsing and generating 802.11 action frames in WMM category. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_action_wmm_c ) : public core_frame_action_c + { + +public: + + /** + * Defines the possible Type values. + */ + enum core_dot11_action_wmm_type_e + { + core_dot11_action_wmm_type_addts_req = 0, + core_dot11_action_wmm_type_addts_resp = 1, + core_dot11_action_wmm_type_delts = 2 + }; + + /** + * Defines the possible Status Code values. + */ + enum core_dot11_action_wmm_status_e + { + core_dot11_action_wmm_status_admission_accepted = 0, + core_dot11_action_wmm_status_invalid_parameters = 1, + core_dot11_action_wmm_status_refused = 3 + /** 2, 4 - 255 reserved */ + }; + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.2 + * @param frame Frame to be parsed. + * @return Pointer to the created parser instance. + */ + static core_frame_action_wmm_c* instance( + const core_frame_action_c& frame ); + + /** + * Generate a 802.11 action frame in WWMM category. + * + * @since S60 v3.2 + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param action_type Action Type field of the frame. + * @param dialog_token The Dialog Token field of the frame. + * @param status The Status field of the frame. + * @param tspec The TSPEC element of the frame. + * @return Pointer to the created frame instance. + */ + static core_frame_action_wmm_c* instance( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + u8_t status, + const core_frame_wmm_ie_tspec_c* tspec ); + + /** + * Destructor. + */ + virtual ~core_frame_action_wmm_c(); + + /** + * Return the Action Type field of the header. + */ + u8_t action_type() const; + + /** + * Return the Dialog Token field of the header. + */ + u8_t dialog_token() const; + + /** + * Return the Status field of the header. + */ + u8_t status() const; + +private: + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + u16_t first_ie_offset() const; + + /** + * Generate a 802.11 ADDTS request frame. + * + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + * @param action_type Action Type field of the frame. + * @param dialog_token The Dialog Token field of the frame. + * @param status The Status field of the frame. + * @param tspec The TSPEC element of the frame. + */ + void generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + u8_t status, + const core_frame_wmm_ie_tspec_c* tspec ); + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_action_wmm_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_ACTION_WMM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_assoc_resp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_assoc_resp.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parser utility for 802.11 (re-)association response frames. +* +*/ + + +#ifndef CORE_FRAME_ASSOC_RESP_H +#define CORE_FRAME_ASSOC_RESP_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_dot11.h" + +/** + * Class for parsing 802.11 (re-)association response frames. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_assoc_resp_c ) : public core_frame_dot11_c + { + +public: + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.1 + * @param frame Frame to be parsed. + * @param is_copied Whether the object should take a copy of the frame data. + * @return Pointer to the created parser instance. + */ + static core_frame_assoc_resp_c* instance( + const core_frame_dot11_c& frame, + bool_t is_copied = false_t ); + + /** + * Destructor. + */ + virtual ~core_frame_assoc_resp_c(); + + /** + * Return the Capability field of the frame. + * + * @since S60 v3.1 + * @return The Capability field of the frame. + */ + u16_t capability() const; + + /** + * Return the Status Code field of the frame. + * + * @since S60 v3.1 + * @return The Status Code field of the frame. + */ + u16_t status_code() const; + + /** + * Return the AID field of the frame. + * + * @since S60 v3.1 + * @return The AID field of the frame. + */ + u16_t aid() const; + +private: + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + u16_t first_ie_offset() const; + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_assoc_resp_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + }; + +#endif // CORE_FRAME_ASSOC_RESP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_beacon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_beacon.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parser utility for 802.11 beacon/probe response frames. +* +*/ + + +#ifndef CORE_FRAME_BEACON_H +#define CORE_FRAME_BEACON_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_dot11.h" + +/** + * Class for 802.11 beacon/probe response frames. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_beacon_c ) : public core_frame_dot11_c + { + +public: + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.1 + * @param frame Frame to be parsed. + * @param is_copied Whether the object should take a copy of the frame data. + * @return Pointer to the created parser instance. + */ + static core_frame_beacon_c* instance( + const core_frame_dot11_c& frame, + bool_t is_copied = false_t ); + + /** + * Destructor. + */ + virtual ~core_frame_beacon_c(); + + /** + * Return the timestamp field of the frame. + * + * @since S60 v3.1 + * @return The timestamp field of the frame. + */ + core_tsf_value_s timestamp() const; + + /** + * Return the beacon interval field of the frame. + * + * @since S60 v3.1 + * @return The beacon interval field of the frame. + */ + u16_t beacon_interval() const; + + /** + * Return the capability field of the frame. + * + * @since S60 v3.1 + * @return The capability field of the frame. + */ + u16_t capability() const; + +private: + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + u16_t first_ie_offset() const; + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_beacon_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + }; + +#endif // CORE_FRAME_BEACON_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_dot11.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_dot11.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,338 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11 frames +* +*/ + + +#ifndef CORE_FRAME_DOT11_H +#define CORE_FRAME_DOT11_H + +#include "core_types.h" + +class core_frame_dot11_ie_c; + +/** + * Class for parsing 802.11 frames. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_dot11_c ) + { + +public: + + /** + * Bit masks for 802.11 Frame Control fields. + */ + enum core_dot11_frame_control_e + { + core_dot11_frame_control_version_mask = 0x0003, + core_dot11_frame_control_type_mask = 0x000C, + core_dot11_frame_control_subtype_mask = 0x00F0, + core_dot11_frame_control_type_subtype_mask = 0x00FC, + core_dot11_frame_control_to_ds_mask = 0x0100, + core_dot11_frame_control_from_ds_mask = 0x0200, + core_dot11_frame_control_more_fragments_mask = 0x0400, + core_dot11_frame_control_retry_mask = 0x0800, + core_dot11_frame_control_power_mgmt_mask = 0x1000, + core_dot11_frame_control_more_data_mask = 0x2000, + core_dot11_frame_control_privacy_mask = 0x4000, + core_dot11_frame_control_order_mask = 0x8000 + }; + + /** + * Enumerations for 802.11 Frame Control Type field. + */ + enum core_dot11_frame_control_type_e + { + core_dot11_frame_control_type_management = 0x0000, + core_dot11_frame_control_type_control = 0x0004, + core_dot11_frame_control_type_data = 0x0008 + }; + + /** + * Bit masks for 802.11 Frame Control Subtype field. + */ + enum core_dot11_frame_control_subtype_e + { + core_dot11_frame_control_subtype_cf_ack_mask = 0x0010, + core_dot11_frame_control_subtype_cf_poll_mask = 0x0020, + core_dot11_frame_control_subtype_no_body_mask = 0x0040, + core_dot11_frame_control_subtype_qos_mask = 0x0080 + }; + + /** + * Enumerations for 802.11 Type/Subtype combinations. + */ + enum core_dot11_type_e + { + core_dot11_type_association_req = 0x0000, + core_dot11_type_association_resp = 0x0010, + core_dot11_type_reassociation_req = 0x0020, + core_dot11_type_reassociation_resp = 0x0030, + core_dot11_type_probe_req = 0x0040, + core_dot11_type_probe_resp = 0x0050, + core_dot11_type_beacon = 0x0080, + core_dot11_type_action = 0x00D0, + core_dot11_type_data = 0x0008, + core_dot11_type_qos_data = 0x0088 + }; + + /** + * Definitions for Capability bitmask in beacons/probe responses. + */ + enum core_dot11_capability_e + { + core_dot11_capability_ess = 0x0001, + core_dot11_capability_ibss = 0x0002, + core_dot11_capability_cf_pollable = 0x0004, + core_dot11_capability_cf_poll_request = 0x0008, + core_dot11_capability_privacy = 0x0010, + core_dot11_capability_preamble = 0x0020, + core_dot11_capability_pbcc = 0x0040, + core_dot11_capability_channel_agility = 0x0080, + core_dot11_capability_spectrum_mgmt = 0x0100, + core_dot11_capability_qos = 0x0200, + core_dot11_capability_slot_time = 0x0400, + core_dot11_capability_apsd = 0x0800, + core_dot11_capability_radio_measurement = 0x1000, + core_dot11_capability_dsss_ofdm = 0x2000, + core_dot11_capability_delayed_block_ack = 0x4000, + core_dot11_capability_immediate_block_ack = 0x8000 + }; + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.1 + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param is_copied Whether the object should take a copy of the frame data. + * @return Pointer to the created parser instance. + */ + static core_frame_dot11_c* instance( + u16_t data_length, + const u8_t* data, + bool_t is_copied ); + + /** + * Destructor. + */ + virtual ~core_frame_dot11_c(); + + /** + * Return the frame control field of the frame. + * + * @since S60 v3.1 + * @return The frame control field of the frame. + */ + u16_t frame_control() const; + + /** + * Return the type of the frame. + * + * @since S60 v3.1 + * @return type of the frame + */ + core_frame_dot11_c::core_dot11_type_e type() const; + + /** + * Return the duration field of the frame. + * + * @since S60 v3.1 + * @return The duration field of the frame. + */ + u16_t duration() const; + + /** + * Return the destination MAC field of the frame. + * + * @since S60 v3.1 + * @return The destination MAC field of the frame. + */ + core_mac_address_s destination() const; + + /** + * Return the source MAC field of the frame. + * + * @since S60 v3.1 + * @return The source MAC field of the frame. + */ + core_mac_address_s source() const; + + /** + * Return the BSSID field of the frame. + * + * @since S60 v3.1 + * @return The BSSID field of the frame. + */ + core_mac_address_s bssid() const; + + /** + * Return the current length of the frame. + * + * @since S60 v3.1 + * @return The current length of the frame. + */ + u16_t data_length() const; + + /** + * Return a pointer to the frame data. + * + * @since S60 v3.1 + * @return A pointer to the frame data. + */ + const u8_t* data() const; + + /** + * Return the length of the payload data. + * + * @since S60 v3.1 + * @return The length of the payload data. + */ + u16_t payload_data_length() const; + + /** + * Return a pointer to the payload data. + * + * @since S60 v3.1 + * @return A pointer to the payload data. + */ + const u8_t* payload_data() const; + + /** + * Return the first IE of the frame. + * + * @since S60 v3.1 + * @return Pointer to the first IE, NULL if no IEs. + */ + core_frame_dot11_ie_c* first_ie(); + + /** + * Return the next IE of the frame. + * + * @since S60 v3.1 + * @return Pointer to the next IE, NULL if no more IEs. + */ + core_frame_dot11_ie_c* next_ie(); + + /** + * Append an IE to frame. + * + * @since S60 v3.1 + * @param ie IE to add to the frame. + */ + void append_ie( + const core_frame_dot11_ie_c* ie ); + + /** + * Set Destination MAC Address of the frame. + * + * @since S60 v5.2 + * @param da Destination Address to set. + */ + void set_destination( const core_mac_address_s& da ); + + /** + * Set Source MAC Address of the frame. + * + * @since S60 v5.2 + * @param sa Source Address to set. + */ + void set_source( const core_mac_address_s& sa ); + + /** + * Return the offset of the first fixed element. + * + * @since S60 v5.2 + * @return The offset of the first fixed element. + */ + u16_t first_fixed_element_offset() const; + +protected: + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + virtual u16_t first_ie_offset() const; + + /** + * Return the MAC address field from the given index. + * + * @param index Index of the MAC address field. + * @return The MAC address field from the given index. + */ + core_mac_address_s mac_address( + u16_t index ) const; + + /** + * Generate a 802.11 header. + * + * @param type The Type and Subtype field of the header. + * @param duration The Duration field of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param sequence_control The Sequence Control field of the frame. + */ + void generate( + u8_t type, + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control ); + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_dot11_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +protected: // data + + /** The length of the frame. */ + u16_t data_length_m; + + /** Pointer to the frame data. */ + u8_t* data_m; + + /** The maximum frame length when generating a frame or copying it. */ + const u16_t max_data_length_m; + +private: // data + + /** Whether this frame includes QoS Control field. */ + bool_t is_qos_m; + + /** Whether this frame includes HT Control field. */ + bool_t is_ht_m; + + /** Pointer to the start of the current IE data. Not owned by this pointer. */ + const u8_t* current_ie_m; + + /** The maximum length of the current IE. */ + u16_t current_ie_max_length_m; + + }; + +#endif // CORE_FRAME_DOT11_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_dot11_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_dot11_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11 IEs. +* +*/ + + +#ifndef CORE_FRAME_DOT11_IE_H +#define CORE_FRAME_DOT11_IE_H + +#include "core_types.h" + +const u8_t CORE_FRAME_DOT11_IE_HEADER_LENGTH = 2; + +/** + * Class parsing 802.11 IEs. + * + * This class acts as a base class for the various IE parsers. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_dot11_ie_c ) + { + +public: + + enum core_frame_dot11_ie_element_id_e + { + core_frame_dot11_ie_element_id_ssid = 0, + core_frame_dot11_ie_element_id_supported_rates = 1, + core_frame_dot11_ie_element_id_fh_parameter_set = 2, + core_frame_dot11_ie_element_id_ds_parameter_set = 3, + core_frame_dot11_ie_element_id_cf_paremeter_set = 4, + core_frame_dot11_ie_element_id_tim = 5, + core_frame_dot11_ie_element_id_ibss_parameter_set = 6, + core_frame_dot11_ie_element_id_country = 7, + core_frame_dot11_ie_element_id_hopping_pattern = 8, + core_frame_dot11_ie_element_id_hopping_pattern_table = 9, + core_frame_dot11_ie_element_id_request = 10, + core_frame_dot11_ie_element_id_qbss_load = 11, + core_frame_dot11_ie_element_id_challenge_text = 16, + // Reserved for challenge text extension 17 - 31 + core_frame_dot11_ie_element_id_power_constraint = 32, + core_frame_dot11_ie_element_id_power_capability = 33, + core_frame_dot11_ie_element_id_measurement_req = 38, + core_frame_dot11_ie_element_id_measurement_resp = 39, + core_frame_dot11_ie_element_id_erp_information = 42, + core_frame_dot11_ie_element_id_rsn = 48, + core_frame_dot11_ie_element_id_extended_rates = 50, + core_frame_dot11_ie_element_id_ap_channel_report = 51, + core_frame_dot11_ie_element_id_neighbor_report = 52, + core_frame_dot11_ie_element_id_admission_capacity = 67, + core_frame_dot11_ie_element_id_wapi = 68, + core_frame_dot11_ie_element_id_rrm_capabilities = 70, + core_frame_dot11_ie_element_id_wpa = 221, + core_frame_dot11_ie_element_id_wmm_parameter = 221, + core_frame_dot11_ie_element_id_wmm_tspec = 221 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param is_copied Whether the object should take a copy of the frame data. Default value is false_t. + * @return Pointer to the created parser instance. + */ + static core_frame_dot11_ie_c* instance( + u16_t data_length, + const u8_t* data, + bool_t is_copied = false_t ); + + /** + * Destructor. + */ + virtual ~core_frame_dot11_ie_c(); + + /** + * Return the element ID field of the IE. + * + * @since S60 v3.1 + * @return The element ID field of the IE. + */ + u8_t element_id() const; + + /** + * Return the length field of the IE. + * + * @since S60 v3.1 + * @return The length field of the IE. + */ + u8_t length() const; + + /** + * Return the data of the IE, including the IE headers. + * + * @since S60 v3.1 + * @return The total length of the IE. + */ + u16_t data_length() const; + + /** + * Return a pointer to the IE data. + * + * @since S60 v3.1 + * @return A pointer to the IE data. + */ + const u8_t* data() const; + +protected: + + /** + * Generate a IE header. + * + * @param element_id The element ID field of the header. + */ + void generate( + u8_t element_id ); + + /** + * Set the total length of the IE to the given value. + * + * @param length The total length of the IE. + */ + void set_length( + u8_t length ); + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length + */ + core_frame_dot11_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +protected: + + /** The length of the IE data. */ + u16_t data_length_m; + + /** Pointer to the IE data. */ + u8_t* data_m; + + /** The maximum IE length when generating an IE. */ + u16_t max_data_length_m; + + }; + +#endif // CORE_FRAME_DOT11_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_echo_test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_echo_test.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating echo test frames. +* +*/ + + +#ifndef CORE_FRAME_ECHO_TEST_H +#define CORE_FRAME_ECHO_TEST_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_ethernet.h" + +/** + * Class for parsing and generating echo test frames. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_echo_test_c ) : public core_frame_ethernet_c + { + +public: + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.2 + * @param frame Frame to be parsed. + * @return Pointer to the created parser instance. + */ + static core_frame_echo_test_c* instance( + const core_frame_ethernet_c& frame ); + + /** + * Factory for generating an echo test frame. + * + * @since S60 v3.2 + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param token Token field of the frame. + * @return Pointer to the created frame instance. + */ + static core_frame_echo_test_c* instance( + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t token ); + + /** + * Destructor. + */ + virtual ~core_frame_echo_test_c(); + + /** + * Return the Token field. + */ + u16_t token() const; + +protected: + + /** + * Generate an echo test frame. + * + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param bssid The BSSID field of the frame. + * @param token Token field of the frame. + */ + void generate( + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t token ); + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_echo_test_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_ECHO_TEST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_ethernet.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_ethernet.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing Ethernet frames +* +*/ + + +#ifndef CORE_FRAME_ETHERNET_H +#define CORE_FRAME_ETHERNET_H + +#include "core_types.h" + +/** + * Class for parsing Ethernet frames. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_frame_ethernet_c ) + { + +public: + + /** + * Possible values for Ethernet Type field. + */ + enum core_ethernet_type_e + { + core_ethernet_type_none = 0x0000, + core_ethernet_type_ip = 0x0800, + core_ethernet_type_arp = 0x0806, + core_ethernet_type_test = 0x8013 + }; + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v3.2 + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param is_copied Whether the object should take a copy of the frame data. + * @return Pointer to the created parser instance. + */ + static core_frame_ethernet_c* instance( + u16_t data_length, + const u8_t* data, + bool_t is_copied ); + + /** + * Factory for creating an Ethernet frame. + * + * @since S60 v3.2 + * @param max_data_length The maximum size of the frame. + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param type The Ethernet Type field of the frame. + * @return Pointer to the created frame instance. + */ + static core_frame_ethernet_c* instance( + u16_t max_data_length, + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t type ); + + /** + * Destructor. + */ + virtual ~core_frame_ethernet_c(); + + /** + * Return the destination MAC field of the frame. + * + * @since S60 v3.2 + * @return The destination MAC field of the frame. + */ + core_mac_address_s destination() const; + + /** + * Return the source MAC field of the frame. + * + * @since S60 v3.2 + * @return The source MAC field of the frame. + */ + core_mac_address_s source() const; + + /** + * Return the Ethernet Type field of the frame. + * + * @since S60 v3.2 + * @return The Ethernet Type field of the frame. + */ + u16_t type() const; + + /** + * Return the current length of the frame. + * + * @since S60 v3.1 + * @return The current length of the frame. + */ + u16_t data_length() const; + + /** + * Return a pointer to the frame data. + * + * @since S60 v3.1 + * @return A pointer to the frame data. + */ + const u8_t* data() const; + + /** + * Return the length of the payload data. + * + * @since S60 v3.1 + * @return The length of the payload data. + */ + u16_t payload_data_length() const; + + /** + * Return a pointer to the payload data. + * + * @since S60 v3.1 + * @return A pointer to the payload data. + */ + const u8_t* payload_data() const; + +protected: + + /** + * Return the MAC address field from the given index. + * + * @param index Index of the MAC address field. + * @return The MAC address field from the given index. + */ + core_mac_address_s mac_address( + u16_t index ) const; + + /** + * Generate an Ethernet header. + * + * @param destination The destination MAC field of the frame. + * @param source The source MAC field of the frame. + * @param type The Ethernet Type field of the frame. + */ + void generate( + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t type ); + + /** + * Constructor. + * + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_ethernet_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +protected: // data + + /** The length of the frame. */ + u16_t data_length_m; + + /** Pointer to the frame data. */ + u8_t* data_m; + + /** The maximum frame length when generating a frame or copying it. */ + const u16_t max_data_length_m; + + }; + +#endif // CORE_FRAME_ETHERNET_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_mgmt_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_mgmt_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,613 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11 management frame IEs. +* +*/ + + +#ifndef CORE_FRAME_MGMT_IE_H +#define CORE_FRAME_MGMT_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +const u16_t CORE_FRAME_RADIO_MGMT_IE_LENGTH = 2; +const u16_t CORE_FRAME_RADIO_MGMT_IE_MIN_POWER_CAPABILITY = 0; +const u16_t CORE_FRAME_RRM_MGMT_IE_LENGTH = 5; + +const u8_t CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_LENGTH = 4; +const u8_t CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_CLASS_OFFSET = 2; +const u8_t CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_CHANNEL_OFFSET = 3; + +/** + * Class for parsing 802.11 management frame SSID IE. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_ssid_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_ssid_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_ssid_c(); + + /** + * Return the SSID. + * @return The SSID. BROADCAST_SSID if none or invalid. + */ + core_ssid_s ssid() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_ssid_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame DS IE. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_ds_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_ds_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_ds_c(); + + /** + * Return the channel field. + * @return The channel field. + */ + u8_t channel() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_ds_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame country IE. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_country_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_country_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_country_c(); + + /** + * Return the country string field. + * @return The country string field. + */ + core_country_string_s country() const; + + /** + * Return the maximum transmit power level for the given channel. + * @param channel Channel to check. + * @return The maximum transmit power level for the given channel. + */ + u8_t max_tx_power_level( + u8_t channel ) const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_country_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame power constraint IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_power_constraint_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_power_constraint_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_power_constraint_c(); + + /** + * Return the power constraint value. + * @return The power constraint value. + */ + u8_t power_constraint() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_power_constraint_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame ap channel report IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_ap_channel_report_c ) : public core_frame_dot11_ie_c + { + +public: + + enum core_frame_mgmt_ie_class_id_e + { + core_frame_mgmt_ie_class_id_europe_2dot407 = 4, + core_frame_mgmt_ie_class_id_usa_5 = 5, + core_frame_mgmt_ie_class_id_usa_2dot407 = 12, + core_frame_mgmt_ie_class_id_japan_2dot407 = 30, + core_frame_mgmt_ie_class_id_japan_2dot414 = 31, + core_frame_mgmt_ie_class_id_japan_5 = 32 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_ap_channel_report_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_ap_channel_report_c(); + + /** + * Return the class value. + * + * @since S60 v5.2 + * @return The class value. + */ + u8_t ap_channel_report_class() const; + + /** + * Return the channel value. + * + * @since S60 v5.2 + * @return The channel value. + */ + u8_t ap_channel_report_channel( + u16_t channel_offset ) const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_ap_channel_report_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame admission capacity IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_admission_capacity_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_admission_capacity_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_admission_capacity_c(); + + /** + * Return the admission capacity bitmask. + * + * @since S60 v5.2 + * @return The admission capacity bitmask. + */ + u16_t admission_capacity_bitmask() const; + + /** + * Get admission capacities. + * + * @since S60 v5.2 + * @param ie_data_length IE data length. + * @param admission_capacity_table Admission capacities. + */ + void get_admission_capacity( + u16_t ie_data_length, + u16_t* admission_capacity_table ); + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_admission_capacity_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame power capability IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_power_capability_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_power_capability_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_power_capability_c(); + + /** + * Return the power capability. + * + * @since S60 v5.2 + * @return The power capability. + */ + u8_t power_capability() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_mgmt_ie_power_capability_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 radio management frame IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_radio_mgmt_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param max_data_length Maximum length of the data. + * @param min_capability Minimum transmit power capability. + * @param max_capability Maximum transmit power capability. + * @return A pointer to the created IE instance. + */ + static core_frame_radio_mgmt_ie_c* instance( + u16_t max_data_length, + u8_t min_capability, + u8_t max_capability ); + + /** + * Destructor. + */ + virtual ~core_frame_radio_mgmt_ie_c(); + +private: + + /** + * Generate an IE with the given parameters. + * + * @param min_capability Minimum transmit power capability. + * @param max_capability Maximum transmit power capability. + */ + void generate( + u8_t min_capability, + u8_t max_capability ); + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_radio_mgmt_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame rrm capabilities IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_rrm_capabilities_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_rrm_capabilities_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_rrm_capabilities_c(); + + /** + * Return the rrm capability bits. + * + * @since S60 v5.2 + * @return The rrm capability bits. + */ + u64_t rrm_capabilities() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_mgmt_ie_rrm_capabilities_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 radio management frame IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rrm_mgmt_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param rrm_capabilities RRM capabilities. + * @return A pointer to the created IE instance. + */ + static core_frame_rrm_mgmt_ie_c* instance( + const u8_t* rrm_capabilities ); + + /** + * Destructor. + */ + virtual ~core_frame_rrm_mgmt_ie_c(); + +private: + + /** + * Generate an IE with the given parameters. + * + * @since S60 v5.2 + * @param rrm_capabilities RRM capabilities. + */ + void generate( + const u8_t* rrm_capabilities ); + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_rrm_mgmt_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +/** + * Class for parsing 802.11 management frame request IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_mgmt_ie_request_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_mgmt_ie_request_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_mgmt_ie_request_ie_c(); + + /** + * Get information element list. + * + * @since S60 v5.2 + * @param ie_id_list Information element list. + * @return Information element list length. + */ + u8_t element_list( u8_t* ie_id_list ) const; + + /** + * Return the element data. + * + * @since S60 v5.2 + * @param request_ie_offset Element data offset. + * @return The element data. + */ + u8_t element_data( + u16_t element_data_offset ) const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_mgmt_ie_request_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_MGMT_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_nr_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_nr_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing Neighbor Report IEs. +* +*/ + + +#ifndef CORE_FRAME_NR_IE_H +#define CORE_FRAME_NR_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing NR Parameter Element IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_nr_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_nr_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating a Measurement Report IE + * instance with given parameters. + * + * @since S60 v5.2 + * @param + */ + static core_frame_nr_ie_c* instance( + const core_ssid_s& ssid ); + + /** + * Destructor. + */ + virtual ~core_frame_nr_ie_c(); + + /** + * Return the BSS Id field. + * + * @since S60 v5.2 + * @return The BSS Id field. + */ + core_mac_address_s bssid() const; + + /** + * Return the BSS Id info field. + * + * @since S60 v5.2 + * @return The BSS Id info field. + */ + u32_t bssid_info() const; + + /** + * Return the regulatory class field. + * + * @since S60 v5.2 + * @return The regulatory class field. + */ + u8_t regulatory_class() const; + + /** + * Return the Channel Number field. + * + * @since S60 v5.2 + * @return The Channel Number field. + */ + u8_t channel_number() const; + + /** + * Return the phy type field. + * + * @since S60 v5.2 + * @return The phy type field. + */ + u8_t phy_type() const; + +protected: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_nr_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + /** + * Generate an IE header. + * + * @since S60 v5.2 + * @param ssid Reference to ssid. + */ + void generate( + const core_ssid_s& ssid ); + + }; + +#endif // CORE_FRAME_NR_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_qbss_load_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_qbss_load_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11e QBSS Load IE. +* +*/ + + +#ifndef CORE_FRAME_QBSS_LOAD_IE_H +#define CORE_FRAME_QBSS_LOAD_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing 802.11e QBSS Load IE. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_frame_qbss_load_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_qbss_load_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_qbss_load_ie_c(); + + /** + * Return the Station Count field. + * @return The Station Count field. + */ + u16_t station_count() const; + + /** + * Return the Channel Utilization field. + * @return The Channel Utilization field. + */ + u8_t channel_utilitization() const; + + /** + * Return the Available Admission Capacity field. + * @return The Available Admission Capacity field. + */ + u16_t admission_capacity() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_qbss_load_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_QBSS_LOAD_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_radio_measurement_action.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_radio_measurement_action.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames in RM category. +* +*/ + + +#ifndef CORE_FRAME_RADIO_MEASUREMENT_ACTION_H +#define CORE_FRAME_RADIO_MEASUREMENT_ACTION_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_frame_action.h" + +/** + * Class for parsing and generating 802.11 action frames in RM category. + * + * @lib wlmserversrv.lib + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_radio_measurement_action_c ) : public core_frame_action_c + { + +public: + + /** + * Defines the possible Type values. + */ + enum core_dot11_action_rm_type_e + { + core_dot11_action_rm_type_meas_req = 0, + core_dot11_action_rm_type_meas_resp = 1, + core_dot11_action_rm_type_neighbor_req = 4, + core_dot11_action_rm_type_neighbor_resp = 5 + }; + + /** + * Factory for creating a parser for the given frame. + * + * @since S60 v5.2 + * @param frame Frame to be parsed. + * @param is_copied Frame is copied. + * @return Pointer to the created parser instance. + */ + static core_frame_radio_measurement_action_c* instance( + const core_frame_action_c& frame, + bool_t is_copied ); + + /** + * Destructor. + * + * @since S60 v5.2 + */ + virtual ~core_frame_radio_measurement_action_c(); + + /** + * Return the Action Type field of the header. + * + * @since S60 v5.2 + */ + u8_t action_type() const; + +private: + + /** + * Constructor. + * + * @since S60 v5.2 + * @param data_length Length of the frame. + * @param data Pointer to the frame data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_radio_measurement_action_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_RADIO_MEASUREMENT_ACTION_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_H +#define CORE_FRAME_RM_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing RM Parameter Element IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + enum core_frame_rm_ie_action_type_e + { + core_frame_rm_ie_action_type_beacon_request = 5 + }; + + /** + * Factory for creating a parser instance for receiving an IE. + * + * @since S60 v5.2 + * @param ie Reference to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_rm_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating a Measurement Report IE + * instance with given parameters. + * + * @since S60 v5.2 + * @param measurement_token Value for Measurement Token field of IE. + * @param measurement_request_mode Value for Measurement Request Mode field of IE. + * @param measurement_type Value for Measurement Type field of IE. + * @return A pointer to the created IE instance. + */ + static core_frame_rm_ie_c* instance( + u8_t measurement_token, + u8_t measurement_request_mode, + u8_t measurement_type ); + + /** + * Destructor. + */ + virtual ~core_frame_rm_ie_c(); + + /** + * Return the Measurement Token field. + * @return The Measurement Token field. + */ + u8_t measurement_token() const; + + /** + * Return the Measurement Request Mode field. + * @return Measurement Request Mode field. + */ + u8_t measurement_request_mode() const; + + /** + * Return the Measurement Type field. + * @return Measurement Type field. + */ + u8_t measurement_type() const; + +protected: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_rm_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + /** + * Generate an IE header. + * + * @param measurement_token Value for Measurement Token field of IE. + * @param measurement_request_mode Value for Measurement Request Mode field of IE. + * @param measurement_type Value for Measurement Type field of IE. + */ + void generate( + u8_t measurement_token, + u8_t measurement_request_mode, + u8_t measurement_type ); + + + }; + +#endif // CORE_FRAME_RM_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_report.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_report.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Beacon Report IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_BEACON_REPORT_H +#define CORE_FRAME_RM_IE_BEACON_REPORT_H + +#include "core_frame_rm_ie.h" +#include "core_frame_rm_ie_beacon_report_ie.h" +#include "core_types.h" +#include "core_ap_data.h" + +/** + * Class for parsing RM Beacon Report Element IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_beacon_report_c ) : public core_frame_rm_ie_c + { + +public: + + /** + * Factory for creating a Beacon Report IE + * instance with given sub-element. + * + * @since S60 v5.2 + * @param measurement_token Value for Measurement Token field of IE. + * @param measurement_request_mode Value for Measurement Request Mode field of IE. + * @param ie Pointer to sub-element. + */ + static core_frame_rm_ie_beacon_report_c* instance( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie ); + + /** + * Factory for creating a Beacon Report IE + * instance with given sub-element. + * + * @since S60 v5.2 + * @param measurement_token Value for Measurement Token field of IE. + * @param measurement_request_mode Value for Measurement Request Mode field of IE. + * @param ie Pointer to sub-element. + * @param frame_body_ie Pointer to frame body ie. + */ + static core_frame_rm_ie_beacon_report_c* instance( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie, + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie ); + + /** + * Destructor. + */ + virtual ~core_frame_rm_ie_beacon_report_c(); + + /** + * Generate an IE header. + * + * @param measurement_token Value for Measurement Token field of IE. + * @param measurement_request_mode Value for Measurement Request Mode field of IE. + * @param ie Pointer to sub-element. + */ + void generate( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie ); + + /** + * Generate an IE header. + * + * @param measurement_token Value for Measurement Token field of IE. + * @param measurement_request_mode Value for Measurement Request Mode field of IE. + * @param ie Pointer to sub-element. + * @param frame_body_ie Pointer to frame body ie. + */ + void generate( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie, + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie ); + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_rm_ie_beacon_report_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + u16_t first_ie_offset() const; + + /** + * Return the length of the payload data. + * + * @since S60 v5.2 + * @return The length of the payload data. + */ + u16_t payload_data_length() const; + + /** + * Return a pointer to the payload data. + * + * @since S60 v5.2 + * @return A pointer to the payload data. + */ + const u8_t* payload_data() const; + +private: // data + + /** Pointer to the start of the current IE data. Not owned by this pointer. */ + const u8_t* current_ie_m; + + /** The maximum length of the current IE. */ + u16_t current_ie_max_length_m; + + }; + +#endif // CORE_FRAME_RM_IE_BEACON_REPORT_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_report_frame_body_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_report_frame_body_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Beacon Report Frame Body IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_H +#define CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_H + +#include "core_frame_rm_ie.h" +#include "core_types.h" +#include "core_ap_data.h" + +/** + * Class for parsing Beacon Report Element IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_beacon_report_frame_body_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + enum core_frame_rm_ie_beacon_report_frame_body_ie_element_id_e + { + core_frame_rm_ie_beacon_report_frame_body_ie_element_id_reported_frame_body = 1 + }; + + /** + * Factory for creating a Beacon Report Frame Body IE + * instance with given parameters. + * + * @since S60 v5.2 + * @param ap_data Reference to core_ap_data_c from which to generate the information. + */ + static core_frame_rm_ie_beacon_report_frame_body_ie_c* instance( + core_ap_data_c& ap_data ); + + /** + * Factory for creating a Beacon Report Frame Body IE + * instance with given parameters. + * + * @since S60 v5.2 + * @param ap_data Reference to core_ap_data_c from which to generate the information. + * @param ie_id_list Information element id list. + * @param ie_id_list_length Information element id list length. + */ + static core_frame_rm_ie_beacon_report_frame_body_ie_c* instance( + core_ap_data_c& ap_data, + u8_t* ie_id_list, + u8_t ie_id_list_length ); + + /** + * Destructor. + */ + virtual ~core_frame_rm_ie_beacon_report_frame_body_ie_c(); + + /** + * Generate an IE header. + * + * @param ap_data Reference to core_ap_data_c from which to generate the information. + */ + void generate( core_ap_data_c& ap_data ); + + /** + * Generate an IE header. + * + * @param ap_data Reference to core_ap_data_c from which to generate the information. + * @param ie_id_list Information element id list. + * @param ie_id_list_length Information element id list length. + */ + void generate( + core_ap_data_c& ap_data, + u8_t* ie_id_list, + u8_t ie_id_list_length ); + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_rm_ie_beacon_report_frame_body_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +private: // data + + /** Pointer to the start of the current IE data. Not owned by this pointer. */ + const u8_t* current_ie_m; + + /** The maximum length of the current IE. */ + u16_t current_ie_max_length_m; + + }; + +#endif // CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_H + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_report_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_report_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Beacon Report IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_BEACON_REPORT_IE_H +#define CORE_FRAME_RM_IE_BEACON_REPORT_IE_H + +#include "core_frame_rm_ie.h" +#include "core_frame_rm_ie_beacon_report_frame_body_ie.h" +#include "core_types.h" +#include "core_ap_data.h" + +/** + * Class for parsing Beacon Report Element IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_beacon_report_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a Beacon Report IE + * instance with given parameters. + * + * @since S60 v5.2 + * @param regulatory_class Value for Regulatory Class field of IE. + * @param measurement_duration Value for Measurement Duration field of IE. + * @param reported_frame_information Value for Reported Frame Information field of IE. + * @param antenna_id Value for Antenna ID field of IE. + * @param ap_data Reference to core_ap_data_c from which to generate the information. + */ + static core_frame_rm_ie_beacon_report_ie_c* instance( + u8_t regulatory_class, + u16_t measurement_duration, + u8_t reported_frame_information, + u8_t antenna_id, + core_ap_data_c& ap_data ); + + /** + * Factory for creating a Beacon Report IE + * instance with given parameters. + * + * @since S60 v5.2 + * @param regulatory_class Value for Regulatory Class field of IE. + * @param measurement_duration Value for Measurement Duration field of IE. + * @param reported_frame_information Value for Reported Frame Information field of IE. + * @param antenna_id Value for Antenna ID field of IE. + * @param ap_data Reference to core_ap_data_c from which to generate the information. + * @param frame_body_ie Pointer to frame body ie. + */ + static core_frame_rm_ie_beacon_report_ie_c* instance( + u8_t regulatory_class, + u16_t measurement_duration, + u8_t reported_frame_information, + u8_t antenna_id, + core_ap_data_c& ap_data, + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie ); + + /** + * Destructor. + */ + virtual ~core_frame_rm_ie_beacon_report_ie_c(); + + /** + * Generate an IE header. + * + * @param regulatory_class Value for Regulatory Class field of IE. + * @param actual_measurement_start_time Value for Actual Measurement Start Time field of IE. + * @param measurement_duration Value for Measurement Duration field of IE. + * @param reported_frame_information Value for Reported Frame Information field of IE. + * @param rsni Value for RSNI field of IE. + * @param antenna_id Value for Antenna ID field of IE. + * @param parent_tsf Value for Parent TSF field of IE. + * @param ap_data Reference to core_ap_data_c from which to generate the information. + */ + void generate( + u8_t regulatory_class, + core_tsf_value_s& actual_measurement_start_time, + u16_t measurement_duration, + u8_t reported_frame_information, + u8_t rsni, + u8_t antenna_id, + core_tsf_value_s& parent_tsf, + core_ap_data_c& ap_data ); + + /** + * Generate an IE header. + * + * @param regulatory_class Value for Regulatory Class field of IE. + * @param actual_measurement_start_time Value for Actual Measurement Start Time field of IE. + * @param measurement_duration Value for Measurement Duration field of IE. + * @param reported_frame_information Value for Reported Frame Information field of IE. + * @param rsni Value for RSNI field of IE. + * @param antenna_id Value for Antenna ID field of IE. + * @param parent_tsf Value for Parent TSF field of IE. + * @param ap_data Reference to core_ap_data_c from which to generate the information. + * @param frame_body_ie Pointer to frame body ie. + */ + void generate( + u8_t regulatory_class, + core_tsf_value_s& actual_measurement_start_time, + u16_t measurement_duration, + u8_t reported_frame_information, + u8_t rsni, + u8_t antenna_id, + core_tsf_value_s& parent_tsf, + core_ap_data_c& ap_data, + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie ); + + /** + * Return the length of the IE. + * + * @since S60 v5.2 + * @return The length of the IE. + */ + u8_t length() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length The maximum size of the frame buffer. + */ + core_frame_rm_ie_beacon_report_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +private: // data + + /** Pointer to the start of the current IE data. Not owned by this pointer. */ + const u8_t* current_ie_m; + + /** The maximum length of the current IE. */ + u16_t current_ie_max_length_m; + + }; + +#endif // CORE_FRAME_RM_IE_BEACON_REPORT_IE_H + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_request.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_request.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Beacon Request IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_BEACON_REQUEST_H +#define CORE_FRAME_RM_IE_BEACON_REQUEST_H + +#include "core_frame_rm_ie.h" +#include "core_frame_rm_ie_beacon_request_ie.h" +#include "core_frame_rm_ie_beacon_request_detail_ie.h" +#include "core_types.h" + +/** + * Class for parsing RM Beacon Request Element IE. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_beacon_request_c ) : public core_frame_rm_ie_c + { + +public: + enum core_frame_rm_ie_beacon_request_element_id_e + { + core_frame_rm_ie_beacon_request_element_id_beacon_reporting_information = 1, + core_frame_rm_ie_beacon_request_element_id_beacon_reporting_detail = 2 + }; + + enum core_beacon_request_scan_mode_e + { + core_beacon_request_scan_mode_passive = 0, + core_beacon_request_scan_mode_active = 1, + core_beacon_request_scan_mode_beacon = 2 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Reference to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_rm_ie_beacon_request_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_rm_ie_beacon_request_c(); + + /** + * Return the Regulatory Class field. + * @return The Regulatory Class field. + */ + u8_t regulatory_class() const; + + /** + * Return the Channel Number field. + * @return Channel Number field. + */ + u8_t channel_number() const; + + /** + * Return the Randomization Interval field. + * @return Randomization Interval field. + */ + u16_t randomization_interval() const; + + /** + * Return the Measurement Duration field. + * @return Measurement Duration field. + */ + u16_t measurement_duration() const; + + /** + * Return the Measurement Mode field. + * @return Measurement Mode field. + */ + u8_t measurement_mode() const; + + /** + * Return the BSSID field. + * @return BSSID field. + */ + core_mac_address_s bssid() const; + + /** + * Return the first IE of the Beacon Request. + * + * @since S60 v5.2 + * @return Pointer to the first IE, NULL if no IEs. + */ + core_frame_dot11_ie_c* first_ie(); + + /** + * Return the next IE of the Beacon Request. + * + * @since S60 v5.2 + * @return Pointer to the next IE, NULL if no more IEs. + */ + core_frame_dot11_ie_c* next_ie(); + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_rm_ie_beacon_request_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + /** + * Return the offset of the first IE. + * @return The offset of the first IE. 0 if the frame doesn't support IEs. + */ + u16_t first_ie_offset() const; + + /** + * Return the length of the payload data. + * + * @since S60 v5.2 + * @return The length of the payload data. + */ + u16_t payload_data_length() const; + + /** + * Return a pointer to the payload data. + * + * @since S60 v5.2 + * @return A pointer to the payload data. + */ + const u8_t* payload_data() const; + +private: // data + + /** Pointer to the start of the current IE data. Not owned by this pointer. */ + const u8_t* current_ie_m; + + /** The maximum length of the current IE. */ + u16_t current_ie_max_length_m; + + }; + +#endif // CORE_FRAME_RM_IE_BEACON_REQUEST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_request_detail_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_request_detail_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11k Beacon Request Detail IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_H +#define CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_H + +#include "core_types.h" +#include "core_frame_dot11_ie.h" + +/** + * Class parsing 802.11k Beacon Request Detail IEs. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_beacon_request_detail_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + + enum core_frame_rm_ie_brd_reporting_detail_e + { + core_frame_rm_ie_brd_reporting_detail_no_fields_or_elements = 0, + core_frame_rm_ie_brd_reporting_detail_fields_and_requested_elements = 1, + core_frame_rm_ie_brd_reporting_detail_default = 2 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Pointer to the IE data. + * @return Pointer to the created parser instance. + */ + static core_frame_rm_ie_beacon_request_detail_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Return the Reporting Detail field of the IE. + * + * @since S60 v5.2 + * @return The Reporting Detail field of the IE. + */ + u8_t reporting_detail() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_rm_ie_beacon_request_detail_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_request_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rm_ie_beacon_request_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11k Beacon Request IEs. +* +*/ + + +#ifndef CORE_FRAME_RM_IE_BEACON_REQUEST_IE_H +#define CORE_FRAME_RM_IE_BEACON_REQUEST_IE_H + +#include "core_types.h" +#include "core_frame_dot11_ie.h" + +/** + * Class parsing 802.11k Beacon Request IEs. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_frame_rm_ie_beacon_request_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + + enum core_frame_rm_ie_bri_reporting_condition_e + { + core_frame_rm_ie_bri_reporting_condition_default = 0 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v5.2 + * @param ie Reference to the IE data. + * @return Pointer to the created parser instance. + */ + static core_frame_rm_ie_beacon_request_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Return the Reporting Condition field of the IE. + * + * @since S60 v5.2 + * @return The Reporting Condition field of the IE. + */ + u8_t reporting_condition() const; + + /** + * Return the Threshold/Offset Reference Value of the IE. + * + * @since S60 v5.2 + * @return The Threshold/Offset Reference Value field of the IE. + */ + u8_t threshold_reference_value() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + * @param max_data_length Maximum length of the IE data. + */ + core_frame_rm_ie_beacon_request_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_RM_IE_BEACON_REQUEST_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rsn_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_rsn_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11i (RSN) IEs. +* +*/ + + +#ifndef CORE_FRAME_RSN_IE_H +#define CORE_FRAME_RSN_IE_H + +#include "abs_core_wpx_adaptation.h" +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing and generating 802.11i (RSN) IEs. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_rsn_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param wpx_adaptation WPX adaptation. + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_rsn_ie_c* instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating an IE with the given parameters. + * + * @since S60 v3.1 + * @param wpx_adaptation WPX adaptation. + * @param group_cipher Used group cipher. + * @param pairwise_cipher Used pairwise cipher. + * @param key_management Used key management suite. + * @param pmkid_length Length of optional PMKID data. + * @param pmkid_data Pointer to the buffer of optional PMKID data. + * @return A pointer to the created IE instance. + */ + static core_frame_rsn_ie_c* instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t pmkid_length, + const u8_t* pmkid_data ); + + /** + * Destructor. + */ + virtual ~core_frame_rsn_ie_c(); + + /** + * Return the supported group cipher. + * @return The supported group cipher. + */ + u8_t group_cipher_suite() const; + + /** + * Return the supported pairwise ciphers. + * @param The supported pairwise ciphers. + */ + u8_t pairwise_cipher_suites() const; + + /** + * Return the supported key management suites. + * @param The supported key management suites. + */ + u8_t key_management_suites() const; + +private: + + /** + * Convert OUI to core_cipher_suite_e type. + * @param oui OUI to convert. + * @return OUI convert to core_cipher_suite_e type. + */ + core_cipher_suite_e cipher_oui_to_enum( + const u8_t* oui ) const; + + /** + * Convert OUI to core_key_management_e type. + * @param oui OUI to convert. + * @return OUI converted to core_key_management_e type. + */ + core_key_management_e key_management_oui_to_enum( + const u8_t* oui ) const; + + /** + * Return the "raw" value for the given group cipher. + * @param cipher The cipher to return the value to. + * @return The "raw" value for the given group cipher. + */ + u8_t get_raw_group_cipher( + core_cipher_suite_e cipher ) const; + + /** + * Return the "raw" value for the given pairwise cipher. + * @param cipher The cipher to return the value to. + * @return The "raw" value for the given pairwise cipher. + */ + u8_t get_raw_pairwise_cipher( + core_cipher_suite_e cipher ) const; + + /** + * Return the "raw" value for the given key management suite. + * @param key_management The key management suite to return the value to. + * @return The "raw" value for the given key management suite. + */ + u8_t get_raw_key_management( + core_key_management_e key_management ) const; + + /** + * Generate a 802.11i (RSN) IE. + * + * @param group_cipher Used group cipher. + * @param pairwise_cipher Used pairwise cipher. + * @param key_management Used key management suite. + * @param pmkid_length Length of optional PMKID data. + * @param pmkid_data Pointer to the buffer of optional PMKID data. + */ + void generate( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t pmkid_length, + const u8_t* pmkid_dat ); + + /** + * Constructor + * + * @param wpx_adaptation WPX adaptation. + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_rsn_ie_c( + abs_core_wpx_adaptation_c& wpx_adaptation, + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +private: // data + + /** WPX adaptation instance. */ + abs_core_wpx_adaptation_c& wpx_adaptation_m; + + }; + +#endif // CORE_FRAME_RSN_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_tim_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_tim_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11 TIM element IEs. +* +*/ + + +#ifndef CORE_FRAME_TIM_IE_H +#define CORE_FRAME_TIM_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing 802.11 TIM element IEs. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_tim_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_tim_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_tim_ie_c(); + + /** + * Return the DTIM Count field. + * + * @return The DTIM Count field. + */ + u8_t dtim_count() const; + + /** + * Return the DTIM Period field. + * + * @return The DTIM Period field. + */ + u8_t dtim_period() const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_tim_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_TIM_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wapi_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wapi_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,186 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing GB 15629.11 (WAPI) IEs. +* +*/ + + +#ifndef CORE_FRAME_WAPI_IE_H +#define CORE_FRAME_WAPI_IE_H + +#include "abs_core_wpx_adaptation.h" +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing and generating GB 15629.11 (WAPI) IEs. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_frame_wapi_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** Defines the capability bits in capability information field. */ + enum core_wapi_capability_e + { + core_wapi_capability_preauthentication = 0x0001 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_wapi_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating an IE with the given parameters. + * + * @since S60 v3.2 + * @param group_cipher Used group cipher. + * @param pairwise_cipher Used pairwise cipher. + * @param key_management Used key management suite. + * @param capability Capability information. + * @param bkid_length Length of optional BKID data. + * @param bkid_data Pointer to the buffer of optional BKID data. + * @return A pointer to the created IE instance. + */ + static core_frame_wapi_ie_c* instance( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t capability, + u16_t bkid_length, + const u8_t* bkid_data ); + + /** + * Destructor. + */ + virtual ~core_frame_wapi_ie_c(); + + /** + * Return the supported group cipher. + * @return The supported group cipher. + */ + u8_t group_cipher_suite() const; + + /** + * Return the supported pairwise ciphers. + * @return The supported pairwise ciphers. + */ + u8_t pairwise_cipher_suites() const; + + /** + * Return the supported key management suites. + * @return The supported key management suites. + */ + u8_t key_management_suites() const; + + /** + * Return the capability information. + * @return The capability information. + */ + u16_t capability() const; + +private: + + /** + * Return the offset for pairwise cipher count. + * @return Offset of pairwise cipher count, 0 if invalid. + */ + u8_t pairwise_cipher_count_offset() const; + + /** + * Return the offset for group cipher. + * @return Offset of group cipher, 0 if invalid. + */ + u8_t group_cipher_offset() const; + + /** + * Convert OUI to core_cipher_suite_e type. + * @param oui OUI to convert. + * @return OUI convert to core_cipher_suite_e type. + */ + core_cipher_suite_e cipher_oui_to_enum( + const u8_t* oui ) const; + + /** + * Convert OUI to core_key_management_e type. + * @param oui OUI to convert. + * @return OUI converted to core_key_management_e type. + */ + core_key_management_e key_management_oui_to_enum( + const u8_t* oui ) const; + + /** + * Return the "raw" value for the given group cipher. + * @param cipher The cipher to return the value to. + * @return The "raw" value for the given group cipher. + */ + u8_t get_raw_group_cipher( + core_cipher_suite_e cipher ) const; + + /** + * Return the "raw" value for the given pairwise cipher. + * @param cipher The cipher to return the value to. + * @return The "raw" value for the given pairwise cipher. + */ + u8_t get_raw_pairwise_cipher( + core_cipher_suite_e cipher ) const; + + /** + * Return the "raw" value for the given key management suite. + * @param key_management The key management suite to return the value to. + * @return The "raw" value for the given key management suite. + */ + u8_t get_raw_key_management( + core_key_management_e key_management ) const; + + /** + * Generate an GB 15629.11 (WAPI) IEs. + * + * @param group_cipher Used group cipher. + * @param pairwise_cipher Used pairwise cipher. + * @param key_management Used key management suite. + * @param capability Capability information. + * @param bkid_length Length of optional PMKID data. + * @param bkid_data Pointer to the buffer of optional PMKID data. + */ + void generate( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t capability, + u16_t bkid_length, + const u8_t* bkid_data ); + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_wapi_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // core_frame_wapi_ie_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wmm_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wmm_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing WMM QoS IEs. +* +*/ + + +#ifndef CORE_FRAME_WMM_IE_H +#define CORE_FRAME_WMM_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing WMM Parameter Element IE. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_frame_wmm_ie_parameter_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_wmm_ie_parameter_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Destructor. + */ + virtual ~core_frame_wmm_ie_parameter_c(); + + /** + * Return the Version field. + * @return The Version field. + */ + u8_t version() const; + + /** + * Return whether U-APSD is supported. + * @return Whether U-APSD is supported. + */ + bool_t is_uapsd_supported() const; + + /** + * Return whether Admission Control is mandatory for the given access class. + * @return Whether Admission Control is mandatory for the given access class. + */ + bool_t is_admission_control_required( + core_access_class_e access_class ) const; + +private: + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_wmm_ie_parameter_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_WMM_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wmm_ie_tspec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wmm_ie_tspec.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for generating WMM TSPEC elements. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef CORE_FRAME_WMM_IE_TSPEC_H +#define CORE_FRAME_WMM_IE_TSPEC_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for generating WMM TSPEC elements. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_frame_wmm_ie_tspec_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param ie Pointer to the IE data. + * @return The A pointer to the created IE instance. + */ + static core_frame_wmm_ie_tspec_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating a TSPEC IE with the given parameters. + * + * @since S60 v3.2 + * @param tid Traffic Identifier field of the frame. + * @param user_priority User Priority field of the frame. + * @param is_uapsd_enabled Whether U-APSD is enabled. + * @param is_periodic_traffic Whether the traffic pattern is periodic or aperiodic. + * @param direction Direction field of the frame. + * @param nominal_msdu_size Nominal MSDU Size field of the frame. + * @param maximum_msdu_size Maximum MSDU Size field of the frame. + * @param minimum_service_interval Minimum Service Interval field of the frame. + * @param maximum_service_interval Maximum Service Interval field of the frame. + * @param inactivity_interval Inactivity Interval field of the frame. + * @param suspension_interval Suspension Interval field of the frame. + * @param service_start_time Service Start Time field of the frame. + * @param minimum_data_rate Minimum Data Rate field of the frame. + * @param mean_data_rate Mean Data Rate field of the frame. + * @param peak_data_rate Peak Data Rate field of the frame. + * @param maximum_burst_size Maximum Burst Size field of the frame. + * @param delay_bound Delay Bound field of the frame. + * @param minimum_phy_rate Minimum PHY Rate field of the frame. + * @param surplus_bandwidth_allowance Surplus Bandwidth Allowance field of the frame. + * @param medium_time Medium Time field of the frame. + * @return A pointer to the created IE instance. + */ + static core_frame_wmm_ie_tspec_c* instance( + u8_t tid, + u8_t user_priority, + bool_t is_uapsd_enabled, + bool_t is_periodic_traffic, + core_traffic_stream_direction_e direction, + u16_t nominal_msdu_size, + u16_t maximum_msdu_size, + u32_t minimum_service_interval, + u32_t maximum_service_interval, + u32_t inactivity_interval, + u32_t suspension_interval, + u32_t service_start_time, + u32_t minimum_data_rate, + u32_t mean_data_rate, + u32_t peak_data_rate, + u32_t maximum_burst_size, + u32_t delay_bound, + u32_t minimum_phy_rate, + u16_t surplus_bandwidth_allowance, + u16_t medium_time ); + + /** + * Destructor. + */ + virtual ~core_frame_wmm_ie_tspec_c(); + + /** + * Return the Version field. + * @return The Version field. + */ + u8_t version() const; + + /** + * Return the Traffic Identifier field of the frame. + * + * @since S60 v3.2 + * @return The Traffic Identifier field of the frame. + */ + u8_t tid() const; + + /** + * Return the User Priority field of the frame. + * + * @since S60 v3.2 + * @return The User Priority field of the frame. + */ + u8_t user_priority() const; + + /** + * Return the whether U-APSD is enabled. + * + * @since S60 v3.2 + * @return Whether U-APSD is enabled. + */ + bool_t is_uapsd_enabled() const; + + /** + * Return whether the traffic pattern is periodic or aperiodic. + * + * @since S60 v3.2 + * @return Whether the traffic pattern is periodic or aperiodic. + */ + bool_t is_periodic_traffic() const; + + /** + * Return the Direction field of the frame. + * + * @since S60 v5.1 + * @return The Direction field of the frame. + */ + core_traffic_stream_direction_e direction() const; + + /** + * Return the Nominal MSDU Size field of the frame. + * + * @since S60 v3.2 + * @return The Nominal MSDU Size field of the frame. + */ + u16_t nominal_msdu_size() const; + + /** + * Return the Maximum MSDU Size field of the frame. + * + * @since S60 v3.2 + * @return The Maximum MSDU Size field of the frame. + */ + u16_t maximum_msdu_size() const; + + /** + * Return the Minimum Service Interval field of the frame. + * + * @since S60 v3.2 + * @return The Minimum Service Interval field of the frame. + */ + u32_t minimum_service_interval() const; + + /** + * Return the Maximum Service Interval field of the frame. + * + * @since S60 v3.2 + * @return The Maximum Service Interval field of the frame. + */ + u32_t maximum_service_interval() const; + + /** + * Return the Inactivity Interval field of the frame. + * + * @since S60 v3.2 + * @return The Inactivity Interval field of the frame. + */ + u32_t inactivity_interval() const; + + /** + * Return the Suspension Interval field of the frame. + * + * @since S60 v3.2 + * @return The Suspension Interval field of the frame. + */ + u32_t suspension_interval() const; + + /** + * Return the Service Start Time field of the frame. + * + * @since S60 v3.2 + * @return The Service Start Time field of the frame. + */ + u32_t service_start_time() const; + + /** + * Return the Minimum Data Rate field of the frame. + * + * @since S60 v3.2 + * @return The Minimum Data Rate field of the frame. + */ + u32_t minimum_data_rate() const; + + /** + * Return the Mean Data Rate field of the frame. + * + * @since S60 v3.2 + * @return The Mean Data Rate field of the frame. + */ + u32_t mean_data_rate() const; + + /** + * Return the Peak Data Rate field of the frame. + * + * @since S60 v3.2 + * @return The Peak Data Rate field of the frame. + */ + u32_t peak_data_rate() const; + + /** + * Return the Maximum Burst Size field of the frame. + * + * @since S60 v3.2 + * @return The Maximum Burst Size field of the frame. + */ + u32_t maximum_burst_size() const; + + /** + * Return the Delay Bound field of the frame. + * + * @since S60 v3.2 + * @return The Delay Bound field of the frame. + */ + u32_t delay_bound() const; + + /** + * Return the Minimum PHY Rate field of the frame. + * + * @since S60 v3.2 + * @return The Minimum PHY Rate field of the frame. + */ + u32_t minimum_phy_rate() const; + + /** + * Return the Surplus Bandwidth Allowance field of the frame. + * + * @since S60 v3.2 + * @return The Surplus Bandwidth Allowance field of the frame. + */ + u16_t surplus_bandwidth_allowance() const; + + /** + * Return the Medium Time field of the frame. + * + * @since S60 v3.2 + * @return The Medium Time field of the frame. + */ + u16_t medium_time() const; + +private: + + /** + * Generate a TSPEC IE. + * + * @param tid Traffic Identifier field of the frame. + * @param user_priority User Priority field of the frame. + * @param is_uapsd_enabled Whether U-APSD is enabled. + * @param is_periodic_traffic Whether the traffic pattern is periodic or aperiodic. + * @param direction Direction field of the frame. + * @param nominal_msdu_size Nominal MSDU Size field of the frame. + * @param maximum_msdu_size Maximum MSDU Size field of the frame. + * @param minimum_service_interval Minimum Service Interval field of the frame. + * @param maximum_service_interval Maximum Service Interval field of the frame. + * @param inactivity_interval Inactivity Interval field of the frame. + * @param suspension_interval Suspension Interval field of the frame. + * @param service_start_time Service Start Time field of the frame. + * @param minimum_data_rate Minimum Data Rate field of the frame. + * @param mean_data_rate Mean Data Rate field of the frame. + * @param peak_data_rate Peak Data Rate field of the frame. + * @param maximum_burst_size Maximum Burst Size field of the frame. + * @param delay_bound Delay Bound field of the frame. + * @param minimum_phy_rate Minimum PHY Rate field of the frame. + * @param surplus_bandwidth_allowance Surplus Bandwidth Allowance field of the frame. + * @param medium_time Medium Time field of the frame. + */ + void generate( + u8_t tid, + u8_t user_priority, + bool_t is_uapsd_enabled, + bool_t is_periodic_traffic, + core_traffic_stream_direction_e direction, + u16_t nominal_msdu_size, + u16_t maximum_msdu_size, + u32_t minimum_service_interval, + u32_t maximum_service_interval, + u32_t inactivity_interval, + u32_t suspension_interval, + u32_t service_start_time, + u32_t minimum_data_rate, + u32_t mean_data_rate, + u32_t peak_data_rate, + u32_t maximum_burst_size, + u32_t delay_bound, + u32_t minimum_phy_rate, + u16_t surplus_bandwidth_allowance, + u16_t medium_time ); + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_wmm_ie_tspec_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + + }; + +#endif // CORE_FRAME_WMM_IE_TSPEC_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wpa_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wpa_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing WPA IEs. +* +*/ + + +#ifndef CORE_FRAME_WPA_IE_H +#define CORE_FRAME_WPA_IE_H + +#include "abs_core_wpx_adaptation.h" +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +/** + * Class for parsing and generating WPA IEs. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_frame_wpa_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.1 + * @param wpx_adaptation WPX adaptation. + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_wpa_ie_c* instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating an IE with the given parameters. + * + * @since S60 v3.1 + * @param wpx_adaptation WPX adaptation. + * @param group_cipher Used group cipher. + * @param pairwise_cipher Used pairwise cipher. + * @param key_management Used key management suite. + * @param pmkid_length Length of optional PMKID data. + * @param pmkid_data Pointer to the buffer of optional PMKID data. + * @return A pointer to the created IE instance. + */ + static core_frame_wpa_ie_c* instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management ); + + /** + * Destructor. + */ + virtual ~core_frame_wpa_ie_c(); + + /** + * Return the supported group cipher. + * @return The supported group cipher. + */ + u8_t group_cipher_suite() const; + + /** + * Return the supported pairwise ciphers. + * @param The supported pairwise ciphers. + */ + u8_t pairwise_cipher_suites() const; + + /** + * Return the supported key management suites. + * @param The supported key management suites. + */ + u8_t key_management_suites() const; + +private: + + /** + * Convert OUI to core_cipher_suite_e type. + * @param oui OUI to convert. + * @return OUI convert to core_cipher_suite_e type. + */ + core_cipher_suite_e cipher_oui_to_enum( + const u8_t* oui ) const; + + /** + * Convert OUI to core_key_management_e type. + * @param oui OUI to convert. + * @return OUI converted to core_key_management_e type. + */ + core_key_management_e key_management_oui_to_enum( + const u8_t* oui ) const; + + /** + * Return the "raw" value for the given group cipher. + * @param cipher The cipher to return the value to. + * @return The "raw" value for the given group cipher. + */ + u8_t get_raw_group_cipher( + core_cipher_suite_e cipher ) const; + + /** + * Return the "raw" value for the given pairwise cipher. + * @param cipher The cipher to return the value to. + * @return The "raw" value for the given pairwise cipher. + */ + u8_t get_raw_pairwise_cipher( + core_cipher_suite_e cipher ) const; + + /** + * Return the "raw" value for the given key management suite. + * @param key_management The key management suite to return the value to. + * @return The "raw" value for the given key management suite. + */ + u8_t get_raw_key_management( + core_key_management_e key_management ) const; + + /** + * Generate a 802.11i (RSN) IE. + * + * @param group_cipher Used group cipher. + * @param pairwise_cipher Used pairwise cipher. + * @param key_management Used key management suite. + * @param pmkid_length Length of optional PMKID data. + * @param pmkid_data Pointer to the buffer of optional PMKID data. + */ + void generate( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management ); + + /** + * Constructor + * + * @param wpx_adaptation WPX adaptation. + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_wpa_ie_c( + abs_core_wpx_adaptation_c& wpx_adaptation, + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +private: // data + + /** WPX adaptation instance. */ + abs_core_wpx_adaptation_c& wpx_adaptation_m; + + }; + +#endif // CORE_FRAME_WPA_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wsc_ie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wsc_ie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing WSC IEs. +* +*/ + + +#ifndef CORE_FRAME_WSC_IE_H +#define CORE_FRAME_WSC_IE_H + +#include "core_frame_dot11_ie.h" +#include "core_types.h" + +// Compile time assert. Used to make sure that datatypes in generate are correct size. +#define COMPILE_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] + + +const u8_t CORE_FRAME_WSC_IE_USED_VERSION = 0x10; +const u8_t CORE_FRAME_WSC_IE_REQUEST_TYPE_ENROLLEE = 0x01; + +/** + * Class for parsing and generating WSC IEs (Wi-Fi Protected Setup). + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_frame_wsc_ie_c ) : public core_frame_dot11_ie_c + { + +public: + + enum core_frame_wsc_ie_config_method_e + { + core_frame_wsc_ie_config_method_usba = 0x0001, + core_frame_wsc_ie_config_method_ethernet = 0x0002, + core_frame_wsc_ie_config_method_pin_label = 0x0004, + core_frame_wsc_ie_config_method_pin_display = 0x0008, + core_frame_wsc_ie_config_method_nfc_ext_token = 0x0010, + core_frame_wsc_ie_config_method_nfc_int_token = 0x0020, + core_frame_wsc_ie_config_method_nfc_interface = 0x0040, + core_frame_wsc_ie_config_method_push_button = 0x0080, + core_frame_wsc_ie_config_method_keypad = 0x0100 + }; + + /** + * Factory for creating a parser instance. + * + * @since S60 v3.2 + * @param ie Pointer to the IE data. + * @return A pointer to the created IE instance. + */ + static core_frame_wsc_ie_c* instance( + const core_frame_dot11_ie_c& ie ); + + /** + * Factory for creating an IE with the given parameters. + * + * @since S60 v3.2 + * @param version Used Protected Setup version number. + * @param request_type Specifies the mode in which the device will operate in this setup exchange. + * @return A pointer to the created IE instance. + */ + static core_frame_wsc_ie_c* instance( + const u8_t version, + const u8_t request_type ); + + /** + * Destructor. + */ + virtual ~core_frame_wsc_ie_c(); + + /** + * Following getters are used to read values from IE. + * Conversion from Big endian to host order is done in these methods. + * + * @return Attribute value or pointer to attribute data. + */ + u16_t association_state() const; + u16_t config_methods() const; + u16_t configuration_error() const; + const u8_t* device_name() const; + u16_t device_password_id() const; + const u8_t* manufacturer() const; + const u8_t* model_name() const; + const u8_t* model_number() const; + u8_t request_type() const; + u8_t response_type() const; + u8_t rf_bands() const; + bool_t selected_registrar() const; + const u8_t* serial_number() const; + u8_t protected_setup_state() const; + const u8_t* uuid_e() const; + const u8_t* uuid_r() const; + u8_t version() const; + u16_t selected_registrar_config_methods() const; + const u8_t* primary_device_type() const; + bool_t ap_setup_locked() const; + +private: + + /** + * Search through data and stores Attribute indexes to members. + */ + void search_attributes(); + + /** + * Generate IE for Association request. + * + * @param version Used Protected Setup version number. + * @param request_type Specifies the mode in which the device will operate in this setup exchange. + */ + void generate( + const u8_t version, + const u8_t request_type ); + + /** + * Constructor + * + * @param data_length Length of the IE data. + * @param data Pointer to the IE data. + */ + core_frame_wsc_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ); + +private: // Data + + /* + * Indexes to data fields within IE. + * These indexes are used in getters for easy access to attributes. + */ + u8_t association_state_ind_m; + u8_t config_methods_ind_m; + u8_t configuration_error_ind_m; + u8_t device_name_ind_m; + u8_t device_password_id_ind_m; + u8_t manufacturer_ind_m; + u8_t model_name_ind_m; + u8_t model_number_ind_m; + u8_t request_type_ind_m; + u8_t response_type_ind_m; + u8_t rf_bands_ind_m; + u8_t selected_registrar_ind_m; + u8_t serial_number_ind_m; + u8_t protected_setup_state_ind_m; + u8_t uuid_e_ind_m; + u8_t uuid_r_ind_m; + u8_t version_ind_m; + u8_t selected_registrar_config_methods_ind_m; + u8_t primary_device_type_ind_m; + u8_t ap_setup_locked_ind_m; + + }; + + +#endif // CORE_FRAME_WSC_IE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_iap_data.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_iap_data.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,280 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class holding all IAP related data +* +*/ + + +#ifndef CORE_IAP_DATA_H +#define CORE_IAP_DATA_H + +#include "core_types.h" +#include "core_type_list.h" + +/** + * Class holding all IAP related data + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_iap_data_c ) + { + +public: + + /** + * Constructor + * + * @since S60 v3.1 + * @param iap_data containing structure of IAP data + */ + core_iap_data_c( + const core_iap_data_s& iap_data ); + + /** + * Destructor + */ + ~core_iap_data_c(); + + /** + * Return the ID of the IAP. + * + * @since S60 v3.1 + * @return The ID of the IAP. + */ + u32_t id() const; + + /** + * Return the IAP ID of the IAP. + * + * @since S60 v5.2 + * @return The IAP ID of the IAP. + */ + u32_t iap_id() const; + + /** + * Return the configured operating mode. + * + * @since S60 v3.1 + * @return The configured operating mode. + */ + core_operating_mode_e operating_mode() const; + + /** + * Return the configured SSID. + * + * @since S60 v3.1 + * @return The configured SSID. + */ + const core_ssid_s& ssid() const; + + /** + * Check whether the SSID is hidden. + * + * @since S60 v3.1 + * @return Whether the SSID is hidden. + */ + bool_t is_hidden() const; + + /** + * Return the requested WEP key. + * + * @since S60 v3.1 + * @param Index of the WEP key ( 1 - 4 ). + * @return The requested WEP key. + */ + const core_wep_key_s& wep_key( + u32_t key_index ) const; + + /** + * Return the index of the default WEP key. + * + * @since S60 v3.1 + * @return The index of the default WEP key. + */ + u32_t default_wep_key_index() const; + + /** + * Return the configured security mode. + * + * @since S60 v3.1 + * @return The configured security mode. + */ + core_security_mode_e security_mode() const; + + /** + * Return the configured authentication mode. + * + * @since S60 v3.1 + * @return The configured authentication mode. + */ + core_authentication_mode_e authentication_mode() const; + + /** + * Set the authentication mode to the given mode. + * + * @since S60 v3.2 + * @param mode Authentication mode to be set. + */ + void set_authentication_mode( + core_authentication_mode_e mode ); + + /** + * Check whether PSK is used or not. + * + * @since S60 v3.1 + * @return Whether PSK is used or not. + */ + bool_t is_psk_used() const; + + /** + * Check whether PSK key has been overridden. + * + * @since S60 v3.1 + * @return Whether PSK key has been overridden. + */ + bool_t is_psk_overridden() const; + + /** + * Return the overridden PSK key. + * + * @since S60 v3.1 + * @return The overridden PSK key. + */ + const core_wpa_preshared_key_s& psk_key() const; + + /** + * Return the used ad-hoc channel. + * + * @since S60 v3.1 + * @return The used ad-hoc channel. 0 if automatic configuration is used. + */ + u32_t adhoc_channel() const; + + /** + * Check whether IP address is configured dynamically. + * + * @since S60 v3.1 + * @return Whether IP address is configured dynamically. + */ + bool_t is_dynamic_ip_addr() const; + + /** + * Check whether roaming between APs is allowed. + * + * @since S60 v3.1 + * @return Whether roaming between APs is allowed. + */ + bool_t is_roaming_allowed() const; + + /** + * Check whether the configured security mode uses EAP. + * + * @since S60 v3.1 + * @return Whether the configured security mode uses EAP. + */ + bool_t is_eap_used() const; + + /** + * Check whether the configured security mode uses WAPI. + * + * @since S60 v3.2 + * @return Whether the configured security mode uses WAPI. + */ + bool_t is_wapi_used() const; + + /** + * Check whether the configured security mode is 802.1x. + * + * @since S60 v3.1 + * @return Whether the configured security mode is 802.1x. + */ + bool_t is_802dot1x_used() const; + + /** + * Check whether the IAP whitelist is empty. + * + * @since S60 v3.1 + * @return Whether the IAP whitelist is empty. + */ + bool_t is_iap_whitelist_empty() const; + + /** + * Check whether the given MAC address is whitelisted. + * + * @since S60 v3.1 + * @param mac MAC address to be checked. + * @return Whether the given MAC address is whitelisted. + */ + bool_t is_mac_in_iap_whitelist( + const core_mac_address_s& mac ); + + /** + * Check whether the given MAC address is blacklisted. + * + * @since S60 v3.1 + * @param mac MAC address to be checked. + * @return Whether the given MAC address is blacklisted. + */ + bool_t is_mac_in_iap_blacklist( + const core_mac_address_s& mac ); + + /** + * Add a MAC address to the IAP whitelist. + * + * @since S60 v3.1 + * @param mac MAC address to be added. + */ + void add_mac_to_iap_whitelist( + const core_mac_address_s& mac ); + + /** + * Remove a MAC address from the IAP whitelist. + * + * @since S60 v3.1 + * @param mac MAC address to be removed. + */ + void remove_mac_from_iap_whitelist( + const core_mac_address_s& mac ); + + /** + * Add a MAC address to the IAP blacklist. + * + * @since S60 v3.1 + * @param mac MAC address to be added. + */ + void add_mac_to_iap_blacklist( + const core_mac_address_s& mac ); + + /** + * Remove a MAC address from the IAP blacklist. + * + * @since S60 v3.1 + * @param mac MAC address to be removed. + */ + void remove_mac_from_iap_blacklist( + const core_mac_address_s& mac ); + +private: // data + + /** Adaptation side data about the WLAN connection */ + core_iap_data_s iap_data_m; + + /** IAP whitelist of APs. */ + core_type_list_c iap_whitelist_m; + + /** IAP blacklist of APs. */ + core_type_list_c iap_blacklist_m; + }; + +#endif // CORE_IAP_DATA_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_base.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_base.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,330 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for wlan engine operations +* +*/ + + +#ifndef CORE_OPERATION_BASE_H +#define CORE_OPERATION_BASE_H + +#include "core_types.h" + +class core_server_c; +class abs_core_driverif_c; +class abs_core_server_callback_c; + +/** + * Base class for wlan engine operations + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_base_c ) + { + +public: + + /** + * Defines the possible operation states used in the state machine + * of the base class. + */ + enum core_base_state_e + { + core_base_state_init = 0, + core_base_state_load_drivers, + core_base_state_user_cancel, + core_base_state_next, + core_base_state_MAX + }; + + /** + * Defines the possible feature flags an operation can have. + */ + enum core_base_flag_e + { + /** + * No special features. + */ + core_base_flag_none = 0, + /** + * Operation needs drivers. The drivers will be automatically + * loaded if not yet loaded. + */ + core_base_flag_drivers_needed = 1, + /** + * Operation needs a onnection to a WLAN AP. This flag is used + * to clear the operation queue from connection related operations + * after a connection has been closed. + */ + core_base_flag_connection_needed = 2, + /** + * Only one instance of the operation is allowed in the operation + * queue. + */ + core_base_flag_only_one_instance = 4, + /** + * The operation is a roam operation. + */ + core_base_flag_roam_operation = 8 + }; + + core_operation_base_c( + core_operation_type_e type, + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u32_t feature_flags ); + + virtual ~core_operation_base_c(); + + /** + * starts the operation + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e start_operation(); + + /** + * callback to previously made asynchronous request + * + * @since S60 v3.1 + * @param request_status Status of the completed request. + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e continue_operation( + core_error_e request_status ); + + /** + * cancels the operation + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel_operation(); + + /** + * User cancels the operation + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel_operation( + bool_t do_graceful_cancel ); + + /** + * returns the request_id related to this operation + * + * @since S60 v3.1 + * @return enum specifying operation type + */ + u32_t request_id() const; + + /** + * returns the operation type + * + * @since S60 v3.1 + * @return enum specifying operation type + */ + core_operation_type_e operation_type() const; + + /** + * whether operation is executing or not ("in queue") + * + * @since S60 v3.1 + * @return true or false + */ + bool_t is_executing() const; + + /** + * Check whether the operation has the given feature flags. + * + * @since S60 v3.1 + * @param u32_t The feature flags to check for. + * @return Whether the operation has the given feature flags. + */ + bool_t is_flags( + u32_t feature_flags ) const; + +protected: + + /** + * This method is called when a pending request has been completed + * and sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + virtual core_error_e next_state() = 0; + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + virtual core_error_e cancel(); + + /** + * This method is called when user want the operation to be canceled. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + virtual void user_cancel( + bool_t do_graceful_cancel ); + + /** + * Change to another state. + * + * @since S60 v3.1 + * @param state The new state. + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e goto_state( + u32_t state ); + + /** + * Start a sub-operation and advance to the next state if + * operation completes successfully. + * + * If the sub-operation fails, will initiate canceling. + * + * @since S60 v3.1 + * @param sub_operation The sub-operation to start. + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e run_sub_operation( + core_operation_base_c* sub_operation ); + + /** + * Start a sub-operation and advance to the next state if + * operation completes successfully. + * + * If the sub-operation fails, will initiate canceling. + * + * @since S60 v3.1 + * @param sub_operation The sub-operation to start. + * @param state The new state. + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e run_sub_operation( + core_operation_base_c* sub_operation, + u32_t state ); + + /** + * Change to another state asynchronously. + * + * @since S60 v3.1 + * @param state The new state. + * @param delay Delay before changing state in microseconds. + * @return Returns always core_error_request_pending. + */ + core_error_e asynch_goto( + u32_t state, + u32_t delay = CORE_TIMER_IMMEDIATELY ); + + /** + * The asynchronous version of the default user cancel handler. + * + * This method is meant for situations where the cancel cannot + * proceed because the operation is waiting for an event. + * + * @since S60 v3.2 + */ + void asynch_default_user_cancel(); + +protected: // data + + /** + * Request_id is used for identifying the initial caller. + */ + u32_t request_id_m; + + /** + * Pointer to the core_server instance. + * Not owned by this pointer. + */ + core_server_c* server_m; + + /** + * Pointer to low-level management functionality. + * Not owned by this pointer. + */ + abs_core_driverif_c* drivers_m; + + /** + * Pointer to the upper-level management functionality. + * Not owned by this pointer. + */ + abs_core_server_callback_c* adaptation_m; + + /** + * Has this operation been started or not. + */ + bool_t is_executing_m; + + /** + * Whether this operation is currently being canceled. + */ + bool_t is_canceling_m; + + /** + * Internal state of the operation. + */ + u32_t operation_state_m; + + /** + * The pending sub-operation. + */ + core_operation_base_c* sub_operation_m; + + /** + * Operation failure reason. + */ + core_error_e failure_reason_m; + +private: // data + + /** + * specifies the type of the operation (e.g. connect, scan, ...) + */ + core_operation_type_e operation_type_m; + + /** + * Defines the features of the operation. + */ + u32_t feature_flags_m; + + }; + +#endif // CORE_OPERATION_BASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_check_rcpi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_check_rcpi.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for requesting RCPI values for roaming. +* +*/ + + +#ifndef CORE_OPERATION_CHECK_RCPI_H +#define CORE_OPERATION_CHECK_RCPI_H + +#include "core_operation_base.h" + +/** + * Statemachine for requesting RCPI values for roaming. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_check_rcpi_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_rcpi_received, + core_state_scan_start, + core_state_scan_complete, + core_state_connect_success, + core_state_connect_failure, + core_state_rcpi_trigger, + core_state_MAX + }; + + /** + * Defines the possible reasons for running the RCPI check operation. + */ + enum core_rcpi_check_reason_e + { + /** The operation has been triggered by a polling timer. */ + core_rcpi_check_reason_timer, + /** The operation has been triggered by an RCPI trigger indication. */ + core_rcpi_check_reason_rcpi_trigger, + /** The operation has been triggered by a signal loss prediction indication. */ + core_rcpi_check_reason_signal_loss_prediction + }; + + core_operation_check_rcpi_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_rcpi_check_reason_e reason ); + + virtual ~core_operation_check_rcpi_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: // data + + /** + * The reason the operation was started. + */ + core_rcpi_check_reason_e reason_m; + + /** + * Current RCPI value. + */ + u32_t current_rcpi_m; + + /** + * Whether we are still connected to the AP after the roam attempt. + */ + bool_t is_connected_m; + + }; + +#endif // CORE_OPERATION_CHECK_RCPI_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_configure_multicast_group.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_configure_multicast_group.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for configuring multicast address to drivers +* +*/ + + +#ifndef CORE_OPERATION_CONFIGURE_MULTICAST_GROUP_H +#define CORE_OPERATION_CONFIGURE_MULTICAST_GROUP_H + +#include "core_operation_base.h" + +/** + * Statemachine for configuring multicast address to drivers. + * (driver sw performs multicast address filtering) + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_configure_multicast_group_c ) : + public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_configure_multicast_group, + core_state_MAX + }; + + core_operation_configure_multicast_group_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t join_group, + const core_mac_address_s& multicast_addr ); + + virtual ~core_operation_configure_multicast_group_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** whether adding or removing address */ + bool_t is_join_m; + + /** multicast mac address to add */ + const core_mac_address_s multicast_addr_m; + }; + +#endif // CORE_OPERATION_CONFIGURE_MULTICAST_GROUP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_connect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_connect.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connecting to a network +* +*/ + + +#ifndef CORE_OPERATION_CONNECT_H +#define CORE_OPERATION_CONNECT_H + +#include "core_operation_base.h" +#include "core_type_list.h" +#include "core_ap_data.h" + +class abs_core_timer_c; + +/** + * Statemachine for connecting to a network. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_connect_c ) : public core_operation_base_c + { + +public: + + /** The possible states of the state machine. */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_power_mode, + core_state_secondary_ssid_scan_start, + core_state_secondary_ssid_scan, + core_state_scan_start, + core_state_scan_complete, + core_state_connect_failure, + core_state_connect_secondary_ssid_failure, + core_state_connect_total_failure, + core_state_connect_disconnect, + core_state_connect_success, + core_state_set_rcpi_trigger, + core_state_MAX + }; + + /** + * Constructor. + * + * @since S60 v3.1 + * @param request_id to corresponding service request + * @param server core server + * @param drivers pointer to lower adaptation + * @param adaptation pointer to upper adaptation + * @param settings The settings used for establishing the connection. + * @param ssid_list List of possible secondary SSIDs. + * @param connect_status contains the error code of connection attempt + * on completion. + */ + core_operation_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_iap_data_s& settings, + core_type_list_c* ssid_list, + core_connect_status_e& connect_status ); + + /** + * Destructor. + */ + virtual ~core_operation_connect_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + + /** + * This method is called when user want the operation to be canceled. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + +private: // data + + /** + * The settings used for establishing the connection. + */ + const core_iap_data_s settings_m; + + /** Connect status that will be returned to adaptation */ + core_connect_status_e& connect_status_m; + + /** + * The number of times roaming has failed. + */ + u32_t failure_count_m; + + /** + * Whether we are still connected to an AP. + */ + bool_t is_connected_m; + + /** + * SSID to connect to. + */ + core_ssid_s ssid_m; + + /** + * List of secondary SSIDs. NULL if none. Not owned by this pointer. + */ + core_type_list_c* ssid_list_m; + + /** + * Reason the connection is released. + */ + core_release_reason_e release_reason_m; + + }; + +#endif // CORE_OPERATION_CONNECT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_create_ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_create_ts.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for creating a virtual traffic stream. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef CORE_OPERATION_CREATE_TS_H +#define CORE_OPERATION_CREATE_TS_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" +#include "core_virtual_traffic_stream.h" + +class core_traffic_stream_c; + +/** + * State machine for creating a virtual traffic stream. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_create_ts_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_delete_streams, + core_state_create_stream, + core_state_create_stream_success, + core_state_create_stream_failed, + core_state_parameters_set, + core_state_MAX + }; + + core_operation_create_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e& stream_status ); + + virtual ~core_operation_create_ts_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: + + /** + * Validate the given traffic stream parameters. + * + * @return true_t if the parameters are valid, false_t otherwise. + */ + bool_t is_valid_params(); + +private: // data + + /** + * Requested TID of the virtual traffic stream. + */ + u8_t requested_tid_m; + + /** + * Selected TID of the virtual traffic stream. + */ + u8_t tid_m; + + /** + * User priority of the virtual traffic stream. + */ + u8_t user_priority_m; + + /** + * Access class of the virtual traffic stream. + */ + core_access_class_e access_class_m; + + /** + * Whether the virtual traffic stream has been created automatically. + */ + bool_t is_automatic_stream_m; + + /** + * Requested parameters of the virtual traffic stream. + */ + core_traffic_stream_params_s requested_params_m; + + /** + * Parameters of the virtual traffic stream. + */ + core_traffic_stream_params_s params_m; + + /** + * ID of the virtual traffic stream. + */ + u32_t& stream_id_m; + + /** + * The current status of the virtual traffic stream. + */ + core_traffic_stream_status_e& stream_status_m; + + /** + * The traffic stream being created. + */ + core_traffic_stream_c* stream_m; + + }; + +#endif // CORE_OPERATION_CREATE_TS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_delete_ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_delete_ts.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for deleting a traffic stream. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef CORE_OPERATION_DELETE_TS_H +#define CORE_OPERATION_DELETE_TS_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" + +/** + * Statemachine for deleting a traffic stream. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_delete_ts_c ) : + public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_base_state_parameters_set, + core_state_MAX + }; + + core_operation_delete_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u32_t stream_id ); + + virtual ~core_operation_delete_ts_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** + * The ID of the traffic stream. + */ + u32_t id_m; + + }; + +#endif // CORE_OPERATION_DELETE_TS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_directed_roam.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_directed_roam.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for a directed roam request. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef CORE_OPERATION_DIRECTED_ROAM_H +#define CORE_OPERATION_DIRECTED_ROAM_H + +#include "core_operation_base.h" + +/** + * State machine for a directed roam request. + */ +NONSHARABLE_CLASS( core_operation_directed_roam_c ) : public core_operation_base_c + { + +public: + + /** + * The possible states of the state machine. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_scan_start, + core_state_scan_complete, + core_state_connect_success, + core_state_connect_failure, + core_state_rcpi_trigger, + core_state_MAX + }; + + /** + * Constructor. + * + * @param request_id An unique identification for the request. + * @param server Handle to core server. + * @param drivers Handle to low-level management functionality. + * @param adaptation Handle upper-level management functionality. + * @param bssid BSSID to roam to, BROADCAST_MAC_ADDR if any. + */ + core_operation_directed_roam_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_mac_address_s& bssid ); + + /** + * Destructor. + */ + virtual ~core_operation_directed_roam_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: // data + + /** + * BSSID to roam to, BROADCAST_MAC_ADDR if any. + */ + core_mac_address_s bssid_m; + + /** + * Current RCPI value. + */ + u32_t current_rcpi_m; + + /** + * Whether we are still connected to the AP after the roam attempt. + */ + bool_t is_connected_m; + + }; + +#endif // CORE_OPERATION_DIRECTED_ROAM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_available_iaps.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,287 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for IAP availability. +* +*/ + + +#ifndef CORE_OPERATION_GET_AVAILABLE_IAPS_H +#define CORE_OPERATION_GET_AVAILABLE_IAPS_H + +#include "genscanlist.h" +#include "core_operation_base.h" +#include "core_type_list.h" +#include "abs_core_frame_handler.h" +#include "core_ap_data.h" +#include "abs_core_event_handler.h" +#include "core_scan_channels.h" + +class core_server_c; + +/** + * State machine for IAP availability. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_get_available_iaps_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c, + public abs_core_event_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_long_broadcast_scan_start, + core_state_long_broadcast_scan_done, + core_state_broadcast_scan_start, + core_state_broadcast_scan_done, + core_state_broadcast_scan_start_unknown_region, + core_state_broadcast_scan_complete_unknown_region, + core_state_store_country_info, + core_state_broadcast_scan_done_handle_result, + core_state_direct_scan_start, + core_state_direct_scan_done, + core_state_secondary_ssid_check, + core_state_secondary_ssid_next, + core_state_secondary_ssid_start, + core_state_secondary_ssid_done, + core_state_scanning_done, + core_state_MAX + }; + + struct core_scan_list_entry + { + core_mac_address_s bssid; + core_ssid_s ssid; + }; + + /** + * Constructor. + * + * @since S60 v3.1 + * @param request_id to corresponding service request + * @param server core server + * @param drivers pointer to lower adaptation + * @param adaptation pointer to upper adaptation + * @param is_active_scan_allowed specifies whether to use probes or just listen to beacons + * @param iap_data_list contains list of IAP data structures + * @param iap_ssid_list List of possible secondary SSIDs + * @param list of available IAP IDs on return + * @param scan data of found networks on return + */ + core_operation_get_available_iaps_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t is_active_scan_allowed, + core_type_list_c& iap_data_list, + core_type_list_c& iap_id_list, + core_type_list_c* iap_ssid_list, + ScanList& scan_data ); + + /** + * Destructor. + */ + virtual ~core_operation_get_available_iaps_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + + /** + * From abs_core_event_handler_c Called by the core server when an indication has been received. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + * @return true_t if the indication was handled, false_t if not handled. + */ + bool_t notify( + core_am_indication_e indication ); + +private: // functions + + /** + * Remove IAPs that are not marked hidden from the list of IAPs to search. + */ + void remove_non_hidden_iaps(); + + /** + * Process the scan results using the given tag. + * + * @param tag Tag to use for iterating through the scan results. + */ + void process_scan_results( + u8_t tag ); + + /** + * Remove IAPs that match the given AP. + */ + void remove_matching_iaps( + core_ap_data_c& ap_data ); + + /** + * Calculate the amount IAPs marked as hidden from the given IAP list. + * + * @param iap_data_list List of IAPs to check + * @return The amount IAPs marked as hidden. + */ + u8_t hidden_iap_count( + core_type_list_c& iap_data_list ); + + /** + * If region information is not known before the scan, also the channels 12 and 13 can be + * scanned in passive mode. After the scan if region is still not known or region + * limits the allowed channels, this method removes the those APs from scan list that + * are not on valid channels. + */ + void remove_disallowed_aps(); + + /** + * Check whether the given IAP ID has any secondary SSIDs defined. + * + * @param id IAP ID to match. + * @return true_t if secondary SSIDs found, false_t otherwise. + */ + bool_t is_id_in_secondary_ssid_list( + u32_t id ); + + /** + * Remove all secondary SSID entries with a matching IAP ID. + * + * @param id IAP ID to match. + */ + void remove_secondary_ssid_entries_by_id( + u32_t id ); + + /** + * Check whether the given SSID is present in the scan results. + * + * @param ssid SSID to match. + * @param scan_data Scan list to search. + * @return true_t if matching SSID is found, false_t otherwise. + */ + bool_t is_ssid_in_scanlist( + const core_ssid_s& ssid, + const ScanList& scan_data ); + +private: // data + + /** + * Whether active scanning is allowed. + */ + bool_t is_active_scan_allowed_m; + + /** + * Whether the amount of channels scanned should be limited. + */ + bool_t is_limiting_algorithm_used_m; + + /** + * Original list of IAPs. + */ + core_type_list_c& iap_data_list_m; + + /** + * List for storing IDs of available IAPs. + */ + core_type_list_c& iap_id_list_m; + + /** + * List of possible secondary SSIDs. Not owned by this pointer. + */ + core_type_list_c* iap_ssid_list_m; + + /** + * Handle to the ScanList instance. + */ + ScanList& client_scan_data_m; + + /** + * List of channels that have WLAN activity. + */ + core_scan_channels_c active_channels_m; + + /** + * List of channels to scan in a broadcast scan. + */ + core_scan_channels_c broadcast_channels_m; + + /** + * Number of channels to scan with a long broadcast scan + */ + u8_t long_broadcast_count_m; + + /** + * List of IAPs that are not available. + */ + core_type_list_c non_found_iaps_list_m; + + /** + * Defines whether a split-scan should be used. + */ + bool_t is_split_scan_m; + + /** + * Defines the number of BSSs found during scanning. + */ + u8_t bss_count_m; + + /** + * SSID being direct scanned. + */ + core_ssid_s direct_scanned_ssid_m; + + /** + * Region information that is selected based on the APs country information. + */ + core_wlan_region_e region_from_ap_m; + + }; + +#endif // CORE_OPERATION_GET_AVAILABLE_IAPS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_rcpi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_rcpi.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for getting the RCPI value of the current connection +* +*/ + + +#ifndef CORE_OPERATION_GET_RCPI_H +#define CORE_OPERATION_GET_RCPI_H + +#include "core_operation_base.h" + +/** + * Statemachine for getting the RCPI value of the current connection + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_get_rcpi_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_rcpi, + core_state_MAX + }; + + core_operation_get_rcpi_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u32_t& rcpi ); + + virtual ~core_operation_get_rcpi_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** + * The result is stored here. + */ + u32_t& current_rcpi_m; + + }; + +#endif // CORE_OPERATION_GET_RCPI_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_statistics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_get_statistics.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for getting the packet statistics. +* +*/ + + +#ifndef CORE_OPERATION_GET_STATISTICS_H +#define CORE_OPERATION_GET_STATISTICS_H + +#include "core_operation_base.h" + +/** + * Statemachine for getting the packet statistics. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_get_statistics_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_packet_statistics, + core_state_MAX + }; + + core_operation_get_statistics_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_packet_statistics_s& statistics ); + + virtual ~core_operation_get_statistics_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** Packet statistics for the client are stored here. */ + core_packet_statistics_s& client_statistics_m; + + /** Packet statistics for the current connection. */ + core_packet_statistics_by_access_category_s current_statistics_m; + + }; + +#endif // CORE_OPERATION_GET_STATISTICS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_bss_lost.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_bss_lost.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling BSS lost notification from drivers. +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef CORE_OPERATION_HANDLE_BSS_LOST_H +#define CORE_OPERATION_HANDLE_BSS_LOST_H + +#include "core_operation_base.h" +#include "core_scan_channels.h" + +class abs_core_timer_c; + +/** + * Statemachine for handling BSS lost notification from drivers. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_handle_bss_lost_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_set_tx_level, + core_state_set_tx_level_success, + core_state_scan_start, + core_state_scan_complete, + core_state_connect_failure, + core_state_connect_total_failure, + core_state_connect_disconnect, + core_state_connect_success, + core_state_connect_set_rcpi_trigger, + core_state_MAX + }; + + /** + * Defines the possible reasons for running the BSS lost operation. + */ + enum core_bss_lost_reason_e + { + /** The operation has been triggered by a BSS lost indication. */ + core_bss_lost_reason_bss_lost, + /** The operation has been triggered by a media disconnect indication. */ + core_bss_lost_reason_media_disconnect, + /** The operation has been triggered by a failed RCPI roaming attempt. */ + core_bss_lost_reason_failed_rcpi_roam, + /** The operation has been triggered by a failed reauthentication. */ + core_bss_lost_reason_failed_reauthentication, + /** The operation has been triggered by a failed directed roam attempt. */ + core_bss_lost_reason_failed_directed_roam + }; + + core_operation_handle_bss_lost_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_bss_lost_reason_e reason, + u32_t reason_data = 0 ); + + virtual ~core_operation_handle_bss_lost_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + + /** + * This method is called when user want the operation to be canceled. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + +private: // data + + /** + * The reason the operation was started. + */ + core_bss_lost_reason_e reason_m; + + /** + * Optional data related to the reason_m. + */ + u32_t reason_data_m; + + /** + * The number of times roaming has failed due to no suitable AP found. + */ + u32_t failure_count_m; + + /** + * Whether we are still connected to an AP. + */ + bool_t is_connected_m; + + /** + * The channels used for scanning when roaming. + */ + core_scan_channels_c scan_channels_m; + + /** + * Whether the scan channels were already inverted. + */ + bool_t is_scan_channels_inverted_m; + + /** + * Reason the connection is released. + */ + core_release_reason_e release_reason_m; + + /** + * Number of times the current scan interval has been tried. + */ + u32_t scan_interval_count_m; + + /** + * The current scan interval value. + */ + u32_t scan_interval_m; + + /** + * Whether this scan is part of the scans done with + * partial channel masks. + */ + bool_t is_first_scan_m; + + }; + +#endif // CORE_OPERATION_HANDLE_BSS_LOST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_delete_ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_delete_ts.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling traffic stream deletion from network side. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef CORE_OPERATION_HANDLE_DELETE_TS_H +#define CORE_OPERATION_HANDLE_DELETE_TS_H + +#include "core_operation_base.h" + +/** + * Statemachine for handling traffic stream deletion from network side. + * + * @lib wlmserversrv.lib + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_operation_handle_delete_ts_c ) : public core_operation_base_c + { + +public: + + /** + * The possible states of the operation. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_base_state_parameters_set, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_handle_delete_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u8_t tid ); + + virtual ~core_operation_handle_delete_ts_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: + + /** + * Set the status of all virtual traffic streams with a matching TID + * and send a notification to clients. + * + * @param tid TID to match against. + * @param stream_status Stream status to set. + */ + void set_virtual_traffic_stream_inactive_by_tid( + u8_t tid, + core_traffic_stream_status_e stream_status ); + +private: // data + + /** + * The TID of the traffic stream. + */ + u8_t tid_m; + + }; + +#endif // CORE_OPERATION_HANDLE_DELETE_TS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_frame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_frame.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling a frame received from drivers +* +*/ + + +#ifndef CORE_OPERATION_HANDLE_FRAME_H +#define CORE_OPERATION_HANDLE_FRAME_H + +#include "core_operation_base.h" +#include "core_frame_dot11.h" + +/** + * Statemachine for handling a frame received from drivers + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_handle_frame_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_done, + core_state_MAX + }; + + core_operation_handle_frame_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_type_e frame_type, + u16_t data_length, + const u8_t* data ); + + virtual ~core_operation_handle_frame_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: + + // Prohibit copy constructor + core_operation_handle_frame_c( + const core_operation_handle_frame_c& ); + // Prohibit assigment operator + core_operation_handle_frame_c& operator=( + const core_operation_handle_frame_c& ); + +private: // data + + /** The type of the frame. */ + core_frame_type_e type_m; + + /** The frame length. */ + const u16_t data_length_m; + + /** Pointer to the frame data */ + u8_t* data_m; + + /** Pointer to the 802.11 frame */ + core_frame_dot11_c* frame_m; + + }; + +#endif // CORE_OPERATION_HANDLE_FRAME_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_measurement_request.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_measurement_request.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,359 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling received measurement request. +* +*/ + + +#ifndef CORE_OPERATION_HANDLE_MEASUREMENT_REQUEST_H +#define CORE_OPERATION_HANDLE_MEASUREMENT_REQUEST_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" +#include "abs_core_event_handler.h" +#include "core_type_list.h" +#include "core_frame_rm_ie.h" +#include "core_frame_rm_ie_beacon_request.h" +#include "core_frame_rm_ie_beacon_report.h" +#include "core_frame_mgmt_ie.h" + +// forward declarations +class core_frame_action_rm_c; +class core_frame_dot11_ie_c; +class core_frame_action_c; + +NONSHARABLE_CLASS( core_measurement_status_c ) + { +public: + + core_measurement_status_c() : + da_m ( ZERO_MAC_ADDR ), + sa_m ( ZERO_MAC_ADDR ), + error_in_request_m ( false_t ), + refuse_request_m ( false_t ), + too_short_interval_m ( false_t ) + {} + + ~core_measurement_status_c() + {} + +public: + inline const core_mac_address_s& da() const { return da_m; } + inline const core_mac_address_s& sa() const { return sa_m; } + inline bool_t error_in_request() const { return error_in_request_m; } + inline bool_t refuse_request() const { return refuse_request_m; } + inline bool_t too_short_interval() const { return too_short_interval_m; } + inline void set_error_in_request( bool_t state ){ error_in_request_m = state; } + inline void set_refuse_request( bool_t state ){ refuse_request_m = state; } + inline void set_too_short_interval( bool_t state ){ too_short_interval_m = state; } + inline void set_sa( core_mac_address_s sa ){ sa_m = sa; } + inline void set_da( core_mac_address_s da ){ da_m = da; } + inline core_scan_channels_s get_scan_channels() const { return channels_m; } + inline void set_scan_channels( core_scan_channels_s channels ){ channels_m = channels; } + +private: + core_mac_address_s da_m; + core_mac_address_s sa_m; + bool_t error_in_request_m; + bool_t refuse_request_m; + bool_t too_short_interval_m; + core_scan_channels_s channels_m; + }; + +/** + * Statemachine for handling received measurement request. + * + * @lib wlmserversrv.lib + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_operation_handle_measurement_request_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c, + public abs_core_event_handler_c + { + +public: + + /** + * The possible states of the operation. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_get_next_ie, + core_state_process_current_ie, + core_state_make_measurement, + core_state_create_response, + core_state_scan_start, + core_state_create_negative_response, + core_state_send_response, + core_state_operation_finished, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_handle_measurement_request_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_action_rm_c* measurement_request ); + + virtual ~core_operation_handle_measurement_request_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v5.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v5.2 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + + /** + * From abs_core_event_handler_c Called by the core server when an indication has been received. + * + * @since S60 v5.2 + * @param indication Adaptation layer event. + * @return true_t if the indication was handled, false_t if not handled. + */ + bool_t notify( + core_am_indication_e indication ); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v5.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + +private: + + /** + * This method parses the received measurement request IE and + * fills in the parameters of the measurement request structure. + * + * @since S60 v5.2 + * @param ie Reference to the received measurement IE + * @param parsed_mask Mask defining what information was parsed from the IE + */ + void parse( core_frame_dot11_ie_c* ie, u16_t& parsed_mask ); + + /** + * This method creates a negative response to received measurement request. + * + * @since S60 v5.2 + * @return true_t if response created, false_t otherwise + */ + bool_t create_negative_response(); + + /** + * This method creates a negative response to the received measurement request + * refusing to perform the requested measurement or creates an empty response + * to the received measurement request or creates an incapable response to a + * measurement request. + * + * @since S60 v5.2 + * @param measurement_report_mode Measurement report mode + * @return true_t if response created, false_t otherwise + */ + bool_t create_negative_response_based_on_meas_report_mode( u8_t measurement_report_mode ); + + /** + * This method creates a response to received invalid measurement request. + * + * @since S60 v5.2 + * @return true_t if response created, false_t otherwise + */ + bool_t create_response_to_invalid_request(); + + /** + * This method validates the received beacon request. + * + * @since S60 v5.2 + */ + void validate_measurement_request(); + + /** + * This method validates the received beacon request. + * + * @since S60 v5.2 + */ + void validate_beacon_request(); + + /** + * This method validates the Beacon Reporting Information IE. + * + * @since S60 v5.2 + */ + void validate_beacon_reporting_information(); + + /** + * This method validates the Beacon Reporting Detail IE. + * + * @since S60 v5.2 + */ + void validate_beacon_reporting_detail(); + + /** + * This method validates the interval that the measurement + * requests are coming is not too small. + * + * @since S60 v5.2 + * @return true_t if interval long enough, false_t otherwise + */ + bool_t validate_measurement_interval(); + + /** + * Add IE to Measurement Response, creates Measurement Response if + * it doesn't already exist. + * + * @since S60 v5.2 + * @param ie Reference to IE to be added to Measurement Response + * @return true_t if successful, false_t otherwise + */ + bool_t add_to_report( const core_frame_rm_ie_c* ie ); + + /** + * This method validates the requested scan channels. + * + * @since S60 v5.2 + * @return true_t if scan can be done, false_t otherwise + */ + bool_t validate_scan_channels(); + + /** + * Return channel time to use in scan. + * + * @since S60 v5.2 + * @return channel times to use in scan + * @param measurement_mode Request's Measurement Mode + */ + u16_t get_channel_time( core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_e measurement_mode ); + + /** + * Return SSID to use in scan. + * + * @since S60 v5.2 + * @return SSID to use in scan + */ + core_ssid_s get_ssid(); + + /** + * Return channels to use in scan. + * + * @since S60 v5.2 + * @return Channels to use in scan. + */ + core_scan_channels_c get_channels(); + + /** + * Check if Beacon/Probe matches to requested data. + * + * @since S60 v5.2 + * @return true_t if match, false_t otherwise + */ + bool_t match_found( core_ap_data_c& ap_data ); + + /** + * Create response frame to a measurement request. + * + * @since S60 v5.2 + * @return true_t if success, false_t otherwise + */ + bool_t create_response( + core_ap_data_c& ap_data ); + + /** + * Initialise internal data members for processing next beacon request IE. + * + * @since S60 v5.2 + */ + void initialise_beacon_request_data(); + + /** + * Get random delay utilising Randomization Interval. + * + * @since S60 v5.2 + * @return random delay + */ + u32_t get_random_delay(); + +private: // data + + /** The received Measurement Request frame. */ + core_frame_action_rm_c* measurement_request_m; + + /** List of IEs included in the received Measurement Request */ + core_type_list_c ie_list_m; + + /** Structure containing status data for the operation logic */ + core_measurement_status_c status_m; + + /** Bitmask about which IEs are successfully parsed. */ + u16_t parsed_mask_m; + + /** Reference to IE currently under processing. */ + core_frame_dot11_ie_c* current_ie_m; + + /** The Measurement Report frame to be sent. */ + core_frame_action_c* report_m; + + /** Parser for Measurement Request IE. */ + core_frame_rm_ie_c* meas_req_parser_m; + + /** Parser for Beacon Request IE. */ + core_frame_rm_ie_beacon_request_c* beacon_req_parser_m; + + /** Parser for SSID Sub-Element. */ + core_frame_mgmt_ie_ssid_c* ssid_parser_m; + + /** Parser for Beacon Reporting Information Sub-Element. */ + core_frame_rm_ie_beacon_request_ie_c* bri_parser_m; + + /** Parser for Beacon Reporting Detail Sub-Element. */ + core_frame_rm_ie_beacon_request_detail_ie_c* brd_parser_m; + + /** Parser for AP Channel Report Sub-Element. */ + core_frame_mgmt_ie_ap_channel_report_c* ap_ch_rep_parser_m; + + /** Parser for Request IE Sub-Element. */ + core_frame_mgmt_ie_request_ie_c* request_ie_parser_m; + + /** Measurement Duration used in the actual measurement. */ + u16_t actual_measurement_duration_m; + + }; + +#endif // CORE_OPERATION_HANDLE_MEASUREMENT_REQUEST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_neighbor_response.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_handle_neighbor_response.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling received neighbor response. +* +*/ + + +#ifndef CORE_OPERATION_HANDLE_NEIGHBOR_RESPONSE_H +#define CORE_OPERATION_HANDLE_NEIGHBOR_RESPONSE_H + +#include "core_operation_base.h" +#include "core_type_list.h" +#include "core_frame_nr_ie.h" +#include "core_frame_mgmt_ie.h" + +// forward declarations +class core_frame_action_nr_c; +class core_frame_dot11_ie_c; +class core_frame_action_c; + +/** + * Statemachine for handling received neighbor response. + * + * @lib wlmserversrv.lib + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( core_operation_handle_neighbor_response_c ) : public core_operation_base_c + { + +public: + + /** + * The possible states of the operation. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_ies_stored, + core_state_return_erroneous_frame, + core_state_get_next_ie, + core_state_process_current_ie, + core_state_operation_finished, + core_base_state_parameters_set, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_handle_neighbor_response_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_action_nr_c* neighbor_response ); + + /** + * Destructor. + */ + virtual ~core_operation_handle_neighbor_response_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v5.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: + + /** + * This method parses the received neighbor response IE. + * + * @since S60 v5.2 + * @param ie Reference to the received neighbor response IE + */ + void parse( core_frame_dot11_ie_c* ie ); + +private: // data + + /** + * The received Neighbor Response frame. + */ + core_frame_action_nr_c* neighbor_response_m; + + /** + * List of IEs included in the received Neighbor Response + */ + core_type_list_c ie_list_m; + + /** + * Reference to IE currently under processing. + */ + core_frame_dot11_ie_c* current_ie_m; + + /** Parser for Neighbor Response IE. */ + core_frame_nr_ie_c* neighbor_resp_parser_m; + + }; + +#endif // CORE_OPERATION_HANDLE_NEIGHBOR_RESPONSE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_ibss_merge.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_ibss_merge.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for merging existing IBSS (ad hoc) network to another one +* +*/ + + +#ifndef CORE_OPERATION_IBSS_MERGE_H +#define CORE_OPERATION_IBSS_MERGE_H + +#include "core_operation_base.h" + +class core_frame_dot11_c; + +/** + * Statemachine for merging existing IBSS (ad hoc) network to another one + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_ibss_merge_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_merge_done, + core_state_MAX + }; + + core_operation_ibss_merge_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_dot11_c* frame ); + + virtual ~core_operation_ibss_merge_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** The beacon frame length. */ + core_frame_dot11_c* frame_m; + + /** Whether we are still connected to the network. */ + bool_t is_connected_m; + + }; + +#endif // CORE_OPERATION_IBSS_MERGE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_null.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_null.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for null operation (does nothing) +* +*/ + + +#ifndef CORE_OPERATION_NULL_H +#define CORE_OPERATION_NULL_H + +#include "core_operation_base.h" + +/** + * Statemachine for a null operation. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_null_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_MAX + }; + + core_operation_null_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_error_e status ); + + virtual ~core_operation_null_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** + * The status for the completition. + */ + core_error_e status_m; + + }; + +#endif // CORE_OPERATION_NULL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_power_save_test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_power_save_test.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for running an echo test in power save. +* +*/ + + +#ifndef CORE_OPERATION_POWER_SAVE_TEST_H +#define CORE_OPERATION_POWER_SAVE_TEST_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" +#include "core_ap_data.h" + +/** + * Statemachine for running an echo test in power save. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_power_save_test_c ) : public core_operation_base_c + { + +public: + + /** The possible states of the operation. */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_set_power_mode_none, + core_state_set_power_mode_on, + core_state_reset_power_mode, + core_state_echo_test, + core_state_echo_test_complete, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_power_save_test_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * Destructor. + */ + virtual ~core_operation_power_save_test_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: // data + + /** + * The AP currently being tested. Not owned by this pointer. + */ + const core_ap_data_c* current_ap_m; + + /** + * Status of the operation. + * + * core_error_timeout if no response was received from the AP. + * core_error_ok if response was successfully received, + * an error otherwise. + */ + core_error_e return_status_m; + + /** + * Whether power save enabled during the echo test. + */ + bool_t is_power_save_m; + + /** + * Whether the Unicast test enabled. + */ + bool_t is_unicast_test_on_m; + + }; + +#endif // CORE_OPERATION_POWER_SAVE_TEST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_protected_setup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_protected_setup.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for Wi-Fi Protected setup +* +*/ + + +#ifndef CORE_OPERATION_PROTECTED_SETUP_H +#define CORE_OPERATION_PROTECTED_SETUP_H + +#include "core_operation_base.h" +#include "genscanlist.h" +#include "core_frame_dot11_ie.h" +#include "core_type_list.h" +#include "abs_core_protected_setup_handler.h" +#include "abs_core_timer.h" + +class core_server_c; +class core_ap_data_c; +class abs_core_scan_list_iterator_c; + +/** + * Statemachine for Wi-Fi Protected setup + * + * @lib wlmserversrv.lib + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_operation_protected_setup_c ) : + public core_operation_base_c, + public abs_core_protected_setup_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, // init + core_state_prepare_scanning, // initial actions before scanning + core_state_start_scanning, // scanning is started + core_state_scan, // analyse scanlist + core_state_connect_and_setup, // make connect and invoke EAPOL to start Protected Setup + core_state_setup_completed, // setup is done + core_state_disconnect, + core_state_disconnect_on_error, // this will return correct return value when EAPOL returns failure + core_state_disconnect_on_cancel, // this will return correct return value when user cancelled operation + core_state_disconnect_before_second_round_trip, + core_state_walktime_expiration, + core_state_user_cancel, // the operation has been cancelled from the outside + core_state_setup_failed, // EAPOL has returned a failure code + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_protected_setup_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_iap_data_s& iap_data, + core_type_list_c& iap_data_list, + core_protected_setup_status_e& protected_setup_status ); + + /** + * Destructor. + */ + virtual ~core_operation_protected_setup_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and no sub-operations are pending. + * + * @since S60 v3.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * Called by the timer framework when timer expires. + */ + static void timer_expired( void* this_ptr ); + + /** + * Called by the core server when a network has been configured via + * Protected Setup. + * + * @since S60 v3.2 + * @param iap_data Results of a successful Protected Setup operation. + */ + void handle_protected_setup_network( + const core_iap_data_s& iap_data ); + +private: + + /** + * This method is called to count selected registrars from scanlist + * + * @since S60 v3.2 + * @param iter Iterator used for going through scan list. + * @param copy_ap_data_always Whether ap_data should be copied even when + * selected_registrar is not found. + * @return number of selected registrars + */ + u32_t check_selected_registrars( + abs_core_scan_list_iterator_c * iter, + bool_t copy_ap_data_always ); + + /** + * Determine the status based on the given arguments. + * + * @param request_status The request completion status. + * @param management_status The association response status from the AP. + * @param protected_setup_status The status will be written here. + */ + core_error_e protected_setup_status( + core_error_e request_status, + core_management_status_e management_status, + core_protected_setup_status_e& protected_setup_status ) const; + + // Prohibit copy constructor + core_operation_protected_setup_c( + const core_operation_protected_setup_c& ); + // Prohibit assigment operator + core_operation_protected_setup_c& operator=( + const core_operation_protected_setup_c& ); + +private: // data + + /** IAP data. */ + core_iap_data_s core_iap_data_m; + + /** Storage for received credentials. */ + core_type_list_c& iap_data_list_m; + + /** Protected Setup status that will be returned to adaptation */ + core_protected_setup_status_e& protected_setup_status_m; + + /** ScanList instance. */ + ScanList* scan_data_m; + + /** Walk time timer. */ + abs_core_timer_c* walktime_timer_m; + + /** AP that will be used Protected Setup. Not owned by this pointer. */ + core_ap_data_c* selected_ap_data_m; + + /** Tag used for scan results. */ + u8_t tag_m; + + /** Channels that will be used for scanning. */ + core_scan_channels_s all_valid_scan_channels_m; + + /** The list of IEs that will be added to the association/resassociation request */ + core_type_list_c assoc_ie_list_m; + + /** Whether the connection attempt is a reassociation. */ + bool_t is_reassociation_m; + + /** Status of connection attempt. */ + core_management_status_e management_status_m; + + /** Whether we are still connected to an AP. */ + bool_t is_connected_m; + + /** Count how many times protected setup AP's are scanned. */ + u8_t wps_scan_count_m; + + /** Mark whether selected registrar flag was on. + * This will prevent two round-trips when flag is set already in first round-trip. + */ + bool_t is_selected_registrar_found_m; + + /** Mark whether pushbutton method is used. + * This information is used for selected_registrar counting. + */ + bool_t is_pushbutton_method_used_m; + +}; + +#endif // CORE_OPERATION_PROTECTED_SETUP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_release.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_release.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connection release +* +*/ + + +#ifndef CORE_OPERATION_RELEASE_H +#define CORE_OPERATION_RELEASE_H + +#include "core_operation_base.h" + +class core_server_c; + +/** + * Statemachine for releasing the connection + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_release_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_disable_user_data, + core_state_tx_power_level, + core_state_disconnect, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_release_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_release_reason_e reason ); + + /** + * Destructor. + */ + virtual ~core_operation_release_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when user want the operation to be canceled. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + +private: // data + + /** + * The reason the operation was started. + */ + core_release_reason_e reason_m; + + }; + +#endif // CORE_OPERATION_RELEASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_roam.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_roam.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for roaming +* +*/ + +/* +* %version: 26 % +*/ + +#ifndef CORE_OPERATION_ROAM_H +#define CORE_OPERATION_ROAM_H + +#include "core_operation_base.h" +#include "core_type_list.h" +#include "core_ap_data.h" +#include "core_frame_dot11_ie.h" + +class core_frame_assoc_resp_c; + +/** + * State machine for roaming between APs. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_roam_c ) : public core_operation_base_c + { + +public: + + /** + * Data structure for a roaming list entry. + */ + struct roaming_list_entry_s + { + core_ap_data_c* ap_data; + bool_t is_cached_sa_available; + }; + + /** + * The possible states of the state machine. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_disable_userdata_before_connect, + core_state_req_connect, + core_state_req_update_ts, + core_state_req_enable_userdata, + core_state_fail_connect, + core_state_fail_set_tx_power, + core_state_MAX + }; + + /** + * Constructor + * + * @param request_id An unique identification for the request. + * @param server Handle to core server. + * @param drivers Handle to low-level management functionality. + * @param adaptation Handle upper-level management functionality. + * @param is_connected Whether the terminal is currently connected to a BSS. + * @param tag Tag used for iterating scan results for a suitable AP. + * @param min_required_rcpi Minimum RCPI value required for connection. + * @param min_medium_time Minimum amount of free medium time required for connection. + * @param ssid SSID used for connection. + * @param bssid BSSID used for connection, BROADCAST_MAC_ADDR if any. + */ + core_operation_roam_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + u8_t tag, + u8_t min_required_rcpi, + const medium_time_s& min_medium_time, + const core_ssid_s& ssid, + const core_mac_address_s& bssid ); + + /** + * Destructor. + */ + virtual ~core_operation_roam_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: + + /** + * Check whether a cached security association is available for the given AP. + * + * @param ap_data Information about the AP. + * @return true_t if a security association exists, false_t otherwise. + */ + bool_t is_security_association_available( + const core_ap_data_c& ap_data ); + + /** + * Determine the connection status based on the status information. + * + * @param request_status The request completion status. + * @param management_status The association response status from the AP. + * @return The connection status based on the status information. + */ + core_connect_status_e connect_status( + core_error_e request_status, + core_management_status_e management_status ); + + /** + * Decide whether the connection failure is fatal and the AP should + * be blacklisted. + * + * @param request_status The request completion status. + * @param management_status The association response status from the AP. + * @param is_reassociation Whether the connection attempt was a reassociation. + * @return core_ap_blacklist_reason_none if no blacklisting required, + * the reason otherwise. + */ + core_ap_blacklist_reason_e is_fatal_failure( + core_error_e request_status, + core_management_status_e management_status, + bool_t is_reassociation ) const; + + /** + * Determine the connection status based on the EAP information. + * + * @param security_mode The used security mode. + * @param eap_type EAP type used + * @param eap_error EAP-specific error code. + * @return The connection status based on the EAP information. + */ + core_connect_status_e eap_connect_status( + core_security_mode_e security_mode, + u32_t eap_type, + u32_t eap_error ) const; + + /** + * Process the frame and add it to the roaming list if suitable for connecting. + * + * @param ap_data Information about the AP. + * @return true_t if the AP was added to the roaming list, false_t otherwise. + */ + bool_t process_frame( + core_ap_data_c& ap_data ); + + /** + * Update roam metrics based on the connection failure reason. + * + * @param request_status The request completion status. + * @param management_status The association response status from the AP. + */ + void update_roam_failure_count( + core_error_e request_status, + core_management_status_e management_status ); + + /** + * Create and send neighbor report request. + */ + void handle_neighbor_request(); + +private: // data + + /** Whether we are still connected to an AP. */ + bool_t& is_connected_m; + + /** The scan tag used for iterating suitable APs. */ + u8_t tag_m; + + /** The minimum RCPI value required. */ + u8_t min_required_rcpi_m; + + /** The minimum amount of free medium time required. */ + const medium_time_s min_medium_time_m; + + /** SSID to use for connection. */ + const core_ssid_s ssid_m; + + /** BSSID to use for connection. */ + const core_mac_address_s bssid_m; + + /** List of suitable APs. */ + core_type_list_c roaming_list_m; + + /** Status of connection attempt. */ + core_management_status_e management_status_m; + + /** Connect status for the current connection attempt. */ + core_connect_status_e connect_status_m; + + /** The AP currently tried. Not owned by this pointer. */ + core_ap_data_c* current_ap_m; + + /** BSSID currently connected to. */ + core_mac_address_s current_bssid_m; + + /** The list of IEs that will be added to the association/reassociation request */ + core_type_list_c assoc_ie_list_m; + + /** Whether the connection attempt uses a cached security association. */ + bool_t is_cached_sa_used_m; + + /** The (re-)association response frame is stored here if received. */ + core_frame_assoc_resp_c* assoc_resp_m; + + }; + +#endif // CORE_OPERATION_ROAM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_scan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_scan.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for scanning +* +*/ + + +#ifndef CORE_OPERATION_SCAN_H +#define CORE_OPERATION_SCAN_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" +#include "core_type_list.h" +#include "genscanlist.h" +#include "abs_core_event_handler.h" + +class core_server_c; + +/** + * Statemachine for loading the drivers + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_scan_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c, + public abs_core_event_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_scan_start, + core_state_scan_complete, + core_state_scan_start_unknown_region, + core_state_scan_complete_unknown_region, + core_state_scan_complete_store_country_info, + core_state_scan_complete_handle_result, + core_state_rcpi_received, + core_state_scanning_done, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_scan_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + u8_t scan_max_age, + ScanList& scan_data, + bool_t passive_scan_all_channels, + bool_t is_current_ap_added ); + + /** + * Destructor. + */ + virtual ~core_operation_scan_c(); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * From abs_core_event_handler_c Called by the core server when an indication has been received. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + * @return true_t if the indication was handled, false_t if not handled. + */ + bool_t notify( + core_am_indication_e indication ); + +private: + + /** + * If region information is not known before the scan, also the channels 12 and 13 can be + * scanned in passive mode. After the scan if region is still not known or region + * limits the allowed channels, this method removes the those APs from scan list that + * are not on valid channels. + * + * @since S60 v5.0 + */ + void remove_disallowed_aps(); + +private: // data + + /** + * The scanning mode. + */ + const core_scan_mode_e scan_mode_m; + + /** + * The SSID to be scanned. + */ + const core_ssid_s& scan_ssid_m; + + /** + * The channels to be scanned. + */ + const core_scan_channels_s& scan_channels_m; + + /** + * The maximum age of returned scan results. + */ + const u8_t scan_max_age_m; + + /** + * Handle to the ScanList instance. + */ + ScanList& scan_data_m; + + /** + * Whether all channels should be scanned in passive mode if region information (MCC) is not known. + */ + const bool_t passive_scan_all_channels_m; + + /** + * Region information that is selected based on the APs country information. + */ + core_wlan_region_e region_from_ap_m; + + /** + * Whether the current AP needs be added during an ongoing connection if not otherwise + * found in the scan. + */ + const bool_t is_current_ap_added_m; + + /** + * Current RCPI value. + */ + u32_t current_rcpi_m; + + }; + +#endif // CORE_OPERATION_SCAN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_set_arp_filter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_set_arp_filter.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for updating arp filter +* +*/ + + +#ifndef CORE_OPERATION_SET_ARP_FILTER_H +#define CORE_OPERATION_SET_ARP_FILTER_H + +#include "core_operation_base.h" + +/** + * Statemachine for updating the device ARP filter. + * + * @lib wlmserversrv.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( core_operation_set_arp_filter_c ) : public core_operation_base_c + { + +public: + + /** The possible states of the operation. */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_set_arp_filter, + core_state_MAX + }; + + /** + * Constructor. + * + * When the operation is instantiated, the ARP filter + * is passed as an argument. + */ + core_operation_set_arp_filter_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_arp_filter_s& filter ); + + /** + * Destructor. + */ + virtual ~core_operation_set_arp_filter_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v5.0 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** ARP filter is stored here. */ + const core_arp_filter_s arp_filter_m; + + }; + +#endif // CORE_OPERATION_SET_ARP_FILTER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_set_power_save_settings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_set_power_save_settings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for setting the power save settings. +* +*/ + + +#ifndef CORE_OPERATION_SET_POWER_SAVE_SETTINGS_H +#define CORE_OPERATION_SET_POWER_SAVE_SETTINGS_H + +#include "core_operation_base.h" + +/** + * Statemachine for setting the power save settings. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_set_power_save_settings_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_set_power_save_settings, + core_state_MAX + }; + + core_operation_set_power_save_settings_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_power_save_settings_s& settings ); + + virtual ~core_operation_set_power_save_settings_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** Power save settings are stored here. */ + const core_power_save_settings_s power_save_settings_m; + + }; + +#endif // CORE_OPERATION_SET_POWER_SAVE_SETTINGS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_set_uapsd_settings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_set_uapsd_settings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for setting U-APSD settings. +* +*/ + + +#ifndef CORE_OPERATION_SET_UAPSD_SETTINGS_H +#define CORE_OPERATION_SET_UAPSD_SETTINGS_H + +#include "core_operation_base.h" + +/** + * Statemachine for setting U-APSD settings. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_set_uapsd_settings_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_set_uapsd_settings, + core_state_MAX + }; + + core_operation_set_uapsd_settings_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_uapsd_settings_s& settings ); + + virtual ~core_operation_set_uapsd_settings_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** U-APSD settings are stored here. */ + const core_uapsd_settings_s uapsd_settings_m; + + }; + +#endif // CORE_OPERATION_SET_UAPSD_SETTINGS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_unload_drivers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_unload_drivers.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for unloading the drivers +* +*/ + + +#ifndef CORE_OPERATION_UNLOAD_DRIVERS_H +#define CORE_OPERATION_UNLOAD_DRIVERS_H + +#include "core_operation_base.h" + +const u32_t DELAY_FOR_AGENT = 100000; // 0,1 seconds + +class core_server_c; + +/** + * Statemachine for unloading the drivers + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_unload_drivers_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_notifying, + core_state_releasing, + core_state_unloading, + core_state_MAX + }; + + /** + * Constructor. + */ + core_operation_unload_drivers_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * Destructor. + */ + virtual ~core_operation_unload_drivers_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + }; + +#endif // CORE_OPERATION_UNLOAD_DRIVERS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_device_settings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_device_settings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating device settings +* +*/ + + +#ifndef CORE_OPERATION_UPDATE_DEVICE_SETTINGS_H +#define CORE_OPERATION_UPDATE_DEVICE_SETTINGS_H + +#include "core_operation_base.h" + +/** + * Statemachine for updating device settings + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_update_device_settings_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_set_power_mode, + core_state_MAX + }; + + core_operation_update_device_settings_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + virtual ~core_operation_update_device_settings_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + }; + +#endif // CORE_OPERATION_UPDATE_DEVICE_SETTINGS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_power_mode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_power_mode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating power mode +* +*/ + + +#ifndef CORE_OPERATION_UPDATE_POWER_MODE_H +#define CORE_OPERATION_UPDATE_POWER_MODE_H + +#include "core_operation_base.h" + +/** + * Statemachine for updating the device IP address. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_update_power_mode_c ) : public core_operation_base_c + { + +public: + + /** The possible states of the operation. */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_set_power_mode, + core_state_MAX + }; + + /** + * Constructor. + * + * When the operation is instantiated through this constructor, the power save mode + * is determined from core_settings_c parameters. + */ + core_operation_update_power_mode_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * Constructor. + * + * When the operation is instantiated through this constructor, the power save mode + * is passed as an argument. + */ + core_operation_update_power_mode_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_power_save_mode_s& mode ); + + /** + * Destructor. + */ + virtual ~core_operation_update_power_mode_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: + + /** + * Determine the power mode to be used. + * + * @since S60 v3.2 + * @return The power save mode to be used. + */ + core_power_mode_s determine_power_mode() const; + +private: // data + + /** The power save mode to be used. */ + core_power_save_mode_s preferred_mode_m; + + /** The power mode to be set. */ + core_power_mode_s power_mode_m; + + }; + +#endif // CORE_OPERATION_UPDATE_POWER_MODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_rxtx_parameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_rxtx_parameters.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating power mode +* +*/ + + +#ifndef CORE_OPERATION_UPDATE_RXTX_PARAMETERS_H +#define CORE_OPERATION_UPDATE_RXTX_PARAMETERS_H + +#include "core_operation_base.h" + +/** + * Statemachine for updating the device IP address. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_operation_update_rxtx_parameters_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_set_bss_lost_parameters, + core_state_req_set_tx_rate_policies, + core_state_MAX + }; + + core_operation_update_rxtx_parameters_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + virtual ~core_operation_update_rxtx_parameters_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + }; + +#endif // CORE_OPERATION_UPDATE_RXTX_PARAMETERS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_tx_rate_policies.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_operation_update_tx_rate_policies.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for creating a traffic stream. +* +*/ + + +#ifndef CORE_OPERATION_UPDATE_TX_RATE_POLICIES_H +#define CORE_OPERATION_UPDATE_TX_RATE_POLICIES_H + +#include "core_operation_base.h" +#include "core_ap_data.h" + +/** + * Statemachine for updating the currently active TX rate policies. + * + * @lib wlmserversrv.lib + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_operation_update_tx_rate_policies_c ) : + public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_success, + core_state_MAX + }; + + enum core_ap_type_e + { + core_ap_type_802p11b_only, + core_ap_type_802p11g_only, + core_ap_type_802p11bg + }; + + /** + * Constructor. + */ + core_operation_update_tx_rate_policies_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_ap_data_c& ap_data ); + + /** + * Constructor. + */ + core_operation_update_tx_rate_policies_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * Destructor. + */ + virtual ~core_operation_update_tx_rate_policies_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** The AP to be parsed for supported rates. Not owned by this pointer. */ + core_ap_data_c* current_ap_m; + + }; + +#endif // CORE_OPERATION_UPDATE_TX_RATE_POLICIES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_roam_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_roam_metrics.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,244 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing roaming metrics. +* +*/ + + +#ifndef CORE_ROAM_METRICS_H +#define CORE_ROAM_METRICS_H + +#include "core_types.h" + +/** + * Class for storing traffic stream parameters. + * + * @lib wlmserversrv.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_roam_metrics_c ) + { + +public: + + /** + * Constructor. + */ + core_roam_metrics_c(); + + /** + * Destructor. + */ + ~core_roam_metrics_c(); + + /** + * Set all the metrics to initial values. + * + * @since S60 v3.2 + */ + void clear_metrics(); + + /** + * Return the timestamp when user data was disabled. + */ + u64_t roam_ts_userdata_disabled() const; + + /** + * Update the timestamp when user data was disabled. + * + * @since S60 v3.2 + */ + void set_roam_ts_userdata_disabled(); + + /** + * Return the timestamp when user data was enabled. + */ + u64_t roam_ts_userdata_enabled() const; + + /** + * Update the timestamp when user data was enabled. + * + * @since S60 v3.2 + */ + void set_roam_ts_userdata_enabled(); + + /** + * Return the timestamp when connect request to drivers was issued. + */ + u64_t roam_ts_connect_started() const; + + /** + * Update the timestamp when connect request to drivers was issued. + * + * @since S60 v3.2 + */ + void set_roam_ts_connect_started(); + + /** + * Return the timestamp when connect request to drivers was completed. + */ + u64_t roam_ts_connect_completed() const; + + /** + * Update the timestamp when connect request to drivers was completed. + * + * @since S60 v3.2 + */ + void set_roam_ts_connect_completed(); + + /** + * Get the amount of microseconds user data was disabled during last roam. + * + * @since S60 v3.2 + * @return The amount of microseconds user data was disabled during last roam. + */ + u32_t roam_total_delay() const; + + /** + * Get the amount of microseconds taken to connect the network. + * + * @since S60 v3.2 + * @return The amount of microseconds taken to connect the network. + */ + u32_t roam_connect_delay() const; + + /** + * Get the total number of successful roams. + * + * @since S60 v3.2 + * @return The total number of successful roams. + */ + u16_t roam_success_count() const; + + /** + * Increase the total number of successful roams. + * + * @since S60 v3.2 + * @param count Parameter to be set. + */ + void inc_roam_success_count(); + + /** + * Get the amount of roam attempts. + * + * @since S60 v3.2 + * @param reason Type of count to return. + * @return The amount of roam attempts. + */ + u16_t roam_attempt_count( + core_roam_reason_e reason ) const; + + /** + * Increase the amount of roam attempts. + * + * @since S60 v3.2 + * @param reason Type of count to increase. + */ + void inc_roam_attempt_count( + core_roam_reason_e reason ); + + /** + * Return the amount of failed roam attempts. + * + * @since S60 v3.2 + * @param reason Type of count to return. + * @return The amount of failed roam attempts. + */ + u16_t roam_attempt_failed_count( + core_roam_failed_reason_e reason ) const; + + /** + * Increase the amount of roam failed attempts. + * + * @since S60 v3.2 + * @param reason Type of count to increase. + */ + void inc_roam_attempt_failed_count( + core_roam_failed_reason_e reason ); + + /** + * Get the reason for the last roam. + * + * @since S60 v3.2 + * @return The reason for the last roam. + */ + core_roam_reason_e last_roam_reason() const; + + /** + * Set the reason for the last roam. + * + * @since S60 v3.2 + * @param reason The reason for the last roam. + */ + void set_last_roam_reason( + core_roam_reason_e reason ); + + /** + * Get the reason for the last roam failure. + * + * @since S60 v3.2 + * @return The reason for the last roam failure. + */ + core_roam_failed_reason_e last_roam_failed_reason() const; + + /** + * Set the reason for the last roam failure. + * + * @since S60 v3.2 + * @param reason The reason for the last roam failure. + */ + void set_last_roam_failed_reason( + core_roam_failed_reason_e reason ); + + /** + * Trace the current roam metrics. + * + * @since S60 v3.2 + */ + void trace_current_roam_metrics() const; + +private: + + /** + * Assignment operator. + */ + core_roam_metrics_c& operator=( + const core_roam_metrics_c& src ); + +private: // data + + /** The timestamp when userdata was disabled. */ + u64_t roam_ts_userdata_disabled_m; + + /** The timestamp when userdata was enabled. */ + u64_t roam_ts_userdata_enabled_m; + + /** The timestamp when connect request to drivers was issued. */ + u64_t roam_ts_connect_start_m; + + /** The timestamp when connect request to drivers was completed. */ + u64_t roam_ts_connect_completed_m; + + /** The total number of successful roams. */ + u16_t roam_success_count_m; + + /** The amount of roam attempts. */ + u16_t roam_attempt_count_m[core_roam_reason_max]; + + /** The amount of failed roam attempts. */ + u16_t roam_attempt_failed_count_m[core_roam_failed_reason_max]; + + }; + +#endif // CORE_ROAM_METRICS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_scan_channels.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_scan_channels.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for manipulating scan channels masks. +* +*/ + + +#ifndef CORE_SCAN_CHANNELS_H +#define CORE_SCAN_CHANNELS_H + +#include "core_types.h" + +/** + * This class implements a storage for channel masks. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_scan_channels_c ) + { + +public: + + /** + * Constructor. + */ + core_scan_channels_c(); + + /** + * Constructor. + */ + core_scan_channels_c( + const core_scan_channels_s& channels ); + + /** + * Constructor. + */ + core_scan_channels_c( + const core_scan_channels_c& channels ); + + /** + * Destructor. + */ + virtual ~core_scan_channels_c(); + + /** + * Return the current channel mask as a struct. + * + * @since S60 v3.2 + * @return The current channel mask as a struct. + */ + const core_scan_channels_s& channels(); + + /** + * Set the current channel mask to the given mask. + * + * @since S60 v3.2 + * @param channels The channel mask to set. + */ + void set( + const core_scan_channels_s& channels ); + + /** + * Set the current channel mask to the given mask. + * + * @since S60 v3.2 + * @param channels The channel mask to set. + */ + void set( + const core_scan_channels_c& channels ); + + /** + * Merge the current channel mask with the given mask. + * + * @since S60 v3.2 + * @param channels The channel mask to merge. + */ + void merge( + const core_scan_channels_c& channels ); + + /** + * Add the given channel to the channel mask. + * + * @since S60 v3.2 + * @param band Band of the scan channel. + * @param channel Channel to add. + */ + void add( + u8_t band, + u8_t channel ); + + /** + * Inverts the current channel mask. + */ + void invert_channels(); + + /** + * Remove the given channel from the channel mask. + * + * @since S60 v5.0 + * @param band Band of the scan channel. + * @param channel Channel to remove. + */ + void remove( + u8_t band, + u8_t channel ); + + /** + * Check whether the channel mask on the given band is empty. + * + * @since S60 v3.2 + * @param band Band of the scan channel. + * @return true_t if the mask is empty, false_t otherwise. + */ + bool_t is_empty( + u8_t band ); + +private: // data + + /** + * The current channels for 2.4GHz range. + */ + u16_t channels2dot4ghz_m; + + /** + * The current channel mask. + */ + core_scan_channels_s channel_mask_m; + + }; + +#endif // CORE_SCAN_CHANNELS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_scan_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_scan_list.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing beacons/probe responses. +* +*/ + + +#ifndef CORE_SCAN_LIST_H +#define CORE_SCAN_LIST_H + +#include "core_type_list.h" +#include "core_ap_data.h" +#include "core_scan_channels.h" +#include "core_scan_list_iterator.h" +#include "core_frame_beacon.h" + +/** + * This is a storage class for received beacons/probe responses. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_scan_list_c ) + { + + friend class core_scan_list_iterator_by_tag_c; + friend class core_scan_list_iterator_by_age_c; + friend class core_scan_list_iterator_by_tag_and_ssid_c; + +public: + + /** + * Structure for storing beacon/probe response entries. + */ + struct core_scan_list_entry_s + { + /** Data of the AP. */ + core_ap_data_c* ap_data; + + /** Timestamp of the entry. */ + u64_t timestamp; + + /** Tags of the entry. */ + u8_t tags; + }; + + /** + * Constructor. + * + * @since S60 v3.1 + * @param iap_data containing structure of IAP data + */ + core_scan_list_c(); + + /** + * Destructor. + */ + virtual ~core_scan_list_c(); + + /** + * Return the amount of entries in the list. + * + * @since S60 v3.1 + * @return The amount of entries in the list. + */ + u32_t count() const; + + /** + * Append an entry to the list. + * + * @since S60 v3.1 + * @param ap_data AP data to be added. If an entry already exists, it is replaced. + * @return core_error_ok if success, an error code otherwise. + * @note The timestamp is refreshed on all entries that match the BSSID of the AP. + */ + core_error_e update_entry( + core_ap_data_c& ap_data ); + + /** + * Remove all entries that have a matching BSSID. + * + * @since S60 v3.1 + * @param bssid BSSID to match against. + */ + void remove_entries_by_bssid( + const core_mac_address_s& bssid ); + + /** + * Remove all entries that are older than the given age. + * + * @since S60 v3.2 + * @param age Age to match against (in microseconds). + */ + void remove_entries_by_age( + u32_t age ); + + /** + * Set a tag on all the entries. + * + * @since S60 v3.1 + * @param tag The tag to set. + */ + void set_tag( + u8_t tag ); + + /** + * Clear a tag from all the entries. + * + * @since S60 v3.1 + * @param tag The tag to clear. + */ + void clear_tag( + u8_t tag ); + + /** + * Clear all tags from the entries. + * + * @since S60 v3.1 + */ + void clear_all_tags(); + + /** + * Print the contents of the list. + */ + void print_contents(); + + /** + * Get a list of channels that have matching SSID. + * + * @since S60 v3.2 + * @param channels List of channels with matching SSID. + * @param ssid SSID to match against. + */ + void get_channels_by_ssid( + core_scan_channels_c& channels, + const core_ssid_s& ssid ); + +private: // data + + /** + * List of beacons/probe responses. + */ + core_type_list_c scan_list_m; + + }; + +#endif // CORE_SCAN_LIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_scan_list_iterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_scan_list_iterator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for different iterators for the scan list +* +*/ + + +#ifndef CORE_SCAN_LIST_ITERATOR_H +#define CORE_SCAN_LIST_ITERATOR_H + +#include "abs_core_scan_list_iterator.h" +#include "core_ap_data.h" + +class core_scan_list_c; + +/** + * This class iterates the scan list by not tagged items. + */ +NONSHARABLE_CLASS( core_scan_list_iterator_by_tag_c ) : public abs_core_scan_list_iterator_c + { + +public: + + /** + * Constructor + * + * @since S60 v3.1 + * @param scan_list Reference to the scan list instance. + * @param tag The suitable entiries must not contain this tag. + */ + core_scan_list_iterator_by_tag_c( + core_scan_list_c& scan_list, + u8_t tag ); + + /** + * Destructor. + */ + virtual ~core_scan_list_iterator_by_tag_c(); + + /** + * Return the first entry in the list that matches the iterator type. + * + * @since S60 v3.1 + * @return NULL if the list empty, pointer to the first entry otherwise. + * @note This method will reset the internal iterator. + */ + virtual core_ap_data_c* first(); + + /** + * Return the next entry in the list. + * + * @since S60 v3.1 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + virtual core_ap_data_c* next(); + + /** + * Return the current entry in the list. + * + * @since S60 v3.1 + * @return pointer to the current entry. + */ + virtual core_ap_data_c* current(); + +private: // data + + /** + * Handle to the scan list instance. + */ + core_scan_list_c& scan_list_m; + + /** + * The suitable entries must not contain this tag. + */ + u8_t tag_m; + + }; + +/** + * This class iterates the scan list by age. + */ +NONSHARABLE_CLASS( core_scan_list_iterator_by_age_c ) : public abs_core_scan_list_iterator_c + { + +public: + + /** + * Constructor + * + * @since S60 v3.1 + * @param scan_list Reference to the scan list instance. + * @param maximum_age The maximum age of suitable entries in seconds. + */ + core_scan_list_iterator_by_age_c( + core_scan_list_c& scan_list, + u32_t maximum_age ); + + /** + * Destructor. + */ + virtual ~core_scan_list_iterator_by_age_c(); + + /** + * Return the first entry in the list that matches the iterator type. + * + * @since S60 v3.1 + * @return NULL if the list empty, pointer to the first entry otherwise. + * @note This method will reset the internal iterator. + */ + virtual core_ap_data_c* first(); + + /** + * Return the next entry in the list. + * + * @since S60 v3.1 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + virtual core_ap_data_c* next(); + + /** + * Return the current entry in the list. + * + * @since S60 v3.1 + * @return pointer to the current entry. + */ + virtual core_ap_data_c* current(); + +private: // data + + /** + * Handle to the scan list instance. + */ + core_scan_list_c& scan_list_m; + + /** + * The maximum age of suitable entries in seconds. + */ + u32_t maximum_age_m; + + }; + +/** + * This class iterates the scan list by not tagged items and matching SSID. + */ +NONSHARABLE_CLASS( core_scan_list_iterator_by_tag_and_ssid_c ) : public core_scan_list_iterator_by_tag_c + { + +public: + + /** + * Constructor + * + * @since S60 v3.1 + * @param scan_list Reference to the scan list instance. + * @param tag The suitable entiries must not contain this tag. + * @param ssid SSID to match against entries. + */ + core_scan_list_iterator_by_tag_and_ssid_c( + core_scan_list_c& scan_list, + u8_t tag, + const core_ssid_s& ssid ); + + /** + * Destructor. + */ + virtual ~core_scan_list_iterator_by_tag_and_ssid_c(); + + /** + * Return the first entry in the list that matches the iterator type. + * + * @since S60 v3.1 + * @return NULL if the list empty, pointer to the first entry otherwise. + * @note This method will reset the internal iterator. + */ + virtual core_ap_data_c* first(); + + /** + * Return the next entry in the list. + * + * @since S60 v3.1 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + virtual core_ap_data_c* next(); + +private: // data + + /** + * SSID to match against entries. + */ + core_ssid_s ssid_m; + + }; + +/** + * This class iterates the scan list by not tagged items and matching SSID + * and BSSID. + */ +NONSHARABLE_CLASS( core_scan_list_iterator_by_tag_and_ssid_and_bssid_c ) : public core_scan_list_iterator_by_tag_and_ssid_c + { + +public: + + /** + * Constructor + * + * @since S60 v3.1 + * @param scan_list Reference to the scan list instance. + * @param tag The suitable entiries must not contain this tag. + * @param ssid SSID to match against entries. + * @param bssid BSSID to match against entries. + */ + core_scan_list_iterator_by_tag_and_ssid_and_bssid_c( + core_scan_list_c& scan_list, + u8_t tag, + const core_ssid_s& ssid, + const core_mac_address_s& bssid ); + + /** + * Destructor. + */ + virtual ~core_scan_list_iterator_by_tag_and_ssid_and_bssid_c(); + + /** + * Return the first entry in the list that matches the iterator type. + * + * @since S60 v3.1 + * @return NULL if the list empty, pointer to the first entry otherwise. + * @note This method will reset the internal iterator. + */ + virtual core_ap_data_c* first(); + + /** + * Return the next entry in the list. + * + * @since S60 v3.1 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + virtual core_ap_data_c* next(); + +private: // data + + /** + * BSSID to match against entries. + */ + core_mac_address_s bssid_m; + + }; + +#endif // CORE_SCAN_LIST_ITERATOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1044 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Main class for core server +* +*/ + +/* +* %version: 54 % +*/ + +#ifndef CORE_SERVER_H +#define CORE_SERVER_H + +#include "am_platform_libraries.h" +#include "abs_core_server.h" +#include "abs_core_server_callback.h" +#include "abs_core_driverif.h" +#include "abs_core_driverif_callback.h" +#include "core_operation_base.h" +#include "core_type_list.h" +#include "core_settings.h" +#include "core_connection_data.h" +#include "core_timer_counter_measures.h" +#include "core_scan_list.h" +#include "abs_core_wpx_adaptation.h" +#include "core_operation_handle_bss_lost.h" +#include "core_wlan_eapol_interface.h" + +class ScanList; +class abs_core_timer_c; +class abs_wlan_eapol_callback_interface_c; +class abs_core_frame_handler_c; +class abs_core_event_handler_c; +class abs_core_protected_setup_handler_c; +class core_eapol_handler_c; + +/** + * core server class for WLAN management functionality. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_server_c ) : + public abs_core_server_c, + public abs_core_driverif_callback_c + { + +public: + + /** + * Constructor. + * + * @param callback External service interface. + * @param drivers Driver interface + * @param settings Wlan Device Settings + * @param mac_address MAC address of the device. + * @param features Bitmask of enabled features. + */ + core_server_c( + abs_core_server_callback_c& callback, + abs_core_driverif_c& drivers, + const core_device_settings_s& settings, + const core_mac_address_s& mac_address, + u32_t features ); + + /** + * Destructor. + */ + virtual ~core_server_c(); + + /** + * Perform the necessary initialization procedures after construction. + * + * @since S60 v3.1 + * @return An error code if initialization fails, core_error_ok otherwise. + * @note This method MUST be called after the construction of this object. + */ + core_error_e init(); + + /** + * Get a reference to device settings. + * + * @since S60 v3.1 + * @return Reference to device settings. + */ + core_device_settings_s& get_device_settings(); + + /** + * Get a reference to core engine settings. + * + * @since S60 v3.1 + * @return Reference to core engine settings. + */ + core_settings_c& get_core_settings(); + + /** + * Get a reference to connection data. + * + * @since S60 v3.1 + * @return Pointer to connection data. + */ + core_connection_data_c* get_connection_data(); + + /** + * Get a reference to EAPOL instance. + * + * @since S60 v3.1 + * @return Reference to EAPOL instance. + */ + core_wlan_eapol_interface_c& get_eapol_instance(); + + /** + * Direct the callbacks from EAPOL to the given handler. + * + * @since S60 v3.1 + * @param New handler of EAPOL callbacks. + */ + void set_eapol_handler( + abs_wlan_eapol_callback_interface_c* handler ); + + /** + * Return the device MAC address. + * + * @since S60 v3.1 + * @return The device MAC address. + */ + core_mac_address_s& own_mac_addr(); + + /** + * Queue the given internal operation. This method should be used + * when queueing operations from inside other operations. + * + * @param operation Operation to be queued. + * @return core_error_ok if successfully queued, an error otherwise. + * @note Ownership of the operation instance is transferred immediately + * to this method. If there's an error, the instance is automatically + * deleted. + */ + core_error_e queue_int_operation( + core_operation_base_c* operation ); + + /** + * Queue the given internal operation and run the next operation if + * no operation is executing. + * + * @param operation Operation to be queued. + * @return core_error_ok if successfully queued, an error otherwise. + * @note Ownership of the operation instance is transferred immediately + * to this method. If there's an error, the instance is automatically + * deleted. + */ + core_error_e queue_int_operation_and_run_next( + core_operation_base_c* operation ); + + /** + * Check whether WPA counter measures are active. + * + * @since S60 v3.1 + * @return Whether WPA counter measures are active. + */ + bool_t is_cm_active(); + + /** + * Initialize the connection related data structures. + * @param iap_data The settings used for establishing the connection. + * @param device_settings Handle to device settings. + * @since S60 v3.1 + */ + core_error_e init_connection_data( + const core_iap_data_s& iap_data, + const core_device_settings_s& device_settings ); + + /** + * Cleans up connection related data structures from core engine + * @since S60 v3.1 + */ + void clear_connection_data(); + + /** + * Schedule roaming timer. + * + * @since S60 v3.1 + * @param delay Expiration time in micro seconds. + */ + void schedule_roam_timer( + u32_t delay ); + + /** + * Cancel the roaming timer. + * + * @since S60 v3.1 + */ + void cancel_roam_timer(); + + /** + * Schedule operation timer. + * + * @since S60 v3.1 + * @param delay Expiration time in micro seconds. + * @note This timer should never be used while running a sub-operation + * since it's possible the sub-operation will also try to the use + * the same timer. + */ + void schedule_operation_timer( + u32_t delay ); + + /** + * Cancel the operation timer. + * + * @since S60 v3.1 + */ + void cancel_operation_timer(); + + /** + * Check whether DHCP timer is active. + * + * @since S60 v5.0 + * @return true_t if timer is active, false_t otherwise. + */ + bool_t is_dhcp_timer_active(); + + /** + * Schedule the DHCP timer. + * + * @since S60 v3.1 + * @param delay Expiration time in micro seconds. + */ + void schedule_dhcp_timer( + u32_t delay ); + + /** + * Cancel the DHCP timer. + * + * @since S60 v3.1 + */ + void cancel_dhcp_timer(); + + /** + * Schedule the driver unload timer. + * + * @since S60 v3.1 + * @param delay Expiration time in micro seconds. + */ + void schedule_unload_timer( + u32_t delay ); + + /** + * Cancel the driver unload timer. + * + * @since S60 v3.1 + */ + void cancel_unload_timer(); + + /** + * Check whether an operation with the given flags is in queue. + * + * @param feature_flags Feature flags to check for. + * @return Whether an operation with the given flags is in queue. + */ + bool_t is_operation_in_queue_with_flags( + u32_t feature_flags ); + + /** + * Check whether an operation of the given type is in queue. + * + * @param type Type of the operation to search for. + * @return Whether an operation of the given type is in queue. + */ + bool_t is_operation_in_queue_with_type( + u32_t type ); + + /** + * Cancels all the operations in the queue that have + * the given feature flags enabled. Does not touch + * the currently executing operation. + * + * @since S60 v3.1 + * @param feature_flags Feature flags to check for. + */ + void cancel_operations_with_flags( + u32_t feature_flags ); + + /** + * Cancels all the operations of the given type in the queue. + * Does not touch the currently executing operation. + * + * @since S60 v3.2 + * @param type Operation type to check for. + */ + void cancel_operations_with_type( + u32_t type ); + + /** + * Cancels all the operations in the queue including + * the currently executing operation. + * + * @since S60 v3.2 + * @param is_graceful_cancel Whether cancel should be graceful or forced. + */ + void cancel_all_operations( + bool_t is_graceful_cancel ); + + /** + * Creates an instance of EAPOL if needed. + * + * @since S60 v3.1 + * @param mode Operating mode to use. + * @return true_t if an instance is successfully created or it already exists, false_t otherwise. + */ + bool_t create_eapol_instance( + core_eapol_operating_mode_e mode ); + + /** + * Return the current frame handler. + * + * @since S60 v3.2 + * @return Pointer to the current frame handler. + */ + abs_core_frame_handler_c* frame_handler(); + + /** + * Register a handler for received frames. + * + * @since S60 v5.0 + * @param handler Pointer to the new handler. + */ + void register_frame_handler( + abs_core_frame_handler_c* handler ); + + /** + * Unregister a handler for received frames. + * + * @since S60 v5.0 + * @param handler Pointer to the registered handler. + */ + void unregister_frame_handler( + abs_core_frame_handler_c* handler ); + + /** + * Return a reference to the scan list. + * + * @since S60 v3.1 + * @return A reference to the scan list. + */ + core_scan_list_c& get_scan_list(); + + /** + * Return the current event handler. + * + * @since S60 v3.2 + * @return Pointer to the current event handler. + */ + abs_core_event_handler_c* event_handler(); + + /** + * Register a handler for received indications. + * + * @since S60 v5.0 + * @param handler Pointer to the new handler. + */ + void register_event_handler( + abs_core_event_handler_c* handler ); + + /** + * Unregister a handler for received indications. + * + * @since S60 v5.0 + * @param handler Pointer to the registered handler. + */ + void unregister_event_handler( + abs_core_event_handler_c* handler ); + + /** + * Forces the engine to roam to any available AP. + * + * @since S60 v3.1 + * @param reason Reason to roam. + */ + void schedule_roam( + core_operation_handle_bss_lost_c::core_bss_lost_reason_e reason ); + + /** + * Send a management frame. + * + * @since S60 v3.2 + * @param frame_type The type of the frame to send. + * @param frame_length The length of the frame. + * @param frame_data Pointer to the frame data. + * @param destination Destination MAC address. + * @return true_t if frame was successfully sent, false_t otherwise. + */ + bool_t send_management_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + const core_mac_address_s& destination ); + + /** + * Send a data frame. + * + * @since S60 v3.2 + * @param ap_data AP data is being sent to. + * @param frame_type The type of the frame to send. + * @param frame_length The length of the frame. + * @param frame_data Pointer to the frame data. + * @param frame_priority Desired priority of the frame. + * @param destination Destination MAC address. + * @param send_unencrypted Whether the frame must be sent unencrypted. + * @return true_t if frame was successfully sent, false_t otherwise. + */ + bool_t send_data_frame( + const core_ap_data_c& ap_data, + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + core_access_class_e frame_priority, + const core_mac_address_s& destination, + bool_t send_unencrypted = false_t ); + + /** + * Get a reference to WPX adaptation instance. + * + * @since S60 v3.1 + * @return Reference to WPX adaptation instance. + */ + abs_core_wpx_adaptation_c& get_wpx_adaptation_instance(); + + /** + * Direct the Protected Setup events to the given handler. + * + * @since S60 v3.2 + * @param New handler of Protected Setup events. + */ + void set_protected_setup_handler( + abs_core_protected_setup_handler_c* handler ); + +public: // abs_core_server_c + + /** + * Connect to a network. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param settings The settings used for establishing the connection. + * @param connect_status contains the error code of connection attempt + * on completion + * @param ssid_list List of possible secondary SSIDs. + */ + void connect( + u32_t request_id, + const core_iap_data_s& settings, + core_connect_status_e& connect_status, + core_type_list_c* ssid_list = NULL ); + + /** + * Disconnect an active connection. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void release( + u32_t request_id ); + + /** + * Request available networks with the given SSID. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param scan_mode Defines whether active or passive scan is performed. + * @param scan_ssid Name of the network to scan for. + * @param scan_channels Channels to scan. + * @param scan_max_age Maximum age of returned scan results in seconds. + * @param scan_data Scan results are stored here. + * @param is_current_ap_added Whether the current AP needs to be added during an ongoing + * connection if not otherwise found in the scan. + * @note If the length of the SSID is zero, a broadcast scan is performed. + */ + void get_scan_result( + u32_t request_id, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + u8_t scan_max_age, + ScanList& scan_data, + bool_t is_current_ap_added = true_t ); + + /** + * Find which iaps from the given list are currently available. + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param is_active_scan_allowed specifies whether active scanning is allowed. + * @param iap_data_list containing list of iap data structures. + * @param iap_id_list list of iap ids are stored here on completion. + * @param iap_ssid_list List of possible secondary SSIDs. + * @param scan_data contains the scan results + */ + void get_available_iaps( + u32_t request_id, + bool_t is_active_scan_allowed, + core_type_list_c& iap_data_list, + core_type_list_c& iap_id_list, + core_type_list_c* iap_ssid_list, + ScanList& scan_data ); + + /** + * Get the current RCPI value of the connection. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param rcpi Current channel power indicator (RCPI). + */ + void get_current_rcpi( + u32_t request_id, + u32_t& rcpi ); + + /** + * Disable all WLAN activity. + * + * Disconnects the active connection and prevents any further + * WLAN activity until enable_wlan() is called. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void disable_wlan( + u32_t request_id ); + + /** + * Allow WLAN activity after disabled_wlan(). + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void enable_wlan( + u32_t request_id ); + + /** + * Schedule an immediate driver unload. + * + * @since S60 v3.1 + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e unload_drivers(); + + /** + * Get packet statistics of the current connection. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param statistics Packet statistics of the current connection. + */ + void get_packet_statistics( + u32_t request_id, + core_packet_statistics_s& statistics ); + + /** + * Request creation of a virtual traffic stream. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param tid TID of the virtual traffic stream. + * @param user_priority User Priority of the virtual traffic stream. + * @param is_automatic_stream Whether the virtual traffic stream + * has been created automatically. + * @param params Parameters of the virtual traffic stream. + * @param stream_id ID assigned to this virtual traffic stream on + * successful completion. + * @param stream_status Status of the virtual traffic stream on + * successful completion. + * @note If the TID has been defined as TRAFFIC_STREAM_ID_NONE, + * core server will select the next free ID. + */ + void create_traffic_stream( + u32_t request_id, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e& stream_status ); + + /** + * Request deletion of a virtual traffic stream. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param stream_id ID of the virtual traffic stream. + */ + void delete_traffic_stream( + u32_t request_id, + u32_t stream_id ); + + /** + * Start Protected Setup. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param iap_data IAP data used for running Protected Setup. + * @param iap_data_list IAP data results from a successful Protected Setup operation. + * @param protected_setup_status contains the error code of Protected Setup attempt + * on completion. + */ + void run_protected_setup( + u32_t request_id, + const core_iap_data_s& iap_data, + core_type_list_c& iap_data_list, + core_protected_setup_status_e& protected_setup_status ); + + /** + * Initiate a roam to the given BSSID. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param bssid BSSID to roam to. If BSSID is set to BROADCAST_MAC_ADDR, + * search for a better BSS is initiated. + * @note This method does not guarantee that the a roam to the given BSSID + * will occur. If the roam succeeds, the request will be completed + * with core_error_ok, otherwise with an error code. + */ + void directed_roam( + u32_t request_id, + const core_mac_address_s& bssid ); + + /** + * Get the BSSID of the access point currently connected to. + * + * @since S60 v3.1 + * @param bssid BSSID of the access point. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_current_bssid( + core_mac_address_s& bssid ); + + /** + * Get the name of the network (SSID) currently connected to. + * + * @since S60 v3.1 + * @param ssid Current SSID. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_current_ssid( + core_ssid_s& ssid ); + + /** + * Get the current security mode of the connection. + * + * @since S60 v3.1 + * @param mode Current security mode. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_current_security_mode( + core_connection_security_mode_e& mode ); + + /** + * Get the current connection state. + * + * @since S60 v3.1 + * @param state Current connection state. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_current_connection_state( + core_connection_state_e& state ); + + /** + * Inform core server about updated device settings. + * + * @since S60 v3.1 + * @param settings Updated device settings. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + core_error_e update_device_settings( + core_device_settings_s& settings ); + + /** + * Set the preferred power save mode. + * + * @since S60 v3.1 + * @param mode Preferred power save mode. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + core_error_e set_power_save_mode( + const core_power_save_mode_s& mode ); + + /** + * Add a BSSID to the rogue list. + * + * Prevents roaming to the given BSSID and hides it from + * the scan results. + * + * @since S60 v3.1 + * @param bssid BSSID to add to the list. + * @return core_error_ok if success, an error code otherwise. + * @note The list entry will be persistent, meaning it will not + * be cleared when the connection is closed. + */ + core_error_e add_bssid_to_rogue_list( + const core_mac_address_s& bssid ); + + /** + * Remove a BSSID from the rogue list. + * + * @since S60 v3.1 + * @param bssid BSSID to remove from the list. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e remove_bssid_from_rogue_list( + const core_mac_address_s& bssid ); + + /** + * Return a list of BSSIDs on the rogue list. + * + * @since S60 v3.2 + * @param rogue_list List of BSSIDs on the rogue list. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_rogue_list( + core_type_list_c& rogue_list ); + + /** + * Set the RCP level notification boundary. + * + * When the signal strength is getting worse (RCPI value is getting smaller), + * the core server will indicate core_notification_e::core_notification_rcp_changed + * when the RCPI value gets smaller than the the rcp_level_boundary value. + * + * When the signal strength is getting better, the core server will indicate + * core_notification_e::core_notification_rcp_changed when the RCPI value + * gets bigger than the combined value of rcp_level_boundary and hysteresis. + * + * @since S60 v3.1 + * @param rcp_level_boundary RCP level notification boundary. + * @param hysteresis Specifies the difference between boundaries when + * the RCP level is rising vs. descending + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e set_rcp_level_notification_boundary( + const i32_t rcp_level_boundary, + const i32_t hysteresis ); + + /** + * Clear packet statistics of the current connection. + * + * @since S60 v3.2 + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e clear_packet_statistics(); + + /** + * Get the current U-APSD settings. + * + * @since S60 v3.2 + * @param settings Current U-APSD settings. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_uapsd_settings( + core_uapsd_settings_s& settings ); + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param settings Current U-APSD settings to be set. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + core_error_e set_uapsd_settings( + const core_uapsd_settings_s& settings ); + + /** + * Get the current power save settings. + * + * @since S60 v3.2 + * @param settings Current power save settings. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_power_save_settings( + core_power_save_settings_s& settings ); + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param settings Current power save settings to be set. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new parameters + * are taken into use immediately. + */ + core_error_e set_power_save_settings( + const core_power_save_settings_s& settings ); + + /** + * Get information about the current AP. + * + * @since S60 v3.2 + * @param info Information about the current AP. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_current_ap_info( + core_ap_information_s& info ); + + /** + * Get roam metrics of the current connection. + * + * @since S60 v3.2 + * @param roam_metrics Roam metrics of the current connection. + */ + void get_roam_metrics( + core_roam_metrics_s& roam_metrics ); + + /** + * Set the arp filter. + * + * @since S60 v5.0 + * @param filter Current ARP filter to be set. + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new filter + * is taken into use immediately. + */ + core_error_e set_arp_filter( + const core_arp_filter_s& filter ); + + /** + * Delivers multicast MAC address to drivers. + * + * @since S60 v3.1 + * @param join_group is set true_t if adding a multicast address + * otherwise the address will be removed. + * @param multicast_addr contains the MAC address to add/remove + * @return core_error_ok if success, an error code otherwise. + * @note This method does not guarantee that the new address + * is taken into use immediately. + */ + core_error_e configure_multicast_group( + bool_t join_group, + const core_mac_address_s& multicast_addr ); + + /** + * Get information about current traffic statuses and traffic modes for + * access classes. + * + * @since S60 v3.2 + * @param info Information about the current traffic statuses and traffic modes. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e get_current_ac_traffic_info( + core_ac_traffic_information_s& info ); + + /** + * An asynchronous request from the core server has been completed. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param status Completion status of the request. + */ + void request_complete( + u32_t request_id, + core_error_e status ); + + /** + * Cancel a pending asynchronous request. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + */ + void cancel_request( + u32_t request_id ); + +public: // abs_core_driverif_callback_c + + /** + * Inform the core server about a new received frame. + * + * @since S60 v3.1 + * @param frame_type The type of the frame received. + * @param frame_length The length of the frame. + * @param frame_data Pointer to the frame data. + * @param frame_rcpi RCPI value of the frame. + */ + void receive_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + u8_t frame_rcpi ); + + /** + * Notify the core server about an adaptation layer event. + * + * @note received notification is never related to an existing operation, + * but it may lead to starting a new one. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + */ + void notify( + core_am_indication_e indication ); + +private: + + /** + * Called by the timer framework when timer expires. + * @param pointer to 'this' (note: the static method) + */ + static void queue_timer_expired( + void* this_ptr ); + + /** + * Called by the driver unload timer when it expires + * @param pointer to 'this' (note: the static method) + */ + static void unload_timer_expired( + void* this_ptr ); + + /** + * Called by the roaming timer when it expires + * @param pointer to 'this' (note: the static method) + */ + static void roam_timer_expired( + void* this_ptr ); + + /** + * Called by the operation timer when it expires + * @param pointer to 'this' (note: the static method) + */ + static void operation_timer_expired( + void* this_ptr ); + + /** + * Called by the DHCP timer when it expires + * + * @since S60 v3.1 + * @param pointer to 'this' (note: the static method) + */ + static void dhcp_timer_expired( + void* this_ptr ); + + /** + * Schedule the next operation to be run. If the queue is empty + * or there's already a running operation, do nothing. + */ + void schedule_operation(); + + /** + * Queue the given external operation and run the next operation if + * no operation is executing. + * + * @param operation Operation to be queued. + * @param request_id ID of the operation. + * @note Ownership of the operation instance is transferred immediately + * to this method. If there's an error, the instance is automatically + * deleted. + */ + void queue_ext_operation_and_run_next( + core_operation_base_c* operation, + u32_t request_id ); + + /** + * Notify EAPOL about a MIC failure. + * + * @param is_group_key_fail Is this a group or pairwise key failure. + */ + void mic_failure( + bool_t is_group_key_fail ); + + /** + * Queue an operation to unload the drivers. + */ + void queue_unload_drivers(); + +private: // data + + abs_core_server_callback_c& callback_m; + + abs_core_driverif_c& drivers_m; + + /** Device settings. */ + core_device_settings_s device_settings_m; + + /** Queue for operations to be performed. */ + core_type_list_c queue_m; + + /** Timer for running queue operations. */ + abs_core_timer_c* queue_timer_m; + + /** Timer for unloading drivers */ + abs_core_timer_c* driver_unload_timer_m; + + /** Core engine settings and statuses. */ + core_settings_c core_settings_m; + + /** Connection data */ + core_connection_data_c* connection_data_m; + + /** Device MAC address. */ + core_mac_address_s own_mac_addr_m; + + /** Handler to EAPOL callbacks. */ + core_eapol_handler_c* eapol_handler_m; + + /** EAPOL */ + core_wlan_eapol_interface_c* eapol_m; + + /** Timer for WPA TKIP counter measures. */ + core_timer_counter_measures_c cm_timer_m; + + /** Timer for romaing. */ + abs_core_timer_c* roam_timer_m; + + /** Timer for currently active operation's purposes */ + abs_core_timer_c* operation_timer_m; + + /** Timer for enabling power save after DHCP is done. */ + abs_core_timer_c* driver_dhcp_timer_m; + + /** Handler for received frames. Not owned by this pointer. */ + abs_core_frame_handler_c* frame_handler_m; + + /** Handler for received indications. Not owned by this pointer. */ + abs_core_event_handler_c* event_handler_m; + + /** Scan list for storing beacons/probe responses. */ + core_scan_list_c scan_list_m; + + /** WPX adaptation instance. */ + abs_core_wpx_adaptation_c* wpx_adaptation_m; + + }; + +#endif // CORE_SERVER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server_factory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server_factory.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Static factory class for instantiating a class +* implementing abs_core_server_c interface +* +*/ + + +#ifndef CORE_SERVER_FACTORY_H +#define CORE_SERVER_FACTORY_H + +#include "abs_core_server.h" +#include "abs_core_server_callback.h" +#include "abs_core_driverif.h" + +/** + * Factory for instantiating a class implementing abs_core_server_c interface. + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +class core_server_factory_c + { + +public: + + /** + * Factory method used for creating a class implementing + * abs_core_server_c interface. + * + * @since S60 v3.1 + * @param callback Reference to the class implementing abs_core_server_callback_c. + * @param drivers Reference to the class implementing abs_core_driverif_c. + * @param settings Initial settings for the WLAN service. + * @param mac_address MAC address of the device. + * @param features Bitmask of enabled features. + */ + static abs_core_server_c* instance( + abs_core_server_callback_c& callback, + abs_core_driverif_c& drivers, + core_device_settings_s& settings, + core_mac_address_s& mac_address, + u32_t features = core_feature_none ); + +private: + + /** + * Private constructor to prevent instantiation. + */ + core_server_factory_c(); + + }; + +#endif // CORE_SERVER_FACTORY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,549 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class encapsulating core engine settings and statuses. +* +*/ + + +#ifndef CORE_SETTINGS_H +#define CORE_SETTINGS_H + +#include "core_types.h" +#include "core_type_list.h" +#include "core_roam_metrics.h" + +/** + * Class encapsulating core engine settings and statuses. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_settings_c ) + { + +public: + + /** + * Constructor. + * + * @param features Bitmask of enabled features. + */ + core_settings_c( + u32_t features ); + + /** + * Destructor. + */ + virtual ~core_settings_c(); + + /** + * Check whether the WLAN drivers have been loaded. + * + * @since S60 v3.1 + * @return true_t if the WLAN drivers have been loaded, + * false_t otherwise. + */ + bool_t is_driver_loaded() const; + + /** + * Set the state of the WLAN drivers. + * + * @since S60 v3.1 + * @param is_driver_loaded true_t the WLAN drivers have been loaded, + * false_t otherwise. + */ + void set_driver_state( + bool_t is_driver_loaded ); + + /** + * Check whether WLAN is enabled or disabled. + * + * @since S60 v3.1 + * @return true_t if enabled, + * false_t otherwise. + */ + bool_t is_wlan_enabled() const; + + /** + * Set WLAN state enabled or disabled. + * + * @since S60 v3.1 + * @param is_wlan_enabled true_t if enabling WLAN, + * false_t otherwise. + */ + void set_wlan_enabled( + bool_t is_wlan_enabled ); + + /** + * Get the currently used power mode. + * + * @since S60 v3.1 + * @return Currently used power mode. + */ + const core_power_mode_s& power_mode() const; + + /** + * Set the currently used power mode. + * + * @since S60 v3.1 + * @param Currently used power mode. + */ + void set_power_mode( + const core_power_mode_s& mode ); + + /** + * Get the preferred power save mode. + * + * @since S60 v3.1 + * @return Preferred power save mode. + */ + const core_power_save_mode_s& preferred_power_save_mode() const; + + /** + * Set the preferred power save mode. + * + * @since S60 v3.1 + * @param Preferred power save mode. + */ + void set_preferred_power_save_mode( + const core_power_save_mode_s& mode ); + + /** + * Get current connection state. + * + * @since S60 v3.1 + * @return connection state. + */ + core_connection_state_e connection_state() const; + + /** + * Set current connection state. + * + * @since S60 v3.1 + * @param connection state. + */ + void set_connection_state( + core_connection_state_e state ); + + /** + * Returns true/false based on connection state information + * + * @since S60 v3.1 + * @return true or false + */ + bool_t is_connected() const; + + /** + * Check whether the permanent whitelist is empty. + * + * @since S60 v3.1 + * @return Whether the permanent whitelist is empty. + */ + bool_t is_permanent_whitelist_empty() const; + + /** + * Check whether the given MAC address is permanently whitelisted. + * + * @since S60 v3.1 + * @param mac MAC address to be checked. + * @return Whether the given MAC address is permanently whitelisted. + */ + bool_t is_mac_in_permanent_whitelist( + const core_mac_address_s& mac ); + + /** + * Check whether the given MAC address is permanently blacklisted. + * + * @since S60 v3.1 + * @param mac MAC address to be checked. + * @return Whether the given MAC address is permanently blacklisted. + */ + bool_t is_mac_in_permanent_blacklist( + const core_mac_address_s& mac ); + + /** + * Add a MAC address to the permanent whitelist. + * + * @since S60 v3.1 + * @param mac MAC address to be added. + */ + void add_mac_to_permanent_whitelist( + const core_mac_address_s& mac ); + + /** + * Remove a MAC address from the permanent whitelist. + * + * @since S60 v3.1 + * @param mac MAC address to be removed. + */ + void remove_mac_from_permanent_whitelist( + const core_mac_address_s& mac ); + + /** + * Add a MAC address to the permanent blacklist. + * + * @since S60 v3.1 + * @param mac MAC address to be added. + * @param reason Reason for the blacklist. + */ + void add_mac_to_permanent_blacklist( + const core_mac_address_s& mac, + core_ap_blacklist_reason_e reason ); + + /** + * Remove a MAC address from the permanent blacklist. + * + * @since S60 v3.1 + * @param mac MAC address to be removed. + */ + void remove_mac_from_permanent_blacklist( + const core_mac_address_s& mac ); + + /** + * Return the permanent blacklist. + * + * @since S60 v3.2 + * @return The permanent blacklist. + */ + core_type_list_c& permanent_blacklist(); + + /** + * Set RCPI notification boundaries + * + * @since S60 v3.1 + * @param rcp_decline_boundary Threshold for 'signal getting worse'. + * @param rcp_improve_boundary Threshold for 'signal getting better'. + */ + void set_rcpi_boundaries( + u32_t rcp_decline_boundary, + u32_t rcp_improve_boundary ); + + /** + * Get the RCPI threshold for 'signal getting worse' indication. + * + * @since S60 v3.1 + * @return The RCPI threshold for 'signal getting worse' indication. + */ + u32_t rcp_decline_boundary() const; + + /** + * Get the RCPI threshold for 'signal getting better' indication. + * + * @since S60 v3.1 + * @return The RCPI threshold for 'signal getting better' indication. + */ + u32_t rcp_improve_boundary() const; + + /** + * Get the currently used regional domain. + * + * @since S60 v3.1 + * @return The currently used regional domain. + */ + core_wlan_region_e regional_domain() const; + + /** + * Set the currently used regional domain. + * + * @since S60 v3.1 + * @param region The currently used regional domain. + */ + void set_regional_domain( + core_wlan_region_e region ); + + /** + * Get the information whether mobile country code is currently known. + * + * @since S60 v5.0 + * @return Whether or not the mobile country code is currently known. + */ + bool_t mcc_known() const; + + /** + * Set the information whether or not the mobile country code is currently known. + * + * @since S60 v5.0 + * @param mcc_known The information whether or not the mobile country code is currently known. + */ + void set_mcc_known( + bool_t mcc_known ); + + + /** + * Check whether the given channel is valid in the current regional domain. + * + * @since S60 v3.1 + * @param band The band the channel is in. + * @param channel The channel to check. + * @return Whether the given channel is valid in the current regional domain. + */ + bool_t is_valid_channel( + u8_t band, + u8_t channel ) const; + + /** + * Return a channel mask with all of the allowed channels in the current regional domain. + * + * @since S60 v3.1 + * @return All of the allowed channels in the current regional domain. + */ + core_scan_channels_s all_valid_scan_channels() const; + + /** + * Return a channel mask with invalid channels filtered out. + * + * @since S60 v3.1 + * @param channels Channel mask to be filtered. + * @return A channel mask with invalid channels filtered out. + */ + core_scan_channels_s valid_scan_channels( + const core_scan_channels_s& channels ); + + /** + * Return a channel mask with valid channels filtered out. + * + * @since S60 v5.0 + * @param channels Channel mask to be filtered. + * @return A channel mask with valid channels filtered out. + */ + core_scan_channels_s invalid_scan_channels( + const core_scan_channels_s& channels ); + + /** + * Return whether a BT connection has been established. + * + * @since S60 v3.1 + * @return Whether a BT connection has been established. + */ + bool_t is_bt_connection_established() const; + + /** + * Set whether a BT connection has been established. + * + * @since S60 v3.1 + * @param true_t if connection established, false_t otherwise. + */ + void set_bt_connection_established( + bool_t established ); + + /** + * Get packet statistics for the connection that is/was active. + * + * @since S60 v3.2 + * @return Packet statistics for the connection that is/was active. + */ + const core_packet_statistics_by_access_category_s& connection_statistics_by_access_category(); + + /** + * Get packet statistics for the connection that is/was active. + * + * @since S60 v3.2 + * @return Packet statistics for the connection that is/was active. + */ + core_packet_statistics_s connection_statistics(); + + /** + * Update packet statistics for the currently active connection. + * + * @since S60 v3.2 + * @param statistics Packet statistics for the currently active connection. + */ + void update_connection_statistics( + const core_packet_statistics_by_access_category_s& statistics ); + + /** + * Clear the packet statistics. + * + * @since S60 v3.2 + */ + void clear_connection_statistics(); + + /** + * Return the roam metrics for the currently active connection. + * + * @since S60 v3.2 + * @return The roam metrics for the currently active connection. + */ + core_roam_metrics_c& roam_metrics(); + + /** + * Get a list of channels that have APs with long beacon intervals. + * + * @since S60 v3.2 + * @return List of channels that have APs with long beacon intervals. + */ + core_long_beacon_interval_channels_s& long_beacon_interval_channels(); + + /** + * Get the U-APSD settings for access classes. + * + * @since S60 v3.2 + * @return The U-APSD settings. + */ + const core_uapsd_settings_s& uapsd_settings(); + + /** + * Check whether U-APSD is enable for the given access class + * + * @since S60 v3.2 + * @param access_class Access class to check. + * @return Whether U-APSD is enable for the given access class. + */ + bool_t is_uapsd_enable_for_access_class( + core_access_class_e access_class ); + + /** + * Set the U-APSD settings for access classes. + * + * @since S60 v3.2 + * @param settings The U-APSD settings to be stored. + */ + void set_uapsd_settings( + const core_uapsd_settings_s& settings ); + + /** + * Get the power save settings for access classes. + * + * @since S60 v3.2 + * @return The power save settings. + */ + const core_power_save_settings_s& power_save_settings(); + + /** + * Set the power save settings for access classes. + * + * @since S60 v3.2 + * @param settings The power save settings to be stored. + */ + void set_power_save_settings( + const core_power_save_settings_s& settings ); + + /** + * Get the block ACK usage information. + * + * @since S60 v5.1 + * @return The block ACK usage information. + */ + const core_block_ack_usage_s& block_ack_usage(); + + /** + * Set the block ACK usage per traffic stream. + * + * @since S60 v5.1 + * @param usage The block ACK usage information to be stored. + */ + void set_block_ack_usage( + const core_block_ack_usage_s& usage ); + + /** + * Add a IAP ID to the weaklist. + * + * @since S60 v5.2 + * @param iap_id IAP ID to be added. + */ + void add_iap_id_to_weak_iap_list(u32_t iap_id); + + /** + * Check whether the given IAP ID is weaklisted. + * + * @since S60 v5.2 + * @param iap_id IAP ID to be checked. + * @return Whether the given IAP ID is weaklisted. + */ + bool_t is_iap_id_in_weak_list( u32_t iap_id ); + + /** + * Remove a IAP ID from the weaklist. + * + * @since S60 v5.2 + * @param iap_id IAP ID to be removed. + */ + void remove_iap_id_from_weak_list( u32_t iap_id ); + + /** + * Check whether the given feature is enabled. + * + * @since S60 v5.2 + * @param feature Feature flag to check. + * @return true_t if the feature is enabled, false_t otherwise. + */ + bool_t is_feature_enabled( + core_feature_e feature ) const; + +private: // data + + /** Defines whether wlan functionality is enabled or disabled */ + bool_t is_wlan_enabled_m; + + /** Defines whether the drivers have been loaded. */ + bool_t is_driver_loaded_m; + + /** Specifies the current connection state */ + core_connection_state_e connection_state_m; + + /** Currently used power mode. */ + core_power_mode_s power_mode_m; + + /** Preferred power save mode. */ + core_power_save_mode_s preferred_power_save_m; + + /** Permanent white list of APs. */ + core_type_list_c perm_whitelist_m; + + /** Permanent black list of APs. */ + core_type_list_c perm_blacklist_m; + + /** Threshold for RCPI is getting worse notification. */ + u32_t rcp_decline_boundary_m; + + /** Threshold for RCPI is getting better notification. */ + u32_t rcp_improve_boundary_m; + + /** Defines the currently used regional domain. */ + core_wlan_region_e region_m; + + /** Defines whether the mobile country code is known or not. */ + bool_t mcc_known_m; + + /** Defines whether a BT connection has been established. */ + bool_t is_bt_connection_established_m; + + /** Packet statistics for the connection that is/was active. */ + core_packet_statistics_by_access_category_s current_statistics_m; + + /** Roam metrics for the connection that is/was active. */ + core_roam_metrics_c roam_metrics_m; + + /** List of channels that have APs with long beacon intervals. */ + core_long_beacon_interval_channels_s long_beacon_interval_channels_m; + + /** U-APSD settings for access classes. */ + core_uapsd_settings_s uapsd_settings_m; + + /** Power save settings for access classes. */ + core_power_save_settings_s power_save_settings_m; + + /** Block ACK usage per traffic stream. */ + core_block_ack_usage_s block_ack_usage_m; + + + /** List of IAP Ids whose rcpi values are weak */ + core_type_list_c weak_iap_list_m; + + + /** Bitmask of enabled features. */ + u32_t features_m; + + }; + +#endif // CORE_SETTINGS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings_default.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_settings_default.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Default values for some of the settings. +* +*/ + + +#ifndef CORE_SETTINGS_DEFAULT_H +#define CORE_SETTINGS_DEFAULT_H + +#include "core_types.h" + +const core_uapsd_settings_s DEFAULT_UAPSD_SETTINGS = + { + core_max_service_period_length_all, // allow AP to send all buffered frames during a service period + true_t, // U-APSD is enabled for Voice + true_t, // U-APSD is enabled for Video + true_t, // U-APSD is enabled for BestEffort + true_t // U-APSD is enabled for Background + }; + +const core_power_save_settings_s DEFAULT_POWER_SAVE_SETTINGS = + { + true_t, // stay in U-APSD power save when using Voice + false_t, // allow CAM<>U-APSD power save transitions when using Video + false_t, // allow CAM<>U-APSD power save transitions when using BestEffort + false_t, // allow CAM<>U-APSD power save transitions when using Background + false_t, // allow CAM<>legacy power save transitions when using Voice + false_t, // allow CAM<>legacy power save transitions when using Video + false_t, // allow CAM<>legacy power save transitions when using BestEffort + false_t, // allow CAM<>legacy power save transitions when using Background + }; + +const core_block_ack_usage_s DEFAULT_BLOCK_ACK_USAGE = + { + 0xFF, // enabled for all traffic streams in TX direction + 0xFF // enabled for all traffic streams in RX direction + }; + +#endif // CORE_SETTINGS_DEFAULT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_adhoc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_adhoc.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for establishing an adhoc network +* +*/ + + +#ifndef CORE_SUB_OPERATION_ADHOC_H +#define CORE_SUB_OPERATION_ADHOC_H + +#include "core_operation_base.h" +#include "core_ap_data.h" +#include "abs_core_frame_handler.h" +#include "abs_core_event_handler.h" + +class core_server_c; +class abs_core_driverif_c; + +/** + * Statemachine for establishing an adhoc network + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_adhoc_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c, + public abs_core_event_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_scan_start, + core_state_scan_complete, + core_state_req_set_tx_rate_policies, + core_state_req_start_adhoc, + core_state_adhoc_started, + core_state_adhoc_frame, + core_state_adhoc_complete, + core_state_MAX + }; + + /** + * Constructor. + */ + core_sub_operation_adhoc_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_ap_data_c** ap_data ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_adhoc_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + + /** + * From abs_core_event_handler_c Called by the core server when an indication has been received. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + * @return true_t if the indication was handled, false_t if not handled. + */ + bool_t notify( + core_am_indication_e indication ); + +private: // data + + core_ap_data_c** ptr_ap_data_m; + + /** The channel to create the network to. */ + u32_t channel_m; + + /** Structure for the channel noise information. */ + u32_t noise_per_channel_m[SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO]; + + }; + +#endif // CORE_SUB_OPERATION_ADHOC_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_connect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_connect.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connecting to a network +* +*/ + + +#ifndef CORE_SUB_OPERATION_CONNECT_H +#define CORE_SUB_OPERATION_CONNECT_H + +#include "core_operation_base.h" +#include "core_ap_data.h" +#include "core_type_list.h" +#include "abs_core_frame_handler.h" + +class core_server_c; +class abs_core_driverif_c; +class core_frame_dot11_ie_c; +class core_frame_assoc_resp_c; + +const u64_t RRM_CAPABILITY_BIT_MASK = 0xfc0070; + +/** + * Statemachine for connecting to a network + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_connect_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_set_tx_level, + core_state_req_set_tx_rate_policies, + core_state_connect, + core_state_connect_frame, + core_state_connect_complete, + core_state_MAX + }; + + /** + * Constructor. + */ + core_sub_operation_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + core_management_status_e& connect_status, + const core_ssid_s& ssid, + core_ap_data_c& ap_data, + u16_t auth_algorithm, + core_encryption_mode_e encryption_level, + core_cipher_key_type_e pairwise_key_type, + core_type_list_c& assoc_ie_list, + core_frame_assoc_resp_c** assoc_resp, + bool_t is_pairwise_key_invalidated, + bool_t is_group_key_invalidated ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_connect_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + +private: // data + + /** + * Whether we are still connected to an AP. + */ + bool_t& is_connected_m; + + /** Status of connection attempt. */ + core_management_status_e& connect_status_m; + + /** + * SSID to connect to. + */ + const core_ssid_s& ssid_m; + + /** + * AP to connect to. + */ + core_ap_data_c& ap_data_m; + + /** + * Authentication algorithm number to use. + */ + u16_t auth_algorithm_m; + + /** + * Encryption to use. + */ + core_encryption_mode_e encryption_m; + + /** + * Pairwise cipher key type to be used. + */ + core_cipher_key_type_e pairwise_key_type_m; + + /** + * The maximum allowed TX level. + */ + u32_t tx_level_m; + + /** The list of IEs that will be added to the association/resassociation request */ + core_type_list_c& assoc_ie_list_m; + + /** Buffer for storing all the IEs added to the association/reassociation request. */ + u8_t* assoc_ie_data_m; + + /** + * The (re-)association response frame is stored here if received. + * Not owned by this pointer. + */ + core_frame_assoc_resp_c** assoc_resp_m; + + /** + * Whether the pairwise key should be invalidated. + */ + bool_t is_pairwise_key_invalidated_m; + + /** + * Whether the group key should be invalidated. + */ + bool_t is_group_key_invalidated_m; + + }; + +#endif // CORE_SUB_OPERATION_CONNECT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_create_ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_create_ts.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for creating a traffic stream. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef CORE_SUB_OPERATION_CREATE_TS_H +#define CORE_SUB_OPERATION_CREATE_TS_H + +#include "core_operation_base.h" +#include "core_traffic_stream.h" +#include "core_ap_data.h" +#include "abs_core_frame_handler.h" + +/** + * Statemachine for creating a traffic stream. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_create_ts_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_request_sent, + core_state_invalid_parameters, + core_state_failure, + core_state_success, + core_state_MAX + }; + + core_sub_operation_create_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_ap_data_c& ap_data, + u8_t tid, + u8_t user_priority, + core_traffic_stream_params_s& tspec, + core_traffic_stream_status_e& stream_status ); + + virtual ~core_sub_operation_create_ts_c(); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a frame parser. + * @param rcpi RCPI value of the frame. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + /** The AP currently tried. */ + const core_ap_data_c& current_ap_m; + + /** + * The TID of the traffic stream. + */ + u8_t tid_m; + + /** + * The User Priority of the traffic stream. + */ + u8_t user_priority_m; + + /** Traffic stream to be created. */ + core_traffic_stream_params_s& tspec_m; + + /** The current status of the traffic stream. */ + core_traffic_stream_status_e& stream_status_m; + + }; + +#endif // CORE_SUB_OPERATION_CREATE_TS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_echo_test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_echo_test.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for running an echo test. +* +*/ + + +#ifndef CORE_SUB_OPERATION_ECHO_TEST_H +#define CORE_SUB_OPERATION_ECHO_TEST_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" +#include "core_ap_data.h" + +/** + * Statemachine for running an echo test. + * + * @lib wlmserversrv.lib + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_sub_operation_echo_test_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c + { + +public: + + /** + * The possible states of the operation. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_echo_frame_broadcast_timeout, + core_state_echo_frame_unicast_timeout, + core_state_echo_frame_broadcast, + core_state_echo_frame_unicast, + core_state_MAX + }; + + /** + * Constructor. + * + * @since S60 v3.2 + * @param request_id An unique identification for the request. + * @param server Handle to core server. + * @param drivers Handle to low-level management functionality. + * @param adaptation Handle upper-level management functionality. + * @param ap_data The access point being tested. + * @param max_retry_count Maximum times an echo test frame can be re-sent. + * @param timeout The amount of microseconds to wait for response. + * @param test_mode Indicates the current test mode which is unicast or broadcast. + */ + core_sub_operation_echo_test_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_ap_data_c& ap_data, + u8_t max_retry_count, + u32_t timeout, + bool_t test_mode ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_echo_test_c(); + +protected: + + /** + * From core_operation_base_c This method is called when a pending request has been completed + * and no sub-operations are pending. + * + * @since S60 v3.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * From abs_core_frame_handler_c Called by the core server when an echo test frame has been received. + * + * @since S60 v3.2 + * @param frame Pointer to an echo test frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_test_frame( + const core_frame_echo_test_c* frame, + u8_t rcpi ); + +private: // data + + /** + * The access point being tested. + */ + const core_ap_data_c& current_ap_m; + + /** + * Maximum times an echo test frame can be re-sent. + */ + const u8_t max_retry_count_m; + + /** + * Number of times the echo test frame has been sent. + */ + u8_t retry_count_m; + + /** + * The amount of microseconds to wait for response. + */ + u32_t timeout_m; + + /** + * The token used in the sent echo test frame. + */ + u16_t token_m; + + /** + * Status of the operation. + * + * core_error_timeout if no response was received from the AP. + * core_error_ok if response was successfully received, + * an error otherwise. + */ + core_error_e return_status_m; + + /** + * Illustrates the state if unicast test mode is on. + */ + bool_t is_unicast_mode_m; + + }; + +#endif // CORE_SUB_OPERATION_ECHO_TEST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_load_drivers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_load_drivers.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for loading the drivers +* +*/ + + +#ifndef CORE_SUB_OPERATION_LOAD_DRIVERS_H +#define CORE_SUB_OPERATION_LOAD_DRIVERS_H + +#include "core_operation_base.h" + +class core_server_c; +class abs_core_driverif_c; + +/** + * Statemachine for loading the drivers + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_load_drivers_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_region, + core_state_req_load_drivers, + core_state_req_set_tx_power, + core_state_req_set_rxtx_parameters, + core_state_req_set_uapsd_settings, + core_state_req_set_power_save_settings, + core_state_req_set_power_mode_mgmt_settings, + core_state_req_set_block_ack_usage, + core_state_req_set_wpx_settings, + core_state_cancel_req_unload_drivers, + core_state_done, + core_state_MAX + }; + + /** + * Constructor. + */ + core_sub_operation_load_drivers_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_load_drivers_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: // data + + /** + * Current WLAN region. + */ + core_wlan_region_e region_m; + + /** + * Is MCC (mobile country code) currently known + */ + bool_t mcc_known_m; + + }; + +#endif // CORE_SUB_OPERATION_LOAD_DRIVERS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_roam_scan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_roam_scan.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for doing scans when roaming +* +*/ + + +#ifndef CORE_SUB_OPERATION_ROAM_SCAN_H +#define CORE_SUB_OPERATION_ROAM_SCAN_H + +#include "core_operation_base.h" +#include "abs_core_frame_handler.h" +#include "abs_core_event_handler.h" + +NONSHARABLE_CLASS( core_sub_operation_roam_scan_c ) : + public core_operation_base_c, + public abs_core_frame_handler_c, + public abs_core_event_handler_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_scan_start, + core_state_scan_started, + core_state_scan_stop, + core_state_scan_stopped, + core_state_scan_complete, + core_state_MAX + }; + + /** + * Constructor + * + * @since S60 v3.1 + * @param request_id to corresponding service request + * @param server core server + * @param drivers pointer to lower adaptation + * @param adaptation pointer to upper adaptation + * @param scan_ssid SSID to be scanned. + * @param scan_channels List of channels to scan. + * @param is_connected Whether the terminal is currently connected to a BSS. + * @param is_first_match_selected Whether scan should be stopped at the first match. + */ + core_sub_operation_roam_scan_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + bool_t is_connected, + bool_t is_first_match_selected ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_roam_scan_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + + /** + * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. + * + * @since S60 v3.1 + * @param frame Pointer to a dot11 frame parser. + * @param rcpi RCPI value of the frame. + * @return true_t if the frame was handled, false_t otherwise. + */ + bool_t receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ); + + /** + * From abs_core_event_handler_c Called by the core server when an indication has been received. + * + * @since S60 v3.1 + * @param indication Adaptation layer event. + * @return true_t if the indication was handled, false_t if not handled. + */ + bool_t notify( + core_am_indication_e indication ); + +private: // data + + /** + * The SSID to be scanned. + */ + const core_ssid_s scan_ssid_m; + + /** + * The channels to be scanned. + */ + const core_scan_channels_s scan_channels_m; + + /** + * Whether the terminal is currently connected to a BSS. + */ + bool_t is_connected_m; + + /** + * Whether scan should be stopped at the first match. + */ + bool_t is_first_match_selected; + + }; + +#endif // CORE_SUB_OPERATION_ROAM_SCAN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_roam_update_ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_roam_update_ts.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating traffic stream statuses after roam. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef CORE_SUB_OPERATION_ROAM_UPDATE_TS_H +#define CORE_SUB_OPERATION_ROAM_UPDATE_TS_H + +#include "core_operation_base.h" +#include "core_virtual_traffic_stream_list.h" +#include "core_virtual_traffic_stream_list_iter.h" +#include "core_traffic_stream_list.h" +#include "core_traffic_stream_list_iter.h" +#include "core_ap_data.h" + +/** + * Statemachine for updating traffic stream statuses after roam. + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_roam_update_ts_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_recreate_next, + core_state_recreate_success, + core_state_recreate_fail, + core_state_recreate_virtual_next, + core_state_recreate_virtual_success, + core_state_recreate_virtual_fail, + core_state_set_params_next, + core_state_set_params_success, + core_state_MAX + }; + + core_sub_operation_roam_update_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_ap_data_c& ap_data ); + + virtual ~core_sub_operation_roam_update_ts_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: + + /** + * Set the status of all virtual traffic streams with a matching TID + * and send a notification to clients. + * + * @param tid TID to match against. + * @param stream_status Stream status to set. + */ + void set_virtual_traffic_stream_inactive_by_tid( + u8_t tid, + core_traffic_stream_status_e stream_status ); + + /** + * Set the status of all virtual traffic streams with a matching ID + * and send a notification to clients. + * + * @param id ID to match against. + * @param stream_status Stream status to set. + */ + void set_virtual_traffic_stream_inactive_by_id( + u32_t id, + core_traffic_stream_status_e stream_status ); + + /** + * Set the status of all virtual traffic streams with a matching ID + * and send a notification to clients. + * + * @param id ID to match against. + * @param tid Current TID of the virtual traffic stream. + */ + void set_virtual_traffic_stream_active_by_id( + u32_t id, + u8_t tid ); + +private: // data + + /** The AP currently tried. */ + core_ap_data_c& current_ap_m; + + /** List of virtual traffic streams to be recreated. */ + core_virtual_traffic_stream_list_c virtual_stream_list_m; + + /** Iterator for virtual traffic streams. */ + core_virtual_traffic_stream_list_iter_c virtual_stream_iter_m; + + /** List of traffic stream to be recreated. */ + core_traffic_stream_list_c stream_list_m; + + /** Iterator for traffic streams. */ + core_traffic_stream_list_iter_c stream_iter_m; + + /** TID of the traffic stream to be recreated. */ + u8_t tid_m; + + /** The User Priority of the traffic stream. */ + u8_t user_priority_m; + + /** Parameters of the traffic stream to be recreated. */ + core_traffic_stream_params_s params_m; + + /** The current status of the traffic stream. */ + core_traffic_stream_status_e stream_status_m; + + }; + +#endif // CORE_SUB_OPERATION_ROAM_UPDATE_TS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_set_static_wep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_set_static_wep.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for settings static WEP keys +* +*/ + + +#ifndef CORE_SUB_OPERATION_SET_STATIC_WEP_H +#define CORE_SUB_OPERATION_SET_STATIC_WEP_H + +#include "core_operation_base.h" +#include "core_ap_data.h" + +class core_server_c; +class abs_core_driverif_c; + +/** + * Statemachine for settings static WEP keys + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_set_static_wep_c ) : public core_operation_base_c + { + +public: + + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_req_set_key1, + core_state_req_set_key2, + core_state_req_set_key3, + core_state_req_set_key4, + core_state_MAX + }; + + /** + * Constructor. + */ + core_sub_operation_set_static_wep_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_set_static_wep_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + +private: // data + + }; + +#endif // CORE_SUB_OPERATION_SET_STATIC_WEP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_wep_connect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_wep_connect.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for connecting to a WEP network. +* +*/ + + +#ifndef CORE_SUB_OPERATION_WEP_CONNECT_H +#define CORE_SUB_OPERATION_WEP_CONNECT_H + +#include "core_operation_base.h" +#include "core_ap_data.h" +#include "core_type_list.h" + +/** + * State machine for connecting to a WEP AP. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_sub_operation_wep_connect_c ) : public core_operation_base_c + { + +public: + + /** The possible states of the state machine. */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_connect, + core_state_connect_failed, + core_state_MAX + }; + + /** + * Constructor. + * + * @param request_id An unique identification for the request. + * @param server Callback to the core server. + * @param drivers Callback to the lower adaptation. + * @param adaptation Callback to the upper adaptation. + * @param is_connected Whether we are still connected to an AP. + * @param connect_status Status of connection attempt. + * @param ssid SSID to connect to. + * @param ap_data AP to connect to. + * @param auth_mode Authentication mode to use. + * @param encryption_level Encryption to use. + * @param assoc_ie_list The list of IEs to be added. + * @param assoc_resp The (re-)association response frame is stored here. + */ + core_sub_operation_wep_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + core_management_status_e& connect_status, + const core_ssid_s& ssid, + core_ap_data_c& ap_data, + core_authentication_mode_e auth_mode, + core_encryption_mode_e encryption_level, + core_type_list_c& assoc_ie_list, + core_frame_assoc_resp_c** assoc_resp ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_wep_connect_c(); + +protected: + +// from base class core_operation_base_c + + /** + * From core_operation_base_c. + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * From core_operation_base_c. + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.2 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + +private: // data + + /** Whether we are still connected to an AP. */ + bool_t& is_connected_m; + + /** Status of connection attempt. */ + core_management_status_e& connect_status_m; + + /** SSID to connect to. */ + const core_ssid_s& ssid_m; + + /** AP to connect to. */ + core_ap_data_c& ap_data_m; + + /** Authentication mode to try initially. */ + core_authentication_mode_e initial_auth_mode_m; + + /** Authentication mode to use. */ + core_authentication_mode_e auth_mode_m; + + /** Encryption to use. */ + core_encryption_mode_e encryption_m; + + /** The list of IEs that will be added to the association/resassociation request */ + core_type_list_c& assoc_ie_list_m; + + /** + * The (re-)association response frame is stored here if received. + * Not owned by this pointer. + */ + core_frame_assoc_resp_c** assoc_resp_m; + + }; + +#endif // CORE_SUB_OPERATION_WEP_CONNECT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_wpa_connect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_wpa_connect.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,274 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connecting to a WPA network +* +*/ + + +#ifndef CORE_SUB_OPERATION_WPA_CONNECT_H +#define CORE_SUB_OPERATION_WPA_CONNECT_H + +#include "core_operation_base.h" +#include "core_ap_data.h" +#include "abs_core_event_handler.h" +#include "core_type_list.h" +#include "abs_wlan_eapol_callback_interface.h" + +/** The maximum length of a PMKID. */ +const u32_t CORE_EAPOL_PMKID_MAX_LENGTH = 256; + +class core_server_c; +class abs_core_driverif_c; +class core_frame_dot11_ie_c; +class core_frame_assoc_resp_c; + +/** + * Statemachine for connecting to a WPA network + * + * @lib wlmserversrv.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_sub_operation_wpa_connect_c ) : + public core_operation_base_c, + public abs_wlan_eapol_callback_interface_c, + public abs_core_event_handler_c + { + +public: + + /** + * The possible states of the state machine. + */ + enum core_state_e + { + core_state_init = core_base_state_next, + core_state_start_authentication_needed, + core_state_do_connect, + core_state_req_connect, + core_state_req_connect_failed, + core_state_req_association_failed, + core_state_process_eapol_frame, + core_state_req_state_notification, + core_state_bss_lost, + core_state_user_cancel, + core_state_MAX + }; + + /** + * Constructor. + */ + core_sub_operation_wpa_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + core_management_status_e& connect_status, + const core_ssid_s& ssid, + core_ap_data_c& ap_data, + bool_t& is_cached_sa_used, + core_type_list_c& assoc_ie_list, + core_frame_assoc_resp_c** assoc_resp ); + + /** + * Destructor. + */ + virtual ~core_sub_operation_wpa_connect_c(); + +protected: + + /** + * This method is called when a pending request has been completed + * and so sub-operations are pending. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e next_state(); + + /** + * This method is called when the operation needs to be canceled. + * + * @since S60 v3.1 + * @return status of the operation: + * core_error_request_pending if the operation is not finished, + * otherwise the status code of the finished operation + */ + core_error_e cancel(); + + /** + * This method is called when the operation is cancelled from the outside. + * + * @since S60 v3.2 + * @param do_graceful_cancel Whether cancel should be graceful or forced. + */ + void user_cancel( + bool_t do_graceful_cancel ); + +// from base class abs_wlan_eapol_callback_interface_c + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e packet_send( + network_id_c * send_network_id, + u8_t * packet_data, + u32_t packet_data_length, + bool_t send_unencrypted ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e associate( + wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e disassociate( + network_id_c * receive_network_id, + const bool_t self_disassociation ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e packet_data_session_key( + network_id_c * send_network_id, + session_key_c * key ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + void state_notification( + state_notification_c * state ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e reassociate( + network_id_c * send_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e authentication_type, + u8_t * PMKID, + u32_t PMKID_length ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e complete_check_pmksa_cache( + core_type_list_c & network_id_list ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + core_error_e new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ); + + /** + * From abs_wlan_eapol_callback_interface_c + */ + void handle_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ); + +// from base class abs_core_event_handler_c + + bool_t notify( + core_am_indication_e indication ); + +private: // data + + /** + * Whether we are still connected to an AP. + */ + bool_t& is_connected_m; + + /** + * Whether the connection attempt uses a cached security association. + */ + bool_t& is_cached_sa_used_m; + + /** + * Status of connection attempt. + */ + core_management_status_e& connect_status_m; + + /** + * SSID to connect to. + */ + const core_ssid_s& ssid_m; + + /** + * AP to connect to. + */ + core_ap_data_c& ap_data_m; + + /** + * BSSID currently tried. + */ + core_mac_address_s current_bssid_m; + + /** + * Length of PMKID data. + */ + u16_t pmkid_length_m; + + /** + * PMKID data. + */ + u8_t pmkid_data_m[CORE_EAPOL_PMKID_MAX_LENGTH]; + + /** + * Sent WPA/RSN/WAPI IE data. + */ + core_frame_dot11_ie_c* sent_ie_m; + + /** + * Authentication algorithm used for the connection. + */ + u16_t auth_algorithm_m; + + /** + * Authentication type for EAPOL. + */ + wlan_eapol_if_eapol_key_authentication_type_e eapol_auth_type_m; + + /** + * List of IEs that will be added to the (re-)association request. + */ + core_type_list_c& assoc_ie_list_m; + + /** + * The (re-)association response frame is stored here if received. + * Not owned by this class. + */ + core_frame_assoc_resp_c** assoc_resp_m; + + /** + * Whether the connection attempt uses a proactive key caching. + */ + bool_t is_key_caching_used_m; + + }; + +#endif // CORE_SUB_OPERATION_WPA_CONNECT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_timer_counter_measures.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_timer_counter_measures.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Timer for handling WPA TKIP counter measures +* +*/ + + +#ifndef CORE_TIMER_COUNTER_MEASURES_H +#define CORE_TIMER_COUNTER_MEASURES_H + +#include "am_platform_libraries.h" +#include "abs_core_timer.h" + +/** + * Timer for handling WPA TKIP counter measures. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_timer_counter_measures_c ) + { + +public: + + /** The possible states of the timer. */ + enum core_state_e + { + core_state_not_running, + core_state_activated, + core_state_blocked + }; + + /** + * Constructor. + */ + core_timer_counter_measures_c(); + + /** + * Destructor. + */ + virtual ~core_timer_counter_measures_c(); + + /** + * Check whether WPA connections are allowed or not. + * + * @since S60 v3.1 + * @return Whether WPA connections are allowed or not. + */ + bool_t is_wpa_allowed(); + + /** + * Used to indicate to the timer that a MIC failure has occured. + */ + void mic_failure(); + + /** + * Called by the timer framework when timer expires. + */ + static void timer_expired( void* this_ptr ); + +private: + + // Prohibit copy constructor + core_timer_counter_measures_c( + const core_timer_counter_measures_c& ); + // Prohibit assigment operator + core_timer_counter_measures_c& operator=( + const core_timer_counter_measures_c& ); + +private: // data + + /** + * Current timer state. + */ + core_state_e state_m; + + /** + * Counter measures timer. + */ + abs_core_timer_c* timer_m; + + }; + +#endif // CORE_TIMER_COUNTER_MEASURES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_timer_factory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_timer_factory.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Factory class for timers implementing abs_core_timer_c interface +* +*/ + + +#ifndef CORE_TIMER_FACTORY_H +#define CORE_TIMER_FACTORY_H + +#include "am_platform_libraries.h" + +class abs_core_timer_c; +class abs_core_timer_callback_c; +class core_callback_c; + +/** +* This class implements a timer factory that is used to instantiate +* timers implementing abs_core_timer_c interface. +* @see abs_core_timer_c +*/ +NONSHARABLE_CLASS(core_timer_factory_c) + { + public: + + /** + * Create a new timer. + * @param callback Handle to callback interface + * @return Pointer to the created timer. + */ + static abs_core_timer_c* create_timer( + core_callback_c* callback ); + + /** + * Destroy an old timer. + * @param timer Timer to be destroyed. + */ + static void destroy_timer( + abs_core_timer_c* timer ); + + private: // private constructor + + core_timer_factory_c(); + }; + +#endif // CORE_TIMER_FACTORY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tools.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,426 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Simple utility functions for core +* +*/ + + +#ifndef CORE_TOOLS_H +#define CORE_TOOLS_H + +#include "am_platform_libraries.h" +#include "core_types.h" +#include "core_iap_data.h" +#include "core_ap_data.h" +#include "genscanlist.h" + +/** +* core_tools_c offers generic utilities +* +* @lib wlmserversrv.lib +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS(core_tools_c) + { + public: // New functions + + /** + * compares two arrays of data + * @param pl Pointer to parameter1 data. + * @param ll Length of parameter1 data. + * @param pr Pointer to parameter2 data. + * @param rl Length of parameter2 data. + * @return 0 if data is same or similar + * !0 if data is not similar + */ + static int_t compare( + const u8_t* pl, + int_t ll, + const u8_t* pr, + int_t rl ); + + /** + * copies data from source buffer to target buffer + * @param trg Pointer to target buffer. + * @param src Pointer to source buffer. + * @param len Length of data to copy in bytes. + * @return pointer to end of target + */ + static u8_t* copy( + void* trg, + const void* src, + int_t len ); + + /** + * fills buffer with zeroes + * @param trg Pointer to buffer. + * @param len Length of buffer in bytes. + */ + static void fillz( + void* trg, + int_t len ); + + /** + * Convert the given parameter to big-endian order. + * @param source integer + * @return converted integer + */ + static u16_t convert_host_to_big_endian( + u16_t src ); + + /** + * Convert the given parameter to big-endian order. + * @param source integer + * @return converted integer + */ + static u32_t convert_host_to_big_endian( + u32_t src ); + + /** + * Convert the given parameter to big-endian order. + * @param source integer + * @return converted integer + */ + static u16_t convert_big_endian_to_host( + u16_t src ); + + /** + * Convert the given parameter to big-endian order. + * @param source integer + * @return converted integer + */ + static u32_t convert_big_endian_to_host( + u32_t src ); + + /** + * Return a big endian word from the given buffer index in host order. + * + * @since S60 v3.1 + * @param pointer to data + * @param index in the buffer + * @return A word from the given buffer index in host order. + */ + static u16_t get_u16_big_endian( + const u8_t* data, + u16_t index ); + + /** + * Return a host order word from the given buffer index. + * + * @since S60 v3.1 + * @param pointer to data + * @param index in the buffer + * @return A word from the given buffer index in host order. + */ + static u16_t get_u16( + const u8_t* data, + u16_t index ); + + /** + * Return a big endian long word from the given buffer index in host order. + * + * @since S60 v3.1 + * @param pointer to data + * @param index in the buffer + * @return A long word from the given buffer index in host order. + */ + static u32_t get_u32_big_endian( + const u8_t* data, + u16_t index ); + + /** + * Return a host order from the given buffer index. + * + * @since S60 v3.1 + * @param pointer to data + * @param index in the buffer + * @return A long word from the given buffer index in host order. + */ + static u32_t get_u32( + const u8_t* data, + u16_t index ); + + /** + * Return a host order from the given buffer index. + * + * @since S60 v5.2 + * @param pointer to data + * @param index in the buffer + * @return A quadruple word from the given buffer index in host order. + */ + static u64_t get_u64( + const u8_t* data, + u16_t index ); + + /** + * Insert a big endian u16_t to the given buffer index. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param index Index in the buffer. + * @param value Data be to appended. + */ + static void insert_u16_big_endian( + u8_t* data, + u16_t index, + u16_t value ); + + /** + * Insert a host order u16_t to the given buffer index. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param index Index in the buffer. + * @param value Data be to appended. + */ + static void insert_u16( + u8_t* data, + u16_t index, + u16_t value ); + + /** + * Insert a big endian u32_t to the given buffer index. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param index Index in the buffer. + * @param value Data be to appended. + */ + static void insert_u32_big_endian( + u8_t* data, + u16_t index, + u32_t value ); + + /** + * Insert a host order u32_t to the given buffer index. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param index Index in the buffer. + * @param value Data be to appended. + */ + static void insert_u32( + u8_t* data, + u16_t index, + u32_t value ); + + /** + * Append a big endian u16_t to the given buffer. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param data_length Current buffer length. + * @param value Data be to appended. + */ + static void append_u16_big_endian( + u8_t* data, + u16_t& data_length, + u16_t value ); + + /** + * Append a host order u16_t to the given buffer. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param data_length Current buffer length. + * @param value Data be to appended. + */ + static void append_u16( + u8_t* data, + u16_t& data_length, + u16_t value ); + + /** + * Append a big endian u32_t to the given buffer. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param data_length Current buffer length. + * @param value Data be to appended. + */ + static void append_u32_big_endian( + u8_t* data, + u16_t& data_length, + u32_t value ); + + /** + * Append a host order u32_t to the given buffer. + * + * @since S60 v3.2 + * @param data Pointer to the buffer. + * @param data_length Current buffer length. + * @param value Data be to appended. + */ + static void append_u32( + u8_t* data, + u16_t& data_length, + u32_t value ); + + /** + * Convert the given cipher suite to matching cipher key type. + * + * @since S60 v3.1 + * @param cipher Cipher suite to convert. + * @return The type of the cipher key. + */ + static core_cipher_key_type_e cipher_key_type( + core_cipher_suite_e cipher ); + + /** + * Determine the type of the cipher key from the given parameters. + * + * @since S60 v3.1 + * @param type Type of the key reported by EAPOL. + * @param pairwise_cipher The currently used pairwise cipher. + * @param group_cipher The currently used group cipher. + * @return The type of the cipher key. + */ + static core_cipher_key_type_e cipher_key_type( + wlan_eapol_if_eapol_key_type_e type, + core_cipher_suite_e pairwise_cipher, + core_cipher_suite_e group_cipher ); + + /** + * Determine the EAPOL authentication type from the given parameters. + * + * @since S60 v3.1 + * @param iap_data Information about the used IAP. + * @param ap_data Information about the used AP. + * @retun The authentication type. + */ + static wlan_eapol_if_eapol_key_authentication_type_e eap_authentication_type( + const core_iap_data_c& iap_data, + const core_ap_data_c& ap_data ); + + /** + * Convert the given cipher suite to the EAPOL equivalent. + * + * @since S60 v3.1 + * @param cipher Cipher suite to convert. + * @return The converted cipher suite. + */ + static wlan_eapol_if_rsna_cipher_e eapol_cipher( + core_cipher_suite_e cipher ); + + /** + * Add the given beacon to the scan list. + * + * @since S60 v3.1 + * @param scan_list Scan list where the beacon is added. + * @param ap_data Beacon to be added. + * @param rcpi RCPI value of the beacon. + */ + static void add_beacon_to_scan_list( + ScanList& scan_list, + const core_ap_data_c& ap_data, + u32_t rcpi ); + + /** + * Convert the given user priority value to an access class. + * + * @since S60 v3.1 + * @param user_priority User priority value to be converted. + * @return The corresponding access class. + */ + static core_access_class_e convert_user_priority_to_ac( + u8_t user_priority ); + + /** + * Convert the given access class to an user priority value. + * + * @since S60 v3.2 + * @param access_class Access class to be converted + * @return The corresponding user priority value. + */ + static u8_t convert_ac_to_user_priority( + core_access_class_e access_class ); + + /** + * Convert the given tx rate value (500kbit/s per unit) to a corresponding enum. + * + * @since S60 v3.2 + * @param tx_rate Tx rate value to be converted. + * @return Corresponding tx rate enum. + */ + static core_tx_rate_e convert_tx_rate_to_tx_rate_enum( + u8_t tx_rate ); + + /** + * Convert the given tx rate enum to a corresponding tx rate value (500kbit/s per unit). + * + * @since S60 v3.2 + * @param tx_rate Tx rate enum to be converted. + * @return Corresponding rx rate value. + */ + static u8_t convert_tx_rate_enum_to_tx_rate( + core_tx_rate_e tx_rate ); + + /** + * Return the highest tx rate defined. + * + * @since S60 v3.2 + * @param tx_rates Bitmask of tx rates. + * @return The highest tx rate defined. + */ + static core_tx_rate_e highest_tx_rate( + u32_t tx_rates ); + + /** + * Convert the tx rates to a tx policy. + * + * @since S60 v3.2 + * @param tx_rates Bitmask of tx rates. + * @return Corresponding tx rate policy. + */ + static core_tx_rate_policy_s convert_tx_rates_to_tx_policy( + u32_t tx_rates ); + + /** + * Determine the security mode from the given parameters. + * + * @since S60 v3.2 + * @param iap_data Information about the used IAP. + * @param ap_data Information about the used AP. + * @retun The security mode. + */ + static core_connection_security_mode_e security_mode( + const core_iap_data_c& iap_data, + const core_ap_data_c& ap_data ); + + /** + * Convert an EAPOL error code to the the corresponding + * protected setup error code. + * + * @since S60 v3.2 + * @param error EAPOL error code. + * @return The corresponding protected setup status code. + */ + static core_protected_setup_status_e convert_eapol_error_to_protected_setup_status( + const wlan_eapol_if_eap_status_e error ); + + /** + * Check which WLAN region the country information received from AP matches. + * @since S60 5.0 + * @param found_country Country information received from AP. + * @return WLAN region converted from the country information. + */ + static core_wlan_region_e convert_country_to_region( + const core_country_string_s& found_country ); + + + }; + +#include "core_tools.inl" + +#endif // CORE_TOOLS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tools.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tools.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Simple utility functions for core +* +*/ + +/* +* %version: 5 % +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +/** + * operator== for core_mac_address_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if equal, false_t otherwise + */ +inline bool_t operator== ( + const core_mac_address_s& lhs, + const core_mac_address_s& rhs ) + { + if ( !core_tools_c::compare( lhs.addr, MAC_ADDR_LEN, + rhs.addr, MAC_ADDR_LEN ) ) + { + return true_t; + } + + return false_t; + } + +/** + * operator!= for core_mac_address_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if not equal, false_t otherwise + */ +inline bool_t operator!= ( + const core_mac_address_s& lhs, + const core_mac_address_s& rhs ) + { + return !( lhs == rhs ); + } + +/** + * operator== for core_ssid_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if equal, false_t otherwise + */ +inline bool_t operator== ( + const core_ssid_s& lhs, + const core_ssid_s& rhs ) + { + if ( !core_tools_c::compare( lhs.ssid, lhs.length, + rhs.ssid, rhs.length ) ) + { + return true_t; + } + + return false_t; + } + +/** + * operator!= for core_ssid_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if not equal, false_t otherwise + */ +inline bool_t operator!= ( + const core_ssid_s& lhs, + const core_ssid_s& rhs ) + { + return !( lhs == rhs ); + } + +/** + * operator== for core_country_string_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t equal, false_t otherwise + */ +inline bool_t operator== ( + const core_country_string_s& lhs, + const core_country_string_s& rhs ) + { + if ( !core_tools_c::compare( lhs.country, MAX_COUNTRY_STRING_LENGTH, + rhs.country, MAX_COUNTRY_STRING_LENGTH ) ) + { + return true_t; + } + + return false_t; + } + +/** + * operator!= for core_country_string_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if not equal, false_t otherwise + */ +inline bool_t operator!= ( + const core_country_string_s& lhs, + const core_country_string_s& rhs ) + { + return !( lhs == rhs ); + } + +/** + * operator== for medium_time_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if not equal, false_t otherwise + */ +inline bool_t operator== ( + const medium_time_s& lhs, + const medium_time_s& rhs ) + { + if( !core_tools_c::compare( + reinterpret_cast( lhs.up ), sizeof( lhs.up ), + reinterpret_cast( rhs.up ), sizeof( rhs.up ) ) && + !core_tools_c::compare( + reinterpret_cast( lhs.ac ), sizeof( lhs.ac ), + reinterpret_cast( rhs.ac ), sizeof( rhs.ac ) ) ) + { + return true_t; + } + + return false_t; + } + +/** + * operator!= for medium_time_s + * @param lhs left hand side + * @param rhs right hand side + * @return true_t if not equal, false_t otherwise + */ +inline bool_t operator!= ( + const medium_time_s& lhs, + const medium_time_s& rhs ) + { + return !( lhs == rhs ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tools_parser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tools_parser.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Simple parser functions for core +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef CORE_TOOLS_PARSER_H +#define CORE_TOOLS_PARSER_H + +#include "core_types.h" +#include "core_ap_data.h" +#include "core_settings.h" +#include "core_connection_data.h" +#include "abs_core_wpx_adaptation.h" + +class core_frame_dot11_c; + +/** + * Class for parsing various 802.11 information elements. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_tools_parser_c ) + { + +public: + + /** + * Check whether the given AP has compatible settings with the connection settings. + * + * @since S60 v3.1 + * @param wpx_adaptation WPX adaptation. + * @param ap_data AP data to compare. + * @param iap_data IAP data to compare. + * @param core_settings Core settings to compare. + * @param is_cm_active Whether WPA counter measures are active. + * @return core_connect_ok if AP is compatible, the failure reason otherwise. + */ + static core_connect_status_e is_ap_compatible_with_iap( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_ap_data_c& ap_data, + core_iap_data_c& iap_data, + core_settings_c& core_settings, + bool_t is_cm_active = false_t, + bool_t ignore_channels = false_t); + + /** + * Check whether the given AP is suitable for roaming. + * + * @since S60 v3.2 + * @param wpx_adaptation WPX adaptation. + * @param ap_data AP data to compare. + * @param iap_data IAP data to compare. + * @param core_settings Core settings to compare. + * @param connection_data Connection data to compare. + * @param min_rcpi Minimum RCPI required. RCPI_VALUE_NONE if none. + * @param min_medium_time Minimum amount free medium time required. MEDIUM_TIME_NOT_DEFINED if none. + * @param is_cm_active Whether WPA counter measures are active. + * @param current_bssid BSSID currently connected to. ZERO_MAC_ADDR if none. + * @return core_connect_ok if AP is compatible, the failure reason otherwise. + */ + static core_connect_status_e is_ap_suitable( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_ap_data_c& ap_data, + core_iap_data_c& iap_data, + core_settings_c& core_settings, + core_connection_data_c& connection_data, + u8_t min_rcpi, + const medium_time_s& min_medium_time, + bool_t is_cm_active, + const core_mac_address_s& current_bssid ); + + /** + * Get parsed access point information structure. + * + * @since S60 v3.2 + * @param iap_data Information about the used IAP. + * @param ap_data AP data to parse. + * @return Parsed access point information structure. + */ + static core_ap_information_s get_ap_info( + const core_iap_data_c& iap_data, + core_ap_data_c& ap_data ); + + /** + * Get the traffic stream parameters for the given TID. + * + * @since S60 v3.2 + * @param frame Frame to be parsed. + * @param tid TID of the traffic stream. + * @param tspec Parameters are stored here. + * @return true_t if parameters found, false_t otherwise. + */ + static bool_t get_wmm_traffic_stream_params( + core_frame_dot11_c& frame, + u8_t tid, + core_traffic_stream_params_s& tspec ); + + /** + * Parse the basic and supported rates from the given information element. + * @param data Pointer to IE data. + * @param data_length Length of IE data. + * @param basic_rates Bitmask of basic rates. + * @param supported_rates Bitmask of supported rates. + * @see core_tx_rate_e for rates. + */ + static void parse_rates( + const u8_t* data, + u8_t data_length, + u32_t& basic_rates, + u32_t& supported_rates ); + +private: + + /** + * Constructor. + */ + core_tools_parser_c(); + + }; + +#endif // core_tools_parser_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_traffic_stream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_traffic_stream.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,352 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing traffic stream parameters. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef CORE_TRAFFIC_STREAM_H +#define CORE_TRAFFIC_STREAM_H + +#include "core_types.h" + +/** + * Class for storing traffic stream parameters. + * + * @lib wlmserversrv.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_traffic_stream_c ) + { + +public: + + /** + * Constructor. + * @param tid TID of the traffic stream. + * @param user_priority User Priority of the traffic stream. + */ + core_traffic_stream_c( + u8_t tid, + u8_t user_priority ); + + /** + * Destructor. + */ + virtual ~core_traffic_stream_c(); + + /** + * Get the TID value of the traffic stream. + * + * @since S60 v3.2 + * @return The TID value of the traffic stream. + */ + u8_t tid() const; + + /** + * Get the User Priority value of the traffic stream. + * + * @since S60 v3.2 + * @return The User Priority value of the traffic stream. + */ + u8_t user_priority() const; + + /** + * Get the access class of the traffic stream. + * + * @since S60 v5.1 + * @return The access class of the traffic stream. + */ + core_access_class_e access_class() const; + + /** + * Set the default traffic values. + * + * @since S60 v3.2 + * @param params Traffic stream parameters. + */ + void set_default_traffic_values( + const core_traffic_stream_params_s& params ); + + /** + * Override the default traffic values with different values. + * + * @since S60 v3.2 + * @param params Traffic stream parameters. + */ + void set_traffic_values( + const core_traffic_stream_params_s& params ); + + /** + * Reset the traffic stream back to default values. + * + * @since S60 v3.2 + */ + void reset_to_default_values(); + + /** + * Reset the traffic stream back to previous values. + * + * @since S60 v3.2 + */ + void reset_to_previous_values(); + + /** + * Get the current status of the traffic stream. + * + * @since S60 v3.2 + * @return The current status of the traffic stream. + */ + core_traffic_stream_status_e status() const; + + /** + * Set the current status of the traffic stream. + * + * @since S60 v3.2 + * @param status The current status of the traffic stream. + */ + void set_status( + core_traffic_stream_status_e status ); + + /** + * Return the current amount of virtual traffic streams + * referencing this traffic stream. + * + * @since S60 v3.2 + * @return The current reference count. + */ + u8_t reference_count(); + + /** + * Increase the reference count by one. + * + * @since S60 v3.2 + */ + void inc_reference_count(); + + /** + * Decrease the reference count by one. + * + * @since S60 v3.2 + */ + void dec_reference_count(); + + /** + * Get the traffic pattern. + * + * @since S60 v3.2 + * @return Whether the traffic pattern is periodic or aperiodic. + */ + bool_t is_periodic_traffic() const; + + /** + * Return the Direction field of the traffic stream. + * + * @since S60 v5.1 + * @return The Direction field of the frame. + */ + core_traffic_stream_direction_e direction() const; + + /** + * Get the Nominal MSDU Size of the traffic stream. + * + * @since S60 v3.2 + * @return The Nominal MSDU Size of the traffic stream. + */ + u16_t nominal_msdu_size() const; + + /** + * Get the Maximum MSDU Size of the traffic stream. + * + * @since S60 v3.2 + * @return The Maximum MSDU Size of the traffic stream. + */ + u16_t maximum_msdu_size() const; + + /** + * Get the Minimum Service Interval of the traffic stream. + * + * @since S60 v3.2 + * @return The Minimum Service Interval of the traffic stream. + */ + u32_t minimum_service_interval() const; + + /** + * Get the Maximum Service Interval of the traffic stream. + * + * @since S60 v3.2 + * @return The Maximum Service Interval of the traffic stream. + */ + u32_t maximum_service_interval() const; + + /** + * Get the Inactivity Interval of the traffic stream. + * + * @since S60 v3.2 + * @return The Inactivity Interval of the traffic stream. + */ + u32_t inactivity_interval() const; + + /** + * Get the Suspension Interval of the traffic stream. + * + * @since S60 v3.2 + * @return The Suspension Interval of the traffic stream. + */ + u32_t suspension_interval() const; + + /** + * Get the Service Start Time of the traffic stream. + * + * @since S60 v3.2 + * @return The Service Start Time of the traffic stream. + */ + u32_t service_start_time() const; + + /** + * Get the Minimum Data Rate of the traffic stream. + * + * @since S60 v3.2 + * @return The Minimum Data Rate of the traffic stream. + */ + u32_t minimum_data_rate() const; + + /** + * Get the Mean Data Rate of the traffic stream. + * + * @since S60 v3.2 + * @return The Mean Data Rate of the traffic stream. + */ + u32_t mean_data_rate() const; + + /** + * Get the Peak Data Rate of the traffic stream. + * + * @since S60 v3.2 + * @return The Peak Data Rate of the traffic stream. + */ + u32_t peak_data_rate() const; + + /** + * Get the Maximum Burst Size of the traffic stream. + * + * @since S60 v3.2 + * @return The Maximum Burst Size of the traffic stream. + */ + u32_t maximum_burst_size() const; + + /** + * Get the Delay Bound of the traffic stream. + * + * @since S60 v3.2 + * @return The Delay Bound of the traffic stream. + */ + u32_t delay_bound() const; + + /** + * Get the Minimum PHY Rate of the traffic stream. + * + * @since S60 v3.2 + * @return The Minimum PHY Rate of the traffic stream. + */ + u32_t minimum_phy_rate() const; + + /** + * Get the Surplus Bandwidth Allowance of the traffic stream. + * + * @since S60 v3.2 + * @return The Surplus Bandwidth Allowance of the traffic stream. + */ + u16_t surplus_bandwidth_allowance() const; + + /** + * Get the Medium Time of the traffic stream. + * + * @since S60 v3.2 + * @return The Medium Time of the traffic stream. + */ + u16_t medium_time() const; + + /** + * Get the Nominal PHY Rate of the traffic stream. + * + * @since S60 v3.2 + * @return The Nominal PHY Rate of the traffic stream. + */ + core_tx_rate_e nominal_phy_rate() const; + + /** + * Get the rates for overriding the tx rate policy. + * @since S60 v3.2 + * @return The Nominal PHY Rate of the traffic stream, 0 if defaults are used + */ + u32_t override_rates() const; + + /** + * Get the Maximum Transmit MSDU Lifetime. + * @since S60 v3.2 + * @return The Maximum Transmit MSDU Lifetime of the traffic stream. + */ + u32_t max_tx_msdu_lifetime() const; + + /** + * Assignment operator. + */ + core_traffic_stream_c& operator=( + const core_traffic_stream_c& src ); + +private: // data + + /** + * The TID of the traffic stream. + */ + u8_t tid_m; + + /** + * The User Priority of the traffic stream. + */ + u8_t user_priority_m; + + /** + * The default traffic stream parameters. + */ + core_traffic_stream_params_s default_params_m; + + /** + * The current traffic stream parameters. + */ + core_traffic_stream_params_s params_m; + + /** + * The previous traffic stream parameters. + */ + core_traffic_stream_params_s previous_params_m; + + /** + * The current status of the traffic stream. + */ + core_traffic_stream_status_e status_m; + + /** + * The current amount of virtual traffic streams + * referencing this traffic stream. + */ + u8_t reference_count_m; + + }; + +#endif // CORE_TRAFFIC_STREAM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_traffic_stream_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_traffic_stream_list.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing active traffic streams. +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef CORE_TRAFFIC_STREAM_LIST_H +#define CORE_TRAFFIC_STREAM_LIST_H + +#include "core_type_list.h" +#include "core_traffic_stream.h" + +class core_traffic_stream_c; + +/** + * This is a storage class for active traffic streams. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_traffic_stream_list_c ) + { + + friend class core_traffic_stream_list_iter_c; + +public: + + /** + * Structure for storing active traffic streams. + */ + struct entry_s + { + /** Data of the AP. */ + core_traffic_stream_c* traffic_stream; + }; + + /** + * Constructor. + * + * @since S60 v3.2 + * @param iap_data containing structure of IAP data + */ + core_traffic_stream_list_c(); + + /** + * Destructor. + */ + virtual ~core_traffic_stream_list_c(); + + /** + * Return the amount of entries in the list. + * + * @since S60 v3.2 + * @return The amount of entries in the list. + */ + u32_t count() const; + + /** + * Return the first entry in the list. + * @return The first entry in the list. NULL if none. + */ + core_traffic_stream_c* first(); + + /** + * Return the next entry in the list. + * @return The next entry in the list. NULL if none. + */ + core_traffic_stream_c* next(); + + /** + * Return the current entry in the list. + * @return The current entry in the list. NULL if none. + */ + core_traffic_stream_c* current() const; + + /** + * Append an entry to the list. + * + * @since S60 v3.2 + * @param traffic_stream Traffic stream to be added. If an entry already exists, it is replaced. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e update_traffic_stream( + const core_traffic_stream_c& traffic_stream ); + + /** + * Remove entry with a matching TID. + * + * @since S60 v3.2 + * @param tid TID to match against. + */ + void remove_traffic_stream_by_tid( + u8_t tid ); + + /** + * Print the contents of the list. + */ + void print_contents(); + + /** + * Calculate the combined admitted medium time. + * + * @since S60 v3.2 + * @return The combined admitted medium time. MEDIUM_TIME_NOT_DEFINED if none. + */ + medium_time_s admitted_medium_time(); + + /** + * Check whether the given access class has any traffic streams. + * + * @since S60 v3.2 + * @param access_class Access class to search for. + * @return true_t if any traffic stream exist, false_t otherwise. + */ + bool_t is_traffic_stream_for_access_class( + core_access_class_e access_class ); + + /** + * Check whether a traffic stream exists for the given TID. + * + * @since S60 v3.2 + * @param tid TID to search for. + * @return true_t if a traffic stream exists, false_t otherwise. + */ + bool_t is_traffic_stream_for_tid( + u8_t tid ); + + /** + * Set the given status to all traffic streams. + * + * @since S60 v3.2 + * @param status Status to be set. + */ + void set_traffic_stream_status( + core_traffic_stream_status_e status ); + + /** + * Get the next free TID. + * + * @return The next free TID, MAX_TRAFFIC_STREAM_TID if no available. + */ + u8_t next_tid(); + +private: // data + + /** + * List of beacons/probe responses. + */ + core_type_list_c ts_list_m; + + }; + +#endif // CORE_TRAFFIC_STREAM_LIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_traffic_stream_list_iter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_traffic_stream_list_iter.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Iterator for traffic stream list. +* +*/ + +/* +* %version: % +*/ + +#ifndef CORE_TRAFFIC_STREAM_LIST_ITER_H +#define CORE_TRAFFIC_STREAM_LIST_ITER_H + +#include "core_traffic_stream_list.h" + +/** + * This class implements an iterator for traffic stream list. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_traffic_stream_list_iter_c ) + { + +public: + + /** + * Constructor. + * + * @param list Reference to the list being iterated. + */ + core_traffic_stream_list_iter_c( + core_traffic_stream_list_c& list ); + + /** + * Destructor. + */ + virtual ~core_traffic_stream_list_iter_c(); + + /** + * Return the first entry in the list. + * @return The first entry in the list. NULL if none. + */ + core_traffic_stream_c* first(); + + /** + * Return the next entry in the list. + * @return The next entry in the list. NULL if none. + */ + core_traffic_stream_c* next(); + + /** + * Return the current entry in the list. + * @return The current entry in the list. NULL if none. + */ + core_traffic_stream_c* current() const; + + /** + * Remove the current entry from the list. + * + * @return core_error_ok if removed successfully, an error code otherwise. + */ + core_error_e remove(); + +private: // data + + /** + * An iterator for iterating the list. + */ + core_type_list_iterator_c iter_m; + + }; + +#endif // CORE_TRAFFIC_STREAM_LIST_ITER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tx_rate_policies.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_tx_rate_policies.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,324 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Default values for TX rate policies. +* +*/ + + +#ifndef CORE_TX_RATE_POLICIES_H +#define CORE_TX_RATE_POLICIES_H + +#include "core_types.h" + +/** + * TX rate policies to use with 802.11bg access points. + */ + +const core_tx_rate_policy_s TX_RATE_POLICY_BG = + { + 1, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 3, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 1, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_6mbit, // initial rate is 6 Mbit/s + CORE_TX_RATES_802P11BG, // TX auto rate policy (all 802.11bg rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_VOICE_BG = + { + 1, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 1, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 1, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_12mbit, // initial rate is 12 Mbit/s + CORE_TX_RATES_802P11BG, // TX auto rate policy (all 802.11bg rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_BLUETOOTH_BG = + { + 2, // 54 Mbits/s + 2, // 48 Mbits/s + 1, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 1, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 0, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_24mbit, // initial rate is 24 Mbit/s + 0x3FF8, // TX auto rate policy (6 Mbits/s and above) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_BLUETOOTH_VOICE_BG = + { + 2, // 54 Mbits/s + 2, // 48 Mbits/s + 1, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 2, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 1, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_24mbit, // initial rate is 24 Mbit/s + 0x3FF9, // TX auto rate policy (1 Mbit/s, 6 Mbit/s and above) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +/** + * TX rate policies to use with 802.11b-only access points. + */ + +const core_tx_rate_policy_s TX_RATE_POLICY_B = + { + 0, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 0, // 24 Mbits/s + 0, // 22 Mbits/s + 0, // 18 Mbits/s + 0, // 12 Mbits/s + 2, // 11 Mbits/s + 0, // 9 Mbits/s + 0, // 6 Mbits/s + 2, // 5.5 Mbits/s + 2, // 2 Mbits/s + 1, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_2mbit, // initial rate is 2 Mbit/s, + CORE_TX_RATES_802P11B, // TX auto rate policy (all 802.11b rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_VOICE_B = + { + 0, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 0, // 24 Mbits/s + 0, // 22 Mbits/s + 0, // 18 Mbits/s + 0, // 12 Mbits/s + 2, // 11 Mbits/s + 0, // 9 Mbits/s + 0, // 6 Mbits/s + 2, // 5.5 Mbits/s + 1, // 2 Mbits/s + 1, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_5p5mbit, // initial rate is 5.5 Mbit/s + CORE_TX_RATES_802P11B, // TX auto rate policy (all 802.11b rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_BLUETOOTH_B = + { + 0, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 0, // 24 Mbits/s + 0, // 22 Mbits/s + 0, // 18 Mbits/s + 0, // 12 Mbits/s + 6, // 11 Mbits/s + 0, // 9 Mbits/s + 0, // 6 Mbits/s + 2, // 5.5 Mbits/s + 0, // 2 Mbits/s + 0, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_11mbit, // initial rate is 11 Mbit/s + 0x24, // TX auto rate policy (5.5 Mbit/s, 11 Mbit/s) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_BLUETOOTH_VOICE_B = + { + 0, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 0, // 24 Mbits/s + 0, // 22 Mbits/s + 0, // 18 Mbits/s + 0, // 12 Mbits/s + 6, // 11 Mbits/s + 0, // 9 Mbits/s + 0, // 6 Mbits/s + 2, // 5.5 Mbits/s + 0, // 2 Mbits/s + 1, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_11mbit, // initial rate is 11 Mbit/s + 0x25, // TX auto rate policy (1 Mbit/s, 5.5 Mbit/s, 11 Mbit/s) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +/** + * TX rate policies to use with 802.11g-only access points. + */ + +const core_tx_rate_policy_s TX_RATE_POLICY_G = + { + 1, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 2, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 0, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_6mbit, // initial rate is 6 Mbit/s, + CORE_TX_RATES_802P11G, // TX auto rate policy (all 802.11g rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_VOICE_G = + { + 1, // 54 Mbits/s + 0, // 48 Mbits/s + 0, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 0, // 9 Mbits/s + 2, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 0, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_6mbit, // initial rate is 6 Mbit/s + CORE_TX_RATES_802P11G, // TX auto rate policy (all 802.11g rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_BLUETOOTH_G = + { + 2, // 54 Mbits/s + 2, // 48 Mbits/s + 1, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 1, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 0, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_24mbit, // initial rate is 24 Mbit/s + CORE_TX_RATES_802P11G, // TX auto rate policy (all 802.11g rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +const core_tx_rate_policy_s TX_RATE_POLICY_BLUETOOTH_VOICE_G = + { + 2, // 54 Mbits/s + 2, // 48 Mbits/s + 1, // 36 Mbits/s + 0, // 33 Mbits/s + 1, // 24 Mbits/s + 0, // 22 Mbits/s + 1, // 18 Mbits/s + 1, // 12 Mbits/s + 0, // 11 Mbits/s + 1, // 9 Mbits/s + 1, // 6 Mbits/s + 0, // 5.5 Mbits/s + 0, // 2 Mbits/s + 0, // 1 Mbits/s + 0, // short retry limit will be filled later + 0, // long retry limit will be filled later + 0, // no flags + core_tx_rate_24mbit, // initial rate is 24 Mbit/s + CORE_TX_RATES_802P11G, // TX auto rate policy (all 802.11g rates) + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +#endif // CORE_TX_RATE_POLICIES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_type_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_type_list.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,747 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A template class implementing a linked-list. +* +*/ + + +#ifndef CORE_TYPE_LIST_H +#define CORE_TYPE_LIST_H + +#include "core_types.h" +#include "am_debug.h" + +/** Defining this enables further iterator traces. */ +//#define WLAN_CORE_DEEP_DEBUG 1 + +template class core_type_list_iterator_c; + +/** Default priority for list entries. */ +const u32_t LIST_LOW_PRIORITY = 0; +const u32_t LIST_DEFAULT_PRIORITY = 10; +const u32_t LIST_MEDIUM_PRIORITY = 15; +const u32_t LIST_HIGH_PRIORITY = 20; +const u32_t LIST_TOP_PRIORITY = 30; // This priority must be the highest + +/** + * Data structure for storing a single list entry. + * + * @since S60 v3.2 + */ +template struct core_type_list_entry_s + { + /** + * Constructor. + */ + core_type_list_entry_s( + u32_t priority, + type_t* entry, + core_type_list_entry_s* next, + core_type_list_entry_s* prev ) : + priority_m( priority ), + entry_m( entry ), + next_m( next ), + prev_m( prev ) + { + } + + /** Defines the priority level of the entry. */ + u32_t priority_m; + + /** Pointer to entry data. */ + type_t* entry_m; + + /** Pointer to the next entry. */ + core_type_list_entry_s* next_m; + + /** Pointer to the previous entry. */ + core_type_list_entry_s* prev_m; + }; + +/** + * A template class implementing a linked-list. + * + * The list is sorted by priority in either descending + * or ascending order. + * + * The class contains an internal iterator that can + * be accessed via first() and next() methods. This + * functionality is deprecated, the external iterator + * core_type_list_iterator_c should be used instead. + * + * @since S60 v3.2 + */ +template NONSHARABLE_CLASS( core_type_list_c ) + { + friend class core_type_list_iterator_c; + +public: + + /** + * Constructor. + * + * @param is_order_descending Whether the list is sorted in descending or ascending + * priority order. + * @param is_owned Whether the list claims ownership of the entries. + */ + core_type_list_c( + bool_t is_order_descending = true_t, + bool_t is_owned = true_t ); + + /** + * Destructor. + */ + ~core_type_list_c(); + + /** + * Append an entry to the list. + * + * @since S60 v3.2 + * @param entry The entry to be added. + * @param priority Priority of the entry. + * @return core_error_ok if success, an error code otherwise. + * @note The list takes ownership of the passed entry pointer. + */ + core_error_e append( + type_t* entry, + u32_t priority = LIST_DEFAULT_PRIORITY ); + + /** + * Remove an entry from the list. + * + * @since S60 v3.2 + * @param entry The entry to be removed. + * @return core_error_ok if success, an error code otherwise. + * @note The ownership of the entry is passed to the calling party. + */ + core_error_e remove( + const type_t* entry ); + + /** + * Remove all entries from the list and delete them. + * + * @since S60 v3.2 + */ + void clear(); + + /** + * Return the first entry in the list. + * + * @since S60 v3.2 + * @return NULL if the list empty, pointer to the first entry otherwise. + * @note This method will reset the internal iterator. + */ + type_t* first(); + + /** + * Return the next entry in the list. + * + * @since S60 v3.2 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + type_t* next(); + + /** + * Return the current entry in the list. + * + * @since S60 v3.2 + * @return pointer to the current entry. + */ + type_t* current() const; + + /** + * Return the amount of entries in the list. + * + * @since S60 v3.2 + * @return The amount of entries in the list. + */ + u32_t count() const; + +protected: + + /** + * Register an iterator so that it can be notified when an entry is removed. + * + * @param iterator Iterator to register. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e register_iterator( + core_type_list_iterator_c* iterator ); + + /** + * Unregister an iterator. + * + * @param iterator Iterator to unregister. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e unregister_iterator( + core_type_list_iterator_c* iterator ); + + /** + * Called by a core_type_list_iterator_c before an entry is removed. + * + * This method will cause the list to notify all registerd iterators + * about the deletion. + * + * @param entry Entry to be removed. + */ + void on_remove( + core_type_list_entry_s* entry ); + +private: + + /** Prohibit copy constructor. */ + core_type_list_c( + const core_type_list_c& ); + + /** Prohibit assigment operator. */ + core_type_list_c& operator=( + const core_type_list_c& ); + +private: // data + + /** The list head entry. */ + core_type_list_entry_s list_head_m; + + /** The first entry in the list of registered iterators. */ + core_type_list_entry_s< core_type_list_iterator_c >* iter_head_m; + + /** Iterator for iterating through the list of entries. */ + core_type_list_iterator_c list_iter_m; + + /** The amount of entries in the list. */ + u32_t count_m; + + /** Whether the list order is descending or ascending. */ + bool_t is_order_descending_m; + + /** Whether the list claims ownership of the entries. */ + bool_t is_owned_m; + + }; + +/** + * This class implements a robust iterator for core_type_list_c class. + * + * @since S60 v3.2 + */ +template NONSHARABLE_CLASS( core_type_list_iterator_c ) + { + friend class core_type_list_c; + +public: + + /** + * Constructor. + * + * @param list Reference to the list being iterated. + */ + core_type_list_iterator_c( + core_type_list_c& list ); + + /** + * Destructor. + */ + ~core_type_list_iterator_c(); + + /** + * Return the first entry in the list. + * + * @since S60 v3.2 + * @return NULL if the list empty, pointer to the first entry otherwise. + */ + type_t* first(); + + /** + * Return the next entry in the list. + * + * @since S60 v3.2 + * @return NULL if the current entry is the last one, + * pointer to the next entry otherwise. + */ + type_t* next(); + + /** + * Return the current entry in the list. + * + * @since S60 v3.2 + * @return NULL if an empty list or at the end of the list, + * pointer to the current entry otherwise. + */ + type_t* current() const; + + /** + * Remove the current entry from the list. + * + * @since S60 v3.2 + * @return core_error_ok if removed successfully, an error code otherwise. + */ + core_error_e remove(); + +protected: + + /** + * Called by core_type_list_c before an entry is removed. + * + * @param entry Entry to be removed. + */ + void on_remove( + core_type_list_entry_s* entry ); + +private: + + /** Prohibit copy constructor. */ + core_type_list_iterator_c( + const core_type_list_iterator_c& ); + + /** Prohibit assigment operator. */ + core_type_list_iterator_c& operator=( + const core_type_list_iterator_c& ); + +private: // data + + /** + * Handle to the actual list. + */ + core_type_list_c& list_m; + + /** + * Pointer to the currently iterated entry. Not owned by this pointer. + */ + core_type_list_entry_s* list_iter_m; + + /** + * Whether the iterator has an active registration with the list. + */ + bool_t is_registed_m; + + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_type_list_c::core_type_list_c( + bool_t is_order_descending, + bool_t is_owned ) : + list_head_m( 0, NULL, NULL, NULL ), + iter_head_m( NULL ), + list_iter_m( *this ), + count_m( 0 ), + is_order_descending_m( is_order_descending ), + is_owned_m( is_owned ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_type_list_c::~core_type_list_c() + { + clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_error_e core_type_list_c::append( + type_t* entry, + u32_t priority ) + { + if( !entry ) + { + DEBUG( "core_type_list_c::append() - entry is NULL" ); + + return core_error_illegal_argument; + } + + core_type_list_entry_s* list_entry = new core_type_list_entry_s( + priority, entry, NULL, NULL ); + if( !list_entry ) + { + DEBUG( "core_type_list_c::append() - unable to instantiate core_type_list_entry_s" ); + + return core_error_no_memory; + } + + core_type_list_entry_s* prev = &list_head_m; + core_type_list_entry_s* current = list_head_m.next_m; + bool_t is_done( false_t ); + + while( current && !is_done ) + { + if( is_order_descending_m && + current->priority_m < list_entry->priority_m ) + { + is_done = true_t; + } + else if( !is_order_descending_m && + current->priority_m > list_entry->priority_m ) + { + is_done = true_t; + } + else + { + prev = current; + current = current->next_m; + } + } + + list_entry->next_m = current; + list_entry->prev_m = prev; + prev->next_m = list_entry; + if( current ) + { + current->prev_m = list_entry; + } + + ++count_m; + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_error_e core_type_list_c::remove( + const type_t* entry ) + { + core_type_list_iterator_c iter( *this ); + for( type_t* current = iter.first(); current; current = iter.next() ) + { + if ( current == entry ) + { + iter.remove(); + + return core_error_ok; + } + } + + return core_error_not_found; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template void core_type_list_c::clear() + { + for( type_t* current = list_iter_m.first(); current; current = list_iter_m.next() ) + { + list_iter_m.remove(); + + if ( is_owned_m ) + { + delete current; + current = NULL; + } + } + + ASSERT( !count_m ); + ASSERT( !list_head_m.next_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template type_t* core_type_list_c::first() + { + return list_iter_m.first(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template type_t* core_type_list_c::next() + { + return list_iter_m.next(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template type_t* core_type_list_c::current() const + { + return list_iter_m.current(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template u32_t core_type_list_c::count() const + { + return count_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_error_e core_type_list_c::register_iterator( + core_type_list_iterator_c* iterator ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_type_list_c::register_iterator() - registering iterator 0x%08X", + iterator ); +#endif // WLAN_CORE_DEEP_DEBUG + + if( !iterator ) + { + DEBUG( "core_type_list_c::register_iterator() - iterator is NULL" ); + + return core_error_illegal_argument; + } + + core_type_list_entry_s< core_type_list_iterator_c >* iter_entry = + new core_type_list_entry_s< core_type_list_iterator_c >( + 0, + iterator, + iter_head_m, + NULL ); + if( !iter_entry ) + { + DEBUG( "core_type_list_c::register_iterator() - unable to instantiate core_type_list_entry_s" ); + + return core_error_no_memory; + } + + if ( iter_head_m ) + { + iter_head_m->prev_m = iter_entry; + } + iter_head_m = iter_entry; + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_error_e core_type_list_c::unregister_iterator( + core_type_list_iterator_c* iterator ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_type_list_c::unregister_iterator() - unregistering iterator 0x%08X", + iterator ); +#endif // WLAN_CORE_DEEP_DEBUG + + if( !iterator ) + { + DEBUG( "core_type_list_c::unregister_iterator() - iterator is NULL" ); + + return core_error_illegal_argument; + } + + core_type_list_entry_s< core_type_list_iterator_c >* iter_entry = iter_head_m; + while( iter_entry ) + { + if ( iter_entry->entry_m == iterator ) + { + if( !iter_entry->prev_m ) + { + /** + * First entry in the list. + */ + ASSERT( iter_head_m == iter_entry ); + + if ( iter_entry->next_m ) + { + iter_entry->next_m->prev_m = NULL; + } + iter_head_m = iter_entry->next_m; + } + else + { + /** + * Somewhere else in the list. + */ + iter_entry->prev_m->next_m = iter_entry->next_m; + if ( iter_entry->next_m ) + { + iter_entry->next_m->prev_m = iter_entry->prev_m; + } + } + + delete iter_entry; + iter_entry = NULL; + + return core_error_ok; + } + + iter_entry = iter_entry->next_m; + } + + return core_error_not_found; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template void core_type_list_c::on_remove( + core_type_list_entry_s* entry ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_type_list_c::on_remove() - entry 0x%08X will be removed, notifying iterators", + entry ); +#endif // WLAN_CORE_DEEP_DEBUG + + core_type_list_entry_s< core_type_list_iterator_c >* iter_entry = iter_head_m; + while( iter_entry ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_type_list_c::on_remove() - notifying iterator 0x%08X", + iter_entry->entry_m ); +#endif // WLAN_CORE_DEEP_DEBUG + + iter_entry->entry_m->on_remove( entry ); + + iter_entry = iter_entry->next_m; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_type_list_iterator_c::core_type_list_iterator_c( + core_type_list_c& list ) : + list_m( list ), + list_iter_m( &list_m.list_head_m ), + is_registed_m( false ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_type_list_iterator_c::~core_type_list_iterator_c() + { + if ( is_registed_m ) + { + list_m.unregister_iterator( this ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template type_t* core_type_list_iterator_c::first() + { + if ( !is_registed_m ) + { + list_m.register_iterator( this ); + is_registed_m = true_t; + } + + list_iter_m = list_m.list_head_m.next_m; + if ( list_iter_m ) + { + return list_iter_m->entry_m; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template type_t* core_type_list_iterator_c::next() + { + if ( !list_iter_m ) + { + return NULL; + } + + list_iter_m = list_iter_m->next_m; + if ( list_iter_m ) + { + return list_iter_m->entry_m; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template type_t* core_type_list_iterator_c::current() const + { + if ( !list_iter_m || + list_iter_m == &list_m.list_head_m ) + { + return NULL; + } + + return list_iter_m->entry_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template core_error_e core_type_list_iterator_c::remove() + { + if ( !list_iter_m || + list_iter_m == &list_m.list_head_m ) + { + return core_error_illegal_argument; + } + + core_type_list_entry_s* current = list_iter_m; + + // Notify list about the removal. + list_m.on_remove( current ); + + current->prev_m->next_m = current->next_m; + if ( current->next_m ) + { + current->next_m->prev_m = current->prev_m; + } + --list_m.count_m; + + delete current; + current = NULL; + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template void core_type_list_iterator_c::on_remove( + core_type_list_entry_s* entry ) + { + if ( !list_iter_m || + list_iter_m == &list_m.list_head_m ) + { + return; + } + + if ( list_iter_m == entry ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_type_list_iterator_c::on_remove() - iterator 0x%08X is affected", + this ); +#endif // WLAN_CORE_DEEP_DEBUG + + list_iter_m = list_iter_m->prev_m; + } +#ifdef WLAN_CORE_DEEP_DEBUG + else + { + DEBUG1( "core_type_list_iterator_c::on_remove() - iterator 0x%08X is not affected", + this ); + } +#endif // WLAN_CORE_DEEP_DEBUG + } + +#endif // CORE_TYPE_LIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_types.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2152 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Type definitions and constants for core engine +* +*/ + +/* +* %version: 93 % +*/ + +#ifndef CORE_TYPES_H +#define CORE_TYPES_H + +#include "am_platform_libraries.h" + +/** The maximum length of SSID. */ +const u8_t MAX_SSID_LEN = 32; + +/** The maximum length of MAC address. */ +const u8_t MAC_ADDR_LEN = 6; + +/** The maximum length of a timestamp (TSF). */ +const u8_t TSF_VALUE_LEN = 8; + +/** + * The maximum length of a WEP key. + * + * 40-bit (64-bit) key has the length of 5. + * 104-bit (128-bit) key has the length of 13. + * 232-bit (256-bit) key has the length of 29. + **/ +const u8_t MAX_WEP_KEY_LENGTH = 29; + +/** + * The maximum length of a WPA-PSK key. + * + * WPA-PSK passphrase is limited to 8 - 63 characters + * in the range of 32 to 126 (decimal), inclusive. + * + * Length of 64 indicates the actual hashed PSK. + */ +const u8_t MAX_WPA_PSK_LENGTH = 64; + +/** The maximum length of a cipher key (256 bits). */ +const u8_t MAX_CIPHER_KEY_LENGTH = 32; + +/** The maximum length of a RSN/WPA IE. */ +const u8_t MAX_WPAIE_LENGTH = 255; + +const u8_t MAX_RATES = 40; + +const u8_t TX_RATE_BASIC_MASK = 0x80; + +/** Definitions for Capability bitmask in beacons/probe responses. */ +const u16_t CAPABILITY_BIT_MASK_ESS = 0x0001; +const u16_t CAPABILITY_BIT_MASK_IBSS = 0x0002; +const u16_t CAPABILITY_BIT_MASK_PRIVACY = 0x0010; +const u16_t CAPABILITY_BIT_MASK_PREAMBLE = 0x0020; +const u16_t CAPABILITY_BIT_MASK_SLOT_TIME = 0x0400; + +const u8_t SCAN_BAND_2DOT4GHZ = 1; +const u8_t SCAN_BAND_4DOT9GHZ = 2; +const u8_t SCAN_BAND_5GHZ = 4; + +const u8_t MAX_TX_POWER_LEVEL_NOT_DEFINED = 0xFF; +const u32_t MAX_TX_MSDU_LIFETIME_NOT_DEFINED = 0; +const u16_t ADMISSION_CAPACITY_NOT_DEFINED = 0xFFFF; + +const u32_t REQUEST_ID_CORE_INTERNAL = 0; + +const u32_t WEP_KEY1 = 1; +const u32_t WEP_KEY2 = 2; +const u32_t WEP_KEY3 = 3; +const u32_t WEP_KEY4 = 4; + +const u32_t EAP_TYPE_NONE = 0; +const u32_t EAP_ERROR_NONE = 0; + +const u8_t RCPI_VALUE_NONE = 0; + +const u8_t MAX_COUNTRY_STRING_LENGTH = 3; + +const u8_t SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_FCC = 11; +const u8_t SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO = 13; + +/** Timer value for immediate queue execution. */ +const u32_t CORE_TIMER_IMMEDIATELY = 0; + +const u32_t SECONDS_FROM_MICROSECONDS = 1000000; +const u32_t SECONDS_FROM_MILLISECONDS = 1000; +const u32_t MILLISECONDS_FROM_MICROSECONDS = 1000; +const u32_t TIMEUNITS_FROM_MICROSECONDS = 1024; + +/** The maximum number of TX rate policies. */ +const u8_t MAX_TX_RATE_POLICY = 4; + +/** The size of MCS information in a TX rate policy. */ +const u8_t TX_RATE_POLICY_MCS_SIZE = 10; + +/** The number of QoS access classes. */ +const u8_t MAX_QOS_ACCESS_CLASS = 4; + +/** The number of QoS user priority values. */ +const u8_t MAX_QOS_USER_PRIORITY = 8; + +/** The maximum and minimum values of different integers. */ +const u32_t MAX_U32 = 0xFFFFFFFF; +const u32_t MIN_U32 = 0; +const i32_t MAX_I32 = 0x7FFFFFFF; +const i32_t MIN_I32 = static_cast( 0x80000000 ); + +const u32_t SCAN_LIST_AGE_ANY = MAX_U32; +const u32_t SCAN_LIST_AGE_LAST_SCAN = MIN_U32; + +/** The length of OUI. */ +const u8_t OUI_LENGTH = 3; + +/** The value for undefined virtual traffic stream TID. */ +const u8_t TRAFFIC_STREAM_TID_NONE = 0xFF; + +/** The number of traffic stream TID values. */ +const u8_t MAX_TRAFFIC_STREAM_TID = 8; + +typedef enum _core_scan_list_tag_e + { + core_scan_list_tag_none = 0x00, + core_scan_list_tag_scan = 0x01, + core_scan_list_tag_direct_scan = 0x02, + core_scan_list_tag_roam_scan = 0x04, + core_scan_list_tag_ibss_merge = 0x08 + } core_scan_list_tag_e; + +/** + * Defines the possible 802.11 authentication algorithms. + */ +typedef enum _core_authentication_mode_e + { + /** 802.11 Open System authentication algorithm. */ + core_authentication_mode_open = 0, + /** 802.11 Shared Key authentication algorithm. */ + core_authentication_mode_shared = 1, + } core_authentication_mode_e; + +/** + * Definitions for the possible states indicated by core engine. + */ +typedef enum _core_connection_state_e + { + /** Connection is not active. No data flow. */ + core_connection_state_notconnected, + /** Connection to an access point is active. */ + core_connection_state_infrastructure, + /** Searching an access point. No data flow. */ + core_connection_state_searching, + /** IBSS network is active. */ + core_connection_state_ibss, + /** Secure connection to an access point is active. */ + core_connection_state_secureinfra, + /** Secure IBSS network is active. */ + core_connection_state_secureibss + } core_connection_state_e; + +/** + * Security mode according to IAP definition + */ +typedef enum _core_security_mode_e + { + /** No encryption used. */ + core_security_mode_allow_unsecure, + /** Use WEP encryption with static keys. */ + core_security_mode_wep, + /** Use WEP encryption, keys are negotiated by EAPOL. */ + core_security_mode_802dot1x, + /** Use WEP/TKIP/CCMP encryption, keys are negotiated by EAPOL. */ + core_security_mode_wpa, + /** Use CCMP encryption, keys are negotiated by EAPOL. */ + core_security_mode_wpa2only, + /** Use Wi-Fi Protected Setup, keys are negotiated by EAPOL. */ + core_security_mode_protected_setup, + /** Use WAPI, keys are negotiated by EAPOL. */ + core_security_mode_wapi + } core_security_mode_e; + +/** + * Security mode of the current connection + */ +typedef enum _core_connection_security_mode_e + { + /** No security used. */ + core_connection_security_mode_open, + /** Use Open WEP encryption with static keys. */ + core_connection_security_mode_wep_open, + /** Use Shared WEP encryption with static keys. */ + core_connection_security_mode_wep_shared, + /** Use WEP/TKIP/CCMP encryption, keys are negotiated by EAPOL. */ + core_connection_security_mode_802d1x, + /** Use TKIP/CCMP encryption, keys are negotiated by EAPOL. */ + core_connection_security_mode_wpa, + /** WPA with preshared key. */ + core_connection_security_mode_wpa_psk, + /** Use CCMP encryption, keys are negotiated by EAPOL. */ + core_connection_security_mode_wpa2, + /** WPA2 with preshared key. */ + core_connection_security_mode_wpa2_psk, + /** WAPI with certificates. */ + core_connection_security_mode_wapi, + /** WAPI with preshared key. */ + core_connection_security_mode_wapi_psk + } core_connection_security_mode_e; + +/** + * The possible encryption modes. + */ +typedef enum _core_encryption_mode_e + { + /** No encryption used. */ + core_encryption_mode_disabled, + /** Use WEP encryption with static keys. */ + core_encryption_mode_wep, + /** Use WEP encryption with static keys in mixed cell. */ + core_encryption_mode_wep_mixed_cell, + /** Use WEP encryption, keys are negotiated by EAPOL. */ + core_encryption_mode_802dot1x, + /** Use WEP encryption in mixed cell, keys are negotiated by EAPOL. */ + core_encryption_mode_802dot1x_mixed_cell, + /** Use WEP/TKIP/CCMP encryption, keys are negotiated by EAPOL. */ + core_encryption_mode_wpa, + /** Use WPI encryption, keys are negotiated by EAPOL. */ + core_encryption_mode_wpi + } core_encryption_mode_e; + +/** + * Defines all the possible indications that can be received from adaptation. + */ +typedef enum _core_am_indication_e + { + /** + * AP has deauthenticated the station. + */ + core_am_indication_wlan_media_disconnect, + /** + * A fatal error has occurred in the lower layer. + */ + core_am_indication_wlan_hw_failed, + /** + * A number of consecutive beacons has been lost. + * + * @see core_bss_lost_parameters_s::beacon_lost_count + */ + core_am_indication_wlan_beacon_lost, + /** + * UMAC has not been able to perform a power mode state transition. + */ + core_am_indication_wlan_power_mode_failure, + /** + * A number of consecutive transmissions has failed. + * + * @see core_bss_lost_parameters_s::failed_tx_packet_count + */ + core_am_indication_wlan_tx_fail, + /** + * Connection to the BSS has been regained. This indication can occur after + * core_am_indication_wlan_beacon_lost, + * core_am_indication_wlan_power_mode_failure or + * core_am_indication_wlan_tx_fail. + */ + core_am_indication_wlan_bss_regained, + /** + * Decryption of a received packet failed. + */ + core_am_indication_wlan_wep_decrypt_failure, + /** + * A MIC failure has been detected on a received unicast packet. + */ + core_am_indication_wlan_pairwise_key_mic_failure, + /** + * A MIC failure has been detected on a received broadcast + * or multicast packet. + */ + core_am_indication_wlan_group_key_mic_failure, + /** + * Scan has been completed. + */ + core_am_indication_wlan_scan_complete, + /** + * Used to indicate that the RCPI trigger level has been been crossed. + * This indication is one-shot, it will not be triggered again until + * the level is set again. + * + * @see abs_core_driverif_callback_c::set_rcpi_trigger_level + */ + core_am_indication_wlan_rcpi_trigger, + /** + * Signal loss prediction algorithm has indicated an imminent signal + * loss. + */ + core_am_indication_wlan_signal_loss_prediction, + /** + * UMAC has switched to power save mode after (re-)assocation, indicating + * a possibility to run the power save test. + */ + core_am_indication_wlan_power_save_test_trigger, + /** + * The lower layer has detected problems with power save in the + * current access point. + */ + core_am_indication_wlan_ap_ps_mode_error, + /** + * Indication of an imminent power loss. + */ + core_am_indication_os_power_standby, + /** + * Bluetooth connection has been established. + */ + core_am_indication_bt_connection_established, + /** + * Bluetooth connection has been disconnected. + */ + core_am_indication_bt_connection_disconnected, + /** + * Indication that voice call is on. + */ + core_am_indication_voice_call_on, + /** + * Indication that voice call is off. + */ + core_am_indication_voice_call_off + } core_am_indication_e; + +/** + * Structure for storing a MAC address. + */ +typedef struct _core_mac_address_s + { + u8_t addr[MAC_ADDR_LEN]; + } core_mac_address_s; + +/** + * Definition for an undefined MAC address. + */ +const core_mac_address_s ZERO_MAC_ADDR = {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; + +/** + * Definition for a broadcast MAC address. + */ +const core_mac_address_s BROADCAST_MAC_ADDR = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; + +/** + * Structure for storing a timestamp (TSF) from a beacon/probe response. + */ +typedef struct _core_tsf_value_s + { + u8_t tsf[TSF_VALUE_LEN]; + } core_tsf_value_s; + +/** + * Data values for operating modes. + */ +typedef enum _core_operating_mode_e + { + /** The BSS is operating in infrastructure mode. */ + core_operating_mode_infrastructure = CAPABILITY_BIT_MASK_ESS, + /** The BSS is operating in IBSS (ad-hoc) mode. */ + core_operating_mode_ibss = CAPABILITY_BIT_MASK_IBSS + } core_operating_mode_e; + +/** + * The possible scan modes. + */ +typedef enum _core_scan_mode_e + { + /** Send probe requests and listen to beacons and probe responses. */ + core_scan_mode_active, + /** Listen to beacons and probe responses. */ + core_scan_mode_passive + } core_scan_mode_e; + +/** + * Structure for storing an SSID. + */ +typedef struct _core_ssid_s + { + /** Length of the SSID. */ + u32_t length; + /** SSID data. */ + u8_t ssid[MAX_SSID_LEN]; + } core_ssid_s; + +/** + * Definition for a broadcast SSID. + */ +const core_ssid_s BROADCAST_SSID = { 0, { 0x00 }}; + +/** + * Data structure for storing a WEP key. + */ +typedef struct _core_wep_key_s + { + /** Specifies which key to add or remove. Range: 0-3. */ + u32_t key_index; + /** The length of KeyMaterial in bytes. Range: 0-29. */ + u32_t key_length; + /** Array that stores the WEP key. */ + u8_t key_data[MAX_WEP_KEY_LENGTH]; + } core_wep_key_s; + +/** + * Data structure for storing an ARP filters. + */ +typedef struct _core_arp_filter_s + { + u32_t ipv4_addr; + bool_t enable_filter; + } core_arp_filter_s; + +/** + * Defines the possible error codes core engine can return. + */ +typedef enum _core_error_e + { + core_error_ok = 0, + core_error_not_found, + core_error_general, + core_error_no_memory, + core_error_illegal_rate, + core_error_failed, + core_error_drivers_not_loaded, + core_error_in_power_save, + core_error_challenge_failure, + core_error_not_connected, + core_error_illegal_argument, + core_error_not_supported, + core_error_in_use, + core_error_timeout, + core_error_internal_error, + core_error_request_pending, + core_error_cancel, + core_error_eapol_total_failure, + core_error_eapol_failure, + core_error_eapol_canceled_by_user, + core_error_connection_already_active, + core_error_wlan_disabled, + core_error_already_exists, + core_error_eapol_auth_start_timeout, + } core_error_e; + +/** + * Defines the notification core engine can send to adaptation. + */ +typedef enum _core_notification_e + { + /** + * Indicates a change in connection state. + * + * This indication has one to four bytes of payload data. The first byte + * always contains the current connection state (core_connection_state_e). + * + * If the state is core_connection_state_notconnected, the second byte + * contains the reason connection was closed (core_release_reason_e). + * + * If the state is core_connection_state_notconnected and the release reason + * is core_release_reason_max_roam_attempts_exceeded, there are two more + * bytes of payload data. The third byte contains the reason roaming was + * attempted (core_roam_reason_e) and the fourth byte has the reason why + * roaming failed (core_roam_failed_reason_e). + */ + core_notification_connection_state_changed, + /** + * Indicates a successful roam to another AP has been done. + * + * The payload data contains the BSSID of the AP as a core_mac_address_s + * structure. + */ + core_notification_bssid_changed, + /** + * Indicates a temporary loss of connection. + */ + core_notification_bss_lost, + /** + * Indicates that connection has been regained after a + * core_notification_bss_lost indication. + */ + core_notification_bss_regained, + /** + * Indicates the currently allowed maximum tx power. + * + * The payload data is four bytes, containing the maximum tx power + * as u32_t. The value is in dBm. + */ + core_notification_tx_power_level_changed, + /** + * Indicates the RCPI indication threshold has been crossed. + * + * The first byte of payload data indicates the direction (core_rcp_class_e). + * The second byte contains the current RCPI value. + */ + core_notification_rcp_changed, + /** + * Indicates a status change in a virtual traffic stream. + * + * The first four bytes of payload data contains the ID of the affected virtual + * traffic stream. The second byte contains the status of the traffic stream + * (core_traffic_stream_status_e). + */ + core_notification_ts_status_changed, + /** + * Indicates a change in the parameters of the current AP. + * + * The payload data consists of core_ap_information_s structure. + * + * While this indication is most likely triggered by a successful roam, + * it should not be considered as an indication that a roam has happened. + */ + core_notification_ap_info_changed, + /** + * Indicates that an RCPI based roaming attempt has been started. + * + * If the roam attempt is successful, core_notification_bssid_changed and + * core_notification_rcpi_roam_attempt_completed indications will be sent. + * + * If no suitable AP to roam to is found, only core_notification_rcpi_roam_attempt_completed + * indication will be sent. + * + * If the attempt fails due to an association or authentication failure, + * core_notification_connection_state_changed( core_connection_state_searching ) + * will be sent to indicate that the terminal is no longer connected to + * the previous AP. + */ + core_notification_rcpi_roam_attempt_started, + /** + * Indicates that the RCPI based roaming attempt has been completed. + * + * See the description of core_notification_rcpi_roam_attempt_started + * for further information on this indication. + */ + core_notification_rcpi_roam_attempt_completed, + /** + * Indicates that the Broken Power Save test has failed. + * + * If the Broken Power Save test fails, the engine will not allow the any power + * save functionality to be used with this BSSID, decreasing battery life. + */ + core_notification_broken_power_save_test_failed, + /** + * Indicates the traffic mode of an access class has changed. + * + * The first byte of payload data contains the access class + * (core_access_class_e). The second byte contains the traffic mode + * of the access class (core_access_class_traffic_mode_e). + */ + core_notification_ac_traffic_mode_changed, + /** + * Indicates the traffic status of an access class has changed. + * + * The first byte of payload data contains the access class + * (core_access_class_e). The second byte contains the traffic status + * of the access class (core_access_class_traffic_status_e). + */ + core_notification_ac_traffic_status_changed + } core_notification_e; + +/** + * The possible completion statuses for a connect request. + */ +typedef enum _core_connect_status_e + { + core_connect_undefined, + core_connect_ok, + core_connect_unspecified_failure, + core_connect_network_not_found, + core_connect_mode_infra_required_but_ibss_found, + core_connect_mode_ibss_required_but_infra_found, + core_connect_ap_full, + core_connect_ap_not_whitelisted, + core_connect_ap_permanently_blacklisted, + core_connect_ap_temporarily_blacklisted, + core_connect_ap_outside_defined_region, + core_connect_ap_signal_too_weak, + core_connect_ap_has_no_admission_control, + core_connect_ap_has_no_free_admission_capability, + core_connect_iap_open_but_ap_requires_encryption, + core_connect_iap_wep_but_ap_has_no_privacy, + core_connect_iap_wep_but_ap_has_wpa_ie, + core_connect_iap_wpa_but_ap_has_no_privacy, + core_connect_wep_open_authentication_unsupported, + core_connect_wep_open_echo_test_failed, + core_connect_wep_shared_authentication_unsupported, + core_connect_wep_shared_authentication_failed, + core_connect_wpa_ie_required_but_ap_has_none, + core_connect_wpa_psk_required_but_ap_has_no_support, + core_connect_wpa_eap_required_but_ap_has_no_support, + core_connect_wpa_ap_has_no_valid_ciphers, + core_connect_wpa_counter_measures_active, + core_connect_wpa_authentication_canceled_by_user, + core_connect_wpa_eap_failure, + core_connect_wpa_psk_failure, + core_connect_802_1x_authentication_canceled_by_user, + core_connect_802_1x_authentication_algorithm_not_supported, + core_connect_802_1x_failure, + core_connect_eap_gtc_failure, + core_connect_eap_tls_failure, + core_connect_eap_tls_server_certificate_expired, + core_connect_eap_tls_server_certificate_unknown, + core_connect_eap_tls_user_certificate_expired, + core_connect_eap_tls_user_certificate_unknown, + core_connect_eap_tls_illegal_cipher_suite, + core_connect_eap_tls_user_rejected, + core_connect_eap_leap_failure, + core_connect_eap_sim_failure, + core_connect_eap_sim_identity_query_failed, + core_connect_eap_sim_user_has_not_subscribed_to_the_requested_service, + core_connect_eap_sim_users_calls_are_barred, + core_connect_eap_ttls_failure, + core_connect_eap_ttls_server_certificate_expired, + core_connect_eap_ttls_server_certificate_unknown, + core_connect_eap_ttls_user_certificate_expired, + core_connect_eap_ttls_user_certificate_unknown, + core_connect_eap_ttls_illegal_cipher_suite, + core_connect_eap_ttls_user_rejected, + core_connect_eap_aka_failure, + core_connect_eap_aka_identity_query_failed, + core_connect_eap_aka_user_has_not_subscribed_to_the_requested_service, + core_connect_eap_aka_users_calls_are_barred, + core_connect_eap_peap_failure, + core_connect_eap_peap_server_certificate_expired, + core_connect_eap_peap_server_certificate_unknown, + core_connect_eap_peap_user_certificate_expired, + core_connect_eap_peap_user_certificate_unknown, + core_connect_eap_peap_illegal_cipher_suite, + core_connect_eap_peap_user_rejected, + core_connect_eap_mschapv2_failure, + core_connect_eap_mschapv2_password_expired, + core_connect_eap_mschapv2_no_dialin_permission, + core_connect_eap_mschapv2_account_disabled, + core_connect_eap_mschapv2_restricted_logon_hours, + core_connect_eapol_auth_start_timeout, + core_connect_eap_fast_tunnel_compromise_error, + core_connect_eap_fast_unexpected_tlv_exhanged, + core_connect_eap_fast_no_pac_nor_certs_to_authenticate_with_provision_disabled, + core_connect_eap_fast_no_matching_pac_for_aid, + core_connect_eap_fast_pac_store_corrupted, + core_connect_eap_fast_authentication_failed, + core_connect_iap_wapi_but_ap_has_no_privacy, + core_connect_wapi_ie_required_but_ap_has_none, + core_connect_wapi_certificate_required_but_ap_has_no_support, + core_connect_wapi_psk_required_but_ap_has_no_support, + core_connect_wapi_ap_has_no_valid_ciphers, + core_connect_wapi_psk_failure, + core_connect_wapi_certificate_failure, + } core_connect_status_e; + +/** + * Possible completion status for a protected setup request. + */ +typedef enum _core_protected_setup_status_e + { + core_protected_setup_status_undefined, + core_protected_setup_status_ok, + core_protected_setup_status_session_overlap, + core_protected_setup_status_walktime_expired, + core_protected_setup_status_network_auth_failure, + core_protected_setup_status_network_assoc_failure, + core_protected_setup_status_OOB_interface_read_error, + core_protected_setup_status_decryption_CRC_failure, + core_protected_setup_status_RF_band_2_4_ghz_not_supported, + core_protected_setup_status_RF_band_5_0_ghz_not_supported, + core_protected_setup_status_signal_too_weak, + core_protected_setup_status_no_DHCP_response, + core_protected_setup_status_failed_DHCP_configure, + core_protected_setup_status_ip_address_conflict, + core_protected_setup_status_could_not_connect_to_registrar, + core_protected_setup_status_multiple_PBC_sessions_detected, + core_protected_setup_status_rogue_activity_suspected, + core_protected_setup_status_device_busy, + core_protected_setup_status_setup_locked, + core_protected_setup_status_message_timeout, + core_protected_setup_status_registration_session_timeout, + core_protected_setup_status_device_password_authentication_failure, + core_protected_setup_status_pin_code_authentication_not_supported, + core_protected_setup_status_push_button_authentication_not_supported + } core_protected_setup_status_e; + +typedef enum _core_rcp_class_e + { + core_rcp_normal, + core_rcp_weak + } core_rcp_class_e; + +/** + * Definitions for possible WLAN regions. + */ +typedef enum _core_wlan_region_e + { + /** Undefined region */ + core_wlan_region_undefined = 0x00, + /** Channels 1-11, USA */ + core_wlan_region_fcc = 0x10, + /** Channels 1-13, Europe */ + core_wlan_region_etsi = 0x30, + } core_wlan_region_e; + +typedef struct _core_wpa_preshared_key_s + { + /** The length of KeyMaterial in bytes. Range: 0-63 */ + uint_t key_length; + /** Array of that stores the WPA Pre-Shared Key. */ + u8_t key_data[MAX_WPA_PSK_LENGTH]; + } core_wpa_preshared_key_s; + +typedef enum _core_cipher_key_type_e + { + core_cipher_key_type_none, + core_cipher_key_type_tkip, + core_cipher_key_type_ccmp, + core_cipher_key_type_wep, + core_cipher_key_type_wpi, + } core_cipher_key_type_e; + +typedef enum _core_cipher_suite_e + { + core_cipher_suite_none = 0, + core_cipher_suite_wep40 = 1, + core_cipher_suite_wep104 = 2, + core_cipher_suite_tkip = 4, + core_cipher_suite_ccmp = 8, + core_cipher_suite_wpi = 16 + } core_cipher_suite_e; + +typedef enum _core_key_management_e + { + core_key_management_none = 0, + core_key_management_eap = 1, + core_key_management_preshared = 2, + core_key_management_wpx_fast_roam = 4, + core_key_management_wapi_certificate = 8, + core_key_management_wapi_psk = 16 + } core_key_management_e; + +/** + * Definitions for power save modes. + */ +typedef enum _core_power_save_mode_e + { + /** + * Automatic mode, wake-up mode and interval adjusted automatically. + */ + core_power_save_mode_automatic, + /** + * Continuous access mode (CAM), no power save. + */ + core_power_save_mode_none, + /** + * Power save, wake-up at every Nth beacon. + */ + core_power_save_mode_beacon, + /** + * Power save, wake-up at every Nth DTIM. + */ + core_power_save_mode_dtim, + /** + * Power save, wake-up at every Nth DTIM, where N is defined by + * DTIM skipping interval. + */ + core_power_save_mode_dtim_skipping + } core_power_save_mode_e; + +typedef enum _core_slot_time_e + { + core_slot_time_short, + core_slot_time_long + } core_slot_time_e; + +/** + * Possible 802.11b and 802.11g status codes + */ +typedef enum _core_management_status_e + { + core_management_status_success = 0, + core_management_status_unspecified_failure = 1, + // 2 - 9 are reserved. + core_management_status_unsupported_capabilities = 10, + core_management_status_reassociation_denied_other = 11, + core_management_status_association_denied_other = 12, + core_management_status_auth_algo_not_supported = 13, + core_management_status_auth_frame_out_of_sequence = 14, + core_management_status_auth_challenge_failure = 15, + core_management_status_auth_timeout = 16, + core_management_status_assoc_denied_full_ap = 17, + core_management_status_assoc_unsup_basic_rates = 18, + core_management_status_assoc_unsup_short_preamble = 19, + core_management_status_assoc_unsup_pbcc = 20, + core_management_status_assoc_unsup_channel_agility = 21, + // 22 - 24 reserved. + core_management_status_assoc_unsup_short_slot_time = 25, + core_management_status_assoc_unsup_dsss_ofdm = 26 + // 27 - 65,535 reserved + } core_management_status_e; + +/** + * The frame types the core server can send and receive. + */ +typedef enum _core_frame_type_e + { + core_frame_type_ethernet, + core_frame_type_dot11, + core_frame_type_snap, + core_frame_type_test + } core_frame_type_e; + +/** + * The possible physical medium types. + */ +typedef enum _core_phy_type_e + { + core_phy_type_ofdm, + core_phy_type_high_rate_dss, + core_phy_type_erp + } core_phy_type_e; + +/** + * operation types. + */ +typedef enum _core_operation_type_e + { + core_operation_unspecified, + core_operation_check_rcpi, + core_operation_configure_multicast_group, + core_operation_connect, + core_operation_get_available_iaps, + core_operation_get_rcpi, + core_operation_handle_bss_lost, + core_operation_handle_frame, + core_operation_handle_delete_ts, + core_operation_handle_measurement_request, + core_operation_handle_neighbor_response, + core_operation_ibss_merge, + core_operation_null, + core_operation_release, + core_operation_roam, + core_operation_scan, + core_operation_set_cipher_key, + core_operation_unload_drivers, + core_operation_update_device_settings, + core_operation_update_power_mode, + core_operation_update_rxtx_parameters, + core_operation_create_ts, + core_operation_delete_ts, + core_operation_get_statistics, + core_operation_set_uapsd_settings, + core_operation_set_power_save_settings, + core_operation_protected_setup, + core_operation_power_save_test, + core_operation_set_arp_filter, + core_operation_directed_roam, + /** Not a real operation, defined as upper bound. */ + core_operation_max + } core_operation_type_e; + +/** + * Defines the possible values of maximum service period length. + */ +typedef enum _core_max_service_period_length_e + { + core_max_service_period_length_all, + core_max_service_period_length_two, + core_max_service_period_length_four, + core_max_service_period_length_six + } core_max_service_period_length_e; + +/** + * Defines the possible QoS Access Classes. + */ +typedef enum _core_access_class_e + { + core_access_class_best_effort = 0, + core_access_class_background = 1, + core_access_class_video = 2, + core_access_class_voice = 3 + } core_access_class_e; + +/** + * Defines the possible TX rate values. + */ +typedef enum _core_tx_rate_e + { + core_tx_rate_none = 0x00000000, + core_tx_rate_1mbit = 0x00000001, + core_tx_rate_2mbit = 0x00000002, + core_tx_rate_5p5mbit = 0x00000004, + core_tx_rate_6mbit = 0x00000008, + core_tx_rate_9mbit = 0x00000010, + core_tx_rate_11mbit = 0x00000020, + core_tx_rate_12mbit = 0x00000040, + core_tx_rate_18mbit = 0x00000080, + core_tx_rate_22mbit = 0x00000100, + core_tx_rate_24mbit = 0x00000200, + core_tx_rate_33mbit = 0x00000400, + core_tx_rate_36mbit = 0x00000800, + core_tx_rate_48mbit = 0x00001000, + core_tx_rate_54mbit = 0x00002000 + } core_tx_rate_e; + +const u32_t CORE_TX_RATES_802P11B = + core_tx_rate_1mbit | + core_tx_rate_2mbit | + core_tx_rate_5p5mbit | + core_tx_rate_11mbit; + +const u32_t CORE_TX_RATES_802P11G = + core_tx_rate_6mbit | + core_tx_rate_9mbit | + core_tx_rate_12mbit | + core_tx_rate_18mbit | + core_tx_rate_22mbit | + core_tx_rate_24mbit | + core_tx_rate_33mbit | + core_tx_rate_36mbit | + core_tx_rate_48mbit | + core_tx_rate_54mbit; + +const u32_t CORE_TX_RATES_802P11BG = + CORE_TX_RATES_802P11B | + CORE_TX_RATES_802P11G; + +/** + * Define the possible TX rate value as units of 500kbit/s. + */ +typedef enum _core_tx_rate_value_e + { + core_tx_rate_value_none = 0, + core_tx_rate_value_1mbit = 2, + core_tx_rate_value_2mbit = 4, + core_tx_rate_value_5p5mbit = 11, + core_tx_rate_value_6mbit = 12, + core_tx_rate_value_9mbit = 18, + core_tx_rate_value_11mbit = 22, + core_tx_rate_value_12mbit = 24, + core_tx_rate_value_18mbit = 36, + core_tx_rate_value_22mbit = 44, + core_tx_rate_value_24mbit = 48, + core_tx_rate_value_33mbit = 66, + core_tx_rate_value_36mbit = 72, + core_tx_rate_value_48mbit = 96, + core_tx_rate_value_54mbit = 108, + } _core_tx_rate_value_e; + +/** + * The possible statuses of a virtual traffic stream. + */ +typedef enum _core_traffic_stream_status_e + { + /** + * Initialization value, never returned as a status. + */ + core_traffic_stream_status_undefined, + /** + * The traffic stream is active in the current access point. + */ + core_traffic_stream_status_active, + /** + * The traffic stream is not active in the current access point + * because the AP doesn't require admission control. + */ + core_traffic_stream_status_inactive_not_required, + /** + * The traffic stream is not active in the current access point + * because the AP has deleted the traffic stream. + */ + core_traffic_stream_status_inactive_deleted_by_ap, + /** + * The traffic stream is not active in the current access point + * because the AP has refused the traffic stream request due to + * insufficient over-the-air bandwidth. + */ + core_traffic_stream_status_inactive_no_bandwidth, + /** + * The traffic stream is not active in the current access point + * because the AP has refused the traffic stream request due to + * invalid traffic stream parameters. + */ + core_traffic_stream_status_inactive_invalid_parameters, + /** + * The traffic stream is not active in the current access point + * because the AP has refused the traffic stream request due to + * other reasons. + */ + core_traffic_stream_status_inactive_other + } core_traffic_stream_status_e; + +/** + * The possible reasons for a roam. + */ + typedef enum _core_roam_reason_e + { + /** Initial value if no roaming has been done. */ + core_roam_reason_none, + /** Initial connection attempt. */ + core_roam_reason_initial_connect, + /** Connection to the previous AP has been lost. */ + core_roam_reason_bss_lost, + /** The previous AP has deauthenticated us. */ + core_roam_reason_media_disconnect, + /** Signal strength was too low. */ + core_roam_reason_signal_strength, + /** Signal loss was predicted. */ + core_roam_reason_signal_loss_prediction, + /** Failed EAPOL reauthentication. */ + core_roam_reason_failed_reauthentication, + /** Due to directed roam request. */ + core_roam_reason_directed_roam, + /** Not a real reason, defined as an upper bound. */ + core_roam_reason_max + } core_roam_reason_e; + +/** + * The possible reasons for a failed roaming attempt. + */ + typedef enum _core_roam_failed_reason_e + { + /** Initial value if no roaming has been done. */ + core_roam_failed_reason_none, + /** Authentication or (re-)association has timed out. */ + core_roam_failed_reason_timeout, + /** No suitable AP found either due to an empty scan or blacklisting. */ + core_roam_failed_reason_no_suitable_ap, + /** AP has rejected authentication or (re-)association with a status code. */ + core_roam_failed_reason_ap_status_code, + /** EAPOL authentication has failed. */ + core_roam_failed_reason_eapol_failure, + /** Failures not covered by defined reasons above. */ + core_roam_failed_reason_other_failure, + /** Not a real reason, defined as an upper bound. */ + core_roam_failed_reason_max + } core_roam_failed_reason_e; + +/** + * The possible reasons why a connection was released. + */ + typedef enum _core_release_reason_e + { + /** Release was requested by an external party. */ + core_release_reason_external_request, + /** Maximum number of roaming attempts was exceeded. */ + core_release_reason_max_roam_attempts_exceeded, + /** Release was due to a HW failure indication. */ + core_release_reason_hw_failure, + /** Release was due to TKIP MIC failure. */ + core_release_reason_tkip_mic_failure, + /** Reasons not covered by defined reasons above. */ + core_release_reason_other, + /** Not a real reason, defined as an upper bound. */ + core_release_reason_max + } core_release_reason_e; + +/** + * The possible reasons an access point was blacklisted. + */ +typedef enum _core_ap_blacklist_reason_e + { + /** No blacklisting required. */ + core_ap_blacklist_reason_none = 0, + /** Blacklisting was requested by an external party. */ + core_ap_blacklist_reason_external = 1, + /** Blacklisting was based on failed WPA/802.1x authentication. */ + core_ap_blacklist_reason_eapol_failure = 2, + /** Blacklisting was based on association response status. */ + core_ap_blacklist_reason_association_status = 4, + /** Blacklisting due to exceeded max_ap_association_failure_count. */ + core_ap_blacklist_reason_max_association_failure_count = 8, + /** Blacklisting due to exceeded max_ap_deauthentication_count. */ + core_ap_blacklist_reason_max_deauthentication_count = 16, + /** Not a real reason, defined as an upper bound. */ + core_ap_blacklist_reason_max + } core_ap_blacklist_reason_e; + +/** + * Defines the operating modes of EAPOL stack. + */ +typedef enum _core_eapol_operating_mode_e + { + core_eapol_operating_mode_wfa, + core_eapol_operating_mode_wapi + } core_eapol_operating_mode_e; + +/** + * Definitions for possible power modes. + */ +typedef enum _core_power_mode_e + { + /** Continuous access mode (CAM), no power save. */ + core_power_mode_cam, + /** Power save mode (PS). */ + core_power_mode_ps + } core_power_mode_e; + +/** + * Definitions for power save wake-up modes. + */ +typedef enum _core_power_save_wakeup_mode_e + { + /** Wake-up at every Nth beacon. */ + core_power_save_wakeup_mode_beacon, + /** Wake-up at every Nth DTIM. */ + core_power_save_wakeup_mode_dtim + } core_power_save_wakeup_mode_e; + +/** + * Definitions for run-time feature configuration flags. + */ +typedef enum _core_feature_e + { + /** No configurable features enabled. */ + core_feature_none = 0, + /** Power save test enabled. */ + core_feature_power_save_test = 1, + /** 802.11k support enabled. */ + core_feature_802dot11k = 2 + } core_feature_e; + +/** + * Definitions for possible traffic modes for an access class. + */ +typedef enum _core_access_class_traffic_mode_e + { + /** Automatic traffic stream creation is allowed. */ + core_access_class_traffic_mode_automatic, + /** Automatic traffic stream creation is NOT allowed. */ + core_access_class_traffic_mode_manual + } core_access_class_traffic_mode_e; + +/** + * Definitions for possible traffic statuses for an access class. + */ +typedef enum _core_access_class_traffic_status_e + { + /** + * Traffic for this access class has been admitted. + */ + core_access_class_traffic_status_admitted, + /** + * Traffic for this access class has NOT been admitted, + * traffic needs to be downgraded to a lower access class. + */ + core_access_class_traffic_status_not_admitted + } core_access_class_traffic_status_e; + +/** + * Enumeration for traffic stream direction. + */ +typedef enum _core_traffic_stream_direction_e + { + /** Admission is requested for uplink traffic. */ + core_traffic_stream_direction_uplink = 0, + /** Admission is requested for downlink traffic. */ + core_traffic_stream_direction_downlink = 1, + /** Admission is requested for both uplink and downlink traffic. */ + core_traffic_stream_direction_bidirectional = 3 + } core_traffic_stream_direction_e; + +/** + * Structure for storing WLAN packet statistics. + */ +struct core_packet_statistics_s + { + /** + * Number of successfully received data frames. + */ + u32_t rx_frames; + /** + * Number of sent data frames. + */ + u32_t tx_frames; + /** + * Number of successfully received multicast data frames. + */ + u32_t rx_multicast_frames; + /** + * Number of sent multicast data frames. + */ + u32_t tx_multicast_frames; + /** + * Number of received frames with FCS errors. + */ + u32_t fcs_errors; + /** + * Total number of retransmissions done. + */ + u32_t tx_retries; + /** + * Number of data frames that could not be to delivered. + */ + u32_t tx_errors; + }; + +/** + * Structure for storing WLAN packet statistics per access category. + */ + struct core_packet_statistics_for_access_category_s + { + /** + * Number of successfully received data frames. + */ + u32_t rx_frames; + /** + * Number of sent data frames. + */ + u32_t tx_frames; + /** + * Number of successfully received multicast data frames. + */ + u32_t rx_multicast_frames; + /** + * Number of sent multicast data frames. + */ + u32_t tx_multicast_frames; + /** + * Total number of retransmissions done. + */ + u32_t tx_retries; + /** + * Number of data frames that could not be to delivered. + */ + u32_t tx_errors; + /** + * Average data frame Transmit / Media Delay in microseconds. + */ + u32_t tx_media_delay; + /** + * Average data frame Total Transmit Delay in microseconds. + */ + u32_t tx_total_delay; + /** + * Number of frame whose whose total transmit delay was <= 10ms. + */ + u32_t tx_total_delay_bin0; + /** + * Number of frame whose whose total transmit delay was ]10,20]ms. + */ + u32_t tx_total_delay_bin1; + /** + * Number of frame whose whose total transmit delay was ]20,40]ms. + */ + u32_t tx_total_delay_bin2; + /** + * Number of frame whose whose total transmit delay was > 40ms. + */ + u32_t tx_total_delay_bin3; + }; + +/** + * Structure for storing WLAN packet statistics for all the access categories. + */ + struct core_packet_statistics_by_access_category_s + { + /** + * Statistics per access category. + */ + core_packet_statistics_for_access_category_s ac[MAX_QOS_ACCESS_CLASS]; + /** + * Number of received frames with FCS errors. + */ + u32_t fcs_errors; + }; + +/** + * Structure for storing U-APSD settings for the access categories. + */ +struct core_uapsd_settings_s + { + /** + * Defines the maximum number of frames to send during a service period. + */ + core_max_service_period_length_e max_service_period; + /** + * Whether U-APSD is trigger and delivery-enabled for Voice. + */ + bool_t uapsd_enabled_for_voice; + /** + * Whether U-APSD is trigger and delivery-enabled for Video. + */ + bool_t uapsd_enabled_for_video; + /** + * Whether U-APSD is trigger and delivery-enabled for BestEffort. + */ + bool_t uapsd_enabled_for_best_effort; + /** + * Whether U-APSD is trigger and delivery-enabled for Background. + */ + bool_t uapsd_enabled_for_background; + }; + +/** + * Structure for storing parameters related to AP lost indications. + */ +struct core_bss_lost_parameters_s + { + /** + * The number of consecutive beacons that can be lost before + * core_am_indication_wlan_beacon_lost is indicated. + */ + u32_t beacon_lost_count; + /** + * The number of consecutive transmissions that can fail + * before core_am_indication_wlan_tx_fail indicated. + */ + u8_t failed_tx_packet_count; + }; + +/** + * Structure for storing parameters related to tx rate adaptation algorithm. + */ +struct core_tx_rate_adaptation_parameters_s + { + /** + * Minimum and initial rate increase checkpoint in units of frames. + */ + u8_t min_stepup_checkpoint; + /** + * Maximum rate increase checkpoint in units of frames. + */ + u8_t max_stepup_checkpoint; + /** + * Rate increase checkpoint is multiplied with this value if sending of a probe frame fails. + */ + u8_t stepup_checkpoint_factor; + /** + * After this many frames the need to decrease the rate is checked. + */ + u8_t stepdown_checkpoint; + /** + * Minimum and initial rate increase threshold percentage. + */ + u8_t min_stepup_threshold; + /** + * Maximum rate increase threshold percentage value. + */ + u8_t max_stepup_threshold; + /** + * Rate increase threshold is incremented by this value if sending of a probe frame fails. + */ + u8_t stepup_threshold_increment; + /** + * Rate decrease threshold percentage. + */ + u8_t stepdown_threshold; + /** + * If false_t, the rate adaptation algorithm handles the first frame transmitted after a + * rate increase in a special way. + */ + bool_t disable_probe_handling; + }; + +/** + * Structure for storing parameters related to power mode management algorithm. + */ +struct core_power_mode_mgmt_parameters_s + { + /** + * Time interval in microseconds after which transition from Active mode + * to Light PS mode is considered. + */ + u32_t active_to_light_timeout; + /** + * Frame count threshold used when considering transition from Active + * to Light PS mode. + */ + u16_t active_to_light_threshold; + /** + * Time interval in microseconds after which the frame counter used when + * considering transition from Light PS to Active mode is reset. + */ + u32_t light_to_active_timeout; + /** + * Frame count threshold used when considering transition from Light PS + * to Active mode. + */ + u16_t light_to_active_threshold; + /** + * Time interval in microseconds after which transition from Light PS mode + * to Deep PS mode is considered. + */ + u32_t light_to_deep_timeout; + /** + * Frame count threshold used when considering transition from Light PS + * to Deep PS mode. + */ + u16_t light_to_deep_threshold; + /** + * Received frame payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category. + */ + u16_t uapsd_rx_frame_length_threshold; + }; + +struct core_device_settings_s + { + u32_t beacon; ///< IBSS beacon interval in TUs. + u32_t long_retry; ///< How many times packets bigger than 'rts' will be resent. + u32_t short_retry; ///< How many times packets smaller than 'rts' will be resent. + u32_t rts; ///< Minimum size of a packet for CTS/RTS handshake. + u32_t tx_power_level; ///< Maximum allowed transmission power level in dBm. + u32_t scan_rate; ///< Data rate used to send probe requests. + ///< The rate is defined in units of 500kbit/s. + u32_t rcpi_trigger; ///< Roaming is attemped when RCPI value is lower than this. + u32_t active_scan_min_ch_time; ///< Min time (TUs) to listen a channel in active scanning. + u32_t active_scan_max_ch_time; ///< Max time (TUs) to listen a channel in active scanning. + u32_t passive_scan_min_ch_time; ///< Min time (TUs) to listen a channel in passive scanning. + u32_t passive_scan_max_ch_time; ///< Max time (TUs) to listen a channel in passive scanning. + u32_t max_tx_msdu_life_time; ///< Max time (TUs) to (re-)send one (fragmented) packet. + u32_t unload_driver_timer; ///< Number of seconds to wait before unloading WLAN drivers + ///< if no WLAN connection is active. + u32_t roam_timer; ///< Defines how often to search for a better AP in poor + ///< signal conditions. The value is in microseconds. + u32_t rcpi_difference; ///< Difference in dBm required between an AP and the current + ///< AP before roaming is attemped. + u32_t max_tries_to_find_nw; ///< Defines how many are made to find a suitable AP before + ///< giving up during initial connect. + u32_t delay_between_find_nw; ///< Defines the amount of microseconds to wait between + ///< initial connection attempts. + bool_t power_save_enabled; ///< true_t if WLAN power save is allowed, false_t if not. + bool_t allow_radio_measurements; ///< true_t if radio measurements are allowed, false_t if not. + u32_t max_ap_association_failure_count; ///< Number of times association may fail before the AP + ///< is blacklisted for the duration of the connection. + u32_t max_ap_authentication_failure_count; ///< Number of times authentication may fail before the AP + ///< is blacklisted for the duration of the connection. + u32_t max_ap_deauthentication_count; ///< The maximum number of times AP can deauthenticate the + ///< terminal within ap_deauthentication_timeout after a + ///< successful roam before it's blacklisted for the + ///< duration of the connection. + u32_t ap_deauthentication_timeout; ///< Deauthentication within this many microseconds after + ///< a successful roam is calculated towards AP's + ///< deauthentication count. + u32_t long_beacon_find_count; ///< Number of attempts to find an AP with long beacon + ///< interval. + u32_t qos_null_frame_interval; ///< Defines how often (in microseconds) a QoS NULL data frame + ///< is sent during a VoIP call if no other frames to send. + u32_t qos_null_frame_exit_timeout; ///< Defines how soon after the last Voice AC packet QoS NULL + ///< data frame sending is stopped (in microseconds). + u32_t qos_null_frame_entry_timeout; ///< Defines the time period in microseconds which is used + ///< to evaluate whether QoS NULL data frame sending should + ///< be started. + u32_t qos_null_frame_entry_tx_count; ///< Defines how many Voice AC packets must be sent during + ///< the time period defined in qos_null_frame_entry_timeout + ///< before QoS NULL data frame sending is started. + u32_t keep_alive_interval; ///< How often NULL data frames are sent when nothing is being + ///< transmitted. The value is in microseconds. + u32_t scan_stop_rcpi_threshold; ///< If AP RCPI value is better than this, roaming scan can be + ///< stopped. + u32_t iap_availability_rcpi_threshold; ///< If AP RCPI value is less than this, IAP will not marked + ///< as active. + u32_t sp_rcpi_target; ///< Defines the signal predictor algorithm "target" RCPI + ///< value for roam indication. + u32_t sp_time_target; ///< Defines the signal predictor algorithm "target" time for + //// roam indication (in microseconds). + u32_t sp_min_indication_interval; ///< Defines the minimum time interval for consecutive roam + ///< indications from the signal predictor algorithm + ///< (in microseconds). + u32_t scan_list_expiration_time; ///< This value defines how long beacons/probe responses are + ///< stored in the internal scan list (in microseconds). + u32_t rcpi_roam_min_interval; ///< Minimum delay between RCPI checks (in microseconds). + u32_t rcpi_roam_max_interval; ///< Maximum delay between RCPI checks (in microseconds). + u32_t rcpi_roam_attempts_per_interval; ///< Number of times to try with the current interval value. + u32_t rcpi_roam_next_interval_factor; ///< The current interval value is multiplied by this factor + ///< to get the next interval value. + u32_t rcpi_roam_next_interval_addition; ///< This value is added to the multiplied interval value + ///< (in microseconds). + u32_t bss_lost_roam_min_interval; ///< Minimum delay between roam attempts due to BSS lost. + u32_t bss_lost_roam_max_interval; ///< Maximum delay between roam attempts due to BSS lost. + u32_t bss_lost_roam_attempts_per_interval; ///< Number of times to try with the current interval value. + u32_t bss_lost_roam_next_interval_factor; ///< The current interval value is multiplied by this factor + ///< to get the next interval value. + u32_t bss_lost_roam_next_interval_addition; ///< This value is added to the multiplied interval value + ///< (in microseconds). + u32_t bss_lost_roam_max_tries_to_find_nw; ///< Defines how many are made to find a suitable AP before + ///< giving up during BSS lost. + u32_t max_dtim_skip_interval; ///< Maximum amount of microseconds to sleep when waking up + ///< on DTIMs. Zero value means waking up on every DTIM. + u32_t ps_active_to_light_timeout; ///< Time interval in microseconds after which transition + ///< from Active mode to Light PS mode is considered. + u16_t ps_active_to_light_threshold; ///< Frame count threshold used when considering transition + ///< from Active to Light PS mode. + u32_t ps_light_to_active_timeout; ///< Time interval in microseconds after which the frame counter + ///< used when considering transition from Light PS to Active mode is reset. + u16_t ps_light_to_active_threshold; ///< Frame count threshold used when considering transition + ///< from Light PS to Active mode. + u32_t ps_light_to_deep_timeout; ///< Time interval in microseconds after which transition + ///< from Light PS mode to Deep PS mode is considered. + u16_t ps_light_to_deep_threshold; ///< Frame count threshold used when considering transition + ///< from Light PS to Deep PS mode. + u16_t ps_uapsd_rx_frame_length; ///< Received frame payload length (in bytes) threshold in + ///< U-APSD network for Best Effort Access Category. + u32_t rrm_min_measurement_interval; ///< This value defines how often 802.11k Measurement Request are accepted. + ///< The value is in microseconds. If zero, request coming with any + ///< interval are accepted. + }; + +struct core_iap_data_s + { + /** ID of the IAP in CommsDB. */ + u32_t id; + /** Is the connection mode IBSS or Infrastructure. */ + core_operating_mode_e op_mode; + /** Name of the network. */ + core_ssid_s ssid; + /** Is SSID hidden */ + bool_t is_hidden; + /** WEP key 1. */ + core_wep_key_s wep_key1; + /** WEP key 2. */ + core_wep_key_s wep_key2; + /** WEP key 3. */ + core_wep_key_s wep_key3; + /** WEP key 4. */ + core_wep_key_s wep_key4; + /** Default WEP key id. */ + u32_t default_wep_key; + /** Security mode. */ + core_security_mode_e security_mode; + /** Authentication mode (open, shared). */ + core_authentication_mode_e authentication_mode; + /** Is preshared key in use (ETrue) or not (EFalse). */ + bool_t wpa_preshared_key_in_use; + /** Is WPA settings overriden or not. */ + bool_t is_wpa_overriden; + /** Overridden WPA PSK */ + core_wpa_preshared_key_s wpa_preshared_key; + /** Used channel in IBSS (ad-hoc) mode */ + u32_t used_adhoc_channel; + /** Is IP address configured dynamically. */ + bool_t is_dynamic_ip_addr; + /** Is roaming between APs allowed. */ + bool_t is_roaming_allowed; + /** ID of the IAP. */ + u32_t iap_id; + }; + +/** + * Struct containing SSIDs related to secondary SSID feature. + */ +struct core_ssid_entry_s + { + /** ID of the IAP this entry refers to. */ + u32_t id; + /** Defines the SSID to look for in the scan results. */ + core_ssid_s ssid; + /** Defines the SSID used for connecting. */ + core_ssid_s used_ssid; + }; + +struct core_scan_channels_s + { + u8_t band; ///< 1 = 2.4GHz, 2 = 4.9GHz, 4 = 5GHz + u8_t channels2dot4ghz[2]; + u8_t channels4dot9ghz[3]; + u8_t channels5ghz[26]; + }; + +const core_scan_channels_s SCAN_CHANNELS_2DOT4GHZ_US = + { SCAN_BAND_2DOT4GHZ, { 0xFF, 0x07 }, { 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; + +const core_scan_channels_s SCAN_CHANNELS_2DOT4GHZ_ETSI = + { SCAN_BAND_2DOT4GHZ, { 0xFF, 0x1F }, { 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; + +/** + * Structure for storing 802.11d country strings. + */ +struct core_country_string_s + { + u8_t country[MAX_COUNTRY_STRING_LENGTH]; + }; + +/** Definition for an empty country string. */ +const core_country_string_s COUNTRY_STRING_NONE = { 0, 0, 0 }; + +/** AP country information for Canada, North America, Taiwan, Brazil, Argentina, Mexico and Colombia. */ +const core_country_string_s country_info_table[] = { {'C','A','0'}, {'U','S','0'}, {'V','I','0'}, {'T','W','0'}, {'B','R','0'}, {'A','R','0'}, {'M','X','0'}, {'C','O','0'} }; +const u8_t country_info_table_length = 8; + +/** + * Structure for storing a single TX rate policy. + */ +struct core_tx_rate_policy_s + { + /** Number of attempts to transmit at 54 Mbits/s. */ + u8_t tx_policy_54; + /** Number of attempts to transmit at 48 Mbits/s. */ + u8_t tx_policy_48; + /** Number of attempts to transmit at 36 Mbits/s. */ + u8_t tx_policy_36; + /** Number of attempts to transmit at 33 Mbits/s. */ + u8_t tx_policy_33; + /** Number of attempts to transmit at 24 Mbits/s. */ + u8_t tx_policy_24; + /** Number of attempts to transmit at 22 Mbits/s. */ + u8_t tx_policy_22; + /** Number of attempts to transmit at 18 Mbits/s. */ + u8_t tx_policy_18; + /** Number of attempts to transmit at 12 Mbits/s. */ + u8_t tx_policy_12; + /** Number of attempts to transmit at 11 Mbits/s. */ + u8_t tx_policy_11; + /** Number of attempts to transmit at 9 Mbits/s. */ + u8_t tx_policy_9; + /** Number of attempts to transmit at 6 Mbits/s. */ + u8_t tx_policy_6; + /** Number of attempts to transmit at 5.5 Mbits/s. */ + u8_t tx_policy_5p5; + /** Number of attempts to transmit at 2 Mbits/s. */ + u8_t tx_policy_2; + /** Number of attempts to transmit at 1 Mbits/s. */ + u8_t tx_policy_1; + /** Number of retransmissions to packets that are smaller than RTS. */ + u8_t short_retry_limit; + /** Number of retransmissions to packets that are bigger than RTS. */ + u8_t long_retry_limit; + /** Flags defined in HAL API that apply to this policy. */ + u32_t flags; + /** Initial TX rate used for transmitting. */ + core_tx_rate_e initial_tx_rate; + /** TX rate mask for auto rate policy. */ + u32_t tx_auto_rate_policy; + /** Bitmap of enabled 802.11n modulation and coding schemes. */ + u8_t mcs_set[TX_RATE_POLICY_MCS_SIZE]; + }; + +/** + * Structure for storing a group of TX rate policies. + */ +struct core_tx_rate_policies_s + { + /** Number of TX rate policies in the array. */ + u8_t policy_count; + /** Array of TX rate policies. */ + core_tx_rate_policy_s policy[MAX_TX_RATE_POLICY]; + }; + +/** + * Structure for storing mappings between QoS Access Classes and TX rate policies. + */ +struct core_tx_rate_policy_mappings_s + { + u8_t policy_for_best_effort; + u8_t policy_for_background; + u8_t policy_for_video; + u8_t policy_for_voice; + }; + +/** + * Structure for storing traffic stream parameters. + */ +struct core_traffic_stream_params_s + { + /** + * Whether the traffic pattern is periodic or aperiodic. + */ + bool_t is_periodic_traffic; + /** + * Traffic stream direction. + */ + core_traffic_stream_direction_e direction; + /** + * The current value of Nominal MSDU Size. + */ + u16_t nominal_msdu_size; + /** + * The current value of Maximum MSDU Size. + */ + u16_t maximum_msdu_size; + /** + * The current value of Minimum Service Interval. + */ + u32_t minimum_service_interval; + /** + * The current value of Maximum Service Interval. + */ + u32_t maximum_service_interval; + /** + * The current value of Inactivity Interval. + */ + u32_t inactivity_interval; + /** + * The current value of Suspension Interval. + */ + u32_t suspension_interval; + /** + * The current value of Service Start Time. + */ + u32_t service_start_time; + /** + * The current value of Minimum Data Rate. + */ + u32_t minimum_data_rate; + /** + * The current value of Mean Data Rate. + */ + u32_t mean_data_rate; + /** + * The current value of Peak Data Rate. + */ + u32_t peak_data_rate; + /** + * The current value of Maximum Burst Size. + */ + u32_t maximum_burst_size; + /** + * The current value of Delay Bound + */ + u32_t delay_bound; + /** + * The current value of Minimum PHY Rate. + */ + u32_t minimum_phy_rate; + /** + * The current value of Nominal PHY Rate in units + */ + core_tx_rate_e nominal_phy_rate; + /** + * The current value of Bandwidth Allowance. + */ + u16_t surplus_bandwidth_allowance; + /** + * Whether re-creation of traffic streams is allowed. + */ + bool_t is_retry_allowed; + /** + * The current value of Medium Time. + */ + u16_t medium_time; + /** + * The tx rates to be used with this AC, 0 if defaults are used. + */ + u32_t override_rates; + /** + * The Maximum Transmit MSDU Lifetime, 0 if default is used. + */ + u32_t override_max_tx_msdu_lifetime; + }; + +/** + * Structure for storing information about channels that have + * APs with long beacon intervals. + */ +struct core_long_beacon_interval_channels_s + { + u8_t channel_scan_count[SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO]; + }; + +/** + * Structure for storing power save settings for the access categories. + */ +struct core_power_save_settings_s + { + /** Whether the terminal stays in U-APSD power save when using Voice. */ + bool_t stay_in_uapsd_power_save_for_voice; + /** Whether the terminal stays in U-APSD power save when using Video. */ + bool_t stay_in_uapsd_power_save_for_video; + /** Whether the terminal stays in U-APSD power save when using BestEffort. */ + bool_t stay_in_uapsd_power_save_for_best_effort; + /** Whether the terminal stays in U-APSD power save when using Background. */ + bool_t stay_in_uapsd_power_save_for_background; + /** Whether the terminal stays in legacy power save when using Voice. */ + bool_t stay_in_legacy_power_save_for_voice; + /** Whether the terminal stays in legacy power save when using Video. */ + bool_t stay_in_legacy_power_save_for_video; + /** Whether the terminal stays in legacy power save when using BestEffort. */ + bool_t stay_in_legacy_power_save_for_best_effort; + /** Whether the terminal stays in legacy power save when using Background. */ + bool_t stay_in_legacy_power_save_for_background; + }; + +/** + * Structure for storing RCPI roam interval parameters. + */ +struct core_rcpi_roam_interval_s + { + /** Number of times the current interval has been tried. */ + u32_t count; + /** The current interval value. */ + u32_t interval; + }; + +/** + * Structure for storing information about an access point. + */ +struct core_ap_information_s + { + /** The SSID of the AP. */ + core_ssid_s ssid; + /** The BSSID of the AP. */ + core_mac_address_s bssid; + /** Capabilities of the AP. */ + u16_t capabilities; + /** The channel AP is on. */ + u8_t channel; + /** The received channel power indicator (RCPI). */ + u8_t rcpi; + /** Basic rates of the AP. */ + u32_t basic_rates; + /** Supported rates of the AP. */ + u32_t supported_rates; + /** The security mode of the AP. */ + core_connection_security_mode_e security_mode; + /** Whether the AP supports WPX. */ + bool_t is_wpx; + /** Whether Admission Control must be used with Voice. */ + bool_t is_ac_required_for_voice; + /** Whether Admission Control must be used with Video. */ + bool_t is_ac_required_for_video; + /** Whether Admission Control must be used with BestEffort. */ + bool_t is_ac_required_for_best_effort; + /** Whether Admission Control must be used with Background. */ + bool_t is_ac_required_for_background; + }; + +/** + * Structure for storing roaming metrics information. + */ +struct core_roam_metrics_s + { + /** Connection attempt total counter. */ + u32_t connection_attempt_total_count; + /** Unsuccesfull connection attempt counter. */ + u32_t unsuccesfull_connection_attempt_count; + /** Roaming counter. */ + u32_t roaming_counter; + /** Coverage loss counter. */ + u32_t coverage_loss_count; + + /** The total duration (ms) of the last roaming (= data path broken time + scanning time). */ + u32_t last_roam_total_duration; + /** The duration (ms) how long the data path was broken during the last roaming. */ + u32_t last_roam_data_path_broken_duration; + /** The cause for the last roaming. */ + core_roam_reason_e last_roam_reason; + }; + +/** + * Structure for storing parameters related to power save mode. + */ +struct core_power_save_mode_s + { + /** The power save mode to use. */ + core_power_save_mode_e mode; + /** + * The wake-up interval. + * @note This parameter is only applicable if the mode is + * core_power_save_mode_beacon or core_power_save_mode_dtim, + * otherwise it should set to zero. + */ + u8_t wakeup_interval; + }; + +const core_power_save_mode_s CORE_POWER_SAVE_MODE_EVERY_BEACON = + { core_power_save_mode_beacon, 1 }; +const core_power_save_mode_s CORE_POWER_SAVE_MODE_EVERY_DTIM = + { core_power_save_mode_dtim, 1 }; +const core_power_save_mode_s CORE_POWER_SAVE_MODE_NONE = + { core_power_save_mode_none, 0 }; +const core_power_save_mode_s CORE_POWER_SAVE_MODE_AUTOMATIC = + { core_power_save_mode_automatic, 0 }; +const core_power_save_mode_s CORE_POWER_SAVE_MODE_DTIM_SKIPPING = + { core_power_save_mode_dtim_skipping, 0 }; + +/** + * Structure for storing parameters related to power mode. + */ +struct core_power_mode_s + { + /** The power mode to use. */ + core_power_mode_e mode; + /** Disable dynamic power save management. */ + bool_t disable_dynamic_ps; + /** Defines the wake-up mode for Light PS mode. */ + core_power_save_wakeup_mode_e wakeup_mode_light; + /** Defines the wake-up interval (N) for Light PS mode. */ + u8_t wakeup_interval_light; + /** Defines the wake-up mode for Deep PS mode. */ + core_power_save_wakeup_mode_e wakeup_mode_deep; + /** Defines the wake-up interval (N) for Deep PS mode. */ + u8_t wakeup_interval_deep; + }; + +const core_power_mode_s CORE_POWER_MODE_CAM = + { core_power_mode_cam, true_t, core_power_save_wakeup_mode_beacon, 1, core_power_save_wakeup_mode_beacon, 1 }; +const core_power_mode_s CORE_POWER_MODE_PS = + { core_power_mode_ps, false_t, core_power_save_wakeup_mode_beacon, 1, core_power_save_wakeup_mode_dtim, 1 }; +const core_power_mode_s CORE_POWER_MODE_PS_BEACON = + { core_power_mode_ps, true_t, core_power_save_wakeup_mode_beacon, 1, core_power_save_wakeup_mode_beacon, 1 }; +const core_power_mode_s CORE_POWER_MODE_PS_DTIM = + { core_power_mode_ps, true_t, core_power_save_wakeup_mode_dtim, 1, core_power_save_wakeup_mode_dtim, 1 }; + +/** + * Structure for storing an access point blacklist entry. + */ +struct core_ap_blacklist_entry_s + { + /** BSSID of the AP. */ + core_mac_address_s bssid; + /** Reason the AP was blacklisted. */ + core_ap_blacklist_reason_e reason; + }; + +/** + * Structure for storing block ACK usage information. + */ +struct core_block_ack_usage_s + { + /** Bitmap of TIDs where TX block ACK is allowed. */ + u8_t tx_usage; + /** Bitmap of TIDs where RX block ACK is allowed. */ + u8_t rx_usage; + }; + +/** + * Structure for storing a SNAP header. + */ +struct core_snap_header_s + { + /** Destination Service Access Point. */ + u8_t dsap; + /** Source Service Access Point. */ + u8_t ssap; + /** Control Field. */ + u8_t control; + /** Organizationally Unique Identifier (OUI). */ + u8_t oui[OUI_LENGTH]; + }; + +/** + * Structure for access class traffic statuses and traffic modes. + */ +struct core_ac_traffic_information_s + { + /** Current traffic status for Voice. */ + core_access_class_traffic_status_e status_for_voice; + /** Current traffic status for Video. */ + core_access_class_traffic_status_e status_for_video; + /** Current traffic status for BestEffort. */ + core_access_class_traffic_status_e status_for_best_effort; + /** Current traffic status for Background. */ + core_access_class_traffic_status_e status_for_background; + /** Current traffic mode for Voice. */ + core_access_class_traffic_mode_e mode_for_voice; + /** Current traffic mode for Video. */ + core_access_class_traffic_mode_e mode_for_video; + /** Current traffic mode for BestEffort. */ + core_access_class_traffic_mode_e mode_for_best_effort; + /** Current traffic mode for Background. */ + core_access_class_traffic_mode_e mode_for_background; + }; + +/** + * Enums for WLAN Engine - EAPOL interface datatypes. + */ + +typedef enum _wlan_eapol_if_eap_protocol_layer_e + { + wlan_eapol_if_eap_protocol_layer_none, + wlan_eapol_if_eap_protocol_layer_general, + wlan_eapol_if_eap_protocol_layer_internal_type, + wlan_eapol_if_eap_protocol_layer_am_eap_type, + wlan_eapol_if_eap_protocol_layer_radius, + wlan_eapol_if_eap_protocol_layer_eap_type, + wlan_eapol_if_eap_protocol_layer_eap, + wlan_eapol_if_eap_protocol_layer_eapol, + wlan_eapol_if_eap_protocol_layer_eapol_key, + wlan_eapol_if_eap_protocol_layer_ethernet, + wlan_eapol_if_eap_protocol_layer_wlan_authentication, + wlan_eapol_if_eap_protocol_layer_authentication_server, + wlan_eapol_if_eap_protocol_layer_wapi + } wlan_eapol_if_eap_protocol_layer_e; + +typedef enum _wlan_eapol_if_eapol_key_authentication_mode_e + { + wlan_eapol_if_eapol_key_authentication_mode_none, + wlan_eapol_if_eapol_key_authentication_mode_open, + wlan_eapol_if_eapol_key_authentication_mode_shared, + wlan_eapol_if_eapol_key_authentication_mode_wpx, + } wlan_eapol_if_eapol_key_authentication_mode_e; + +typedef enum _wlan_eapol_if_eapol_key_authentication_type_e + { + wlan_eapol_if_eapol_key_authentication_type_none, + wlan_eapol_if_eapol_key_authentication_type_rsna_eap, + wlan_eapol_if_eapol_key_authentication_type_rsna_psk, + wlan_eapol_if_eapol_key_authentication_type_wpa_eap, + wlan_eapol_if_eapol_key_authentication_type_wpa_psk, + wlan_eapol_if_eapol_key_authentication_type_802_1x, + wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam, + wlan_eapol_if_eapol_key_authentication_type_wfa_sc, + wlan_eapol_if_eapol_key_authentication_type_wapi_psk, + wlan_eapol_if_eapol_key_authentication_type_wapi + } wlan_eapol_if_eapol_key_authentication_type_e; + +typedef enum _wlan_eapol_if_eapol_key_type_e + { + wlan_eapol_if_eapol_key_type_broadcast, + wlan_eapol_if_eapol_key_type_unicast, + wlan_eapol_if_eapol_key_type_wpx_fast_roam_krk, + wlan_eapol_if_eapol_key_type_wpx_fast_roam_btk, + wlan_eapol_if_eapol_key_type_pmkid, + } wlan_eapol_if_eapol_key_type_e; + +typedef enum _wlan_eapol_if_eapol_tkip_mic_failure_type_e + { + wlan_eapol_if_eapol_tkip_mic_failure_type_group_key, + wlan_eapol_if_eapol_tkip_mic_failure_type_pairwise_key, + } wlan_eapol_if_eapol_tkip_mic_failure_type_e; + +typedef enum _wlan_eapol_if_eapol_wlan_authentication_state_e + { + wlan_eapol_if_eapol_wlan_authentication_state_none, + wlan_eapol_if_eapol_wlan_authentication_state_association_ok, + wlan_eapol_if_eapol_wlan_authentication_state_this_ap_failed, + wlan_eapol_if_eapol_wlan_authentication_state_failed_completely, + wlan_eapol_if_eapol_wlan_authentication_state_802_11_auth_algorithm_not_supported, + wlan_eapol_if_eapol_wlan_authentication_state_obsolete, // <- Do not use this value. + wlan_eapol_if_eapol_wlan_authentication_state_eap_authentication_running, + wlan_eapol_if_eapol_wlan_authentication_state_no_response, + wlan_eapol_if_eapol_wlan_authentication_state_4_way_handshake_running, + wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull, + wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled, + wlan_eapol_if_eapol_wlan_authentication_state_immediate_reconnect, + wlan_eapol_if_eapol_wlan_authentication_state_wapi_authentication_running + } wlan_eapol_if_eapol_wlan_authentication_state_e; + +typedef enum _wlan_eapol_if_error_e + { + wlan_eapol_if_error_ok, + wlan_eapol_if_error_pending_request, + wlan_eapol_if_error_allocation_error, + wlan_eapol_if_error_illegal_parameter, + wlan_eapol_if_error_process_general_error, + } wlan_eapol_if_error_e; + +typedef enum _wlan_eapol_if_rsna_cipher_e + { + wlan_eapol_if_rsna_cipher_none, + wlan_eapol_if_rsna_cipher_ccmp, + wlan_eapol_if_rsna_cipher_tkip, + wlan_eapol_if_rsna_cipher_wep_40, + wlan_eapol_if_rsna_cipher_wep_104, + wlan_eapol_if_wapi_cipher_wpi + } wlan_eapol_if_rsna_cipher_e; + +typedef enum _wlan_eapol_ethernet_type_e + { + wlan_eapol_ethernet_type_none = 0, + wlan_eapol_ethernet_type_pae = 0x888e, ///< Ethernet type Port Access Entity (PAE) + wlan_eapol_ethernet_type_preauthentication = 0x88c7, ///< Ethernet type Preauthentication + wlan_eapol_ethernet_type_wapi = 0x88b4 ///< Ethernet type WAPI + } wlan_eapol_ethernet_type_e; + +typedef enum _wlan_eapol_if_eap_type_e + { + wlan_eapol_if_eap_type_none = 0, ///< This is internal value for no type case. + wlan_eapol_if_eap_type_tls = 13, ///< This is Transport Layer Security (TLS) type. + wlan_eapol_if_eap_type_leap = 17, ///< This is LEAP type. + wlan_eapol_if_eap_type_gsmsim = 18, ///< This is SIM type. + wlan_eapol_if_eap_type_ttls = 21, ///< This is tunneled TLS. + wlan_eapol_if_eap_type_aka = 23, ///< This is AKA type. + wlan_eapol_if_eap_type_peap = 25, ///< This is PEAP type. + wlan_eapol_if_eap_type_mschapv2 = 26, ///< This is MsChapv2 type. + wlan_eapol_if_eap_type_fast = 43, ///< This is EAP-FAST type. + } wlan_eapol_if_eap_type_e; + +typedef enum _wlan_eapol_if_eap_status_e + { + wlan_eapol_if_eap_status_none = 0, + wlan_eapol_if_eap_status_authentication_failure = 14, + wlan_eapol_if_eap_status_illegal_cipher_suite = 70, + wlan_eapol_if_eap_status_bad_certificate = 71, + wlan_eapol_if_eap_status_unsupported_certificate = 72, + wlan_eapol_if_eap_status_certificate_revoked = 73, + wlan_eapol_if_eap_status_certificate_expired = 74, + wlan_eapol_if_eap_status_user_certificate_unknown = 76, + wlan_eapol_if_eap_status_identity_query_failed = 94, + wlan_eapol_if_eap_status_user_has_not_subscribed_to_the_requested_service = 96, + wlan_eapol_if_eap_status_users_calls_are_barred = 97, + wlan_eapol_if_eap_status_restricted_logon_hours = 98, + wlan_eapol_if_eap_status_account_disabled = 99, + wlan_eapol_if_eap_status_no_dialin_permission = 100, + wlan_eapol_if_eap_status_password_expired = 101, + wlan_eapol_if_eap_status_OOB_interface_read_error = 103, + wlan_eapol_if_eap_status_decryption_CRC_failure = 104, + wlan_eapol_if_eap_status_RF_band_2_4_ghz_not_supported = 105, + wlan_eapol_if_eap_status_RF_band_5_0_ghz_not_supported = 106, + wlan_eapol_if_eap_status_signal_too_weak = 107, + wlan_eapol_if_eap_status_network_authentication_failure = 108, + wlan_eapol_if_eap_status_network_association_failure = 109, + wlan_eapol_if_eap_status_no_DHCP_response = 110, + wlan_eapol_if_eap_status_failed_DHCP_configure = 111, + wlan_eapol_if_eap_status_ip_address_conflict = 112, + wlan_eapol_if_eap_status_could_not_connect_to_registrar = 113, + wlan_eapol_if_eap_status_multiple_PBC_sessions_detected = 114, + wlan_eapol_if_eap_status_rogue_activity_suspected = 115, + wlan_eapol_if_eap_status_device_busy = 116, + wlan_eapol_if_eap_status_setup_locked = 117, + wlan_eapol_if_eap_status_message_timeout = 118, + wlan_eapol_if_eap_status_registration_session_timeout = 119, + wlan_eapol_if_eap_status_device_password_authentication_failure = 120, + wlan_eapol_if_eap_status_pin_code_authentication_not_supported = 121, + wlan_eapol_if_eap_status_push_button_authentication_not_supported = 122, + wlan_eapol_if_eap_status_tunnel_compromise_error = 124, + wlan_eapol_if_eap_status_unexpected_tlv_exhanged = 125, + wlan_eapol_if_eap_status_no_pac_nor_certs_to_authenticate_with_provision_disabled = 126, + wlan_eapol_if_eap_status_no_matching_pac_for_aid = 127, + wlan_eapol_if_eap_status_pac_store_corrupted = 128, + } wlan_eapol_if_eap_status_e; + +enum wlan_eapol_if_eap_state_e + { + wlan_eapol_if_eap_state_general_authentication_error = 4, + wlan_eapol_if_eap_state_authentication_terminated_unsuccessfully = 7, + }; + +/** + * Structure for storing medium time by user priority. + */ +typedef u16_t medium_time_by_user_priority[MAX_QOS_USER_PRIORITY]; + +/** + * Structure for storing medium time by access class. + */ +typedef u16_t medium_time_by_access_class[MAX_QOS_ACCESS_CLASS]; + +/** + * Structure for storing medium time by user priority and by access class. + */ +typedef struct _medium_time_s + { + /** Admission capacity by user priority. */ + medium_time_by_user_priority up; + /** Admission capacity by access class. */ + medium_time_by_access_class ac; + } medium_time_s; + +const medium_time_s ADMISSION_CAPACITIES_NOT_DEFINED = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; +const medium_time_s MEDIUM_TIME_NOT_DEFINED = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +#endif // CORE_TYPES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_virtual_traffic_stream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_virtual_traffic_stream.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing the parameters of a virtual traffic stream. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef CORE_VIRTUAL_TRAFFIC_STREAM_H +#define CORE_VIRTUAL_TRAFFIC_STREAM_H + +#include "core_types.h" + +/** + * Class for storing the parameters of a virtual traffic stream. + * + * @since S60 v5.1 + */ +NONSHARABLE_CLASS( core_virtual_traffic_stream_c ) + { + +public: + + /** + * Constructor. + * + * @param requested_tid TID the virtual traffic stream was requested with. + * @param tid Current TID of the virtual traffic stream. + * @param user_priority User Priority of the virtual traffic stream. + * @param is_automatic_stream Whether the virtual traffic stream + * has been created automatically. + * @param params Parameters of the virtual traffic stream. + * @param id ID of the virtual traffic stream. + * @param stream_status Status of the virtual traffic stream. + */ + core_virtual_traffic_stream_c( + u8_t requested_tid, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t stream_id, + core_traffic_stream_status_e stream_status ); + + /** + * Destructor. + */ + virtual ~core_virtual_traffic_stream_c(); + + /** + * Get the ID of the virtual traffic stream. + */ + u32_t id() const; + + /** + * Get the TID value the virtual traffic stream was requested with. + */ + u8_t requested_tid() const; + + /** + * Get the current TID value of the virtual traffic stream. + * + * @since S60 v5.1 + * @return The TID value of the virtual traffic stream. + */ + u8_t tid() const; + + /** + * Set the current TID value of the virtual traffic stream. + * + * @since S60 v5.1 + * @param tid TID value of the virtual traffic stream. + */ + void set_tid( + u8_t tid ); + + /** + * Get the User Priority value of the virtual traffic stream. + * + * @since S60 v5.1 + * @return The User Priority value of the virtual traffic stream. + */ + u8_t user_priority() const; + + /** + * Get the access class of the traffic stream. + * + * @since S60 v5.1 + * @return The access class of the traffic stream. + */ + core_access_class_e access_class() const; + + /** + * Whether the virtual traffic stream has been created automatically. + * + * @since S60 v5.1 + * @return true_t if the virtual traffic stream has been created automatically, + * false_t otherwise. + */ + bool_t is_automatic_stream() const; + + /** + * Get the TSPEC parameters of the virtual traffic stream. + * + * @since S60 v5.1 + * @return The TSPEC parameters of the virtual traffic stream. + */ + const core_traffic_stream_params_s& params() const; + + /** + * Get the current status of the virtual traffic stream. + * + * @since S60 v3.2 + * @return The current status of the virtual traffic stream. + */ + core_traffic_stream_status_e status() const; + + /** + * Set the current status of the virtual traffic stream. + * + * @since S60 v3.2 + * @param status The current status of the virtual traffic stream. + */ + void set_status( + core_traffic_stream_status_e status ); + +private: // data + + /** + * The TID the virtual traffic stream was requested with. + */ + u8_t requested_tid_m; + + /** + * The TID of the virtual traffic stream. + */ + u8_t tid_m; + + /** + * The User Priority of the virtual traffic stream. + */ + u8_t user_priority_m; + + /** + * Whether the virtual traffic stream has been created automatically. + */ + bool_t is_automatic_stream_m; + + /** + * Parameters of the virtual traffic stream. + */ + core_traffic_stream_params_s params_m; + + /** + * ID of the virtual traffic stream. + */ + u32_t id_m; + + /** + * The current status of the virtual traffic stream. + */ + core_traffic_stream_status_e status_m; + + }; + +#endif // CORE_VIRTUAL_TRAFFIC_STREAM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_virtual_traffic_stream_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_virtual_traffic_stream_list.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing virtual traffic streams. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef CORE_VIRTUAL_TRAFFIC_STREAM_LIST_H +#define CORE_VIRTUAL_TRAFFIC_STREAM_LIST_H + +#include "core_type_list.h" +#include "core_virtual_traffic_stream.h" + +/** + * This is a storage class for virtual traffic streams. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_virtual_traffic_stream_list_c ) + { + + friend class core_virtual_traffic_stream_list_iter_c; + +public: + + /** + * Structure for storing virtual traffic streams. + */ + struct entry_s + { + /** Data of the AP. */ + core_virtual_traffic_stream_c* traffic_stream; + }; + + /** + * Constructor. + */ + core_virtual_traffic_stream_list_c(); + + /** + * Destructor. + */ + virtual ~core_virtual_traffic_stream_list_c(); + + /** + * Return the amount of entries in the list. + * + * @since S60 v5.1 + * @return The amount of entries in the list. + */ + u32_t count() const; + + /** + * Add a copy of the given entry to the list. + * + * @since S60 v5.1 + * @param stream Entry to copy. + * @return core_error_ok if successful, an error code otherwise. + */ + core_error_e add_traffic_stream( + const core_virtual_traffic_stream_c& stream ); + + /** + * Add an entry to the list. + * + * @since S60 v5.1 + * @param requested_tid TID the virtual traffic stream was requested with. + * @param tid Current TID of the virtual traffic stream. + * @param user_priority User Priority of the virtual traffic stream. + * @param is_automatic_stream Whether the virtual traffic stream + * has been created automatically. + * @param params Parameters of the virtual traffic stream. + * @param id Contains the ID assigned to the stream if successfully added. + * @param stream_status Status of the virtual traffic stream. + * @return core_error_ok if successful, an error code otherwise. + */ + core_error_e add_traffic_stream( + u8_t requested_tid, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e stream_status ); + + /** + * Remove entry with a matching TID. + * + * @since S60 v5.1 + * @param tid TID to match against. + */ + void remove_traffic_stream_by_tid( + u8_t tid ); + + /** + * Remove entry with a matching stream ID. + * + * @since S60 v5.1 + * @param stream_id ID to match against. + */ + void remove_traffic_stream_by_id( + u32_t stream_id ); + + /** + * Return the traffic mode of the given AC. + * + * @since S60 v5.1 + * @return The traffic mode of the given AC. + */ + core_access_class_traffic_mode_e traffic_mode_by_ac( + core_access_class_e access_class ); + + /** + * Print the contents of the list. + */ + void print_contents(); + + /** + * Get the next free TID. + * + * @return The next free TID, MAX_TRAFFIC_STREAM_TID if no available. + */ + u8_t next_tid(); + +private: // data + + /** + * List of virtual traffic streams. + */ + core_type_list_c ts_list_m; + + /** + * Contains the next stream ID to be used. + */ + u32_t next_stream_id_m; + + }; + +#endif // CORE_VIRTUAL_TRAFFIC_STREAM_LIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_virtual_traffic_stream_list_iter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_virtual_traffic_stream_list_iter.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Iterator for a virtual traffic stream list. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef CORE_VIRTUAL_TRAFFIC_STREAM_LIST_ITER_H +#define CORE_VIRTUAL_TRAFFIC_STREAM_LIST_ITER_H + +#include "core_virtual_traffic_stream_list.h" + +/** + * This class implements an iterator for a virtual_traffic stream list. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( core_virtual_traffic_stream_list_iter_c ) + { + +public: + + /** + * Constructor. + * + * @param list Reference to the list being iterated. + */ + core_virtual_traffic_stream_list_iter_c( + core_virtual_traffic_stream_list_c& list ); + + /** + * Destructor. + */ + virtual ~core_virtual_traffic_stream_list_iter_c(); + + /** + * Return the first entry in the list. + * + * @return The first entry in the list. NULL if none. + */ + core_virtual_traffic_stream_c* first(); + + /** + * Return the next entry in the list. + * + * @return The next entry in the list. NULL if none. + */ + core_virtual_traffic_stream_c* next(); + + /** + * Return the current entry in the list. + * + * @return The current entry in the list. NULL if none. + */ + core_virtual_traffic_stream_c* current() const; + + /** + * Remove the current entry from the list. + * + * @return core_error_ok if removed successfully, an error code otherwise. + */ + core_error_e remove(); + +private: // data + + /** + * An iterator for iterating the list. + */ + core_type_list_iterator_c iter_m; + + }; + +#endif // CORE_VIRTUAL_TRAFFIC_STREAM_LIST_ITER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wlan_eapol_if_message.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wlan_eapol_if_message.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,778 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating messages for Engine-EAPOL interface. +* +*/ + + +#ifndef CORE_WLAN_EAPOL_IF_MESSAGE_H +#define CORE_WLAN_EAPOL_IF_MESSAGE_H + +#include "am_platform_libraries.h" +#include "core_type_list.h" +#include "core_types.h" +#include "core_tools.h" + +// Compile time assert. Used to make sure that generated datatypes are correct size. +#define COMPILE_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] + + +/** + * Class for parsing and generating WLAN EAPOL Plugin interface messages. + * + * @since S60 v3.2 + */ + + +enum wlan_eapol_if_message_type_e + { + wlan_eapol_if_message_type_none = 0, + wlan_eapol_if_message_type_array = 1, + wlan_eapol_if_message_type_boolean = 2, + wlan_eapol_if_message_type_eap_protocol_layer = 3, + wlan_eapol_if_message_type_eap_state_notification = 4, + wlan_eapol_if_message_type_eap_status = 5, + wlan_eapol_if_message_type_eap_type = 6, + wlan_eapol_if_message_type_eapol_key_802_11_authentication_mode = 7, + wlan_eapol_if_message_type_eapol_key_authentication_type = 8, + wlan_eapol_if_message_type_eapol_key_type = 9, + wlan_eapol_if_message_type_eapol_tkip_mic_failure_type = 10, + wlan_eapol_if_message_type_eapol_wlan_authentication_state = 11, + wlan_eapol_if_message_type_error = 12, + wlan_eapol_if_message_type_function = 13, + wlan_eapol_if_message_type_network_id = 14, + wlan_eapol_if_message_type_network_key = 15, + wlan_eapol_if_message_type_protected_setup_credential = 16, + wlan_eapol_if_message_type_RSNA_cipher = 17, + wlan_eapol_if_message_type_session_key = 18, + wlan_eapol_if_message_type_u8_t = 19, + wlan_eapol_if_message_type_u16_t = 20, + wlan_eapol_if_message_type_u32_t = 21, + wlan_eapol_if_message_type_u64_t = 22, + wlan_eapol_if_message_type_variable_data = 23, + }; + + +enum wlan_eapol_if_message_type_function_e + { + wlan_eapol_if_message_type_function_none = 0, + wlan_eapol_if_message_type_function_check_pmksa_cache = 1, + wlan_eapol_if_message_type_function_start_authentication = 2, + wlan_eapol_if_message_type_function_complete_association = 3, + wlan_eapol_if_message_type_function_disassociation = 4, + wlan_eapol_if_message_type_function_start_preauthentication = 5, + wlan_eapol_if_message_type_function_start_reassociation = 6, + wlan_eapol_if_message_type_function_complete_reassociation = 7, + wlan_eapol_if_message_type_function_start_wpx_fast_roam_reassociation = 8, + wlan_eapol_if_message_type_function_complete_wpx_fast_roam_reassociation = 9, + wlan_eapol_if_message_type_function_packet_process = 10, + wlan_eapol_if_message_type_function_tkip_mic_failure = 11, + wlan_eapol_if_message_type_function_eap_acknowledge = 12, + wlan_eapol_if_message_type_function_update_header_offset = 13, + wlan_eapol_if_message_type_function_complete_check_pmksa_cache = 14, + wlan_eapol_if_message_type_function_packet_send = 15, + wlan_eapol_if_message_type_function_associate = 16, + wlan_eapol_if_message_type_function_disassociate = 17, + wlan_eapol_if_message_type_function_packet_data_session_key = 18, + wlan_eapol_if_message_type_function_state_notification = 19, + wlan_eapol_if_message_type_function_reassociate = 20, + wlan_eapol_if_message_type_function_update_wlan_database_reference_values = 21, + wlan_eapol_if_message_type_function_complete_start_wpx_fast_roam_reassociation = 22, + wlan_eapol_if_message_type_function_new_protected_setup_credentials = 23, + }; + + + +static const u32_t WLAN_EAPOL_MESSAGE_IF_TYPE_OFFSET = 0; +static const u32_t WLAN_EAPOL_MESSAGE_IF_LENGTH_OFFSET = 4; +static const u32_t WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET = 8; + + + +class network_id_c + { +public: + + /** + * Constructor + */ + network_id_c( + u8_t * source, u32_t source_length, + u8_t * destination, u32_t destination_length, + u16_t packet_type ) + : source_ptr( source ) + , source_length( source_length ) + , destination_ptr( destination ) + , destination_length( destination_length ) + , packet_type( packet_type ) + , source_m( ZERO_MAC_ADDR ) + , destination_m( ZERO_MAC_ADDR ) + { + } + + /** + * Destructor. + */ + ~network_id_c() + { + source_ptr = NULL; + destination_ptr = NULL; + } + + const core_mac_address_s& source() + { + if( source_ptr ) + { + core_tools_c::copy( + &source_m.addr[0], + source_ptr, + MAC_ADDR_LEN ); + } + + return source_m; + } + + const core_mac_address_s& destination() + { + if( destination_ptr ) + { + core_tools_c::copy( + &destination_m.addr[0], + destination_ptr, + MAC_ADDR_LEN ); + } + + return destination_m; + } + +public: // data + + u8_t * source_ptr; + u32_t source_length; + u8_t * destination_ptr; + u32_t destination_length; + u16_t packet_type; + core_mac_address_s source_m; + core_mac_address_s destination_m; + }; + + + + + +class session_key_c + { +public: + + /** + * Constructor + */ + session_key_c( + u8_t * key, u32_t key_length, + u8_t * sequence_number, u32_t sequence_number_length, + wlan_eapol_if_eapol_key_type_e eapol_key_type, + u32_t key_index, + bool_t key_tx_bit ) + : key( key ) + , key_length( key_length ) + , sequence_number( sequence_number ) + , sequence_number_length( sequence_number_length ) + , eapol_key_type( eapol_key_type ) + , key_index( key_index ) + , key_tx_bit( key_tx_bit ) + { } + + /** + * Destructor. + */ + ~session_key_c() + { + key = NULL; + sequence_number = NULL; + } + +public: // data + + u8_t * key; + u32_t key_length; + + u8_t * sequence_number; + u32_t sequence_number_length; + + wlan_eapol_if_eapol_key_type_e eapol_key_type; + u32_t key_index; + bool_t key_tx_bit; + }; + + + + + +class state_notification_c + { +public: + + /** + * Constructor + */ + state_notification_c( + const network_id_c * network_id, + wlan_eapol_if_eap_protocol_layer_e protocol_layer, + u32_t protocol, + u32_t eap_type_vendor_id, + u32_t eap_type_vendor_type, + u32_t current_state, + bool_t is_client, + wlan_eapol_if_eap_status_e authentication_error ) + : network_id( *network_id ) + , protocol_layer( protocol_layer ) + , protocol( protocol ) + , eap_type_vendor_id( eap_type_vendor_id ) + , eap_type_vendor_type( eap_type_vendor_type ) + , current_state( current_state ) + , is_client( is_client ) + , authentication_error( authentication_error ) + { } + + /** + * Destructor. + */ + ~state_notification_c() + { } + +public: // data + + network_id_c network_id; + wlan_eapol_if_eap_protocol_layer_e protocol_layer; + u32_t protocol; + u32_t eap_type_vendor_id; + u32_t eap_type_vendor_type; + u32_t current_state; + bool_t is_client; + wlan_eapol_if_eap_status_e authentication_error; + + }; + + +class network_key_c + { +public: + + /** + * Constructor + */ + network_key_c( + u8_t network_key_index, + u8_t * network_key, + u32_t network_key_length ) + : network_key_index( network_key_index ) + , network_key( network_key ) + , network_key_length( network_key_length ) + { } + + /** + * Destructor. + */ + ~network_key_c() + { + network_key = NULL; + } + +public: // data + + u8_t network_key_index; + u8_t * network_key; + u32_t network_key_length; + + }; + + +class protected_setup_credential_c + { +public: + + /** + * Constructor + */ + protected_setup_credential_c( + u8_t network_index, + u8_t * ssid, + u32_t ssid_length, + u16_t authentication_type, + u16_t encryption_type, + u8_t * mac_address, + u32_t mac_address_length ) + : network_index( network_index ) + , ssid( ssid ) + , ssid_length( ssid_length ) + , authentication_type( authentication_type ) + , encryption_type( encryption_type ) + , network_key_list( ) + , mac_address( mac_address ) + , mac_address_length( mac_address_length ) + { } + + /** + * Destructor. + */ + ~protected_setup_credential_c() + { + ssid = NULL; + mac_address = NULL; + } + +public: // data + + u8_t network_index; + u8_t * ssid; + u32_t ssid_length; + u16_t authentication_type; + u16_t encryption_type; + core_type_list_c network_key_list; + u8_t * mac_address; + u32_t mac_address_length; + + }; + + + + + + + + +//NONSHARABLE_CLASS( core_wlan_eapol_if_parameter_c ) + +class core_wlan_eapol_if_parameter_c + { +public: + + /** + * Constructor + */ + core_wlan_eapol_if_parameter_c(); + + /** + * Constructor + * + * @param data Pointer to the TLV encoded data. + * @param data_length Length of the TLV encoded data. + */ + core_wlan_eapol_if_parameter_c( + u8_t *data, u32_t data_length ); + + /** + * Destructor. + */ + ~core_wlan_eapol_if_parameter_c(); + + /** + * Update content of parameter + * + * @param data Pointer to the TLV encoded data. + * @param data_length Length of the TLV encoded data. + */ + void update( + u8_t *data, u32_t data_length ); + + + // ============================================================================ + // General methods to handle parameters + + u32_t size() const; + + wlan_eapol_if_message_type_e get_parameter_type() const; + + u32_t get_parameter_length() const; + + u8_t* get_data() const; + + + // ============================================================================ + // Parameter specific methods + + // All 32 bit base types + core_error_e set_parameter_data( + wlan_eapol_if_message_type_e type, + u32_t value ); + + // All already generated structures, arrays and variable data + core_error_e set_parameter_data( + wlan_eapol_if_message_type_e type, + const u8_t* data, u32_t length ); + + // EAP type + core_error_e set_parameter_data( + wlan_eapol_if_message_type_e type, + u32_t vendor_id, + u32_t vendor_type ); + + core_error_e set_parameter_data_boolean( + wlan_eapol_if_message_type_e type, + bool_t boolean ); + + core_error_e set_parameter_data_u16_t( + wlan_eapol_if_message_type_e type, + u16_t value ); + + core_error_e set_parameter_data_u8_t( + wlan_eapol_if_message_type_e type, + u8_t value ); + + core_error_e set_parameter_data_u64_t( + u64_t data ); + + // ============================================================================ + + // All 32 bit values + core_error_e get_parameter_data( + u32_t * value ) const; + + // + core_error_e get_parameter_data( + u64_t * value ) const; + + // + core_error_e get_parameter_data( + bool_t * value ) const; + + core_error_e get_parameter_data( + u16_t * value ) const; + + core_error_e get_parameter_data( + u8_t * value ) const; + + core_error_e get_parameter_data( + u8_t ** const data, u32_t * data_length ) const; + + core_error_e get_parameter_data( + u32_t * vendor_id, + u32_t * vendor_type ) const; + + +// ============================================================================ + +private: + + core_error_e reserve_buffer( + u32_t needed_buffer_length ); + + void add_header( + wlan_eapol_if_message_type_e type, + u32_t length ); + + u64_t get_parameter_u64_t() const; + + void add_parameter_u32_t( + u32_t data ); + + u32_t get_parameter_u32_t() const; + + void add_parameter_u16_t( + u16_t data ); + + u16_t get_parameter_u16_t() const; + + void add_parameter_u8_t( + u8_t data ); + + u8_t get_parameter_u8_t() const; + +private: // Data + + u8_t * data_m; // This is pointer to current buffer + u32_t buffer_length_m; + bool_t delete_buffer_m; + + }; + + + + + + + + + + +class core_wlan_eapol_if_function_c + { +public: + + /** + * Constructor + */ + core_wlan_eapol_if_function_c(); + + /** + * Constructor + * + * @param data Pointer to the IE data. + * @param data_length Length of the IE data. + */ + core_wlan_eapol_if_function_c( + u8_t * data, + const u32_t length ); + + /** + * Destructor. + */ + ~core_wlan_eapol_if_function_c(); + + + wlan_eapol_if_message_type_e get_type(); + + wlan_eapol_if_message_type_function_e get_function(); + + core_error_e append( + const core_wlan_eapol_if_parameter_c * const param ); + + u32_t size() const; + + u8_t* get_data(); + + void clear(); + + // ============================================================================ + + // Iterators + void first(); + + void next(); + + const core_wlan_eapol_if_parameter_c* current(); + + bool_t is_done() const; + + // ============================================================================ + // Methods to generate and parse structured datatypes + + core_error_e reserve_buffer( + u32_t needed_buffer_length ); + + // Higher level methods to handle structured parameters and functions + + core_error_e generate_network_id( + const network_id_c * const network_id ); + + core_error_e parse_network_id( + network_id_c * network_id ); + + core_error_e generate_network_key( + network_key_c * network_key ); + + core_error_e parse_network_key( + network_key_c * network_key ); + + core_error_e generate_protected_setup_credential( + protected_setup_credential_c * credential ); + + core_error_e parse_protected_setup_credential( + protected_setup_credential_c * credential ); + + core_error_e generate_session_key( + session_key_c * session_key ); + + core_error_e parse_session_key( + session_key_c * session_key ); + + core_error_e generate_eap_state_notification( + state_notification_c * state_notification ); + + core_error_e parse_eap_state_notification( + state_notification_c * state_notification ); + + + // ============================================================================ + // Methods to generate and parse functions + + core_error_e check_pmksa_cache( + core_type_list_c & network_id_list, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ); + + core_error_e start_authentication( + u8_t * ssid, const u32_t ssid_length, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + u8_t * wpa_psk, const u32_t wpa_psk_length, + const bool_t wpa_override_enabled, + const network_id_c * receive_network_id ); + + core_error_e complete_association( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ); + + core_error_e disassociation( + const network_id_c * network_id ); + + core_error_e start_preauthentication( + const network_id_c * network_id ); + + core_error_e start_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type ); + + core_error_e complete_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ); + + core_error_e start_wpx_fast_roam_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + u8_t * reassociation_request_ie, + const u32_t reassociation_request_ie_length, + const u8_t* received_wpa_ie, + u32_t received_wpa_ie_length, + const u8_t* sent_wpa_ie, + u32_t sent_wpa_ie_length ); + + core_error_e complete_wpx_fast_roam_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e reassociation_result, + const network_id_c * network_id, + u8_t * received_reassociation_ie, const u32_t received_reassociation_ie_length ); + + core_error_e packet_process( + const network_id_c * network_id, + const u8_t * packet_data, const u32_t packet_data_length ); + + core_error_e tkip_mic_failure( + const network_id_c * network_id, + const bool_t is_fatal_failure, + const wlan_eapol_if_eapol_tkip_mic_failure_type_e tkip_mic_failure_type ); + + core_error_e eap_acknowledge( + const network_id_c * network_id ); + + core_error_e update_header_offset( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ); + + + + core_error_e generate_complete_check_pmksa_cache( + core_type_list_c & network_id_list ); + + core_error_e parse_complete_check_pmksa_cache( + core_type_list_c & network_id_list ); + + core_error_e generate_packet_send( + network_id_c * send_network_id, + u8_t * packet_data, const u32_t packet_data_length ); + + core_error_e parse_packet_send( + network_id_c * send_network_id, + u8_t ** packet_data, u32_t * packet_data_length ); + + core_error_e generate_associate( + const wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ); + + core_error_e parse_associate( + wlan_eapol_if_eapol_key_authentication_mode_e * authentication_mode ); + + core_error_e generate_disassociate( + network_id_c * receive_network_id, + const bool_t self_disassociation ); + + core_error_e parse_disassociate( + network_id_c * receive_network_id, + bool_t * self_disassociation ); + + core_error_e generate_packet_data_session_key( + network_id_c * send_network_id, + session_key_c * session_key ); + + core_error_e parse_packet_data_session_key( + network_id_c * send_network_id, + session_key_c * session_key ); + + core_error_e generate_state_notification( + state_notification_c * state_notification ); + + core_error_e parse_state_notification( + state_notification_c * state_notification ); + + core_error_e generate_reassociate( + network_id_c * send_network_id, + wlan_eapol_if_eapol_key_authentication_type_e authentication_type, + u8_t * pmkid, + u32_t pmkid_length ); + + core_error_e parse_reassociate( + network_id_c * send_network_id, + wlan_eapol_if_eapol_key_authentication_type_e * authentication_type, + u8_t ** pmkid, + u32_t * pmkid_length ); + + core_error_e update_wlan_database_reference_values( + u8_t * database_reference_value, const u32_t database_reference_value_length ); + + core_error_e generate_complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ); + + core_error_e parse_complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t ** reassociation_request_ie, + u32_t * reassociation_request_ie_length ); + + core_error_e generate_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ); + + core_error_e parse_error( + wlan_eapol_if_error_e * errorcode, + wlan_eapol_if_message_type_function_e * function ); + + core_error_e generate_new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ); + + core_error_e parse_new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ); + + + void debug_print(); + + void debug_print_type_string( + wlan_eapol_if_message_type_e type, + u32_t length ); + + void debug_print_function_string( + wlan_eapol_if_message_type_function_e function ); + +private: // Data + + u8_t * data_m; // This is pointer to current buffer + u32_t data_length_m; + u32_t buffer_length_m; + bool_t delete_buffer_m; + + u32_t iter_m; + core_wlan_eapol_if_parameter_c current_parameter_m; + + }; + + +#endif // CORE_WLAN_EAPOL_IF_MESSAGE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wlan_eapol_interface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wlan_eapol_interface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2001-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to EAPOL authentication protocols. +* +*/ + + + + +#ifndef CORE_WLAN_EAPOL_INTERFACE_H +#define CORE_WLAN_EAPOL_INTERFACE_H + +// INCLUDES +#include "am_platform_libraries.h" +#include "core_wlan_eapol_if_message.h" +#include "abs_core_server_callback.h" +#include "core_frame_ethernet.h" + +// CLASS DECLARATION +class core_wlan_eapol_interface_c +{ +public: + + core_wlan_eapol_interface_c( + abs_core_server_callback_c& wlm_callback ); + + ~core_wlan_eapol_interface_c(); + + static core_error_e convert_if_status_to_core_error( const u32_t if_status ); + + core_error_e load_eapol( + core_eapol_operating_mode_e mode, + abs_wlan_eapol_callback_c* const eapol_handler ); + + core_error_e shutdown(); + + core_error_e configure(); + + + core_error_e check_pmksa_cache( + core_type_list_c & network_id_list, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ); + + core_error_e start_authentication( + u8_t * ssid, const u32_t ssid_length, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + u8_t * wpa_psk, const u32_t wpa_psk_length, + const bool_t wpa_override_enabled, + const network_id_c * network_id ); + + core_error_e complete_association( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ); + + core_error_e disassociation( + const network_id_c * network_id ); + + core_error_e start_preauthentication( + const network_id_c * network_id ); + + core_error_e start_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type ); + + core_error_e complete_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ); + + core_error_e start_wpx_fast_roam_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + u8_t * reassociation_request_ie, + const u32_t reassociation_request_ie_length, + const u8_t* received_wpa_ie, + u32_t received_wpa_ie_length, + const u8_t* sent_wpa_ie, + u32_t sent_wpa_ie_length ); + + core_error_e complete_wpx_fast_roam_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e reassociation_result, + const network_id_c * network_id, + u8_t * received_reassociation_ie, const u32_t received_reassociation_ie_length ); + + /** + * Send the given frame to EAPOL for processing. + * + * @param frame Frame to be sent for processing + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e process_frame( + const core_frame_ethernet_c& frame ); + + core_error_e tkip_mic_failure( + const network_id_c * network_id, + const bool_t is_fatal_failure, + const wlan_eapol_if_eapol_tkip_mic_failure_type_e tkip_mic_failure_type ); + + core_error_e eap_acknowledge( + const network_id_c * network_id ); + + core_error_e update_header_offset( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ); + + core_error_e update_wlan_database_reference_values( + u8_t * database_reference_value, const u32_t database_reference_value_length ); + + core_error_e update_completed_check_pmksa_cache_list( + core_type_list_c & network_id_list ); + + core_type_list_c & get_completed_check_pmksa_cache_list(); + + /** + * Store a frame for later use. + * + * @param frame Ethernet frame to be stored. + * @note This method will take a copy of the frame. + */ + core_error_e store_frame( + const core_frame_ethernet_c& frame ); + + /** + * Delete the stored frame. + */ + void clear_stored_frame(); + + /** + * Process the stored frame. + * + * If a frame has been stored using store_frame(), this method + * will send the frame to EAPOL for processing. + * @return core_error_ok if success, an error code otherwise. + */ + core_error_e process_stored_frame(); + + /** + * Return current EAPOL operating mode. + * + * @return Current EAPOL operating mode. + */ + core_eapol_operating_mode_e operating_mode() const; + + /** + * Return current EAPOL ethernet type. + * + * @return Current EAPOL ethernet type. + */ + wlan_eapol_ethernet_type_e ethernet_type() const; + + /** + * Return current EAPOL authentication type. + * + * @return Current EAPOL authentication type. + */ + wlan_eapol_if_eapol_key_authentication_type_e authentication_type() const; + +private: // Data + + abs_core_server_callback_c& wlm_callback_m; + core_wlan_eapol_if_function_c function; + + core_type_list_c< core_mac_address_s > completed_check_pmksa_cache_list; + + /** Frame stored for later use. */ + core_frame_ethernet_c* stored_frame_m; + + /** Current EAPOL operating mode. */ + core_eapol_operating_mode_e eapol_mode_m; + + /** Currently used EAPOL authentication type. */ + wlan_eapol_if_eapol_key_authentication_type_e authentication_type_m; + + //-------------------------------------------------- +}; // class core_wlan_eapol_interface_c + +#endif //#ifndef CORE_WLAN_EAPOL_INTERFACE_H + +//-------------------------------------------------- + +// End of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wpx_adaptation_factory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wpx_adaptation_factory.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Factory class for WPX adaptation implementation. +* +*/ + + +#ifndef CORE_WPX_ADAPTATION_FACTORY_H +#define CORE_WPX_ADAPTATION_FACTORY_H + +#include "am_platform_libraries.h" + +class abs_core_wpx_adaptation_c; +class core_server_c; +class abs_core_driverif_c; +class abs_core_server_callback_c; + +/** +* This class implements a factory that is used to instantiate +* WPX adaptation implementation. +* @see abs_core_wpx_adaptation_c +*/ +NONSHARABLE_CLASS( core_wpx_adaptation_factory_c ) + { +public: + + /** + * Create a WPX adaptation instance. + * @param server Callback to core server. + * @param drivers Callback to lower adaptation. + * @param adaptation Callback to upper adaptation. + * @return Pointer to the created timer. + */ + static abs_core_wpx_adaptation_c* instance( + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ); + +private: // private constructor + + /** + * Constructor. + */ + core_wpx_adaptation_factory_c(); + + }; + +#endif // CORE_WPX_ADAPTATION_FACTORY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wpx_adaptation_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_wpx_adaptation_stub.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,298 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub version of WPX adaptation. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef CORE_WPX_ADAPTATION_STUB_H +#define CORE_WPX_ADAPTATION_STUB_H + +#include "abs_core_wpx_adaptation.h" + +/** + * This class hides WPX specific functionality. + * + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( core_wpx_adaptation_stub_c ) : public abs_core_wpx_adaptation_c + { + +public: + + /** + * Constructor. + */ + core_wpx_adaptation_stub_c(); + + /** + * Destructor. + */ + virtual ~core_wpx_adaptation_stub_c(); + + /** + * Returns the WPX key management suite from the given OUI. + * + * @since S60 v3.1 + * @param oui OUI to check for key management suite. + * @return core_key_management_none if no supported WPX key management suite found, + * otherwise the defined suite + */ + virtual core_key_management_e wpx_key_management_suite( + const u8_t* oui ); + + /** + * Convert the given key management suite to WPX specific OUI. + * + * @since S60 v3.1 + * @param key_management Key management suite to convert. + * @param data_length Length of the OUI element. + * @param data Pointer to the buffer for storing the OUI element. + * @return code_error_ok on success, an error code otherwise. + * @note On successful execution data_length parameter is changed + * to the size of data stored. + */ + virtual core_error_e get_wpx_key_management_oui( + core_key_management_e key_management, + u8_t& data_length, + u8_t* data ); + + /** + * Check whether the given AP has compatible WPX settings with the connection settings. + * + * @since S60 v3.1 + * @param reason The reason AP failed the check. + * @param ap_data AP data to compare. + * @param iap_data IAP data to compare. + * @return Whether further checking is allowed. + */ + virtual bool_t is_ap_wpx_compatible_with_iap( + core_connect_status_e& reason, + const core_ap_data_c& ap_data, + const core_iap_data_c& iap_data ); + + /** + * Process the given WPX frame. + * + * @since S60 v3.1 + * @param frame_type Type of the frame. + * @param frame_length Length of frame data. + * @param frame_data Pointer to the frame data. + * @return Whether the frame was handled. + */ + virtual bool_t handle_wpx_frame( + core_frame_type_e frame_type, + u16_t frame_length, + const u8_t* frame_data ); + + /** + * Handle a successful roam to WPX AP. + * + * @since S60 v3.1 + * @param ap_data AP information. + */ + virtual void handle_wpx_roam_success( + const core_ap_data_c& ap_data ); + + /** + * Handle a connection stop. + * + * @since S60 v3.2 + */ + virtual void handle_wpx_connection_stop(); + + /** + * Handle the starting of WPX fast-roam reassociation. + * + * @since S60 v3.1 + * @param ap_data AP information. + * @param assoc_ie_list IEs added to be added to reassociation request. + * @return code_error_ok on success, an error code otherwise. + */ + virtual core_error_e handle_fast_roam_start_reassociation( + core_ap_data_c& ap_data, + core_type_list_c& assoc_ie_list ); + + /** + * Process the WPX fast-roam reassociation response frame. + * + * @since S60 v3.1 + * @param server Pointer to the core_server instance. + * @param frame Received reassociation response. + */ + virtual void handle_fast_roam_reassoc_resp( + core_frame_assoc_resp_c* frame ); + + /** + * Return the WPX specific IEs for the association request. + * + * @since S60 v3.1 + * @param ap_data AP being connected to. + * @param assoc_ie_list WPX IEs are added to this list. + */ + virtual void get_association_request_wpx_ie( + core_ap_data_c& ap_data, + core_type_list_c& assoc_ie_list ); + + /** + * Return the WPX version number. + * + * @since S60 v3.1 + * @param frame Frame to search for WPX version number. + * @return The WPX version number. Zero if none. + */ + virtual u8_t wpx_version( + core_frame_beacon_c* frame ); + + /** + * Return the maximum tx power level. + * + * @since S60 v3.1 + * @param frame Frame to search for maximum tx power level. + * @return Maximum tx power level, MAX_TX_POWER_LEVEL_NOT_DEFINED if none. + */ + virtual u8_t max_tx_power_level( + core_frame_beacon_c* frame ); + + /** + * Handle the WPX-specific features in traffic stream creation. + * + * @since S60 v3.2 + * @param ap_data AP being connected to. + * @param frame Frame containing the TSPEC parameters. + * @param tid TID of the traffic stream. + * @param tspec TSPEC parameters of the traffic stream. + */ + virtual void handle_ts_create_request( + const core_ap_data_c& ap_data, + core_frame_dot11_c* frame, + u8_t tid, + const core_traffic_stream_params_s& tspec ); + + /** + * Get the WPX-specific traffic stream parameters. + * + * @since S60 v3.2 + * @param frame Frame to be parsed. + * @param tid TID of the traffic stream. + * @param tspec Parameters are stored here. + */ + virtual void get_wpx_traffic_stream_params( + core_frame_dot11_c* frame, + u8_t tid, + core_traffic_stream_params_s& tspec ); + + /** + * Get the WPX-specific traffic stream status. + * + * @since S60 v3.2 + * @param status Status Code field from the ADDTS Response. + * @return The WPX-specific traffic stream status. + */ + virtual core_traffic_stream_status_e get_wpx_traffic_stream_status( + u8_t status ); + + /** + * Handle the WPX-specific features in association response. + * + * @since S60 v3.2 + * @param ap_data AP being connected to. + * @param frame Received reassociation response. + */ + virtual void handle_association_response( + core_ap_data_c& ap_data, + core_frame_assoc_resp_c* frame ); + + /** + * Handle the WPX-specific operations after successful traffic stream creation. + * + * @since S60 v3.2 + * @param frame Frame containing the TSPEC parameters. + * @param tid TID of the traffic stream. + * @param user_priority User Priority of the traffic stream. + */ + virtual void handle_ts_create_success( + core_frame_dot11_c* frame, + u8_t tid, + u8_t user_priority ); + + /** + * Handle the WPX-specific operations after traffic stream deletion. + * + * @since S60 v3.2 + * @param tid TID of the traffic stream. + * @param user_priority User Priority of the traffic stream. + */ + virtual void handle_ts_delete( + u8_t tid, + u8_t user_priority ); + + /** + * Check whether the given management status code is WPX-specific. + * + * @since S60 v3.2 + * @param management_status Management status code to check. + * @return Whether the given status code is WPX-specific. + */ + virtual bool_t is_wpx_management_status( + u32_t management_status ); + + /** + * Check whether the given WPX-specific management status code is considered fatal. + * + * @since S60 v3.2 + * @param management_status Management status code to check. + * @return Whether the given status code is considered fatal. + */ + virtual bool_t is_fatal_wpx_management_status( + u32_t management_status ); + + /** + * Get the encryption mode used for connection. + * + * @since S60 v3.2 + * @param ap_data AP being connected to. + * @param mode Suggested encryption mode. + * @return The encryption mode used for connection. + */ + virtual core_encryption_mode_e encryption_mode( + core_ap_data_c& ap_data, + core_encryption_mode_e mode ); + + /** + * Get the authentication algorithm number used for connection. + * + * @since S60 v3.2 + * @param eapol_auth_type The type of authentication. + * @param eapol_auth_mode The authentication mode requested by EAPOL. + * @return The authentication algorithm number used for connection. + */ + virtual u16_t authentication_algorithm( + wlan_eapol_if_eapol_key_authentication_type_e eapol_auth_type, + wlan_eapol_if_eapol_key_authentication_mode_e eapol_auth_mode ); + + /** + * Return a WPX specific operation to be run during loading of drivers. + * + * @since S60 v3.2 + * @return Pointer to the operation instance, NULL if none. + */ + virtual core_operation_base_c* get_wpx_load_drivers_operation(); + + }; + +#endif // CORE_WPX_ADAPTATION_STUB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfo.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,293 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class to dig information from scan results. +* +*/ + + +#ifndef GENSCANINFO_H +#define GENSCANINFO_H + + +// INCLUDES +#include "genscanlistiterator.h" + +// CONSTANTS +/** Length of BSSID element. */ +const u8_t BSSID_LENGTH = 6; +/** The bitmask for determining operating mode. */ +const u16_t SCAN_CAPABILITY_BIT_MASK_ESS = 0x0001; +/** The bitmask for privacy bit. */ +const u16_t SCAN_CAPABILITY_BIT_MASK_PRIVACY = 0x0010; +/** Length of OUI element. */ +const u8_t SCAN_IE_OUI_LENGTH = 3; +/** Length of TSF element. */ +const u8_t TIMESTAMP_LENGTH = 8; + +// LOCAL DATATYPES +/** The possible error codes returned by parsing methods. */ +typedef enum _WlanScanError + { + WlanScanError_Ok, + WlanScanError_IeNotFound + } WlanScanError; + +/** The possible security modes of a BSS. */ +typedef enum _WlanSecurityMode + { + WlanSecurityModeOpen, + WlanSecurityModeWep, + WlanSecurityMode802_1x, + WlanSecurityModeWpaEap, + WlanSecurityModeWpaPsk, + WlanSecurityModeWpa2Eap, + WlanSecurityModeWpa2Psk, + WlanSecurityModeWapi, + WlanSecurityModeWapiPsk + } WlanSecurityMode; + +/** The possible operating modes of a BSS. */ +typedef enum _WlanOperatingMode + { + WlanOperatingModeInfra, + WlanOperatingModeAdhoc + } WlanOperatingMode; + +/** Type definition for OUI element. */ +typedef u8_t WlanIeOui[SCAN_IE_OUI_LENGTH]; + +/** + * Wrapper class to parse data fields from scan info. + */ +NONSHARABLE_CLASS( ScanInfo ) : public ScanListIterator + { +public: // Methods + + /** + * C++ constructor. + * + * @param scan_list Reference to the scan list container. + */ + ScanInfo( const ScanList& scan_list ); + + // New methods + + /** + * Return the measured signal noise ratio of the BSS. + * + * @return Signal noise ratio (SNR). + * @deprecated + */ + inline u8_t SignalNoiseRatio() const; + + /** + * Return the measured Received Channel Power Indicator value of the BSS. + * + * @return RCPI value. + */ + inline u8_t RXLevel() const; + + /** + * Return BSSID of the BSS. + * + * @param bssid BSSID of the BSS. + */ + inline void BSSID( + u8_t bssid[BSSID_LENGTH] ) const; + + /** + * Return the beacon interval of the BSS. + * + * @return The beacon interval in TUs. + */ + inline u16_t BeaconInterval() const; + + /** + * Return the capability information of the BSS. + * + * @return The capability information. + */ + inline u16_t Capability() const; + + /** + * Return whether the privacy bit is enabled in BSs capabilities. + * + * @return Whether the privacy is enabled. + */ + inline bool_t Privacy() const; + + /** + * Return the operating mode of the BSS. + * + * @return The operating mode of the BSS. + */ + inline WlanOperatingMode OperatingMode() const; + + /** + * Return the security mode of the BSS. + * @return The security mode of the BSS. + */ + WlanSecurityMode SecurityMode(); + + /** + * Return the timestamp (TSF) of the BSS. + * + * @param timestamp Timestamp of the BSS. + */ + inline void Timestamp( + u8_t timestamp[TIMESTAMP_LENGTH] ) const; + + /** + * Return the requested information element. + * + * @param ie_id Element ID of the information element. + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError InformationElement( + u8_t ie_id, + u8_t& ie_length, + const u8_t** ie_data ); + + /** + * Return the WPA information element. + * + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError WpaIE( + u8_t& ie_length, + const u8_t** ie_data ); + + /** + * Return the first information element. + * + * @param ie_id Element ID of the information element. + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError FirstIE( + u8_t& ie_id, + u8_t& ie_length, + const u8_t** ie_data ); + + /** + * Return next information element. + * + * @param ie_id Element ID of the information element. + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError NextIE( + u8_t& ie_id, + u8_t& ie_length, + const u8_t** ie_data ); + + /** + * Return the first information element with given OUI and OUI type. + * + * @param ie_id Element ID of the information element. + * @param ie_oui OUI element of the requested IE. + * @param ie_oui_type OUI type element of the requested IE. + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError InformationElement( + u8_t ie_id, + const WlanIeOui& ie_oui, + u8_t ie_oui_type, + u8_t& ie_length, + const u8_t** ie_data ); + + /** + * Return the first information element with given OUI, OUI type and OUI subtype. + * + * @param ie_id Element ID of the information element. + * @param ie_oui OUI element of the requested IE. + * @param ie_oui_type OUI type element of the requested IE. + * @param ie_oui_subtype OUI subtype element of the requested IE. + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError InformationElement( + u8_t ie_id, + const WlanIeOui& ie_oui, + u8_t ie_oui_type, + u8_t ie_oui_subtype, + u8_t& ie_length, + const u8_t** ie_data ); + + /** + * Check whether Wi-Fi Protected Setup is supported. + * + * @return true_t if AP supports Wi-Fi Protected Setup, + * false_t otherwise. + */ + bool_t IsProtectedSetupSupported(); + +private: //Methods + + /** + * Prohibit copy constructor. + */ + ScanInfo( + const ScanInfo& ); + /** + * Prohibit assigment operator. + */ + ScanInfo& operator= ( + const ScanInfo& ); + + /** + * Return current information element. + * + * @param ie_id Element ID of the information element. + * @param ie_length Length of the IE. Zero if IE not found. + * @param ie_data Pointer to the beginning of the IE data. NULL if IE not found. + * @return WlanScanError_Ok if IE was found, an error otherwise. + */ + WlanScanError CurrentIE( + u8_t& ie_id, + u8_t& ie_length, + const u8_t** ie_data ) const; + + /** + * Search through WSC IE and return value of AP setup locked attribute. + * + * @param ie_data Pointer to the beginning of the IE data. + * @param ie_length Length of the IE. + * @return true_t if value of AP setup locked is true. + * false_t otherwise. + */ + bool_t IsApSetupLocked( + const u8_t* ie_data, + const u8_t ie_length ) const; + +private: // Data + + /** Iterator for going through IEs of scan info. */ + const u8_t* ie_iter_m; + }; + +#include "genscaninfo.inl" + +#endif // GENSCANINFO_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfo.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of ScanInfo inline methods. +* +*/ + + +#include "genscanoffsets.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u8_t ScanInfo::SignalNoiseRatio() const + { + return *( current_m + CNTRL_RX_SNR_OFFSET ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u8_t ScanInfo::RXLevel() const + { + if( !current_m ) + { + return 0; + } + + return *( current_m + CNTRL_RX_LEVEL_OFFSET ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void ScanInfo::BSSID( + u8_t bssid[BSSID_LENGTH] ) const + { + u8_t* dst = bssid; + if ( !dst || !current_m ) + { + return; + } + + const u8_t* src = current_m + MGMT_BSSID_OFFSET; + const u8_t* end = src + BSSID_LENGTH; + + for ( ; src < end; ++dst, ++src ) + { + *dst = *src; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u16_t ScanInfo::BeaconInterval() const + { + if( !current_m ) + { + return 0; + } + + return *( reinterpret_cast( current_m + MGMT_BEACON_INTERVAL_OFFSET ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u16_t ScanInfo::Capability() const + { + if( !current_m ) + { + return 0; + } + + return *( reinterpret_cast( current_m + MGMT_CAPABILITY_OFFSET ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline bool_t ScanInfo::Privacy() const + { + if ( Capability() & SCAN_CAPABILITY_BIT_MASK_PRIVACY ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanOperatingMode ScanInfo::OperatingMode() const + { + if ( Capability() & SCAN_CAPABILITY_BIT_MASK_ESS ) + { + return WlanOperatingModeInfra; + } + + return WlanOperatingModeAdhoc; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void ScanInfo::Timestamp( u8_t timestamp[TIMESTAMP_LENGTH] ) const + { + u8_t* dst = timestamp; + if ( !dst ) + { + return; + } + + const u8_t* src = current_m + MGMT_TIMESTAMP_OFFSET; + const u8_t* end = src + TIMESTAMP_LENGTH; + + for ( ; src < end; ++dst, ++src ) + { + *dst = *src; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfoie.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscaninfoie.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the ScanInfoIe class. +* +*/ + + +#ifndef GENSCANINFOIE_H +#define GENSCANINFOIE_H + +#include "genscaninfo.h" + +/** Defines the possible types of security information elements. */ +enum ScanInfoIeType + { + ScanInfoIeTypeRsn, + ScanInfoIeTypeWpa, + ScanInfoIeTypeWapi + }; + +/** Defines the possible types of key management suites. */ +enum ScanInfoIeKeyManagement + { + ScanInfoIeKeyManagementEap, + ScanInfoIeKeyManagementPsk, + ScanInfoIeKeyManagementWapiCertificate, + ScanInfoIeKeyManagementWapiPsk + }; + +/** +* Class determining the security mode of an access point. +*/ +NONSHARABLE_CLASS( ScanInfoIe ) + { + public: // Methods + + // Constructors and destructor + + /** + * C++ constructor. + */ + ScanInfoIe(); + + /** + * Destructor. + */ + virtual ~ScanInfoIe(); + + // New methods + + /** + * Parses the given scan information and returns the security + * mode of the BSS. + * + * @param info Scan information to be parsed. + * @return Security mode of the BSS. + */ + WlanSecurityMode SecurityMode( + ScanInfo& info ) const; + + private: // Methods + + /** + * Checks whether the given memory buffers are equal. + * + * @param pl Pointer to parameter1 data. + * @param ll Length of parameter1 data. + * @param pr Pointer to parameter2 data. + * @param rl Length of parameter2 data. + * @return 0 if data is same or similar + * !0 if data is not similar + */ + int Compare( + const unsigned char* pl, + int ll, + const unsigned char* pr, + int rl ) const; + + /** + * Checks whether the given information element defines + * the expected key management suite. + * + * @param ie_type Type of of the information element. + * @param key_type Expected key management suite. + * @param ie_length Length of the IE. + * @param ie_data Pointer to the beginning of the IE data. + * @return true_t if expected key management suite is defined, + * false_t otherwise. + */ + bool_t IsKeyManagement( + ScanInfoIeType ie_type, + ScanInfoIeKeyManagement key_type, + u8_t ie_length, + const u8_t* ie_data ) const; + + /** + * Checks whether the given information element defines + * valid ciphers suites for WPA2. + * + * @param ie_type Type of of the information element. + * @param ie_length Length of the IE. + * @param ie_data Pointer to the beginning of the IE data. + * @return true_t if cipher suites are for WPA2, false_t otherwise. + */ + bool_t IsWpa2Ciphers( + ScanInfoIeType ie_type, + u8_t ie_length, + const u8_t* ie_data ) const; + + /** + * Prohibit copy constructor. + */ + ScanInfoIe( + const ScanInfoIe& ); + /** + * Prohibit assigment operator. + */ + ScanInfoIe& operator= ( + const ScanInfoIe& ); + }; + +#endif // GENSCANINFOIE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlist.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the ScanList class +* +*/ + + +#ifndef GENSCANLIST_H +#define GENSCANLIST_H + +#include "am_platform_libraries.h" + +/** The default maximum size of the scan list is 50kB. */ +const u32_t SCAN_LIST_DEFAULT_MAX_SIZE = 51200; +/** The default granularity of the scan list is 8kB. */ +const u32_t SCAN_LIST_DEFAULT_GRANULARITY = 8192; +/** The return value for failed Append(). */ +const u32_t APPEND_FAILED_NO_MEMORY = 0; +/** + * The definition for beacon/probe response frame data. + * Always used as pointer to the frame data, i.e. ScanFrame*. + */ +typedef u8_t ScanFrame; + +/** + * Container class for delivering scan results. + */ +NONSHARABLE_CLASS( ScanList ) + { + + friend class ScanListIterator; + +public: // Methods + + // Constructors and destructor + + /** + * Constructor for an empty container with default parameters. + */ + ScanList(); + + /** + * Constructor for an empty container. + * + * @param max_size The maximum size of the container. + * @param granularity The granularity of the container. + * @note After the initial allocation, memory is always allocated + * in multiples of the granularity parameter. + */ + ScanList( + u32_t max_size, + u32_t granularity = SCAN_LIST_DEFAULT_GRANULARITY ); + + /** + * Destructor. + */ + ~ScanList(); + + /** + * Returns the number of access points the instance contains. + * + * @return the number of access points the instance contains. + */ + inline u32_t Count() const; + + /** + * Appends one beacon/probe response frame to container. + * + * @param data_length Length of the frame data to be appended. + * @param data Pointer to the frame data. + * @return APPEND_FAILED_NO_MEMORY if there is not enough space, + * otherwise the new size of the container. + * @note If the current size of the container is not enough for the + * frame, the container will automatically allocate more memory. + */ + u32_t Append( + u32_t data_length, + const ScanFrame* data ); + + /** + * Returns the current size of the container. + * + * @return The current size of the container in bytes. + */ + inline u32_t Size() const; + + /** + * Returns the maximum size of the container. + * + * @return The maximum size of the container in bytes. + */ + inline u32_t MaxSize() const; + + /** + * Sets the maximum size of currently allocated container to the given size. + * + * @param max_size Maximum size of the container in bytes. + * @return The current maximum size if size could not be changed, + * the new maximum size otherwise. + * @note If the current container is smaller than the given size, + * more memory is automatically allocated. + * @note The maximum size is still limited by the size parameter given + * when the class was instantiated. + * @note Making the container smaller than the current size (other than + * zero) is not supported at the moment. + */ + u32_t SetCurrentMaxSize( + u32_t max_size ); + + /** + * Return a pointer to the currently allocated container. + * + * @return NULL if the container is empty, pointer to the + * currently allocated container otherwise. + */ + inline u8_t* Data() const; + + /** + * Updates the amount of frames and the current size of the container. + * + * @param count The amount of beacon/probe response frames stored in the container. + * @param size The current size of the container (in bytes). + * @note This method does not do any checking on the parameters and it + * is supposed to be used only when the container has been + * directly modified through Data(). + */ + inline void Update( + u32_t count, + u32_t size ); + + /** + * Clears the container. + */ + inline void ClearAll(); + + /** + * The alignment of one beacon/probe response frame data must be four bytes. + * Returns the amount of needed padding for a particular frame length. + * + * @param data_length Length of the frame data in bytes. + * @return Total length in bytes with additional padding. + */ + inline static u32_t AddPadding( + u32_t data_length ); + + /** + * Compresses the container so it will be occupy the minimum amount of memory. + * + * @return The current size of the container in bytes. + */ + inline u32_t Compress(); + +private: // Methods + + /** + * Prohibit copy constructor. + */ + ScanList( + const ScanList& ); + + /** + * Check that the given frame is valid, i.e. it has all mandatory IE fields included. + * + * @param data Pointer to the frame data. + * @return true_t if the frame is valid, false_t otherwise. + * @note The data being checked has to be stored in the container. + */ + bool_t CheckData( + const ScanFrame* data ) const; + + /** + * Copy data from source buffer to target buffer. + * + * @param trg Pointer to the target buffer. + * @param src Pointer to the source buffer. + * @param len Length of data to copy in bytes. + * @return Pointer to end of copied data in the target buffer. + */ + u8_t* Copy( + void* target, + const void* source, + u32_t data_length ); + +private: // Data + + /** The container for storing beacon/probe response frames. */ + u8_t* data_m; + /** The granularity of the container (in bytes). */ + u32_t granularity_m; + /** The amount of beacon/probe response frames stored in the container. */ + u32_t count_m; + /** The current size of the container (in bytes). */ + u32_t size_m; + /** The maximum size of the currently allocated container (in bytes). */ + u32_t current_max_size_m; + /** The maximum size of the container (in bytes). The container will never exceed this limit. */ + u32_t max_size_m; + }; + +#include "genscanlist.inl" + +#endif // GENSCANLIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlist.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of ScanList inline methods. +* +*/ + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u32_t ScanList::Count() const + { + return count_m; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u32_t ScanList::Size() const + { + return size_m; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u32_t ScanList::MaxSize() const + { + return max_size_m; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u8_t* ScanList::Data() const + { + return data_m; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void ScanList::Update( + u32_t count, + u32_t size ) + { + count_m = count; + size_m = size; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void ScanList::ClearAll() + { + delete data_m; + data_m = NULL; + count_m = 0; + size_m = 0; + current_max_size_m = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u32_t ScanList::AddPadding( + u32_t data_length ) + { + /** @note size & 0x3 has the same result as size % 4 */ + return ( data_length & 0x3 ) ? data_length + ( 4 - data_length & 0x3 ) : data_length; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u32_t ScanList::Compress() + { + return SetCurrentMaxSize( size_m ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlistiterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlistiterator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the ScanListIterator class +* +*/ + + +#ifndef GENSCANLISTITERATOR_H +#define GENSCANLISTITERATOR_H + +#include "genscanlist.h" + +class ScanList; + +/** +* Iterator for TScanList. +*/ +NONSHARABLE_CLASS( ScanListIterator ) + { +public: + + /** + * Return the size of the scan info. The size includes the static + * control information header and the actual frame data. + * + * @return The size of the scan info in bytes. + */ + inline u16_t Size() const; + + /** + * Return the first beacon/probe response frame. + * + * @return NULL if the container is empty, pointer to the first + * frame in the container otherwise. + */ + const ScanFrame* First(); + + /** + * Return the next beacon/probe response frame. + * + * @return NULL if the container is empty or end of the container + * has been reached, pointer to the next frame otherwise. + */ + const ScanFrame* Next(); + + /** + * Return the beacon/probe response frame currently iterated. + * + * @return NULL if no frame has been iterated to, pointer to the + * frame otherwise. + */ + const ScanFrame* Current() const; + + /** + * Check whether the are more beacon/probe response frames to be iterated. + * + * @return false_t if end of the container has been reached, true_t otherwise. + */ + bool_t IsDone() const; + +protected: // Methods + + /** + * Private C++ constructor to prevent instantiation. + * + * @param scan_list Reference to the scan list container. + */ + explicit ScanListIterator( const ScanList& scan_list ); + +private: // Methods + + /** + * Prohibit copy constructor. + */ + ScanListIterator( + const ScanListIterator& ); + /** + * Prohibit assigment operator. + */ + ScanListIterator& operator= ( + const ScanListIterator& ); + +protected: // Data + + /** Pointer to the beginning of the current frame. */ + const ScanFrame* current_m; + +private: // Data + /** Reference to the scan list container. */ + const ScanList& scan_list_m; + }; + +#include "genscanlistiterator.inl" + +#endif // GENSCANLISTITERATOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlistiterator.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanlistiterator.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of ScanListIterator inline methods. +* +*/ + + +#include "genscanoffsets.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline u16_t ScanListIterator::Size() const + { + if ( !scan_list_m.size_m ) + { + return 0; + } + + return static_cast( CNTRL_HEADER_LEN + + *( reinterpret_cast( current_m + CNTRL_LENGTH_OFFSET ) ) ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanoffsets.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/genscanoffsets.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of scan frame offsets. +* +*/ + + +#ifndef GENSCANOFFSETS_H +#define GENSCANOFFSETS_H + +/** + * Definitions for static control information header preceding the + * actual beacon/probe response frame data. + */ + +/** Length of the control information header. */ +const u32_t CNTRL_HEADER_LEN = 12; +/** Offset for RCPI value. */ +const u32_t CNTRL_RX_LEVEL_OFFSET = 0; +/** Offset for SNR value. Deprecated. */ +const u32_t CNTRL_RX_SNR_OFFSET = 4; +/** Offset for beacon/probe response frame data length. */ +const u32_t CNTRL_LENGTH_OFFSET = 8; + +/** + * Offsets for actual 802.11 beacon/probe response frame data. + */ + +/** Start of beacon/probe response frame data. */ +const u32_t DOT11_BASE_OFFSET = CNTRL_HEADER_LEN; +/** Start of Frame Control field (2 octets). */ +const u32_t MGMT_FRAME_CONTROL_OFFSET = DOT11_BASE_OFFSET; +/** Start of Duration field (2 octets). */ +const u32_t MGMT_DURATION_OFFSET = DOT11_BASE_OFFSET + 2; +/** Start of Destination Address field (6 octets). */ +const u32_t MGMT_DA_OFFSET = DOT11_BASE_OFFSET + 4; +/** Start of Source Address field (6 octets). */ +const u32_t MGMT_SA_OFFSET = DOT11_BASE_OFFSET + 10; +/** Start of BSSID field (6 octets ). */ +const u32_t MGMT_BSSID_OFFSET = DOT11_BASE_OFFSET + 16; +/** Start of Sequence Control field (2 octets). */ +const u32_t MGMT_SEQ_CONTROL_OFFSET = DOT11_BASE_OFFSET + 22; +/** Start of Timestamp field (8 octets). */ +const u32_t MGMT_TIMESTAMP_OFFSET = DOT11_BASE_OFFSET + 24; +/** Start of Beacon Interval field (2 octets). */ +const u32_t MGMT_BEACON_INTERVAL_OFFSET = DOT11_BASE_OFFSET + 32; +/** Start of Capability field (2 octets). */ +const u32_t MGMT_CAPABILITY_OFFSET = DOT11_BASE_OFFSET + 34; +/** Start of first IE in beacon/probe response frame. */ +const u32_t MGMT_BODY_OFFSET = DOT11_BASE_OFFSET + 36; + +#endif // GENSCANOFFSETS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_ap_data.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_ap_data.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1187 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class holding access point specific information +* +*/ + +/* +* %version: 34 % +*/ + +#include "core_ap_data.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "core_frame_beacon.h" +#include "core_frame_dot11_ie.h" +#include "core_frame_mgmt_ie.h" +#include "core_frame_rsn_ie.h" +#include "core_frame_wpa_ie.h" +#include "core_frame_wmm_ie.h" +#include "core_frame_wsc_ie.h" +#include "core_frame_qbss_load_ie.h" +#include "core_frame_wapi_ie.h" +#include "am_debug.h" + +/** Defining this enables IE parsing related traces. */ +//#define WLAN_CORE_DEEP_DEBUG 1 +const u16_t AP_CHANNEL_REPORT_CHANNEL_OFFSET = 3; +const u8_t REQUEST_IE_OFFSET = 2; +/** The maximum number of admission capacities. */ +const u16_t MAX_NBR_OF_ADMISSION_CAPACITIES = 12; +const u16_t CHECKSUM_LENGTH = 4; +const u16_t REPORTED_FRAME_BODY_MAX_LENGTH = 224; +const u16_t HEADER_LENGTH = 5; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c::core_ap_data_c( + abs_core_wpx_adaptation_c& wpx_adaptation ) : + wpx_adaptation_m( wpx_adaptation ), + frame_m( NULL ), + rcpi_m( 0 ), + pairwise_cipher_m( core_cipher_suite_none ), + group_cipher_m( core_cipher_suite_none ), + key_management_m( core_key_management_none ), + wpx_version_m( 0 ), + capabilities_bitmap_m( 0 ), + is_ac_required_bitmap_m( 0 ), + dtim_period_m( 0 ) + { + DEBUG( "core_ap_data_c::core_ap_data_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c::~core_ap_data_c() + { + DEBUG( "core_ap_data_c::~core_ap_data_c()" ); + + delete frame_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_ap_data_c::bssid() const + { + return frame_m->bssid(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ssid_s core_ap_data_c::ssid() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ssid ) + { + core_frame_mgmt_ie_ssid_c* parser = core_frame_mgmt_ie_ssid_c::instance( *ie ); + if ( parser ) + { + core_ssid_s ssid = parser->ssid(); + + delete parser; + parser = NULL; + delete ie; + ie = NULL; + + return ssid; + } + } + + delete ie; + ie = NULL; + } + + return BROADCAST_SSID; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_ap_data_c::capabilities() const + { + return frame_m->capability(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::max_tx_power_level() const + { + u8_t tx_power_level( MAX_TX_POWER_LEVEL_NOT_DEFINED ); + u8_t power_constraint( 0 ); + u8_t channel = core_ap_data_c::channel(); + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_country ) + { + core_frame_mgmt_ie_country_c* parser = core_frame_mgmt_ie_country_c::instance( *ie ); + if ( parser ) + { + tx_power_level = parser->max_tx_power_level( + channel ); + + delete parser; + parser = NULL; + } + } + else if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_power_constraint ) + { + core_frame_mgmt_ie_power_constraint_c* parser2 = core_frame_mgmt_ie_power_constraint_c::instance( *ie ); + if ( parser2 ) + { + power_constraint = parser2->power_constraint(); + + delete parser2; + parser2 = NULL; + } + } + + delete ie; + ie = NULL; + } + + if(tx_power_level != MAX_TX_POWER_LEVEL_NOT_DEFINED) + { + tx_power_level = tx_power_level - power_constraint; + } + + u8_t temp_power_level = wpx_adaptation_m.max_tx_power_level( frame_m ); + if ( temp_power_level < tx_power_level ) + { + tx_power_level = temp_power_level; + } + + return tx_power_level; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_country_string_s core_ap_data_c::country_info() const + { + core_country_string_s country_info( COUNTRY_STRING_NONE ); + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_country ) + { + core_frame_mgmt_ie_country_c* parser = core_frame_mgmt_ie_country_c::instance( *ie ); + if ( parser ) + { + country_info = parser->country(); + + delete parser; + parser = NULL; + delete ie; + ie = NULL; + + return country_info; + } + } + + delete ie; + ie = NULL; + } + + return country_info; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_privacy_enabled() const + { + return frame_m->capability() & CAPABILITY_BIT_MASK_PRIVACY; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_ap_data_c::instance( + const core_ap_data_c& copy ) + { + DEBUG( "core_ap_data_c::instance()" ); + + core_ap_data_c* instance = new core_ap_data_c( copy.wpx_adaptation_m ); + if ( !instance ) + { + DEBUG( "core_ap_data_c::instance() - unable to create an instance" ); + + return NULL; + } + + *instance = copy; + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_ap_data_c::instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + const core_frame_dot11_c* frame, + u8_t rcpi, + bool_t is_copied ) + { + DEBUG( "core_ap_data_c::instance()" ); + DEBUG1( "core_ap_data_c::instance() - is_copied %u", + is_copied ); + + core_ap_data_c* instance = new core_ap_data_c( wpx_adaptation ); + if ( !instance ) + { + DEBUG( "core_ap_data_c::instance() - unable to create core_ap_data_c instance" ); + + return NULL; + } + instance->rcpi_m = rcpi; + + instance->frame_m = core_frame_beacon_c::instance( + *frame, + is_copied ); + if ( !instance->frame_m ) + { + DEBUG( "core_ap_data_c::instance() - unable to create core_frame_beacon_c instance" ); + + delete instance; + instance = NULL; + + return NULL; + } + + const core_mac_address_s bssid = instance->frame_m->bssid(); + DEBUG6( "core_ap_data_c::instance() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + const core_tsf_value_s timestamp = instance->frame_m->timestamp(); + DEBUG8( "core_ap_data_c::instance() - TSF: 0x%02X%02X%02X%02X%02X%02X%02X%02X", + timestamp.tsf[0], timestamp.tsf[1], timestamp.tsf[2], + timestamp.tsf[3], timestamp.tsf[4], timestamp.tsf[5], + timestamp.tsf[6], timestamp.tsf[7] ); + DEBUG1( "core_ap_data_c::instance() - capability: 0x%04X", + instance->frame_m->capability() ); + DEBUG1( "core_ap_data_c::instance() - beacon_interval: %u", + instance->frame_m->beacon_interval() ); + + DEBUG1( "core_ap_data_c::instance() - class size: %u", + sizeof( *instance ) ); + DEBUG1( "core_ap_data_c::instance() - beacon class size: %u", + frame->data_length() ); + +#ifdef WLAN_CORE_DEEP_DEBUG + for( core_frame_dot11_ie_c* ie = instance->frame_m->first_ie(); ie; ie = instance->frame_m->next_ie() ) + { + DEBUG1( "core_ap_data_c::instance() - IE id: 0x%02X", + ie->element_id() ); + DEBUG1( "core_ap_data_c::instance() - IE length: %u", + ie->length() ); + delete ie; + ie = NULL; + } +#endif // WLAN_CORE_DEEP_DEBUG + + const core_frame_rsn_ie_c* rsn_ie = instance->rsn_ie(); + if ( rsn_ie ) + { + DEBUG( "core_ap_data_c::instance() - RSN IE detected" ); + instance->capabilities_bitmap_m |= core_am_ap_data_capability_rsn_ie_present; + instance->pairwise_cipher_m |= rsn_ie->pairwise_cipher_suites(); + instance->group_cipher_m |= rsn_ie->group_cipher_suite(); + instance->key_management_m |= rsn_ie->key_management_suites(); + delete rsn_ie; + rsn_ie = NULL; + } + + const core_frame_wpa_ie_c* wpa_ie = instance->wpa_ie(); + if ( wpa_ie ) + { + DEBUG( "core_ap_data_c::instance() - WPA IE detected" ); + instance->capabilities_bitmap_m |= core_am_ap_data_capability_wpa_ie_present; + instance->pairwise_cipher_m |= wpa_ie->pairwise_cipher_suites(); + instance->group_cipher_m |= wpa_ie->group_cipher_suite(); + instance->key_management_m |= wpa_ie->key_management_suites(); + delete wpa_ie; + wpa_ie = NULL; + } + + const core_frame_wapi_ie_c* wapi_ie = instance->wapi_ie(); + if ( wapi_ie ) + { + DEBUG( "core_ap_data_c::instance() - WAPI IE detected" ); + instance->capabilities_bitmap_m |= core_am_ap_data_capability_wapi_ie_present; + instance->pairwise_cipher_m |= wapi_ie->pairwise_cipher_suites(); + instance->group_cipher_m |= wapi_ie->group_cipher_suite(); + instance->key_management_m |= wapi_ie->key_management_suites(); + delete wapi_ie; + wapi_ie = NULL; + } + + if ( instance->is_rsn_ie_present() || + instance->is_wpa_ie_present() || + instance->is_wapi_ie_present() ) + { + DEBUG1( "core_ap_data_c::instance() - supported pairwise ciphers: 0x%02X", + instance->pairwise_cipher_m ); + DEBUG1( "core_ap_data_c::instance() - supported group cipher: 0x%02X", + instance->group_cipher_m ); + DEBUG1( "core_ap_data_c::instance() - supported key management suites: 0x%02X", + instance->key_management_m ); + } + + DEBUG1( "core_ap_data_c::instance() - RCPI: %u", + instance->rcpi_m ); + DEBUG1( "core_ap_data_c::instance() - channel: %u", + instance->channel() ); + u8_t max_tx_power_level = instance->max_tx_power_level(); + if ( max_tx_power_level < MAX_TX_POWER_LEVEL_NOT_DEFINED ) + { + DEBUG1( "core_ap_data_c::instance() - maximum tx power level: %u", + max_tx_power_level ); + } + else + { + DEBUG( "core_ap_data_c::instance() - maximum tx power level: undefined" ); + } + + core_country_string_s country_value = instance->country_info(); + if ( COUNTRY_STRING_NONE != country_value ) + { + DEBUG2( "core_ap_data_c::instance() - country %c%c", + country_value.country[0], country_value.country[1] ); + } + + instance->wpx_version_m = instance->wpx_adaptation_m.wpx_version( + instance->frame_m ); + + if ( instance->wpx_version_m ) + { + DEBUG1( "core_ap_data_c::instance() - WPX: v%u", + instance->wpx_version_m ); + } + else + { + DEBUG( "core_ap_data_c::instance() - WPX: no" ); + } + + const core_frame_wmm_ie_parameter_c* wmm_ie = instance->wmm_parameter_ie(); + if ( wmm_ie ) + { + DEBUG( "core_ap_data_c::instance() - WMM Parameter Element IE detected" ); + instance->capabilities_bitmap_m |= core_am_ap_data_capability_wmm_ie_present; + if ( wmm_ie->is_uapsd_supported() ) + { + instance->capabilities_bitmap_m |= core_am_ap_data_capability_uapsd_supported; + } + if ( wmm_ie->is_admission_control_required( core_access_class_best_effort ) ) + { + instance->is_ac_required_bitmap_m |= ( 1 << core_access_class_best_effort ); + } + if ( wmm_ie->is_admission_control_required( core_access_class_background ) ) + { + instance->is_ac_required_bitmap_m |= ( 1 << core_access_class_background ); + } + if ( wmm_ie->is_admission_control_required( core_access_class_video ) ) + { + instance->is_ac_required_bitmap_m |= ( 1 << core_access_class_video ); + } + if ( wmm_ie->is_admission_control_required( core_access_class_voice ) ) + { + instance->is_ac_required_bitmap_m |= ( 1 << core_access_class_voice ); + } + DEBUG1( "core_ap_data_c::instance() - U-APSD: %u", + instance->is_uapsd_supported() ); + DEBUG1( "core_ap_data_c::instance() - Admission Control for Best Effort: %u", + instance->is_admission_control_required( core_access_class_best_effort ) ); + DEBUG1( "core_ap_data_c::instance() - Admission Control for Background: %u", + instance->is_admission_control_required( core_access_class_background ) ); + DEBUG1( "core_ap_data_c::instance() - Admission Control for Video: %u", + instance->is_admission_control_required( core_access_class_video ) ); + DEBUG1( "core_ap_data_c::instance() - Admission Control for Voice: %u", + instance->is_admission_control_required( core_access_class_voice ) ); + + delete wmm_ie; + wmm_ie = NULL; + } + +#ifdef _DEBUG + const core_frame_qbss_load_ie_c* qbss_load_ie = instance->qbss_load_ie(); + if ( qbss_load_ie ) + { + DEBUG( "core_ap_data_c::instance() - QBSS Load IE detected" ); + DEBUG1( "core_ap_data_c::instance() - Station Count: %u", + qbss_load_ie->station_count() ); + DEBUG1( "core_ap_data_c::instance() - Channel Utilization: %u", + qbss_load_ie->channel_utilitization() ); + DEBUG1( "core_ap_data_c::instance() - Available Admission Capacity: %u", + qbss_load_ie->admission_capacity() ); + + delete qbss_load_ie; + qbss_load_ie = NULL; + } +#endif // _DEBUG + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_short_preamble_allowed() const + { + if ( frame_m->capability() & CAPABILITY_BIT_MASK_PREAMBLE ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_short_slot_time_used() const + { + if ( frame_m->capability() & CAPABILITY_BIT_MASK_SLOT_TIME ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_infra() const + { + if ( frame_m->capability() & CAPABILITY_BIT_MASK_ESS ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_radio_measurement_supported() const + { + if ( frame_m->capability() & core_frame_dot11_c::core_dot11_capability_radio_measurement ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_wpa_ie_present() const + { + if ( capabilities_bitmap_m & core_am_ap_data_capability_wpa_ie_present ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_rsn_ie_present() const + { + if ( capabilities_bitmap_m & core_am_ap_data_capability_rsn_ie_present ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_wmm_ie_present() const + { + if ( capabilities_bitmap_m & core_am_ap_data_capability_wmm_ie_present ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_uapsd_supported() const + { + if ( capabilities_bitmap_m & core_am_ap_data_capability_uapsd_supported ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_admission_control_required( + core_access_class_e access_class ) const + { + if ( is_ac_required_bitmap_m & ( 1 << access_class ) ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_wapi_ie_present() const + { + if ( capabilities_bitmap_m & core_am_ap_data_capability_wapi_ie_present ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::pairwise_ciphers() const + { + return pairwise_cipher_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::group_cipher() const + { + return group_cipher_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::key_management_suites() const + { + return key_management_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_cipher_suite_e core_ap_data_c::best_pairwise_cipher() const + { + return best_cipher( + pairwise_cipher_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_cipher_suite_e core_ap_data_c::best_group_cipher() const + { + return best_cipher( + group_cipher_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_cipher_suite_e core_ap_data_c::best_cipher( + u32_t ciphers ) const + { + if ( ciphers & core_cipher_suite_wpi ) + { + return core_cipher_suite_wpi; + } + + if( ciphers & core_cipher_suite_ccmp ) + { + return core_cipher_suite_ccmp; + } + + if( ciphers & core_cipher_suite_tkip ) + { + return core_cipher_suite_tkip; + } + + if( ciphers & core_cipher_suite_wep104 ) + { + return core_cipher_suite_wep104; + } + + if( ciphers & core_cipher_suite_wep40 ) + { + return core_cipher_suite_wep40; + } + + return core_cipher_suite_none; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_wpx() const + { + return wpx_version_m != 0; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::wpx_version() const + { + return wpx_version_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::channel() const + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ds_parameter_set ) + { + core_frame_mgmt_ie_ds_c* parser = core_frame_mgmt_ie_ds_c::instance( *ie ); + if ( parser ) + { + u8_t channel = parser->channel(); + + delete parser; + parser = NULL; + delete ie; + ie = NULL; + + return channel; + } + } + + delete ie; + ie = NULL; + } + + return 0; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c& core_ap_data_c::operator=( + const core_ap_data_c& src ) + { + // Check first assignment to itself + if( &src == this) + { + DEBUG( "core_ap_data_c::operator=() - assignment to this"); + return *this; + } + delete frame_m; + frame_m = NULL; + + frame_m = core_frame_beacon_c::instance( + *src.frame(), + true_t ); + + rcpi_m = src.rcpi_m; + pairwise_cipher_m = src.pairwise_cipher_m; + group_cipher_m = src.group_cipher_m; + key_management_m = src.key_management_m; + wpx_version_m = src.wpx_version_m; + capabilities_bitmap_m = src.capabilities_bitmap_m; + is_ac_required_bitmap_m = src.is_ac_required_bitmap_m; + dtim_period_m = src.dtim_period_m; + + return *this; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_ap_data_c::is_wpx_fast_roam_available() const + { + return key_management_m & core_key_management_wpx_fast_roam; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_tsf_value_s core_ap_data_c::timestamp() const + { + return frame_m->timestamp(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::band() const + { + return SCAN_BAND_2DOT4GHZ; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::rcpi() const + { + return rcpi_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_ap_data_c::beacon_interval() const + { + return frame_m->beacon_interval(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::dtim_period() const + { + return dtim_period_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_ap_data_c::set_dtim_period( + u8_t dtim_period ) + { + dtim_period_m = dtim_period; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_beacon_c* core_ap_data_c::frame() const + { + return frame_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_frame_wpa_ie_c* core_ap_data_c::wpa_ie() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_wpa ) + { + core_frame_wpa_ie_c* wpa_ie = core_frame_wpa_ie_c::instance( wpx_adaptation_m, *ie ); + if ( wpa_ie ) + { + delete ie; + ie = NULL; + + return wpa_ie; + } + } + + delete ie; + ie = NULL; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_frame_rsn_ie_c* core_ap_data_c::rsn_ie() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_rsn ) + { + core_frame_rsn_ie_c* rsn_ie = core_frame_rsn_ie_c::instance( wpx_adaptation_m, *ie ); + if ( rsn_ie ) + { + delete ie; + ie = NULL; + + return rsn_ie; + } + } + + delete ie; + ie = NULL; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_frame_wsc_ie_c* core_ap_data_c::wsc_ie() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie ; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_wpa ) + { + core_frame_wsc_ie_c* wsc_ie = core_frame_wsc_ie_c::instance( *ie ); + if ( wsc_ie ) + { + delete ie; + ie = NULL; + + return wsc_ie; + } + } + + delete ie; + ie = NULL; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_frame_wmm_ie_parameter_c* core_ap_data_c::wmm_parameter_ie() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_wmm_parameter ) + { + core_frame_wmm_ie_parameter_c* wmm_ie = core_frame_wmm_ie_parameter_c::instance( *ie ); + if ( wmm_ie ) + { + delete ie; + ie = NULL; + + return wmm_ie; + } + } + + delete ie; + ie = NULL; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_frame_qbss_load_ie_c* core_ap_data_c::qbss_load_ie() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_qbss_load ) + { + core_frame_qbss_load_ie_c* qbss_load_ie = core_frame_qbss_load_ie_c::instance( *ie ); + if ( qbss_load_ie ) + { + delete ie; + ie = NULL; + + return qbss_load_ie; + } + } + + delete ie; + ie = NULL; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_frame_wapi_ie_c* core_ap_data_c::wapi_ie() + { + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_wapi ) + { + core_frame_wapi_ie_c* wapi_ie = core_frame_wapi_ie_c::instance( *ie ); + if ( wapi_ie ) + { + delete ie; + ie = NULL; + + return wapi_ie; + } + } + + delete ie; + ie = NULL; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_c core_ap_data_c::ap_channel_report() + { + u8_t channel( 0 ); + core_scan_channels_c ap_channel_list; + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie ; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ap_channel_report ) + { + core_frame_mgmt_ie_ap_channel_report_c* parser = core_frame_mgmt_ie_ap_channel_report_c::instance( *ie ); + if ( parser ) + { + for( u16_t i=0; i < (ie->data_length() - AP_CHANNEL_REPORT_CHANNEL_OFFSET); i++ ) + { + channel = parser->ap_channel_report_channel( i ); + ap_channel_list.add( SCAN_BAND_2DOT4GHZ, channel ); + } + + delete parser; + parser = NULL; + } + } + + delete ie; + ie = NULL; + } + + return ap_channel_list; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_ap_data_c::admission_capacity( + medium_time_s& admission_capacities ) + { + u16_t admission_capacity_table[MAX_NBR_OF_ADMISSION_CAPACITIES]; + admission_capacities = ADMISSION_CAPACITIES_NOT_DEFINED; + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_admission_capacity ) + { + core_frame_mgmt_ie_admission_capacity_c* parser = core_frame_mgmt_ie_admission_capacity_c::instance( *ie ); + if ( parser ) + { + u16_t bitmask( + parser->admission_capacity_bitmask() ); + parser->get_admission_capacity( ie->data_length(), admission_capacity_table ); + + /** + * Admission capacity by user priority. + */ + for( u8_t idx( 0 ); idx < MAX_QOS_USER_PRIORITY; ++idx ) + { + if( bitmask & 0x0001 ) + { + admission_capacities.up[idx] = admission_capacity_table[idx]; + } + + bitmask = bitmask >> 1; + } + + /** + * Admission capacity by access class. + */ + for( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) + { + if( bitmask & 0x0001 ) + { + admission_capacities.ac[idx] = admission_capacity_table[idx + MAX_QOS_USER_PRIORITY]; + } + + bitmask = bitmask >> 1; + } + + delete parser; + parser = NULL; + } + } + + delete ie; + ie = NULL; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_ap_data_c::power_capability() + { + u8_t min_capability( 0 ); + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie ; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_power_capability ) + { + core_frame_mgmt_ie_power_capability_c* parser = core_frame_mgmt_ie_power_capability_c::instance( *ie ); + if ( parser ) + { + min_capability = parser->power_capability(); + + delete parser; + parser = NULL; + } + } + + delete ie; + ie = NULL; + } + + return min_capability; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u64_t core_ap_data_c::rrm_capabilities() + { + u64_t rrm_capabilities( 0 ); + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie ; ie = frame_m->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_rrm_capabilities ) + { + core_frame_mgmt_ie_rrm_capabilities_c* parser = core_frame_mgmt_ie_rrm_capabilities_c::instance( *ie ); + if ( parser ) + { + rrm_capabilities = parser->rrm_capabilities(); + + delete parser; + parser = NULL; + + delete ie; + ie = NULL; + + return rrm_capabilities; + } + } + + delete ie; + ie = NULL; + } + + return rrm_capabilities; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_ap_data_c::get_reported_frame_body( + u16_t* reported_frame_body_length, + u8_t* reported_frame_body ) + { + u8_t frame_body[REPORTED_FRAME_BODY_MAX_LENGTH] = {0}; + + *reported_frame_body_length = frame_m->data_length() - frame_m->first_fixed_element_offset() - CHECKSUM_LENGTH; + + core_tools_c::copy( + &frame_body[0], + const_cast( frame_m->data() ), + frame_m->data_length() ); + + core_tools_c::copy( + &reported_frame_body[0], + const_cast( &frame_body[frame_m->first_fixed_element_offset()] ), + *reported_frame_body_length ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_ap_data_c::request_ie( + u16_t* reported_frame_body_length, + u8_t* reported_frame_body, + u8_t* ie_id_list, + u8_t ie_id_list_length ) + { + u8_t index = HEADER_LENGTH; + bool_t frame_too_long = false_t; + + *reported_frame_body_length = frame_m->data_length() - frame_m->first_fixed_element_offset() - CHECKSUM_LENGTH; + + core_tools_c::copy( + &reported_frame_body[0], + const_cast( frame_m->data() ), + index ); + + for( core_frame_dot11_ie_c* ie = frame_m->first_ie(); ie ; ie = frame_m->next_ie() ) + { + for( u16_t j=0; j < ie_id_list_length; j++ ) + { + if ( ie->element_id() == ie_id_list[j] ) + { + if( index + ie->data_length() <= REPORTED_FRAME_BODY_MAX_LENGTH ) + { + core_frame_mgmt_ie_request_ie_c* parser = core_frame_mgmt_ie_request_ie_c::instance( *ie ); + if ( parser ) + { + reported_frame_body[index] = ie->element_id(); + index++; + reported_frame_body[index] = ie->data_length() - REQUEST_IE_OFFSET; + index++; + for( u16_t i=0; i < ( ie->data_length() - REQUEST_IE_OFFSET ); i++ ) + { + reported_frame_body[index] = parser->element_data( i ); + index++; + } + + delete parser; + parser = NULL; + } + } + else + { + frame_too_long = true_t; + break; + } + } + } + + delete ie; + ie = NULL; + + if ( frame_too_long == true_t ) + { + break; + } + } + + *reported_frame_body_length = index; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_connection_data.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_connection_data.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,909 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class holding all connection related data +* +*/ + +/* +* %version: 37 % +*/ + +#include "core_connection_data.h" +#include "core_tools.h" +#include "am_debug.h" + +const u8_t CORE_FAILURE_NONE = 0; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connection_data_c::core_connection_data_c( + const core_iap_data_s& iap_data, + const core_device_settings_s& device_settings ) : + iap_data_m( iap_data ), + device_settings_m( device_settings ), + connect_status_m( core_connect_undefined ), + previous_ap_m( NULL ), + current_ap_m( NULL ), + ssid_m( BROADCAST_SSID ), + temp_blacklist_m( ), + last_rcp_class_m( core_rcp_normal ), + last_tx_level_m( MAX_TX_POWER_LEVEL_NOT_DEFINED ), + last_bssid_m( ZERO_MAC_ADDR ), + last_connection_state_m( core_connection_state_notconnected ), + association_failure_count_m( ), + deauthentication_count_m( ), + last_eap_type_m( EAP_TYPE_NONE ), + last_eap_error_code_m( EAP_ERROR_NONE ), + adjacent_ap_channels_m( ), + is_eapol_authentication_started_m( false_t ), + is_eapol_authenticating_m( false_t ), + eapol_auth_bssid_m( ZERO_MAC_ADDR ), + traffic_stream_list_m( ), + virtual_traffic_stream_list_m( ), + is_eapol_connecting_m( false_t ), + is_disconnecting_m( false_t ), + last_roam_reason_m( core_roam_reason_none ), + last_roam_failed_reason_m( core_roam_failed_reason_none ), + is_eapol_require_immediate_reconnect_m( false_t ), + is_voice_call_on_m( false_t ), + previous_rrm_measurement_request_time_m( 0 ) + { + DEBUG( "core_connection_data_c::core_connection_data_c()" ); + + for( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) + { + ac_traffic_status_m[idx] = core_access_class_traffic_status_admitted; + ac_traffic_mode_m[idx] = core_access_class_traffic_mode_automatic; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connection_data_c::~core_connection_data_c() + { + DEBUG( "core_connection_data_c::~core_connection_data_c()" ); + delete current_ap_m; + delete previous_ap_m; + temp_blacklist_m.clear(); + association_failure_count_m.clear(); + deauthentication_count_m.clear(); + power_save_test_verdict_m.clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_iap_data_c& core_connection_data_c::iap_data() + { + return iap_data_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connect_status_e core_connection_data_c::connect_status() const + { + return connect_status_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_connect_status( + core_connect_status_e connect_status ) + { + connect_status_m = connect_status; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_current_ap_data( + const core_ap_data_c& ap_data ) + { + DEBUG( "core_connection_data_c::set_current_ap_data()" ); + + delete current_ap_m; + current_ap_m = NULL; + + current_ap_m = core_ap_data_c::instance( ap_data ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_connection_data_c::current_ap_data() + { + return current_ap_m; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_previous_ap_data( + const core_ap_data_c& ap_data ) + { + delete previous_ap_m; + previous_ap_m = NULL; + + previous_ap_m = core_ap_data_c::instance( ap_data ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_connection_data_c::previous_ap_data() + { + return previous_ap_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_ssid_s& core_connection_data_c::ssid() const + { + return ssid_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_ssid( + const core_ssid_s& ssid ) + { + ssid_m = ssid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_mac_in_temporary_blacklist( + const core_mac_address_s& mac ) + { + core_ap_blacklist_entry_s* addr = temp_blacklist_m.first(); + while ( addr ) + { + if ( addr->bssid == mac ) + { + return true_t; + } + + addr = temp_blacklist_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::add_mac_to_temporary_blacklist( + const core_mac_address_s& mac, + core_ap_blacklist_reason_e reason ) + { + if ( !is_mac_in_temporary_blacklist( mac ) ) + { + core_ap_blacklist_entry_s* entry = new core_ap_blacklist_entry_s; + if ( entry ) + { + entry->bssid = mac; + entry->reason = reason; + temp_blacklist_m.append( entry ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::remove_mac_from_temporary_blacklist( + const core_mac_address_s& mac ) + { + core_ap_blacklist_entry_s* addr = temp_blacklist_m.first(); + while ( addr ) + { + if ( addr->bssid == mac ) + { + temp_blacklist_m.remove( addr ); + delete addr; + addr = NULL; + + return; + } + + addr = temp_blacklist_m.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_type_list_c& core_connection_data_c::temporary_blacklist() + { + return temp_blacklist_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::remove_temporary_blacklist_entries( + u32_t reasons ) + { + core_ap_blacklist_entry_s* addr = temp_blacklist_m.first(); + while( addr ) + { + if( reasons & addr->reason ) + { + DEBUG6( "core_connection_data_c::remove_temporary_blacklist_entries() - removing entry with BSSID %02X:%02X:%02X:%02X:%02X:%02X", + addr->bssid.addr[0], addr->bssid.addr[1], addr->bssid.addr[2], + addr->bssid.addr[3], addr->bssid.addr[4], addr->bssid.addr[5] ); + + temp_blacklist_m.remove( addr ); + delete addr; + addr = NULL; + + return; + } + + addr = temp_blacklist_m.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_rcp_class_e core_connection_data_c::last_rcp_class() const + { + return last_rcp_class_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_rcp_class( + core_rcp_class_e type ) + { + last_rcp_class_m = type; + }; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_connection_data_c::last_tx_level() const + { + return last_tx_level_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_tx_level( + u32_t tx_level ) + { + last_tx_level_m = tx_level; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_mac_address_s& core_connection_data_c::last_bssid() const + { + return last_bssid_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_bssid( + const core_mac_address_s& bssid ) + { + last_bssid_m = bssid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connection_state_e core_connection_data_c::connection_state() const + { + core_operating_mode_e mode = + iap_data_m.operating_mode(); + + if( mode == core_operating_mode_ibss ) + { + if( iap_data_m.security_mode() == core_security_mode_allow_unsecure ) + { + return core_connection_state_ibss; + } + else + { + return core_connection_state_secureibss; + } + } + else + { + if( iap_data_m.security_mode() == core_security_mode_allow_unsecure ) + { + return core_connection_state_infrastructure; + } + else + { + return core_connection_state_secureinfra; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connection_state_e core_connection_data_c::last_connection_state() const + { + return last_connection_state_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_connection_state( + core_connection_state_e state ) + { + last_connection_state_m = state; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_connection_data_c::ap_association_failure_count( + const core_mac_address_s& bssid ) + { + core_ap_failure_count_s* iter = association_failure_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + return iter->count; + } + + iter = association_failure_count_m.next(); + } + + return CORE_FAILURE_NONE; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::increase_ap_association_failure_count( + const core_mac_address_s& bssid ) + { + core_ap_failure_count_s* iter = association_failure_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + iter->count++; + return; + } + + iter = association_failure_count_m.next(); + } + + iter = new core_ap_failure_count_s; + if ( iter ) + { + iter->bssid = bssid; + iter->count = CORE_FAILURE_NONE + 1; + association_failure_count_m.append( iter ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::clear_ap_association_failure_count( + const core_mac_address_s& bssid ) + { + core_ap_failure_count_s* iter = association_failure_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + DEBUG1( "core_connection_data_c::clear_ap_failure_count() - this AP had %u previous failures", + iter->count ); + + association_failure_count_m.remove( iter ); + + delete iter; + iter = NULL; + + return; + } + + iter = association_failure_count_m.next(); + } + + DEBUG( "core_connection_data_c::clear_ap_failure_count() - this AP had no previous failures" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_connection_data_c::ap_authentication_failure_count( + const core_mac_address_s& bssid ) + { + core_ap_auth_failure_count_s* iter = authentication_failure_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + return iter->count; + } + + iter = authentication_failure_count_m.next(); + } + + return CORE_FAILURE_NONE; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::increase_ap_authentication_failure_count( + const core_mac_address_s& bssid ) + { + core_ap_auth_failure_count_s* iter = authentication_failure_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + iter->count++; + return; + } + + iter = authentication_failure_count_m.next(); + } + + iter = new core_ap_auth_failure_count_s; + if ( iter ) + { + iter->bssid = bssid; + iter->count = CORE_FAILURE_NONE + 1; + authentication_failure_count_m.append( iter ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::clear_all_authentication_failure_counts() + { + DEBUG( "core_connection_data_c::clear_all_authentication_failure_counts()" ); + + core_ap_auth_failure_count_s* iter = authentication_failure_count_m.first(); + while ( iter ) + { + DEBUG1( "core_connection_data_c::clear_all_authentication_failure_counts() - this AP had %u previous failures", + iter->count ); + + authentication_failure_count_m.remove( iter ); + + delete iter; + iter = NULL; + + iter = authentication_failure_count_m.next(); + } + + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_connection_data_c::ap_deauthentication_count( + const core_mac_address_s& bssid ) + { + core_ap_failure_count_s* iter = deauthentication_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + return iter->count; + } + + iter = deauthentication_count_m.next(); + } + + return CORE_FAILURE_NONE; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::increase_ap_deauthentication_count( + const core_mac_address_s& bssid ) + { + core_ap_failure_count_s* iter = deauthentication_count_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + iter->count++; + return; + } + + iter = deauthentication_count_m.next(); + } + + iter = new core_ap_failure_count_s; + if ( iter ) + { + iter->bssid = bssid; + iter->count = CORE_FAILURE_NONE + 1; + deauthentication_count_m.append( iter ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_connection_data_c::last_failed_eap_type() const + { + return last_eap_type_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_failed_eap_type( + u32_t type ) + { + last_eap_type_m = type; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_connection_data_c::last_eap_error() const + { + return last_eap_error_code_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_eap_error( + u32_t error ) + { + last_eap_error_code_m = error; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_scan_channels_c& core_connection_data_c::adjacent_ap_channels() const + { + return adjacent_ap_channels_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_adjacent_ap_channels( + const core_scan_channels_c& channels ) + { + adjacent_ap_channels_m.set( channels ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::merge_adjacent_ap_channels( + const core_scan_channels_c& channels ) + { + adjacent_ap_channels_m.merge( channels ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_eapol_authentication_started() const + { + return is_eapol_authentication_started_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_eapol_authentication_started( + bool_t is_authentication_started ) + { + is_eapol_authentication_started_m = is_authentication_started; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_eapol_authenticating() const + { + return is_eapol_authenticating_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_eapol_authenticating( + bool_t is_authenticating ) + { + is_eapol_authenticating_m = is_authenticating; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_mac_address_s& core_connection_data_c::eapol_auth_bssid() const + { + return eapol_auth_bssid_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_eapol_auth_bssid( + const core_mac_address_s& bssid ) + { + eapol_auth_bssid_m = bssid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_list_c& core_connection_data_c::traffic_stream_list() + { + return traffic_stream_list_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_list_c& core_connection_data_c::virtual_traffic_stream_list() + { + return virtual_traffic_stream_list_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_eapol_connecting() const + { + return is_eapol_connecting_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_eapol_connecting( + bool_t is_eapol_connecting ) + { + is_eapol_connecting_m = is_eapol_connecting; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_disconnecting() const + { + return is_disconnecting_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_disconnecting( + bool_t is_disconnecting ) + { + is_disconnecting_m = is_disconnecting; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_rcpi_roam_interval_s& core_connection_data_c::rcpi_roam_interval() const + { + return rcpi_roam_interval_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::reset_rcpi_roam_interval() + { + rcpi_roam_interval_m.count = 0; + rcpi_roam_interval_m.interval = device_settings_m.rcpi_roam_min_interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_core_rcpi_roam_interval( + const core_rcpi_roam_interval_s& interval ) + { + rcpi_roam_interval_m = interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_roam_reason_e core_connection_data_c::last_roam_reason() const + { + return last_roam_reason_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_roam_reason( + core_roam_reason_e reason ) + { + last_roam_reason_m = reason; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_roam_failed_reason_e core_connection_data_c::last_roam_failed_reason() const + { + return last_roam_failed_reason_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_last_roam_failed_reason( + core_roam_failed_reason_e reason ) + { + last_roam_failed_reason_m = reason; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_ap_power_save_test_run( + const core_mac_address_s& bssid, + bool_t& is_success ) + { + core_ap_power_save_test_verdict_s* iter = power_save_test_verdict_m.first(); + while ( iter ) + { + if ( iter->bssid == bssid ) + { + is_success = iter->is_success; + + return true_t; + } + + iter = power_save_test_verdict_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::add_ap_power_save_test_verdict( + const core_mac_address_s& bssid, + bool_t is_success ) + { + core_ap_power_save_test_verdict_s* iter = new core_ap_power_save_test_verdict_s; + if ( iter ) + { + iter->bssid = bssid; + iter->is_success = is_success; + + power_save_test_verdict_m.append( iter ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::is_eapol_require_immediate_reconnect() const + { + return is_eapol_require_immediate_reconnect_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_eapol_require_immediate_reconnect( + bool_t is_immediate_reconnect_required ) + { + is_eapol_require_immediate_reconnect_m = is_immediate_reconnect_required; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_connection_data_c::voice_call_state() const + { + DEBUG1( "core_connection_data_c::voice_call_state() - returning %u", is_voice_call_on_m ); + return is_voice_call_on_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_voice_call_state( const bool_t& is_voice_call_on ) + { + DEBUG1( "core_connection_data_c::set_voice_call_state( %u )", is_voice_call_on ); + is_voice_call_on_m = is_voice_call_on; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u64_t& core_connection_data_c::get_previous_rrm_measurement_request_time() const + { + return previous_rrm_measurement_request_time_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_previous_rrm_measurement_request_time( const u64_t& timestamp) + { + previous_rrm_measurement_request_time_m = timestamp; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_access_class_traffic_status_e core_connection_data_c::ac_traffic_status( + core_access_class_e access_class ) const + { + return ac_traffic_status_m[access_class]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_ac_traffic_status( + core_access_class_e access_class, + core_access_class_traffic_status_e status ) + { + ac_traffic_status_m[access_class] = status; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_access_class_traffic_mode_e core_connection_data_c::ac_traffic_mode( + core_access_class_e access_class ) const + { + return ac_traffic_mode_m[access_class]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_connection_data_c::set_ac_traffic_mode( + core_access_class_e access_class, + core_access_class_traffic_mode_e mode ) + { + ac_traffic_mode_m[access_class] = mode; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_eapol_handler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_eapol_handler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1082 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: handler to EAPOL callbacks. +* +*/ + + +#include "core_eapol_handler.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "abs_core_protected_setup_handler.h" +#include "am_debug.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_eapol_handler_c::core_eapol_handler_c( + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + abs_wlan_eapol_callback_interface_c(), + server_m( server ), + drivers_m( drivers ), + adaptation_m( adaptation ), + handler_m( NULL ), + protected_setup_handler_m( NULL ) + { + DEBUG( "core_eapol_handler_c::core_eapol_handler_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_eapol_handler_c::~core_eapol_handler_c() + { + DEBUG( "core_eapol_handler_c::~core_eapol_handler_c()" ); + server_m = NULL; + drivers_m = NULL; + adaptation_m = NULL; + handler_m = NULL; + protected_setup_handler_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +abs_wlan_eapol_callback_interface_c* core_eapol_handler_c::eapol_handler() + { + return handler_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_eapol_handler_c::set_eapol_handler( + abs_wlan_eapol_callback_interface_c* handler ) + { + handler_m = handler; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_eapol_handler_c::set_protected_setup_handler( + abs_core_protected_setup_handler_c* handler ) + { + protected_setup_handler_m = handler; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::packet_send( + network_id_c * send_network_id, + u8_t * packet_data, + u32_t packet_data_length, + bool_t send_unencrypted ) + { + DEBUG( "core_eapol_handler_c::packet_send()" ); + + ASSERT ( server_m != NULL ); + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_eapol_handler_c::packet_send() - not connected or attempting connection, ignoring" ); + + return core_error_ok; + } + + if ( handler_m ) + { + return handler_m->packet_send( + send_network_id, + packet_data, + packet_data_length, + send_unencrypted ); + } + + server_m->send_data_frame( + *server_m->get_connection_data()->current_ap_data(), + core_frame_type_ethernet, + static_cast( packet_data_length ), + packet_data, + core_access_class_voice, + send_network_id->destination(), + send_unencrypted ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::associate( + wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ) + { + DEBUG( "core_eapol_handler_c::associate()" ); + + ASSERT ( handler_m ); + if ( handler_m ) + { + return handler_m->associate( + authentication_mode ); + } + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::disassociate( + network_id_c * receive_network_id, + const bool_t self_disassociation ) + { + DEBUG( "core_eapol_handler_c::disassociate()" ); + + ASSERT ( handler_m ); + if ( handler_m ) + { + return handler_m->disassociate( + receive_network_id, + self_disassociation ); + } + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::packet_data_session_key( + network_id_c * send_network_id, + session_key_c * key ) + { + DEBUG( "core_eapol_handler_c::packet_data_session_key()" ); + ASSERT( key != NULL); + ASSERT( send_network_id != NULL); + + if ( !handler_m ) + { + ASSERT ( server_m != NULL ); + core_cipher_key_type_e type = + core_tools_c::cipher_key_type( + key->eapol_key_type, + server_m->get_connection_data()->current_ap_data()->best_pairwise_cipher(), + server_m->get_connection_data()->current_ap_data()->best_group_cipher() ); + + core_mac_address_s mac( BROADCAST_MAC_ADDR ); + if ( key->eapol_key_type == wlan_eapol_if_eapol_key_type_unicast ) + { + mac = send_network_id->destination(); + } + + ASSERT ( drivers_m != NULL ); + drivers_m->add_cipher_key( + type, + static_cast( key->key_index ), + static_cast( key->key_length ), + key->key, + mac, + true_t ); + + return core_error_ok; + } + + return handler_m->packet_data_session_key( + send_network_id, + key ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_eapol_handler_c::state_notification( + state_notification_c * state ) + { + DEBUG( "core_eapol_handler_c::state_notification()" ); + + const u32_t eap_type_vendor_id_ietf = 0; + const u32_t eap_type_vendor_id_WFA = 0x00372A; + + ASSERT ( server_m != NULL ); + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_eapol_handler_c::state_notification() - not connected or attempting connection, ignoring" ); + + return; + } + + ASSERT ( state != NULL ); + + if ( state->protocol_layer == wlan_eapol_if_eap_protocol_layer_wlan_authentication || + state->protocol_layer == wlan_eapol_if_eap_protocol_layer_wapi ) + { + if ( state->current_state == wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled ) + { + if ( server_m->get_connection_data()->last_failed_eap_type() == EAP_TYPE_NONE ) + { + // We know that vendor_type values (in ietf and WFA) are not overlapping + // and thus there is no need for storing vendor_id's. + if ( state->eap_type_vendor_id == eap_type_vendor_id_ietf + || state->eap_type_vendor_id == eap_type_vendor_id_WFA ) + { + server_m->get_connection_data()->set_last_failed_eap_type( + state->eap_type_vendor_type ); + server_m->get_connection_data()->set_last_eap_error( + state->authentication_error ); + } + else + { + DEBUG1( "core_eapol_handler_c::state_notification() - Unknown vendor_id %i in EAP-type. Type not stored.", + state->eap_type_vendor_id ); + } + } + } + + handle_wlan_authentication_state( + state->current_state, + state->network_id.destination() ); + } + else + { + if ( state->protocol_layer == wlan_eapol_if_eap_protocol_layer_general && + state->current_state == wlan_eapol_if_eap_state_general_authentication_error ) + { + DEBUG( "core_eapol_handler_c::state_notification() - EAP-specific authentication error:" ); + } + else if ( state->protocol_layer == wlan_eapol_if_eap_protocol_layer_eap && + state->current_state == wlan_eapol_if_eap_state_authentication_terminated_unsuccessfully ) + { + DEBUG( "core_eapol_handler_c::state_notification() - EAP-layer error:" ); + } + + if ( ( state->protocol_layer == wlan_eapol_if_eap_protocol_layer_general && + state->current_state == wlan_eapol_if_eap_state_general_authentication_error ) || + ( state->protocol_layer == wlan_eapol_if_eap_protocol_layer_eap && + state->current_state == wlan_eapol_if_eap_state_authentication_terminated_unsuccessfully ) ) + { + DEBUG2( "core_eapol_handler_c::state_notification() - type: vendor_id: %u, vendor_type: %u", + state->eap_type_vendor_id, + state->eap_type_vendor_type ); + DEBUG1( "core_eapol_handler_c::state_notification() - error: %u", + state->authentication_error ); + DEBUG1( "core_eapol_handler_c::state_notification() - previous type: %u", + server_m->get_connection_data()->last_failed_eap_type() ); + DEBUG1( "core_eapol_handler_c::state_notification() - previous error: %u", + server_m->get_connection_data()->last_eap_error() ); + + if ( server_m->get_connection_data()->last_failed_eap_type() == EAP_TYPE_NONE ) + { + // We know that vendor_type values (in ietf and WFA) are not overlapping + // and thus there is no need for storing vendor_id's. + if ( state->eap_type_vendor_id == eap_type_vendor_id_ietf + || state->eap_type_vendor_id == eap_type_vendor_id_WFA ) + { + server_m->get_connection_data()->set_last_failed_eap_type( + state->eap_type_vendor_type ); + server_m->get_connection_data()->set_last_eap_error( + state->authentication_error ); + } + else + { + DEBUG1( "core_eapol_handler_c::state_notification() - Unknown vendor_id %i in EAP-type. Type not stored.", + state->eap_type_vendor_id ); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::reassociate( + network_id_c * send_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e authentication_type, + u8_t * PMKID, + u32_t PMKID_length ) + { + DEBUG( "core_eapol_handler_c::reassociate()" ); + + ASSERT ( handler_m ); + if ( handler_m ) + { + return handler_m->reassociate( + send_network_id, + authentication_type, + PMKID, + PMKID_length ); + } + return core_error_ok; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_eapol_handler_c::convert_core_error_to_if_status( + core_error_e core_error ) + { + DEBUG1( "core_eapol_handler_c::convert_core_error_to_if_status( %i )", core_error ); + switch ( core_error ) + { + case core_error_ok: + return wlan_eapol_if_error_ok; + case core_error_request_pending: + return wlan_eapol_if_error_pending_request; + case core_error_no_memory: + return wlan_eapol_if_error_allocation_error; + case core_error_illegal_argument: + return wlan_eapol_if_error_illegal_parameter; + case core_error_general: + return wlan_eapol_if_error_process_general_error; + default: + DEBUG( "core_eapol_handler_c::convert_core_error_to_if_status - Error: No special conversion to given status" ); + return wlan_eapol_if_error_process_general_error; + } + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_eapol_handler_c::send_data( + const void * const data, + const u32_t length ) + { + DEBUG2( "core_eapol_handler_c::send_data(data=0x%08X, length=%i)", data, length ); + + if ( !data || length == 0 ) + { + DEBUG( "core_eapol_handler_c::send_data() - Parameters not valid. Ignoring." ); + + core_wlan_eapol_if_function_c function; + if ( function.generate_error( wlan_eapol_if_error_illegal_parameter, wlan_eapol_if_message_type_function_none ) + == core_error_ok ) + { + adaptation_m->process_data( function.get_data(), function.size() ); + } + return wlan_eapol_if_error_illegal_parameter; + } + + core_wlan_eapol_if_function_c function( static_cast( const_cast( data ) ), length ); + + function.debug_print(); + + core_error_e error( core_error_ok ); + + // 1. Get function + // 2. Parse it's parameters + // 3. Call actual function + + // Check error case here. + wlan_eapol_if_message_type_e type = function.get_type(); + if ( type == wlan_eapol_if_message_type_error ) + { + DEBUG( "core_eapol_handler_c::send_data() - Error received." ); + + wlan_eapol_if_error_e parsed_errorcode; + wlan_eapol_if_message_type_function_e parsed_function; + + error = function.parse_error( &parsed_errorcode, &parsed_function ); + if ( error != core_error_ok ) + { + DEBUG1( "core_eapol_handler_c::send_data() - Could not parse error message (parsing error=%i)", error ); + // Do not send Error message when error message parsing fails... + } + else + { + handle_error( parsed_errorcode, parsed_function ); + } + return wlan_eapol_if_error_ok; + } + else if ( type != wlan_eapol_if_message_type_function ) + { + DEBUG( "core_eapol_handler_c::send_data() - Type parameter is not valid. Ignoring." ); + + if ( function.generate_error( wlan_eapol_if_error_illegal_parameter, wlan_eapol_if_message_type_function_none ) + == core_error_ok ) + { + adaptation_m->process_data( function.get_data(), function.size() ); + } + return wlan_eapol_if_error_illegal_parameter; + } + + wlan_eapol_if_message_type_function_e func = function.get_function(); + + switch ( func ) + { + // These functions are used only from WLAN Engine to EAPOL. So, no need to parse and handle... + case wlan_eapol_if_message_type_function_check_pmksa_cache: + case wlan_eapol_if_message_type_function_start_authentication: + case wlan_eapol_if_message_type_function_complete_association: + case wlan_eapol_if_message_type_function_disassociation: + case wlan_eapol_if_message_type_function_start_preauthentication: + case wlan_eapol_if_message_type_function_start_reassociation: + case wlan_eapol_if_message_type_function_complete_reassociation: + case wlan_eapol_if_message_type_function_start_wpx_fast_roam_reassociation: + case wlan_eapol_if_message_type_function_complete_wpx_fast_roam_reassociation: + case wlan_eapol_if_message_type_function_packet_process: + case wlan_eapol_if_message_type_function_tkip_mic_failure: + case wlan_eapol_if_message_type_function_eap_acknowledge: + case wlan_eapol_if_message_type_function_update_header_offset: + case wlan_eapol_if_message_type_function_update_wlan_database_reference_values: + DEBUG1( "core_eapol_handler_c::send_data() - Error: Message %i coming to from EAPOL to Engine (wrong direction...)", func ); + return wlan_eapol_if_error_illegal_parameter; + + // These functions are handled in WLAN Engine. + case wlan_eapol_if_message_type_function_complete_check_pmksa_cache: + { + core_type_list_c network_id_list; + + error = function.parse_complete_check_pmksa_cache( + network_id_list ); + if ( error == core_error_ok ) + { + error = complete_check_pmksa_cache( network_id_list ); + } + break; + } + case wlan_eapol_if_message_type_function_packet_send: + { + network_id_c network_id( NULL, 0, NULL, 0, 0 ); + u8_t * packet( NULL ); + u32_t packet_length( 0 ); + + wlan_eapol_if_eapol_key_authentication_type_e type( + server_m->get_eapol_instance().authentication_type() ); + bool_t send_unecrypted( false_t ); + if( type == wlan_eapol_if_eapol_key_authentication_type_wapi || + type == wlan_eapol_if_eapol_key_authentication_type_wapi_psk ) + { + send_unecrypted = true_t; + } + + error = function.parse_packet_send( + &network_id, + &packet, &packet_length ); + if ( error == core_error_ok ) + { + error = packet_send( &network_id, packet, packet_length, send_unecrypted ); + } + break; + } + case wlan_eapol_if_message_type_function_associate: + { + wlan_eapol_if_eapol_key_authentication_mode_e auth_mode( wlan_eapol_if_eapol_key_authentication_mode_none ); + + error = function.parse_associate( + &auth_mode ); + if ( error == core_error_ok ) + { + error = associate( auth_mode ); + } + break; + } + case wlan_eapol_if_message_type_function_disassociate: + { + network_id_c network_id( NULL, 0, NULL, 0, 0 ); + bool_t self_disassociation( false_t ); + + error = function.parse_disassociate( + &network_id, + &self_disassociation ); + if ( error == core_error_ok ) + { + error = disassociate( &network_id, self_disassociation ); + } + break; + } + case wlan_eapol_if_message_type_function_packet_data_session_key: + { + network_id_c network_id( NULL, 0, NULL, 0, 0 ); + session_key_c session_key( NULL, 0, NULL, 0, wlan_eapol_if_eapol_key_type_broadcast, 0, false_t ); + + error = function.parse_packet_data_session_key( + &network_id, + &session_key ); + if ( error == core_error_ok ) + { + error = packet_data_session_key( &network_id, &session_key ); + } + break; + } + case wlan_eapol_if_message_type_function_state_notification: + { + network_id_c network_id( NULL, 0, NULL, 0, 0 ); + state_notification_c state_notif( &network_id, wlan_eapol_if_eap_protocol_layer_none, 0, 0, 0, 0, false_t, wlan_eapol_if_eap_status_none ); + + error = function.parse_state_notification( + &state_notif ); + if ( error == core_error_ok ) + { + state_notification( &state_notif ); + } + break; + } + case wlan_eapol_if_message_type_function_reassociate: + { + network_id_c network_id( NULL, 0, NULL, 0, 0 ); + wlan_eapol_if_eapol_key_authentication_type_e authentication_type( wlan_eapol_if_eapol_key_authentication_type_none ); + u8_t * pmkid( NULL ); + u32_t pmkid_length( 0 ); + + error = function.parse_reassociate( + &network_id, + &authentication_type, + &pmkid, + &pmkid_length ); + if ( error == core_error_ok ) + { + error = reassociate( + &network_id, + authentication_type, + pmkid, + pmkid_length ); + } + break; + } + case wlan_eapol_if_message_type_function_complete_start_wpx_fast_roam_reassociation: + { + network_id_c network_id( NULL, 0, NULL, 0, 0 ); + u8_t * reassociation_request_ie( NULL ); + u32_t reassociation_request_ie_length( 0 ); + + error = function.parse_complete_start_wpx_fast_roam_reassociation( + &network_id, + &reassociation_request_ie, + &reassociation_request_ie_length ); + if ( error == core_error_ok ) + { + error = complete_start_wpx_fast_roam_reassociation( + &network_id, + reassociation_request_ie, + reassociation_request_ie_length ); + } + break; + } + case wlan_eapol_if_message_type_function_new_protected_setup_credentials: + { + core_type_list_c< protected_setup_credential_c > credential_list; + + error = function.parse_new_protected_setup_credentials( + credential_list ); + if ( error == core_error_ok ) + { + error = new_protected_setup_credentials( + credential_list ); + } + break; + } + case wlan_eapol_if_message_type_function_none: + default: + DEBUG1( "core_eapol_handler_c::send_data() - Error: unknown function %i", func ); + } + + // Check if error message should be sent + if ( error != core_error_ok + && error != core_error_request_pending ) + { + // send error message + core_error_e ret_val = function.generate_error( + static_cast( core_eapol_handler_c::convert_core_error_to_if_status( error ) ), + func ); + if ( ret_val == core_error_ok ) + { + adaptation_m->process_data( function.get_data(), function.size() ); + } + } + return core_eapol_handler_c::convert_core_error_to_if_status( error ); + } + + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::complete_check_pmksa_cache( + core_type_list_c & network_id_list ) + { + DEBUG( "core_eapol_handler_c::complete_check_pmksa_cache()" ); + + return server_m->get_eapol_instance().update_completed_check_pmksa_cache_list( network_id_list ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ) + { + DEBUG( "core_eapol_handler_c::complete_start_wpx_fast_roam_reassociation()" ); + + if ( handler_m ) + { + return handler_m->complete_start_wpx_fast_roam_reassociation( + receive_network_id, + reassociation_request_ie, + reassociation_request_ie_length ); + } + return core_error_ok; + } + + +enum protected_setup_authentication_type_e +{ + protected_setup_authentication_type_None = 0x0000, + protected_setup_authentication_type_Open = 0x0001, + protected_setup_authentication_type_WPAPSK = 0x0002, + protected_setup_authentication_type_Shared = 0x0004, + protected_setup_authentication_type_WPA = 0x0008, + protected_setup_authentication_type_WPA2 = 0x0010, + protected_setup_authentication_type_WPA2PSK = 0x0020, +}; + +enum protected_setup_encryption_type_e +{ + protected_setup_encryption_type_None = 0x0001, + protected_setup_encryption_type_WEP = 0x0002, + protected_setup_encryption_type_TKIP = 0x0004, + protected_setup_encryption_type_AES = 0x0008, +}; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ) + { + DEBUG( "core_eapol_handler_c::new_protected_setup_credentials()" ); + + ASSERT( protected_setup_handler_m ); + + for ( protected_setup_credential_c* credential = credential_list.first(); credential; credential = credential_list.next() ) + { + core_iap_data_s iap_data; + core_tools_c::fillz( + &iap_data, + sizeof ( iap_data ) ); + + iap_data.id = 0; + iap_data.op_mode = core_operating_mode_infrastructure; + iap_data.is_hidden = false_t; + iap_data.authentication_mode = core_authentication_mode_open; + iap_data.wpa_preshared_key_in_use = false_t; + iap_data.is_wpa_overriden = false_t; + iap_data.used_adhoc_channel = 0; + iap_data.is_dynamic_ip_addr = true_t; + iap_data.is_roaming_allowed = true_t; + + // SSID + if ( credential->ssid_length > MAX_SSID_LEN ) + { + DEBUG1( "core_eapol_handler_c::new_protected_setup_credentials() - Error: Too long SSID (%d bytes). Ignoring credentials.", + credential->ssid_length ); + } + else + { + iap_data.ssid.length = + credential->ssid_length; + core_tools_c::copy( + &iap_data.ssid.ssid[0], + credential->ssid, + iap_data.ssid.length ); + + // Security mode + switch ( credential->authentication_type ) + { + case protected_setup_authentication_type_WPAPSK: + iap_data.security_mode = core_security_mode_wpa; + iap_data.wpa_preshared_key_in_use = true_t; + break; + case protected_setup_authentication_type_WPA2PSK: + iap_data.security_mode = core_security_mode_wpa2only; + iap_data.wpa_preshared_key_in_use = true_t; + break; + case protected_setup_authentication_type_WPA: + iap_data.security_mode = core_security_mode_wpa; + break; + case protected_setup_authentication_type_WPA2: + iap_data.security_mode = core_security_mode_wpa2only; + break; + case protected_setup_authentication_type_Shared: + iap_data.security_mode = core_security_mode_wep; + iap_data.authentication_mode = core_authentication_mode_shared; + break; + case protected_setup_authentication_type_Open: + if ( credential->encryption_type == protected_setup_encryption_type_WEP ) + { + iap_data.security_mode = core_security_mode_wep; + } + else + { + iap_data.security_mode = core_security_mode_allow_unsecure; + } + break; + case protected_setup_authentication_type_None: + /** Falls through on purpose. */ + default: + iap_data.security_mode = core_security_mode_allow_unsecure; + break; + } + + bool_t ignore_current_credential( false_t ); + // Encryption keys + switch ( iap_data.security_mode ) + { + case core_security_mode_wpa: + /** Falls through on purpose. */ + case core_security_mode_wpa2only: + if ( iap_data.wpa_preshared_key_in_use && + credential->network_key_list.first() ) + { + network_key_c* key = credential->network_key_list.current(); + if ( key->network_key_length > MAX_WPA_PSK_LENGTH ) + { + DEBUG1( "core_eapol_handler_c::new_protected_setup_credentials() - Error: Too long WPA Passphrase (%d bytes). Ignoring credentials.", + key->network_key_length ); + ignore_current_credential = true_t; + } + else + { + iap_data.wpa_preshared_key.key_length = key->network_key_length; + core_tools_c::copy( + &iap_data.wpa_preshared_key.key_data[0], + key->network_key, + iap_data.wpa_preshared_key.key_length ); + } + } + break; + case core_security_mode_wep: + { + for ( network_key_c* key = credential->network_key_list.first(); key; key = credential->network_key_list.next()) + { + core_wep_key_s wep_key; + if ( key->network_key_length > MAX_WEP_KEY_LENGTH) + { + // WEP key is ignored if its key_length is too long. + DEBUG2( "core_eapol_handler_c::new_protected_setup_credentials() - Error: Too long WEP key for key index %d (%d bytes). Ignoring WEP key.", + key->network_key_index, + key->network_key_length ); + } + else + { + wep_key.key_index = key->network_key_index; + wep_key.key_length = key->network_key_length; + core_tools_c::copy( + &wep_key.key_data[0], + key->network_key, + wep_key.key_length ); + + if ( wep_key.key_index == 1 ) + { + iap_data.wep_key1 = wep_key; + } + else if ( wep_key.key_index == 2 ) + { + iap_data.wep_key2 = wep_key; + } + else if ( wep_key.key_index == 3 ) + { + iap_data.wep_key3 = wep_key; + } + else if ( wep_key.key_index == 4 ) + { + iap_data.wep_key4 = wep_key; + } + else + { + // WEP key is ignored if its key_index is not valid. + DEBUG1( "core_eapol_handler_c::new_protected_setup_credentials() - Error: WEP key index is not valid (it was %d). Ignoring WEP key.", + wep_key.key_index ); + } + } + } + + /** Use the first defined key as the default key. */ + if ( iap_data.wep_key1.key_length ) + { + iap_data.default_wep_key = 0; + } + else if ( iap_data.wep_key2.key_length ) + { + iap_data.default_wep_key = 1; + } + else if ( iap_data.wep_key3.key_length ) + { + iap_data.default_wep_key = 2; + } + else if ( iap_data.wep_key4.key_length ) + { + iap_data.default_wep_key = 3; + } + else + { + // Credentials are ignored if there was no valid keys. + DEBUG( "core_eapol_handler_c::new_protected_setup_credentials() - Error: No valid WEP keys defined. Could not set default wep key. Ignoring credentials." ); + ignore_current_credential = true_t; + } + + break; + } + default: + break; + } + + if ( !ignore_current_credential ) + { + protected_setup_handler_m->handle_protected_setup_network( iap_data ); + } + } + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_eapol_handler_c::handle_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ) + { + DEBUG2( "core_eapol_handler_c::handle_error() - Received error message: errorcode=%i, function=%i", errorcode, function ); + + if ( handler_m ) + { + handler_m->handle_error( + errorcode, + function ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_eapol_handler_c::handle_wlan_authentication_state( + u32_t state, + const core_mac_address_s& bssid ) + { +#ifdef _DEBUG + switch ( state ) + { + case wlan_eapol_if_eapol_wlan_authentication_state_no_response: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_no_response" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_this_ap_failed: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_this_ap_failed" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_failed_completely: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_failed_completely" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_association_ok: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_association_ok" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_802_11_auth_algorithm_not_supported: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_802_11_auth_algorithm_not_supported" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_eap_authentication_running: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_eap_authentication_running" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_4_way_handshake_running: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_4_way_handshake_running" ); + break; + case wlan_eapol_if_eapol_wlan_authentication_state_wapi_authentication_running: + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - wlan_eapol_if_eapol_wlan_authentication_state_wapi_authentication_running" ); + break; + } +#endif // _DEBUG + + const core_mac_address_s cur_bssid( + server_m->get_connection_data()->eapol_auth_bssid() ); + + DEBUG6( "core_eapol_handler_c::handle_wlan_authentication_state() - notification BSSID is %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + DEBUG6( "core_eapol_handler_c::handle_wlan_authentication_state() - current BSSID is %02X:%02X:%02X:%02X:%02X:%02X", + cur_bssid.addr[0], cur_bssid.addr[1], cur_bssid.addr[2], + cur_bssid.addr[3], cur_bssid.addr[4], cur_bssid.addr[5] ); + + if ( state == wlan_eapol_if_eapol_wlan_authentication_state_eap_authentication_running || + state == wlan_eapol_if_eapol_wlan_authentication_state_4_way_handshake_running || + state == wlan_eapol_if_eapol_wlan_authentication_state_wapi_authentication_running ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - marking is_eapol_authenticating as true" ); + + /** + * EAPOL has started authenticating, reset the previous + * failures. + */ + ASSERT ( server_m != NULL ); + + server_m->get_connection_data()->set_eapol_authenticating( + true_t ); + server_m->get_connection_data()->set_last_failed_eap_type( + EAP_TYPE_NONE ); + server_m->get_connection_data()->set_last_eap_error( + EAP_ERROR_NONE ); + + return; + } + + // EAP-FAST will fail after PAC provisioning. With this state EAPOL requires wlan engine to reconnect again. + if ( state == wlan_eapol_if_eapol_wlan_authentication_state_immediate_reconnect ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - immediate reconnect required" ); + + server_m->get_connection_data()->set_eapol_require_immediate_reconnect( true_t ); + + return; + } + + if ( !is_eapol_wlan_authentication_state_success( state ) && + !is_eapol_wlan_authentication_state_failure( state ) ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - neither a failure nor a success, ignoring notification" ); + + return; + } + else if ( !server_m->get_connection_data()->is_eapol_authenticating() && + !server_m->get_connection_data()->is_eapol_authentication_started() ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - failure or success received while not authenticating, ignoring notification" ); + + return; + } + else if ( bssid != ZERO_MAC_ADDR && + bssid != cur_bssid ) + { + DEBUG( "core_ap_data_c::instance() - notification doesn't match the current BSSID, ignoring notification" ); + + return; + } + + bool_t is_authentication_started( server_m->get_connection_data()->is_eapol_authenticating() ); + + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - marking is_eapol_authenticating as false" ); + server_m->get_connection_data()->set_eapol_authenticating( + false_t ); + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - marking is_eapol_authentication_started as false" ); + server_m->get_connection_data()->set_eapol_authentication_started( + false_t ); + + if ( handler_m ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - eapol handler registered" ); + + // Check whether authentication ended without getting even first message from AP. + if ( is_authentication_started + || state == wlan_eapol_if_eapol_wlan_authentication_state_failed_completely + || state == wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled + || state == wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - completing request" ); + server_m->request_complete( + REQUEST_ID_CORE_INTERNAL, + eapol_wlan_authentication_state_to_error( state ) ); + } + else + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - completing request (authentication not yet started)" ); + server_m->request_complete( + REQUEST_ID_CORE_INTERNAL, + core_error_eapol_auth_start_timeout ); + } + } + else + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - no eapol handler registered" ); + + /** + * Since we have no operation to complete, it means this indication is + * about a reauthentication. + */ + if ( is_eapol_wlan_authentication_state_failure( state ) ) + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - reauthentication has failed, scheduling a roam" ); + server_m->schedule_roam( + core_operation_handle_bss_lost_c::core_bss_lost_reason_failed_reauthentication ); + } + else + { + DEBUG( "core_eapol_handler_c::handle_wlan_authentication_state() - reauthentication has succeeded" ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_eapol_handler_c::eapol_wlan_authentication_state_to_error( + u32_t state ) const + { + switch ( state ) + { + case wlan_eapol_if_eapol_wlan_authentication_state_no_response: + /** Falls through on purpose. */ + case wlan_eapol_if_eapol_wlan_authentication_state_this_ap_failed: + return core_error_eapol_failure; + case wlan_eapol_if_eapol_wlan_authentication_state_failed_completely: + /** Falls through on purpose. */ + case wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled: + return core_error_eapol_total_failure; + case wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull: + /** Falls through on purpose. */ + default: + return core_error_ok; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_eapol_handler_c::is_eapol_wlan_authentication_state_failure( + u32_t state ) const + { + if ( state == wlan_eapol_if_eapol_wlan_authentication_state_no_response || + state == wlan_eapol_if_eapol_wlan_authentication_state_this_ap_failed || + state == wlan_eapol_if_eapol_wlan_authentication_state_failed_completely || + state == wlan_eapol_if_eapol_wlan_authentication_state_authentication_cancelled ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_eapol_handler_c::is_eapol_wlan_authentication_state_success( + u32_t state ) const + { + if ( state == wlan_eapol_if_eapol_wlan_authentication_state_authentication_successfull ) + { + return true_t; + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames. +* +*/ + + +#include "core_frame_action.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u16_t CORE_FRAME_ACTION_MIN_LENGTH = 25; +const u16_t CORE_FRAME_ACTION_CATEGORY_INDEX = 24; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_c* core_frame_action_c::instance( + const core_frame_dot11_c& frame ) + { + DEBUG( "core_frame_action_c::instance()" ); + + if ( frame.data_length() < CORE_FRAME_ACTION_MIN_LENGTH ) + { + DEBUG( "core_frame_action_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + core_frame_action_c* instance = new core_frame_action_c( + frame.data_length(), + frame.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_action_c::instance() - unable to create an instance" ); + + return NULL; + } + + if ( instance->type() != core_frame_dot11_c::core_dot11_type_action ) + { + DEBUG( "core_frame_action_c::instance() - not a valid action frame" ); + delete instance; + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_c::~core_frame_action_c() + { + DEBUG( "core_frame_action_c::~core_frame_action_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_action_c::category() const + { + return data_m[CORE_FRAME_ACTION_CATEGORY_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_action_c::set_category( u8_t cat ) + { + data_m[CORE_FRAME_ACTION_CATEGORY_INDEX] = cat; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_action_c::generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t category ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_c::generate( + core_frame_dot11_c::core_dot11_type_action, + duration, + destination, + source, + bssid, + sequence_control ); + + // Category + data_m[data_length_m++] = category; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_c::core_frame_action_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_action_c::core_frame_action_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action_nr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action_nr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames for Neighbor Reports. +* +*/ + + +#include "core_frame_action_nr.h" +#include "core_frame_nr_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u16_t CORE_FRAME_ACTION_NR_IE_INDEX = 3; +const u16_t CORE_FRAME_ACTION_NR_MIN_LENGTH = 28; +const u16_t CORE_FRAME_ACTION_NR_LENGTH = 61; +const u16_t CORE_FRAME_ACTION_NR_TOKEN_INDEX = 26; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_nr_c* core_frame_action_nr_c::instance( + const core_frame_action_c& frame, + bool_t is_copied ) + { + if ( frame.data_length() < CORE_FRAME_ACTION_NR_MIN_LENGTH ) + { + DEBUG( "core_frame_action_nr_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( frame.data() ); + u16_t buffer_length( 0 ); + + if( is_copied ) + { + buffer_length = frame.data_length(); + buffer = new u8_t[buffer_length]; + + if( !buffer ) + { + DEBUG( "core_frame_action_nr_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( buffer, frame.data(), buffer_length ); + } + + core_frame_action_nr_c* instance = new core_frame_action_nr_c( + buffer_length, + buffer, + buffer_length ); + + if ( !instance ) + { + DEBUG( "core_frame_action_nr_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_nr_c* core_frame_action_nr_c::instance( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_nr_ie_c* nr_ie ) + { + const u8_t max_data_length = CORE_FRAME_ACTION_NR_LENGTH; + + u8_t* buffer = new u8_t[max_data_length]; + if ( !buffer ) + { + DEBUG( "core_frame_action_nr_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_action_nr_c* instance = + new core_frame_action_nr_c( 0, buffer, max_data_length ); + if ( !instance ) + { + DEBUG( "core_frame_action_nr_c::instance() - unable to create an instance" ); + delete[] buffer; + buffer = NULL; + + return NULL; + } + + instance->generate( + duration, + destination, + source, + bssid, + sequence_control, + action_type, + dialog_token, + nr_ie ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_nr_c::~core_frame_action_nr_c() + { + DEBUG1( "core_frame_action_nr_c::~core_frame_action_nr_c() @ 0x%08X", this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_action_nr_c::dialog_token() const + { + return data_m[CORE_FRAME_ACTION_NR_TOKEN_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_action_nr_c::first_ie_offset() const + { + return CORE_FRAME_ACTION_NR_IE_INDEX; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_action_nr_c::generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_nr_ie_c* nr_ie ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + ASSERT( nr_ie ); + + core_frame_action_c::generate( + duration, + destination, + source, + bssid, + sequence_control, + core_frame_action_c::core_dot11_action_category_rm ); + + // Action Type + data_m[data_length_m++] = action_type; + + // Dialog Token + data_m[data_length_m++] = dialog_token; + + // IE + core_tools_c::copy( + &data_m[data_length_m], + nr_ie->data(), + nr_ie->data_length() ); + data_length_m += nr_ie->data_length(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_nr_c::core_frame_action_nr_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_action_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action_rm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action_rm.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames in RM category. +* +*/ + + +#include "core_frame_action_rm.h" +#include "core_frame_rm_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +const u16_t CORE_FRAME_ACTION_RM_MIN_LENGTH = 28; +const u16_t CORE_FRAME_ACTION_RM_LENGTH = 400; +const u16_t CORE_FRAME_ACTION_RM_TOKEN_INDEX = 26; +const u16_t CORE_FRAME_ACTION_RM_NBR_OF_REPETITIONS_INDEX = 27; +const u16_t CORE_FRAME_ACTION_RM_IE_INDEX = 5; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_rm_c* core_frame_action_rm_c::instance( + const core_frame_action_c& frame, + bool_t is_copied ) + { + DEBUG( "core_frame_action_rm_c::instance()" ); + DEBUG1( "core_frame_action_rm_c::instance() - is_copied %u", + is_copied ); + + if ( frame.data_length() < CORE_FRAME_ACTION_RM_MIN_LENGTH ) + { + DEBUG( "core_frame_action_rm_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( frame.data() ); + u16_t buffer_length( 0 ); + + if( is_copied ) + { + buffer_length = frame.data_length(); + buffer = new u8_t[buffer_length]; + + if( !buffer ) + { + DEBUG( "core_frame_action_rm_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( buffer, frame.data(), buffer_length ); + } + + core_frame_action_rm_c* instance = new core_frame_action_rm_c( + buffer_length, + buffer, + buffer_length ); + + if ( !instance ) + { + DEBUG( "core_frame_action_rm_c::instance() - unable to create an instance" ); + delete[] buffer; + buffer = NULL; + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_rm_c* core_frame_action_rm_c::instance( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_rm_ie_c* rm_ie ) + { + const u16_t max_data_length = CORE_FRAME_ACTION_RM_LENGTH; + + u8_t* buffer = new u8_t[max_data_length]; + if ( !buffer ) + { + DEBUG( "core_frame_action_rm_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_action_rm_c* instance = + new core_frame_action_rm_c( 0, buffer, max_data_length ); + if ( !instance ) + { + DEBUG( "core_frame_action_rm_c::instance() - unable to create an instance" ); + delete[] buffer; + buffer = NULL; + + return NULL; + } + + instance->generate( + duration, + destination, + source, + bssid, + sequence_control, + action_type, + dialog_token, + rm_ie ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_rm_c::~core_frame_action_rm_c() + { + DEBUG1( "core_frame_action_rm_c::~core_frame_action_rm_c() @ 0x%08X", this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_action_rm_c::dialog_token() const + { + return data_m[CORE_FRAME_ACTION_RM_TOKEN_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_action_rm_c::first_ie_offset() const + { + return CORE_FRAME_ACTION_RM_IE_INDEX; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_action_rm_c::nbr_of_repetitions() const + { + u16_t repetitions( 0 ); + core_tools_c::copy( &repetitions, &data_m[CORE_FRAME_ACTION_RM_NBR_OF_REPETITIONS_INDEX], sizeof( repetitions ) ); + + return repetitions; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_action_rm_c::generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + const core_frame_rm_ie_c* rm_ie ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + ASSERT( rm_ie ); + + core_frame_action_c::generate( + duration, + destination, + source, + bssid, + sequence_control, + core_frame_action_c::core_dot11_action_category_rm ); + + // Action Type + data_m[data_length_m++] = action_type; + + // Dialog Token + data_m[data_length_m++] = dialog_token; + + // IE + core_tools_c::copy( + &data_m[data_length_m], + rm_ie->data(), + rm_ie->data_length() ); + data_length_m += rm_ie->data_length(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_rm_c::core_frame_action_rm_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_action_c( data_length, data, max_data_length ) + { + DEBUG1( "core_frame_action_rm_c::core_frame_action_rm_c() @ 0x%08X", this ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action_wmm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_action_wmm.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames in WMM category. +* +*/ + + +#include "core_frame_action_wmm.h" +#include "core_frame_wmm_ie_tspec.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u16_t CORE_FRAME_ACTION_WMM_MIN_LENGTH = 28; +const u16_t CORE_FRAME_ACTION_WMM_LENGTH = 200; +const u16_t CORE_FRAME_ACTION_WMM_TYPE_INDEX = 25; +const u16_t CORE_FRAME_ACTION_WMM_TOKEN_INDEX = 26; +const u16_t CORE_FRAME_ACTION_WMM_STATUS_INDEX = 27; +const u16_t CORE_FRAME_ACTION_WMM_IE_INDEX = 4; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_wmm_c* core_frame_action_wmm_c::instance( + const core_frame_action_c& frame ) + { + DEBUG( "core_frame_action_wmm_c::instance()" ); + + if ( frame.data_length() < CORE_FRAME_ACTION_WMM_MIN_LENGTH ) + { + DEBUG( "core_frame_action_wmm_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + core_frame_action_wmm_c* instance = new core_frame_action_wmm_c( + frame.data_length(), + frame.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_action_wmm_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_wmm_c* core_frame_action_wmm_c::instance( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + u8_t status, + const core_frame_wmm_ie_tspec_c* tspec ) + { + const u8_t max_data_length = CORE_FRAME_ACTION_WMM_LENGTH; + + u8_t* buffer = new u8_t[max_data_length]; + if ( !buffer ) + { + DEBUG( "core_frame_action_wmm_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_action_wmm_c* instance = + new core_frame_action_wmm_c( 0, buffer, max_data_length ); + if ( !instance ) + { + DEBUG( "core_frame_action_wmm_c::instance() - unable to create an instance" ); + delete[] buffer; + buffer = NULL; + + return NULL; + } + + instance->generate( + duration, + destination, + source, + bssid, + sequence_control, + action_type, + dialog_token, + status, + tspec ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_wmm_c::~core_frame_action_wmm_c() + { + DEBUG( "core_frame_action_wmm_c::~core_frame_action_wmm_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_action_wmm_c::action_type() const + { + return data_m[CORE_FRAME_ACTION_WMM_TYPE_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_action_wmm_c::dialog_token() const + { + return data_m[CORE_FRAME_ACTION_WMM_TOKEN_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_action_wmm_c::status() const + { + return data_m[CORE_FRAME_ACTION_WMM_STATUS_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_action_wmm_c::first_ie_offset() const + { + DEBUG( "core_frame_action_wmm_c::first_ie_offset()" ); + + return CORE_FRAME_ACTION_WMM_IE_INDEX; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_action_wmm_c::generate( + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control, + u8_t action_type, + u8_t dialog_token, + u8_t status, + const core_frame_wmm_ie_tspec_c* tspec ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_action_c::generate( + duration, + destination, + source, + bssid, + sequence_control, + core_frame_action_c::core_dot11_action_category_wmm_qos ); + + // Action Type + data_m[data_length_m++] = action_type; + + // Dialog Token + data_m[data_length_m++] = dialog_token; + + // Status + data_m[data_length_m++] = status; + + // TSPEC + core_tools_c::copy( + &data_m[data_length_m], + tspec->data(), + tspec->data_length() ); + data_length_m += tspec->data_length(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_action_wmm_c::core_frame_action_wmm_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_action_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_action_wmm_c::core_frame_action_wmm_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_assoc_resp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_assoc_resp.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parser utility for 802.11 (re-)association response frames. +* +*/ + + +#include "core_frame_assoc_resp.h" +#include "core_frame_dot11_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +const u16_t CORE_FRAME_REASSOC_RESP_LENGTH = 24; +const u16_t CORE_FRAME_REASSOC_RESP_IE_INDEX = 6; +const u16_t CORE_FRAME_REASSOC_RESP_CAPABILITY_INDEX = 0; +const u16_t CORE_FRAME_REASSOC_RESP_STATUS_CODE_INDEX = 2; +const u16_t CORE_FRAME_REASSOC_RESP_AID_INDEX = 4; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_assoc_resp_c* core_frame_assoc_resp_c::instance( + const core_frame_dot11_c& frame, + bool_t is_copied ) + { + DEBUG( "core_frame_assoc_resp_c::instance()" ); + + if ( frame.data_length() < CORE_FRAME_REASSOC_RESP_LENGTH ) + { + DEBUG( "core_frame_assoc_resp_c::instance() - not a valid 802.11 (re-)association frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( frame.data() ); + u16_t buffer_length( 0 ); + if ( is_copied ) + { + buffer_length = frame.data_length(); + buffer = new u8_t[buffer_length]; + + if ( !buffer ) + { + DEBUG( "core_frame_assoc_resp_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( + buffer, + frame.data(), + buffer_length ); + } + + core_frame_assoc_resp_c* instance = new core_frame_assoc_resp_c( + frame.data_length(), + buffer, + buffer_length ); + if ( !instance ) + { + DEBUG( "core_frame_assoc_resp_c::instance() - unable to create an instance" ); + + if ( is_copied ) + { + delete[] buffer; + } + + return NULL; + } + + if ( instance->type() != core_frame_dot11_c::core_dot11_type_association_resp && + instance->type() != core_frame_dot11_c::core_dot11_type_reassociation_resp ) + { + DEBUG( "core_frame_assoc_resp_c::instance() - not a valid (re-)assocation response frame" ); + delete instance; + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_assoc_resp_c::~core_frame_assoc_resp_c() + { + DEBUG( "core_frame_assoc_resp_c::~core_frame_assoc_resp_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_assoc_resp_c::capability() const + { + return core_tools_c::get_u16( payload_data(), + CORE_FRAME_REASSOC_RESP_CAPABILITY_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_assoc_resp_c::status_code() const + { + return core_tools_c::get_u16( payload_data(), + CORE_FRAME_REASSOC_RESP_STATUS_CODE_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_assoc_resp_c::aid() const + { + return core_tools_c::get_u16( payload_data(), + CORE_FRAME_REASSOC_RESP_AID_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_assoc_resp_c::first_ie_offset() const + { + return CORE_FRAME_REASSOC_RESP_IE_INDEX; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_assoc_resp_c::core_frame_assoc_resp_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_assoc_resp_c::core_frame_assoc_resp_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_beacon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_beacon.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parser utility for beacon and probe response frames +* +*/ + + +#include "core_frame_beacon.h" +#include "core_frame_dot11_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +const u16_t CORE_BEACON_LENGTH = 36; +const u16_t CORE_BEACON_TIMESTAMP_INDEX = 0; +const u16_t CORE_BEACON_BEACON_INTERVAL_INDEX = 8; +const u16_t CORE_BEACON_CAPABILITY_INDEX = 10; +const u16_t CORE_BEACON_IE_INDEX = 12; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_beacon_c* core_frame_beacon_c::instance( + const core_frame_dot11_c& frame, + bool_t is_copied ) + { + DEBUG( "core_frame_beacon_c::instance()" ); + + if ( frame.data_length() < CORE_BEACON_LENGTH ) + { + DEBUG( "core_frame_beacon_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( frame.data() ); + u16_t buffer_length( 0 ); + + if ( is_copied ) + { + buffer_length = frame.data_length(); + buffer = new u8_t[buffer_length]; + + if ( !buffer ) + { + DEBUG( "core_frame_beacon_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( + buffer, + frame.data(), + buffer_length ); + } + + core_frame_beacon_c* instance = new core_frame_beacon_c( + frame.data_length(), + buffer, + buffer_length ); + if ( !instance ) + { + DEBUG( "core_frame_beacon_c::instance() - unable to create an instance" ); + + if ( is_copied ) + { + delete[] buffer; + } + + return NULL; + } + + if ( instance->type() != core_frame_dot11_c::core_dot11_type_beacon && + instance->type() != core_frame_dot11_c::core_dot11_type_probe_resp ) + { + DEBUG( "core_frame_beacon_c::instance() - not a valid beacon or probe response frame" ); + delete instance; + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_beacon_c::~core_frame_beacon_c() + { + DEBUG( "core_frame_beacon_c::~core_frame_beacon_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_beacon_c::first_ie_offset() const + { + return CORE_BEACON_IE_INDEX; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_tsf_value_s core_frame_beacon_c::timestamp() const + { + core_tsf_value_s timestamp; + + core_tools_c::copy( + ×tamp.tsf[0], + payload_data() + CORE_BEACON_TIMESTAMP_INDEX, + TSF_VALUE_LEN ); + + return timestamp; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_beacon_c::beacon_interval() const + { + return core_tools_c::get_u16( payload_data(), + CORE_BEACON_BEACON_INTERVAL_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_beacon_c::capability() const + { + return core_tools_c::get_u16( payload_data(), + CORE_BEACON_CAPABILITY_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_beacon_c::core_frame_beacon_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_beacon_c::core_frame_beacon_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_dot11.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_dot11.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,588 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11 frames +* +*/ + + +#include "core_frame_dot11.h" +#include "core_frame_dot11_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +const u16_t CORE_DOT11_LENGTH = 24; +const u16_t CORE_DOT11_QOS_CONTROL_LENGTH = 2; +const u16_t CORE_DOT11_HT_CONTROL_LENGTH = 4; +const u16_t CORE_DOT11_FRAME_CONTROL_INDEX = 0; +const u16_t CORE_DOT11_DURATION_INDEX = 2; +const u16_t CORE_DOT11_ADDRESS1_INDEX = 4; +const u16_t CORE_DOT11_ADDRESS2_INDEX = 10; +const u16_t CORE_DOT11_ADDRESS3_INDEX = 16; +const u16_t CORE_DOT11_NO_IE_OFFSET = 0; +const u16_t CORE_DOT11_FRAME_CONTROL_DEFAULT = 0x0000; + +/** Defining this enables IE iterator related traces. */ +//#define WLAN_CORE_DEEP_DEBUG 1 + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_c* core_frame_dot11_c::instance( + u16_t data_length, + const u8_t* data, + bool_t is_copied ) + { + DEBUG( "core_frame_dot11_c::instance()" ); + DEBUG1( "core_frame_dot11_c::instance() - is_copied %u", + is_copied ); + + if( data_length < CORE_DOT11_LENGTH ) + { + DEBUG( "core_frame_dot11_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( data ); + u16_t buffer_length( 0 ); + + if( is_copied ) + { + buffer_length = data_length; + buffer = new u8_t[buffer_length]; + + if( !buffer ) + { + DEBUG( "core_frame_dot11_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( + buffer, + data, + buffer_length ); + } + + core_frame_dot11_c* instance = new core_frame_dot11_c( + data_length, + buffer, + buffer_length ); + if( !instance ) + { + DEBUG( "core_frame_dot11_c::instance() - unable to create an instance" ); + if( is_copied ) + { + delete[] buffer; + } + + return NULL; + } + + u16_t required_length( CORE_DOT11_LENGTH ); + if( instance->is_qos_m ) + { + required_length += CORE_DOT11_QOS_CONTROL_LENGTH; + + DEBUG( "core_frame_dot11_c::instance() - this frame includes QoS Control field" ); + } + + if( instance->is_ht_m ) + { + required_length += CORE_DOT11_HT_CONTROL_LENGTH; + + DEBUG( "core_frame_dot11_c::instance() - this frame includes HT Control field" ); + } + + if( data_length < required_length ) + { + DEBUG( "core_frame_dot11_c::instance() - not a valid 802.11 frame, frame is too short" ); + delete instance; + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_c::~core_frame_dot11_c() + { + DEBUG( "core_frame_dot11_c::~core_frame_dot11_c" ); + + /** + * If maximum frame length has been defined, we have allocated + * the frame buffer ourselves. + */ + if( max_data_length_m ) + { + delete[] data_m; + } + data_m = NULL; + current_ie_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_c::frame_control() const + { + return core_tools_c::get_u16( data_m, CORE_DOT11_FRAME_CONTROL_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_c::core_dot11_type_e core_frame_dot11_c::type() const + { + return static_cast( + frame_control() & core_dot11_frame_control_type_subtype_mask ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_c::duration() const + { + return core_tools_c::get_u16( data_m, CORE_DOT11_DURATION_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_dot11_c::destination() const + { + u16_t index( 0 ); + + if( frame_control() & core_dot11_frame_control_to_ds_mask ) + { + if( frame_control() & core_dot11_frame_control_from_ds_mask ) + { + index = CORE_DOT11_ADDRESS3_INDEX; + } + else + { + index = CORE_DOT11_ADDRESS3_INDEX; + } + } + else + { + if( frame_control() & core_dot11_frame_control_from_ds_mask ) + { + index = CORE_DOT11_ADDRESS1_INDEX; + } + else + { + index = CORE_DOT11_ADDRESS1_INDEX; + } + } + + return mac_address( index ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_dot11_c::source() const + { + u16_t index( 0 ); + + if( frame_control() & core_dot11_frame_control_to_ds_mask ) + { + if( frame_control() & core_dot11_frame_control_from_ds_mask ) + { + return ZERO_MAC_ADDR; + } + else + { + index = CORE_DOT11_ADDRESS2_INDEX; + } + } + else + { + if( frame_control() & core_dot11_frame_control_from_ds_mask ) + { + index = CORE_DOT11_ADDRESS3_INDEX; + } + else + { + index = CORE_DOT11_ADDRESS2_INDEX; + } + } + + return mac_address( index ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_dot11_c::set_destination( const core_mac_address_s& da ) + { + core_mac_address_s destination = da; + core_tools_c::copy( + &data_m[CORE_DOT11_ADDRESS2_INDEX], + &destination, + MAC_ADDR_LEN ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_dot11_c::set_source( const core_mac_address_s& sa ) + { + core_mac_address_s source = sa; + core_tools_c::copy( + &data_m[CORE_DOT11_ADDRESS1_INDEX], + &source, + MAC_ADDR_LEN ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_dot11_c::bssid() const + { + u16_t index( 0 ); + + if( frame_control() & core_dot11_frame_control_to_ds_mask ) + { + if( frame_control() & core_dot11_frame_control_from_ds_mask ) + { + return ZERO_MAC_ADDR; + } + else + { + index = CORE_DOT11_ADDRESS1_INDEX; + } + } + else + { + if( frame_control() & core_dot11_frame_control_from_ds_mask ) + { + index = CORE_DOT11_ADDRESS2_INDEX; + } + else + { + index = CORE_DOT11_ADDRESS3_INDEX; + } + } + + return mac_address( index ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_dot11_c::mac_address( + u16_t index ) const + { + core_mac_address_s mac( ZERO_MAC_ADDR ); + + core_tools_c::copy( + &mac.addr[0], + &data_m[index], + MAC_ADDR_LEN ); + + return mac; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_c::data_length() const + { + return data_length_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_dot11_c::data() const + { + return data_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_c::payload_data_length() const + { + u16_t length( data_length_m - CORE_DOT11_LENGTH ); + if( is_qos_m ) + { + length -= CORE_DOT11_QOS_CONTROL_LENGTH; + } + if( is_ht_m ) + { + length -= CORE_DOT11_HT_CONTROL_LENGTH; + } + + return length; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_dot11_c::payload_data() const + { + u8_t* data( data_m + CORE_DOT11_LENGTH ); + if( is_qos_m ) + { + data += CORE_DOT11_QOS_CONTROL_LENGTH; + } + if( is_ht_m ) + { + data += CORE_DOT11_HT_CONTROL_LENGTH; + } + + return data; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c* core_frame_dot11_c::first_ie() + { + u16_t offset = first_ie_offset(); + if( !offset ) + { + DEBUG( "core_frame_dot11_c::instance() - the frame has no IEs" ); + return NULL; + } + + current_ie_m = payload_data() + offset; + current_ie_max_length_m = payload_data_length() - offset; + + return next_ie(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c* core_frame_dot11_c::next_ie() + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_frame_dot11_c::next_ie() - real frame length: %u", + data_length_m ); + DEBUG1( "core_frame_dot11_c::next_ie() - data_m is at %08X", + data_m ); + DEBUG1( "core_frame_dot11_c::next_ie() - current_ie_m is at %08X", + current_ie_m ); + DEBUG1( "core_frame_dot11_c::next_ie() - data end is at %08X", + data_m + data_length_m ); + DEBUG1( "core_frame_dot11_c::next_ie() - maximum IE length is %u", + current_ie_max_length_m ); +#endif // WLAN_CORE_DEEP_DEBUG + + if( !current_ie_max_length_m ) + { + return NULL; + } + + core_frame_dot11_ie_c* instance = + core_frame_dot11_ie_c::instance( current_ie_max_length_m, current_ie_m ); + if( !instance ) + { + DEBUG( "core_frame_dot11_c::instance() - unable to create IE parser" ); + + return NULL; + } + + current_ie_m += instance->data_length(); + +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_frame_dot11_c::next_ie() - IE ID is %u", + instance->element_id() ); + DEBUG1( "core_frame_dot11_c::next_ie() - IE length is %u", + instance->length() ); + DEBUG1( "core_frame_dot11_c::next_ie() - IE data length is %u", + instance->data_length() ); +#endif // WLAN_CORE_DEEP_DEBUG + + ASSERT( current_ie_m <= data_m + data_length_m ); + current_ie_max_length_m -= instance->data_length(); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_dot11_c::append_ie( + const core_frame_dot11_ie_c* ie ) + { + if( !ie ) + { + return; + } + +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG1( "core_frame_dot11_c::append_ie() - real frame length: %u", + data_length_m ); + DEBUG1( "core_frame_dot11_c::append_ie() - maximum frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_dot11_c::append_ie() - ie length: %u", + ie->data_length() ); +#endif // WLAN_CORE_DEEP_DEBUG + + if( data_length_m + ie->data_length() <= max_data_length_m ) + { + core_tools_c::copy( + &data_m[data_length_m], + ie->data(), + ie->data_length() ); + data_length_m += ie->data_length(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_c::first_ie_offset() const + { + /** + * By default the frame doesn't have any IEs. + */ + return CORE_DOT11_NO_IE_OFFSET; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_c::first_fixed_element_offset() const + { + u16_t offset = CORE_DOT11_LENGTH; + + if( is_qos_m ) + { + offset += CORE_DOT11_QOS_CONTROL_LENGTH; + } + if( is_ht_m ) + { + offset += CORE_DOT11_HT_CONTROL_LENGTH; + } + + return offset; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_dot11_c::generate( + u8_t type, + u16_t duration, + const core_mac_address_s& destination, + const core_mac_address_s& source, + const core_mac_address_s& bssid, + u16_t sequence_control ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + // Frame Control + u16_t temp16( CORE_DOT11_FRAME_CONTROL_DEFAULT ); + temp16 |= type; + + // Data frames sent by a station must have the ToDS bit set. + if( ( type & core_dot11_frame_control_type_mask ) == core_dot11_frame_control_type_data ) + { + temp16 |= core_dot11_frame_control_to_ds_mask; + } + + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + + // Duration + temp16 = duration; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + + // BSSID + core_tools_c::copy( + &data_m[data_length_m], + &bssid.addr[0], + MAC_ADDR_LEN ); + data_length_m += MAC_ADDR_LEN; + + // Source MAC + core_tools_c::copy( + &data_m[data_length_m], + &source.addr[0], + MAC_ADDR_LEN ); + data_length_m += MAC_ADDR_LEN; + + // Destination MAC + core_tools_c::copy( + &data_m[data_length_m], + &destination.addr[0], + MAC_ADDR_LEN ); + data_length_m += MAC_ADDR_LEN; + + // Sequence Control + temp16 = sequence_control; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_c::core_frame_dot11_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + data_length_m( data_length ), + data_m( NULL ), + max_data_length_m( max_data_length ), + is_qos_m( false_t ), + is_ht_m( false_t ), + current_ie_m( NULL ), + current_ie_max_length_m( 0 ) + { + DEBUG( "core_frame_dot11_c::core_frame_dot11_c" ); + + /** + * The reason the const is discarded is that the same pointer + * is used when we have allocated the frame buffer ourselves. + */ + data_m = const_cast( data ); + + core_dot11_frame_control_type_e type_field = + static_cast( + frame_control() & core_dot11_frame_control_type_mask ); + + if( type_field == core_dot11_frame_control_type_data && + frame_control() & core_dot11_frame_control_subtype_qos_mask ) + { + is_qos_m = true_t; + } + + if( ( type_field == core_dot11_frame_control_type_management || + is_qos_m ) && + frame_control() & core_dot11_frame_control_order_mask ) + { + is_ht_m = true_t; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_dot11_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_dot11_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11 IEs. +* +*/ + + +#include "genscaninfo.h" +#include "core_frame_dot11_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u8_t CORE_FRAME_DOT11_IE_LENGTH = 2; +const u8_t CORE_FRAME_DOT11_IE_MIN_LENGTH_FIELD = 0; + +const u8_t CORE_FRAME_DOT11_IE_ELEMENT_INDEX = 0; +const u8_t CORE_FRAME_DOT11_IE_LENGTH_INDEX = 1; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c* core_frame_dot11_ie_c::instance( + u16_t data_length, + const u8_t* data, + bool_t is_copied ) + { + if ( data_length < CORE_FRAME_DOT11_IE_LENGTH ) + { + DEBUG2( "core_frame_dot11_ie_c::instance() - IE data length is too short, actual length %u, minimum length %u", + data_length, CORE_FRAME_DOT11_IE_LENGTH ); + + return NULL; + } + + u8_t* buffer = const_cast( data ); + u16_t buffer_length( 0 ); + + if ( is_copied ) + { + DEBUG( "core_frame_dot11_ie_c::instance() - copying IE data" ); + + buffer_length = data_length; + buffer = new u8_t[buffer_length]; + + if ( !buffer ) + { + DEBUG( "core_frame_dot11_ie_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( + buffer, + data, + buffer_length ); + } + + core_frame_dot11_ie_c* instance = new core_frame_dot11_ie_c( + data_length, + buffer, + buffer_length ); + if ( !instance ) + { + DEBUG( "core_frame_dot11_ie_c::instance() - unable to create an instance" ); + + if ( is_copied ) + { + delete[] buffer; + } + + return NULL; + } + + if ( instance->length() + CORE_FRAME_DOT11_IE_HEADER_LENGTH > data_length ) + { + DEBUG( "core_frame_dot11_ie_c::instance() - length field is too big" ); + DEBUG2( "core_frame_dot11_ie_c::instance() - IE size is %u, IE length field is %u", + data_length, instance->length() ); + delete instance; + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c::~core_frame_dot11_ie_c() + { + /** + * If maximum IE length has been defined, we have allocated + * the frame buffer ourselves. + */ + if ( max_data_length_m ) + { + delete[] data_m; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_dot11_ie_c::element_id() const + { + return data_m[CORE_FRAME_DOT11_IE_ELEMENT_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_dot11_ie_c::length() const + { + return data_m[CORE_FRAME_DOT11_IE_LENGTH_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_dot11_ie_c::data_length() const + { + return length() + CORE_FRAME_DOT11_IE_HEADER_LENGTH; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_dot11_ie_c::data() const + { + return data_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_dot11_ie_c::generate( + u8_t element_id ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + data_length_m = 0; + + // Element ID + data_m[data_length_m++] = element_id; + + // Length + data_m[data_length_m++] = CORE_FRAME_DOT11_IE_MIN_LENGTH_FIELD; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_dot11_ie_c::set_length( + u8_t length ) + { + data_m[CORE_FRAME_DOT11_IE_LENGTH_INDEX] = length - CORE_FRAME_DOT11_IE_HEADER_LENGTH; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c::core_frame_dot11_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + data_length_m( data_length ), + data_m( NULL ), + max_data_length_m( max_data_length ) + { + /** + * The reason the const is discarded is that the same pointer + * is used when we have allocated the frame buffer ourselves. + */ + data_m = const_cast( data ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_echo_test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_echo_test.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating echo test frames. +* +*/ + + +#include "core_frame_echo_test.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u16_t CORE_FRAME_ECHO_TEST_LENGTH = 16; +const u16_t CORE_FRAME_ECHO_TOKEN_INDEX = 14; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_echo_test_c* core_frame_echo_test_c::instance( + const core_frame_ethernet_c& frame ) + { + DEBUG( "core_frame_echo_test_c::instance()" ); + + if ( frame.data_length() < CORE_FRAME_ECHO_TEST_LENGTH ) + { + DEBUG( "core_frame_echo_test_c::instance() - not a valid echo test frame, frame is too short" ); + + return NULL; + } + + core_frame_echo_test_c* instance = new core_frame_echo_test_c( + frame.data_length(), + frame.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_echo_test_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_echo_test_c* core_frame_echo_test_c::instance( + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t token ) + { + const u8_t max_data_length = CORE_FRAME_ECHO_TEST_LENGTH; + + u8_t* buffer = new u8_t[max_data_length]; + if ( !buffer ) + { + DEBUG( "core_frame_echo_test_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_echo_test_c* instance = + new core_frame_echo_test_c( 0, buffer, max_data_length ); + if ( !instance ) + { + DEBUG( "core_frame_echo_test_c::instance() - unable to create an instance" ); + delete[] buffer; + buffer = NULL; + + return NULL; + } + + instance->generate( + destination, + source, + token ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_echo_test_c::~core_frame_echo_test_c() + { + DEBUG( "core_frame_echo_test_c::~core_frame_echo_test_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_echo_test_c::token() const + { + return core_tools_c::get_u16_big_endian( data_m, CORE_FRAME_ECHO_TOKEN_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_echo_test_c::generate( + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t token ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + // Ethernet header + core_frame_ethernet_c::generate( + destination, + source, + core_frame_ethernet_c::core_ethernet_type_test ); + + // Token + u16_t temp16 = core_tools_c::convert_host_to_big_endian( + token ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &temp16 ), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_echo_test_c::core_frame_echo_test_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_ethernet_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_echo_test_c::core_frame_echo_test()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_ethernet.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_ethernet.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing Ethernet frames +* +*/ + + +#include "core_frame_ethernet.h" +#include "core_tools.h" +#include "am_debug.h" + +const u16_t CORE_ETHERNET_MIN_LENGTH = 14; +const u16_t CORE_ETHERNET_DESTINATION_INDEX = 0; +const u16_t CORE_ETHERNET_SOURCE_INDEX = 6; +const u16_t CORE_ETHERNET_TYPE_INDEX = 12; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_ethernet_c* core_frame_ethernet_c::instance( + u16_t data_length, + const u8_t* data, + bool_t is_copied ) + { + DEBUG( "core_frame_ethernet_c::instance()" ); + DEBUG1( "core_frame_ethernet_c::instance() - is_copied %u", + is_copied ); + + if ( data_length < CORE_ETHERNET_MIN_LENGTH ) + { + DEBUG( "core_frame_ethernet_c::instance() - not a valid Ethernet frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( data ); + u16_t buffer_length( 0 ); + + if ( is_copied ) + { + buffer_length = data_length; + buffer = new u8_t[buffer_length]; + + if ( !buffer ) + { + DEBUG( "core_frame_ethernet_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( + buffer, + data, + buffer_length ); + } + + core_frame_ethernet_c* instance = new core_frame_ethernet_c( + data_length, + buffer, + buffer_length ); + if ( !instance ) + { + DEBUG( "core_frame_ethernet_c::instance() - unable to create an instance" ); + if ( is_copied ) + { + delete[] buffer; + } + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_ethernet_c* core_frame_ethernet_c::instance( + u16_t max_data_length, + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t type ) + { + DEBUG( "core_frame_ethernet_c::instance()" ); + + u8_t* buffer = new u8_t[max_data_length]; + if ( !buffer ) + { + DEBUG( "core_frame_ethernet_c::instance() - unable create the internal buffer" ); + } + + core_frame_ethernet_c* instance = + new core_frame_ethernet_c( 0, buffer, max_data_length ); + if ( !instance ) + { + DEBUG( "core_frame_ethernet_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + destination, + source, + type ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_ethernet_c::~core_frame_ethernet_c() + { + DEBUG( "core_frame_ethernet_c::~core_frame_ethernet_c" ); + + /** + * If maximum frame length has been defined, we have allocated + * the frame buffer ourselves. + */ + if ( max_data_length_m ) + { + delete[] data_m; + } + + data_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_ethernet_c::destination() const + { + return mac_address( CORE_ETHERNET_DESTINATION_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_ethernet_c::source() const + { + return mac_address( CORE_ETHERNET_SOURCE_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_ethernet_c::type() const + { + return core_tools_c::get_u16_big_endian( data_m, CORE_ETHERNET_TYPE_INDEX ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_ethernet_c::mac_address( + u16_t index ) const + { + core_mac_address_s mac( ZERO_MAC_ADDR ); + + core_tools_c::copy( + &mac.addr[0], + &data_m[index], + MAC_ADDR_LEN ); + + return mac; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_ethernet_c::data_length() const + { + return data_length_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_ethernet_c::data() const + { + return data_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_ethernet_c::payload_data_length() const + { + return data_length_m - CORE_ETHERNET_MIN_LENGTH; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_ethernet_c::payload_data() const + { + return data_m + CORE_ETHERNET_MIN_LENGTH; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_ethernet_c::core_frame_ethernet_c::generate( + const core_mac_address_s& destination, + const core_mac_address_s& source, + u16_t type ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + // Destination MAC + core_tools_c::copy( + &data_m[data_length_m], + &destination.addr[0], + MAC_ADDR_LEN ); + data_length_m += MAC_ADDR_LEN; + + // Source MAC + core_tools_c::copy( + &data_m[data_length_m], + &source.addr[0], + MAC_ADDR_LEN ); + data_length_m += MAC_ADDR_LEN; + + // Ethernet Type + u16_t temp16 = core_tools_c::convert_host_to_big_endian( + type ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &temp16 ), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_ethernet_c::core_frame_ethernet_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + data_length_m( data_length ), + data_m( NULL ), + max_data_length_m( max_data_length ) + { + DEBUG( "core_frame_ethernet_c::core_frame_ethernet_c" ); + + /** + * The reason the const is discarded is that the same pointer + * is used when we have allocated the frame buffer ourselves. + */ + data_m = const_cast( data ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_mgmt_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_mgmt_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,755 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11i (RSN) IEs. +* +*/ + +#include "core_frame_mgmt_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_MGMT_IE_SSID_MAX_LENGTH = 34; +const u8_t CORE_FRAME_MGMT_IE_SSID_OFFSET = 2; + +const u8_t CORE_FRAME_MGMT_IE_DS_LENGTH = 3; +const u8_t CORE_FRAME_MGMT_IE_DS_OFFSET = 2; + +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_MIN_LENGTH = 8; +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_OFFSET = 2; +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_FIRST_CHANNEL_OFFSET = 5; +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_SET_LENGTH = 3; +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_SET_CH_OFFSET = 0; +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_SET_NR_OFFSET = 1; +const u8_t CORE_FRAME_MGMT_IE_COUNTRY_SET_TX_OFFSET = 2; + +const u8_t CORE_FRAME_MGMT_IE_POWER_CONSTRAINT_LENGTH = 3; +const u8_t CORE_FRAME_MGMT_IE_POWER_CONSTRAINT_OFFSET = 2; + +const u16_t CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_LENGTH = 4; +const u16_t CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_BITMASK_OFFSET = 2; +const u16_t CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_OFFSET = 4; + +const u16_t CORE_FRAME_MGMT_IE_POWER_CAPABILITY_LENGTH = 4; +const u16_t CORE_FRAME_MGMT_IE_POWER_CAPABILITY_OFFSET = 2; + +const u16_t CORE_FRAME_MGMT_IE_RRM_CAPABILITIES_LENGTH = 7; +const u16_t CORE_FRAME_MGMT_IE_RRM_CAPABILITIES_OFFSET = 2; + +const u8_t CORE_FRAME_MGMT_IE_REQUEST_IE_MAX_LENGTH = 237; +const u8_t CORE_FRAME_MGMT_IE_REQUEST_IE_OFFSET = 2; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ssid_c* core_frame_mgmt_ie_ssid_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() > CORE_FRAME_MGMT_IE_SSID_MAX_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_ssid_c::instance() - not a valid IE, too long" ); + + return NULL; + } + + core_frame_mgmt_ie_ssid_c* instance = new core_frame_mgmt_ie_ssid_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_ssid_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ssid_c::~core_frame_mgmt_ie_ssid_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ssid_s core_frame_mgmt_ie_ssid_c::ssid() const + { + core_ssid_s ssid( BROADCAST_SSID ); + + ssid.length = length(); + core_tools_c::copy( + &ssid.ssid[0], + data_m + CORE_FRAME_MGMT_IE_SSID_OFFSET, + ssid.length ); + + return ssid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ssid_c::core_frame_mgmt_ie_ssid_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ds_c* core_frame_mgmt_ie_ds_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() != CORE_FRAME_MGMT_IE_DS_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_ds_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_ds_c* instance = new core_frame_mgmt_ie_ds_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_ds_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ds_c::~core_frame_mgmt_ie_ds_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_ds_c::channel() const + { + return data_m[CORE_FRAME_MGMT_IE_DS_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ds_c::core_frame_mgmt_ie_ds_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_country_c* core_frame_mgmt_ie_country_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_MGMT_IE_COUNTRY_MIN_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_country_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_country_c* instance = new core_frame_mgmt_ie_country_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_country_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_country_c::~core_frame_mgmt_ie_country_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_country_string_s core_frame_mgmt_ie_country_c::country() const + { + core_country_string_s country = { 0, 0, 0 }; + core_tools_c::copy( + &country.country[0], + &data_m[CORE_FRAME_MGMT_IE_COUNTRY_OFFSET], + MAX_COUNTRY_STRING_LENGTH ); + + return country; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_country_c::max_tx_power_level( + u8_t channel ) const + { + for ( const u8_t* idx = data_m + CORE_FRAME_MGMT_IE_COUNTRY_FIRST_CHANNEL_OFFSET; + idx + CORE_FRAME_MGMT_IE_COUNTRY_SET_LENGTH <= data_m + data_length_m; + idx += CORE_FRAME_MGMT_IE_COUNTRY_SET_LENGTH ) + { + u8_t channel_start = idx[CORE_FRAME_MGMT_IE_COUNTRY_SET_CH_OFFSET]; + u8_t channel_end = channel_start + idx[CORE_FRAME_MGMT_IE_COUNTRY_SET_NR_OFFSET]; + + if ( channel >= channel_start && + channel < channel_end ) + { + return idx[CORE_FRAME_MGMT_IE_COUNTRY_SET_TX_OFFSET]; + } + } + + return MAX_TX_POWER_LEVEL_NOT_DEFINED; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_country_c::core_frame_mgmt_ie_country_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_power_constraint_c* core_frame_mgmt_ie_power_constraint_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() != CORE_FRAME_MGMT_IE_POWER_CONSTRAINT_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_power_constraint_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_power_constraint_c* instance = new core_frame_mgmt_ie_power_constraint_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_power_constraint_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_power_constraint_c::~core_frame_mgmt_ie_power_constraint_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_power_constraint_c::power_constraint() const + { + return data_m[CORE_FRAME_MGMT_IE_POWER_CONSTRAINT_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_power_constraint_c::core_frame_mgmt_ie_power_constraint_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ap_channel_report_c* core_frame_mgmt_ie_ap_channel_report_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_ap_channel_report_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_ap_channel_report_c* instance = new core_frame_mgmt_ie_ap_channel_report_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_ap_channel_report_c::instance() - unable to create an instance" ); + + return NULL; + } + + DEBUG1( "core_frame_mgmt_ie_ap_channel_report_c::instance() - AP Channel Report: 0x%02X", + instance->ap_channel_report_channel( 0 ) ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ap_channel_report_c::~core_frame_mgmt_ie_ap_channel_report_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_ap_channel_report_c::ap_channel_report_class() const + { + return data_m[CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_CLASS_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_ap_channel_report_c::ap_channel_report_channel( + u16_t channel_offset ) const + { + return data_m[CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_CHANNEL_OFFSET + channel_offset]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_ap_channel_report_c::core_frame_mgmt_ie_ap_channel_report_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_admission_capacity_c* core_frame_mgmt_ie_admission_capacity_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_admission_capacity_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_admission_capacity_c* instance = new core_frame_mgmt_ie_admission_capacity_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_admission_capacity_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_admission_capacity_c::~core_frame_mgmt_ie_admission_capacity_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_mgmt_ie_admission_capacity_c::admission_capacity_bitmask() const + { + return core_tools_c::get_u16( + data_m, + CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_BITMASK_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_mgmt_ie_admission_capacity_c::get_admission_capacity( + u16_t ie_data_length, + u16_t* admission_capacity_table ) + { + for( u16_t i=0; i < (ie_data_length - CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_OFFSET ); i=i+2 ) + { + admission_capacity_table[i/2] = core_tools_c::get_u16( + data_m, + CORE_FRAME_MGMT_IE_ADMISSION_CAPACITY_OFFSET + i ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_admission_capacity_c::core_frame_mgmt_ie_admission_capacity_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_power_capability_c* core_frame_mgmt_ie_power_capability_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_MGMT_IE_POWER_CAPABILITY_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_power_capability_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_power_capability_c* instance = new core_frame_mgmt_ie_power_capability_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_power_capability_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_power_capability_c::~core_frame_mgmt_ie_power_capability_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_power_capability_c::power_capability() const + { + return data_m[CORE_FRAME_MGMT_IE_POWER_CAPABILITY_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_power_capability_c::core_frame_mgmt_ie_power_capability_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_radio_mgmt_ie_c* core_frame_radio_mgmt_ie_c::instance( + u16_t max_data_length, + u8_t min_capability, + u8_t max_capability ) + { + u8_t* buffer = new u8_t[max_data_length + CORE_FRAME_DOT11_IE_HEADER_LENGTH]; + + if ( !buffer ) + { + DEBUG( "core_frame_radio_mgmt_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_radio_mgmt_ie_c* instance = + new core_frame_radio_mgmt_ie_c( 0, buffer, max_data_length + CORE_FRAME_DOT11_IE_HEADER_LENGTH ); + if ( !instance ) + { + DEBUG( "core_frame_radio_mgmt_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + min_capability, + max_capability ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_radio_mgmt_ie_c::~core_frame_radio_mgmt_ie_c() + { + DEBUG( "core_frame_radio_mgmt_ie_c::~core_frame_radio_mgmt_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_radio_mgmt_ie_c::generate( + u8_t min_capability, + u8_t max_capability ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_power_capability ); + + // Minimum transmit power capability + data_m[data_length_m++] = min_capability; + + // Maximum transmit power capability + data_m[data_length_m++] = max_capability; + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_radio_mgmt_ie_c::core_frame_radio_mgmt_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_radio_mgmt_ie_c::core_frame_radio_mgmt_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_rrm_capabilities_c* core_frame_mgmt_ie_rrm_capabilities_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_MGMT_IE_RRM_CAPABILITIES_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_rrm_capabilities_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_mgmt_ie_rrm_capabilities_c* instance = new core_frame_mgmt_ie_rrm_capabilities_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_rrm_capabilities_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_rrm_capabilities_c::~core_frame_mgmt_ie_rrm_capabilities_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u64_t core_frame_mgmt_ie_rrm_capabilities_c::rrm_capabilities() const + { + return core_tools_c::get_u64( + data_m, + CORE_FRAME_MGMT_IE_RRM_CAPABILITIES_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_rrm_capabilities_c::core_frame_mgmt_ie_rrm_capabilities_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rrm_mgmt_ie_c* core_frame_rrm_mgmt_ie_c::instance( + const u8_t* rrm_capabilities ) + { + u8_t* buffer = new u8_t[CORE_FRAME_RRM_MGMT_IE_LENGTH + CORE_FRAME_DOT11_IE_HEADER_LENGTH]; + if ( !buffer ) + { + DEBUG( "core_frame_rrm_mgmt_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rrm_mgmt_ie_c* instance = + new core_frame_rrm_mgmt_ie_c( 0, buffer, CORE_FRAME_RRM_MGMT_IE_LENGTH + CORE_FRAME_DOT11_IE_HEADER_LENGTH ); + if ( !instance ) + { + DEBUG( "core_frame_rrm_mgmt_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( rrm_capabilities ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rrm_mgmt_ie_c::~core_frame_rrm_mgmt_ie_c() + { + DEBUG( "core_frame_rrm_mgmt_ie_c::~core_frame_rrm_mgmt_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rrm_mgmt_ie_c::generate( + const u8_t* rrm_capabilities ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_rrm_capabilities ); + + // RRM capabilities + core_tools_c::copy( + &data_m[data_length_m], + const_cast(rrm_capabilities), + CORE_FRAME_RRM_MGMT_IE_LENGTH ); + data_length_m += CORE_FRAME_RRM_MGMT_IE_LENGTH; + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rrm_mgmt_ie_c::core_frame_rrm_mgmt_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_rrm_mgmt_ie_c::core_frame_rrm_mgmt_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_request_ie_c* core_frame_mgmt_ie_request_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() > CORE_FRAME_MGMT_IE_REQUEST_IE_MAX_LENGTH ) + { + DEBUG( "core_frame_mgmt_ie_request_ie_c::instance() - not a valid IE, too long" ); + + return NULL; + } + + core_frame_mgmt_ie_request_ie_c* instance = new core_frame_mgmt_ie_request_ie_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_mgmt_ie_request_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_request_ie_c::~core_frame_mgmt_ie_request_ie_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_request_ie_c::element_list( u8_t* ie_id_list ) const + { + u8_t ie_id_list_length = data_length_m - CORE_FRAME_DOT11_IE_HEADER_LENGTH; + + core_tools_c::copy( + ie_id_list, + const_cast( &data_m[CORE_FRAME_MGMT_IE_REQUEST_IE_OFFSET] ), + data_length_m ); + + return ie_id_list_length; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_mgmt_ie_request_ie_c::element_data( + u16_t element_data_offset ) const + { + return data_m[CORE_FRAME_MGMT_IE_REQUEST_IE_OFFSET + element_data_offset]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_mgmt_ie_request_ie_c::core_frame_mgmt_ie_request_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_nr_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_nr_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing Neighbor Report IEs. +* +*/ + + +#include "core_frame_nr_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_NR_IE_PARAMETER_REQ_MIN_LENGTH = 34; +const u8_t CORE_FRAME_NR_IE_PARAMETER_RESP_MIN_LENGTH = 15; +const u8_t CORE_FRAME_NR_IE_PARAMETER_BSSID_OFFSET = 2; +const u8_t CORE_FRAME_NR_IE_PARAMETER_BSSID_INFO_OFFSET = 8; +const u8_t CORE_FRAME_NR_IE_PARAMETER_REGULATORY_CLASS_OFFSET = 12; +const u8_t CORE_FRAME_NR_IE_PARAMETER_CHANNEL_NUMBER_OFFSET = 13; +const u8_t CORE_FRAME_NR_IE_PARAMETER_PHY_TYPE_OFFSET = 14; + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_nr_ie_c* core_frame_nr_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_NR_IE_PARAMETER_RESP_MIN_LENGTH ) + { + DEBUG( "core_frame_nr_ie_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_nr_ie_c* instance = new core_frame_nr_ie_c( + ie.data_length(), + ie.data(), + 0 ); + + if ( !instance ) + { + DEBUG( "core_frame_nr_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_nr_ie_c* core_frame_nr_ie_c::instance( + const core_ssid_s& ssid ) + { + const u8_t max_length = CORE_FRAME_NR_IE_PARAMETER_REQ_MIN_LENGTH; + + u8_t* buffer = new u8_t[max_length]; + if ( !buffer ) + { + DEBUG( "core_frame_nr_ie_c::instance() - unable to create the internal buffer" ); + return NULL; + } + + core_frame_nr_ie_c* instance = + new core_frame_nr_ie_c( 0, buffer, max_length ); + + if ( !instance ) + { + DEBUG( "core_frame_nr_ie_c::instance() - unable to create an instance" ); + delete [] buffer; + + return NULL; + } + + instance->generate( ssid ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_nr_ie_c::generate( + const core_ssid_s& ssid ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ssid ); + + // SSID + core_tools_c::fillz( + &data_m[data_length_m], + MAX_SSID_LEN ); + core_tools_c::copy( + &data_m[data_length_m], + &ssid.ssid[0], + ssid.length ); + data_length_m += MAX_SSID_LEN; + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_nr_ie_c::~core_frame_nr_ie_c() + { + DEBUG1( "core_frame_nr_ie_c::~core_frame_nr_ie_c() @ 0x%08X", this ); + DEBUG1( "core_frame_nr_ie_c::~core_frame_nr_ie_c() - data @ 0x%08X", data_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_nr_ie_c::bssid() const + { + core_mac_address_s mac_addr( ZERO_MAC_ADDR ); + core_tools_c::copy( &mac_addr, &data_m[CORE_FRAME_NR_IE_PARAMETER_BSSID_OFFSET], sizeof( core_mac_address_s ) ); + return mac_addr; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_nr_ie_c::bssid_info() const + { + return core_tools_c::get_u32( + data_m, + CORE_FRAME_NR_IE_PARAMETER_BSSID_INFO_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_nr_ie_c::regulatory_class() const + { + return data_m[CORE_FRAME_NR_IE_PARAMETER_REGULATORY_CLASS_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_nr_ie_c::channel_number() const + { + return data_m[CORE_FRAME_NR_IE_PARAMETER_CHANNEL_NUMBER_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_nr_ie_c::phy_type() const + { + return data_m[CORE_FRAME_NR_IE_PARAMETER_PHY_TYPE_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_nr_ie_c::core_frame_nr_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_qbss_load_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_qbss_load_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11e QBSS Load IE. +* +*/ + + +#include "core_frame_qbss_load_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_QBSS_LOAD_IE_LENGTH = 7; +const u8_t CORE_FRAME_QBSS_LOAD_IE_STATION_COUNT_OFFSET = 2; +const u8_t CORE_FRAME_QBSS_LOAD_IE_CHANNEL_UTILIZATION_OFFSET = 4; +const u8_t CORE_FRAME_QBSS_LOAD_IE_ADMISSION_CAPACITY_OFFSET = 5; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_qbss_load_ie_c* core_frame_qbss_load_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() != CORE_FRAME_QBSS_LOAD_IE_LENGTH ) + { + DEBUG( "core_frame_qbss_load_ie_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_qbss_load_ie_c* instance = new core_frame_qbss_load_ie_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_qbss_load_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_qbss_load_ie_c::~core_frame_qbss_load_ie_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_qbss_load_ie_c::station_count() const + { + return core_tools_c::get_u16( + data_m, + CORE_FRAME_QBSS_LOAD_IE_STATION_COUNT_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_qbss_load_ie_c::channel_utilitization() const + { + return data_m[CORE_FRAME_QBSS_LOAD_IE_CHANNEL_UTILIZATION_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_qbss_load_ie_c::admission_capacity() const + { + return core_tools_c::get_u16( + data_m, + CORE_FRAME_QBSS_LOAD_IE_ADMISSION_CAPACITY_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_qbss_load_ie_c::core_frame_qbss_load_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_radio_measurement_action.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_radio_measurement_action.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing and generating 802.11 action frames in RM category. +* +*/ + + +#include "core_frame_radio_measurement_action.h" +#include "core_frame_rm_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u16_t CORE_FRAME_RADIO_MEASUREMENT_ACTION_MIN_LENGTH = 28; +const u16_t CORE_FRAME_RADIO_MEASUREMENT_ACTION_TYPE_INDEX = 25; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_radio_measurement_action_c* core_frame_radio_measurement_action_c::instance( + const core_frame_action_c& frame, + bool_t is_copied ) + { + DEBUG( "core_frame_radio_measurement_action_c::instance()" ); + DEBUG1( "core_frame_radio_measurement_action_c::instance() - is_copied %u", + is_copied ); + + if ( frame.data_length() < CORE_FRAME_RADIO_MEASUREMENT_ACTION_MIN_LENGTH ) + { + DEBUG( "core_frame_action_rm_c::instance() - not a valid 802.11 frame, frame is too short" ); + + return NULL; + } + + u8_t* buffer = const_cast( frame.data() ); + u16_t buffer_length( 0 ); + + if( is_copied ) + { + buffer_length = frame.data_length(); + buffer = new u8_t[buffer_length]; + + if( !buffer ) + { + DEBUG( "core_frame_radio_measurement_action_c::instance() - not able to allocate buffer for copying" ); + + return NULL; + } + + core_tools_c::copy( buffer, frame.data(), buffer_length ); + } + + core_frame_radio_measurement_action_c* instance = new core_frame_radio_measurement_action_c( + buffer_length, + buffer, + buffer_length ); + + if ( !instance ) + { + DEBUG( "core_frame_radio_measurement_action_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_radio_measurement_action_c::~core_frame_radio_measurement_action_c() + { + DEBUG1( "core_frame_radio_measurement_action_c::~core_frame_radio_measurement_action_c() @ 0x%08X", this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_radio_measurement_action_c::action_type() const + { + return data_m[CORE_FRAME_RADIO_MEASUREMENT_ACTION_TYPE_INDEX]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_radio_measurement_action_c::core_frame_radio_measurement_action_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_action_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Measurement Request/Report IEs. +* +*/ + + +#include "core_frame_rm_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_RM_IE_MIN_LENGTH = 5; +const u8_t CORE_FRAME_RM_IE_MEASUREMENT_TOKEN_OFFSET = 2; +const u8_t CORE_FRAME_RM_IE_MEASUREMENT_REQUEST_MODE_OFFSET = 3; +const u8_t CORE_FRAME_RM_IE_MEASUREMENT_TYPE_OFFSET = 4; + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_c* core_frame_rm_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + u16_t length = ie.data_length(); + if ( length < CORE_FRAME_RM_IE_MIN_LENGTH ) + { + DEBUG( "core_frame_rm_ie_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_rm_ie_c* instance = new core_frame_rm_ie_c( + length, + ie.data(), + 0 ); + + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + DEBUG1( "core_frame_rm_ie_c::instance() - Measurement Token: 0x%02X", + instance->measurement_token() ); + DEBUG1( "core_frame_rm_ie_c::instance() - Measurement Request Mode: 0x%02X", + instance->measurement_request_mode() ); + DEBUG1( "core_frame_rm_ie_c::instance() - Measurement Type: 0x%02X", + instance->measurement_type() ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_c* core_frame_rm_ie_c::instance( + u8_t measurement_token, + u8_t measurement_request_mode, + u8_t measurement_type ) + { + const u8_t max_length = CORE_FRAME_RM_IE_MIN_LENGTH; + + u8_t* buffer = new u8_t[max_length]; + if ( !buffer ) + { + DEBUG( "core_frame_rm_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rm_ie_c* instance = + new core_frame_rm_ie_c( 0, buffer, max_length ); + + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_c::instance() - unable to create an instance" ); + delete [] buffer; + + return NULL; + } + + instance->generate( + measurement_token, + measurement_request_mode, + measurement_type ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rm_ie_c::generate( + u8_t measurement_token, + u8_t measurement_request_mode, + u8_t measurement_type ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_measurement_resp ); + + // Measurement Token + data_m[data_length_m++] = measurement_token; + DEBUG1( "core_frame_rm_ie_c::generate() - Measurement Token: 0x%02X", data_m[data_length_m - 1] ); + + // Measurement Request Mode + data_m[data_length_m++] = measurement_request_mode; + DEBUG1( "core_frame_rm_ie_c::generate() - Measurement Request Mode: 0x%02X", data_m[data_length_m - 1] ); + + // Measurement Type + data_m[data_length_m++] = measurement_type; + DEBUG1( "core_frame_rm_ie_c::generate() - Measurement Type: 0x%02X", data_m[data_length_m - 1] ); + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_c::~core_frame_rm_ie_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_c::measurement_token() const + { + return data_m[CORE_FRAME_RM_IE_MEASUREMENT_TOKEN_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_c::measurement_request_mode() const + { + return data_m[CORE_FRAME_RM_IE_MEASUREMENT_REQUEST_MODE_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_c::measurement_type() const + { + return data_m[CORE_FRAME_RM_IE_MEASUREMENT_TYPE_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_c::core_frame_rm_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_report.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_report.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Beacon Report IEs +* +*/ + + +#include "core_frame_rm_ie_beacon_report.h" +#include "core_frame_rm_ie_beacon_report_ie.h" +#include "core_frame_dot11_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "core_types.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_RM_IE_BEACON_REPORT_MIN_LENGTH = 5; + +//#define WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_c* core_frame_rm_ie_beacon_report_c::instance( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::instance()" ); + + const u16_t required_buffer_length = ie->length() + CORE_FRAME_RM_IE_BEACON_REPORT_MIN_LENGTH; + + u8_t* buffer = new u8_t[ required_buffer_length ]; + if ( !buffer ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rm_ie_beacon_report_c* instance = + new core_frame_rm_ie_beacon_report_c( 0, buffer, required_buffer_length ); + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + measurement_token, + measurement_request_mode, + ie ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_c* core_frame_rm_ie_beacon_report_c::instance( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie, + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::instance()" ); + + const u16_t required_buffer_length = ie->length() + frame_body_ie->data_length() + CORE_FRAME_RM_IE_BEACON_REPORT_MIN_LENGTH; + + u8_t* buffer = new u8_t[ required_buffer_length ]; + if ( !buffer ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rm_ie_beacon_report_c* instance = + new core_frame_rm_ie_beacon_report_c( 0, buffer, required_buffer_length ); + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + measurement_token, + measurement_request_mode, + ie, + frame_body_ie ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rm_ie_beacon_report_c::generate( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::generate()" ); + +#ifdef WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - max frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - real frame length: %u", + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data_m is at 0x%08X", + data_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - current_ie_m is at 0x%08X", + current_ie_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data end is at 0x%08X", + data_m + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - maximum IE length is %u", + current_ie_max_length_m ); +#endif // WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + + core_frame_rm_ie_c::generate( + measurement_token, + measurement_request_mode, + core_frame_rm_ie_c::core_frame_rm_ie_action_type_beacon_request ); + + ASSERT( max_data_length_m ); + + if ( data_length_m + ie->length() <= max_data_length_m ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::generate() - enough size for IE, appending IE" ); + core_tools_c::copy( + &data_m[data_length_m], + ie->data(), + ie->length() ); + data_length_m += ie->length(); + set_length( data_length_m ); + } + else + { + DEBUG2( "core_frame_rm_ie_beacon_report_c::generate() - unable to append, IE size %u vs. available size %u", + ie->length(), max_data_length_m - data_length_m ); + } + +#ifdef WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - max frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - real frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data_m is at %08X", + data_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - current_ie_m is at %08X", + current_ie_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data end is at %08X", + data_m + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - maximum IE length is %u", + current_ie_max_length_m ); +#endif // WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + + // check generated data length doesn't exceed allocated buffer + ASSERT( data_length_m <= max_data_length_m ); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rm_ie_beacon_report_c::generate( + u8_t measurement_token, + u8_t measurement_request_mode, + core_frame_rm_ie_beacon_report_ie_c* ie, + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::generate()" ); + +#ifdef WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - max frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - real frame length: %u", + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data_m is at 0x%08X", + data_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - current_ie_m is at 0x%08X", + current_ie_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data end is at 0x%08X", + data_m + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - maximum IE length is %u", + current_ie_max_length_m ); +#endif // WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + + core_frame_rm_ie_c::generate( + measurement_token, + measurement_request_mode, + core_frame_rm_ie_c::core_frame_rm_ie_action_type_beacon_request ); + + ASSERT( max_data_length_m ); + + if ( data_length_m + ie->length() <= max_data_length_m ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::generate() - enough size for IE, appending IE" ); + core_tools_c::copy( + &data_m[data_length_m], + ie->data(), + ie->length() ); + data_length_m += ie->length(); + set_length( data_length_m ); + } + else + { + DEBUG2( "core_frame_rm_ie_beacon_report_c::generate() - unable to append, IE size %u vs. available size %u", + ie->length(), max_data_length_m - data_length_m ); + } + + if ( data_length_m + frame_body_ie->data_length() <= max_data_length_m ) + { + DEBUG( "core_frame_rm_ie_beacon_report_c::generate() - enough size for REPORTED FRAME BODY IE, appending IE" ); + core_tools_c::copy( + &data_m[data_length_m], + frame_body_ie->data(), + frame_body_ie->data_length() ); + data_length_m += frame_body_ie->data_length(); + set_length( data_length_m ); + } + else + { + DEBUG2( "core_frame_rm_ie_beacon_report_c::generate() - unable to append, REPORTED FRAME BODY IE size %u vs. available size %u", + frame_body_ie->data_length(), max_data_length_m - data_length_m ); + } + +#ifdef WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - max frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - real frame length: %u", + max_data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data_m is at %08X", + data_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - current_ie_m is at %08X", + current_ie_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - data end is at %08X", + data_m + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_report_c::generate() - maximum IE length is %u", + current_ie_max_length_m ); +#endif // WLAN_CORE_FRAME_RM_IE_BEACON_REPORT_IE_DEBUG + + // check generated data length doesn't exceed allocated buffer + ASSERT( data_length_m <= max_data_length_m ); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_c::~core_frame_rm_ie_beacon_report_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_c::core_frame_rm_ie_beacon_report_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_rm_ie_c( data_length, data, max_data_length ), + current_ie_m( NULL ), + current_ie_max_length_m( 0 ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_report_frame_body_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_report_frame_body_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11k Beacon Report Frame Body IEs. +* +*/ + + +#include "genscaninfo.h" +#include "core_frame_rm_ie_beacon_report_frame_body_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u8_t CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_MAX_LENGTH = 224; +const u8_t CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_HEADER_LENGTH = 2; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_frame_body_ie_c* core_frame_rm_ie_beacon_report_frame_body_ie_c::instance( + core_ap_data_c& ap_data ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::instance()" ); + + u8_t reported_frame_body[CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_MAX_LENGTH] = { 0 }; + u16_t reported_frame_body_length = ( 0 ); + ap_data.get_reported_frame_body( &reported_frame_body_length, reported_frame_body ); + + u8_t* buffer = new u8_t[reported_frame_body_length + CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_HEADER_LENGTH]; + if ( !buffer ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rm_ie_beacon_report_frame_body_ie_c* instance = + new core_frame_rm_ie_beacon_report_frame_body_ie_c( 0, buffer, reported_frame_body_length + CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_HEADER_LENGTH ); + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + ap_data ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_frame_body_ie_c* core_frame_rm_ie_beacon_report_frame_body_ie_c::instance( + core_ap_data_c& ap_data, + u8_t* ie_id_list, + u8_t ie_id_list_length ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::instance()" ); + + u8_t reported_frame_body[CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_MAX_LENGTH] = { 0 }; + u16_t reported_frame_body_length = ( 0 ); + + ap_data.request_ie( &reported_frame_body_length, reported_frame_body, ie_id_list, ie_id_list_length ); + + u8_t* buffer = new u8_t[reported_frame_body_length + CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_HEADER_LENGTH]; + if ( !buffer ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rm_ie_beacon_report_frame_body_ie_c* instance = + new core_frame_rm_ie_beacon_report_frame_body_ie_c( 0, buffer, reported_frame_body_length + CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_HEADER_LENGTH ); + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + ap_data, + ie_id_list, + ie_id_list_length ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rm_ie_beacon_report_frame_body_ie_c::generate( + core_ap_data_c& ap_data ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::generate()" ); + + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_supported_rates ); + + // Reported Frame Body + u8_t reported_frame_body[CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_MAX_LENGTH] = { 0 }; + u16_t reported_frame_body_length = ( 0 ); + ap_data.get_reported_frame_body( &reported_frame_body_length, reported_frame_body ); + DEBUG1( "core_frame_rm_ie_beacon_report_frame_body_ie_c::generate() - Reported Frame Body Length: 0x%04X", reported_frame_body_length ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &reported_frame_body[0] ), + reported_frame_body_length ); + data_length_m += reported_frame_body_length; + + set_length( data_length_m ); + + // check generated data length doesn't exceed allocated buffer + ASSERT( data_length_m <= max_data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rm_ie_beacon_report_frame_body_ie_c::generate( + core_ap_data_c& ap_data, + u8_t* ie_id_list, + u8_t ie_id_list_length ) + { + DEBUG( "core_frame_rm_ie_beacon_report_frame_body_ie_c::generate()" ); + + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_supported_rates ); + + // Reported Frame Body + u8_t reported_frame_body[CORE_FRAME_RM_IE_BEACON_REPORT_FRAME_BODY_IE_MAX_LENGTH] = { 0 }; + u16_t reported_frame_body_length = ( 0 ); + ap_data.request_ie( &reported_frame_body_length, reported_frame_body, ie_id_list, ie_id_list_length ); + DEBUG1( "core_frame_rm_ie_beacon_report_frame_body_ie_c::generate() - Reported Frame Body Length: 0x%04X", reported_frame_body_length ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &reported_frame_body[0] ), + reported_frame_body_length ); + data_length_m += reported_frame_body_length; + + set_length( data_length_m ); + + // check generated data length doesn't exceed allocated buffer + ASSERT( data_length_m <= max_data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_frame_body_ie_c::~core_frame_rm_ie_beacon_report_frame_body_ie_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_frame_body_ie_c::core_frame_rm_ie_beacon_report_frame_body_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ), + current_ie_m( NULL ), + current_ie_max_length_m( 0 ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_report_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_report_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11k Beacon Report IEs. +* +*/ + + +#include "genscaninfo.h" +#include "core_frame_rm_ie_beacon_report_ie.h" +#include "core_frame_rm_ie_beacon_report_frame_body_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +const u8_t CORE_FRAME_RM_IE_BEACON_REPORT_IE_MIN_LENGTH = 26; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_report_ie_c::length() const + { + return CORE_FRAME_RM_IE_BEACON_REPORT_IE_MIN_LENGTH; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_ie_c* core_frame_rm_ie_beacon_report_ie_c::instance( + u8_t regulatory_class, + u16_t measurement_duration, + u8_t reported_frame_information, + u8_t antenna_id, + core_ap_data_c& ap_data ) + { + DEBUG( "core_frame_rm_ie_beacon_report_ie_c::instance()" ); + + core_tsf_value_s dummy_tsf = {0}; + u8_t dummy_rsni = 0xFF; + + u8_t* buffer = new u8_t[CORE_FRAME_RM_IE_BEACON_REPORT_IE_MIN_LENGTH]; + if ( !buffer ) + { + DEBUG( "core_frame_rm_ie_beacon_report_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rm_ie_beacon_report_ie_c* instance = + new core_frame_rm_ie_beacon_report_ie_c( 0, buffer, CORE_FRAME_RM_IE_BEACON_REPORT_IE_MIN_LENGTH ); + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_report_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + regulatory_class, + dummy_tsf, + measurement_duration, + reported_frame_information, + dummy_rsni, + antenna_id, + dummy_tsf, + ap_data ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rm_ie_beacon_report_ie_c::generate( + u8_t regulatory_class, + core_tsf_value_s& actual_measurement_start_time, + u16_t measurement_duration, + u8_t reported_frame_information, + u8_t rsni, + u8_t antenna_id, + core_tsf_value_s& parent_tsf, + core_ap_data_c& ap_data ) + { + DEBUG( "core_frame_rm_ie_beacon_report_ie_c::generate()" ); + + // Regulatory Class + data_m[data_length_m++] = regulatory_class; + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Regulatory Class: 0x%02X", data_m[data_length_m - 1] ); + + // Channel Number + data_m[data_length_m++] = ap_data.channel(); + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Channel Number: 0x%02X", data_m[data_length_m - 1] ); + + // Actual Measurement Start Time + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &actual_measurement_start_time.tsf[0] ), + TSF_VALUE_LEN ); + data_length_m += TSF_VALUE_LEN; + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Actual Measurement Start Time: 0x%016X", data_m[data_length_m - 1] ); + + // Measurement Duration + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &measurement_duration ), + sizeof( measurement_duration ) ); + data_length_m += sizeof( measurement_duration ); + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Measurement Duration: 0x%04X", data_m[data_length_m - 1] ); + + // Reported Frame Information + data_m[data_length_m++] = reported_frame_information; + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Reported Frame Information: 0x%02X", data_m[data_length_m - 1] ); + + // RCPI + data_m[data_length_m++] = ap_data.rcpi(); + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - RCPI: 0x%02X", data_m[data_length_m - 1] ); + + // RSNI + data_m[data_length_m++] = rsni; + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - RSNI: 0x%02X", data_m[data_length_m - 1] ); + + // BSSID + const core_mac_address_s bssid = ap_data.bssid(); + DEBUG6( "core_frame_rm_ie_beacon_report_ie_c::generate() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &bssid.addr[0] ), + MAC_ADDR_LEN ); + data_length_m += MAC_ADDR_LEN; + + // Antenna ID + data_m[data_length_m++] = antenna_id; + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Antenna ID: 0x%02X", data_m[data_length_m - 1] ); + + // Parent TSF + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast( &parent_tsf.tsf[0] ), + TSF_VALUE_LEN / 2 ); + + data_length_m += TSF_VALUE_LEN / 2; + DEBUG1( "core_frame_rm_ie_beacon_report_ie_c::generate() - Parent TSF: 0x%08X", data_m[data_length_m - 1] ); + + // check generated data length doesn't exceed allocated buffer + ASSERT( data_length_m <= max_data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_ie_c::~core_frame_rm_ie_beacon_report_ie_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_report_ie_c::core_frame_rm_ie_beacon_report_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ), + current_ie_m( NULL ), + current_ie_max_length_m( 0 ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_request.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_request.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing RM Beacon Request IEs. +* +*/ + + +#include "core_frame_rm_ie_beacon_request.h" +#include "core_frame_dot11_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_MIN_LENGTH = 18; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_REGULATORY_CLASS_OFFSET = 5; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_CHANNEL_NUMBER_OFFSET = 6; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_RANDOMIZATION_INTERVAL_OFFSET = 7; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_MEASUREMENT_DURATION_OFFSET = 9; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_MEASUREMENT_MODE_OFFSET = 11; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_BSSID_OFFSET = 12; + +const u16_t CORE_FRAME_RM_IE_BEACON_REQUEST_IE_INDEX = 18; + +//#define WLAN_CORE_FRAME_RM_IE_BEACON_REQUEST_IE_DEBUG + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_c* core_frame_rm_ie_beacon_request_c::instance( + const core_frame_dot11_ie_c& ie ) + { + u16_t length = ie.data_length(); + if ( length < CORE_FRAME_RM_IE_BEACON_REQUEST_MIN_LENGTH ) + { + DEBUG( "core_frame_rm_ie_beacon_request_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_rm_ie_beacon_request_c* instance = new core_frame_rm_ie_beacon_request_c( + length, + ie.data(), + 0 ); + + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_request_c::instance() - unable to create an instance" ); + + return NULL; + } + + DEBUG1( "core_frame_rm_ie_beacon_request_c::instance() - Regulatory Class: 0x%02X", + instance->regulatory_class() ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::instance() - Channel Number: 0x%02X", + instance->channel_number() ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::instance() - Randomization Interval: 0x%04X (TU)", + instance->randomization_interval() ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::instance() - Measurement Duration: 0x%04X (TU)", + instance->measurement_duration() ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::instance() - Measurement Mode: 0x%02X", + instance->measurement_mode() ); + core_mac_address_s a = instance->bssid(); + DEBUG6( "core_frame_rm_ie_beacon_request_c::instance() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + a.addr[0],a.addr[1],a.addr[2],a.addr[3],a.addr[4],a.addr[5] ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_c::~core_frame_rm_ie_beacon_request_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_request_c::regulatory_class() const + { + return data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_REGULATORY_CLASS_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_request_c::channel_number() const + { + return data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_CHANNEL_NUMBER_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_rm_ie_beacon_request_c::randomization_interval() const + { + u16_t random_interval( 0 ); + core_tools_c::copy( &random_interval, &data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_RANDOMIZATION_INTERVAL_OFFSET], sizeof( random_interval ) ); + + return random_interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_rm_ie_beacon_request_c::measurement_duration() const + { + u16_t measurement_duration( 0 ); + core_tools_c::copy( &measurement_duration, &data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_MEASUREMENT_DURATION_OFFSET], sizeof( measurement_duration ) ); + + return measurement_duration; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_request_c::measurement_mode() const + { + return data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_MEASUREMENT_MODE_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s core_frame_rm_ie_beacon_request_c::bssid() const + { + core_mac_address_s mac_addr( ZERO_MAC_ADDR ); + core_tools_c::copy( &mac_addr, &data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_BSSID_OFFSET], sizeof( core_mac_address_s ) ); + return mac_addr; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_rm_ie_beacon_request_c::first_ie_offset() const + { + return CORE_FRAME_RM_IE_BEACON_REQUEST_IE_INDEX; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_rm_ie_beacon_request_c::payload_data_length() const + { + u16_t length( data_length_m - CORE_FRAME_RM_IE_BEACON_REQUEST_MIN_LENGTH ); + + return length; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_rm_ie_beacon_request_c::payload_data() const + { + u8_t* data( data_m + CORE_FRAME_RM_IE_BEACON_REQUEST_MIN_LENGTH ); + + return data; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c* core_frame_rm_ie_beacon_request_c::first_ie() + { + u16_t offset = first_ie_offset(); + if( !offset ) + { + DEBUG( "core_frame_rm_ie_beacon_request_c::instance() - the frame has no IEs" ); + return NULL; + } + + current_ie_m = payload_data(); + current_ie_max_length_m = payload_data_length(); + + return next_ie(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_dot11_ie_c* core_frame_rm_ie_beacon_request_c::next_ie() + { + +#ifdef WLAN_CORE_FRAME_RM_IE_BEACON_REQUEST_IE_DEBUG + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - real frame length: %u", + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - data_m is at %08X", + data_m ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - current_ie_m is at %08X", + current_ie_m ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - data end is at %08X", + data_m + data_length_m ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - maximum IE length is %u", + current_ie_max_length_m ); +#endif // WLAN_CORE_FRAME_RM_IE_BEACON_REQUEST_IE_DEBUG + + if( !current_ie_max_length_m ) + { + return NULL; + } + + core_frame_dot11_ie_c* instance = + core_frame_dot11_ie_c::instance( current_ie_max_length_m, current_ie_m ); + if( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_request_c::next_ie() - unable to create IE parser" ); + + return NULL; + } + + current_ie_m += instance->data_length(); + +#ifdef WLAN_CORE_FRAME_RM_IE_BEACON_REQUEST_IE_DEBUG + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - IE ID is %u", + instance->element_id() ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - IE length is %u", + instance->length() ); + DEBUG1( "core_frame_rm_ie_beacon_request_c::next_ie() - IE data length is %u", + instance->data_length() ); +#endif // WLAN_CORE_FRAME_RM_IE_BEACON_REQUEST_IE_DEBUG + + ASSERT( current_ie_m <= data_m + data_length_m ); + current_ie_max_length_m -= instance->data_length(); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_c::core_frame_rm_ie_beacon_request_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_rm_ie_c( data_length, data, max_data_length ), + current_ie_m( NULL ), + current_ie_max_length_m( 0 ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_request_detail_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_request_detail_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11k Beacon Request Reporting Detail IEs. +* +*/ + + +#include "genscaninfo.h" +#include "core_frame_rm_ie_beacon_request_detail_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_MIN_LENGTH = 3; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_REPORTING_DETAIL_OFFSET = 2; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_detail_ie_c* core_frame_rm_ie_beacon_request_detail_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_MIN_LENGTH ) + { + DEBUG( "core_frame_rm_ie_beacon_request_detail_ie_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_rm_ie_beacon_request_detail_ie_c* instance = new core_frame_rm_ie_beacon_request_detail_ie_c( + ie.data_length(), + ie.data(), + 0 ); + + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_beacon_request_detail_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + DEBUG1( "core_frame_rm_ie_beacon_request_detail_ie_c::instance() - Reporting Detail: 0x%02X", + instance->reporting_detail() ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_request_detail_ie_c::reporting_detail() const + { + return data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_DETAIL_IE_REPORTING_DETAIL_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_detail_ie_c::core_frame_rm_ie_beacon_request_detail_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_request_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rm_ie_beacon_request_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class parsing 802.11k Beacon Request IEs. +* +*/ + + +#include "genscaninfo.h" +#include "core_frame_rm_ie_beacon_request_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_IE_MIN_LENGTH = 4; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_IE_REPORTING_CONDITION_OFFSET = 2; +const u8_t CORE_FRAME_RM_IE_BEACON_REQUEST_IE_THRESHOLD_REFERENCE_VALUE_OFFSET = 3; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_ie_c* core_frame_rm_ie_beacon_request_ie_c::instance( const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_RM_IE_BEACON_REQUEST_IE_MIN_LENGTH ) + { + DEBUG( "core_frame_rm_ie_beacon_request_ie_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + core_frame_rm_ie_beacon_request_ie_c* instance = new core_frame_rm_ie_beacon_request_ie_c( + ie.data_length(), + ie.data(), + 0 ); + + if ( !instance ) + { + DEBUG( "core_frame_rm_ie_parameter_c::instance() - unable to create an instance" ); + + return NULL; + } + + DEBUG1( "core_frame_rm_ie_beacon_request_ie_c::instance() - Reporting Condition: 0x%02X", + instance->reporting_condition() ); + DEBUG1( "core_frame_rm_ie_beacon_request_ie_c::instance() - Threshold/Offset Reference Value: 0x%02X", + instance->threshold_reference_value() ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_request_ie_c::reporting_condition() const + { + return data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_IE_REPORTING_CONDITION_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rm_ie_beacon_request_ie_c::threshold_reference_value() const + { + return data_m[CORE_FRAME_RM_IE_BEACON_REQUEST_IE_THRESHOLD_REFERENCE_VALUE_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rm_ie_beacon_request_ie_c::core_frame_rm_ie_beacon_request_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rsn_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_rsn_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,470 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11i (RSN) IEs. +* +*/ + + +#include "core_frame_rsn_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_RSN_IE_MIN_LENGTH = 22; +const u8_t CORE_FRAME_RSN_IE_PMKID_COUNT_SIZE = 2; +const u8_t CORE_FRAME_RSN_IE_GROUP_SUITE_OFFSET = 4; +const u8_t CORE_FRAME_RSN_IE_PAIRWISE_SUITE_COUNT_OFFSET = 8; +const u8_t CORE_FRAME_RSN_IE_PAIRWISE_SUITE_OFFSET = 10; +const u8_t CORE_FRAME_RSN_IE_CIPHER_OUI_LENGTH = 4; +const u8_t CORE_FRAME_RSN_IE_KEY_MANAGEMENT_COUNT_SIZE = 2; +const u8_t CORE_FRAME_RSN_IE_KEY_MANAGEMENT_OUI_LENGTH = 4; + +/** IDs for different cipher suites in RSN IE. */ +const u8_t CORE_FRAME_RSN_IE_CIPHER_ID_NONE = 0x00; +const u8_t CORE_FRAME_RSN_IE_CIPHER_ID_WEP40 = 0x01; +const u8_t CORE_FRAME_RSN_IE_CIPHER_ID_WEP104 = 0x05; +const u8_t CORE_FRAME_RSN_IE_CIPHER_ID_TKIP = 0x02; +const u8_t CORE_FRAME_RSN_IE_CIPHER_ID_CCMP = 0x04; + +/** IDs for different key management suites. */ +const u8_t CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_NONE = 0x00; +const u8_t CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_EAP = 0x01; +const u8_t CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_PSK = 0x02; + +const u8_t CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH = 3; +const u8_t CORE_FRAME_RSN_IE_OUI_PREFIX[] = { 0x00, 0x0F, 0xAC }; + +const u16_t CORE_FRAME_RSN_IE_VERSION = 1; +const u16_t CORE_FRAME_RSN_IE_PAIRWISE_SUITE_COUNT = 1; +const u16_t CORE_FRAME_RSN_IE_KEY_MANAGEMENT_COUNT = 1; +const u16_t CORE_FRAME_RSN_IE_CAPABILITIES = 0; +const u16_t CORE_FRAME_RSN_IE_PMKID_COUNT = 1; +const u16_t CORE_FRAME_RSN_IE_PMKID_LENGTH = 16; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rsn_ie_c* core_frame_rsn_ie_c::instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_RSN_IE_MIN_LENGTH ) + { + DEBUG( "core_frame_rsn_ie_c::instance() - not a valid IE, too short" ); + + return NULL; + } + + core_frame_rsn_ie_c* instance = new core_frame_rsn_ie_c( + wpx_adaptation, + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_rsn_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rsn_ie_c* core_frame_rsn_ie_c::instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t pmkid_length, + const u8_t* pmkid_data ) + { + const u8_t max_length = CORE_FRAME_RSN_IE_MIN_LENGTH + CORE_FRAME_RSN_IE_PMKID_COUNT_SIZE + pmkid_length; + + u8_t* buffer = new u8_t[max_length]; + if ( !buffer ) + { + DEBUG( "core_frame_rsn_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_rsn_ie_c* instance = + new core_frame_rsn_ie_c( wpx_adaptation, 0, buffer, max_length ); + if ( !instance ) + { + DEBUG( "core_frame_rsn_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + group_cipher, + pairwise_cipher, + key_management, + pmkid_length, + pmkid_data ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rsn_ie_c::~core_frame_rsn_ie_c() + { + DEBUG( "core_frame_rsn_ie_c::~core_frame_rsn_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rsn_ie_c::group_cipher_suite() const + { + return cipher_oui_to_enum( data_m + CORE_FRAME_RSN_IE_GROUP_SUITE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rsn_ie_c::pairwise_cipher_suites() const + { + u16_t num_of_suites = core_tools_c::get_u16( + data_m, CORE_FRAME_RSN_IE_PAIRWISE_SUITE_COUNT_OFFSET ); + u8_t suites( 0 ); + + DEBUG1( "core_frame_rsn_ie_c::pairwise_cipher_suites() - num_of_suites = %u", + num_of_suites ); + + u32_t offset_end( + CORE_FRAME_RSN_IE_PAIRWISE_SUITE_OFFSET + + ( num_of_suites * CORE_FRAME_RSN_IE_CIPHER_OUI_LENGTH ) ); + if ( offset_end > data_length() ) + { + DEBUG( "core_frame_rsn_ie_c::pairwise_cipher_suites() - num_of_suites points past the end of IE, ignoring" ); + + return suites; + } + + while ( num_of_suites-- ) + { + suites += cipher_oui_to_enum( data_m + CORE_FRAME_RSN_IE_PAIRWISE_SUITE_OFFSET + + ( num_of_suites * CORE_FRAME_RSN_IE_CIPHER_OUI_LENGTH ) ); + } + + return suites; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_rsn_ie_c::key_management_suites() const + { + u8_t suites( 0 ); + u16_t pairwise_num_of_suites = core_tools_c::get_u16( + data_m, CORE_FRAME_RSN_IE_PAIRWISE_SUITE_COUNT_OFFSET ); + u32_t pairwise_offset_end( + CORE_FRAME_RSN_IE_PAIRWISE_SUITE_COUNT_OFFSET + + ( pairwise_num_of_suites * CORE_FRAME_RSN_IE_CIPHER_OUI_LENGTH ) ); + if ( pairwise_offset_end > data_length() ) + { + DEBUG( "core_frame_rsn_ie_c::key_management_suites() - pairwise_num_of_suites points past the end of IE, ignoring" ); + + return suites; + } + + u8_t pairwise_length( pairwise_num_of_suites * CORE_FRAME_RSN_IE_CIPHER_OUI_LENGTH ); + u16_t num_of_suites = core_tools_c::get_u16( + data_m, CORE_FRAME_RSN_IE_PAIRWISE_SUITE_OFFSET + pairwise_length ); + u32_t offset_end( + CORE_FRAME_RSN_IE_PAIRWISE_SUITE_OFFSET + + pairwise_length + + CORE_FRAME_RSN_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( num_of_suites * CORE_FRAME_RSN_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + if ( offset_end > data_length() ) + { + DEBUG( "core_frame_rsn_ie_c::key_management_suites() - num_of_suites points past the end of IE, ignoring" ); + + return suites; + } + + DEBUG1( "core_frame_rsn_ie_c::key_management_suites() - num_of_suites = %u", + num_of_suites ); + + while ( num_of_suites-- ) + { + suites += key_management_oui_to_enum( + data_m + CORE_FRAME_RSN_IE_PAIRWISE_SUITE_OFFSET + + pairwise_length + + CORE_FRAME_RSN_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( num_of_suites * CORE_FRAME_RSN_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + } + + return suites; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +core_cipher_suite_e core_frame_rsn_ie_c::cipher_oui_to_enum( + const u8_t* oui ) const + { + if ( core_tools_c::compare( + oui, + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH, + &CORE_FRAME_RSN_IE_OUI_PREFIX[0], + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH ) ) + { + DEBUG( "core_frame_rsn_ie_c::cipher_oui_to_enum() - unknown cipher suite" ); + return core_cipher_suite_none; + } + + switch ( *(oui + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH) ) + { + case CORE_FRAME_RSN_IE_CIPHER_ID_WEP40: + return core_cipher_suite_wep40; + case CORE_FRAME_RSN_IE_CIPHER_ID_WEP104: + return core_cipher_suite_wep104; + case CORE_FRAME_RSN_IE_CIPHER_ID_TKIP: + return core_cipher_suite_tkip; + case CORE_FRAME_RSN_IE_CIPHER_ID_CCMP: + return core_cipher_suite_ccmp; + default: + return core_cipher_suite_none; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +core_key_management_e core_frame_rsn_ie_c::key_management_oui_to_enum( + const u8_t* oui ) const + { + if ( !core_tools_c::compare( + oui, + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH, + &CORE_FRAME_RSN_IE_OUI_PREFIX[0], + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH ) ) + { + switch ( *(oui + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH) ) + { + case CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_EAP: + DEBUG( "core_frame_rsn_ie_c::key_management_oui_to_enum() - core_key_management_eap" ); + return core_key_management_eap; + case CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_PSK: + DEBUG( "core_frame_rsn_ie_c::key_management_oui_to_enum() - core_key_management_preshared" ); + return core_key_management_preshared; + default: + DEBUG( "core_frame_rsn_ie_c::key_management_oui_to_enum() - core_key_management_none" ); + return core_key_management_none; + } + } + + return wpx_adaptation_m.wpx_key_management_suite( oui ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_rsn_ie_c::get_raw_group_cipher( + core_cipher_suite_e cipher ) const + { + switch( cipher ) + { + case core_cipher_suite_wep40: + DEBUG( "core_frame_rsn_ie_c::get_raw_group_cipher() - core_cipher_suite_wep40" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_WEP40; + case core_cipher_suite_wep104: + DEBUG( "core_frame_rsn_ie_c::get_raw_group_cipher() - core_cipher_suite_wep104" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_WEP104; + case core_cipher_suite_tkip: + DEBUG( "core_frame_rsn_ie_c::get_raw_group_cipher() - core_cipher_suite_tkip" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_TKIP; + case core_cipher_suite_ccmp: + DEBUG( "core_frame_rsn_ie_c::get_raw_group_cipher() - core_cipher_suite_ccmp" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_CCMP; + default: + DEBUG( "core_frame_rsn_ie_c::get_raw_group_cipher() - core_cipher_suite_none" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_NONE; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_rsn_ie_c::get_raw_pairwise_cipher( + core_cipher_suite_e cipher ) const + { + switch( cipher ) + { + case core_cipher_suite_wep40: + DEBUG( "core_frame_rsn_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_wep40" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_WEP40; + case core_cipher_suite_wep104: + DEBUG( "core_frame_rsn_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_wep104" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_WEP104; + case core_cipher_suite_tkip: + DEBUG( "core_frame_rsn_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_tkip" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_TKIP; + case core_cipher_suite_ccmp: + DEBUG( "core_frame_rsn_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_ccmp" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_CCMP; + default: + DEBUG( "core_frame_rsn_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_none" ); + return CORE_FRAME_RSN_IE_CIPHER_ID_NONE; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_rsn_ie_c::get_raw_key_management( + core_key_management_e key_management ) const + { + switch( key_management ) + { + case core_key_management_eap: + DEBUG( "core_frame_rsn_ie_c::get_raw_key_management() - core_key_management_eap" ); + return CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_EAP; + case core_key_management_preshared: + DEBUG( "core_frame_rsn_ie_c::get_raw_key_management() - core_key_management_preshared" ); + return CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_PSK; + default: + DEBUG( "core_frame_rsn_ie_c::get_raw_key_management() - core_key_management_none" ); + return CORE_FRAME_RSN_IE_KEY_MANAGEMENT_ID_NONE; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_rsn_ie_c::generate( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t pmkid_length, + const u8_t* pmkid_data) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( + core_frame_dot11_ie_element_id_rsn ); + + // Version field + u16_t value( CORE_FRAME_RSN_IE_VERSION ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // Group Cipher Suite field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_RSN_IE_OUI_PREFIX[0], + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_group_cipher( group_cipher ); + + // Pairwise Cipher Suite Count field + value = CORE_FRAME_RSN_IE_PAIRWISE_SUITE_COUNT; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // Pairwise Cipher Suite List field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_RSN_IE_OUI_PREFIX[0], + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_pairwise_cipher( pairwise_cipher ); + + // Key Management Suite Count field + value = CORE_FRAME_RSN_IE_KEY_MANAGEMENT_COUNT; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // Key Management Suite List field + u8_t wpx_oui_length( 0 ); + if ( wpx_adaptation_m.get_wpx_key_management_oui( + key_management, + wpx_oui_length, + &data_m[data_length_m] ) == core_error_ok ) + { + data_length_m = static_cast( data_length_m + wpx_oui_length ); + } + else + { + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_RSN_IE_OUI_PREFIX[0], + CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_RSN_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_key_management( key_management ); + } + + // RSN Capabilities field + value = CORE_FRAME_RSN_IE_CAPABILITIES; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + if ( pmkid_data && + pmkid_length == CORE_FRAME_RSN_IE_PMKID_LENGTH ) + { + DEBUG( "core_frame_rsn_ie_c::core_frame_rsn_ie_c() - adding PMKID" ); + + // PMKID Count field + value = CORE_FRAME_RSN_IE_PMKID_COUNT; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // PMKID List field + core_tools_c::copy( + &data_m[data_length_m], + &pmkid_data[0], + CORE_FRAME_RSN_IE_PMKID_LENGTH ); + data_length_m += CORE_FRAME_RSN_IE_PMKID_LENGTH; + } + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_rsn_ie_c::core_frame_rsn_ie_c( + abs_core_wpx_adaptation_c& wpx_adaptation, + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ), + wpx_adaptation_m( wpx_adaptation ) + { + DEBUG( "core_frame_rsn_ie_c::core_frame_rsn_ie_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_tim_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_tim_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing 802.11 TIM element IEs. +* +*/ + + +#include "core_frame_tim_ie.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_TIM_IE_MIN_LENGTH = 6; +const u8_t CORE_FRAME_TIM_IE_DTIM_COUNT_OFFSET = 2; +const u8_t CORE_FRAME_TIM_IE_DTIM_PERIOD_OFFSET = 3; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_tim_ie_c* core_frame_tim_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_TIM_IE_MIN_LENGTH ) + { + DEBUG( "core_frame_tim_ie_c::instance() - not a valid IE, too short" ); + + return NULL; + } + + core_frame_tim_ie_c* instance = new core_frame_tim_ie_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_tim_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_tim_ie_c::~core_frame_tim_ie_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_tim_ie_c::dtim_count() const + { + return data_m[CORE_FRAME_TIM_IE_DTIM_COUNT_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_tim_ie_c::dtim_period() const + { + return data_m[CORE_FRAME_TIM_IE_DTIM_PERIOD_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_tim_ie_c::core_frame_tim_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wapi_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wapi_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,487 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing GB 15629.11 (WAPI) IEs. +* +*/ + + +#include "core_frame_wapi_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_WAPI_IE_MIN_LENGTH = 22; +const u8_t CORE_FRAME_WAPI_IE_BKID_COUNT_SIZE = 2; +const u8_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_OFFSET = 4; +const u8_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_SIZE = 2; +const u8_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_OUI_LENGTH = 4; +const u8_t CORE_FRAME_WAPI_IE_CIPHER_COUNT_SIZE = 2; +const u8_t CORE_FRAME_WAPI_IE_CIPHER_OUI_LENGTH = 4; + +/** IDs for different cipher suites in WAPI IE. */ +const u8_t CORE_FRAME_WAPI_IE_CIPHER_ID_NONE = 0x00; +const u8_t CORE_FRAME_WAPI_IE_CIPHER_ID_WPI = 0x01; + +/** IDs for different key management suites. */ +const u8_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_NONE = 0x00; +const u8_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_CERTIFICATE = 0x01; +const u8_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_PSK = 0x02; + +const u8_t CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH = 3; +const u8_t CORE_FRAME_WAPI_IE_OUI_PREFIX[] = { 0x00, 0x14, 0x72 }; + +const u16_t CORE_FRAME_WAPI_IE_VERSION = 1; +const u16_t CORE_FRAME_WAPI_IE_PAIRWISE_SUITE_COUNT = 1; +const u16_t CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT = 1; +const u16_t CORE_FRAME_WAPI_IE_BKID_COUNT = 1; +const u16_t CORE_FRAME_WAPI_IE_BKID_LENGTH = 16; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wapi_ie_c* core_frame_wapi_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if( ie.data_length() < CORE_FRAME_WAPI_IE_MIN_LENGTH ) + { + DEBUG( "core_frame_wapi_ie_c::instance() - not a valid IE, too short" ); + + return NULL; + } + + core_frame_wapi_ie_c* instance = new core_frame_wapi_ie_c( + ie.data_length(), + ie.data(), + 0 ); + if( !instance ) + { + DEBUG( "core_frame_wapi_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wapi_ie_c* core_frame_wapi_ie_c::instance( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t capability, + u16_t bkid_length, + const u8_t* bkid_data ) + { + const u8_t max_length = CORE_FRAME_WAPI_IE_MIN_LENGTH + + CORE_FRAME_WAPI_IE_BKID_COUNT_SIZE + bkid_length; + + u8_t* buffer = new u8_t[max_length]; + if( !buffer ) + { + DEBUG( "core_frame_wapi_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_wapi_ie_c* instance = + new core_frame_wapi_ie_c( 0, buffer, max_length ); + if( !instance ) + { + DEBUG( "core_frame_wapi_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + group_cipher, + pairwise_cipher, + key_management, + capability, + bkid_length, + bkid_data ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wapi_ie_c::~core_frame_wapi_ie_c() + { + DEBUG( "core_frame_wapi_ie_c::~core_frame_wapi_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::group_cipher_suite() const + { + u8_t cipher_offset( + group_cipher_offset() ); + u32_t offset_end( + cipher_offset + + CORE_FRAME_WAPI_IE_CIPHER_OUI_LENGTH ); + if( !cipher_offset || + offset_end > data_length() ) + { + DEBUG( "core_frame_wapi_ie_c::pairwise_cipher_suites() - cipher_offset points past the end of IE, ignoring" ); + + return core_cipher_suite_none; + } + + return cipher_oui_to_enum( + data_m + cipher_offset ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::pairwise_cipher_suites() const + { + u8_t suites( 0 ); + u8_t pairwise_cipher_offset( + pairwise_cipher_count_offset() ); + if( !pairwise_cipher_offset ) + { + DEBUG( "core_frame_wapi_ie_c::pairwise_cipher_suites() - pairwise_cipher_offset points past the end of IE, ignoring" ); + + return core_cipher_suite_none; + } + + u16_t pairwise_cipher_count = core_tools_c::get_u16( + data_m, + pairwise_cipher_offset ); + + DEBUG1( "core_frame_wapi_ie_c::pairwise_cipher_suites() - pairwise_cipher_count = %u", + pairwise_cipher_count ); + + u32_t offset_end( + pairwise_cipher_offset + + CORE_FRAME_WAPI_IE_CIPHER_COUNT_SIZE + + ( pairwise_cipher_count * CORE_FRAME_WAPI_IE_CIPHER_OUI_LENGTH ) ); + if( offset_end > data_length() ) + { + DEBUG( "core_frame_wapi_ie_c::pairwise_cipher_suites() - pairwise_cipher_count points past the end of IE, ignoring" ); + + return core_cipher_suite_none; + } + + while( pairwise_cipher_count-- ) + { + suites += cipher_oui_to_enum( + data_m + pairwise_cipher_offset + + CORE_FRAME_WAPI_IE_CIPHER_COUNT_SIZE + + ( pairwise_cipher_count * CORE_FRAME_WAPI_IE_CIPHER_OUI_LENGTH ) ); + } + + return suites; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::key_management_suites() const + { + u8_t suites( 0 ); + u16_t key_management_suite_count = core_tools_c::get_u16( + data_m, CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_OFFSET ); + u32_t offset_end( + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_OFFSET + + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( key_management_suite_count * CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + if( offset_end > data_length() ) + { + DEBUG( "core_frame_wapi_ie_c::key_management_suites() - key_management_suite_count points past the end of IE, ignoring" ); + + return core_key_management_none; + } + + DEBUG1( "core_frame_wapi_ie_c::key_management_suites() - key_management_suite_count = %u", + key_management_suite_count ); + + while( key_management_suite_count-- ) + { + suites += key_management_oui_to_enum( + data_m + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_OFFSET + + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( key_management_suite_count * CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + } + + return suites; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::pairwise_cipher_count_offset() const + { + u16_t key_management_suite_count = core_tools_c::get_u16( + data_m, + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_OFFSET ); + u32_t offset_end( + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_OFFSET + + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( key_management_suite_count * CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + if( offset_end > data_length() ) + { + return 0; + } + + return offset_end; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::group_cipher_offset() const + { + u8_t pairwise_cipher_offset( + pairwise_cipher_count_offset() ); + if( !pairwise_cipher_offset ) + { + return 0; + } + + u16_t pairwise_cipher_count = core_tools_c::get_u16( + data_m, + pairwise_cipher_offset ); + u32_t offset_end( + pairwise_cipher_offset + + CORE_FRAME_WAPI_IE_CIPHER_COUNT_SIZE + + ( pairwise_cipher_count * CORE_FRAME_WAPI_IE_CIPHER_OUI_LENGTH ) ); + if( offset_end > data_length() ) + { + return 0; + } + + return offset_end; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +core_cipher_suite_e core_frame_wapi_ie_c::cipher_oui_to_enum( + const u8_t* oui ) const + { + if( core_tools_c::compare( + oui, + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH, + &CORE_FRAME_WAPI_IE_OUI_PREFIX[0], + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH ) ) + { + DEBUG( "core_frame_wapi_ie_c::cipher_oui_to_enum() - unknown cipher suite" ); + return core_cipher_suite_none; + } + + switch( *(oui + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH) ) + { + case CORE_FRAME_WAPI_IE_CIPHER_ID_WPI: + return core_cipher_suite_wpi; + default: + return core_cipher_suite_none; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +core_key_management_e core_frame_wapi_ie_c::key_management_oui_to_enum( + const u8_t* oui ) const + { + if( core_tools_c::compare( + oui, + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH, + &CORE_FRAME_WAPI_IE_OUI_PREFIX[0], + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH ) ) + { + DEBUG( "core_frame_wapi_ie_c::key_management_oui_to_enum() - unknown key management suite" ); + return core_key_management_none; + } + + switch( *(oui + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH) ) + { + case CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_CERTIFICATE: + DEBUG( "core_frame_wapi_ie_c::key_management_oui_to_enum() - core_key_management_wapi_certificate" ); + return core_key_management_wapi_certificate; + case CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_PSK: + DEBUG( "core_frame_wapi_ie_c::key_management_oui_to_enum() - core_key_management_wapi_psk" ); + return core_key_management_wapi_psk; + default: + DEBUG( "core_frame_wapi_ie_c::key_management_oui_to_enum() - core_key_management_none" ); + return core_key_management_none; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::get_raw_group_cipher( + core_cipher_suite_e cipher ) const + { + switch( cipher ) + { + case core_cipher_suite_wpi: + DEBUG( "core_frame_wapi_ie_c::get_raw_group_cipher() - core_cipher_suite_wpi" ); + return CORE_FRAME_WAPI_IE_CIPHER_ID_WPI; + default: + DEBUG( "core_frame_wapi_ie_c::get_raw_group_cipher() - core_cipher_suite_none" ); + return CORE_FRAME_WAPI_IE_CIPHER_ID_NONE; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::get_raw_pairwise_cipher( + core_cipher_suite_e cipher ) const + { + switch( cipher ) + { + case core_cipher_suite_wpi: + DEBUG( "core_frame_wapi_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_wpi" ); + return CORE_FRAME_WAPI_IE_CIPHER_ID_WPI; + default: + DEBUG( "core_frame_wapi_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_none" ); + return CORE_FRAME_WAPI_IE_CIPHER_ID_NONE; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wapi_ie_c::get_raw_key_management( + core_key_management_e key_management ) const + { + switch( key_management ) + { + case core_key_management_wapi_certificate: + DEBUG( "core_frame_wapi_ie_c::get_raw_key_management() - core_key_management_wapi_certificate" ); + return CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_CERTIFICATE; + case core_key_management_wapi_psk: + DEBUG( "core_frame_wapi_ie_c::get_raw_key_management() - core_key_management_wapi_psk" ); + return CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_PSK; + default: + DEBUG( "core_frame_wapi_ie_c::get_raw_key_management() - core_key_management_none" ); + return CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_ID_NONE; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_wapi_ie_c::generate( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management, + u16_t capability, + u16_t bkid_length, + const u8_t* bkid_data) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( + core_frame_dot11_ie_element_id_wapi ); + + // Version field + core_tools_c::append_u16( + data_m, + data_length_m, + CORE_FRAME_WAPI_IE_VERSION ); + + // Key Management Suite Count field + core_tools_c::append_u16( + data_m, + data_length_m, + CORE_FRAME_WAPI_IE_KEY_MANAGEMENT_COUNT ); + + // Key Management Suite List field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WAPI_IE_OUI_PREFIX[0], + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_key_management( key_management ); + + // Pairwise Cipher Suite Count field + core_tools_c::append_u16( + data_m, + data_length_m, + CORE_FRAME_WAPI_IE_PAIRWISE_SUITE_COUNT ); + + // Pairwise Cipher Suite List field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WAPI_IE_OUI_PREFIX[0], + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_pairwise_cipher( pairwise_cipher ); + + // Group Cipher Suite field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WAPI_IE_OUI_PREFIX[0], + CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_WAPI_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_group_cipher( group_cipher ); + + // Capability information + core_tools_c::append_u16( + data_m, + data_length_m, + capability ); + + if( bkid_data && + bkid_length == CORE_FRAME_WAPI_IE_BKID_LENGTH ) + { + DEBUG( "core_frame_wapi_ie_c::core_frame_wapi_ie_c() - adding BKID" ); + + // BKID Count field + core_tools_c::append_u16( + data_m, + data_length_m, + CORE_FRAME_WAPI_IE_BKID_COUNT ); + + // BKID List field + core_tools_c::copy( + &data_m[data_length_m], + &bkid_data[0], + CORE_FRAME_WAPI_IE_BKID_LENGTH ); + data_length_m += CORE_FRAME_WAPI_IE_BKID_LENGTH; + } + else + { + // BKID Count field + core_tools_c::append_u16( + data_m, + data_length_m, + 0 ); + } + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wapi_ie_c::core_frame_wapi_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + DEBUG( "core_frame_wapi_ie_c::core_frame_wapi_ie_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wmm_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wmm_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing WMM QoS IEs. +* +*/ + + +#include "core_frame_wmm_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_WMM_IE_PARAMETER_LENGTH = 26; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_OUI_OFFSET = 2; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_OUI_LENGTH = 5; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_OUI[] = { 0x00, 0x50, 0xF2, 0x02, 0x1 }; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_VERSION_OFFSET = 7; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_QOS_INFO_OFFSET = 8; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_ACI_BE_OFFSET = 10; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_ACI_BK_OFFSET = 14; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_ACI_VI_OFFSET = 18; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_ACI_VO_OFFSET = 22; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_UAPSD_MASK = 0x80; +const u8_t CORE_FRAME_WMM_IE_PARAMETER_ACM_MASK = 0x10; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_parameter_c* core_frame_wmm_ie_parameter_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() != CORE_FRAME_WMM_IE_PARAMETER_LENGTH ) + { + DEBUG( "core_frame_wmm_ie_parameter_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + if ( core_tools_c::compare( + &ie.data()[CORE_FRAME_WMM_IE_PARAMETER_OUI_OFFSET], + CORE_FRAME_WMM_IE_PARAMETER_OUI_LENGTH, + &CORE_FRAME_WMM_IE_PARAMETER_OUI[0], + CORE_FRAME_WMM_IE_PARAMETER_OUI_LENGTH ) ) + { + DEBUG( "core_frame_wpa_ie_c::instance() - not a valid IE, WMM OUI missing" ); + + return NULL; + } + + core_frame_wmm_ie_parameter_c* instance = new core_frame_wmm_ie_parameter_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_wmm_ie_parameter_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_parameter_c::~core_frame_wmm_ie_parameter_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wmm_ie_parameter_c::version() const + { + return data_m[CORE_FRAME_WMM_IE_PARAMETER_VERSION_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_frame_wmm_ie_parameter_c::is_uapsd_supported() const + { + if ( data_m[CORE_FRAME_WMM_IE_PARAMETER_QOS_INFO_OFFSET] & CORE_FRAME_WMM_IE_PARAMETER_UAPSD_MASK ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_frame_wmm_ie_parameter_c::is_admission_control_required( + core_access_class_e access_class ) const + { + u8_t offset( 0 ); + + switch ( access_class ) + { + case core_access_class_best_effort: + offset = CORE_FRAME_WMM_IE_PARAMETER_ACI_BE_OFFSET; + break; + case core_access_class_background: + offset = CORE_FRAME_WMM_IE_PARAMETER_ACI_BK_OFFSET; + break; + case core_access_class_video: + offset = CORE_FRAME_WMM_IE_PARAMETER_ACI_VI_OFFSET; + break; + case core_access_class_voice: + /** Falls through on purpose. */ + default: + offset = CORE_FRAME_WMM_IE_PARAMETER_ACI_VO_OFFSET; + break; + } + + if ( data_m[offset] & CORE_FRAME_WMM_IE_PARAMETER_ACM_MASK ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_parameter_c::core_frame_wmm_ie_parameter_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wmm_ie_tspec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wmm_ie_tspec.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,563 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for generating WMM TSPEC elements. +* +*/ + +/* +* %version: 7 % +*/ + +#include "core_frame_wmm_ie_tspec.h" +#include "core_tools.h" +#include "am_debug.h" + +const u8_t CORE_FRAME_WMM_IE_TSPEC_LENGTH = 63; +const u8_t CORE_FRAME_WMM_IE_TSPEC_OUI_OFFSET = 2; +const u8_t CORE_FRAME_WMM_IE_TSPEC_OUI_LENGTH = 5; +const u8_t CORE_FRAME_WMM_IE_TSPEC_OUI[] = { 0x00, 0x50, 0xF2, 0x02, 0x02 }; +const u8_t CORE_FRAME_WMM_IE_TSPEC_VERSION_OFFSET = 7; + +const u8_t CORE_FRAME_WMM_IE_TSPEC_TS_INFO_1ST_BYTE_OFFSET = 8; +const u8_t CORE_FRAME_WMM_IE_TSPEC_TS_INFO_2ND_BYTE_OFFSET = 9; +const u8_t CORE_FRAME_WMM_IE_TSPEC_NOMINAL_MSDU_SIZE_OFFSET = 11; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MAXIMUM_MSDU_SIZE_OFFSET = 13; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MINIMUM_SERVICE_INTERVAL_OFFSET = 15; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MAXIMUM_SERVICE_INTERVAL_OFFSET = 19; +const u8_t CORE_FRAME_WMM_IE_TSPEC_INACTIVITY_INTERVAL_OFFSET = 23; +const u8_t CORE_FRAME_WMM_IE_TSPEC_SUSPENSION_INTERVAL_OFFSET = 27; +const u8_t CORE_FRAME_WMM_IE_TSPEC_SERVICE_START_TIME = 31; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MINIMUM_DATA_RATE_OFFSET = 35; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MEAN_DATA_RATE_OFFSET = 39; +const u8_t CORE_FRAME_WMM_IE_TSPEC_PEAK_DATA_RATE_OFFSET = 43; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MAXIMUM_BURST_SIZE_OFFSET = 47; +const u8_t CORE_FRAME_WMM_IE_TSPEC_DELAY_BOUND_OFFSET = 51; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MINIMUM_PHY_RATE_OFFSET = 55; +const u8_t CORE_FRAME_WMM_IE_TSPEC_SURPLUS_BANDWIDTH_ALLOWANCE_OFFSET = 59; +const u8_t CORE_FRAME_WMM_IE_TSPEC_MEDIUM_TIME_OFFSET_OFFSET = 61; + +const u8_t CORE_FRAME_WMM_IE_TSPEC_TID_MASK = 0x1E; +const u8_t CORE_FRAME_WMM_IE_TSPEC_TID_SHIFT = 1; +const u8_t CORE_FRAME_WMM_IE_TSPEC_PSB_MASK = 0x04; +const u8_t CORE_FRAME_WMM_IE_TSPEC_PERIODIC_MASK = 0x01; +const u8_t CORE_FRAME_WMM_IE_TSPEC_UP_MASK = 0x38; +const u8_t CORE_FRAME_WMM_IE_TSPEC_UP_SHIFT = 3; +const u8_t CORE_FRAME_WMM_IE_TSPEC_DIRECTION_MASK = 0x60; +const u8_t CORE_FRAME_WMM_IE_TSPEC_DIRECTION_SHIFT = 5; + +const u8_t CORE_FRAME_WMM_IE_TSPEC_VERSION = 1; +const u8_t CORE_FRAME_WMM_IE_TSPEC_TS_INFO_1ST_BYTE = 0x80; +const u8_t CORE_FRAME_WMM_IE_TSPEC_TS_INFO_2ND_BYTE = 0x00; +const u8_t CORE_FRAME_WMM_IE_TSPEC_TS_INFO_3RD_BYTE = 0x00; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_tspec_c* core_frame_wmm_ie_tspec_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() != CORE_FRAME_WMM_IE_TSPEC_LENGTH ) + { + DEBUG( "core_frame_wmm_ie_tspec_c::instance() - not a valid IE, invalid length" ); + + return NULL; + } + + if ( core_tools_c::compare( + &ie.data()[CORE_FRAME_WMM_IE_TSPEC_OUI_OFFSET], + CORE_FRAME_WMM_IE_TSPEC_OUI_LENGTH, + &CORE_FRAME_WMM_IE_TSPEC_OUI[0], + CORE_FRAME_WMM_IE_TSPEC_OUI_LENGTH ) ) + { + DEBUG( "core_frame_wpa_ie_c::instance() - not a valid IE, WMM OUI missing" ); + + return NULL; + } + + core_frame_wmm_ie_tspec_c* instance = new core_frame_wmm_ie_tspec_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_wmm_ie_tspec_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_tspec_c* core_frame_wmm_ie_tspec_c::instance( + u8_t tid, + u8_t user_priority, + bool_t is_uapsd_enabled, + bool_t is_periodic_traffic, + core_traffic_stream_direction_e direction, + u16_t nominal_msdu_size, + u16_t maximum_msdu_size, + u32_t minimum_service_interval, + u32_t maximum_service_interval, + u32_t inactivity_interval, + u32_t suspension_interval, + u32_t service_start_time, + u32_t minimum_data_rate, + u32_t mean_data_rate, + u32_t peak_data_rate, + u32_t maximum_burst_size, + u32_t delay_bound, + u32_t minimum_phy_rate, + u16_t surplus_bandwidth_allowance, + u16_t medium_time ) + { + const u8_t max_length = CORE_FRAME_WMM_IE_TSPEC_LENGTH; + + u8_t* buffer = new u8_t[max_length]; + if ( !buffer ) + { + DEBUG( "core_frame_wmm_ie_tspec_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_wmm_ie_tspec_c* instance = + new core_frame_wmm_ie_tspec_c( 0, buffer, max_length ); + if ( !instance ) + { + DEBUG( "core_frame_wmm_ie_tspec_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + tid, + user_priority, + is_uapsd_enabled, + is_periodic_traffic, + direction, + nominal_msdu_size, + maximum_msdu_size, + minimum_service_interval, + maximum_service_interval, + inactivity_interval, + suspension_interval, + service_start_time, + minimum_data_rate, + mean_data_rate, + peak_data_rate, + maximum_burst_size, + delay_bound, + minimum_phy_rate, + surplus_bandwidth_allowance, + medium_time ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_tspec_c::~core_frame_wmm_ie_tspec_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wmm_ie_tspec_c::version() const + { + return data_m[CORE_FRAME_WMM_IE_TSPEC_VERSION_OFFSET]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wmm_ie_tspec_c::tid() const + { + u8_t tid_shifted = + data_m[CORE_FRAME_WMM_IE_TSPEC_TS_INFO_1ST_BYTE_OFFSET] & CORE_FRAME_WMM_IE_TSPEC_TID_MASK; + + return ( tid_shifted >> CORE_FRAME_WMM_IE_TSPEC_TID_SHIFT ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wmm_ie_tspec_c::user_priority() const + { + u8_t up_shifted = + data_m[CORE_FRAME_WMM_IE_TSPEC_TS_INFO_2ND_BYTE_OFFSET] & CORE_FRAME_WMM_IE_TSPEC_UP_MASK; + + return ( up_shifted >> CORE_FRAME_WMM_IE_TSPEC_UP_SHIFT ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_frame_wmm_ie_tspec_c::is_uapsd_enabled() const + { + return data_m[CORE_FRAME_WMM_IE_TSPEC_TS_INFO_2ND_BYTE_OFFSET] & CORE_FRAME_WMM_IE_TSPEC_PSB_MASK; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_frame_wmm_ie_tspec_c::is_periodic_traffic() const + { + return data_m[CORE_FRAME_WMM_IE_TSPEC_TS_INFO_1ST_BYTE_OFFSET] & CORE_FRAME_WMM_IE_TSPEC_PERIODIC_MASK; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_direction_e core_frame_wmm_ie_tspec_c::direction() const + { + u8_t direction_shifted = + data_m[CORE_FRAME_WMM_IE_TSPEC_TS_INFO_1ST_BYTE_OFFSET] & CORE_FRAME_WMM_IE_TSPEC_DIRECTION_MASK; + + return static_cast( + direction_shifted >> CORE_FRAME_WMM_IE_TSPEC_DIRECTION_SHIFT ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wmm_ie_tspec_c::nominal_msdu_size() const + { + return core_tools_c::get_u16( + data_m, CORE_FRAME_WMM_IE_TSPEC_NOMINAL_MSDU_SIZE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wmm_ie_tspec_c::maximum_msdu_size() const + { + return core_tools_c::get_u16( + data_m, CORE_FRAME_WMM_IE_TSPEC_MAXIMUM_MSDU_SIZE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::minimum_service_interval() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MINIMUM_SERVICE_INTERVAL_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::maximum_service_interval() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MAXIMUM_SERVICE_INTERVAL_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::inactivity_interval() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_INACTIVITY_INTERVAL_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::suspension_interval() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_SUSPENSION_INTERVAL_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::service_start_time() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_SERVICE_START_TIME ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::minimum_data_rate() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MINIMUM_DATA_RATE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::mean_data_rate() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MEAN_DATA_RATE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::peak_data_rate() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_PEAK_DATA_RATE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::maximum_burst_size() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MAXIMUM_BURST_SIZE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::delay_bound() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_DELAY_BOUND_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_frame_wmm_ie_tspec_c::minimum_phy_rate() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MINIMUM_PHY_RATE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wmm_ie_tspec_c::surplus_bandwidth_allowance() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_SURPLUS_BANDWIDTH_ALLOWANCE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wmm_ie_tspec_c::medium_time() const + { + return core_tools_c::get_u32( + data_m, CORE_FRAME_WMM_IE_TSPEC_MEDIUM_TIME_OFFSET_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_wmm_ie_tspec_c::generate( + u8_t tid, + u8_t user_priority, + bool_t is_uapsd_enabled, + bool_t is_periodic_traffic, + core_traffic_stream_direction_e direction, + u16_t nominal_msdu_size, + u16_t maximum_msdu_size, + u32_t minimum_service_interval, + u32_t maximum_service_interval, + u32_t inactivity_interval, + u32_t suspension_interval, + u32_t service_start_time, + u32_t minimum_data_rate, + u32_t mean_data_rate, + u32_t peak_data_rate, + u32_t maximum_burst_size, + u32_t delay_bound, + u32_t minimum_phy_rate, + u16_t surplus_bandwidth_allowance, + u16_t medium_time ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( + core_frame_dot11_ie_element_id_wmm_tspec ); + + // OUI + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WMM_IE_TSPEC_OUI[0], + CORE_FRAME_WMM_IE_TSPEC_OUI_LENGTH ); + data_length_m += CORE_FRAME_WMM_IE_TSPEC_OUI_LENGTH; + + // Version + data_m[data_length_m++] = CORE_FRAME_WMM_IE_TSPEC_VERSION; + + // TS Info + u8_t temp8 = CORE_FRAME_WMM_IE_TSPEC_TS_INFO_1ST_BYTE; + temp8 |= ( tid << CORE_FRAME_WMM_IE_TSPEC_TID_SHIFT ); + temp8 |= ( direction << CORE_FRAME_WMM_IE_TSPEC_DIRECTION_SHIFT); + if ( is_periodic_traffic ) + { + temp8 |= CORE_FRAME_WMM_IE_TSPEC_PERIODIC_MASK; + } + data_m[data_length_m++] = temp8; + + temp8 = CORE_FRAME_WMM_IE_TSPEC_TS_INFO_2ND_BYTE; + temp8 |= ( user_priority << CORE_FRAME_WMM_IE_TSPEC_UP_SHIFT ); + if ( is_uapsd_enabled ) + { + temp8 |= CORE_FRAME_WMM_IE_TSPEC_PSB_MASK; + } + data_m[data_length_m++] = temp8; + data_m[data_length_m++] = CORE_FRAME_WMM_IE_TSPEC_TS_INFO_3RD_BYTE; + + // Nominal MSDU Size + u16_t temp16 = nominal_msdu_size; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + + // Maximum MSDU Size + temp16 = maximum_msdu_size; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + + // Minimum Service Interval + u32_t temp32 = minimum_service_interval; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Maximum Service Interval + temp32 = maximum_service_interval; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Inactivity Interval + temp32 = inactivity_interval; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Suspension Interval + temp32 = suspension_interval; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Service Start Time + temp32 = service_start_time; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Minimum Data Rate + temp32 = minimum_data_rate; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Mean Data Rate + temp32 = mean_data_rate; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Peak Data Rate + temp32 = peak_data_rate; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Maximum Burst Size + temp32 = maximum_burst_size; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Delay Bound + temp32 = delay_bound; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Minimum PHY Rate + temp32 = minimum_phy_rate; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp32), + sizeof( temp32 ) ); + data_length_m += sizeof( temp32 ); + + // Surplus Bandwidth Allowance + temp16 = surplus_bandwidth_allowance; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + + // Medium Time + temp16 = medium_time; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&temp16), + sizeof( temp16 ) ); + data_length_m += sizeof( temp16 ); + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wmm_ie_tspec_c::core_frame_wmm_ie_tspec_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ) + { + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wpa_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wpa_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,460 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing WPA IEs. +* +*/ + + +#include "core_frame_wpa_ie.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +/** Defining this enables IE parsing related traces. */ +//#define WLAN_CORE_DEEP_DEBUG 1 + +const u8_t CORE_FRAME_WPA_IE_LENGTH = 24; +const u8_t CORE_FRAME_WPA_IE_GROUP_SUITE_OFFSET = 8; +const u8_t CORE_FRAME_WPA_IE_PAIRWISE_SUITE_COUNT_OFFSET = 12; +const u8_t CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET = 14; +const u8_t CORE_FRAME_WPA_IE_CIPHER_OUI_LENGTH = 4; +const u8_t CORE_FRAME_WPA_IE_KEY_MANAGEMENT_COUNT_SIZE = 2; +const u8_t CORE_FRAME_WPA_IE_KEY_MANAGEMENT_OUI_LENGTH = 4; + +/** IDs for different cipher suites in RSN IE. */ +const u8_t CORE_FRAME_WPA_IE_CIPHER_ID_NONE = 0x00; +const u8_t CORE_FRAME_WPA_IE_CIPHER_ID_WEP40 = 0x01; +const u8_t CORE_FRAME_WPA_IE_CIPHER_ID_WEP104 = 0x05; +const u8_t CORE_FRAME_WPA_IE_CIPHER_ID_TKIP = 0x02; +const u8_t CORE_FRAME_WPA_IE_CIPHER_ID_CCMP = 0x04; + +/** IDs for different key management suites. */ +const u8_t CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_NONE = 0x00; +const u8_t CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_EAP = 0x01; +const u8_t CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_PSK = 0x02; + +const u8_t CORE_FRAME_WPA_IE_OUI_OFFSET = 2; +const u8_t CORE_FRAME_WPA_IE_OUI_LENGTH = 4; +const u8_t CORE_FRAME_WPA_IE_OUI[] = { 0x00, 0x50, 0xF2, 0x01 }; + +const u8_t CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH = 3; +const u8_t CORE_FRAME_WPA_IE_OUI_PREFIX[] = { 0x00, 0x50, 0xF2 }; + +const u16_t CORE_FRAME_WPA_IE_VERSION = 1; +const u16_t CORE_FRAME_WPA_IE_PAIRWISE_SUITE_COUNT = 1; +const u16_t CORE_FRAME_WPA_IE_KEY_MANAGEMENT_COUNT = 1; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wpa_ie_c* core_frame_wpa_ie_c::instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + const core_frame_dot11_ie_c& ie ) + { + if ( ie.data_length() < CORE_FRAME_WPA_IE_LENGTH ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG( "core_frame_wpa_ie_c::instance() - not a valid IE, too short" ); +#endif // WLAN_CORE_DEEP_DEBUG + + return NULL; + } + + if ( core_tools_c::compare( + &ie.data()[CORE_FRAME_WPA_IE_OUI_OFFSET], + CORE_FRAME_WPA_IE_OUI_LENGTH, + &CORE_FRAME_WPA_IE_OUI[0], + CORE_FRAME_WPA_IE_OUI_LENGTH ) ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG( "core_frame_wpa_ie_c::instance() - not a valid IE, WPA OUI missing" ); +#endif // WLAN_CORE_DEEP_DEBUG + + return NULL; + } + + core_frame_wpa_ie_c* instance = new core_frame_wpa_ie_c( + wpx_adaptation, + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_wpa_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wpa_ie_c* core_frame_wpa_ie_c::instance( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management ) + { + const u8_t max_length = CORE_FRAME_WPA_IE_LENGTH; + + u8_t* buffer = new u8_t[max_length]; + if ( !buffer ) + { + DEBUG( "core_frame_wpa_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_wpa_ie_c* instance = + new core_frame_wpa_ie_c( wpx_adaptation, 0, buffer, max_length ); + if ( !instance ) + { + DEBUG( "core_frame_wpa_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + group_cipher, + pairwise_cipher, + key_management ); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wpa_ie_c::~core_frame_wpa_ie_c() + { + DEBUG( "core_frame_wpa_ie_c::~core_frame_wpa_ie_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wpa_ie_c::group_cipher_suite() const + { + return cipher_oui_to_enum( data_m + CORE_FRAME_WPA_IE_GROUP_SUITE_OFFSET ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wpa_ie_c::pairwise_cipher_suites() const + { + u16_t num_of_suites = core_tools_c::get_u16( + data_m, CORE_FRAME_WPA_IE_PAIRWISE_SUITE_COUNT_OFFSET ); + u8_t suites( 0 ); + + DEBUG1( "core_frame_wpa_ie_c::pairwise_cipher_suites() - num_of_suites = %u", + num_of_suites ); + + u32_t offset_end( + CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET + + ( num_of_suites * CORE_FRAME_WPA_IE_CIPHER_OUI_LENGTH ) ); + if ( offset_end > data_length() ) + { + DEBUG( "core_frame_wpa_ie_c::pairwise_cipher_suites() - num_of_suites points past the end of IE, ignoring" ); + + return suites; + } + + while ( num_of_suites-- ) + { + suites += cipher_oui_to_enum( data_m + CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET + + ( num_of_suites * CORE_FRAME_WPA_IE_CIPHER_OUI_LENGTH ) ); + } + + return suites; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wpa_ie_c::key_management_suites() const + { + u8_t suites( 0 ); + u16_t pairwise_num_of_suites = core_tools_c::get_u16( + data_m, CORE_FRAME_WPA_IE_PAIRWISE_SUITE_COUNT_OFFSET ); + u32_t pairwise_offset_end( + CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET + + ( pairwise_num_of_suites * CORE_FRAME_WPA_IE_CIPHER_OUI_LENGTH ) ); + if ( pairwise_offset_end > data_length() ) + { + DEBUG( "core_frame_wpa_ie_c::key_management_suites() - pairwise_num_of_suites points past the end of IE, ignoring" ); + + return suites; + } + + u8_t pairwise_length( pairwise_num_of_suites * CORE_FRAME_WPA_IE_CIPHER_OUI_LENGTH ); + u16_t num_of_suites = core_tools_c::get_u16( + data_m, CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET + pairwise_length ); + u32_t offset_end( + CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET + + pairwise_length + + CORE_FRAME_WPA_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( num_of_suites * CORE_FRAME_WPA_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + if ( offset_end > data_length() ) + { + DEBUG( "core_frame_wpa_ie_c::key_management_suites() - num_of_suites points past the end of IE, ignoring" ); + + return suites; + } + + DEBUG1( "core_frame_wpa_ie_c::key_management_suites() - num_of_suites = %u", + num_of_suites ); + + while ( num_of_suites-- ) + { + suites += key_management_oui_to_enum( + data_m + CORE_FRAME_WPA_IE_PAIRWISE_SUITE_OFFSET + + pairwise_length + + CORE_FRAME_WPA_IE_KEY_MANAGEMENT_COUNT_SIZE + + ( num_of_suites * CORE_FRAME_WPA_IE_KEY_MANAGEMENT_OUI_LENGTH ) ); + } + + return suites; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +core_cipher_suite_e core_frame_wpa_ie_c::cipher_oui_to_enum( + const u8_t* oui ) const + { + if ( core_tools_c::compare( + oui, + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH, + &CORE_FRAME_WPA_IE_OUI_PREFIX[0], + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH ) ) + { + DEBUG( "core_frame_wpa_ie_c::cipher_oui_to_enum() - unknown cipher suite" ); + return core_cipher_suite_none; + } + + switch ( *(oui + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH) ) + { + case CORE_FRAME_WPA_IE_CIPHER_ID_WEP40: + return core_cipher_suite_wep40; + case CORE_FRAME_WPA_IE_CIPHER_ID_WEP104: + return core_cipher_suite_wep104; + case CORE_FRAME_WPA_IE_CIPHER_ID_TKIP: + return core_cipher_suite_tkip; + case CORE_FRAME_WPA_IE_CIPHER_ID_CCMP: + return core_cipher_suite_ccmp; + default: + return core_cipher_suite_none; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +core_key_management_e core_frame_wpa_ie_c::key_management_oui_to_enum( + const u8_t* oui ) const + { + if ( !core_tools_c::compare( + oui, + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH, + &CORE_FRAME_WPA_IE_OUI_PREFIX[0], + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH ) ) + { + switch ( *(oui + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH) ) + { + case CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_EAP: + DEBUG( "core_frame_wpa_ie_c::key_management_oui_to_enum() - core_key_management_eap" ); + return core_key_management_eap; + case CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_PSK: + DEBUG( "core_frame_wpa_ie_c::key_management_oui_to_enum() - core_key_management_preshared" ); + return core_key_management_preshared; + default: + DEBUG( "core_frame_wpa_ie_c::key_management_oui_to_enum() - core_key_management_none" ); + return core_key_management_none; + } + } + + return wpx_adaptation_m.wpx_key_management_suite( oui ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wpa_ie_c::get_raw_group_cipher( + core_cipher_suite_e cipher ) const + { + switch( cipher ) + { + case core_cipher_suite_wep40: + DEBUG( "core_frame_wpa_ie_c::get_raw_group_cipher() - core_cipher_suite_wep40" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_WEP40; + case core_cipher_suite_wep104: + DEBUG( "core_frame_wpa_ie_c::get_raw_group_cipher() - core_cipher_suite_wep104" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_WEP104; + case core_cipher_suite_tkip: + DEBUG( "core_frame_wpa_ie_c::get_raw_group_cipher() - core_cipher_suite_tkip" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_TKIP; + case core_cipher_suite_ccmp: + DEBUG( "core_frame_wpa_ie_c::get_raw_group_cipher() - core_cipher_suite_ccmp" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_CCMP; + default: + DEBUG( "core_frame_wpa_ie_c::get_raw_group_cipher() - core_cipher_suite_none" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_NONE; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wpa_ie_c::get_raw_pairwise_cipher( + core_cipher_suite_e cipher ) const + { + switch( cipher ) + { + case core_cipher_suite_wep40: + DEBUG( "core_frame_wpa_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_wep40" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_WEP40; + case core_cipher_suite_wep104: + DEBUG( "core_frame_wpa_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_wep104" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_WEP104; + case core_cipher_suite_tkip: + DEBUG( "core_frame_wpa_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_tkip" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_TKIP; + case core_cipher_suite_ccmp: + DEBUG( "core_frame_wpa_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_ccmp" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_CCMP; + default: + DEBUG( "core_frame_wpa_ie_c::get_raw_pairwise_cipher() - core_cipher_suite_none" ); + return CORE_FRAME_WPA_IE_CIPHER_ID_NONE; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u8_t core_frame_wpa_ie_c::get_raw_key_management( + core_key_management_e key_management ) const + { + switch( key_management ) + { + case core_key_management_eap: + DEBUG( "core_frame_wpa_ie_c::get_raw_key_management() - core_key_management_eap" ); + return CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_EAP; + case core_key_management_preshared: + DEBUG( "core_frame_wpa_ie_c::get_raw_key_management() - core_key_management_preshared" ); + return CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_PSK; + default: + DEBUG( "core_frame_wpa_ie_c::get_raw_key_management() - core_key_management_none" ); + return CORE_FRAME_WPA_IE_KEY_MANAGEMENT_ID_NONE; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_frame_wpa_ie_c::generate( + core_cipher_suite_e group_cipher, + core_cipher_suite_e pairwise_cipher, + core_key_management_e key_management ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( + core_frame_dot11_ie_element_id_wpa ); + + // WPA OUI field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WPA_IE_OUI[0], + CORE_FRAME_WPA_IE_OUI_LENGTH ); + data_length_m += CORE_FRAME_WPA_IE_OUI_LENGTH; + + // Version field + u16_t value( CORE_FRAME_WPA_IE_VERSION ); + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // Group Cipher Suite field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WPA_IE_OUI_PREFIX[0], + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_group_cipher( group_cipher ); + + // Pairwise Cipher Suite Count field + value = CORE_FRAME_WPA_IE_PAIRWISE_SUITE_COUNT; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // Pairwise Cipher Suite List field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WPA_IE_OUI_PREFIX[0], + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_pairwise_cipher( pairwise_cipher ); + + // Key Management Suite Count field + value = CORE_FRAME_WPA_IE_KEY_MANAGEMENT_COUNT; + core_tools_c::copy( + &data_m[data_length_m], + reinterpret_cast(&value), + sizeof( value ) ); + data_length_m += sizeof( value ); + + // Key Management Suite List field + u8_t wpx_oui_length( 0 ); + if ( wpx_adaptation_m.get_wpx_key_management_oui( + key_management, + wpx_oui_length, + &data_m[data_length_m] ) == core_error_ok ) + { + data_length_m = static_cast( data_length_m + wpx_oui_length ); + } + else + { + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WPA_IE_OUI_PREFIX[0], + CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH ); + data_length_m += CORE_FRAME_WPA_IE_OUI_PREFIX_LENGTH; + data_m[data_length_m++] = get_raw_key_management( key_management ); + } + + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wpa_ie_c::core_frame_wpa_ie_c( + abs_core_wpx_adaptation_c& wpx_adaptation, + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ), + wpx_adaptation_m( wpx_adaptation ) + { + DEBUG( "core_frame_wpa_ie_c::core_frame_wpa_ie_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wsc_ie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_frame_wsc_ie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,798 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for parsing WSC IEs. +* +*/ + + +#include "core_frame_wsc_ie.h" +#include "core_tools.h" +#include "am_debug.h" + +/** Defining this enables IE parsing related traces. */ +//#define WLAN_CORE_DEEP_DEBUG 1 + +const u8_t CORE_FRAME_WSC_IE_OUI_OFFSET = 2; +const u8_t CORE_FRAME_WSC_IE_OUI_LENGTH = 4; +const u8_t CORE_FRAME_WSC_IE_OUI[] = { 0x00, 0x50, 0xF2, 0x04 }; + +/** Offset to first Protected Setup attribute type in IE */ +const u8_t CORE_FRAME_WSC_IE_PROTECTED_SETUP_DATA_OFFSET = + CORE_FRAME_WSC_IE_OUI_OFFSET + CORE_FRAME_WSC_IE_OUI_LENGTH; +/** Offset from AttributeType field to DataLength field */ +const u8_t CORE_FRAME_WSC_IE_DATA_LENGTH_OFFSET = 2; +/** Offset from AttributeType field to Data field */ +const u8_t CORE_FRAME_WSC_IE_DATA_AREA_OFFSET = 4; + +/** Maximum length of ASCII text fields. Used to prevent possible buffer overrun in debug print. */ +const u16_t CORE_FRAME_WSC_IE_MANUFACTURER_MAX_LENGTH = 64; +const u16_t CORE_FRAME_WSC_IE_MODEL_NAME_MAX_LENGTH = 32; + +/** IDs for different data elements in WSC IE. */ +const u16_t CORE_FRAME_WSC_IE_ASSOCIATION_STATE = 0x1002; +const u16_t CORE_FRAME_WSC_IE_CONFIG_METHODS = 0x1008; +const u16_t CORE_FRAME_WSC_IE_CONFIGURATION_ERROR = 0x1009; +const u16_t CORE_FRAME_WSC_IE_DEVICE_NAME = 0x1011; +const u16_t CORE_FRAME_WSC_IE_DEVICE_PASSWORD_ID = 0x1012; +const u16_t CORE_FRAME_WSC_IE_MANUFACTURER = 0x1021; +const u16_t CORE_FRAME_WSC_IE_MODEL_NAME = 0x1023; +const u16_t CORE_FRAME_WSC_IE_MODEL_NUMBER = 0x1024; +const u16_t CORE_FRAME_WSC_IE_REQUEST_TYPE = 0x103A; +const u16_t CORE_FRAME_WSC_IE_RESPONSE_TYPE = 0x103B; +const u16_t CORE_FRAME_WSC_IE_RF_BANDS = 0x103C; +const u16_t CORE_FRAME_WSC_IE_SELECTED_REGISTRAR = 0x1041; +const u16_t CORE_FRAME_WSC_IE_SERIAL_NUMBER = 0x1042; +const u16_t CORE_FRAME_WSC_IE_PROTECTED_SETUP_STATE = 0x1044; +const u16_t CORE_FRAME_WSC_IE_UUID_E = 0x1047; +const u16_t CORE_FRAME_WSC_IE_UUID_R = 0x1048; +const u16_t CORE_FRAME_WSC_IE_VERSION = 0x104A; +const u16_t CORE_FRAME_WSC_IE_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053; +const u16_t CORE_FRAME_WSC_IE_PRIMARY_DEVICE_TYPE = 0x1054; +const u16_t CORE_FRAME_WSC_IE_AP_SETUP_LOCKED = 0x1057; + + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wsc_ie_c* core_frame_wsc_ie_c::instance( + const core_frame_dot11_ie_c& ie ) + { + if ( core_tools_c::compare( + &ie.data()[CORE_FRAME_WSC_IE_OUI_OFFSET], + CORE_FRAME_WSC_IE_OUI_LENGTH, + &CORE_FRAME_WSC_IE_OUI[0], + CORE_FRAME_WSC_IE_OUI_LENGTH ) ) + { +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG( "core_frame_wsc_ie_c::instance() - not a valid IE, WSC OUI missing" ); +#endif // WLAN_CORE_DEEP_DEBUG + + return NULL; + } + + core_frame_wsc_ie_c* instance = new core_frame_wsc_ie_c( + ie.data_length(), + ie.data(), + 0 ); + if ( !instance ) + { + DEBUG( "core_frame_wsc_ie_c::instance() - unable to create an instance" ); + + return NULL; + } + + instance->search_attributes(); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wsc_ie_c* core_frame_wsc_ie_c::instance( + const u8_t version, + const u8_t request_type ) + { + // Count size of needed buffer. + const u16_t max_length = + CORE_FRAME_DOT11_IE_HEADER_LENGTH + + CORE_FRAME_WSC_IE_OUI_LENGTH + + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET + sizeof( version ) + + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET + sizeof( request_type ); + + u8_t* buffer = new u8_t[max_length]; + if ( !buffer ) + { + DEBUG( "core_frame_wsc_ie_c::instance() - unable create the internal buffer" ); + return NULL; + } + + core_frame_wsc_ie_c* instance = + new core_frame_wsc_ie_c( 0, buffer, max_length ); + if ( !instance ) + { + DEBUG( "core_frame_wsc_ie_c::instance() - unable to create an instance" ); + delete[] buffer; + + return NULL; + } + + instance->generate( + version, + request_type ); + + // Update members according to generated values. + // This is not necessary needed, but in testing phase this is useful. + instance->search_attributes(); + + return instance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wsc_ie_c::~core_frame_wsc_ie_c() + { + DEBUG( "core_frame_wsc_ie_c::~core_frame_wsc_ie_c()" ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wsc_ie_c::association_state() const + { + if ( association_state_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::association_state() - association_state field not found from IE" ); + return 0; + } + return core_tools_c::get_u16_big_endian( + data_m, association_state_ind_m); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wsc_ie_c::config_methods() const + { + if ( config_methods_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::config_methods() - config_methods field not found from IE" ); + return 0; + } + return core_tools_c::get_u16_big_endian( + data_m, config_methods_ind_m); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wsc_ie_c::configuration_error() const + { + if ( configuration_error_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::configuration_error() - configuration_error field not found from IE" ); + return 0; + } + return core_tools_c::get_u16_big_endian( + data_m, configuration_error_ind_m); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::device_name() const + { + if ( device_name_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::device_name() - device_name field not found from IE" ); + return NULL; + } + return &data_m[device_name_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wsc_ie_c::device_password_id() const + { + if ( device_password_id_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::device_password_id() - device_password_id field not found from IE" ); + return 0xFFFF; + } + return core_tools_c::get_u16_big_endian( + data_m, device_password_id_ind_m); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::manufacturer() const + { + if ( manufacturer_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::manufacturer() - manufacturer field not found from IE" ); + return NULL; + } + return &data_m[manufacturer_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::model_name() const + { + if ( model_name_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::model_name() - model_name field not found from IE" ); + return NULL; + } + return &data_m[model_name_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::model_number() const + { + if ( model_number_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::model_number() - model_number field not found from IE" ); + return NULL; + } + return &data_m[model_number_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wsc_ie_c::request_type() const + { + if ( request_type_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::request_type() - request_type field not found from IE" ); + return 0xFF; + } + return data_m[request_type_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wsc_ie_c::response_type() const + { + if ( response_type_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::response_type() - response_type field not found from IE" ); + return 0xFF; + } + return data_m[response_type_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wsc_ie_c::rf_bands() const + { + if ( rf_bands_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::rf_bands() - rf_bands field not found from IE" ); + return 0; + } + return data_m[rf_bands_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_frame_wsc_ie_c::selected_registrar() const + { + if ( selected_registrar_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::selected_registrar() - selected_registrar field not found from IE" ); + return false_t; + } + else if ( data_m[selected_registrar_ind_m] == 0 ) + { + return false_t; + } + else + { + return true_t; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::serial_number() const + { + if ( serial_number_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::serial_number() - serial_number field not found from IE" ); + return NULL; + } + return &data_m[serial_number_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wsc_ie_c::protected_setup_state() const + { + if ( protected_setup_state_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::protected_setup_state() - protected_setup_state field not found from IE" ); + return 0; + } + return data_m[protected_setup_state_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::uuid_e() const + { + if ( uuid_e_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::uuid_e() - uuid_e field not found from IE" ); + return NULL; + } + return &data_m[uuid_e_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::uuid_r() const + { + if ( uuid_r_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::uuid_r() - uuid_r field not found from IE" ); + return NULL; + } + return &data_m[uuid_r_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_frame_wsc_ie_c::version() const + { + if ( version_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::version() - version field not found from IE" ); + return 0x00; + } + return data_m[version_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_frame_wsc_ie_c::selected_registrar_config_methods() const + { + if ( selected_registrar_config_methods_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::selected_registrar_config_methods() - selected_registrar_config_methods field not found from IE" ); + return 0; + } + return core_tools_c::get_u16_big_endian( + data_m, selected_registrar_config_methods_ind_m); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const u8_t* core_frame_wsc_ie_c::primary_device_type() const + { + if ( primary_device_type_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::primary_device_type() - primary_device_type field not found from IE" ); + return 0; + } + return &data_m[primary_device_type_ind_m]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_frame_wsc_ie_c::ap_setup_locked() const + { + if ( ap_setup_locked_ind_m == 0 ) + { + DEBUG( "core_frame_wsc_ie_c::ap_setup_locked() - ap_setup_locked field not found from IE" ); + return false_t; + } + else if ( data_m[ap_setup_locked_ind_m] == 0 ) + { + return false_t; + } + else + { + return true_t; + } + } + + + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +/** Search attributes from WSC IE. + * + * The main idea in searching is to loop through IE, and store index of each attribute + * to member variable. After loop, it is easy to get needed attribute with stored index. + * + * All data is in big endian format. + */ +void core_frame_wsc_ie_c::search_attributes() + { + DEBUG( "core_frame_wsc_ie_c::search_attributes()" ); + + u16_t index( CORE_FRAME_WSC_IE_PROTECTED_SETUP_DATA_OFFSET ); + while (index < data_length()) + { + u16_t attribute_type = core_tools_c::get_u16_big_endian( + data_m, index); + + u16_t attribute_data_length = core_tools_c::get_u16_big_endian( + data_m, index + CORE_FRAME_WSC_IE_DATA_LENGTH_OFFSET); + //DEBUG3( "core_frame_wsc_ie_c::search_attributes() - found attribute 0x%04x at index %u (length=%u)", attribute_type, index, attribute_data_length); + + // Check if all attribute data does not fit current IE. + if ( ( index + attribute_data_length + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET ) > data_length()) + { + DEBUG5( "core_frame_wsc_ie_c::search_attributes() - attribute 0x%04x does not fit current IE, giving up. IE length=%u, Attribute length=%u ([%u..%u])", + attribute_type, + data_length(), + attribute_data_length, + index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET, + index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET + attribute_data_length - 1 ); + return; + } + + switch (attribute_type) + { + case CORE_FRAME_WSC_IE_ASSOCIATION_STATE: + { + association_state_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - ASSOCIATION_STATE data at index %u (value = %u)", + association_state_ind_m, association_state() ); + break; + } + + case CORE_FRAME_WSC_IE_CONFIG_METHODS: + { + config_methods_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - CONFIG_METHODS data at index %u (value = 0x%02X)", + config_methods_ind_m, config_methods() ); + break; + } + + case CORE_FRAME_WSC_IE_CONFIGURATION_ERROR: + { + configuration_error_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - CONFIGURATION_ERROR data at index %u (value = %u)", + configuration_error_ind_m, configuration_error() ); + break; + } + + case CORE_FRAME_WSC_IE_DEVICE_NAME: + { + device_name_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - DEVICE_NAME data at index %u, data (UTF-8):", + device_name_ind_m ); + const u8_t* debug_device_name = device_name(); + if (debug_device_name) + { + DEBUG_BUFFER( attribute_data_length, debug_device_name); + } + break; + } + + case CORE_FRAME_WSC_IE_DEVICE_PASSWORD_ID: + { + device_password_id_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - DEVICE_PASSWORD_ID data at index %u (value = %u)", + device_password_id_ind_m, device_password_id() ); + break; + } + + case CORE_FRAME_WSC_IE_MANUFACTURER: + { + manufacturer_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - MANUFACTURER data at index %u, data (ASCII):", + manufacturer_ind_m ); + const u8_t* debug_manufacturer = manufacturer(); + if (debug_manufacturer) + { + u16_t length = attribute_data_length; + if ( length > CORE_FRAME_WSC_IE_MANUFACTURER_MAX_LENGTH ) + { + length = CORE_FRAME_WSC_IE_MANUFACTURER_MAX_LENGTH; + } + DEBUG1S("MANUFACTURER: ", length, debug_manufacturer); + } + break; + } + + case CORE_FRAME_WSC_IE_MODEL_NAME: + { + model_name_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - MODEL_NAME data at index %u, data (ASCII):", + model_name_ind_m ); + const u8_t* debug_model_name = model_name(); + if (debug_model_name) + { + u16_t length = attribute_data_length; + if ( length > CORE_FRAME_WSC_IE_MODEL_NAME_MAX_LENGTH ) + { + length = CORE_FRAME_WSC_IE_MODEL_NAME_MAX_LENGTH; + } + DEBUG1S("MODEL_NAME: ", length, debug_model_name); + } + break; + } + + case CORE_FRAME_WSC_IE_MODEL_NUMBER: + { + model_number_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - MODEL_NUMBER data at index %u, data:", + model_number_ind_m ); + const u8_t* debug_model_number = model_number(); + if (debug_model_number) + { + DEBUG_BUFFER( attribute_data_length, debug_model_number); + } + break; + } + + case CORE_FRAME_WSC_IE_REQUEST_TYPE: + { + request_type_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - REQUEST_TYPE data at index %u (value = %u)", + request_type_ind_m, request_type() ); + break; + } + + case CORE_FRAME_WSC_IE_RESPONSE_TYPE: + { + response_type_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - RESPONSE_TYPE data at index %u (value = %u)", + response_type_ind_m, response_type() ); + break; + } + + case CORE_FRAME_WSC_IE_RF_BANDS: + { + rf_bands_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - RF_BANDS data at index %u (value = %u)", + rf_bands_ind_m, rf_bands() ); + break; + } + + case CORE_FRAME_WSC_IE_SELECTED_REGISTRAR: + { + selected_registrar_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - SELECTED_REGISTRAR data at index %u (value = %u)", + selected_registrar_ind_m, selected_registrar() ); + break; + } + + case CORE_FRAME_WSC_IE_SERIAL_NUMBER: + { + serial_number_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - SERIAL_NUMBER data at index %u, data:", + serial_number_ind_m ); + const u8_t* debug_serial_number = serial_number(); + if (debug_serial_number) + { + DEBUG_BUFFER( attribute_data_length, debug_serial_number); + } + break; + } + + case CORE_FRAME_WSC_IE_PROTECTED_SETUP_STATE: + { + protected_setup_state_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - PROTECTED_SETUP_STATE data at index %u (value = %u)", + protected_setup_state_ind_m, protected_setup_state() ); + break; + } + + case CORE_FRAME_WSC_IE_UUID_E: + { + uuid_e_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - UUID_E data at index %u, data:", + uuid_e_ind_m ); + + const u8_t* debug_uuid_e = uuid_e(); + if (debug_uuid_e) + { + DEBUG_BUFFER( attribute_data_length, debug_uuid_e); + } + break; + } + + case CORE_FRAME_WSC_IE_UUID_R: + { + uuid_r_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG1( "core_frame_wsc_ie_c::search_attributes() - UUID_R data at index %u, data:", + uuid_r_ind_m ); + + const u8_t* debug_uuid_r = uuid_r(); + if (debug_uuid_r) + { + DEBUG_BUFFER( attribute_data_length, debug_uuid_r); + } + break; + } + + case CORE_FRAME_WSC_IE_VERSION: + { + version_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + u8_t wsc_version = version(); + DEBUG3( "core_frame_wsc_ie_c::search_attributes() - VERSION data at index %u (value = %x.%x)", + version_ind_m, (wsc_version&0xF0)>>4, (wsc_version&0x0F) ); + break; + } + + case CORE_FRAME_WSC_IE_SELECTED_REGISTRAR_CONFIG_METHODS: + { + selected_registrar_config_methods_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - SELECTED_REGISTRAR_CONFIG_METHODS data at index %u (value = 0x%02X)", + selected_registrar_config_methods_ind_m, selected_registrar_config_methods() ); + break; + } + + case CORE_FRAME_WSC_IE_PRIMARY_DEVICE_TYPE: + { + primary_device_type_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + + const u8_t* device_type = primary_device_type(); + DEBUG3( "core_frame_wsc_ie_c::search_attributes() - PRIMARY_DEVICE_TYPE data at index %u (CategoryID = %u, SubcategoryID = %u)", + primary_device_type_ind_m, + core_tools_c::get_u16_big_endian( + device_type, 0), + core_tools_c::get_u16_big_endian( + device_type, 2+CORE_FRAME_WSC_IE_OUI_LENGTH) ); + break; + } + + case CORE_FRAME_WSC_IE_AP_SETUP_LOCKED: + { + ap_setup_locked_ind_m = index + CORE_FRAME_WSC_IE_DATA_AREA_OFFSET; + DEBUG2( "core_frame_wsc_ie_c::search_attributes() - AP_SETUP_LOCKED data at index %u (value = %u)", + ap_setup_locked_ind_m, ap_setup_locked() ); + break; + } + + default: + DEBUG3( "core_frame_wsc_ie_c::search_attributes() - unhandled attribute 0x%04x from index %u (length = %u)", + attribute_type, index, attribute_data_length ); + } + // update index to start of next attribute + index += CORE_FRAME_WSC_IE_DATA_AREA_OFFSET + attribute_data_length; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Generate IE for Association request +void core_frame_wsc_ie_c::generate( + const u8_t version, + const u8_t request_type ) + { + ASSERT( !data_length_m ); + ASSERT( max_data_length_m ); + + core_frame_dot11_ie_c::generate( + core_frame_dot11_ie_element_id_wpa ); + + // WSC OUI field + core_tools_c::copy( + &data_m[data_length_m], + &CORE_FRAME_WSC_IE_OUI[0], + CORE_FRAME_WSC_IE_OUI_LENGTH ); + data_length_m += CORE_FRAME_WSC_IE_OUI_LENGTH; + + + // ------------------------------------ + // Version + // AttributeType + u16_t attribute_type = core_tools_c::convert_host_to_big_endian( CORE_FRAME_WSC_IE_VERSION ); + core_tools_c::copy( + &data_m[data_length_m], + &attribute_type, + //reinterpret_cast(&attribute_type), + sizeof( attribute_type ) ); + data_length_m += sizeof( attribute_type ); + + // DataLength + u16_t data_length = sizeof(version); + data_length = core_tools_c::convert_host_to_big_endian( data_length ); + core_tools_c::copy( + &data_m[data_length_m], + &data_length, + //reinterpret_cast(&data_length), + sizeof( data_length ) ); + data_length_m += sizeof( data_length ); + + // actual data + data_m[data_length_m] = version; + data_length_m += sizeof(version); + + // ------------------------------------ + // Request type + // AttributeType + attribute_type = core_tools_c::convert_host_to_big_endian( CORE_FRAME_WSC_IE_REQUEST_TYPE ); + core_tools_c::copy( + &data_m[data_length_m], + &attribute_type, + sizeof( attribute_type ) ); + data_length_m += sizeof( attribute_type ); + + // DataLength + data_length = sizeof(request_type); + data_length = core_tools_c::convert_host_to_big_endian( data_length ); + core_tools_c::copy( + &data_m[data_length_m], + &data_length, + sizeof( data_length ) ); + data_length_m += sizeof( data_length ); + + // actual data + data_m[data_length_m] = request_type; + data_length_m += sizeof(request_type); + + + // Set length of whole IE + set_length( data_length_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_frame_wsc_ie_c::core_frame_wsc_ie_c( + u16_t data_length, + const u8_t* data, + u16_t max_data_length ) : + core_frame_dot11_ie_c( data_length, data, max_data_length ), + association_state_ind_m( 0 ), + config_methods_ind_m( 0 ), + configuration_error_ind_m( 0 ), + device_name_ind_m( 0 ), + device_password_id_ind_m( 0 ), + manufacturer_ind_m( 0 ), + model_name_ind_m( 0 ), + model_number_ind_m( 0 ), + request_type_ind_m( 0 ), + response_type_ind_m( 0 ), + rf_bands_ind_m( 0 ), + selected_registrar_ind_m( 0 ), + serial_number_ind_m( 0 ), + protected_setup_state_ind_m( 0 ), + uuid_e_ind_m( 0 ), + uuid_r_ind_m( 0 ), + version_ind_m( 0 ), + selected_registrar_config_methods_ind_m( 0 ), + primary_device_type_ind_m( 0 ), + ap_setup_locked_ind_m( 0 ) + { + DEBUG( "core_frame_wsc_ie_c::core_frame_wsc_ie_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,339 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class holding all IAP related data +* +*/ + + +#include "core_iap_data.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_iap_data_c::core_iap_data_c( + const core_iap_data_s& iap_data ) : + iap_data_m( iap_data ), + iap_whitelist_m( ), + iap_blacklist_m( ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_iap_data_c::~core_iap_data_c() + { + iap_whitelist_m.clear(); + iap_blacklist_m.clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_iap_data_c::id() const + { + return iap_data_m.id; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_iap_data_c::iap_id() const + { + return iap_data_m.iap_id; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operating_mode_e core_iap_data_c::operating_mode() const + { + return iap_data_m.op_mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_ssid_s& core_iap_data_c::ssid() const + { + return iap_data_m.ssid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_hidden() const + { + return iap_data_m.is_hidden; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_wep_key_s& core_iap_data_c::wep_key( + u32_t key_index ) const + { + switch ( key_index ) + { + case WEP_KEY1: + return iap_data_m.wep_key1; + case WEP_KEY2: + return iap_data_m.wep_key2; + case WEP_KEY3: + return iap_data_m.wep_key3; + default: + return iap_data_m.wep_key4; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_iap_data_c::default_wep_key_index() const + { + return iap_data_m.default_wep_key; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_security_mode_e core_iap_data_c::security_mode() const + { + return iap_data_m.security_mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_authentication_mode_e core_iap_data_c::authentication_mode() const + { + return iap_data_m.authentication_mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_iap_data_c::set_authentication_mode( + core_authentication_mode_e mode ) + { + iap_data_m.authentication_mode = mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_psk_used() const + { + return iap_data_m.wpa_preshared_key_in_use; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_psk_overridden() const + { + return iap_data_m.is_wpa_overriden; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_wpa_preshared_key_s& core_iap_data_c::psk_key() const + { + return iap_data_m.wpa_preshared_key; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_iap_data_c::adhoc_channel() const + { + return iap_data_m.used_adhoc_channel; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_dynamic_ip_addr() const + { + return iap_data_m.is_dynamic_ip_addr; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_roaming_allowed() const + { + return iap_data_m.is_roaming_allowed; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_eap_used() const + { + if ( iap_data_m.security_mode == core_security_mode_802dot1x || + iap_data_m.security_mode == core_security_mode_wpa || + iap_data_m.security_mode == core_security_mode_wpa2only || + iap_data_m.security_mode == core_security_mode_protected_setup ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_wapi_used() const + { + return( iap_data_m.security_mode == core_security_mode_wapi ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_802dot1x_used() const + { + return iap_data_m.security_mode == core_security_mode_802dot1x; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_iap_whitelist_empty() const + { + return !iap_whitelist_m.count(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_mac_in_iap_whitelist( + const core_mac_address_s& mac ) + { + core_mac_address_s* addr = iap_whitelist_m.first(); + while ( addr ) + { + if ( *addr == mac ) + { + return true_t; + } + + addr = iap_whitelist_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_iap_data_c::is_mac_in_iap_blacklist( + const core_mac_address_s& mac ) + { + core_mac_address_s* addr = iap_blacklist_m.first(); + while ( addr ) + { + if ( *addr == mac ) + { + return true_t; + } + + addr = iap_blacklist_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_iap_data_c::add_mac_to_iap_whitelist( + const core_mac_address_s& mac ) + { + if ( !is_mac_in_iap_whitelist( mac ) ) + { + core_mac_address_s* entry = new core_mac_address_s; + if ( entry ) + { + *entry = mac; + iap_whitelist_m.append( entry ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_iap_data_c::remove_mac_from_iap_whitelist( + const core_mac_address_s& mac ) + { + core_mac_address_s* addr = iap_whitelist_m.first(); + while ( addr ) + { + if ( *addr == mac ) + { + iap_whitelist_m.remove( addr ); + delete addr; + + return; + } + + addr = iap_whitelist_m.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_iap_data_c::add_mac_to_iap_blacklist( + const core_mac_address_s& mac ) + { + if ( !is_mac_in_iap_blacklist( mac ) ) + { + core_mac_address_s* entry = new core_mac_address_s; + if ( entry ) + { + *entry = mac; + iap_blacklist_m.append( entry ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_iap_data_c::remove_mac_from_iap_blacklist( + const core_mac_address_s& mac ) + { + core_mac_address_s* addr = iap_blacklist_m.first(); + while ( addr ) + { + if ( *addr == mac ) + { + iap_blacklist_m.remove( addr ); + delete addr; + + return; + } + + addr = iap_blacklist_m.next(); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_base.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_base.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,431 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for wlan engine operations +* +*/ + + +#include "core_operation_base.h" +#include "core_server.h" +#include "core_sub_operation_load_drivers.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_base_c::core_operation_base_c( + core_operation_type_e type, + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u32_t feature_flags ) : + request_id_m( request_id ), + server_m( server ), + drivers_m( drivers ), + adaptation_m( adaptation ), + is_executing_m( false_t ), + is_canceling_m( false_t ), + operation_state_m( core_base_state_init ), + sub_operation_m( NULL ), + failure_reason_m( core_error_cancel ), + operation_type_m( type ), + feature_flags_m( feature_flags ) + { + DEBUG1( "core_operation_base_c::core_operation_base_c() (%08X)", + this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_base_c::~core_operation_base_c() + { + DEBUG1( "core_operation_base_c::~core_operation_base_c() (%08X)", + this ); + + delete sub_operation_m; + sub_operation_m = NULL; + server_m = NULL; + drivers_m = NULL; + adaptation_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::start_operation() + { + DEBUG1( "core_operation_base_c::start_operation() (%08X)", + this ); + + is_executing_m = true_t; + return continue_operation( core_error_ok ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::continue_operation( + core_error_e request_status ) + { + DEBUG1( "core_operation_base_c::continue_operation() (%08X)", + this ); + bool_t is_sub_operation_canceled( false_t ); + + /** + * If we have pending sub-operation, this continue must be for it. + */ + if ( sub_operation_m ) + { + core_error_e ret = sub_operation_m->continue_operation( request_status ); + if ( ret == core_error_request_pending ) + { + DEBUG( "core_operation_base_c::continue_operation() - sub-operation still pending" ); + return ret; + } + + delete sub_operation_m; + sub_operation_m = NULL; + + if ( ret == core_error_ok ) + { + DEBUG( "core_operation_base_c::continue_operation() - sub-operation completed successfully" ); + } + else if ( is_canceling_m ) + { + DEBUG( "core_operation_base_c::continue_operation() - sub-operation user cancel completed" ); + is_sub_operation_canceled = true_t; + } + else + { + DEBUG1( "core_operation_base_c::continue_operation() - sub-operation failed with %u", + ret ); + failure_reason_m = ret; + + return cancel_operation(); + } + } + + /** + * Handle user cancel for operations that haven't overridden the user cancel method. + */ + if ( operation_state_m == core_base_state_user_cancel ) + { + DEBUG( "core_operation_base_c::continue_operation() - user cancel complete" ); + ASSERT( is_canceling_m ); + + return core_error_cancel; + } + + /** + * This continue is for this operation. + * + * If a sub-operation has just completed its user cancel, ignore the return + * value. + */ + if ( !is_sub_operation_canceled && + request_status != core_error_ok ) + { + DEBUG1( "core_operation_base_c::continue_operation() - request failed with %u", + request_status ); + failure_reason_m = request_status; + + return cancel_operation(); + } + + switch ( operation_state_m ) + { + case core_base_state_init: + { + operation_state_m = core_base_state_next; + + if ( is_flags( core_base_flag_drivers_needed ) && + !server_m->get_core_settings().is_driver_loaded() ) + { + DEBUG( "core_operation_base_c::continue_operation() - drivers required" ); + + operation_state_m = core_base_state_load_drivers; + + core_operation_base_c* operation = new core_sub_operation_load_drivers_c( + request_id_m, server_m, drivers_m, adaptation_m ); + return run_sub_operation( operation ); + } + + return next_state(); + } + case core_base_state_load_drivers: + { + DEBUG( "core_operation_base_c::continue_operation() - drivers loaded successfully" ); + + operation_state_m = core_base_state_next; + + return next_state(); + } + default: + { + core_error_e ret = next_state(); + + /** + * Always return an error code when the operation completes + * after user cancel. + */ + if( is_canceling_m && + ret != core_error_request_pending ) + { + DEBUG( "core_operation_base_c::continue_operation() - completing user canceled operation with core_error_cancel" ); + + return core_error_cancel; + } + + return ret; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::cancel_operation() + { + DEBUG1( "core_operation_base_c::cancel_operation() (%08X)", + this ); + + /** + * If we have pending sub-operation, it must be canceled first. + */ + if ( sub_operation_m ) + { + core_error_e ret = sub_operation_m->cancel_operation(); + if ( ret == core_error_request_pending ) + { + DEBUG( "core_operation_base_c::cancel_operation() - sub-operation cancel pending" ); + return ret; + } + + delete sub_operation_m; + sub_operation_m = NULL; + } + + /** + * If the cancel occurs during the base operation state machine, fail the operation + * immediately without making the main state machine handle the failure. + */ + if ( operation_state_m < core_base_state_next ) + { + DEBUG( "core_operation_base_c::cancel_operation() - canceling using base operation cancel()" ); + + return core_operation_base_c::cancel(); + } + + return cancel(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_base_c::user_cancel_operation( + bool_t do_graceful_cancel ) + { + DEBUG1( "core_operation_base_c::user_cancel_operation() (%08X)", + this ); + + /** + * Prevent double canceling. + */ + if ( is_canceling_m ) + { + DEBUG( "core_operation_base_c::user_cancel_operation() - canceling already in progress" ); + + return; + } + + /** + * If we have pending sub-operation, it must be canceled first. + */ + if ( sub_operation_m ) + { + sub_operation_m->user_cancel_operation( do_graceful_cancel ); + } + + is_canceling_m = true_t; + + /** + * If the user cancel occurs during the base operation state machine, fail the operation + * immediately without making the main state machine handle the user cancel. + */ + if ( operation_state_m < core_base_state_next ) + { + DEBUG( "core_operation_base_c::user_cancel_operation() - canceling using base operation user_cancel()" ); + + core_operation_base_c::user_cancel( do_graceful_cancel ); + return; + } + + user_cancel( do_graceful_cancel ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_operation_base_c::request_id() const + { + return request_id_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_type_e core_operation_base_c::operation_type() const + { + return operation_type_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_base_c::is_executing() const + { + return is_executing_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_base_c::is_flags( + u32_t feature_flags ) const + { + if ( feature_flags_m & feature_flags ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::cancel() + { + DEBUG( "core_operation_base_c::cancel() " ); + + return failure_reason_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_base_c::user_cancel( + bool_t /* do_graceful_cancel */ ) + { + DEBUG( "core_operation_base_c::user_cancel()" ); + + operation_state_m = core_base_state_user_cancel; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::goto_state( + u32_t state ) + { + operation_state_m = state; + + return next_state(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::run_sub_operation( + core_operation_base_c* sub_operation ) + { + DEBUG( "core_operation_base_c::run_sub_operation() " ); + + ASSERT( !sub_operation_m ); + sub_operation_m = sub_operation; + + if ( !sub_operation_m ) + { + DEBUG( "core_operation_base_c::run_sub_operation() - sub-operation creation failed" ); + failure_reason_m = core_error_no_memory; + + return cancel_operation(); + } + + core_error_e ret = sub_operation_m->start_operation(); + if ( ret == core_error_request_pending ) + { + DEBUG( "core_operation_base_c::run_sub_operation() - sub-operation still pending" ); + return ret; + } + + delete sub_operation_m; + sub_operation_m = NULL; + + if ( ret != core_error_ok ) + { + DEBUG1( "core_operation_base_c::run_sub_operation() - sub-operation failed with %u", + ret ); + failure_reason_m = ret; + + return cancel_operation(); + } + + DEBUG( "core_operation_base_c::run_sub_operation() - sub-operation completed successfully" ); + + return continue_operation( ret ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::run_sub_operation( + core_operation_base_c* sub_operation, + u32_t state ) + { + operation_state_m = state; + + return run_sub_operation( sub_operation ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_base_c::asynch_goto( + u32_t state, + u32_t delay ) + { + operation_state_m = state; + + server_m->schedule_operation_timer( + delay ); + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_base_c::asynch_default_user_cancel() + { + DEBUG( "core_operation_base_c::asynch_default_user_cancel()" ); + + server_m->cancel_operation_timer(); + + asynch_goto( core_base_state_user_cancel ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_check_rcpi.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,512 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for requesting RCPI values for roaming. +* +*/ + +/* +* %version: 21 % +*/ + +#include "core_operation_check_rcpi.h" +#include "core_operation_roam.h" +#include "core_operation_handle_bss_lost.h" +#include "core_sub_operation_roam_scan.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_check_rcpi_c::core_operation_check_rcpi_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_rcpi_check_reason_e reason ) : + core_operation_base_c( core_operation_check_rcpi, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_connection_needed | core_base_flag_roam_operation ), + reason_m( reason ), + current_rcpi_m( 0 ), + is_connected_m( true_t ) + { + DEBUG( "core_operation_check_rcpi_c::core_operation_check_rcpi_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_check_rcpi_c::~core_operation_check_rcpi_c() + { + DEBUG( "core_operation_check_rcpi_c::~core_operation_check_rcpi_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_check_rcpi_c::next_state() + { + DEBUG( "core_operation_check_rcpi_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { +#ifdef _DEBUG + switch ( reason_m ) + { + case core_rcpi_check_reason_timer: + DEBUG( "core_operation_check_rcpi_c::next_state() - core_rcpi_check_reason_timer" ); + break; + case core_rcpi_check_reason_rcpi_trigger: + DEBUG( "core_operation_check_rcpi_c::next_state() - core_rcpi_check_reason_rcpi_trigger" ); + break; + case core_rcpi_check_reason_signal_loss_prediction: + DEBUG( "core_operation_check_rcpi_c::next_state() - core_rcpi_check_reason_signal_loss_prediction" ); + break; + default: + ASSERT( false_t ); + } +#endif // _DEBUG + + operation_state_m = core_state_rcpi_received; + + /** + * Cancel the roaming timer just in case. + */ + server_m->cancel_roam_timer(); + + DEBUG( "core_operation_check_rcpi_c::next_state() - requesting RCPI" ); + + drivers_m->get_current_rcpi( + request_id_m, + current_rcpi_m ); + + break; + } + case core_state_rcpi_received: + { + operation_state_m = core_state_rcpi_trigger; + + DEBUG1( "core_operation_check_rcpi_c::next_state() - current RCPI is %u", + current_rcpi_m ); + DEBUG1( "core_operation_check_rcpi_c::next_state() - internal RCPI threshold level is %u", + server_m->get_device_settings().rcpi_trigger ); + DEBUG1( "core_operation_check_rcpi_c::next_state() - external RCPI threshold level (down) is %u", + server_m->get_core_settings().rcp_decline_boundary() ); + DEBUG1( "core_operation_check_rcpi_c::next_state() - external RCPI threshold level (up) is %u", + server_m->get_core_settings().rcp_improve_boundary() ); + + u8_t trigger_level_down = server_m->get_core_settings().rcp_decline_boundary(); + if ( trigger_level_down < server_m->get_device_settings().rcpi_trigger ) + { + trigger_level_down = server_m->get_device_settings().rcpi_trigger; + } + u8_t trigger_level_up = server_m->get_core_settings().rcp_improve_boundary(); + if ( trigger_level_up < server_m->get_device_settings().rcpi_trigger ) + { + trigger_level_up = server_m->get_device_settings().rcpi_trigger; + } + + /** + * If signal level drops below roaming threshold, attempt roaming. + */ + if ( current_rcpi_m < server_m->get_device_settings().rcpi_trigger && + server_m->get_connection_data()->iap_data().is_roaming_allowed() ) + { + return goto_state( core_state_scan_start ); + } + + /** + * If moving from weak level to normal, notify client. + */ + if ( current_rcpi_m > server_m->get_core_settings().rcp_improve_boundary() && + server_m->get_connection_data()->last_rcp_class() != core_rcp_normal ) + { + DEBUG( "core_operation_check_rcpi_c::next_state() - sending a notification about the normal signal level" ); + + u8_t buf[5]; + buf[0] = static_cast( core_rcp_normal ); + buf[1] = static_cast( current_rcpi_m ); + + adaptation_m->notify( + core_notification_rcp_changed, + sizeof( buf ), + buf ); + server_m->get_connection_data()->set_last_rcp_class( core_rcp_normal ); + + DEBUG( "core_operation_check_rcpi_c::next_state() - reseting RCPI roam check interval" ); + server_m->get_connection_data()->reset_rcpi_roam_interval(); + } + + /** + * Send an indication to adaptation to indicate that this + * roam attempt has been completed. + */ + adaptation_m->notify( + core_notification_rcpi_roam_attempt_completed, + 0, + NULL ); + + /** + * If the signal level is above the trigger level, we only have to check + * whether we should re-arm the trigger. + */ + if ( current_rcpi_m > trigger_level_up ) + { + DEBUG1( "core_operation_check_rcpi_c::next_state() - signal level is above trigger_level_up (%u)", + trigger_level_up ); + + /** + * If the operation was started because of a trigger event, schedule a timer. + * This is done to prevent constant triggering when the signal level is + * hovering right on the trigger level. + */ + if ( reason_m == core_rcpi_check_reason_rcpi_trigger || + reason_m == core_rcpi_check_reason_signal_loss_prediction ) + { + DEBUG1( "core_operation_check_rcpi_c::next_state() - was triggered, scheduling the roaming timer to %u", + server_m->get_device_settings().roam_timer ); + + server_m->schedule_roam_timer( + server_m->get_device_settings().roam_timer ); + + return core_error_ok; + } + + /** + * At least one timer-based poll has been done, trigger can be re-armed. + */ + DEBUG1( "core_operation_check_rcpi_c::next_state() - was not triggered, arming RCPI roam trigger (%u)", + trigger_level_down ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + trigger_level_down ); + + DEBUG( "core_operation_check_rcpi_c::next_state() - reseting RCPI roam check interval" ); + server_m->get_connection_data()->reset_rcpi_roam_interval(); + + return core_error_request_pending; + } + + /** + * If we have come this far, it means the current signal level is between the + * external and the internal threshold level. Schedule a timer and if the operation + * was started because of a timer event, re-arm the trigger as well. + */ + DEBUG2( "core_operation_check_rcpi_c::next_state() - between trigger_level_down (%u) and trigger_level_up (%u)", + trigger_level_down, trigger_level_up ); + DEBUG1( "core_operation_check_rcpi_c::next_state() - scheduling the roaming timer to %u", + server_m->get_device_settings().roam_timer ); + + server_m->schedule_roam_timer( + server_m->get_device_settings().roam_timer ); + + if ( reason_m == core_rcpi_check_reason_timer ) + { + DEBUG1( "core_operation_check_rcpi_c::next_state() - was not triggered, arming RCPI roam trigger (%u)", + trigger_level_down ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + trigger_level_down ); + + return core_error_request_pending; + } + + return core_error_ok; + } + case core_state_rcpi_trigger: + { + DEBUG( "core_operation_check_rcpi_c::next_state() - trigger re-armed" ); + + return core_error_ok; + } + case core_state_scan_start: + { + operation_state_m = core_state_scan_complete; + + DEBUG( "core_operation_check_rcpi_c::next_state() - starting a direct scan on all channels" ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_roam_scan ); + + core_operation_base_c* operation = new core_sub_operation_roam_scan_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + server_m->get_connection_data()->ssid(), + server_m->get_core_settings().all_valid_scan_channels(), + true_t, + false_t ); + + return run_sub_operation( operation ); + } + case core_state_scan_complete: + { + operation_state_m = core_state_connect_success; + + DEBUG( "core_operation_check_rcpi_c::next_state() - attempting to roam" ); + + if ( reason_m == core_rcpi_check_reason_signal_loss_prediction ) + { + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_signal_loss_prediction ); + } + else + { + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_signal_strength ); + } + server_m->get_connection_data()->set_last_roam_failed_reason( + core_roam_failed_reason_none ); + + medium_time_s admitted_medium_time( + server_m->get_connection_data()->traffic_stream_list().admitted_medium_time() ); + + core_operation_base_c* operation = new core_operation_roam_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + core_scan_list_tag_roam_scan, + current_rcpi_m + server_m->get_device_settings().rcpi_difference, + admitted_medium_time, + server_m->get_connection_data()->ssid(), + BROADCAST_MAC_ADDR ); + + return run_sub_operation( operation ); + } + case core_state_connect_success: + { + operation_state_m = core_state_rcpi_trigger; + + DEBUG( "core_operation_check_rcpi_c::next_state() - roamed successfully" ); + + /** + * If moving from weak level to normal, notify client. + */ + if ( server_m->get_connection_data()->last_rcp_class() != core_rcp_normal ) + { + DEBUG( "core_operation_check_rcpi_c::next_state() - sending a notification about the normal signal level" ); + + u8_t buf[5]; + buf[0] = static_cast( core_rcp_normal ); + buf[1] = server_m->get_connection_data()->current_ap_data()->rcpi(); + + adaptation_m->notify( + core_notification_rcp_changed, + sizeof( buf ), + buf ); + server_m->get_connection_data()->set_last_rcp_class( core_rcp_normal ); + } + + /** + * Send an indication to adaptation to indicate that this + * roam attempt has been completed. + */ + adaptation_m->notify( + core_notification_rcpi_roam_attempt_completed, + 0, + NULL ); + + DEBUG( "core_operation_check_rcpi_c::next_state() - reseting RCPI roam check interval" ); + server_m->get_connection_data()->reset_rcpi_roam_interval(); + + DEBUG1( "core_operation_check_rcpi_c::next_state() - internal RCPI threshold level is %u", + server_m->get_device_settings().rcpi_trigger ); + DEBUG1( "core_operation_check_rcpi_c::next_state() - external RCPI threshold level is %u", + server_m->get_core_settings().rcp_decline_boundary() ); + + u8_t trigger_level = server_m->get_core_settings().rcp_decline_boundary(); + if ( trigger_level < server_m->get_device_settings().rcpi_trigger ) + { + trigger_level = server_m->get_device_settings().rcpi_trigger; + } + DEBUG1( "core_operation_check_rcpi_c::next_state() - arming RCPI roam trigger (%u)", + trigger_level ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + trigger_level ); + + break; + } + case core_state_connect_failure: + { + operation_state_m = core_state_rcpi_trigger; + + DEBUG( "core_operation_check_rcpi_c::next_state() - roaming failed" ); + + DEBUG1( "core_operation_check_rcpi_c::next_state() - internal RCPI threshold level is %u", + server_m->get_device_settings().rcpi_trigger ); + DEBUG1( "core_operation_check_rcpi_c::next_state() - external RCPI threshold level is %u", + server_m->get_core_settings().rcp_decline_boundary() ); + + DEBUG1( "core_operation_check_rcpi_c::next_state() - current RCPI is %u", + current_rcpi_m ); + + u8_t weak_trigger_level = server_m->get_core_settings().rcp_decline_boundary(); + if ( weak_trigger_level > server_m->get_device_settings().rcpi_trigger ) + { + weak_trigger_level = server_m->get_device_settings().rcpi_trigger; + } + weak_trigger_level = weak_trigger_level - 20; + + DEBUG1( "core_operation_check_rcpi_c::next_state() - weak_trigger_level (%u)", + weak_trigger_level ); + /** + * If we haven't notified the clients about a weak signal earlier, + * do it now. + */ + if ( current_rcpi_m < weak_trigger_level && + server_m->get_connection_data()->last_rcp_class() != core_rcp_weak ) + { + DEBUG( "core_operation_check_rcpi_c::next_state() - sending a notification about the weak signal level" ); + + u8_t buf[5]; + buf[0] = static_cast( core_rcp_weak ); + buf[1] = static_cast( current_rcpi_m ); + + /** + * Get current IAP Id value and add it to the weak list. + */ + server_m->get_core_settings().add_iap_id_to_weak_iap_list( + server_m->get_connection_data()->iap_data().iap_id()); + + adaptation_m->notify( + core_notification_rcp_changed, + sizeof( buf ), + buf ); + server_m->get_connection_data()->set_last_rcp_class( core_rcp_weak ); + + } + + if ( !is_connected_m ) + { + DEBUG( "core_operation_check_rcpi_c::next_state() - no longer connected, scheduling bss_lost operation" ); + + core_operation_base_c* operation = new core_operation_handle_bss_lost_c( + REQUEST_ID_CORE_INTERNAL, + server_m, + drivers_m, + adaptation_m, + core_operation_handle_bss_lost_c::core_bss_lost_reason_failed_rcpi_roam ); + + server_m->queue_int_operation( operation ); + } + else + { + /** + * Send an indication to adaptation to indicate that this + * roam attempt has been completed. + */ + adaptation_m->notify( + core_notification_rcpi_roam_attempt_completed, + 0, + NULL ); + + core_rcpi_roam_interval_s interval( + server_m->get_connection_data()->rcpi_roam_interval() ); + ++interval.count; + + if ( interval.count > server_m->get_device_settings().rcpi_roam_attempts_per_interval ) + { + DEBUG1( "core_operation_check_rcpi_c::next_state() - maximum interval attempts (%u) exceeded, increasing interval", + server_m->get_device_settings().rcpi_roam_attempts_per_interval ); + interval.count = 1; + interval.interval *= server_m->get_device_settings().rcpi_roam_next_interval_factor; + interval.interval += server_m->get_device_settings().rcpi_roam_next_interval_addition; + + if ( interval.interval > server_m->get_device_settings().rcpi_roam_max_interval ) + { + interval.interval = server_m->get_device_settings().rcpi_roam_max_interval; + + DEBUG1( "core_operation_check_rcpi_c::next_state() - interval value set to maximum (%u)", + interval.interval ); + } + else + { + DEBUG1( "core_operation_check_rcpi_c::next_state() - interval value set to %u", + interval.interval ); + } + } + + server_m->get_connection_data()->set_core_rcpi_roam_interval( + interval ); + + DEBUG1( "core_operation_check_rcpi_c::next_state() - arming the roaming timer to %u", + interval.interval ); + + server_m->schedule_roam_timer( + interval.interval ); + + if ( server_m->get_connection_data()->last_rcp_class() != core_rcp_weak ) + { + DEBUG( "core_operation_check_rcpi_c::next_state() - set_rcpi_trigger_level( weak_trigger_level )" ); + + DEBUG1( "core_operation_check_rcpi_c::next_state() - arming new RCPI roam trigger (%u)", + weak_trigger_level ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + weak_trigger_level ); + + return core_error_request_pending; + } + } + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_check_rcpi_c::cancel() + { + DEBUG( "core_operation_check_rcpi_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_connect_success: + { + return goto_state( core_state_connect_failure ); + } + default: + { + /** + * Send an indication to adaptation to indicate that this + * roam attempt has been completed. + */ + adaptation_m->notify( + core_notification_rcpi_roam_attempt_completed, + 0, + NULL ); + + return failure_reason_m; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_configure_multicast_group.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_configure_multicast_group.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for configuring multicast address to drivers +* +*/ + + +#include "core_operation_configure_multicast_group.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_configure_multicast_group_c::core_operation_configure_multicast_group_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t join_group, + const core_mac_address_s& multicast_addr ): + core_operation_base_c( core_operation_configure_multicast_group, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_connection_needed ), + is_join_m( join_group ), + multicast_addr_m( multicast_addr ) + { + DEBUG( "core_operation_configure_multicast_group_c::core_operation_configure_multicast_group_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_configure_multicast_group_c::~core_operation_configure_multicast_group_c() + { + DEBUG( "core_operation_configure_multicast_group_c::~core_operation_configure_multicast_group_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_configure_multicast_group_c::next_state() + { + DEBUG( "core_operation_configure_multicast_group_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_req_configure_multicast_group; + + drivers_m->configure_multicast_group( + request_id_m, + is_join_m, + multicast_addr_m ); + break; + } + case core_state_req_configure_multicast_group: + { + DEBUG( "core_operation_configure_multicast_group_c::next_state() - DONE" ); + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_connect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_connect.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,506 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connecting to a network +* +*/ + +/* +* %version: 40 % +*/ + +#include "genscaninfo.h" +#include "core_operation_connect.h" +#include "core_sub_operation_set_static_wep.h" +#include "core_sub_operation_roam_scan.h" +#include "core_operation_roam.h" +#include "core_operation_release.h" +#include "core_operation_update_power_mode.h" +#include "core_operation_power_save_test.h" +#include "abs_core_timer.h" +#include "core_timer_factory.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +/** The time to wait for DHCP completion after connect */ +const u32_t UPDATE_IP_ADDR_TIMEOUT = 7*1000000; // 7 seconds + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_connect_c::core_operation_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_iap_data_s& settings, + core_type_list_c* ssid_list, + core_connect_status_e& connect_status ) : + core_operation_base_c( core_operation_connect, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_roam_operation ), + settings_m( settings ), + connect_status_m( connect_status ), + failure_count_m( 0 ), + is_connected_m( false_t ), + ssid_m( settings.ssid ), + ssid_list_m( ssid_list ), + release_reason_m( core_release_reason_max_roam_attempts_exceeded ) + { + DEBUG( "core_operation_connect_c::core_operation_connect_c()" ); + + connect_status_m = core_connect_undefined; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_connect_c::~core_operation_connect_c() + { + DEBUG( "core_operation_connect_c::~core_operation_connect_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_connect_c::next_state() + { + DEBUG( "core_operation_connect_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + if ( server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_connect_c::next_state() - already connected, completing request" ); + + return core_error_connection_already_active; + } + + core_error_e ret = server_m->init_connection_data( + settings_m, + server_m->get_device_settings() ); + if( ret != core_error_ok ) + { + DEBUG1( "core_operation_connect_c::next_state() - unable to initialize connection data (%d)", ret ); + + return ret; + } + + if( server_m->get_connection_data()->iap_data().is_eap_used() && + !server_m->create_eapol_instance( core_eapol_operating_mode_wfa ) ) + { + DEBUG( "core_operation_connect_c::next_state() - unable to instantiate EAPOL (WFA)" ); + + return core_error_no_memory; + } + else if( server_m->get_connection_data()->iap_data().is_wapi_used() && + !server_m->create_eapol_instance( core_eapol_operating_mode_wapi ) ) + { + DEBUG( "core_operation_connect_c::next_state() - unable to instantiate EAPOL (WAPI)" ); + + return core_error_no_memory; + } + + if( server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_ibss && + ( server_m->get_connection_data()->iap_data().security_mode() != core_security_mode_allow_unsecure && + server_m->get_connection_data()->iap_data().security_mode() != core_security_mode_wep ) ) + { + DEBUG1( "core_operation_connect_c::next_state() - ad-hoc with security mode %d not supported", + server_m->get_connection_data()->iap_data().security_mode() ); + + return core_error_not_supported; + } + + server_m->get_core_settings().clear_connection_statistics(); + server_m->get_core_settings().roam_metrics().set_roam_ts_userdata_disabled(); + + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_initial_connect ); + server_m->get_core_settings().roam_metrics().inc_roam_attempt_count( + core_roam_reason_initial_connect ); + + DEBUG( "core_operation_connect_c::next_state() - reseting RCPI roam check interval" ); + server_m->get_connection_data()->reset_rcpi_roam_interval(); + + /** + * Indicate core_connection_state_searching state to adaptation. + */ + core_connection_state_e state = core_connection_state_searching; + server_m->get_core_settings().set_connection_state( state ); + + if ( server_m->get_connection_data()->last_connection_state() != state ) + { + u8_t buf[5]; + buf[0] = static_cast( state ); + adaptation_m->notify( + core_notification_connection_state_changed, + 1, + buf ); + + server_m->get_connection_data()->set_last_connection_state( + state ); + } + + /** + * Disable the power save mode before first connect. + */ + core_operation_base_c* operation = new core_operation_update_power_mode_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + CORE_POWER_SAVE_MODE_NONE ); + + return run_sub_operation( operation, core_state_power_mode ); + } + case core_state_power_mode: + { + if ( ssid_list_m && + ssid_list_m->count() ) + { + DEBUG1( "core_operation_connect_c::next_state() - IAP has %u secondary SSID(s) defined", + ssid_list_m->count() ); + + operation_state_m = core_state_secondary_ssid_scan_start; + } + else + { + operation_state_m = core_state_scan_start; + } + + if ( server_m->get_connection_data()->iap_data().security_mode() == core_security_mode_wep ) + { + core_operation_base_c* operation = new core_sub_operation_set_static_wep_c( + request_id_m, + server_m, + drivers_m, + adaptation_m ); + + return run_sub_operation( operation ); + } + + return next_state(); + } + case core_state_secondary_ssid_scan_start: + { + DEBUG( "core_operation_connect_c::next_state() - doing a broadcast scan to detect available secondary SSIDs" ); + + ASSERT( ssid_list_m ); + ASSERT( ssid_list_m->count() ); + (void)ssid_list_m->first(); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_scan ); + + core_operation_base_c* operation = new core_sub_operation_roam_scan_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + BROADCAST_SSID, + server_m->get_core_settings().all_valid_scan_channels(), + false_t, + false_t ); + + return run_sub_operation( operation, core_state_secondary_ssid_scan ); + } + case core_state_secondary_ssid_scan: + { + ASSERT( ssid_list_m ); + ASSERT( ssid_list_m->count() ); + + core_ssid_entry_s* entry = + ssid_list_m->current(); + ASSERT( entry ); + + DEBUG( "core_operation_connect_c::next_state() - searching broadcast scan results for the secondary SSID:" ); + DEBUG1S( "core_operation_connect_c::next_state() - ssid: ", + entry->ssid.length, &entry->ssid.ssid[0] ); + DEBUG1S( "core_operation_connect_c::next_state() - used_ssid: ", + entry->used_ssid.length, &entry->used_ssid.ssid[0] ); + + core_scan_list_iterator_by_tag_and_ssid_c iter( + server_m->get_scan_list(), + core_scan_list_tag_scan, + entry->ssid ); + + if ( iter.first() != NULL ) + { + DEBUG( "core_operation_connect_c::next_state() - secondary SSID match found" ); + ssid_m = entry->used_ssid; + + return goto_state( core_state_scan_start ); + } + + DEBUG( "core_operation_connect_c::next_state() - secondary SSID match not found" ); + + return goto_state( core_state_connect_secondary_ssid_failure ); + } + case core_state_scan_start: + { + operation_state_m = core_state_scan_complete; + + DEBUG( "core_operation_connect_c::next_state() - starting a direct scan on all channels" ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_roam_scan ); + + core_operation_base_c* operation = new core_sub_operation_roam_scan_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + ssid_m, + server_m->get_core_settings().all_valid_scan_channels(), + false_t, + false_t ); + + return run_sub_operation( operation ); + } + case core_state_scan_complete: + { + operation_state_m = core_state_connect_success; + + DEBUG1S( "core_operation_connect_c::next_state() - trying to connect to SSID ", + ssid_m.length, &ssid_m.ssid[0] ); + + core_operation_base_c* operation = new core_operation_roam_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + core_scan_list_tag_roam_scan, + RCPI_VALUE_NONE, + MEDIUM_TIME_NOT_DEFINED, + ssid_m, + BROADCAST_MAC_ADDR ); + + return run_sub_operation( operation ); + } + case core_state_connect_failure: + { + if ( failure_reason_m == core_error_not_found ) + { + failure_count_m++; + + if ( ssid_list_m && + ssid_list_m->count() ) + { + return goto_state( core_state_connect_secondary_ssid_failure ); + } + } + else + { + failure_count_m = 0; + } + + DEBUG1( "core_operation_connect_c::next_state() - connecting has failed %u time(s)", + failure_count_m ); + DEBUG1( "core_operation_connect_c::next_state() - failure_reason_m is %u", + failure_reason_m ); + DEBUG1( "core_operation_connect_c::next_state() - connect_status is %u", + server_m->get_connection_data()->connect_status() ); + + /** + * If EAPOL has notified about a total failure or we have tried too many times, + * close down the connection. Otherwise, try again. + */ + if ( failure_reason_m == core_error_eapol_total_failure || + failure_reason_m == core_error_eapol_canceled_by_user || + failure_count_m >= server_m->get_device_settings().max_tries_to_find_nw ) + { + return goto_state( core_state_connect_total_failure ); + } + + return asynch_goto( + core_state_scan_start, + server_m->get_device_settings().delay_between_find_nw ); + } + case core_state_connect_secondary_ssid_failure: + { + DEBUG( "core_operation_connect_c::next_state() - trying the next secondary SSID entry" ); + + core_ssid_entry_s* entry = + ssid_list_m->next(); + if ( entry ) + { + return asynch_goto( core_state_secondary_ssid_scan ); + } + + DEBUG( "core_operation_connect_c::next_state() - no more secondary SSID entries to try, closing connection" ); + if ( server_m->get_connection_data()->connect_status() == core_connect_undefined ) + { + server_m->get_connection_data()->set_connect_status( core_connect_network_not_found ); + } + + return goto_state( core_state_connect_total_failure ); + } + case core_state_connect_total_failure: + { + operation_state_m = core_state_connect_disconnect; + + DEBUG1( "core_operation_connect_c::next_state() - gave up connecting after %u tries", + failure_count_m ); + + /** + * Complete adaptation with the same status as was set to connection data. + */ + connect_status_m = server_m->get_connection_data()->connect_status(); + + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + release_reason_m ); + + return run_sub_operation( operation ); + } + case core_state_connect_disconnect: + { + DEBUG( "core_operation_connect_c::next_state() - connection closed successfully" ); + return core_error_ok; + } + case core_state_connect_success: + { + operation_state_m = core_state_set_rcpi_trigger; + + DEBUG( "core_operation_connect_c::next_state() - connected successfully" ); + + /** + * If no roaming between APs is allowed, add the current AP to the + * whitelist to prevent roaming in BSS lost situations. + */ + if ( !server_m->get_connection_data()->iap_data().is_roaming_allowed() && + server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_infrastructure ) + { + const core_mac_address_s current_bssid = + server_m->get_connection_data()->current_ap_data()->bssid(); + + server_m->get_connection_data()->iap_data().add_mac_to_iap_whitelist( + current_bssid ); + } + + /** + * If power save is enabled in infrastructure mode, schedule a power save test. + */ + if ( server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_infrastructure && + server_m->get_device_settings().power_save_enabled ) + { + if ( server_m->get_connection_data()->iap_data().is_dynamic_ip_addr() ) + { + DEBUG( "core_operation_connect_c::next_state() - scheduling a power save test after DHCP timeout" ); + server_m->schedule_dhcp_timer( UPDATE_IP_ADDR_TIMEOUT ); + } + else + { + DEBUG( "core_operation_connect_c::next_state() - scheduling a power save test" ); + + core_operation_base_c* operation = new core_operation_power_save_test_c( + REQUEST_ID_CORE_INTERNAL, + server_m, + drivers_m, + adaptation_m ); + + server_m->queue_int_operation( operation ); + } + } + + /** + * RCPI trigger is only used in infrastructure mode. + */ + if ( server_m->get_connection_data()->iap_data().operating_mode() != + core_operating_mode_infrastructure ) + { + return next_state(); + } + + DEBUG1( "core_operation_connect_c::next_state() - internal RCPI threshold level is %u", + server_m->get_device_settings().rcpi_trigger ); + DEBUG1( "core_operation_connect_c::next_state() - external RCPI threshold level is %u", + server_m->get_core_settings().rcp_decline_boundary() ); + + u8_t trigger_level = server_m->get_core_settings().rcp_decline_boundary(); + if ( trigger_level < server_m->get_device_settings().rcpi_trigger ) + { + trigger_level = server_m->get_device_settings().rcpi_trigger; + } + DEBUG1( "core_operation_connect_c::next_state() - arming RCPI roam trigger (%u)", + trigger_level ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + trigger_level ); + + break; + } + case core_state_set_rcpi_trigger: + { + // Connection is OK, complete connection data + server_m->get_connection_data()->set_connect_status( core_connect_ok ); + // complete adaptation status + connect_status_m = core_connect_ok; + // complete operation + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_connect_c::user_cancel( + bool_t /* do_graceful_cancel */ ) + { + DEBUG( "core_operation_connect_c::user_cancel()" ); + + release_reason_m = core_release_reason_external_request; + + operation_state_m = core_state_connect_total_failure; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_connect_c::cancel() + { + DEBUG( "core_operation_connect_c::cancel() " ); + + switch( operation_state_m ) + { + case core_state_connect_success: + { + return goto_state( core_state_connect_failure ); + } + default: + { + // complete adaptation with the same status as was just set to connection data + connect_status_m = server_m->get_connection_data()->connect_status(); + // connect operation returns OK if possible + return core_error_ok; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_create_ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_create_ts.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,465 @@ +/* +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for creating a traffic stream. +* +*/ + +/* +* %version: 6 % +*/ + +#include "core_operation_create_ts.h" +#include "core_operation_delete_ts.h" +#include "core_traffic_stream.h" +#include "core_sub_operation_create_ts.h" +#include "core_frame_wmm_ie.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_traffic_stream_list_iter.h" +#include "core_virtual_traffic_stream_list_iter.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_create_ts_c::core_operation_create_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e& stream_status ) : + core_operation_base_c( core_operation_create_ts, request_id, server, drivers, adaptation, + core_base_flag_none ), + requested_tid_m( tid ), + tid_m( tid ), + user_priority_m( user_priority ), + access_class_m( core_access_class_best_effort ), + is_automatic_stream_m( is_automatic_stream ), + requested_params_m( params ), + params_m( params ), + stream_id_m( stream_id ), + stream_status_m( stream_status ), + stream_m( NULL ) + { + DEBUG( "core_operation_create_ts_c::core_operation_create_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_create_ts_c::~core_operation_create_ts_c() + { + DEBUG( "core_operation_create_ts_c::~core_operation_create_ts_c()" ); + + delete stream_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_create_ts_c::next_state() + { + DEBUG( "core_operation_create_ts_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + if( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_create_ts_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + if( !is_valid_params() ) + { + DEBUG( "core_operation_create_ts_c::next_state() - invalid traffic stream parameters" ); + + return core_error_illegal_argument; + } + access_class_m = core_tools_c::convert_user_priority_to_ac( user_priority_m ); + + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_traffic_stream_list_iter_c ts_iter( ts_list ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + DEBUG( "core_operation_create_ts_c::next_state() - current traffic streams:" ); + virtual_ts_list.print_contents(); + ts_list.print_contents(); + + if( tid_m != TRAFFIC_STREAM_TID_NONE ) + { + /** + * If TID has been specified for the virtual traffic stream, check + * whether it clashes with an existing traffic stream. + */ + if( ts_list.is_traffic_stream_for_tid( tid_m ) ) + { + DEBUG1( "core_operation_create_ts_c::next_state() - stream already exists for TID %u", + tid_m ); + + return core_error_already_exists; + } + } + else + { + /** + * If TID has been left unspecified, select the next free + * TID. + * + * First try to select the next free TID from virtual traffic + * stream list. In the unlikely scenario where all TIDs are + * in use, try the traffic stream list next. + */ + tid_m = virtual_ts_list.next_tid(); + if( tid_m == MAX_TRAFFIC_STREAM_TID ) + { + tid_m = ts_list.next_tid(); + if( tid_m == MAX_TRAFFIC_STREAM_TID ) + { + DEBUG( "core_operation_create_ts_c::next_state() - no free TIDs" ); + + return core_error_general; + } + } + } + +#ifdef _DEBUG + DEBUG2( "core_operation_create_ts_c::next_state() - Traffic Stream TID is %u, UP is %u", + tid_m, user_priority_m ); + + DEBUG( "core_operation_create_ts_c::next_state() - trying to create a traffic stream with values:" ); + if( params_m.is_periodic_traffic ) + { + DEBUG( "core_operation_create_ts_c::next_state() - Traffic pattern: periodic" ); + } + else + { + DEBUG( "core_operation_create_ts_c::next_state() - Traffic pattern: aperiodic" ); + } + if( params_m.direction == core_traffic_stream_direction_uplink ) + { + DEBUG( "core_operation_create_ts_c::next_state() - Direction: uplink" ); + } + else if( params_m.direction == core_traffic_stream_direction_downlink ) + { + DEBUG( "core_operation_create_ts_c::next_state() - Direction: downlink" ); + } + else + { + DEBUG( "core_operation_create_ts_c::next_state() - Direction: bi-directional" ); + } + DEBUG2( "core_operation_create_ts_c::next_state() - Nominal MSDU Size: %u (0x%04X)", + params_m.nominal_msdu_size, params_m.nominal_msdu_size ); + DEBUG2( "core_operation_create_ts_c::next_state() - Maximum MSDU Size: %u (0x%04X)", + params_m.maximum_msdu_size, params_m.maximum_msdu_size ); + DEBUG2( "core_operation_create_ts_c::next_state() - Minimum Service Interval: %u (0x%08X)", + params_m.minimum_service_interval, params_m.minimum_service_interval ); + DEBUG2( "core_operation_create_ts_c::next_state() - Maximum Service Interval: %u (0x%08X)", + params_m.maximum_service_interval, params_m.maximum_service_interval ); + DEBUG2( "core_operation_create_ts_c::next_state() - Inactivity Interval: %u (0x%08X)", + params_m.inactivity_interval, params_m.inactivity_interval ); + DEBUG2( "core_operation_create_ts_c::next_state() - Suspension Interval: %u (0x%08X)", + params_m.suspension_interval, params_m.suspension_interval ); + DEBUG2( "core_operation_create_ts_c::next_state() - Service Start Time: %u (0x%08X)", + params_m.service_start_time, params_m.service_start_time ); + DEBUG2( "core_operation_create_ts_c::next_state() - Minimum Data Rate: %u (0x%08X)", + params_m.minimum_data_rate, params_m.minimum_data_rate ); + DEBUG2( "core_operation_create_ts_c::next_state() - Mean Data Rate: %u (0x%08X)", + params_m.mean_data_rate, params_m.mean_data_rate ); + DEBUG2( "core_operation_create_ts_c::next_state() - Peak Data Rate: %u (0x%08X)", + params_m.peak_data_rate, params_m.peak_data_rate ); + DEBUG2( "core_operation_create_ts_c::next_state() - Maximum Burst Size: %u (0x%08X)", + params_m.maximum_burst_size, params_m.maximum_burst_size ); + DEBUG2( "core_operation_create_ts_c::next_state() - Delay Bound: %u (0x%08X)", + params_m.delay_bound, params_m.delay_bound ); + DEBUG2( "core_operation_create_ts_c::next_state() - Minimum PHY Rate: %u (0x%08X)", + params_m.minimum_phy_rate, params_m.minimum_phy_rate ); + DEBUG2( "core_operation_create_ts_c::next_state() - Nominal PHY Rate: %u (0x%04X)", + params_m.nominal_phy_rate, params_m.nominal_phy_rate ); + DEBUG2( "core_operation_create_ts_c::next_state() - Surplus Bandwidth Allowance: %u (0x%04X)", + params_m.surplus_bandwidth_allowance, params_m.surplus_bandwidth_allowance ); +#endif // _DEBUG + + stream_m = new core_traffic_stream_c( + tid_m, + user_priority_m ); + if( !stream_m ) + { + DEBUG( "core_operation_create_ts_c::next_state() - unable to allocate a traffic stream instance" ); + + return core_error_no_memory; + } + + /** + * If the Max Tx MSDU Lifetime is not overridden, use the default value. + */ + if( !params_m.override_max_tx_msdu_lifetime ) + { + params_m.override_max_tx_msdu_lifetime = server_m->get_device_settings().max_tx_msdu_life_time; + } + + stream_m->set_default_traffic_values( params_m ); + stream_m->reset_to_default_values(); + + /** + * If this is a manual traffic stream, all automatic streams + * need to be deleted before continuing. + */ + if( !is_automatic_stream_m ) + { + server_m->get_connection_data()->set_ac_traffic_mode( + access_class_m, + core_access_class_traffic_mode_manual ); + + /** + * Send an indication to notify clients that traffic mode + * is now set to manual. + */ + u8_t buf[5]; + buf[0] = static_cast( + access_class_m ); + buf[1] = static_cast( + core_access_class_traffic_mode_manual ); + adaptation_m->notify( + core_notification_ac_traffic_mode_changed, + sizeof( buf ), + buf ); + + return goto_state( core_state_delete_streams ); + } + + /** + * Otherwise proceed with stream creation. + */ + return goto_state( core_state_create_stream ); + } + case core_state_delete_streams: + { + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + for( core_virtual_traffic_stream_c* iter = virtual_ts_iter.first(); iter; iter = virtual_ts_iter.next() ) + { + if( iter->access_class() == access_class_m && + iter->is_automatic_stream() ) + { + core_operation_base_c* operation = new core_operation_delete_ts_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + iter->id() ); + + return run_sub_operation( operation, core_state_delete_streams ); + } + } + + return asynch_goto( core_state_create_stream ); + } + case core_state_create_stream: + { + core_ap_data_c* current_ap = server_m->get_connection_data()->current_ap_data(); + if( !current_ap->is_wmm_ie_present() || + !current_ap->is_admission_control_required( access_class_m ) ) + { + DEBUG1( "core_operation_create_ts_c::next_state() - AP doesn't require admission control on AC %u", + access_class_m ); + + /** + * An actual traffic stream is not needed but the virtual traffic + * stream is still created. + */ + server_m->get_connection_data()->virtual_traffic_stream_list().add_traffic_stream( + requested_tid_m, + TRAFFIC_STREAM_TID_NONE, + user_priority_m, + is_automatic_stream_m, + requested_params_m, + stream_id_m, + core_traffic_stream_status_inactive_not_required ); + + return core_error_ok; + } + + /** + * Try to create the actual traffic stream. + */ + core_operation_base_c* operation = new core_sub_operation_create_ts_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + *server_m->get_connection_data()->current_ap_data(), + tid_m, + user_priority_m, + params_m, + stream_status_m ); + + return run_sub_operation( operation, core_state_create_stream_success ); + } + case core_state_create_stream_failed: + { + DEBUG( "core_operation_create_ts_c::next_state() - traffic stream creation failed" ); + + /** + * Eventhough the actual traffic stream couldn't be created, the virtual traffic + * stream is still created. + */ + server_m->get_connection_data()->virtual_traffic_stream_list().add_traffic_stream( + requested_tid_m, + TRAFFIC_STREAM_TID_NONE, + user_priority_m, + is_automatic_stream_m, + requested_params_m, + stream_id_m, + stream_status_m ); + + return core_error_ok; + } + case core_state_create_stream_success: + { + operation_state_m = core_state_parameters_set; + + DEBUG( "core_operation_create_ts_c::next_state() - traffic stream created successfully" ); + + server_m->get_connection_data()->virtual_traffic_stream_list().add_traffic_stream( + requested_tid_m, + tid_m, + user_priority_m, + is_automatic_stream_m, + requested_params_m, + stream_id_m, + core_traffic_stream_status_active ); + + /** + * Store the new traffic stream parameters. + */ + stream_m->set_status( core_traffic_stream_status_active ); + stream_m->set_traffic_values( params_m ); + server_m->get_connection_data()->traffic_stream_list().update_traffic_stream( + *stream_m ); + + if( params_m.direction == core_traffic_stream_direction_uplink || + params_m.direction == core_traffic_stream_direction_bidirectional ) + { + server_m->get_connection_data()->set_ac_traffic_status( + access_class_m, + core_access_class_traffic_status_admitted ); + + /** + * Send an indication to notify clients that this access class + * is now admitted. + */ + u8_t buf[5]; + buf[0] = static_cast( + access_class_m ); + buf[1] = static_cast( + core_access_class_traffic_status_admitted ); + adaptation_m->notify( + core_notification_ac_traffic_status_changed, + sizeof( buf ), + buf ); + + /** + * Set the parameters to the drivers based on the created + * traffic stream. + */ + DEBUG( "core_operation_create_ts_c::next_state() - setting tx queue parameters" ); + + drivers_m->set_tx_queue_parameters( + request_id_m, + stream_m->access_class(), + stream_m->medium_time(), + stream_m->max_tx_msdu_lifetime() ); + } + else + { + /** + * Since TX queue parameters apply only to uplink, there is nothing + * more to do on downlink streams. + */ + return core_error_ok; + } + + break; + } + case core_state_parameters_set: + { + DEBUG( "core_operation_create_ts_c::next_state() - tx queue parameters set" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_create_ts_c::cancel() + { + DEBUG( "core_operation_create_ts_c::cancel() " ); + + switch( operation_state_m ) + { + case core_state_create_stream_success: + { + return goto_state( core_state_create_stream_failed ); + } + default: + { + return failure_reason_m; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_create_ts_c::is_valid_params() + { + if( tid_m >= MAX_TRAFFIC_STREAM_TID && tid_m != TRAFFIC_STREAM_TID_NONE ) + { + DEBUG1( "core_operation_create_ts_c::is_valid_params() - invalid TID value: %u", + tid_m ); + + return false_t; + } + if( user_priority_m >= MAX_QOS_USER_PRIORITY ) + { + DEBUG1( "core_operation_create_ts_c::is_valid_params() - invalid user priority value: %u", + user_priority_m ); + + return false_t; + } + + return true_t; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_delete_ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_delete_ts.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for deleting a traffic stream. +* +*/ + +/* +* %version: 8 % +*/ + +#include "core_operation_delete_ts.h" +#include "core_traffic_stream.h" +#include "core_frame_wmm_ie_tspec.h" +#include "core_frame_action_wmm.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_traffic_stream_list_iter.h" +#include "core_virtual_traffic_stream_list_iter.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_delete_ts_c::core_operation_delete_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u32_t stream_id ) : + core_operation_base_c( core_operation_delete_ts, request_id, server, drivers, adaptation, + core_base_flag_none ), + id_m( stream_id ) + { + DEBUG( "core_operation_delete_ts_c::core_operation_delete_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_delete_ts_c::~core_operation_delete_ts_c() + { + DEBUG( "core_operation_delete_ts_c::~core_operation_delete_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_delete_ts_c::next_state() + { + DEBUG( "core_operation_delete_ts_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_base_state_parameters_set; + + if( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_delete_ts_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_traffic_stream_list_iter_c ts_iter( ts_list ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + DEBUG( "core_operation_delete_ts_c::next_state() - current traffic streams:" ); + virtual_ts_list.print_contents(); + ts_list.print_contents(); + + /** + * Find the virtual traffic stream to be deleted. + */ + core_virtual_traffic_stream_c* virtual_stream = NULL; + core_virtual_traffic_stream_c* virtual_iter = virtual_ts_iter.first(); + while( virtual_iter ) + { + if( virtual_iter->id() == id_m ) + { + virtual_stream = virtual_iter; + virtual_iter = NULL; + } + else + { + virtual_iter = virtual_ts_iter.next(); + } + } + + if( !virtual_stream ) + { + DEBUG1( "core_operation_delete_ts_c::next_state() - no virtual traffic stream with ID %u found", + id_m ); + + return core_error_not_found; + } + + u8_t tid = virtual_stream->tid(); + + DEBUG3( "core_operation_delete_ts_c::next_state() - virtual traffic stream with ID %u found, TID: %u, UP: %u", + id_m, tid, virtual_stream->user_priority() ); + + /** + * Delete the virtual traffic stream. + */ + virtual_ts_iter.remove(); + + /** + * Locate the actual traffic stream based on the TID. + */ + core_traffic_stream_c* stream = NULL; + core_traffic_stream_c* iter = ts_iter.first(); + while( iter ) + { + if( iter->tid() == tid ) + { + stream = iter; + + iter = NULL; + } + else + { + iter = ts_iter.next(); + } + } + + if( !stream ) + { + DEBUG1( "core_operation_delete_ts_c::next_state() - no traffic stream with TID %u found", + id_m ); + + /** + * This is not an error since the virtual traffic streams can + * exist eventhough the AP doesn't require admission control. + */ + + return core_error_ok; + } + + stream->dec_reference_count(); + if( stream->reference_count() ) + { + DEBUG1( "core_operation_delete_ts_c::next_state() - traffic stream reference count is %u, not deleting", + stream->reference_count() ); + + /** + * If there are still other virtual traffic streams referencing + * this traffic stream, do not delete it. + */ + + return core_error_ok; + } + + u8_t user_priority = stream->user_priority(); + core_traffic_stream_direction_e direction = stream->direction(); + bool_t is_uapsd( true_t ); + if( !server_m->get_connection_data()->current_ap_data()->is_uapsd_supported() || + !server_m->get_core_settings().is_uapsd_enable_for_access_class( + core_tools_c::convert_user_priority_to_ac( user_priority ) ) ) + { + is_uapsd = false_t; + } + DEBUG1( "core_operation_delete_ts_c::next_state() - U-APSD %u", + is_uapsd ); + + core_frame_wmm_ie_tspec_c* tspec_ie = core_frame_wmm_ie_tspec_c::instance( + stream->tid(), + user_priority, + is_uapsd, + stream->is_periodic_traffic(), + stream->direction(), + stream->nominal_msdu_size(), + stream->maximum_msdu_size(), + stream->minimum_service_interval(), + stream->maximum_service_interval(), + stream->inactivity_interval(), + stream->suspension_interval(), + stream->service_start_time(), + stream->minimum_data_rate(), + stream->mean_data_rate(), + stream->peak_data_rate(), + stream->maximum_burst_size(), + stream->delay_bound(), + stream->minimum_phy_rate(), + stream->surplus_bandwidth_allowance(), + stream->medium_time() ); + if( !tspec_ie ) + { + DEBUG( "core_operation_delete_ts_c::next_state() - unable to allocate a WMM TSPEC IE" ); + return core_error_no_memory; + } + + DEBUG( "core_operation_delete_ts_c::next_state() - TSPEC IE:" ); + DEBUG_BUFFER( tspec_ie->data_length(), tspec_ie->data() ); + + const core_mac_address_s dest( + server_m->get_connection_data()->current_ap_data()->bssid() ); + const core_mac_address_s src( + server_m->own_mac_addr() ); + + core_frame_action_wmm_c* frame = core_frame_action_wmm_c::instance( + 0, // Duration + dest, // Destination + src, // Source + dest, // BSSID + 0, // Sequence Control + core_frame_action_wmm_c::core_dot11_action_wmm_type_delts, // Action Type + 0, // Dialog Token + core_frame_action_wmm_c::core_dot11_action_wmm_status_admission_accepted, // Status Code + tspec_ie ); + + delete tspec_ie; + tspec_ie = NULL; + + if( !frame ) + { + DEBUG( "core_operation_delete_ts_c::next_state() - unable to allocate an action frame" ); + return core_error_no_memory; + } + + DEBUG( "core_operation_delete_ts_c::next_state() - DELTS REQ:" ); + DEBUG_BUFFER( frame->data_length(), frame->data() ); + + server_m->send_management_frame( + core_frame_type_dot11, + frame->data_length(), + frame->data(), + dest ); + + delete frame; + frame = NULL; + + DEBUG( "core_operation_delete_ts_c::next_state() - DELTS request sent" ); + + server_m->get_wpx_adaptation_instance().handle_ts_delete( + tid, user_priority ); + + /** + * If there no more manual virtual traffic streams in this AC, + * switch the traffic mode back to automatic. + */ + if( virtual_ts_list.traffic_mode_by_ac( stream->access_class() ) == core_access_class_traffic_mode_automatic ) + { + server_m->get_connection_data()->set_ac_traffic_mode( + stream->access_class(), + core_access_class_traffic_mode_automatic ); + + DEBUG( "core_operation_delete_ts_c::next_state() - traffic mode set to automatic for this AC, notifying clients" ); + + u8_t buf[5]; + buf[0] = static_cast( + stream->access_class() ); + buf[1] = static_cast( + core_access_class_traffic_mode_automatic ); + adaptation_m->notify( + core_notification_ac_traffic_mode_changed, + sizeof( buf ), + buf ); + } + + /** + * Delete the actual traffic stream. + */ + ts_iter.remove(); + + if( direction == core_traffic_stream_direction_uplink || + direction == core_traffic_stream_direction_bidirectional ) + { + server_m->get_connection_data()->set_ac_traffic_status( + core_tools_c::convert_user_priority_to_ac( user_priority ), + core_access_class_traffic_status_not_admitted ); + + /** + * Send an indication to notify clients that this access class + * is no longer admitted. + * + * We don't have to the check the ACM bits since the traffic + * stream wouldn't exist if the AP didn't require admission + * control. + */ + DEBUG( "core_operation_delete_ts_c::next_state() - traffic no longer admitted on this AC, notifying clients" ); + + u8_t buf[5]; + buf[0] = static_cast( + core_tools_c::convert_user_priority_to_ac( user_priority ) ); + buf[1] = static_cast( + core_access_class_traffic_status_not_admitted ); + adaptation_m->notify( + core_notification_ac_traffic_status_changed, + sizeof( buf ), + buf ); + + /** + * Reset TX queue parameters back to default values. + */ + DEBUG( "core_operation_delete_ts_c::next_state() - resetting tx queue parameters" ); + + drivers_m->set_tx_queue_parameters( + request_id_m, + core_tools_c::convert_user_priority_to_ac( user_priority ), + 0, + server_m->get_device_settings().max_tx_msdu_life_time ); + } + else + { + /** + * Since TX queue parameters apply only to uplink, there is nothing + * more to do on downlink streams. + */ + return core_error_ok; + } + + break; + } + case core_base_state_parameters_set: + { + DEBUG( "core_operation_delete_ts_c::next_state() - tx queue parameters reset" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_directed_roam.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_directed_roam.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for a directed roam request. +* +*/ + +/* +* %version: 3 % +*/ + +#include "core_operation_directed_roam.h" +#include "core_operation_roam.h" +#include "core_operation_handle_bss_lost.h" +#include "core_sub_operation_roam_scan.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_directed_roam_c::core_operation_directed_roam_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_mac_address_s& bssid ) : + core_operation_base_c( core_operation_directed_roam, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_connection_needed | core_base_flag_roam_operation ), + bssid_m( bssid ), + current_rcpi_m( 0 ), + is_connected_m( true_t ) + { + DEBUG( "core_operation_directed_roam_c::core_operation_directed_roam_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_directed_roam_c::~core_operation_directed_roam_c() + { + DEBUG( "core_operation_directed_roam_c::~core_operation_directed_roam_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_directed_roam_c::next_state() + { + DEBUG( "core_operation_directed_roam_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + if( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_directed_roam_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + + operation_state_m = core_state_scan_start; + + core_mac_address_s current_bssid = + server_m->get_connection_data()->current_ap_data()->bssid(); + + DEBUG6( "core_operation_directed_roam_c::next_state() - current BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + current_bssid.addr[0], current_bssid.addr[1], current_bssid.addr[2], + current_bssid.addr[3], current_bssid.addr[4], current_bssid.addr[5] ); + DEBUG6( "core_operation_directed_roam_c::next_state() - requested BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid_m.addr[0], bssid_m.addr[1], bssid_m.addr[2], + bssid_m.addr[3], bssid_m.addr[4], bssid_m.addr[5] ); + + DEBUG( "core_operation_directed_roam_c::next_state() - requesting RCPI" ); + + drivers_m->get_current_rcpi( + request_id_m, + current_rcpi_m ); + + break; + } + case core_state_scan_start: + { + DEBUG1( "core_operation_directed_roam_c::next_state() - current RCPI is %u", + current_rcpi_m ); + + DEBUG( "core_operation_directed_roam_c::next_state() - starting a direct scan on all channels" ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_roam_scan ); + + core_operation_base_c* operation = new core_sub_operation_roam_scan_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + server_m->get_connection_data()->ssid(), + server_m->get_core_settings().all_valid_scan_channels(), + true_t, + false_t ); + + return run_sub_operation( operation, core_state_scan_complete ); + } + case core_state_scan_complete: + { + DEBUG( "core_operation_directed_roam_c::next_state() - attempting to roam" ); + + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_directed_roam ); + server_m->get_connection_data()->set_last_roam_failed_reason( + core_roam_failed_reason_none ); + + core_operation_base_c* operation = NULL; + if( bssid_m == BROADCAST_MAC_ADDR ) + { + /** + * Directed roam request with no BSSID specified. + * + * Any suitable AP that is better than the current AP will do. + */ + medium_time_s admitted_medium_time( + server_m->get_connection_data()->traffic_stream_list().admitted_medium_time() ); + + operation = new core_operation_roam_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + core_scan_list_tag_roam_scan, + current_rcpi_m + server_m->get_device_settings().rcpi_difference, + admitted_medium_time, + server_m->get_connection_data()->ssid(), + BROADCAST_MAC_ADDR ); + } + else + { + /** + * Directed roam request to a certain BSSID. + */ + operation = new core_operation_roam_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + core_scan_list_tag_roam_scan, + server_m->get_device_settings().rcpi_trigger, + MEDIUM_TIME_NOT_DEFINED, + server_m->get_connection_data()->ssid(), + bssid_m ); + } + + return run_sub_operation( operation, core_state_connect_success ); + } + case core_state_connect_success: + { + operation_state_m = core_state_rcpi_trigger; + + DEBUG( "core_operation_directed_roam_c::next_state() - roamed successfully" ); + + server_m->cancel_roam_timer(); + + DEBUG( "core_operation_directed_roam_c::next_state() - reseting RCPI roam check interval" ); + server_m->get_connection_data()->reset_rcpi_roam_interval(); + + DEBUG1( "core_operation_directed_roam_c::next_state() - internal RCPI threshold level is %u", + server_m->get_device_settings().rcpi_trigger ); + DEBUG1( "core_operation_directed_roam_c::next_state() - external RCPI threshold level is %u", + server_m->get_core_settings().rcp_decline_boundary() ); + + u8_t trigger_level = server_m->get_core_settings().rcp_decline_boundary(); + if ( trigger_level < server_m->get_device_settings().rcpi_trigger ) + { + trigger_level = server_m->get_device_settings().rcpi_trigger; + } + DEBUG1( "core_operation_directed_roam_c::next_state() - arming RCPI roam trigger (%u)", + trigger_level ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + trigger_level ); + + break; + } + case core_state_connect_failure: + { + DEBUG( "core_operation_directed_roam_c::next_state() - roaming failed" ); + + if( !is_connected_m ) + { + DEBUG( "core_operation_directed_roam_c::next_state() - no longer connected, scheduling bss_lost operation" ); + + core_operation_base_c* operation = new core_operation_handle_bss_lost_c( + REQUEST_ID_CORE_INTERNAL, + server_m, + drivers_m, + adaptation_m, + core_operation_handle_bss_lost_c::core_bss_lost_reason_failed_directed_roam ); + + server_m->queue_int_operation( operation ); + } + + return core_error_general; + } + case core_state_rcpi_trigger: + { + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_directed_roam_c::cancel() + { + DEBUG( "core_operation_directed_roam_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_connect_success: + { + return goto_state( core_state_connect_failure ); + } + default: + { + return failure_reason_m; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_available_iaps.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1321 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for IAP availability. +* +*/ + +/* +* %version: 40.1.2 % +*/ + +#include "core_operation_get_available_iaps.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "core_frame_dot11.h" +#include "core_frame_dot11_ie.h" +#include "am_debug.h" + +/** Defining this enables IAP related traces. */ +//#define WLAN_CORE_DEEP_DEBUG 1 + +/** The channel time used in the long passive scan. */ +const u32_t LONG_PASSIVE_SCAN_CHANNEL_TIME = 210; + +/** + * If the phone has at least this many IAPs marked as hidden, + * limiting algorithm will be used for detecting available IAPs. + */ +const u8_t MIN_HIDDEN_IAPS_FOR_LIMITING_ALGORITHM = 15; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_get_available_iaps_c::core_operation_get_available_iaps_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t is_active_scan_allowed, + core_type_list_c& iap_data_list, + core_type_list_c& iap_id_list, + core_type_list_c* iap_ssid_list, + ScanList& scan_data ) : + core_operation_base_c( core_operation_get_available_iaps, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + is_active_scan_allowed_m( is_active_scan_allowed ), + is_limiting_algorithm_used_m( false_t ), + iap_data_list_m( iap_data_list ), + iap_id_list_m( iap_id_list ), + iap_ssid_list_m( iap_ssid_list ), + client_scan_data_m( scan_data ), + active_channels_m( ), + broadcast_channels_m( ), + long_broadcast_count_m( 0 ), + non_found_iaps_list_m( ), + is_split_scan_m( false_t ), + bss_count_m( 0 ), + direct_scanned_ssid_m( ), + region_from_ap_m( core_wlan_region_fcc ) + { + DEBUG( "core_operation_get_available_iaps_c::core_operation_get_available_iaps_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_get_available_iaps_c::~core_operation_get_available_iaps_c() + { + DEBUG( "core_operation_get_available_iaps_c::~core_operation_get_available_iaps_c()" ); + + server_m->unregister_event_handler( this ); + server_m->unregister_frame_handler( this ); + non_found_iaps_list_m.clear(); + iap_ssid_list_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_get_available_iaps_c::next_state() + { + DEBUG( "core_operation_get_available_iaps_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_long_broadcast_scan_start; + +#ifdef WLAN_CORE_DEEP_DEBUG + DEBUG( "core_operation_get_available_iaps_c::next_state() - IAP data list:" ); + + core_iap_data_s* iter_data = iap_data_list_m.first(); + while( iter_data ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - ID: %u", + iter_data->id ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ", + iter_data->ssid.length, iter_data->ssid.ssid ); + + iter_data = iap_data_list_m.next(); + } + + if ( iap_ssid_list_m ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state()" ); + DEBUG( "core_operation_get_available_iaps_c::next_state() - Secondary SSID list:" ); + + core_ssid_entry_s* iter_entry = iap_ssid_list_m->first(); + while( iter_entry ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - ID: %u", + iter_entry->id ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ", + iter_entry->ssid.length, iter_entry->ssid.ssid ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - Used SSID: ", + iter_entry->used_ssid.length, iter_entry->used_ssid.ssid ); + + iter_entry = iap_ssid_list_m->next(); + } + DEBUG( "core_operation_get_available_iaps_c::next_state()" ); + } +#endif // WLAN_CORE_DEEP_DEBUG + + server_m->get_scan_list().remove_entries_by_age( + server_m->get_device_settings().scan_list_expiration_time ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_scan ); + + if ( server_m->get_core_settings().is_connected() ) + { + is_split_scan_m = true_t; + DEBUG( "core_operation_get_available_iaps_c::next_state() - using a split-scan" ); + } + else + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - using a regular scan" ); + } + + /** + * Limiting algorithm is only used when there's a certain amount of IAPs + * marked as hidden. + */ + if ( hidden_iap_count( iap_data_list_m ) >= MIN_HIDDEN_IAPS_FOR_LIMITING_ALGORITHM ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - %u hidden IAPs defined, using limiting algorithm", + hidden_iap_count( iap_data_list_m ) ); + + is_limiting_algorithm_used_m = true_t; + } + + /** + * Construct a channel mask of channels that have previously contained + * APs with long beacon intervals. + */ + core_long_beacon_interval_channels_s& long_beacon_interval_channels( + server_m->get_core_settings().long_beacon_interval_channels() ); + + for ( u8_t idx( 0 ); idx < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO; ++idx ) + { + if ( long_beacon_interval_channels.channel_scan_count[idx] ) + { + long_beacon_interval_channels.channel_scan_count[idx]--; + const u8_t channel( idx + 1); + + if ( server_m->get_core_settings().mcc_known() ) + { + if ( server_m->get_core_settings().is_valid_channel( + SCAN_BAND_2DOT4GHZ, + channel ) ) + { + long_broadcast_count_m++; + + broadcast_channels_m.add( + SCAN_BAND_2DOT4GHZ, + channel ); + } + } + else + { + long_broadcast_count_m++; + broadcast_channels_m.add( + SCAN_BAND_2DOT4GHZ, + channel ); + } + } + } + + /** + * If we can active scan or the channel mask is empty, we can jump + * directly to the main broadcast scan. + */ + if ( is_active_scan_allowed_m || + !long_broadcast_count_m ) + { + long_broadcast_count_m = 0; + + return goto_state( core_state_long_broadcast_scan_done ); + } + + const core_scan_channels_s channels( + broadcast_channels_m.channels() ); + + DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting long passive broadcast scan on channels 0x%02X%02X", + channels.channels2dot4ghz[1], + channels.channels2dot4ghz[0] ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_passive, + BROADCAST_SSID, + server_m->get_device_settings().scan_rate, + channels, + LONG_PASSIVE_SCAN_CHANNEL_TIME, + LONG_PASSIVE_SCAN_CHANNEL_TIME, + is_split_scan_m ); + + break; + } + case core_state_long_broadcast_scan_start: + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - long broadcast scan request completed, waiting for scan completion" ); + + break; + } + case core_state_long_broadcast_scan_done: + { + operation_state_m = core_state_broadcast_scan_start; + + if ( !long_broadcast_count_m ) + { + broadcast_channels_m.set( + server_m->get_core_settings().all_valid_scan_channels() ); + } + else + { + broadcast_channels_m.invert_channels(); + } + + const core_scan_channels_s channels( + server_m->get_core_settings().valid_scan_channels( broadcast_channels_m.channels() ) ); + + + if ( !is_active_scan_allowed_m || + is_limiting_algorithm_used_m ) + { + DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting passive broadcast scan on channels 0x%02X%02X", + channels.channels2dot4ghz[1], + channels.channels2dot4ghz[0] ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_passive, + BROADCAST_SSID, + server_m->get_device_settings().scan_rate, + channels, + server_m->get_device_settings().passive_scan_min_ch_time, + server_m->get_device_settings().passive_scan_max_ch_time, + is_split_scan_m ); + } + else + { + DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting active broadcast scan on channels 0x%02X%02X", + channels.channels2dot4ghz[1], + channels.channels2dot4ghz[0] ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_active, + BROADCAST_SSID, + server_m->get_device_settings().scan_rate, + channels, + server_m->get_device_settings().active_scan_min_ch_time, + server_m->get_device_settings().active_scan_max_ch_time, + is_split_scan_m ); + } + + break; + } + case core_state_broadcast_scan_start: + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - broadcast scan request completed, waiting for scan completion" ); + + break; + } + case core_state_broadcast_scan_done: + { + if ( server_m->get_core_settings().mcc_known() ) + { + /* When WLAN region is known, the allowed scan channels are known and + * handled already */ + return goto_state( core_state_broadcast_scan_done_handle_result ); + } + + operation_state_m = core_state_broadcast_scan_start_unknown_region; + + broadcast_channels_m.set( + server_m->get_core_settings().all_valid_scan_channels() ); + + const core_scan_channels_s channels( + server_m->get_core_settings().invalid_scan_channels( broadcast_channels_m.channels() ) ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_passive, + BROADCAST_SSID, + server_m->get_device_settings().scan_rate, + channels, + server_m->get_device_settings().passive_scan_min_ch_time, + server_m->get_device_settings().passive_scan_max_ch_time, + is_split_scan_m ); + + break; + } + case core_state_broadcast_scan_start_unknown_region: + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - broadcast scan request for channels 12 and 13 completed, waiting for scan completion" ); + + break; + } + case core_state_broadcast_scan_complete_unknown_region: + { + operation_state_m = core_state_store_country_info; + + /* If WLAN region was not known before the scan, then check if country information is present + * in the scan results. APs on channels 12 and 13 must be ignored if country information indicates this. + */ + core_scan_list_iterator_by_tag_c iter_country_beacon( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + + core_wlan_region_e found_region = core_wlan_region_undefined; + bool_t inconsistent_info( false_t ); + for ( core_ap_data_c* ap_data = iter_country_beacon.first(); ap_data; ap_data = iter_country_beacon.next() ) + { + core_country_string_s country_info = ap_data->country_info(); + core_wlan_region_e ap_region = core_wlan_region_undefined; + if ( country_info.country[0] != 0 ) + { + ap_region = core_tools_c::convert_country_to_region( country_info ); + if ( found_region != core_wlan_region_undefined ) + { + if ( ap_region != found_region ) + { + inconsistent_info = true_t; + } + } + else + { + found_region = ap_region; + } + } + } + if ( found_region != core_wlan_region_undefined ) + { + if ( !inconsistent_info ) + { + region_from_ap_m = found_region; + } + else + { + region_from_ap_m = core_wlan_region_etsi; + } + adaptation_m->store_ap_country_info( request_id_m, region_from_ap_m, inconsistent_info ); + } + else + { + return goto_state( core_state_broadcast_scan_done_handle_result ); + } + break; + } + case core_state_store_country_info: + { + operation_state_m = core_state_broadcast_scan_done_handle_result; + + /* Set the new region information also to core settings */ + DEBUG1( "core_operation_get_available_iaps_c::next_state() - current region %u", + region_from_ap_m ); + server_m->get_core_settings().set_regional_domain( + region_from_ap_m ); + server_m->get_core_settings().set_mcc_known( true_t ); + + return goto_state( core_state_broadcast_scan_done_handle_result ); + } + + case core_state_broadcast_scan_done_handle_result: + { + operation_state_m = core_state_direct_scan_start; + /* If region information is not known, channels 12 and 13 are now been scanned in passive mode in any case */ + + /* If region is FCC, then ignore and remove the APs from channels 12 and 13 */ + if ( server_m->get_core_settings().regional_domain() == core_wlan_region_fcc ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - remove APs that were found on channels 12 and 13" ); + remove_disallowed_aps(); + } + + /* If WLAN regional domain is not ETSI, we have to remove the high channels from + * from the active channels mask to prevent direct scans on those channels. + */ + if ( server_m->get_core_settings().regional_domain() != core_wlan_region_etsi ) + { + for ( u8_t idx( SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_FCC ); idx < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO; ++idx ) + { + const u8_t channel( idx + 1); + if ( !server_m->get_core_settings().is_valid_channel( + SCAN_BAND_2DOT4GHZ, + channel ) ) + { + active_channels_m.remove( + SCAN_BAND_2DOT4GHZ, + channel ); + } + } + } + + DEBUG1( "core_operation_get_available_iaps_c::next_state() - broadcast scan done, %u beacon(s)/probe(s) received", + bss_count_m ); + + /** + * Add the results from the broadcast scan to the scan list so that + * they can be cached in adaptation. + */ + core_scan_list_iterator_by_tag_c iter( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + const core_mac_address_s bssid = ap_data->bssid(); + + if ( !server_m->get_core_settings().is_mac_in_permanent_blacklist( bssid ) ) + { + core_tools_c::add_beacon_to_scan_list( + client_scan_data_m, + *ap_data, + ap_data->rcpi() ); + } + } + + /** + * Go through the broadcast scan results and remove matching IAPs. + */ + process_scan_results( + core_scan_list_tag_scan ); + + /** + * Direct scans are only needed if active scanning is allowed. If limiting algorithm + * is used, channel activity based on broadcast scan is also required. + */ + if ( ( is_active_scan_allowed_m && + !is_limiting_algorithm_used_m ) || + ( is_active_scan_allowed_m && + is_limiting_algorithm_used_m && + bss_count_m ) ) + { + remove_non_hidden_iaps(); + + /** + * If limiting algorithm is used, only the current active_channels_m + * will be used. + */ + if ( is_limiting_algorithm_used_m ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - limiting channels based on WLAN activity" ); + } + else + { + active_channels_m.set( + server_m->get_core_settings().all_valid_scan_channels() ); + } + + /** + * iap_data_list_m now contains only hidden ssid IAPs, + * that will be direct scanned next. + */ + core_iap_data_s* iap = iap_data_list_m.first(); + if( !iap ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - nothing to direct scan" ); + + /** No hidden IAP entries in the request, move on.. */ + return goto_state( core_state_secondary_ssid_check ); + } + + DEBUG1( "core_operation_get_available_iaps_c::next_state() - going to direct scan %u IAP(s)", + iap_data_list_m.count() ); + + direct_scanned_ssid_m = iap->ssid; + DEBUG1( "core_operation_get_available_iaps_c::next_state() - direct scanning IAP ID %u", + iap->id ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ", + direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_direct_scan ); + + const core_scan_channels_s& channels( + active_channels_m.channels() ); + DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting scan on channels 0x%02X%02X", + channels.channels2dot4ghz[1], + channels.channels2dot4ghz[0] ); + + bss_count_m = 0; + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_active, + direct_scanned_ssid_m, + server_m->get_device_settings().scan_rate, + channels, + server_m->get_device_settings().active_scan_min_ch_time, + server_m->get_device_settings().active_scan_max_ch_time, + is_split_scan_m ); + + break; + } + else + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - no reason to direct scan anything" ); + remove_non_hidden_iaps(); + + return goto_state( core_state_scanning_done ); + } + } + case core_state_direct_scan_start: + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - direct scan request completed, waiting for scan completion" ); + + break; + } + case core_state_direct_scan_done: + { + operation_state_m = core_state_direct_scan_start; + + DEBUG1( "core_operation_get_available_iaps_c::next_state() - direct scan done, %u beacon(s)/probe(s) received", + bss_count_m ); + DEBUG1( "core_operation_get_available_iaps_c::next_state() - max %u direct scans left", + iap_data_list_m.count() ); + + /** + * Go through the direct scan results and remove the matching IAPs. + */ + process_scan_results( + core_scan_list_tag_direct_scan ); + + /** + * If the first entry is still the same the one that was scanned, + * it means the IAP was not found. + */ + core_iap_data_s* iap = iap_data_list_m.first(); + if ( iap && iap->ssid == direct_scanned_ssid_m ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - IAP ID %u not found in direct scan", + iap->id ); + + core_error_e ret = iap_data_list_m.remove( iap ); + if( ret != core_error_ok ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - error while removing IAP entry (%d)", + ret ); + } + + non_found_iaps_list_m.append( iap ); + } + + iap = iap_data_list_m.first(); + if( iap ) + { + direct_scanned_ssid_m = iap->ssid; + DEBUG1( "core_operation_get_available_iaps_c::next_state() - direct scanning IAP ID %u", + iap->id ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ", + direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_direct_scan ); + + const core_scan_channels_s& channels( + active_channels_m.channels() ); + DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting scan on channels 0x%02X%02X", + channels.channels2dot4ghz[1], + channels.channels2dot4ghz[0] ); + + bss_count_m = 0; + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_active, + direct_scanned_ssid_m, + server_m->get_device_settings().scan_rate, + channels, + server_m->get_device_settings().active_scan_min_ch_time, + server_m->get_device_settings().active_scan_max_ch_time, + is_split_scan_m ); + } + else + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - nothing to direct scan" ); + + return goto_state( core_state_secondary_ssid_check ); + } + + break; + } + case core_state_secondary_ssid_check: + { + ASSERT( !iap_data_list_m.count() ); + ASSERT( !iap_data_list_m.first() ); + + /** + * All the IAPs that were not found are contained in non_found_iaps_list_m + * list. Those that have secondary SSIDs defined, will be moved back to + * iap_data_list_m for scanning. + */ + + if ( iap_ssid_list_m ) + { + core_iap_data_s* iap = non_found_iaps_list_m.first(); + while( iap ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - checking IAP ID %u for secondary SSIDs", + iap->id ); + + if ( is_id_in_secondary_ssid_list( iap->id ) ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - IAP has secondary SSID(s) defined" ); + + /** Using a temporary pointer to guarantee list iterator working. */ + core_iap_data_s* temp = iap; + iap = non_found_iaps_list_m.next(); + + non_found_iaps_list_m.remove( temp ); + iap_data_list_m.append( temp ); + } + else + { + iap = non_found_iaps_list_m.next(); + } + } + } + + if ( !iap_data_list_m.count() ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - no IAPs with secondary SSID(s) defined" ); + + return goto_state( core_state_scanning_done ); + } + + DEBUG1( "core_operation_get_available_iaps_c::next_state() - %u IAP(s) with secondary SSID(s) defined", + iap_data_list_m.count() ); + + if ( iap_ssid_list_m ) + { + (void)iap_ssid_list_m->first(); + } + (void)iap_data_list_m.first(); + + return goto_state( core_state_secondary_ssid_next ); + } + case core_state_secondary_ssid_next: + { + operation_state_m = core_state_secondary_ssid_start; + + core_iap_data_s* iap = iap_data_list_m.current(); + if ( !iap ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - all IAPs with secondary SSID(s) handled" ); + + return goto_state( core_state_scanning_done ); + } + + DEBUG1( "core_operation_get_available_iaps_c::next_state() - current IAP ID %u", + iap->id ); + core_ssid_entry_s* entry = iap_ssid_list_m->current(); + while ( entry ) + { + if ( iap->id == entry->id ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - ID: %u", + entry->id ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - SSID: ", + entry->ssid.length, entry->ssid.ssid ); + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - Used SSID: ", + entry->used_ssid.length, entry->used_ssid.ssid ); + + if ( is_ssid_in_scanlist( + entry->ssid, + client_scan_data_m ) ) + { + direct_scanned_ssid_m = entry->used_ssid; + + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - matching SSID found, doing a direct scan for SSID ", + direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_direct_scan ); + + const core_scan_channels_s& channels( + active_channels_m.channels() ); + DEBUG2( "core_operation_get_available_iaps_c::next_state() - requesting scan on channels 0x%02X%02X", + channels.channels2dot4ghz[1], + channels.channels2dot4ghz[0] ); + + bss_count_m = 0; + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_active, + direct_scanned_ssid_m, + server_m->get_device_settings().scan_rate, + channels, + server_m->get_device_settings().active_scan_min_ch_time, + server_m->get_device_settings().active_scan_max_ch_time, + is_split_scan_m ); + + return core_error_request_pending; + } + else + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - matching SSID not found, moving to next entry" ); + + entry = iap_ssid_list_m->next(); + } + } + else + { + entry = iap_ssid_list_m->next(); + } + } + + DEBUG1( "core_operation_get_available_iaps_c::next_state() - no more entries for IAP ID %u, moving to next IAP", + iap->id ); + + remove_secondary_ssid_entries_by_id( iap->id ); + iap_data_list_m.remove( iap ); + non_found_iaps_list_m.append( iap ); + (void)iap_ssid_list_m->first(); + (void)iap_data_list_m.first(); + + return asynch_goto( core_state_secondary_ssid_next ); + } + case core_state_secondary_ssid_start: + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - direct scan request completed, waiting for scan completion" ); + + break; + } + case core_state_secondary_ssid_done: + { + core_iap_data_s* iap = iap_data_list_m.current(); + ASSERT( iap ); + + core_ssid_entry_s* entry = iap_ssid_list_m->current(); + ASSERT( entry ); + + core_scan_list_iterator_by_tag_and_ssid_c iter( + server_m->get_scan_list(), + core_scan_list_tag_direct_scan, + direct_scanned_ssid_m ); + + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + core_iap_data_c iap_data( *iap ); + if ( core_tools_parser_c::is_ap_compatible_with_iap( + server_m->get_wpx_adaptation_instance(), + *ap_data, + iap_data, + server_m->get_core_settings(), + false_t, + false_t ) == core_connect_ok ) + { + DEBUG1( "core_operation_get_available_iaps_c::next_state() - secondary SSID match for IAP ID %u", + iap->id ); + + u32_t* iap_id = new u32_t; + if( iap_id ) + { + *iap_id = iap->id; + iap_id_list_m.append( iap_id ); + iap_id = NULL; + } + + remove_secondary_ssid_entries_by_id( iap->id ); + iap_data_list_m.remove( iap ); + (void)iap_ssid_list_m->first(); + (void)iap_data_list_m.first(); + + delete iap; + iap = NULL; + + return goto_state( core_state_secondary_ssid_next ); + } + } + + DEBUG1S( "core_operation_get_available_iaps_c::next_state() - no matching SSID ", + direct_scanned_ssid_m.length, direct_scanned_ssid_m.ssid ); + + (void)iap_ssid_list_m->next(); + + return goto_state( core_state_secondary_ssid_next ); + } + case core_state_scanning_done: + { + server_m->unregister_frame_handler( this ); + + server_m->get_scan_list().print_contents(); // Additional print + + DEBUG( "core_operation_get_available_iaps_c::next_state() - all scanning done" ); + DEBUG1( "core_operation_get_available_iaps_c::next_state() - scan list contains %u AP(s)", + client_scan_data_m.Count() ); + DEBUG1( "core_operation_get_available_iaps_c::next_state() - scan list size is %u bytes", + client_scan_data_m.Size() ); + DEBUG1( "core_operation_get_available_iaps_c::next_state() - %u IAP(s) found", + iap_id_list_m.count() ); + DEBUG1( "core_operation_get_available_iaps_c::next_state() - %u IAP(s) not found", + non_found_iaps_list_m.count() ); + + /** + * Detect channels that have APs with long beacon intervals. + */ + const u32_t long_beacon_interval( + server_m->get_device_settings().passive_scan_max_ch_time ); + + core_long_beacon_interval_channels_s& long_beacon_interval_channels( + server_m->get_core_settings().long_beacon_interval_channels() ); + + core_scan_list_iterator_by_tag_c iter_long_beacon( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + + for ( core_ap_data_c* ap_data = iter_long_beacon.first(); ap_data; ap_data = iter_long_beacon.next() ) + { + if ( ap_data->beacon_interval() > long_beacon_interval ) + { + const u8_t channel( ap_data->channel() ); + const core_mac_address_s bssid = ap_data->bssid(); + + DEBUG8( "core_operation_get_available_iaps_c::next_state() - BSSID %02X:%02X:%02X:%02X:%02X:%02X on channel %u has a long beacon interval (%u)", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5], + channel, + ap_data->beacon_interval() ); + if ( channel && + channel <= SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO ) + { + long_beacon_interval_channels.channel_scan_count[channel - 1] = + server_m->get_device_settings().long_beacon_find_count; + } + } + } + + return core_error_ok; + } + default: + { + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_get_available_iaps_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG( "core_operation_get_available_iaps_c::user_cancel()" ); + + /** + * If region is FCC and region information is not known, then ignore + * and remove the APs from channels 12 and 13 + */ + if ( !server_m->get_core_settings().mcc_known() && + server_m->get_core_settings().regional_domain() == core_wlan_region_fcc ) + { + DEBUG( "core_operation_get_available_iaps_c::next_state() - remove APs that were found on channels 12 and 13" ); + remove_disallowed_aps(); + } + + if ( !do_graceful_cancel ) + { + /** + * If we are in a middle of a scan, we have to schedule our own + * event. + */ + if ( ( operation_state_m == core_state_long_broadcast_scan_start || + operation_state_m == core_state_broadcast_scan_start || + operation_state_m == core_state_broadcast_scan_start_unknown_region || + operation_state_m == core_state_direct_scan_start || + operation_state_m == core_state_secondary_ssid_start ) && + server_m->event_handler() == this && + server_m->frame_handler() == this ) + { + asynch_default_user_cancel(); + + return; + } + + /** + * Everything else is handled by the default implementation. + */ + core_operation_base_c::user_cancel( do_graceful_cancel ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_get_available_iaps_c::remove_non_hidden_iaps() + { + DEBUG("core_operation_get_available_iaps_c::remove_non_hidden_iaps()"); + + core_iap_data_s* iap = iap_data_list_m.first(); + while( iap ) + { + if( !iap->is_hidden ) + { + DEBUG1("core_operation_get_available_iaps_c::remove_non_hidden_iaps() - removing IAP ID %u", + iap->id ); + + core_iap_data_s* temp = iap; + iap = iap_data_list_m.next(); + core_error_e ret = iap_data_list_m.remove( temp ); + if( ret != core_error_ok ) + { + DEBUG1("core_operation_get_available_iaps_c::remove_non_hidden_iaps() - error while removing IAP entry (%d)", + ret ); + } + non_found_iaps_list_m.append( temp ); + } + else + { + DEBUG1("core_operation_get_available_iaps_c::remove_non_hidden_iaps() - leaving IAP ID %u", + iap->id ); + + iap = iap_data_list_m.next(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_get_available_iaps_c::process_scan_results( + u8_t tag ) + { + DEBUG( "core_operation_get_available_iaps_c::process_scan_results()" ); + + core_scan_list_iterator_by_tag_c iter( + server_m->get_scan_list(), + tag ); + + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + remove_matching_iaps( *ap_data ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_get_available_iaps_c::remove_matching_iaps( + core_ap_data_c& ap_data ) + { + DEBUG( "core_operation_get_available_iaps_c::remove_matching_iaps()" ); + + if ( ap_data.rcpi() < server_m->get_device_settings().iap_availability_rcpi_threshold ) + { + DEBUG2( "core_operation_get_available_iaps_c::remove_matching_iaps() - AP not considered, signal too weak (%u vs %u)", + ap_data.rcpi(), server_m->get_device_settings().iap_availability_rcpi_threshold ); + + return; + } + + u8_t treshold_val = + static_cast(server_m->get_core_settings().rcp_improve_boundary()); + + /** + * Loop through the IAP list. + */ + core_iap_data_s* iap = iap_data_list_m.first(); + while( iap ) + { + core_iap_data_c iap_data( *iap ); + if ( iap->ssid == ap_data.ssid() && + core_tools_parser_c::is_ap_compatible_with_iap( + server_m->get_wpx_adaptation_instance(), + ap_data, + iap_data, + server_m->get_core_settings(), + false_t, + false_t ) == core_connect_ok ) + { + DEBUG1("core_operation_get_available_iaps_c::remove_matching_iaps() - match found for IAP ID %u", + iap->id ); + + u32_t* iap_id = new u32_t; + if( iap_id ) + { + if ( server_m->get_core_settings().is_iap_id_in_weak_list( iap->id) ) + { + DEBUG( "core_operation_get_available_iaps_c::remove_matching_iaps() - IAP ID is in weak list" ); + + if ( ap_data.rcpi() > treshold_val ) + { + DEBUG( "core_operation_get_available_iaps_c::remove_matching_iaps() - RCPI improved enough, remove IAP ID from weak list" ); + *iap_id = iap->id; + iap_id_list_m.append( iap_id ); + iap_id = NULL; + + server_m->get_core_settings().remove_iap_id_from_weak_list( iap->id ); + } + + } + else + { + *iap_id = iap->id; + iap_id_list_m.append( iap_id ); + iap_id = NULL; + } + } + + /** Using a temporary pointer to guarantee list iterator working. */ + core_iap_data_s* temp = iap; + + iap = iap_data_list_m.next(); + core_error_e ret = iap_data_list_m.remove( temp ); + if( ret != core_error_ok ) + { + if( iap ) + { + DEBUG1("core_operation_get_available_iaps_c::remove_matching_iaps() - error while removing IAP entry (%d)", + iap->id ); + } + } + + delete temp; + temp = NULL; + delete iap_id; + iap_id = NULL; + } + else + { + iap = iap_data_list_m.next(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_operation_get_available_iaps_c::hidden_iap_count( + core_type_list_c& iap_data_list ) + { + DEBUG( "core_operation_get_available_iaps_c::hidden_iap_count()" ); + + u8_t count( 0 ); + core_iap_data_s* iap = iap_data_list.first(); + + while( iap ) + { + if( iap->is_hidden ) + { + ++count; + } + + iap = iap_data_list.next(); + } + + return count; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_get_available_iaps_c::remove_disallowed_aps() + { + core_type_list_c remove_ap_list; + + core_scan_list_iterator_by_tag_c iter_removed_aps( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + + core_ap_data_c* ap_data = iter_removed_aps.first(); + while ( ap_data ) + { + if ( !server_m->get_core_settings().is_valid_channel( + SCAN_BAND_2DOT4GHZ, + ap_data->channel() ) ) + { + core_mac_address_s* ignored_ap = new core_mac_address_s; + if ( ignored_ap ) + { + *ignored_ap = ap_data->bssid(); + remove_ap_list.append( ignored_ap ); + } + } + + ap_data = iter_removed_aps.next(); + } + + core_mac_address_s* ignored_bssid = remove_ap_list.first(); + while (ignored_bssid ) + { + server_m->get_scan_list().remove_entries_by_bssid( *ignored_bssid ); + ignored_bssid = remove_ap_list.next(); + } + + remove_ap_list.clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_get_available_iaps_c::is_id_in_secondary_ssid_list( + u32_t id ) + { + for( core_ssid_entry_s* iter = iap_ssid_list_m->first(); iter; iter = iap_ssid_list_m->next() ) + { + if ( id == iter->id ) + { + return true_t; + } + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_get_available_iaps_c::remove_secondary_ssid_entries_by_id( + u32_t id ) + { + core_ssid_entry_s* iter = iap_ssid_list_m->first(); + while( iter ) + { + if ( id == iter->id ) + { + /** Using a temporary pointer to guarantee list iterator working. */ + core_ssid_entry_s* temp = iter; + iter = iap_ssid_list_m->next(); + + core_error_e ret = iap_ssid_list_m->remove( temp ); + if( ret != core_error_ok ) + { + DEBUG1("core_operation_get_available_iaps_c::remove_secondary_ssid_entries_by_id() - error while removing an entry (%u)", + ret ); + } + + delete temp; + temp = NULL; + } + else + { + iter = iap_ssid_list_m->next(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_get_available_iaps_c::is_ssid_in_scanlist( + const core_ssid_s& ssid, + const ScanList& scan_data ) + { + u8_t ie_len( 0 ); + const u8_t* ie_data = NULL; + ScanInfo info( scan_data ); + + for ( info.First(); !info.IsDone(); info.Next() ) + { + if( !info.InformationElement( core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ssid, ie_len, &ie_data ) ) + { + if( core_tools_c::compare( + ssid.ssid, ssid.length, + ie_data, ie_len ) == 0 ) + { + return true_t; + } + } + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_get_available_iaps_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ) + { + DEBUG( "core_operation_get_available_iaps_c::receive_frame()" ); + + if ( frame->type() != core_frame_dot11_c::core_dot11_type_beacon && + frame->type() != core_frame_dot11_c::core_dot11_type_probe_resp ) + { + DEBUG( "core_operation_get_available_iaps_c::receive_frame() - not a beacon or a probe" ); + return false_t; + } + + core_ap_data_c* ap_data = core_ap_data_c::instance( + server_m->get_wpx_adaptation_instance(), + frame, + rcpi, + false_t ); + if ( ap_data ) + { + const core_ssid_s ssid = ap_data->ssid(); + DEBUG1S( "core_operation_get_available_iaps_c::receive_frame() - SSID: ", + ssid.length, &ssid.ssid[0] ); + + const core_mac_address_s bssid = ap_data->bssid(); + DEBUG6( "core_operation_get_available_iaps_c::receive_frame() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + server_m->get_scan_list().update_entry( *ap_data ); + + active_channels_m.add( + ap_data->band(), + ap_data->channel() ); + + bss_count_m++; + + delete ap_data; + ap_data = NULL; + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_get_available_iaps_c::notify( + core_am_indication_e indication ) + { + if ( indication == core_am_indication_wlan_scan_complete ) + { + server_m->unregister_event_handler( this ); + + if ( operation_state_m == core_state_long_broadcast_scan_start ) + { + DEBUG( "core_operation_get_available_iaps_c::notify() - long broadcast scan complete" ); + + asynch_goto( core_state_long_broadcast_scan_done, CORE_TIMER_IMMEDIATELY ); + } + else if ( operation_state_m == core_state_broadcast_scan_start ) + { + DEBUG( "core_operation_get_available_iaps_c::notify() - broadcast scan complete" ); + + asynch_goto( core_state_broadcast_scan_done, CORE_TIMER_IMMEDIATELY ); + } + else if ( operation_state_m == core_state_broadcast_scan_start_unknown_region ) + { + DEBUG( "core_operation_get_available_iaps_c::notify() - broadcast scan complete for channels 12 and 13" ); + + asynch_goto( core_state_broadcast_scan_complete_unknown_region, CORE_TIMER_IMMEDIATELY ); + } + else if ( operation_state_m == core_state_direct_scan_start ) + { + DEBUG( "core_operation_get_available_iaps_c::notify() - direct scan complete" ); + + asynch_goto( core_state_direct_scan_done, CORE_TIMER_IMMEDIATELY ); + } + else if ( operation_state_m == core_state_secondary_ssid_start ) + { + DEBUG( "core_operation_get_available_iaps_c::notify() - direct scan complete" ); + + asynch_goto( core_state_secondary_ssid_done, CORE_TIMER_IMMEDIATELY ); + } + else + { + DEBUG( "core_operation_get_available_iaps_c::notify() - scan complete in unknown state" ); + ASSERT( false_t ); + } + + return true_t; + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_rcpi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_rcpi.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for getting the RCPI value of the current connection +* +*/ + + +#include "core_operation_get_rcpi.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_get_rcpi_c::core_operation_get_rcpi_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u32_t& rcpi ) : + core_operation_base_c( core_operation_get_rcpi, request_id, server, drivers, adaptation, + core_base_flag_none ), + current_rcpi_m( rcpi ) + { + DEBUG( "core_operation_get_rcpi_c::core_operation_get_rcpi_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_get_rcpi_c::~core_operation_get_rcpi_c() + { + DEBUG( "core_operation_get_rcpi_c::~core_operation_get_rcpi_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_get_rcpi_c::next_state() + { + DEBUG( "core_operation_get_rcpi_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + DEBUG( "core_operation_get_rcpi_c::next_state() - requesting current RCPI value" ); + + if( server_m->get_core_settings().is_connected() ) + { + drivers_m->get_current_rcpi( + request_id_m, + current_rcpi_m ); + operation_state_m = core_state_req_rcpi; + break; + } + else + { + return core_error_not_supported; + } + } + case core_state_req_rcpi: + { + DEBUG1( "core_operation_get_rcpi_c::next_state() - current RCPI is %u", + current_rcpi_m ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_statistics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_statistics.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for getting the packet statistics. +* +*/ + + +#include "core_operation_get_statistics.h" +#include "core_roam_metrics.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_get_statistics_c::core_operation_get_statistics_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_packet_statistics_s& statistics ) : + core_operation_base_c( core_operation_get_statistics, request_id, server, drivers, adaptation, + core_base_flag_none ), + client_statistics_m( statistics ) + { + DEBUG( "core_operation_get_statistics_c::core_operation_get_statistics_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_get_statistics_c::~core_operation_get_statistics_c() + { + DEBUG( "core_operation_get_statistics_c::~core_operation_get_statistics_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_get_statistics_c::next_state() + { + DEBUG( "core_operation_get_statistics_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + server_m->get_core_settings().roam_metrics().trace_current_roam_metrics(); + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_connect_c::next_state() - not connected, returning cached packet statistics" ); + + client_statistics_m = server_m->get_core_settings().connection_statistics(); + + return core_error_ok; + } + + operation_state_m = core_state_req_packet_statistics; + + DEBUG( "core_operation_get_statistics_c::next_state() - requesting packet statistics from drivers" ); + + drivers_m->get_packet_statistics( + request_id_m, + current_statistics_m ); + + break; + } + case core_state_req_packet_statistics: + { + core_packet_statistics_s statistics = + server_m->get_core_settings().connection_statistics(); + + DEBUG( "core_operation_get_statistics_c::next_state() - previous packet statistics:" ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_frames: %u", + statistics.tx_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - rx_frames: %u", + statistics.rx_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_multicast_frames: %u", + statistics.tx_multicast_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - rx_multicast_frames: %u", + statistics.rx_multicast_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - fcs_errors: %u", + statistics.fcs_errors ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_retries: %u", + statistics.tx_retries ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_errors: %u", + statistics.tx_errors ); + + server_m->get_core_settings().update_connection_statistics( + current_statistics_m ); + + client_statistics_m = server_m->get_core_settings().connection_statistics(); + + DEBUG( "core_operation_get_statistics_c::next_state() - current packet statistics:" ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_frames: %u", + client_statistics_m.tx_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - rx_frames: %u", + client_statistics_m.rx_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_multicast_frames: %u", + client_statistics_m.tx_multicast_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - rx_multicast_frames: %u", + client_statistics_m.rx_multicast_frames ); + DEBUG1( "core_operation_get_statistics_c::next_state() - fcs_errors: %u", + client_statistics_m.fcs_errors ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_retries: %u", + client_statistics_m.tx_retries ); + DEBUG1( "core_operation_get_statistics_c::next_state() - tx_errors: %u", + client_statistics_m.tx_errors ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_bss_lost.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_bss_lost.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,488 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling BSS lost notification from drivers. +* +*/ + +/* +* %version: 33 % +*/ + +#include "core_operation_handle_bss_lost.h" +#include "core_operation_roam.h" +#include "core_operation_release.h" +#include "core_sub_operation_roam_scan.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_am_tools.h" +#include "core_scan_list.h" +#include "am_debug.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_bss_lost_c::core_operation_handle_bss_lost_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_bss_lost_reason_e reason, + u32_t reason_data ) : + core_operation_base_c( core_operation_handle_bss_lost, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_connection_needed | core_base_flag_roam_operation ), + reason_m( reason ), + reason_data_m( reason_data ), + failure_count_m( 0 ), + is_connected_m( false_t ), + scan_channels_m(), + is_scan_channels_inverted_m( false_t ), + release_reason_m( core_release_reason_max_roam_attempts_exceeded ), + scan_interval_count_m( 0 ), + scan_interval_m( 0 ), + is_first_scan_m( true_t ) + { + DEBUG( "core_operation_handle_bss_lost_c::core_operation_handle_bss_lost_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_bss_lost_c::~core_operation_handle_bss_lost_c() + { + DEBUG( "core_operation_handle_bss_lost_c::~core_operation_handle_bss_lost_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_handle_bss_lost_c::next_state() + { + DEBUG( "core_operation_handle_bss_lost_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + core_mac_address_s bssid = + server_m->get_connection_data()->current_ap_data()->bssid(); + + /** + * Update the reason for roaming. + * + * If the operation has been started because of a failed RCPI roam, + * the original roam reason must not be changed. + */ + if ( reason_m != core_bss_lost_reason_failed_rcpi_roam ) + { + server_m->get_connection_data()->set_last_roam_failed_reason( + core_roam_failed_reason_none ); + + switch ( reason_m ) + { + case core_bss_lost_reason_media_disconnect: + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_media_disconnect ); + break; + case core_bss_lost_reason_failed_reauthentication: + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_failed_reauthentication ); + break; + case core_bss_lost_reason_bss_lost: + /** Falls through on purpose. */ + default: + server_m->get_connection_data()->set_last_roam_reason( + core_roam_reason_bss_lost ); + break; + } + } + + /** + * If the AP has deauthenticated us soon after a successful association + * and EAPOL authentication, increase the deauthentication count. + * + * This check is done to detect APs that do MAC filtering after a + * successful association. + */ + if ( reason_m == core_bss_lost_reason_media_disconnect && + !server_m->get_connection_data()->is_eapol_authenticating() ) + { + u64_t time = static_cast( + core_am_tools_c::timestamp() - + server_m->get_core_settings().roam_metrics().roam_ts_userdata_enabled() ); + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - deauthenticated after being connected for %u second(s)", + static_cast( time / SECONDS_FROM_MICROSECONDS ) ); + + if ( server_m->get_device_settings().max_ap_deauthentication_count && + server_m->get_device_settings().ap_deauthentication_timeout && + time <= server_m->get_device_settings().ap_deauthentication_timeout ) + { + u8_t count( server_m->get_connection_data()->ap_deauthentication_count( bssid ) ); + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - AP deauthentication count was %u earlier", + count ); + + if ( count >= server_m->get_device_settings().max_ap_deauthentication_count - 1 ) + { + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - deauthentication count (%u) exceeded, blacklisting the AP", + server_m->get_device_settings().max_ap_deauthentication_count ); + server_m->get_connection_data()->add_mac_to_temporary_blacklist( + bssid, core_ap_blacklist_reason_max_deauthentication_count ); + } + else + { + DEBUG( "core_operation_handle_bss_lost_c::next_state() - increasing AP deauthentication count" ); + server_m->get_connection_data()->increase_ap_deauthentication_count( bssid ); + } + } + } + + /** + * If the connection is lost when EAPOL is doing (re-)authentication, + * EAPOL must be notified. + */ + if ( server_m->get_connection_data()->is_eapol_authenticating() && + ( server_m->get_connection_data()->iap_data().is_eap_used() || + server_m->get_connection_data()->iap_data().is_wapi_used() ) ) + { + network_id_c network_id( + &bssid.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + DEBUG( "core_operation_handle_bss_lost_c::next_state() - marking is_eapol_authenticating as false" ); + server_m->get_connection_data()->set_eapol_authenticating( + false_t ); + + DEBUG6( "core_operation_handle_bss_lost_c::next_state() - EAPOL disassociation from BSSID %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + server_m->get_eapol_instance().disassociation( &network_id ); + } + + operation_state_m = core_state_set_tx_level; + + /** + * Check the channels that were previously reported to be active. + */ + server_m->get_scan_list().get_channels_by_ssid( + scan_channels_m, + server_m->get_connection_data()->ssid() ); + + scan_channels_m.add( + server_m->get_connection_data()->current_ap_data()->band(), + server_m->get_connection_data()->current_ap_data()->channel() ); + + scan_channels_m.merge( + server_m->get_connection_data()->adjacent_ap_channels() ); + + scan_channels_m.merge( + server_m->get_connection_data()->current_ap_data()->ap_channel_report() ); + + server_m->cancel_roam_timer(); + + DEBUG( "core_operation_handle_bss_lost_c::next_state() - removing current AP entries from scan list" ); + server_m->get_scan_list().remove_entries_by_bssid( + bssid ); + + server_m->get_core_settings().roam_metrics().set_roam_ts_userdata_disabled(); + + drivers_m->disable_user_data( + request_id_m ); + + break; + } + case core_state_set_tx_level: + { + operation_state_m = core_state_set_tx_level_success; + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - setting tx power (%u)", + server_m->get_device_settings().tx_power_level ); + + drivers_m->set_tx_power_level( + request_id_m, + server_m->get_device_settings().tx_power_level ); + + break; + } + case core_state_set_tx_level_success: + { + u32_t tx_level = server_m->get_device_settings().tx_power_level; + if ( server_m->get_connection_data()->last_tx_level() != tx_level ) + { + DEBUG( "core_operation_handle_bss_lost_c::next_state() - TX level has changed, notifying change" ); + + adaptation_m->notify( + core_notification_tx_power_level_changed, + sizeof( tx_level ), + reinterpret_cast(&tx_level) ); + + server_m->get_connection_data()->set_last_tx_level( tx_level ); + } + + return goto_state( core_state_scan_start ); + } + case core_state_scan_start: + { + operation_state_m = core_state_scan_complete; + + server_m->get_scan_list().set_tag( + core_scan_list_tag_roam_scan ); + + core_operation_base_c* operation = new core_sub_operation_roam_scan_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + server_m->get_connection_data()->ssid(), + scan_channels_m.channels(), + false_t, + true_t ); + + return run_sub_operation( operation ); + } + case core_state_scan_complete: + { + operation_state_m = core_state_connect_success; + + DEBUG( "core_operation_handle_bss_lost_c::next_state() - trying to connect" ); + + core_operation_base_c* operation = new core_operation_roam_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + core_scan_list_tag_roam_scan, + RCPI_VALUE_NONE, + MEDIUM_TIME_NOT_DEFINED, + server_m->get_connection_data()->ssid(), + BROADCAST_MAC_ADDR ); + + return run_sub_operation( operation ); + } + case core_state_connect_success: + { + operation_state_m = core_state_connect_set_rcpi_trigger; + + DEBUG( "core_operation_handle_bss_lost_c::next_state() - roamed successfully" ); + + DEBUG( "core_operation_handle_bss_lost_c::next_state() - reseting RCPI roam check interval" ); + server_m->get_connection_data()->reset_rcpi_roam_interval(); + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - internal RCPI threshold level is %u", + server_m->get_device_settings().rcpi_trigger ); + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - external RCPI threshold level is %u", + server_m->get_core_settings().rcp_decline_boundary() ); + + u8_t trigger_level = server_m->get_core_settings().rcp_decline_boundary(); + if ( trigger_level < server_m->get_device_settings().rcpi_trigger ) + { + trigger_level = server_m->get_device_settings().rcpi_trigger; + } + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - arming RCPI roam trigger (%u)", + trigger_level ); + + drivers_m->set_rcpi_trigger_level( + request_id_m, + trigger_level ); + + break; + } + case core_state_connect_set_rcpi_trigger: + { + return core_error_ok; + } + case core_state_connect_failure: + { + if( failure_reason_m == core_error_not_found ) + { + if( is_first_scan_m ) + { + /** + * This scan is part of the scans done in the beginning + * using partial channel masks. + */ + + if( !is_scan_channels_inverted_m ) + { + /** + * If no suitable APs were found on the first scan, we scan + * immediately the remaining channels. + */ + DEBUG( "core_operation_handle_bss_lost_c::next_state() - inverting channel mask" ); + + is_scan_channels_inverted_m = true_t; + scan_channels_m.invert_channels(); + + core_scan_channels_s filtered_channels( + server_m->get_core_settings().valid_scan_channels( scan_channels_m.channels() ) ); + + if( !filtered_channels.channels2dot4ghz[0] && + !filtered_channels.channels2dot4ghz[1] ) + { + DEBUG( "core_operation_handle_bss_lost_c::next_state() - inverted channel mask is zero, using full channel mask" ); + + scan_channels_m.set( + SCAN_CHANNELS_2DOT4GHZ_ETSI ); + } + } + else + { + /** + * We start scanning using the normal algorithm and + * a full channel mask. + */ + is_first_scan_m = false_t; + scan_interval_m = + server_m->get_device_settings().bss_lost_roam_min_interval; + scan_channels_m.set( + SCAN_CHANNELS_2DOT4GHZ_ETSI ); + } + } + else + { + scan_channels_m.set( + SCAN_CHANNELS_2DOT4GHZ_ETSI ); + + ++failure_count_m; + ++scan_interval_count_m; + if( scan_interval_m < server_m->get_device_settings().bss_lost_roam_max_interval && + scan_interval_count_m >= server_m->get_device_settings().bss_lost_roam_attempts_per_interval ) + { + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - maximum interval attempts (%u) exceeded, increasing interval", + server_m->get_device_settings().bss_lost_roam_attempts_per_interval ); + scan_interval_count_m = 0; + scan_interval_m *= server_m->get_device_settings().bss_lost_roam_next_interval_factor; + scan_interval_m += server_m->get_device_settings().bss_lost_roam_next_interval_addition; + + if( scan_interval_m > server_m->get_device_settings().bss_lost_roam_max_interval ) + { + scan_interval_m = server_m->get_device_settings().bss_lost_roam_max_interval; + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - interval value set to maximum (%u)", + scan_interval_m ); + } + } + } + } + else + { + /** + * The roaming failed because of some other reason than not + * finding a suitable AP. + */ + is_first_scan_m = false_t; + failure_count_m = 0; + scan_interval_count_m = 0; + scan_interval_m = + server_m->get_device_settings().bss_lost_roam_min_interval; + + scan_channels_m.set( + SCAN_CHANNELS_2DOT4GHZ_ETSI ); + } + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - roaming has failed %u time(s)", + failure_count_m ); + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - failure_reason_m is %u", + failure_reason_m ); + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - connect_status is %u", + server_m->get_connection_data()->connect_status() ); + + /** + * If EAPOL has notified about a total failure or we have tried too many times, + * close down the connection. Otherwise, try again. + */ + if ( failure_reason_m == core_error_eapol_total_failure || + failure_reason_m == core_error_eapol_canceled_by_user || + failure_count_m >= server_m->get_device_settings().bss_lost_roam_max_tries_to_find_nw ) + { + return goto_state( core_state_connect_total_failure ); + } + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - next scan in %u microsecond(s)", + scan_interval_m ); + + return asynch_goto( + core_state_scan_start, + scan_interval_m ); + } + case core_state_connect_total_failure: + { + operation_state_m = core_state_connect_disconnect; + + DEBUG1( "core_operation_handle_bss_lost_c::next_state() - gave up roaming after %u tries", + failure_count_m ); + + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + release_reason_m ); + + return run_sub_operation( operation ); + } + case core_state_connect_disconnect: + { + DEBUG( "core_operation_handle_bss_lost_c::next_state() - connection closed successfully" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_bss_lost_c::user_cancel( + bool_t /* do_graceful_cancel */ ) + { + DEBUG( "core_operation_handle_bss_lost_c::user_cancel()" ); + + release_reason_m = core_release_reason_external_request; + + operation_state_m = core_state_connect_total_failure; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_handle_bss_lost_c::cancel() + { + DEBUG( "core_operation_handle_bss_lost_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_connect_success: + { + return goto_state( core_state_connect_failure ); + } + default: + { + return failure_reason_m; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_delete_ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_delete_ts.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling traffic stream deletion from network side. +* +*/ + +/* +* %version: 9 % +*/ + +#include "core_operation_handle_delete_ts.h" +#include "core_operation_update_tx_rate_policies.h" +#include "core_tools.h" +#include "core_server.h" +#include "core_traffic_stream_list_iter.h" +#include "core_virtual_traffic_stream_list_iter.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_delete_ts_c::core_operation_handle_delete_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + u8_t tid ) : + core_operation_base_c( core_operation_handle_delete_ts, request_id, server, drivers, adaptation, + core_base_flag_none ), + tid_m( tid ) + { + DEBUG( "core_operation_handle_delete_ts_c::core_operation_handle_delete_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_delete_ts_c::~core_operation_handle_delete_ts_c() + { + DEBUG( "core_operation_handle_delete_ts_c::~core_operation_handle_delete_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_handle_delete_ts_c::next_state() + { + DEBUG( "core_operation_handle_delete_ts_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_base_state_parameters_set; + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_handle_delete_ts_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + + DEBUG1( "core_operation_handle_delete_ts_c::next_state() - network has requested deletion of TID %u", + tid_m ); + + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_traffic_stream_list_iter_c ts_iter( ts_list ); + + virtual_ts_list.print_contents(); + ts_list.print_contents(); + + core_traffic_stream_c* stream = NULL; + core_traffic_stream_c* iter = ts_iter.first(); + while( iter ) + { + if ( iter->tid() == tid_m ) + { + stream = iter; + + iter = NULL; + } + else + { + iter = ts_iter.next(); + } + } + + if ( !stream ) + { + DEBUG1( "core_operation_handle_delete_ts_c::next_state() - no traffic stream with TID %u found", + tid_m ); + + return core_error_not_found; + } + + u8_t user_priority = stream->user_priority(); + core_traffic_stream_direction_e direction = stream->direction(); + + /** + * Send a status update to all affected virtual traffic streams. + */ + set_virtual_traffic_stream_inactive_by_tid( + tid_m, + core_traffic_stream_status_inactive_deleted_by_ap ); + + /** + * Delete the actual traffic stream. + */ + server_m->get_wpx_adaptation_instance().handle_ts_delete( + tid_m, user_priority ); + ts_iter.remove(); + + if( direction == core_traffic_stream_direction_uplink || + direction == core_traffic_stream_direction_bidirectional ) + { + server_m->get_connection_data()->set_ac_traffic_status( + core_tools_c::convert_user_priority_to_ac( user_priority ), + core_access_class_traffic_status_not_admitted ); + + /** + * Send an indication to notify clients that this access class + * is no longer admitted. + * + * We don't have to the check the ACM bits since the traffic + * stream wouldn't exist if the AP didn't require admission + * control. + */ + DEBUG( "core_operation_handle_delete_ts_c::next_state() - traffic no longer admitted on this AC, notifying clients" ); + + u8_t buf[5]; + buf[0] = static_cast( + core_tools_c::convert_user_priority_to_ac( user_priority ) ); + buf[1] = static_cast( + core_access_class_traffic_status_not_admitted ); + adaptation_m->notify( + core_notification_ac_traffic_status_changed, + sizeof( buf ), + buf ); + + /** + * Reset TX queue parameters back to default values. + */ + DEBUG( "core_operation_delete_ts_c::next_state() - resetting tx queue parameters" ); + + drivers_m->set_tx_queue_parameters( + request_id_m, + core_tools_c::convert_user_priority_to_ac( user_priority ), + 0, + server_m->get_device_settings().max_tx_msdu_life_time ); + } + else + { + /** + * Since TX queue parameters apply only to uplink, there is nothing + * more to do on downlink streams. + */ + return core_error_ok; + } + + break; + } + case core_base_state_parameters_set: + { + DEBUG( "core_operation_handle_delete_ts_c::next_state() - tx queue parameters reset" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +void core_operation_handle_delete_ts_c::set_virtual_traffic_stream_inactive_by_tid( + u8_t tid, + core_traffic_stream_status_e stream_status ) + { + DEBUG( "core_operation_handle_delete_ts_c::set_virtual_traffic_stream_inactive_by_tid()" ); + + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + core_virtual_traffic_stream_c* virtual_iter = virtual_ts_iter.first(); + while( virtual_iter ) + { + if( virtual_iter->tid() == tid ) + { + u32_t id( virtual_iter->id() ); + + /** + * The virtual traffic stream is no longer mapped to any actual + * traffic stream. + */ + virtual_iter->set_tid( + TRAFFIC_STREAM_TID_NONE ); + virtual_iter->set_status( + stream_status ); + + DEBUG1( "core_operation_handle_delete_ts_c::set_virtual_traffic_stream_inactive_by_tid() - virtual traffic stream with ID %u is now inactive", + id ); + + u8_t buf[5]; + core_tools_c::copy( + &buf[0], + reinterpret_cast( &id ), + sizeof( u32_t ) ); + buf[4] = static_cast( stream_status ); + + adaptation_m->notify( + core_notification_ts_status_changed, + sizeof( buf ), + buf ); + } + + virtual_iter = virtual_ts_iter.next(); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_frame.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_frame.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,409 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling a frame received from drivers +* +*/ + + +#include "core_operation_handle_frame.h" +#include "core_operation_ibss_merge.h" +#include "core_operation_handle_delete_ts.h" +#include "core_operation_update_power_mode.h" +#include "core_operation_handle_measurement_request.h" +#include "core_operation_handle_neighbor_response.h" +#include "core_frame_radio_measurement_action.h" +#include "core_frame_action_wmm.h" +#include "core_frame_wmm_ie_tspec.h" +#include "core_frame_action_rm.h" +#include "core_frame_action_nr.h" +#include "core_frame_tim_ie.h" +#include "core_frame_dot11.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_frame_c::core_operation_handle_frame_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_type_e frame_type, + u16_t data_length, + const u8_t* data ) : + core_operation_base_c( core_operation_handle_frame, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_connection_needed ), + type_m( frame_type ), + data_length_m( data_length ), + data_m( NULL ), + frame_m( NULL ) + { + DEBUG( "core_operation_handle_frame_c::core_operation_handle_frame_c()" ); + + data_m = new u8_t[data_length_m]; + if ( data_m ) + { + core_tools_c::copy( + data_m, + data, + data_length ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_frame_c::~core_operation_handle_frame_c() + { + DEBUG( "core_operation_handle_frame_c::~core_operation_handle_frame_c()" ); + + delete frame_m; + frame_m = NULL; + delete[] data_m; + data_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_handle_frame_c::next_state() + { + DEBUG( "core_operation_handle_frame_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + if ( !data_m ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - no frame, aborting" ); + failure_reason_m = core_error_no_memory; + + return cancel(); + } + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - not connected, discarding frame" ); + + return core_error_ok; + } + + switch ( type_m ) + { + case core_frame_type_dot11: + { + DEBUG( "core_operation_handle_frame_c::next_state() - core_frame_type_dot11" ); + frame_m = core_frame_dot11_c::instance( + data_length_m, + data_m, + false_t ); + if ( !frame_m ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - unable to create parser" ); + failure_reason_m = core_error_general; + + return cancel(); + } + +#ifdef _DEBUG + DEBUG1( "core_operation_handle_frame_c::next_state() - frame control: %04X", + frame_m->frame_control() ); + if ( frame_m->frame_control() & core_frame_dot11_c::core_dot11_frame_control_to_ds_mask ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - frame control ToDS: enabled" ); + } + else + { + DEBUG( "core_operation_handle_frame_c::next_state() - frame control ToDS: disabled" ); + } + if ( frame_m->frame_control() & core_frame_dot11_c::core_dot11_frame_control_from_ds_mask ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - frame control FromDS: enabled" ); + } + else + { + DEBUG( "core_operation_handle_frame_c::next_state() - frame control FromDS: disabled" ); + } + DEBUG1( "core_operation_handle_frame_c::next_state() - duration: %04X", + frame_m->duration() ); + + core_mac_address_s mac( ZERO_MAC_ADDR ); + mac = frame_m->destination(); + DEBUG6( "core_operation_handle_frame_c::next_state() - destination: %02X:%02X:%02X:%02X:%02X:%02X", + mac.addr[0], mac.addr[1], mac.addr[2], + mac.addr[3], mac.addr[4], mac.addr[5] ); + + mac = frame_m->source(); + DEBUG6( "core_operation_handle_frame_c::next_state() - source: %02X:%02X:%02X:%02X:%02X:%02X", + mac.addr[0], mac.addr[1], mac.addr[2], + mac.addr[3], mac.addr[4], mac.addr[5] ); + + mac = frame_m->bssid(); + DEBUG6( "core_operation_handle_frame_c::next_state() - bssid: %02X:%02X:%02X:%02X:%02X:%02X", + mac.addr[0], mac.addr[1], mac.addr[2], + mac.addr[3], mac.addr[4], mac.addr[5] ); +#endif // _DEBUG + + if ( frame_m->type() == core_frame_dot11_c::core_dot11_type_beacon && + server_m->get_core_settings().is_connected() ) + { + if ( server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_ibss ) + { + operation_state_m = core_state_done; + + DEBUG( "core_operation_handle_frame_c::next_state() - beacon received in IBSS mode" ); + + /** + * Beacons received in IBSS mode are an indication that a merge + * is needed. + */ + core_operation_base_c* operation = new core_operation_ibss_merge_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + frame_m ); + + return run_sub_operation( operation ); + } + else + { + DEBUG( "core_operation_handle_frame_c::next_state() - beacon received in infrastructure mode" ); + + /** + * Beacons received in infrastructure mode happen after an association. + * + * They are used to update the current AP data since beacons contain + * fields not present in probe responses. + */ + if ( server_m->get_connection_data() && + server_m->get_connection_data()->current_ap_data() && + server_m->get_connection_data()->current_ap_data()->bssid() == frame_m->bssid() ) + { + core_frame_beacon_c* beacon = core_frame_beacon_c::instance( + *frame_m ); + if ( beacon ) + { + for( core_frame_dot11_ie_c* ie = beacon->first_ie(); ie; ie = beacon->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_tim ) + { + core_frame_tim_ie_c* tim_ie = core_frame_tim_ie_c::instance( *ie ); + if ( tim_ie && + tim_ie->dtim_period() ) + { + DEBUG1( "core_operation_handle_frame_c::next_state() - updating AP DTIM period to %u", + tim_ie->dtim_period() ); + + server_m->get_connection_data()->current_ap_data()->set_dtim_period( + tim_ie->dtim_period() ); + + /** + * Schedule a power mode update since we may have to adjust the wakeup interval + * if DTIM skipping is used. + * + * We should avoid changing power mode if DHCP timer is active. + */ + if( !server_m->is_dhcp_timer_active() ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - scheduling a power save update" ); + + core_operation_base_c* operation = new core_operation_update_power_mode_c( + request_id_m, + server_m, + drivers_m, + adaptation_m ); + + server_m->queue_int_operation( operation ); + } + else + { + DEBUG( "core_operation_handle_frame_c::next_state() - DHCP timer active, no power mode update" ); + } + } + + delete tim_ie; + tim_ie = NULL; + } + + delete ie; + ie = NULL; + } + + delete beacon; + beacon = NULL; + } + } + } + } + else if ( frame_m->type() == core_frame_dot11_c::core_dot11_type_action ) + { + core_frame_action_c* action = core_frame_action_c::instance( + *frame_m ); + if ( action ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - 802.11 action frame found" ); + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 action category: 0x%02X", + action->category() ); + if ( action->category() == core_frame_action_c::core_dot11_action_category_wmm_qos ) + { + core_frame_action_wmm_c* wmm_action = core_frame_action_wmm_c::instance( *action ); + if ( wmm_action ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - 802.11 WMM action frame found" ); + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 WMM action type: 0x%02X", + wmm_action->action_type() ); + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 WMM action dialog token: 0x%02X", + wmm_action->dialog_token() ); + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 WMM action status: 0x%02X", + wmm_action->status() ); + + if ( wmm_action->action_type() == core_frame_action_wmm_c::core_dot11_action_wmm_type_delts ) + { + for( core_frame_dot11_ie_c* ie = wmm_action->first_ie(); ie; ie = wmm_action->next_ie() ) + { + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 WMM action IE ID: 0x%02X", + ie->element_id() ); + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 WMM action IE length: 0x%02X", + ie->length() ); + + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_wmm_tspec ) + { + core_frame_wmm_ie_tspec_c* tspec_ie = core_frame_wmm_ie_tspec_c::instance( *ie ); + if ( tspec_ie ) + { + core_operation_base_c* operation = new core_operation_handle_delete_ts_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + tspec_ie->tid() ); + + server_m->queue_int_operation( operation ); + + delete tspec_ie; + tspec_ie = NULL; + } + } + + delete ie; + ie = NULL; + } + } + + delete wmm_action; + wmm_action = NULL; + } + } + else if ( action->category() == core_frame_action_c::core_dot11_action_category_rm ) + { + core_frame_radio_measurement_action_c* radio_measurement_action = core_frame_radio_measurement_action_c::instance( *action, true_t ); + if ( radio_measurement_action ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - 802.11 RM action frame found" ); + DEBUG1( "core_operation_handle_frame_c::next_state() - 802.11 RM action type: 0x%02X", + radio_measurement_action->action_type() ); + + if ( radio_measurement_action->action_type() == core_frame_radio_measurement_action_c::core_dot11_action_rm_type_meas_req ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - Measurement Request received -> create operation to handle it" ); + + // copy received frame to a new memory location, rm_action will have the ownership of the new data + core_frame_action_rm_c* rm_action = core_frame_action_rm_c::instance( *action, true_t ); + if ( rm_action ) + { + // operation will deallocate rm_action when finished + core_operation_base_c* operation = new core_operation_handle_measurement_request_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + rm_action ); + + server_m->queue_int_operation( operation ); + } + } + else if ( radio_measurement_action->action_type() == core_frame_radio_measurement_action_c::core_dot11_action_rm_type_neighbor_resp ) + { + DEBUG( "core_operation_handle_frame_c::next_state() - Neighbor Report Response received -> create operation to handle it" ); + + // copy received frame to a new memory location, nr_action will have the ownership of the new data + core_frame_action_nr_c* nr_action = core_frame_action_nr_c::instance( *action, true_t ); + if ( nr_action ) + { + // operation will deallocate nr_action when finished + core_operation_base_c* operation = new core_operation_handle_neighbor_response_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + nr_action ); + + server_m->queue_int_operation( operation ); + } + } + else + { + DEBUG( "core_operation_handle_frame_c::next_state() - 802.11 RM action type not supported, ignoring..." ); + } + + delete radio_measurement_action; + radio_measurement_action = NULL; + } + } + + delete action; + action = NULL; + } + } + else + { + DEBUG( "core_operation_handle_frame_c::next_state() - unknown frame, discarding" ); + } + + return core_error_ok; + } + case core_frame_type_snap: + { + DEBUG( "core_operation_handle_frame_c::next_state() - core_frame_type_snap, discarding" ); + + return core_error_ok; + } + default: + { + DEBUG( "core_operation_handle_frame_c::next_state() - unknown frame type, discarding" ); + + return core_error_ok; + } + } + } + case core_state_done: + { + DEBUG( "core_operation_handle_frame_c::next_state() - frame processing done" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_measurement_request.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_measurement_request.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1363 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling received measurement request. +* +*/ + + +#include "core_operation_handle_measurement_request.h" +#include "core_frame_dot11_ie.h" +#include "core_frame_mgmt_ie.h" +#include "core_frame_rm_ie.h" +#include "core_frame_rm_ie_beacon_report.h" +#include "core_frame_rm_ie_beacon_report_ie.h" +#include "core_frame_rm_ie_beacon_report_frame_body_ie.h" +#include "core_frame_rm_ie_beacon_request.h" +#include "core_frame_rm_ie_beacon_request_ie.h" +#include "core_frame_rm_ie_beacon_request_detail_ie.h" +#include "core_frame_action_rm.h" +#include "core_tools.h" +#include "core_server.h" +#include "am_debug.h" +#include "core_am_tools.h" + +const u16_t PARSED_NONE = 0; +const u16_t MEASUREMENT_REQUEST_PARSED = 1; +const u16_t BEACON_REQUEST_PARSED = 2; +const u16_t SSID_IE_PARSED = 4; +const u16_t BRI_IE_PARSED = 8; +const u16_t BRD_IE_PARSED = 16; +const u16_t AP_CH_REP_IE_PARSED = 32; +const u16_t REQUEST_IE_PARSED = 64; +const u16_t SSID_IE_PARSING_FAILED = 128; +const u16_t BRI_IE_PARSING_FAILED = 256; +const u16_t BRD_IE_PARSING_FAILED = 512; +const u16_t AP_CH_REP_IE_PARSING_FAILED = 1024; +const u16_t REQUEST_IE_PARSING_FAILED = 2048; +const u16_t CATEGORY_ERROR_IND = 128; + +const u8_t BEACON_TABLE_REPORTED_FRAME_INFORMATION = 0xFF; +const u8_t ANTENNA_ID = 0x00; +const u8_t BEACON_TABLE_REGULATORY_CLASS = 0xFF; +const u16_t BEACON_TABLE_MEASUREMENT_DURATION = 0x0000; +const u8_t MEASUREMENT_REPORT_MODE_OK = 0x00; +const u8_t MEASUREMENT_REPORT_MODE_INCAPABLE = 0x02; +const u8_t MEASUREMENT_REPORT_MODE_REFUSED = 0x04; +const u8_t DURATION_MANDATORY = 0x10; + +const u8_t SCAN_ALL_CHANNELS_IN_REGULATORY_CLASS = 0x00; +const u8_t SCAN_ALL_CHANNELS_IN_AP_CH_REPORT = 0xFF; + +const u8_t REQUEST_IE_MAX_LENGTH = 237; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_measurement_request_c::core_operation_handle_measurement_request_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_action_rm_c* measurement_request ) : + core_operation_base_c( core_operation_handle_measurement_request, request_id, server, drivers, adaptation, + core_base_flag_none ), + measurement_request_m( measurement_request ), + parsed_mask_m( PARSED_NONE ), + current_ie_m( NULL ), + report_m ( NULL ), + meas_req_parser_m ( NULL ), + beacon_req_parser_m ( NULL ), + ssid_parser_m ( NULL ), + bri_parser_m ( NULL ), + brd_parser_m ( NULL ), + ap_ch_rep_parser_m ( NULL ), + request_ie_parser_m ( NULL ), + actual_measurement_duration_m ( 0 ) + { + DEBUG( "core_operation_handle_measurement_request_c::core_operation_handle_measurement_request_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_measurement_request_c::~core_operation_handle_measurement_request_c() + { + DEBUG( "core_operation_handle_measurement_request_c::~core_operation_handle_measurement_request_c()" ); + + server_m->unregister_event_handler( this ); + server_m->unregister_frame_handler( this ); + + ie_list_m.clear(); + + if ( measurement_request_m ) + { + delete measurement_request_m; + measurement_request_m = NULL; + } + + if ( current_ie_m ) + { + delete current_ie_m; + current_ie_m = NULL; + } + + if ( beacon_req_parser_m ) + { + delete beacon_req_parser_m; + beacon_req_parser_m = NULL; + } + + if ( meas_req_parser_m ) + { + delete meas_req_parser_m; + meas_req_parser_m = NULL; + } + + if ( ssid_parser_m ) + { + delete ssid_parser_m; + ssid_parser_m = NULL; + } + + if ( bri_parser_m ) + { + delete bri_parser_m; + bri_parser_m = NULL; + } + + if ( brd_parser_m ) + { + delete brd_parser_m; + brd_parser_m = NULL; + } + + if ( ap_ch_rep_parser_m ) + { + delete ap_ch_rep_parser_m; + ap_ch_rep_parser_m = NULL; + } + + if ( request_ie_parser_m ) + { + delete request_ie_parser_m; + request_ie_parser_m = NULL; + } + + if ( report_m ) + { + delete report_m; + report_m = NULL; + } + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_handle_measurement_request_c::next_state() + { + DEBUG( "core_operation_handle_measurement_request_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - core_state_init" ); + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + + status_m.set_da( measurement_request_m->source() ); + status_m.set_sa( server_m->own_mac_addr() ); + + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Request data layout" ); + DEBUG_BUFFER( measurement_request_m->data_length(), measurement_request_m->data() ); + + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - Dialog token: 0x%02X", + measurement_request_m->dialog_token() ); + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - Number of repetitions: 0x%04X", + measurement_request_m->nbr_of_repetitions() ); + + // validate measurement interval + if ( !validate_measurement_interval() ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Measurement Request coming too often, refusing request" ); + status_m.set_too_short_interval( true_t ); + } + + // loop through IEs + for ( core_frame_dot11_ie_c* ie = measurement_request_m->first_ie(); ie; ie = measurement_request_m->next_ie() ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Found IE:" ); + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - ID: 0x%02X", + ie->element_id() ); + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - Length: 0x%02X", + ie->length() ); + + ie_list_m.append( ie ); + } + + if ( ie_list_m.count() == 0 ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Measurement request didn't contain any IEs -> sending frame back" ); + + status_m.set_error_in_request( true_t ); + + return goto_state( core_state_create_negative_response ); + } + + return goto_state( core_state_get_next_ie ); + } + case core_state_get_next_ie: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - state core_state_get_next_ie" ); + + initialise_beacon_request_data(); + + if ( current_ie_m != NULL ) + { + // deallocate IE + delete current_ie_m; + current_ie_m = NULL; + } + + current_ie_m = ie_list_m.first(); + + if ( current_ie_m == NULL ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - All IEs processed" ); + + if ( report_m != NULL ) + { + // send created response + return goto_state( core_state_send_response ); + } + else + { + return goto_state( core_state_operation_finished ); + } + } + + // remove ie from list, it is now owned by current_ie_m + ie_list_m.remove ( current_ie_m ); + + return asynch_goto( core_state_process_current_ie ); + } + case core_state_process_current_ie: + { + if ( current_ie_m->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_measurement_req ) + { + // parse IE + parse( current_ie_m, parsed_mask_m ); + + // deallocate IE + delete current_ie_m; + current_ie_m = NULL; + + if ( status_m.error_in_request() == true_t ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Error in request, send frame back and stop further processing." ); + return goto_state( core_state_create_negative_response ); + } + + if ( status_m.refuse_request() == true_t ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Refusing request." ); + return goto_state( core_state_create_negative_response ); + } + + if ( status_m.too_short_interval() == true_t ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Too short request interval, refusing request." ); + status_m.set_refuse_request( true_t ); + return goto_state( core_state_create_negative_response ); + } + + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Going to core_state_make_measurement." ); + + return asynch_goto( core_state_make_measurement, get_random_delay() ); + } + + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Non-supported measurement request IE received, ignoring." ); + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Going to core_state_get_next_ie." ); + + return goto_state( core_state_get_next_ie ); + } + case core_state_make_measurement: + { + ASSERT( beacon_req_parser_m ); + + core_scan_mode_e scan_mode( core_scan_mode_active ); + actual_measurement_duration_m = get_channel_time( core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_active ); + core_ssid_s scan_ssid = get_ssid(); + + if ( ap_ch_rep_parser_m ) + { + core_scan_channels_c scan_channels = get_channels(); + status_m.set_scan_channels( scan_channels.channels() ); + } + + switch ( beacon_req_parser_m->measurement_mode() ) + { + case core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - beacon table measurement" ); + actual_measurement_duration_m = get_channel_time( core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon ); + return asynch_goto( core_state_create_response ); + } + case core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_active: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - issuing active scan request" ); + break; + } + case core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_passive: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - issuing passive scan request" ); + scan_mode = core_scan_mode_passive; + actual_measurement_duration_m = get_channel_time( core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_passive ); + break; + } + default: + { + // by default perform active mode measurement + break; + } + } + + u32_t ch_time( actual_measurement_duration_m ); + + DEBUG( "core_operation_handle_measurement_request_c::next_state() - issuing scan request:" ); + DEBUG1S( "core_operation_handle_measurement_request_c::next_state() - SSID: ", scan_ssid.length, &scan_ssid.ssid[0] ); +#ifdef _DEBUG + u16_t mask( 0 ); + core_tools_c::copy( + reinterpret_cast( &mask ), + &status_m.get_scan_channels().channels2dot4ghz[0], + sizeof( status_m.get_scan_channels().channels2dot4ghz ) ); +#endif // _DEBUG + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - channel mask: %013b", mask ); + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - min ch time: %u", ch_time ); + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - max ch time: %u", ch_time ); + + server_m->get_scan_list().remove_entries_by_age( + server_m->get_device_settings().scan_list_expiration_time ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_scan ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + scan_mode, + scan_ssid, + server_m->get_device_settings().scan_rate, + status_m.get_scan_channels(), + ch_time, + ch_time, + false_t ); + + operation_state_m = core_state_scan_start; + + return core_error_request_pending; + } + case core_state_scan_start: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - scan request completed, waiting for scan completion" ); + + break; + } + case core_state_create_response: + { + core_scan_list_tag_e tag( core_scan_list_tag_scan ); + if ( beacon_req_parser_m->measurement_mode() == core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon ) + { + tag = core_scan_list_tag_none; + } +#ifdef _DEBUG + server_m->get_scan_list().print_contents(); +#endif + core_scan_list_iterator_by_tag_c iter( + server_m->get_scan_list(), + tag ); + + bool_t no_match( true_t ); + + // loop through the scan list + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + if ( !match_found( *ap_data ) ) + { + // no match found, proceed to the next beacon/probe + continue; + } + + no_match = false_t; + + if ( !create_response( *ap_data ) ) + { + // create_response returns false_t only in out-of-memory situation + return core_error_no_memory; + } + } + + if ( no_match ) + { + create_negative_response_based_on_meas_report_mode( MEASUREMENT_REPORT_MODE_OK ); + } + + // check if more IEs need to be added to the report + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Going to core_state_get_next_ie." ); + + return goto_state( core_state_get_next_ie ); + } + case core_state_create_negative_response: + { + if ( !create_negative_response() ) + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - Unable to create response to request" ); + + // create_response returns false only in out-of-memory situation + return core_error_no_memory; + } + + return goto_state( core_state_send_response ); + } + case core_state_send_response: + { + DEBUG1( "core_operation_handle_measurement_request_c::next_state() - sending frame (%u bytes): ", + report_m->data_length() ); + DEBUG_BUFFER( + report_m->data_length(), + report_m->data() ); + + server_m->send_management_frame( + core_frame_type_dot11, + report_m->data_length(), + report_m->data(), + status_m.da() ); + + return goto_state( core_state_operation_finished ); + } + case core_state_operation_finished: + { + DEBUG( "core_operation_handle_measurement_request_c::next_state() - state core_state_operation_finished" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::add_to_report( + const core_frame_rm_ie_c* ie ) + { + DEBUG( "core_operation_handle_measurement_request_c::add_to_report()" ); + + if ( report_m == NULL ) + { + // instantiate response + report_m = core_frame_action_rm_c::instance( + 0, // Duration + status_m.da(), // Destination + status_m.sa(), // Source + status_m.da(), // BSSID + 0, // Sequence Control + core_frame_action_rm_c::core_dot11_action_rm_type_meas_resp, // Action Type + measurement_request_m->dialog_token(), // Dialog Token + ie ); // RM IE + + if ( report_m == NULL ) + { + // unable to instantiate response + return false_t; + } + } + else + { + report_m->append_ie( ie ); + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::parse( + core_frame_dot11_ie_c* ie, + u16_t& parsed_mask ) + { + DEBUG( "core_operation_handle_measurement_request_c::parse() - * Measurement Request IE received *" ); + + // refuse repetitive measurements + if ( measurement_request_m->nbr_of_repetitions() ) + { + DEBUG( "core_operation_handle_measurement_request_c::parse() - refusing repeated measurement" ); + status_m.set_refuse_request( true_t ); + } + + if ( meas_req_parser_m != NULL ) + { + delete meas_req_parser_m; + meas_req_parser_m = NULL; + } + + meas_req_parser_m = core_frame_rm_ie_c::instance( *ie ); + + if ( meas_req_parser_m ) + { + parsed_mask |= MEASUREMENT_REQUEST_PARSED; + + validate_measurement_request(); + + if ( meas_req_parser_m->measurement_type() == core_frame_rm_ie_c::core_frame_rm_ie_action_type_beacon_request ) + { + // instantiate a parser for beacon request + if ( beacon_req_parser_m != NULL ) + { + delete beacon_req_parser_m; + beacon_req_parser_m = NULL; + } + beacon_req_parser_m = core_frame_rm_ie_beacon_request_c::instance( *meas_req_parser_m ); + + validate_beacon_request(); + + if ( beacon_req_parser_m ) + { + parsed_mask |= BEACON_REQUEST_PARSED; + + // loop through IEs + for ( core_frame_dot11_ie_c* beacon_req_ie = beacon_req_parser_m->first_ie(); beacon_req_ie; beacon_req_ie = beacon_req_parser_m->next_ie() ) + { + DEBUG1( "core_operation_handle_measurement_request_c::parse() - 802.11k Beacon Request IE ID: 0x%02X", + beacon_req_ie->element_id() ); + DEBUG1( "core_operation_handle_measurement_request_c::parse() - 802.11k Beacon Request IE length: 0x%02X", + beacon_req_ie->length() ); + + if ( beacon_req_ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ssid ) + { + // instantiate a parser for ssid + if ( ssid_parser_m != NULL ) + { + delete ssid_parser_m; + ssid_parser_m = NULL; + } + DEBUG( "core_operation_handle_measurement_request_c::parse() - *** SSID Sub-element ***" ); + + ssid_parser_m = core_frame_mgmt_ie_ssid_c::instance( *beacon_req_ie ); + if ( ssid_parser_m ) + { + parsed_mask |= SSID_IE_PARSED; + const core_ssid_s ssid = ssid_parser_m->ssid(); + if ( ssid.length != 0 ) + { + DEBUG1S( "core_operation_handle_measurement_request_c::parse() - SSID: ", ssid.length, &ssid.ssid[0] ); + } + else + { + DEBUG( "core_operation_handle_measurement_request_c::parse() - SSID: " ); + } + } + else + { + parsed_mask |= SSID_IE_PARSING_FAILED; + status_m.set_error_in_request( true_t ); + } + } + else if ( beacon_req_ie->element_id() == core_frame_rm_ie_beacon_request_c::core_frame_rm_ie_beacon_request_element_id_beacon_reporting_information ) + { + DEBUG( "core_operation_handle_measurement_request_c::parse() - *** Beacon Reporting Information Sub-element ***" ); + // instantiate a parser for BRI + if ( bri_parser_m != NULL ) + { + delete bri_parser_m; + bri_parser_m = NULL; + } + bri_parser_m = core_frame_rm_ie_beacon_request_ie_c::instance( *beacon_req_ie ); + if ( bri_parser_m ) + { + validate_beacon_reporting_information(); + parsed_mask |= BRI_IE_PARSED; + } + else + { + parsed_mask |= BRI_IE_PARSING_FAILED; + status_m.set_error_in_request( true_t ); + } + } + else if ( beacon_req_ie->element_id() == core_frame_rm_ie_beacon_request_c::core_frame_rm_ie_beacon_request_element_id_beacon_reporting_detail ) + { + DEBUG( "core_operation_handle_measurement_request_c::parse() - *** Beacon Reporting Detail Sub-element ***" ); + // instantiate a parser for BRD + if ( brd_parser_m != NULL ) + { + delete brd_parser_m; + brd_parser_m = NULL; + } + brd_parser_m = core_frame_rm_ie_beacon_request_detail_ie_c::instance( *beacon_req_ie ); + if ( brd_parser_m ) + { + validate_beacon_reporting_detail(); + parsed_mask |= BRD_IE_PARSED; + } + else + { + parsed_mask |= BRD_IE_PARSING_FAILED; + status_m.set_error_in_request( true_t ); + } + } + else if ( beacon_req_ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_request ) + { + // instantiate a parser for request information element + if ( request_ie_parser_m != NULL ) + { + delete request_ie_parser_m; + request_ie_parser_m = NULL; + } + DEBUG( "core_operation_handle_measurement_request_c::parse() - *** Request Sub-element ***" ); + + request_ie_parser_m = core_frame_mgmt_ie_request_ie_c::instance( *beacon_req_ie ); + if ( request_ie_parser_m ) + { + parsed_mask |= REQUEST_IE_PARSED; + } + else + { + parsed_mask |= REQUEST_IE_PARSING_FAILED; + status_m.set_error_in_request( true_t ); + } + } + else if ( beacon_req_ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_ap_channel_report ) + { + // instantiate a parser for ap channel report + if ( ap_ch_rep_parser_m != NULL ) + { + delete ap_ch_rep_parser_m; + ap_ch_rep_parser_m = NULL; + } + DEBUG( "core_operation_handle_measurement_request_c::parse() - *** AP Channel Report Sub-element ***" ); + + ap_ch_rep_parser_m = core_frame_mgmt_ie_ap_channel_report_c::instance( *beacon_req_ie ); + if ( ap_ch_rep_parser_m ) + { + parsed_mask |= AP_CH_REP_IE_PARSED; + } + else + { + parsed_mask |= AP_CH_REP_IE_PARSING_FAILED; + status_m.set_error_in_request( true_t ); + } + } + + delete beacon_req_ie; + beacon_req_ie = NULL; + } + } + } + else + { + // Incapable measurement request + create_negative_response_based_on_meas_report_mode( MEASUREMENT_REPORT_MODE_INCAPABLE ); + } + } + else + { + status_m.set_error_in_request( true_t ); + } + + DEBUG( "core_operation_handle_measurement_request_c::parse() - parsed_mask:" ); + DEBUG1( "core_operation_handle_measurement_request_c::parse() - %012b", parsed_mask ); + DEBUG( "core_operation_handle_measurement_request_c::parse() - ||||||||||||" ); + DEBUG( "core_operation_handle_measurement_request_c::parse() - |||||||||||+--MEASUREMENT_REQUEST_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - ||||||||||+---BEACON_REQUEST_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - |||||||||+----SSID_IE_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - ||||||||+-----BRI_IE_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - |||||||+------BRD_IE_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - ||||||+-------AP_CH_REP_IE_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - |||||+--------REQUEST_IE_PARSED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - ||||+---------SSID_IE_PARSING_FAILED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - |||+----------BRI_IE_PARSING_FAILED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - ||+-----------BRD_IE_PARSING_FAILED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - |+------------AP_CH_REP_IE_PARSING_FAILED"); + DEBUG( "core_operation_handle_measurement_request_c::parse() - +-------------REQUEST_IE_PARSING_FAILED"); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::create_negative_response() + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response()" ); + + bool_t result( false_t ); + + if ( status_m.error_in_request() ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response() - Error in request, send it back and stop further processing." ); + + result = create_response_to_invalid_request(); + } + else if ( status_m.refuse_request() ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response() - Refusing to make the requested measurement" ); + + result = create_negative_response_based_on_meas_report_mode( MEASUREMENT_REPORT_MODE_REFUSED ); + } + else + { + ASSERT( 0 ); + } + + return result; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::create_negative_response_based_on_meas_report_mode( + u8_t measurement_report_mode ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response_based_on_meas_report_mode()" ); + + bool_t result( false_t ); + + // create IE with no sub-elements + core_frame_rm_ie_c* rm_report = core_frame_rm_ie_c::instance( + meas_req_parser_m->measurement_token(), + measurement_report_mode, + meas_req_parser_m->measurement_type() ); + if ( rm_report ) + { + result = add_to_report( rm_report ); + + delete rm_report; + rm_report = NULL; + + return result; + } + + if ( measurement_report_mode == MEASUREMENT_REPORT_MODE_REFUSED ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response_based_on_meas_report_mode() - Unable to instantiate core_frame_rm_ie_parameter_c" ); + } + else if ( measurement_report_mode == MEASUREMENT_REPORT_MODE_OK ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response_based_on_meas_report_mode() - Unable to instantiate core_frame_rm_ie_parameter_c" ); + } + else if ( measurement_report_mode == MEASUREMENT_REPORT_MODE_INCAPABLE ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_negative_response_based_on_meas_report_mode() - Incapable measurement request, unable to instantiate core_frame_rm_ie_parameter_c" ); + } + + return result; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::create_response_to_invalid_request() + { + DEBUG( "core_operation_handle_measurement_request_c::create_response_to_invalid_request()" ); + + ASSERT( !report_m ); + + // send the received frame back + report_m = core_frame_action_c::instance( *measurement_request_m ); + + if ( report_m ) + { + // set the MSB of the Category field to 1 to indicate error situation + // Ref. 7.3.1.11 Action field + report_m->set_category( report_m->category() + CATEGORY_ERROR_IND ); + + // switch DA and SA + report_m->set_source( status_m.da() ); + report_m->set_destination( status_m.sa() ); + + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::validate_beacon_request() + { + if ( !beacon_req_parser_m ) + { + DEBUG( "core_operation_handle_measurement_request_c::validate_beacon_request() - no beacon request element present, refusing measurement" ); + status_m.set_refuse_request( true_t ); + return; + } + + if ( beacon_req_parser_m->measurement_mode() > core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon ) + { + DEBUG1( "core_operation_handle_measurement_request_c::validate_beacon_request() - unknown Measurement Mode %u", + beacon_req_parser_m->measurement_mode() ); + status_m.set_error_in_request( true_t ); + } + + if ( beacon_req_parser_m->measurement_mode() != core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon && + ( meas_req_parser_m->measurement_request_mode() & DURATION_MANDATORY ) && + ( ( beacon_req_parser_m->measurement_mode() == core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_active && + beacon_req_parser_m->measurement_duration() > server_m->get_device_settings().active_scan_max_ch_time ) || + ( beacon_req_parser_m->measurement_mode() == core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_passive && + beacon_req_parser_m->measurement_duration() > server_m->get_device_settings().passive_scan_max_ch_time ) ) ) + { + DEBUG( "core_operation_handle_measurement_request_c::validate_beacon_request() - too big measurement duration requested, refusing request" ); + status_m.set_refuse_request( true_t ); + } + + if ( beacon_req_parser_m->measurement_mode() != core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon && + server_m->get_connection_data()->voice_call_state() == true_t ) + { + DEBUG( "core_operation_handle_measurement_request_c::validate_beacon_request() - non-Beacon Table Mode requested and voice call on, refusing request" ); + status_m.set_refuse_request( true_t ); + } + + if ( !validate_scan_channels() ) + { + DEBUG( "core_operation_handle_measurement_request_c::validate_beacon_request() - invalid scan channels, refusing request" ); + status_m.set_refuse_request( true_t ); + } + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::validate_beacon_reporting_information() + { + if ( bri_parser_m->reporting_condition() != core_frame_rm_ie_beacon_request_ie_c::core_frame_rm_ie_bri_reporting_condition_default ) + { + DEBUG1( "core_operation_handle_measurement_request_c::validate_beacon_reporting_information() - reporting condition 0x%02X not supported", + bri_parser_m->reporting_condition() ); + status_m.set_refuse_request( true_t ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::validate_beacon_reporting_detail() + { + if ( brd_parser_m->reporting_detail() != core_frame_rm_ie_beacon_request_detail_ie_c::core_frame_rm_ie_brd_reporting_detail_no_fields_or_elements && + brd_parser_m->reporting_detail() != core_frame_rm_ie_beacon_request_detail_ie_c::core_frame_rm_ie_brd_reporting_detail_fields_and_requested_elements && + brd_parser_m->reporting_detail() != core_frame_rm_ie_beacon_request_detail_ie_c::core_frame_rm_ie_brd_reporting_detail_default ) + { + DEBUG1( "core_operation_handle_measurement_request_c::validate_beacon_reporting_detail() - reporting detail 0x%02X not supported", + brd_parser_m->reporting_detail() ); + status_m.set_refuse_request( true_t ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::validate_measurement_interval() + { + u64_t previous_timestamp = server_m->get_connection_data()->get_previous_rrm_measurement_request_time(); + u64_t current_timestamp = core_am_tools_c::timestamp(); + + if ( previous_timestamp ) + { + u32_t min_interval = server_m->get_device_settings().rrm_min_measurement_interval; + + DEBUG1( "core_operation_handle_measurement_request_c::validate_measurement_interval() - min. interval in seconds: %u", + server_m->get_device_settings().rrm_min_measurement_interval / SECONDS_FROM_MICROSECONDS ); + + DEBUG1( "core_operation_handle_measurement_request_c::validate_measurement_interval() - seconds since previous request: %u", + static_cast ( ( current_timestamp - previous_timestamp ) / SECONDS_FROM_MICROSECONDS ) ); + + if ( min_interval && ( previous_timestamp + min_interval >= current_timestamp ) ) + { + // interval is too short + return false_t; + } + } + + server_m->get_connection_data()->set_previous_rrm_measurement_request_time( current_timestamp ); + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::validate_measurement_request() + { + if ( meas_req_parser_m->measurement_type() != core_frame_rm_ie_c::core_frame_rm_ie_action_type_beacon_request ) + { + DEBUG1( "core_operation_handle_measurement_request_c::validate_measurement_request() - non-supported Measurement Type 0x%02X", + meas_req_parser_m->measurement_type() ); + status_m.set_refuse_request( true_t ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ) + { + if ( frame->type() != core_frame_dot11_c::core_dot11_type_beacon && + frame->type() != core_frame_dot11_c::core_dot11_type_probe_resp ) + { + DEBUG( "core_operation_handle_measurement_request_c::receive_frame() - not a beacon or a probe" ); + return false_t; + } + + core_ap_data_c* ap_data = core_ap_data_c::instance( + server_m->get_wpx_adaptation_instance(), + frame, + rcpi, + false_t ); + + if ( ap_data ) + { + const core_ssid_s ssid = ap_data->ssid(); + DEBUG1S( "core_operation_handle_measurement_request_c::receive_frame() - SSID: ", + ssid.length, &ssid.ssid[0] ); + + core_mac_address_s bssid( + ap_data->bssid() ); + DEBUG6( "core_operation_handle_measurement_request_c::receive_frame() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + server_m->get_scan_list().update_entry( *ap_data ); + + delete ap_data; + ap_data = NULL; + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::notify( + core_am_indication_e indication ) + { + if ( operation_state_m == core_state_scan_start && + indication == core_am_indication_wlan_scan_complete ) + { + server_m->unregister_event_handler( this ); + server_m->unregister_frame_handler( this ); + + DEBUG( "core_operation_handle_measurement_request_c::notify() - scan complete" ); + + asynch_goto( core_state_create_response, CORE_TIMER_IMMEDIATELY ); + + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::validate_scan_channels() + { + core_scan_channels_c scan_channels; + + switch ( beacon_req_parser_m->channel_number() ) + { + case SCAN_ALL_CHANNELS_IN_REGULATORY_CLASS: + { + DEBUG( "core_operation_handle_measurement_request_c::validate_scan_channels() - scan all channels in Regulatory Class" ); + scan_channels.set( SCAN_CHANNELS_2DOT4GHZ_ETSI ); + break; + } + case SCAN_ALL_CHANNELS_IN_AP_CH_REPORT: + { + DEBUG( "core_operation_handle_measurement_request_c::validate_scan_channels() - scan all channels from the AP Channel report" ); + scan_channels.set( server_m->get_connection_data()->current_ap_data()->ap_channel_report() ); + + if ( scan_channels.is_empty( SCAN_BAND_2DOT4GHZ ) ) + { + DEBUG( "core_operation_handle_measurement_request_c::validate_scan_channels() - No AP Channel report available, using full mask" ); + scan_channels.set( SCAN_CHANNELS_2DOT4GHZ_ETSI ); + } + break; + } + default: + { + DEBUG1( "core_operation_handle_measurement_request_c::validate_scan_channels() - scan channel %u", + beacon_req_parser_m->channel_number() ); + scan_channels.add( SCAN_BAND_2DOT4GHZ, beacon_req_parser_m->channel_number() ); + break; + } + } + + scan_channels.set( server_m->get_core_settings().valid_scan_channels( scan_channels.channels() ) ); + + if ( scan_channels.is_empty( SCAN_BAND_2DOT4GHZ ) ) + { + DEBUG( "core_operation_handle_measurement_request_c::validate_scan_channels() - no valid channels after check" ); + return false_t; + } + + status_m.set_scan_channels( scan_channels.channels() ); + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_operation_handle_measurement_request_c::get_channel_time( + core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_e measurement_mode ) + { + u16_t ch_time( static_cast ( server_m->get_device_settings().active_scan_max_ch_time ) ); + u16_t min_ch_time( static_cast ( server_m->get_device_settings().active_scan_min_ch_time ) ); + + switch( measurement_mode ) + { + case core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_passive: + { + ch_time = static_cast ( server_m->get_device_settings().passive_scan_max_ch_time ); + min_ch_time = static_cast ( server_m->get_device_settings().passive_scan_min_ch_time ); + break; + } + case core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon: + { + ch_time = BEACON_TABLE_MEASUREMENT_DURATION; + min_ch_time = BEACON_TABLE_MEASUREMENT_DURATION; + break; + } + case core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_active: // flow-through on purpose + default: + { + // active mode set above by default + } + } + + if ( beacon_req_parser_m ) + { + if ( beacon_req_parser_m->measurement_duration() > min_ch_time && + beacon_req_parser_m->measurement_duration() < ch_time ) + { + ch_time = beacon_req_parser_m->measurement_duration(); + } + } + + return ch_time; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ssid_s core_operation_handle_measurement_request_c::get_ssid() + { + core_ssid_s ssid = BROADCAST_SSID; + if ( ssid_parser_m ) + { + ssid = ssid_parser_m->ssid(); + } + return ssid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_c core_operation_handle_measurement_request_c::get_channels() + { + core_scan_channels_c channels; + u8_t channel( 0 ); + + if ( ap_ch_rep_parser_m ) + { + for( u16_t i=0; i < (ap_ch_rep_parser_m->data_length() - CORE_FRAME_MGMT_IE_AP_CHANNEL_REPORT_CHANNEL_OFFSET); i++ ) + { + channel = ap_ch_rep_parser_m->ap_channel_report_channel( i ); + channels.add( SCAN_BAND_2DOT4GHZ, channel ); + } + } + return channels; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::match_found( core_ap_data_c& ap_data ) + { + bool_t ssid_match_found( false_t ); + bool_t bssid_match_found( false_t ); + + if ( ssid_parser_m ) + { + const core_ssid_s ap_ssid = ap_data.ssid(); + const core_ssid_s request_ssid = ssid_parser_m->ssid(); + + if ( request_ssid == ap_ssid ) + { + DEBUG( "core_operation_handle_measurement_request_c::match_found() - ssid matches" ); + ssid_match_found = true_t; + } + } + else + { + ssid_match_found = true_t; + } + + ASSERT( beacon_req_parser_m ); + + const core_mac_address_s request_bssid = beacon_req_parser_m->bssid(); + const core_mac_address_s ap_bssid = ap_data.bssid(); + + const core_mac_address_s broadcast_bssid = BROADCAST_MAC_ADDR; + + if ( broadcast_bssid != request_bssid ) + { + if ( request_bssid == ap_bssid ) + { + DEBUG( "core_operation_handle_measurement_request_c::match_found() - bssid matches" ); + bssid_match_found = true_t; + } + } + else + { + bssid_match_found = true_t; + } + + return ( ssid_match_found && bssid_match_found ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_handle_measurement_request_c::create_response( + core_ap_data_c& ap_data ) + { + core_frame_rm_ie_beacon_report_frame_body_ie_c* frame_body_ie = NULL; + + if ( brd_parser_m ) + { + if ( brd_parser_m->reporting_detail() == core_frame_rm_ie_beacon_request_detail_ie_c::core_frame_rm_ie_brd_reporting_detail_fields_and_requested_elements ) + { + if ( request_ie_parser_m ) + { + u8_t ie_id_list[REQUEST_IE_MAX_LENGTH] = { 0 }; + u8_t ie_id_list_length = request_ie_parser_m->element_list( ie_id_list ); + + frame_body_ie = core_frame_rm_ie_beacon_report_frame_body_ie_c::instance( + ap_data, + ie_id_list, + ie_id_list_length ); + } + + if ( frame_body_ie == NULL ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Unable to instantiate core_frame_rm_ie_beacon_report_frame_body_ie_c" ); + return false_t; + } + + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Reported Frame Body data layout" ); + DEBUG_BUFFER( frame_body_ie->data_length(), frame_body_ie->data() ); + + } + else if ( brd_parser_m->reporting_detail() == core_frame_rm_ie_beacon_request_detail_ie_c::core_frame_rm_ie_brd_reporting_detail_default ) + { + frame_body_ie = core_frame_rm_ie_beacon_report_frame_body_ie_c::instance( + ap_data ); + + if ( frame_body_ie == NULL ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Unable to instantiate core_frame_rm_ie_beacon_report_frame_body_ie_c" ); + return false_t; + } + + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Reported Frame Body data layout" ); + DEBUG_BUFFER( frame_body_ie->data_length(), frame_body_ie->data() ); + } + } + else + { + frame_body_ie = core_frame_rm_ie_beacon_report_frame_body_ie_c::instance( + ap_data ); + + if ( frame_body_ie == NULL ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Unable to instantiate core_frame_rm_ie_beacon_report_frame_body_ie_c" ); + return false_t; + } + + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Reported Frame Body data layout" ); + DEBUG_BUFFER( frame_body_ie->data_length(), frame_body_ie->data() ); + } + + core_frame_rm_ie_beacon_report_ie_c* ie = core_frame_rm_ie_beacon_report_ie_c::instance( + BEACON_TABLE_REGULATORY_CLASS, + actual_measurement_duration_m, + BEACON_TABLE_REPORTED_FRAME_INFORMATION, + ANTENNA_ID, + ap_data ); + + if ( ie == NULL ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Unable to instantiate core_frame_rm_ie_beacon_report_ie_c" ); + return false_t; + } + + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Beacon Report data layout" ); + DEBUG_BUFFER( ie->length(), ie->data() ); + + // create beacon report ie + core_frame_rm_ie_beacon_report_c* beacon_report_ie = NULL; + + if ( frame_body_ie != NULL ) + { + beacon_report_ie = core_frame_rm_ie_beacon_report_c::instance( + beacon_req_parser_m->measurement_token(), + MEASUREMENT_REPORT_MODE_OK, + ie, + frame_body_ie ); + } + else + { + beacon_report_ie = core_frame_rm_ie_beacon_report_c::instance( + beacon_req_parser_m->measurement_token(), + MEASUREMENT_REPORT_MODE_OK, + ie ); + } + + delete ie; + ie = NULL; + + if ( frame_body_ie ) + { + delete frame_body_ie; + frame_body_ie = NULL; + } + + if ( beacon_report_ie == NULL ) + { + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Unable to instantiate core_frame_rm_ie_beacon_report_c" ); + return false_t; + } + + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Measurement Report data layout" ); + DEBUG_BUFFER( beacon_report_ie->data_length(), beacon_report_ie->data() ); + + if ( !add_to_report( beacon_report_ie ) ) + { + // add_to_report returns NULL only in out-of-memory situation + DEBUG( "core_operation_handle_measurement_request_c::create_response() - Unable to create response to request" ); + + // deallocate IE + delete beacon_report_ie; + beacon_report_ie = NULL; + + return false_t; + } + + DEBUG( "core_operation_handle_measurement_request_c::create_response() - dot11 frame data layout" ); + DEBUG_BUFFER( report_m->data_length(), report_m->data() ); + + // deallocate IE + delete beacon_report_ie; + beacon_report_ie = NULL; + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::initialise_beacon_request_data() + { + DEBUG( "core_operation_handle_measurement_request_c::initialise_beacon_request_data()" ); + + parsed_mask_m = MEASUREMENT_REQUEST_PARSED; + actual_measurement_duration_m = 0; + status_m.set_error_in_request( false_t ); + status_m.set_refuse_request( false_t ); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_operation_handle_measurement_request_c::get_random_delay() + { + u32_t delay_in_us( 0 ); + + if ( beacon_req_parser_m != NULL && + beacon_req_parser_m->randomization_interval() != 0 && + beacon_req_parser_m->measurement_mode() != core_frame_rm_ie_beacon_request_c::core_beacon_request_scan_mode_beacon ) + { + u32_t delay_in_tus = core_am_tools_c::random() % beacon_req_parser_m->randomization_interval(); + DEBUG1( "core_operation_handle_measurement_request_c::get_random_delay() - random delay in TUs: %u", delay_in_tus ); + delay_in_us = delay_in_tus * TIMEUNITS_FROM_MICROSECONDS; + } + + DEBUG1( "core_operation_handle_measurement_request_c::get_random_delay() - random delay in us: %u", delay_in_us ); + + return delay_in_us; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_measurement_request_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG1( "core_operation_handle_measurement_request_c::user_cancel(do_graceful_cancel=%d)", do_graceful_cancel ); + + if ( !do_graceful_cancel ) + { + /** + * If we are in a middle of a scan, we have to schedule our own + * event. + */ + if ( operation_state_m == core_operation_handle_measurement_request_c::core_state_scan_start && + server_m->event_handler() == this && + server_m->frame_handler() == this ) + { + asynch_default_user_cancel(); + + return; + } + + /** + * Everything else is handled by the default implementation. + */ + core_operation_base_c::user_cancel( do_graceful_cancel ); + } + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_neighbor_response.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_handle_neighbor_response.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for handling received neighbor response. +* +*/ + + +#include "core_operation_handle_neighbor_response.h" +#include "core_frame_dot11_ie.h" +#include "core_frame_mgmt_ie.h" +#include "core_frame_nr_ie.h" +#include "core_frame_action_nr.h" +#include "core_tools.h" +#include "core_server.h" +#include "am_debug.h" + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_neighbor_response_c::core_operation_handle_neighbor_response_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_action_nr_c* neighbor_response ) : + core_operation_base_c( core_operation_handle_neighbor_response, request_id, server, drivers, adaptation, + core_base_flag_none ), + neighbor_response_m( neighbor_response ), + current_ie_m( NULL ), + neighbor_resp_parser_m ( NULL ) + { + DEBUG( "core_operation_handle_neighbor_response_c::core_operation_handle_neighbor_response_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_handle_neighbor_response_c::~core_operation_handle_neighbor_response_c() + { + DEBUG( "core_operation_handle_neighbor_response_c::~core_operation_handle_neighbor_response_c()" ); + + ie_list_m.clear(); + + if ( neighbor_response_m ) + { + delete neighbor_response_m; + neighbor_response_m = NULL; + } + + if ( current_ie_m ) + { + delete current_ie_m; + current_ie_m = NULL; + } + + if ( neighbor_resp_parser_m ) + { + delete neighbor_resp_parser_m; + neighbor_resp_parser_m = NULL; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_handle_neighbor_response_c::next_state() + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - core_state_init" ); + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + + DEBUG1( "core_operation_handle_neighbor_response_c::next_state() - Dialog token: 0x%02X", + neighbor_response_m->dialog_token() ); + + // loop through IEs + for ( core_frame_dot11_ie_c* ie = neighbor_response_m->first_ie(); ie; ie = neighbor_response_m->next_ie() ) + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - Found IE:" ); + DEBUG1( "core_operation_handle_neighbor_response_c::next_state() - ID: 0x%02X", + ie->element_id() ); + DEBUG1( "core_operation_handle_neighbor_response_c::next_state() - Length: 0x%02X", + ie->length() ); + + ie_list_m.append( ie ); + } + + if ( ie_list_m.count() == 0 ) + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - Neighbor response didn't contain any IEs" ); + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - Going to core_state_operation_finished." ); + + return goto_state( core_state_operation_finished ); + } + + return goto_state( core_state_get_next_ie ); + } + case core_state_get_next_ie: + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - state core_state_get_next_ie" ); + + if ( current_ie_m != NULL ) + { + // deallocate IE + delete current_ie_m; + current_ie_m = NULL; + } + + current_ie_m = ie_list_m.first(); + + if ( current_ie_m == NULL ) + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - All IEs processed" ); + return goto_state( core_state_operation_finished ); + } + + // remove ie from list, it is now owned by current_ie_m + ie_list_m.remove ( current_ie_m ); + + return asynch_goto( core_state_process_current_ie ); + } + case core_state_process_current_ie: + { + if ( current_ie_m->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_neighbor_report ) + { + // parse IE + parse( current_ie_m ); + + // deallocate IE + delete current_ie_m; + current_ie_m = NULL; + } + + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - Going to core_state_get_next_ie." ); + + return goto_state( core_state_get_next_ie ); + } + case core_state_operation_finished: + { + DEBUG( "core_operation_handle_neighbor_response_c::next_state() - state core_state_operation_finished" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_handle_neighbor_response_c::parse( + core_frame_dot11_ie_c* ie ) + { + DEBUG( "core_operation_handle_neighbor_response_c::parse() - * Neighbor Report Response IE received *" ); + + if ( neighbor_resp_parser_m != NULL ) + { + delete neighbor_resp_parser_m; + neighbor_resp_parser_m = NULL; + } + + neighbor_resp_parser_m = core_frame_nr_ie_c::instance( *ie ); + + if ( neighbor_resp_parser_m ) + { + core_mac_address_s a = neighbor_resp_parser_m->bssid(); + DEBUG6( "core_operation_handle_neighbor_response_c::parse() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + a.addr[0],a.addr[1],a.addr[2],a.addr[3],a.addr[4],a.addr[5] ); + DEBUG1( "core_operation_handle_neighbor_response_c::parse() - BSSID Information: 0x%08X", + neighbor_resp_parser_m->bssid_info() ); + DEBUG1( "core_operation_handle_neighbor_response_c::parse() - Regulatory Class: 0x%02X", + neighbor_resp_parser_m->regulatory_class() ); + DEBUG1( "core_operation_handle_neighbor_response_c::parse() - Channel Number: 0x%02X", + neighbor_resp_parser_m->channel_number() ); + DEBUG1( "core_operation_handle_neighbor_response_c::parse() - PHY Type: 0x%02X", + neighbor_resp_parser_m->phy_type() ); + + core_scan_channels_c channels; + + if ( server_m->get_core_settings().is_valid_channel( + SCAN_BAND_2DOT4GHZ, + neighbor_resp_parser_m->channel_number() ) ) + { + channels.add( + SCAN_BAND_2DOT4GHZ, + neighbor_resp_parser_m->channel_number() ); + } + else + { + DEBUG( "core_operation_handle_neighbor_response_c::parse() - channel doesn't match the current regional domain, ignoring." ); + } + + DEBUG1( "core_operation_handle_neighbor_response_c::parse() - adding the current channel %u", + server_m->get_connection_data()->current_ap_data()->channel() ); + channels.add( + SCAN_BAND_2DOT4GHZ, + server_m->get_connection_data()->current_ap_data()->channel() ); + server_m->get_connection_data()->merge_adjacent_ap_channels( + channels ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_ibss_merge.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_ibss_merge.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for merging existing IBSS (ad hoc) network to another one +* +*/ + +/* +* %version: 16 % +*/ + +#include "core_operation_ibss_merge.h" +#include "core_operation_roam.h" +#include "core_tools_parser.h" +#include "core_ap_data.h" +#include "core_tools.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_ibss_merge_c::core_operation_ibss_merge_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_frame_dot11_c* frame ) : + core_operation_base_c( core_operation_ibss_merge, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed | core_base_flag_connection_needed ), + frame_m( frame ), + is_connected_m( true_t ) + { + DEBUG( "core_operation_ibss_merge_c::core_operation_ibss_merge_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_ibss_merge_c::~core_operation_ibss_merge_c() + { + DEBUG( "core_operation_ibss_merge_c::~core_operation_ibss_merge_c()" ); + frame_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_ibss_merge_c::next_state() + { + DEBUG( "core_operation_ibss_merge_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + core_ap_data_c* ap_data = core_ap_data_c::instance( + server_m->get_wpx_adaptation_instance(), + frame_m, + 0, + false_t ); + + if ( !ap_data ) + { + DEBUG( "core_operation_ibss_merge_c::next_state() - unable to instantiate core_ap_data_c" ); + return cancel(); + } + + server_m->get_scan_list().set_tag( + core_scan_list_tag_ibss_merge ); + + server_m->get_scan_list().update_entry( *ap_data ); + + if ( core_tools_parser_c::is_ap_compatible_with_iap( + server_m->get_wpx_adaptation_instance(), + *ap_data, + server_m->get_connection_data()->iap_data(), + server_m->get_core_settings() ) != core_connect_ok ) + { + delete ap_data; + ap_data = NULL; + + DEBUG( "core_operation_ibss_merge_c::next_state() - IBSS merge not possible, network settings do not match the IAP" ); + return cancel(); + } + + if ( !server_m->get_core_settings().is_valid_channel( + ap_data->band(), + ap_data->channel() ) ) + { + delete ap_data; + ap_data = NULL; + + DEBUG( "core_operation_ibss_merge_c::next_state() - IBSS merge not possible, invalid channel" ); + return cancel(); + } + + delete ap_data; + ap_data = NULL; + + operation_state_m = core_state_merge_done; + + DEBUG( "core_operation_ibss_merge_c::next_state() - trying an IBSS merge" ); + + core_operation_base_c* operation = new core_operation_roam_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + core_scan_list_tag_ibss_merge, + RCPI_VALUE_NONE, + MEDIUM_TIME_NOT_DEFINED, + server_m->get_connection_data()->ssid(), + BROADCAST_MAC_ADDR ); + + return run_sub_operation( operation ); + } + case core_state_merge_done: + { + DEBUG( "core_operation_ibss_merge_c::next_state() - IBSS merge done successfully" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_null.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_null.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for null operation (does nothing) +* +*/ + + +#include "core_operation_null.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_null_c::core_operation_null_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_error_e status ) : + core_operation_base_c( core_operation_null, request_id, server, drivers, adaptation, + core_base_flag_none ), + status_m( status ) + { + DEBUG( "core_operation_null_c::core_operation_null_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_null_c::~core_operation_null_c() + { + DEBUG( "core_operation_null_c::~core_operation_null_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_null_c::next_state() + { + DEBUG( "core_operation_null_c::next_state()" ); + DEBUG1( "core_operation_null_c::next_state() - completing request with %u", + status_m ); + + return status_m; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_power_save_test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_power_save_test.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for running an echo test in power save. +* +*/ + + +#include "core_operation_power_save_test.h" +#include "core_operation_update_power_mode.h" +#include "core_sub_operation_echo_test.h" +#include "core_tools.h" +#include "core_server.h" +#include "am_debug.h" + +/** The maximum amount of times a particular echo frame is re-sent. */ +const u8_t CORE_MAX_POWER_SAVE_TEST_RETRY_COUNT = 3; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_power_save_test_c::core_operation_power_save_test_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_power_save_test, request_id, server, drivers, adaptation, + core_base_flag_connection_needed | core_base_flag_only_one_instance ), + current_ap_m( NULL ), + return_status_m( core_error_ok ), + is_power_save_m( true_t ), + is_unicast_test_on_m( true_t ) + { + DEBUG( "core_operation_power_save_test_c::core_operation_power_save_test_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_power_save_test_c::~core_operation_power_save_test_c() + { + DEBUG( "core_operation_power_save_test_c::~core_operation_power_save_test_c()" ); + + current_ap_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_power_save_test_c::next_state() + { + DEBUG( "core_operation_power_save_test_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + DEBUG( "core_operation_power_save_test_c::next_state() core_state_init" ); + if( !server_m->get_core_settings().is_driver_loaded() || + !server_m->get_connection_data() || + !server_m->get_connection_data()->current_ap_data() ) + { + DEBUG( "core_operation_power_save_test_c::next_state() - not connected, no reason to run the power save test" ); + + return core_error_not_supported; + } + + current_ap_m = server_m->get_connection_data()->current_ap_data(); + core_mac_address_s bssid( + current_ap_m->bssid() ); + + /** + * If this AP has already been tested, do not test it again. + */ + bool_t is_success( true_t ); + if( server_m->get_connection_data()->is_ap_power_save_test_run( + bssid, + is_success ) ) + { + DEBUG1( "core_operation_power_save_test_c::next_state() - AP already tested (verdict %u)", + is_success ); + + return core_error_ok; + } + + /** + * If the feature isn't enabled, pretend the test succeeded. + */ + if( !server_m->get_core_settings().is_feature_enabled( + core_feature_power_save_test ) ) + { + return goto_state( core_state_reset_power_mode ); + } + + /** + * Set the phone to wake up on every DTIM. + */ + core_operation_base_c* operation = new core_operation_update_power_mode_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + CORE_POWER_SAVE_MODE_EVERY_DTIM ); + + return run_sub_operation( operation, core_state_echo_test ); + } + case core_state_set_power_mode_none: + { + DEBUG( "core_operation_power_save_test_c::next_state(): core_state_set_power_mode_none" ); + is_power_save_m = false_t; + return_status_m = core_error_ok; + + /** + * Disable power save. + */ + core_operation_base_c* operation = new core_operation_update_power_mode_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + CORE_POWER_SAVE_MODE_NONE ); + + return run_sub_operation( operation, core_state_echo_test ); + } + case core_state_set_power_mode_on: + { + is_power_save_m = true_t; + return_status_m = core_error_ok; + + /** + * Set the phone to wake up on every DTIM. + */ + core_operation_base_c* operation = new core_operation_update_power_mode_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + CORE_POWER_SAVE_MODE_EVERY_DTIM ); + + DEBUG( "core_operation_power_save_test_c::next_state(): core_state_set_power_mode_on" ); + is_unicast_test_on_m = false_t; + + return run_sub_operation( operation, core_state_echo_test ); + } + case core_state_echo_test: + { + /** + * The phone is now in correct power mode and the echo test can be started. + */ + + /** + * The response timeout is based on the AP's beacon interval and DTIM period. + */ + u32_t timeout = ( current_ap_m->beacon_interval() * current_ap_m->dtim_period() + 20 ) * + MILLISECONDS_FROM_MICROSECONDS; + DEBUG3( "core_operation_power_save_test_c::next_state() - AP beacon interval is %u ms, DTIM period is %u, timeout is %u us", + current_ap_m->beacon_interval(), + current_ap_m->dtim_period(), + timeout ); + + + core_operation_base_c* operation = new core_sub_operation_echo_test_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + *current_ap_m, + CORE_MAX_POWER_SAVE_TEST_RETRY_COUNT, + timeout, + is_unicast_test_on_m ); + + return run_sub_operation( operation, core_state_echo_test_complete ); + } + case core_state_echo_test_complete: + { + DEBUG( "core_operation_power_save_test_c::next_state(): core_state_echo_test_complete" ); + /** + * Echo test has been completed. + */ + + /** + * Echo test can fail because the AP just refuses to echo unicast or + * broadcast frames. Re-run the test without power save. + */ + if( is_power_save_m && + return_status_m == core_error_timeout ) + { + return goto_state( core_state_set_power_mode_none ); //first & third + } + + if( is_unicast_test_on_m && + return_status_m == core_error_timeout ) + { + return goto_state( core_state_set_power_mode_on ); //second + } + + return goto_state( core_state_reset_power_mode ); //fourth (or any if success) + } + case core_state_reset_power_mode: + { + core_mac_address_s bssid( + current_ap_m->bssid() ); + + if( is_power_save_m && + return_status_m == core_error_ok ) + { + /** + * Echo test w/ power save was completed successfully. + */ + DEBUG( "core_operation_power_save_test_c::next_state() - power save test verdict: PASS" ); + + server_m->get_connection_data()->add_ap_power_save_test_verdict( + bssid, + true_t ); + } + else if( return_status_m == core_error_ok ) + { + /** + * Echo test w/ power save failed but succeeded without power save. + */ + DEBUG( "core_operation_power_save_test_c::next_state() - power save test verdict: FAIL" ); + + server_m->get_connection_data()->add_ap_power_save_test_verdict( + bssid, + false_t ); + /** + * Notify adaptation about the failed test. + */ + adaptation_m->notify( + core_notification_broken_power_save_test_failed, + 0, + NULL ); + } + else if( return_status_m == core_error_timeout ) + { + /** + * Echo test failed both without and with power save. + */ + DEBUG( "core_operation_power_save_test_c::next_state() - power save test verdict: INCONCLUSIVE" ); + + server_m->get_connection_data()->add_ap_power_save_test_verdict( + bssid, + true_t ); + } + else + { + DEBUG1( "core_operation_power_save_test_c::next_state() - power save test verdict: UNKNOWN (failure %u)", + return_status_m ); + } + + DEBUG( "core_operation_power_save_test_c::next_state() - scheduling a power save update" ); + + core_operation_base_c* operation = new core_operation_update_power_mode_c( + REQUEST_ID_CORE_INTERNAL, + server_m, + drivers_m, + adaptation_m ); + + server_m->queue_int_operation( operation ); + + return return_status_m; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_power_save_test_c::cancel() + { + DEBUG( "core_operation_power_save_test_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_echo_test_complete: + { + // Store the return status of the echo test operation. + return_status_m = failure_reason_m; + + return next_state(); + } + default: + { + return failure_reason_m; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_protected_setup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_protected_setup.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,812 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for Wi-Fi Protected setup +* +*/ + + +#include "core_operation_protected_setup.h" +#include "core_operation_scan.h" +#include "core_sub_operation_wpa_connect.h" +#include "core_operation_release.h" +#include "core_server.h" +#include "core_timer_factory.h" +#include "core_callback.h" +#include "core_frame_wsc_ie.h" +#include "core_ap_data.h" +#include "core_tools.h" +#include "core_tools_parser.h" + +#include "am_debug.h" + +// This is for cheat to enable testing even when there are no selected registrars. +//#define CHEAT_FOR_TESTING +#define SCANLIST_PARSING_AND_PRINTING + +/** + * Delay between scans when looking for a selected registrar (in microseconds). + * The default is two seconds. + */ +const u32_t CORE_OPERATION_PROTECTED_SETUP_DELAY_FOR_NEXT_SCAN = 2 * SECONDS_FROM_MICROSECONDS; + +/** + * Timeout for finding a selected registrar (in microseconds). The default value is 120 seconds. + */ +const u32_t CORE_OPERATION_PROTECTED_SETUP_WALKTIME = 120 * SECONDS_FROM_MICROSECONDS; + +/** + * Defines how often Protected Setup is attempted against an AP even if the selected + * registrar bit is not set. The default is every third scan. + */ +const u32_t CORE_OPERATION_PROTECTED_SETUP_ROUNDTRIP_INTERVAL = 3; + +/** + * Defines how many scans are required before CORE_OPERATION_PROTECTED_SETUP_ROUNDTRIP_INTERVAL + * is taken into use. + */ +const u32_t CORE_OPERATION_PROTECTED_SETUP_ROUNDTRIP_START = 13; + +/** + * Delay before Protected Setup is attempted against an AP (in microseconds). Some APs are not + * ready immediately even if the selected registrat bit is set. The default delay is 5 seconds. + */ +const u32_t CORE_OPERATION_PROTECTED_SETUP_START_DELAY = 5 * SECONDS_FROM_MICROSECONDS; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_protected_setup_c::core_operation_protected_setup_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_iap_data_s& iap_data, + core_type_list_c& iap_data_list, + core_protected_setup_status_e& protected_setup_status ) : + core_operation_base_c( core_operation_protected_setup, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + core_iap_data_m( iap_data ), + iap_data_list_m( iap_data_list ), + protected_setup_status_m( protected_setup_status ), + scan_data_m( NULL ), + walktime_timer_m( NULL ), + selected_ap_data_m( NULL ), + tag_m( core_scan_list_tag_scan ), + all_valid_scan_channels_m( ), + assoc_ie_list_m( false_t ), + is_reassociation_m( false_t ), + management_status_m( core_management_status_success ), + is_connected_m( false_t ), + wps_scan_count_m( 0 ), + is_selected_registrar_found_m( false_t ), + is_pushbutton_method_used_m( false_t ) + { + DEBUG( "core_operation_protected_setup_c::core_operation_protected_setup_c()" ); + + all_valid_scan_channels_m = server_m->get_core_settings().all_valid_scan_channels(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_protected_setup_c::~core_operation_protected_setup_c() + { + DEBUG( "core_operation_protected_setup_c::~core_operation_protected_setup_c()" ); + delete scan_data_m; + scan_data_m = NULL; + + assoc_ie_list_m.clear(); + + if ( walktime_timer_m ) + { + walktime_timer_m->stop(); + core_timer_factory_c::destroy_timer( walktime_timer_m ); + walktime_timer_m = NULL; + } + selected_ap_data_m = NULL; + + if ( operation_state_m > core_state_init + && server_m->get_core_settings().connection_state() != core_connection_state_notconnected ) + { + DEBUG( "core_operation_protected_setup_c::~core_operation_protected_setup_c() - Error: Connection is not released!" ); + ASSERT( false_t ); + } + server_m->set_protected_setup_handler( NULL ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_protected_setup_c::next_state() + { + DEBUG( "core_operation_protected_setup_c::next_state()" ); + switch( operation_state_m ) + { + case core_state_init: + { + // This state is for initial actions. + DEBUG( "- core_state_init" ); + DEBUG1S("User selected SSID: ", core_iap_data_m.ssid.length, core_iap_data_m.ssid.ssid); + + if ( core_iap_data_m.wpa_preshared_key.key_length == 0 ) + { + DEBUG( "Using Pushbutton method" ); + is_pushbutton_method_used_m = true_t; + } + else + { + DEBUG( "Using Pincode method" ); + is_pushbutton_method_used_m = false_t; + } + + scan_data_m = new ScanList; + if( !scan_data_m ) + { + DEBUG( "core_operation_protected_setup_c::next_state() - unable to create ScanList" ); + return core_error_no_memory; + } + + core_callback_c* timer_callback = + new core_callback_c( &(core_operation_protected_setup_c::timer_expired), this ); + if( !timer_callback ) + { + DEBUG( "core_operation_protected_setup_c::next_state() - unable to create callbacks" ); + return core_error_no_memory; + } + + walktime_timer_m = core_timer_factory_c::create_timer( timer_callback ); + if( !walktime_timer_m ) + { + DEBUG( "core_operation_protected_setup_c::next_state() - unable to create timer" ); + delete timer_callback; + return core_error_no_memory; + } + + + if ( server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_protected_setup_c::next_state() - already connected, completing request" ); + + return core_error_connection_already_active; + } + + // Override the security mode just in case. + core_iap_data_m.security_mode = core_security_mode_protected_setup; + + if ( !server_m->create_eapol_instance( core_eapol_operating_mode_wfa ) ) + { + DEBUG( "core_operation_protected_setup_c::next_state() - unable to instantiate EAPOL" ); + return core_error_no_memory; + } + + walktime_timer_m->start( CORE_OPERATION_PROTECTED_SETUP_WALKTIME ); + + return goto_state( core_state_prepare_scanning ); + } + // This state is for actions what should be done at start or after core_operation_release_c. + case core_state_prepare_scanning: + { + DEBUG( "- core_state_prepare_scanning" ); + core_error_e ret = server_m->init_connection_data( + core_iap_data_m, + server_m->get_device_settings() ); + if ( ret != core_error_ok ) + { + DEBUG1( "core_operation_protected_setup_c::next_state() - unable to initialize connection data (%d)", ret ); + return ret; + } + + if ( !server_m->get_connection_data()->iap_data().is_eap_used() ) + { + DEBUG( "core_operation_protected_setup_c::next_state() - is_eap_used() == false, it should be true." ); + return core_error_illegal_argument; + } + + server_m->get_core_settings().set_connection_state( core_connection_state_searching ); + + return goto_state( core_state_start_scanning ); + } + + case core_state_start_scanning: + { + DEBUG( "- core_state_start_scanning" ); + operation_state_m = core_state_scan; + + // Clear scanlist + ASSERT( scan_data_m ); + scan_data_m->ClearAll(); + + // add tag to help scanlist iteration + server_m->get_scan_list().set_tag( tag_m ); + selected_ap_data_m = NULL; + + // Broadcast scan is used to detect session overlap. + // Otherwise this could be direct scan. + core_operation_base_c* operation = new core_operation_scan_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + core_scan_mode_active, + BROADCAST_SSID, + all_valid_scan_channels_m, + 0, + *scan_data_m, + false_t, + false_t ); + + return run_sub_operation( operation ); + } + + case core_state_scan: + { + DEBUG( "- core_state_scan" ); + operation_state_m = core_state_MAX; // This is just to spot leak in following switch. + ++wps_scan_count_m; + +#ifdef SCANLIST_PARSING_AND_PRINTING + + core_scan_list_iterator_by_tag_c parsing_iter( + server_m->get_scan_list(), + tag_m); + for ( core_ap_data_c* ap_data = parsing_iter.first(); ap_data; ap_data = parsing_iter.next() ) + { + u8_t buffer[70]; + core_tools_c::fillz(buffer, sizeof(buffer) ); + + for (u32_t i=0; issid().length; ++i) + { + buffer[2*i] = ap_data->ssid().ssid[i]; + buffer[2*i+1] = 0; + } + + DEBUG8("RADAR: SSID:%s BSSID:%02x.%02x.%02x.%02x.%02x.%02x RCPI:%u", + buffer, + //ap_data->ssid().ssid, + ap_data->bssid().addr[0], + ap_data->bssid().addr[1], + ap_data->bssid().addr[2], + ap_data->bssid().addr[3], + ap_data->bssid().addr[4], + ap_data->bssid().addr[5], + ap_data->rcpi() + ); + } + +#endif // SCANLIST_PARSING_AND_PRINTING + + // Decide whether ap_data should be copied even when selected_registrar is not set. + bool_t copy_ap_data( false_t ); + if( wps_scan_count_m == 1 || + ( wps_scan_count_m >= CORE_OPERATION_PROTECTED_SETUP_ROUNDTRIP_START && + ( wps_scan_count_m % CORE_OPERATION_PROTECTED_SETUP_ROUNDTRIP_INTERVAL == 1 ) ) ) + { + copy_ap_data = true_t; + } + DEBUG2( "core_operation_protected_setup_c::next_state() - wps_scan_count_m=%d, copy_ap_data=%d", wps_scan_count_m, copy_ap_data ); + + abs_core_scan_list_iterator_c * iter; + + if ( is_pushbutton_method_used_m ) + { + // Pushbutton: Check all APs from scanlist. + iter = new core_scan_list_iterator_by_tag_c( + server_m->get_scan_list(), + tag_m); + } + else + { + // Pincode: Check only APs with given SSID from scanlist. + iter = new core_scan_list_iterator_by_tag_and_ssid_c( + server_m->get_scan_list(), + tag_m, + core_iap_data_m.ssid); + } + + u32_t selected_registrar_count( check_selected_registrars( iter, copy_ap_data ) ); + delete iter; + iter = NULL; + switch ( selected_registrar_count ) + { + case 0: // No selected registrars yet. We should wait until some registrar appears + { + // Second round-trip should not start before selected_registrar is found. + if ( !selected_ap_data_m ) + { + // Wait some time before new scan + return asynch_goto( core_state_start_scanning, CORE_OPERATION_PROTECTED_SETUP_DELAY_FOR_NEXT_SCAN ); + } + } + /* + * This will fall through in first round-trip if selected AP was found. + * It means that selected_registrar flag is not required until second round-trip. + */ + //lint -fallthrough + case 1: // Successfull case: one and only one selected registrar + { + // AP not found. It is coding error. + ASSERT( selected_ap_data_m ); + + // Check that selected registrar is in SSID where it should be... + if ( core_iap_data_m.ssid != selected_ap_data_m->ssid() ) + { + // If it is not, then wait some time before new scan + DEBUG( "core_operation_protected_setup_c::next_state() - selected registrar is not in wanted AP, ignoring" ); + return asynch_goto( core_state_start_scanning, CORE_OPERATION_PROTECTED_SETUP_DELAY_FOR_NEXT_SCAN ); + } + if ( selected_registrar_count > 0 ) + { + // selected_registrar == true was found in correct AP. + is_selected_registrar_found_m = true_t; + } + + return asynch_goto( core_state_connect_and_setup, CORE_OPERATION_PROTECTED_SETUP_START_DELAY ); + } + default: // More than one selected registrar: It means "multiple PBC sessions detected" + { + // But if we are using pincode method, then we just try connection with first AP. + // No need to check SSID, because it is already filtered. + if ( !is_pushbutton_method_used_m ) + { + DEBUG1( "core_operation_protected_setup_c::next_state() - %i selected registrars found for the same SSID, trying pincode for first AP.", selected_registrar_count ); + is_selected_registrar_found_m = true_t; + return asynch_goto( core_state_connect_and_setup, CORE_OPERATION_PROTECTED_SETUP_START_DELAY ); + } + + protected_setup_status_m = core_protected_setup_status_multiple_PBC_sessions_detected; + walktime_timer_m->stop(); + + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + + return core_error_ok; + } + } + } + + case core_state_connect_and_setup: + { + DEBUG( "- core_state_connect_and_setup" ); + + if ( is_selected_registrar_found_m ) + { + /** + * Walk time timer can be stopped because user has pressed + * Push-button or PIN-code from both phone and registrar. + * Do not stop timer, if selected registrar is not found. + */ + ASSERT( walktime_timer_m ); + walktime_timer_m->stop(); + } + + core_iap_data_c core_iap_data( core_iap_data_m ); + + operation_state_m = core_state_setup_completed; + + // Add WSC IE to association request + core_frame_wsc_ie_c* wsc_ie = core_frame_wsc_ie_c::instance( + CORE_FRAME_WSC_IE_USED_VERSION, + CORE_FRAME_WSC_IE_REQUEST_TYPE_ENROLLEE ); + + if ( wsc_ie == NULL ) + { + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + return core_error_no_memory; + } + assoc_ie_list_m.append( + wsc_ie, + wsc_ie->element_id() ); + + ASSERT( selected_ap_data_m != NULL ); + + server_m->set_protected_setup_handler( this ); + + server_m->get_core_settings().set_connection_state( core_connection_state_secureinfra ); + + // WPA connect initiates connection and start authentication (in this case starts protected setup) + core_operation_base_c* operation = new core_sub_operation_wpa_connect_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + management_status_m, + core_iap_data_m.ssid, + *selected_ap_data_m, + is_reassociation_m, + assoc_ie_list_m, + NULL ); + + return run_sub_operation( operation ); + } + + case core_state_setup_completed: + { + DEBUG( "- core_state_setup_completed" ); + + protected_setup_status_m = core_protected_setup_status_ok; + ASSERT( walktime_timer_m ); + walktime_timer_m->stop(); + + DEBUG( "Wi-Fi Protected Setup done, starting disconnect." ); + + operation_state_m = core_state_disconnect; + + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + core_release_reason_other ); + + return run_sub_operation( operation ); + } + + case core_state_disconnect: + { + DEBUG( "- core_state_disconnect" ); + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + return core_error_ok; + } + + case core_state_user_cancel: + { + DEBUG( "- core_state_user_cancel" ); + + operation_state_m = core_state_disconnect_on_cancel; + + // + ASSERT( walktime_timer_m ); + walktime_timer_m->stop(); + + // We should cancel this timer, because asynch_goto could be ongoing. + server_m->cancel_operation_timer(); + + // This is not necessary? operation release will check this also... + if( server_m->get_core_settings().connection_state() + == core_connection_state_secureinfra ) + { + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + core_release_reason_external_request ); + + return run_sub_operation( operation ); + } + return next_state( ); + } + + case core_state_disconnect_on_cancel: + { + DEBUG( "- core_state_disconnect_on_cancel" ); + + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + + return core_error_cancel; + } + + case core_state_setup_failed: + { + DEBUG( "- core_state_setup_failed" ); + + operation_state_m = core_state_disconnect_on_error; + ASSERT( walktime_timer_m ); + walktime_timer_m->stop(); + + // Get EAPOL errorcode before releasing connection. + wlan_eapol_if_eap_status_e eapol_status = static_cast( server_m->get_connection_data()->last_eap_error() ); + protected_setup_status_m = core_tools_c::convert_eapol_error_to_protected_setup_status( eapol_status ); + + DEBUG2( "Protected Setup has failed, starting disconnect. (EAPOL status %i, protected setup status %i)", + eapol_status, + protected_setup_status_m ); + server_m->get_core_settings().set_connection_state( core_connection_state_secureinfra ); + + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + core_release_reason_other ); + + return run_sub_operation( operation ); + } + + case core_state_disconnect_on_error: + { + DEBUG( "- core_state_disconnect_on_error" ); + + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + + DEBUG1( "core_operation_protected_setup_c::next_state() - failure_reason_m is %u", + failure_reason_m ); + DEBUG1( "core_operation_protected_setup_c::next_state() - management_status_m is %u", + management_status_m ); + + core_error_e ret = protected_setup_status( + failure_reason_m, + management_status_m, + protected_setup_status_m ); + DEBUG1( "core_operation_protected_setup_c::next_state() - returned error code is %u", + ret ); + DEBUG1( "core_operation_protected_setup_c::next_state() - returned status is %u", + protected_setup_status_m ); + + return ret; + } + + case core_state_disconnect_before_second_round_trip: + { + DEBUG( "- core_state_disconnect_before_second_round_trip" ); + + operation_state_m = core_state_prepare_scanning; + + // Get EAPOL errorcode before releasing connection. + wlan_eapol_if_eap_status_e eapol_status = static_cast( server_m->get_connection_data()->last_eap_error() ); + protected_setup_status_m = core_tools_c::convert_eapol_error_to_protected_setup_status( eapol_status ); + + DEBUG2( "Protected Setup has failed (first round-trip), starting disconnect. (EAPOL status %i, protected setup status %i)", + eapol_status, + protected_setup_status_m ); + server_m->get_core_settings().set_connection_state( core_connection_state_secureinfra ); + + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + core_release_reason_other ); + + return run_sub_operation( operation ); + } + + case core_state_walktime_expiration: + { + DEBUG( "- core_state_walktime_expiration" ); + + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + + // indicate unsuccessfully completed protected setup + protected_setup_status_m = core_protected_setup_status_walktime_expired; + + return core_error_ok; + } + + default: + { + ASSERT( false_t ); + } + } + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_protected_setup_c::cancel() + { + DEBUG( "core_operation_protected_setup_c::cancel()" ); + + if ( operation_state_m == core_state_setup_completed ) + { + DEBUG( "core_operation_protected_setup_c::cancel() - Protected Setup has failed " ); + if ( !is_selected_registrar_found_m ) + { + DEBUG( "core_operation_protected_setup_c::cancel() - Goto core_state_disconnect_before_second_round_trip"); + return asynch_goto( core_state_disconnect_before_second_round_trip, CORE_TIMER_IMMEDIATELY ); + } + return goto_state( core_state_setup_failed ); + } + + server_m->get_core_settings().set_connection_state( core_connection_state_notconnected ); + + return failure_reason_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Handle cancel from user. +// +void core_operation_protected_setup_c::user_cancel( + bool_t /* do_graceful_cancel */ ) + { + DEBUG( "core_operation_protected_setup_c::user_cancel()" ); + + // This will move execution to user cancel state, when we get execution time next time. + operation_state_m = core_state_user_cancel; + + return; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_operation_protected_setup_c::check_selected_registrars( + abs_core_scan_list_iterator_c * iter, + bool_t copy_ap_data_always ) + { + DEBUG( "core_operation_protected_setup_c::check_selected_registrars()" ); + u32_t registrar_count = 0; + + // Search through scan_list to count all selected registrars + for ( core_ap_data_c* ap_data = iter->first(); ap_data; ap_data = iter->next() ) + { + const core_frame_wsc_ie_c* wsc_ie = ap_data->wsc_ie(); + if ( wsc_ie != NULL ) + { + // Do we need to check something else? AP setup locked? + if (wsc_ie->selected_registrar() == true_t) + { + ++registrar_count; + selected_ap_data_m = ap_data; + DEBUG1S( "core_operation_protected_setup_c::check_selected_registrars() - selected_registrar=true, SSID: ", + ap_data->ssid().length, + ap_data->ssid().ssid ); + } + else + { + DEBUG( "core_operation_protected_setup_c::check_selected_registrars() - selected_registrar=false" ); + + // Copy ap_data in first round-trip. Do not overwrite if selected_registrar is already found. + if ( copy_ap_data_always && + registrar_count == 0 && + core_iap_data_m.ssid == ap_data->ssid() ) + { + DEBUG( "core_operation_protected_setup_c::check_selected_registrars() - SSID found. Copying ap_data."); + selected_ap_data_m = ap_data; + } + } + + delete wsc_ie; + wsc_ie = NULL; + } + +#ifdef CHEAT_FOR_TESTING + if ( core_tools_c::compare( + core_iap_data_m.ssid.ssid, + core_iap_data_m.ssid.length, + ap_data->ssid().ssid, + ap_data->ssid().length ) == 0) + { + DEBUG( "copy ap_data for testing..."); + selected_ap_data_m = ap_data; + } +#endif // CHEAT_FOR_TESTING + } + DEBUG1( "core_operation_protected_setup_c::check_selected_registrars() - registrar_count %i", registrar_count); + return registrar_count; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_protected_setup_c::timer_expired( void* this_ptr ) + { + DEBUG( "core_operation_protected_setup_c::timer_expired()" ); + + core_operation_protected_setup_c* self = + static_cast( this_ptr ); + + ASSERT( self ); + + // If scan is ongoing, do not use operation_timer. + if ( self->operation_state_m == core_state_scan ) + { + DEBUG( "core_operation_protected_setup_c::timer_expired() - goto core_state_walktime_expiration after scan_complete" ); + self->operation_state_m = core_state_walktime_expiration; + } + else if ( self->operation_state_m == core_state_setup_completed ) + { + DEBUG( "core_operation_protected_setup_c::timer_expired() - Ignoring walktime timer. Let EAPOL continue." ); + /* + * This will prevent newer ending round-trips, if walktime timer expires + * while EAPOL is running protected setup and if it fails. + */ + self->is_selected_registrar_found_m = true_t; + } + else + { + DEBUG( "core_operation_protected_setup_c::timer_expired() - goto core_state_walktime_expiration immediately" ); + + // Must stop operation timer before asynch_goto. + self->server_m->cancel_operation_timer(); + self->asynch_goto( core_state_walktime_expiration, CORE_TIMER_IMMEDIATELY ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_protected_setup_c::handle_protected_setup_network( + const core_iap_data_s& iap_data ) + { + DEBUG( "core_operation_protected_setup_c::handle_protected_setup_network()" ); + + core_iap_data_s* instance = new core_iap_data_s( + iap_data ); + if ( instance ) + { + iap_data_list_m.append( instance ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_protected_setup_c::protected_setup_status( + core_error_e request_status, + core_management_status_e management_status, + core_protected_setup_status_e& protected_setup_status ) const + { + + /** + * If management status is defined, the AP has refused our authentication + * or association. + */ + if ( management_status != core_management_status_success ) + { + switch ( management_status ) + { + case core_management_status_auth_algo_not_supported: + /** Falls through on purpose. */ + case core_management_status_auth_frame_out_of_sequence: + /** Falls through on purpose. */ + case core_management_status_auth_challenge_failure: + /** Falls through on purpose. */ + case core_management_status_auth_timeout: + { + protected_setup_status = core_protected_setup_status_network_auth_failure; + break; + } + default: + { + protected_setup_status = core_protected_setup_status_network_assoc_failure; + break; + } + } + + return core_error_ok; + } + + /** + * If EAPOL has indicated an error, determine the error code from + * the saved notifications. + */ + if ( request_status == core_error_eapol_total_failure || + request_status == core_error_eapol_failure ) + { + // In this case, protected_setup_status is already set from EAPOL errorcode (no need to set it here). + return core_error_ok; + } + else if ( request_status == core_error_timeout ) + { + protected_setup_status = core_protected_setup_status_network_assoc_failure; + return core_error_ok; + } + else if ( request_status != core_error_ok ) + { + protected_setup_status = core_protected_setup_status_network_auth_failure; + return core_error_ok; + } + + /** + * An error occured somewhere else, has nothing to do with Protected Setup. + */ + protected_setup_status = core_protected_setup_status_undefined; + + return request_status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_release.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_release.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,285 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connection release +* +*/ + +/* +* %version: 17 % +*/ + +#include "core_operation_release.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_release_c::core_operation_release_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_release_reason_e reason ) : + core_operation_base_c( core_operation_release, request_id, server, drivers, adaptation, + core_base_flag_none ), + reason_m( reason ) + { + DEBUG( "core_operation_release_c::core_operation_release_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_release_c::~core_operation_release_c() + { + DEBUG( "core_operation_release_c::~core_operation_release_c()" ); + + if ( server_m->get_connection_data() ) + { + DEBUG( "core_operation_release_c::~core_operation_release_c() - marking is_disconnecting as false" ); + server_m->get_connection_data()->set_disconnecting( + false_t ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_release_c::next_state() + { + DEBUG( "core_operation_release_c::next_state()" ); + switch( operation_state_m ) + { + case core_state_init: + { + DEBUG( "core_operation_release_c::next_state() - core_state_init" ); + // ensure state is correct + if( server_m->get_core_settings().connection_state() + == core_connection_state_notconnected ) + { + return core_error_not_supported; + } + + DEBUG( "core_operation_release_c::next_state() - marking is_disconnecting as true" ); + server_m->get_connection_data()->set_disconnecting( + true_t ); + + server_m->cancel_roam_timer(); + server_m->cancel_dhcp_timer(); + server_m->get_wpx_adaptation_instance().handle_wpx_connection_stop(); + +#ifdef _DEBUG + switch ( reason_m ) + { + case core_release_reason_external_request: + DEBUG( "core_operation_release_c::next_state() - release due to core_release_reason_external_request" ); + break; + case core_release_reason_max_roam_attempts_exceeded: + DEBUG( "core_operation_release_c::next_state() - release due to core_release_reason_max_roam_attempts_exceeded" ); + + switch ( server_m->get_connection_data()->last_roam_reason() ) + { + case core_roam_reason_initial_connect: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to core_roam_reason_initial_connect" ); + break; + case core_roam_reason_bss_lost: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to core_roam_reason_bss_lost" ); + break; + case core_roam_reason_media_disconnect: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to core_roam_reason_media_disconnect" ); + break; + case core_roam_reason_signal_strength: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to core_roam_reason_signal_strength" ); + break; + case core_roam_reason_signal_loss_prediction: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to core_roam_reason_signal_loss_prediction" ); + break; + case core_roam_reason_failed_reauthentication: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to core_roam_reason_failed_reauthentication" ); + break; + default: + DEBUG( "core_operation_release_c::next_state() - roam was initiated due to an undefined reason" ); + ASSERT( false_t ); + } + + switch ( server_m->get_connection_data()->last_roam_failed_reason() ) + { + case core_roam_failed_reason_timeout: + DEBUG( "core_operation_release_c::next_state() - roam failed due to core_roam_failed_reason_timeout" ); + break; + case core_roam_failed_reason_no_suitable_ap: + DEBUG( "core_operation_release_c::next_state() - roam failed due to core_roam_failed_reason_no_suitable_ap" ); + break; + case core_roam_failed_reason_ap_status_code: + DEBUG( "core_operation_release_c::next_state() - roam failed due to core_roam_failed_reason_ap_status_code" ); + break; + case core_roam_failed_reason_eapol_failure: + DEBUG( "core_operation_release_c::next_state() - roam failed due to core_roam_failed_reason_eapol_failure" ); + break; + case core_roam_failed_reason_other_failure: + DEBUG( "core_operation_release_c::next_state() - roam failed due to core_roam_failed_reason_other_failure" ); + break; + default: + DEBUG( "core_operation_release_c::next_state() - roam failed due to an undefined reason" ); + ASSERT( false_t ); + } + break; + case core_release_reason_hw_failure: + DEBUG( "core_operation_release_c::next_state() - release due to core_release_reason_hw_failure" ); + break; + case core_release_reason_tkip_mic_failure: + DEBUG( "core_operation_release_c::next_state() - release due to core_release_reason_tkip_mic_failure" ); + break; + case core_release_reason_other: + DEBUG( "core_operation_release_c::next_state() - release due to core_release_reason_other" ); + break; + default: + DEBUG( "core_operation_release_c::next_state() - release due to an undefined reason" ); + ASSERT( false_t ); + } + + server_m->get_core_settings().roam_metrics().trace_current_roam_metrics(); +#endif // _DEBUG + + /** + * EAPOL must notified about the disassociation. + */ + if ( ( server_m->get_connection_data()->iap_data().is_eap_used() || + server_m->get_connection_data()->iap_data().is_wapi_used() ) && + server_m->get_connection_data()->current_ap_data() ) + { + /*const*/ core_mac_address_s bssid = + server_m->get_connection_data()->current_ap_data()->bssid(); + + network_id_c network( + &bssid.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + DEBUG6( "core_operation_release_c::next_state() - EAPOL disassociation from BSSID %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + server_m->get_eapol_instance().disassociation( &network ); + } + + // disable user data + drivers_m->disable_user_data( request_id_m ); + operation_state_m = core_state_disable_user_data; + break; + } + case core_state_disable_user_data: + { + DEBUG( "core_operation_release_c::next_state() - core_state_disable_user_data" ); + drivers_m->set_tx_power_level( + request_id_m, + server_m->get_device_settings().tx_power_level ); + operation_state_m = core_state_tx_power_level; + break; + } + case core_state_tx_power_level: + { + DEBUG( "core_operation_release_c::next_state() - core_state_tx_power_level" ); + + u32_t tx_level = server_m->get_device_settings().tx_power_level; + + if ( server_m->get_connection_data()->last_tx_level() != tx_level ) + { + DEBUG( "core_operation_release_c::next_state() - TX level has changed, notifying change" ); + + adaptation_m->notify( + core_notification_tx_power_level_changed, + sizeof( tx_level ), + reinterpret_cast( &tx_level ) ); + + server_m->get_connection_data()->set_last_tx_level( tx_level ); + } + + drivers_m->disconnect( request_id_m ); + operation_state_m = core_state_disconnect; + break; + } + case core_state_disconnect: + { + DEBUG( "core_operation_release_c::next_state() - core_state_disconnect" ); + + // notify adaptation + core_connection_state_e state = core_connection_state_notconnected; + server_m->get_core_settings().set_connection_state( state ); + + if ( server_m->get_connection_data()->last_connection_state() != state ) + { + u8_t buf[5]; + buf[0] = static_cast( state ); + buf[1] = static_cast( reason_m ); + buf[2] = 0; + buf[3] = 0; + if ( reason_m == core_release_reason_max_roam_attempts_exceeded ) + { + buf[2] = static_cast( + server_m->get_connection_data()->last_roam_reason() ); + buf[3] = static_cast( + server_m->get_connection_data()->last_roam_failed_reason() ); + } + + adaptation_m->notify( + core_notification_connection_state_changed, + sizeof( buf ), + buf ); + + server_m->get_connection_data()->set_last_connection_state( + state ); + } + + // destroy connection data + server_m->clear_connection_data(); + + // Cancel any operations that depend on an active connection. + server_m->cancel_operations_with_flags( + core_operation_base_c::core_base_flag_connection_needed ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_release_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG( "core_operation_release_c::user_cancel()" ); + + if ( !do_graceful_cancel ) + { + core_operation_base_c::user_cancel( do_graceful_cancel ); + return; + } + + /** + * On graceful cancel this operation must be executed completely + * to guarantee disconnect. Therefore user_cancel() is ignored. + */ + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_roam.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1359 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for roaming +* +*/ + +/* +* %version: 75 % +*/ + +#include "core_operation_roam.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "core_sub_operation_connect.h" +#include "core_sub_operation_adhoc.h" +#include "core_sub_operation_wep_connect.h" +#include "core_sub_operation_wpa_connect.h" +#include "core_sub_operation_roam_update_ts.h" +#include "core_operation_update_power_mode.h" +#include "core_frame_assoc_resp.h" +#include "core_frame_dot11.h" +#include "core_frame_qbss_load_ie.h" +#include "core_scan_list.h" +#include "core_frame_nr_ie.h" +#include "core_frame_action_nr.h" +#include "core_frame_action_rm.h" +#include "core_frame_radio_measurement_action.h" +#include "am_debug.h" + +const u32_t CORE_ROAMING_LIST_BONUS_PMKSA = 20; +const u32_t CORE_ROAMING_LIST_BONUS_WPX_FAST_ROAM = 20; + +/** The maximum amount association/authentication failures when WAPI is used. */ +const u32_t CORE_MAX_WAPI_AP_ASSOCIATION_FAILURE_COUNT = 10; + +/** Definitions for RRM Enabled Capabilities bitmask */ +const u64_t RRM_CAPABILITY_BIT_MASK_NEIGHBOR_REPORT = 0x0000000002; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_roam_c::core_operation_roam_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + u8_t tag, + u8_t min_required_rcpi, + const medium_time_s& min_medium_time, + const core_ssid_s& ssid, + const core_mac_address_s& bssid ) : + core_operation_base_c( core_operation_roam, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + is_connected_m( is_connected ), + tag_m( tag ), + min_required_rcpi_m( min_required_rcpi ), + min_medium_time_m( min_medium_time ), + ssid_m( ssid ), + bssid_m( bssid ), + roaming_list_m( ), + management_status_m( core_management_status_success ), + connect_status_m( core_connect_network_not_found ), + current_ap_m( NULL ), + current_bssid_m( ZERO_MAC_ADDR ), + assoc_ie_list_m( false_t ), + is_cached_sa_used_m( false_t ), + assoc_resp_m( NULL ) + { + DEBUG( "core_operation_roam_c::core_operation_roam_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_roam_c::~core_operation_roam_c() + { + DEBUG( "core_operation_roam_c::~core_operation_roam_c()" ); + + for ( roaming_list_entry_s* iter = roaming_list_m.first(); iter; iter = roaming_list_m.next() ) + { + delete iter->ap_data; + } + + roaming_list_m.clear(); + assoc_ie_list_m.clear(); + delete assoc_resp_m; + current_ap_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_roam_c::next_state() + { + DEBUG( "core_operation_roam_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + if( server_m->get_connection_data()->last_roam_reason() != core_roam_reason_initial_connect ) + { + server_m->get_core_settings().roam_metrics().inc_roam_attempt_count( + server_m->get_connection_data()->last_roam_reason() ); + } + + if( is_connected_m ) + { + current_bssid_m = server_m->get_connection_data()->current_ap_data()->bssid(); + + DEBUG6( "core_operation_roam_c::next_state() - current BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + current_bssid_m.addr[0], current_bssid_m.addr[1], current_bssid_m.addr[2], + current_bssid_m.addr[3], current_bssid_m.addr[4], current_bssid_m.addr[5] ); + } + + DEBUG6( "core_operation_roam_c::next_state() - requested BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid_m.addr[0], bssid_m.addr[1], bssid_m.addr[2], + bssid_m.addr[3], bssid_m.addr[4], bssid_m.addr[5] ); + DEBUG1( "core_operation_roam_c::next_state() - minimum required RCPI value: %u", + min_required_rcpi_m ); + + /** + * Set all the traffic streams as not active and reset TSPEC parameters to the + * default values. + */ + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + for( core_traffic_stream_c* iter = ts_list.first(); iter; iter = ts_list.next() ) + { + iter->set_status( core_traffic_stream_status_undefined ); + iter->reset_to_default_values(); + } + + if ( !is_connected_m ) + { + /** + * Indicate core_connection_state_searching state to adaptation. + */ + core_connection_state_e state = core_connection_state_searching; + server_m->get_core_settings().set_connection_state( state ); + + if ( server_m->get_connection_data()->last_connection_state() != state ) + { + u8_t buf[5]; + buf[0] = static_cast( state ); + adaptation_m->notify( + core_notification_connection_state_changed, + 1, + buf ); + + server_m->get_connection_data()->set_last_connection_state( + state ); + } + } + + server_m->get_scan_list().print_contents(); + + DEBUG1( "core_operation_roam_c::next_state() - tag entry for iterator is 0x%02X", + tag_m ); + core_scan_list_iterator_by_tag_and_ssid_and_bssid_c iter( + server_m->get_scan_list(), + tag_m, + ssid_m, + bssid_m ); + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + if ( process_frame( *ap_data ) ) + { + DEBUG( "core_operation_roam_c::next_state() - AP added to roaming list" ); + } + } + +#ifdef _DEBUG + DEBUG( "core_operation_roam_c::next_state() - roaming list start" ); + + roaming_list_entry_s* entry_iter = roaming_list_m.first(); + TUint idx( 1 ); + + while ( entry_iter ) + { + const core_mac_address_s bssid = entry_iter->ap_data->bssid(); + + DEBUG8( "core_operation_roam_c::next_state() - entry #%02u %02X:%02X:%02X:%02X:%02X:%02X (RCPI %u)", + idx, bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5], entry_iter->ap_data->rcpi() ); + + entry_iter = roaming_list_m.next(); + ++idx; + } + + DEBUG( "core_operation_roam_c::next_state() - roaming list end" ); +#endif // _DEBUG + + if ( roaming_list_m.first() ) + { + current_ap_m = roaming_list_m.first()->ap_data; + } + + /** + * We can proceed with the connection if there are entries in + * the roaming list OR we are going to start our own IBSS network. + */ + if( current_ap_m || + ( !is_connected_m && + server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_ibss ) ) + { + operation_state_m = core_state_req_disable_userdata_before_connect; + + if ( !is_connected_m ) + { + return next_state(); + } + + DEBUG( "core_operation_roam_c::next_state() - disabling user data before connect" ); + + server_m->get_core_settings().roam_metrics().set_roam_ts_userdata_disabled(); + + drivers_m->disable_user_data( + request_id_m ); + } + else + { + DEBUG( "core_operation_roam_c::next_state() - no suitable AP found" ); + failure_reason_m = core_error_not_found; + if ( server_m->get_connection_data()->connect_status() == core_connect_undefined ) + { + server_m->get_connection_data()->set_connect_status( connect_status_m ); + } + + server_m->get_core_settings().roam_metrics().inc_roam_attempt_failed_count( + core_roam_failed_reason_no_suitable_ap ); + if ( server_m->get_connection_data()->last_roam_failed_reason() == core_roam_failed_reason_none ) + { + server_m->get_connection_data()->set_last_roam_failed_reason( core_roam_failed_reason_no_suitable_ap ); + } + + /** + * Set all traffic stream statuses and parameters back to the values + * they were before the roam attempt. + */ + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + + for( core_traffic_stream_c* iter = ts_list.first(); iter; iter = ts_list.next() ) + { + iter->set_status( core_traffic_stream_status_active ); + iter->reset_to_previous_values(); + } + + return cancel(); + } + + break; + } + case core_state_req_disable_userdata_before_connect: + { + operation_state_m = core_state_req_connect; + +#ifdef _DEBUG + if( current_ap_m ) + { + const core_mac_address_s current_bssid = + current_ap_m->bssid(); + + DEBUG6( "core_operation_roam_c::next_state() - selecting BSSID %02X:%02X:%02X:%02X:%02X:%02X", + current_bssid.addr[0], current_bssid.addr[1], current_bssid.addr[2], + current_bssid.addr[3], current_bssid.addr[4], current_bssid.addr[5] ); + } + else + { + DEBUG("core_operation_roam_c::next_state() - establishing adhoc network"); + } +#endif // _DEBUG + + core_security_mode_e mode( + server_m->get_connection_data()->iap_data().security_mode() ); + bool_t is_ibss_mode( + server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_ibss ); + + /** + * Establish Adhoc network + */ + if( !current_ap_m && + is_ibss_mode ) + { + core_operation_base_c* operation = new core_sub_operation_adhoc_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + ¤t_ap_m ); // conveying a pointer to pointer + + return run_sub_operation( operation ); + } + + /** + * IAP with no security. + */ + if ( mode == core_security_mode_allow_unsecure ) + { + core_operation_base_c* operation = new core_sub_operation_connect_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + management_status_m, + ssid_m, + *current_ap_m, + core_authentication_mode_open, + core_encryption_mode_disabled, + core_cipher_key_type_none, + assoc_ie_list_m, + is_ibss_mode ? NULL : &assoc_resp_m, + true_t, // ignored, pairwise key not used + true_t ); // ignored, group key not used + + return run_sub_operation( operation ); + } + + /** + * IAP with static WEP. + */ + if ( mode == core_security_mode_wep ) + { + core_operation_base_c* operation = new core_sub_operation_wep_connect_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + management_status_m, + ssid_m, + *current_ap_m, + server_m->get_connection_data()->iap_data().authentication_mode(), + core_encryption_mode_wep, + assoc_ie_list_m, + is_ibss_mode ? NULL : &assoc_resp_m ); + + return run_sub_operation( operation ); + } + + /** + * IAP with EAP. + */ + is_cached_sa_used_m = roaming_list_m.first()->is_cached_sa_available; + + core_operation_base_c* operation = new core_sub_operation_wpa_connect_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + management_status_m, + ssid_m, + *current_ap_m, + is_cached_sa_used_m, + assoc_ie_list_m, + is_ibss_mode ? NULL : &assoc_resp_m ); + + return run_sub_operation( operation ); + } + case core_state_req_connect: + { + operation_state_m = core_state_req_update_ts; + + DEBUG( "core_operation_roam_c::next_state() - connection success" ); + + /** + * Send information about the current AP to the subscribed clients. + * + * This has to be done before updating traffic stream statuses so + * that NIF won't try to recreate rejected streams. + */ + core_ap_information_s info = core_tools_parser_c::get_ap_info( + server_m->get_connection_data()->iap_data(), + *current_ap_m ); + DEBUG( "core_operation_roam_c::next_state() - notifying access point information:" ); + DEBUG1( "core_operation_roam_c::next_state() - is_ac_required_for_voice = %u", + info.is_ac_required_for_voice ); + DEBUG1( "core_operation_roam_c::next_state() - is_ac_required_for_video = %u", + info.is_ac_required_for_video ); + DEBUG1( "core_operation_roam_c::next_state() - is_ac_required_for_best_effort = %u", + info.is_ac_required_for_best_effort ); + DEBUG1( "core_operation_roam_c::next_state() - is_ac_required_for_background = %u", + info.is_ac_required_for_background ); + DEBUG1( "core_operation_roam_c::next_state() - is_wpx = %u", + info.is_wpx ); + adaptation_m->notify( + core_notification_ap_info_changed, + sizeof ( info ), + reinterpret_cast( &info ) ); + + if ( server_m->get_connection_data()->current_ap_data() && + server_m->get_connection_data()->current_ap_data()->bssid() != current_ap_m->bssid() ) + { + server_m->get_connection_data()->set_previous_ap_data( + *server_m->get_connection_data()->current_ap_data() ); + + /** + * EAPOL must notified about the disassociation. + */ + if ( server_m->get_connection_data()->iap_data().is_eap_used() || + server_m->get_connection_data()->iap_data().is_wapi_used() ) + { + core_mac_address_s bssid = + server_m->get_connection_data()->previous_ap_data()->bssid(); + + network_id_c network( + &bssid.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + DEBUG6( "core_operation_roam_c::next_state() - EAPOL disassociation from BSSID %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + server_m->get_eapol_instance().disassociation( &network ); + } + } + + server_m->get_connection_data()->set_current_ap_data( + *current_ap_m ); + + core_operation_base_c* operation = new core_sub_operation_roam_update_ts_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + *current_ap_m ); + + return run_sub_operation( operation ); + } + case core_state_req_update_ts: + { + operation_state_m = core_state_req_enable_userdata; + + DEBUG( "core_operation_roam_c::next_state() - allowing user data" ); + + drivers_m->enable_user_data( + request_id_m ); + + break; + } + case core_state_req_enable_userdata: + { + DEBUG( "core_operation_roam_c::next_state() - connection done" ); + + server_m->get_connection_data()->set_last_rcp_class( core_rcp_normal ); + server_m->get_connection_data()->set_ssid( ssid_m ); + server_m->get_core_settings().roam_metrics().set_roam_ts_userdata_enabled(); + server_m->get_core_settings().roam_metrics().inc_roam_success_count(); + + server_m->get_connection_data()->clear_ap_association_failure_count( + current_ap_m->bssid() ); + + server_m->get_connection_data()->clear_all_authentication_failure_counts(); + + server_m->get_connection_data()->remove_temporary_blacklist_entries( + core_ap_blacklist_reason_eapol_failure | + core_ap_blacklist_reason_max_association_failure_count ); + + if ( current_ap_m->bssid() != server_m->get_connection_data()->last_bssid() ) + { + DEBUG( "core_operation_roam_c::next_state() - BSSID changed, notifying change" ); + + const core_mac_address_s bssid = current_ap_m->bssid(); + + adaptation_m->notify( + core_notification_bssid_changed, + sizeof ( bssid ), + &bssid.addr[0] ); + + server_m->get_connection_data()->set_last_bssid( + bssid ); + } + + if ( !is_connected_m ) + { + core_connection_state_e state = server_m->get_connection_data()->connection_state(); + server_m->get_core_settings().set_connection_state( state ); + + if ( server_m->get_connection_data()->last_connection_state() != state ) + { + u8_t buf[5]; + buf[0] = static_cast( state ); + + adaptation_m->notify( + core_notification_connection_state_changed, + 1, + buf ); + + server_m->get_connection_data()->set_last_connection_state( + state ); + } + } + + if ( current_ap_m->is_wpx() ) + { + server_m->get_wpx_adaptation_instance().handle_wpx_roam_success( + *current_ap_m ); + } + + if( current_ap_m->rrm_capabilities() & RRM_CAPABILITY_BIT_MASK_NEIGHBOR_REPORT ) + { + handle_neighbor_request(); + } + + /** + * If roaming to another AP, schedule a power save update. + * + * This is not done on first connect because we do not want to disturb + * DHCP negotiation. + */ + if ( server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_infrastructure && + server_m->get_connection_data()->previous_ap_data() ) + { + DEBUG( "core_operation_roam_c::next_state() - scheduling a power save update" ); + + core_operation_base_c* operation = new core_operation_update_power_mode_c( + REQUEST_ID_CORE_INTERNAL, + server_m, + drivers_m, + adaptation_m ); + + server_m->queue_int_operation( operation ); + } + + return core_error_ok; + } + case core_state_fail_connect: + { + DEBUG( "core_operation_roam_c::next_state() - connection failed" ); + + DEBUG1( "core_operation_roam_c::next_state() - failure_reason_m is %u", + failure_reason_m ); + DEBUG1( "core_operation_roam_c::next_state() - management_status_m is %u", + management_status_m ); + DEBUG1( "core_operation_roam_c::next_state() - is_cached_sa_used_m is %u", + is_cached_sa_used_m ); + + core_connect_status_e status = connect_status( + failure_reason_m, + management_status_m ); + + DEBUG1( "core_operation_roam_c::next_state() - connect_status is %u", + status ); + + server_m->get_connection_data()->set_connect_status( status ); + + const core_mac_address_s bssid = + current_ap_m->bssid(); + + DEBUG( "core_operation_roam_c::next_state() - removing current AP entries from scan list" ); + server_m->get_scan_list().remove_entries_by_bssid( + bssid ); + + update_roam_failure_count( + failure_reason_m, + management_status_m ); + + core_ap_blacklist_reason_e reason = + is_fatal_failure( + failure_reason_m, + management_status_m, + is_cached_sa_used_m ); + if( reason != core_ap_blacklist_reason_none ) + { + if ( reason == core_ap_blacklist_reason_eapol_failure ) + { + u8_t count_af( server_m->get_connection_data()->ap_authentication_failure_count( bssid ) ); + + u32_t max_ap_authentication_failure_count( + server_m->get_device_settings().max_ap_authentication_failure_count ); + + DEBUG1( "core_operation_roam_c::next_state() - this AP has failed %u time(s) in authentication earlier", + count_af ); + + if ( count_af >= max_ap_authentication_failure_count ) + { + DEBUG1( "core_operation_roam_c::next_state() - authentication failure count (%u), blacklisting the AP", count_af ); + server_m->get_connection_data()->add_mac_to_temporary_blacklist( + bssid, reason ); + } + else + { + DEBUG( "core_operation_roam_c::next_state() - increasing authentication failure count" ); + server_m->get_connection_data()->increase_ap_authentication_failure_count( bssid ); + } + } + else + { + DEBUG( "core_operation_roam_c::next_state() - fatal failure, blacklisting the AP"); + server_m->get_connection_data()->add_mac_to_temporary_blacklist( + bssid, reason ); + } + } + else + { + u8_t count( server_m->get_connection_data()->ap_association_failure_count( bssid ) ); + DEBUG1( "core_operation_roam_c::next_state() - this AP has failed %u time(s) earlier", + count ); + + u32_t max_ap_association_failure_count( + server_m->get_device_settings().max_ap_association_failure_count ); + if( server_m->get_connection_data()->iap_data().is_wapi_used() ) + { + max_ap_association_failure_count = CORE_MAX_WAPI_AP_ASSOCIATION_FAILURE_COUNT; + } + + if( count >= max_ap_association_failure_count - 1 ) + { + DEBUG1( "core_operation_roam_c::next_state() - failure count (%u) exceeded, blacklisting the AP", + max_ap_association_failure_count ); + server_m->get_connection_data()->add_mac_to_temporary_blacklist( + bssid, core_ap_blacklist_reason_max_association_failure_count ); + } + else + { + DEBUG( "core_operation_roam_c::next_state() - increasing AP failure count" ); + server_m->get_connection_data()->increase_ap_association_failure_count( bssid ); + } + } + + DEBUG1( "core_operation_roam_c::next_state() - setting tx power (%u)", + server_m->get_device_settings().tx_power_level ); + + operation_state_m = core_state_fail_set_tx_power; + + drivers_m->set_tx_power_level( + request_id_m, + server_m->get_device_settings().tx_power_level ); + + break; + } + case core_state_fail_set_tx_power: + { + u32_t tx_level = server_m->get_device_settings().tx_power_level; + if ( server_m->get_connection_data()->last_tx_level() != tx_level ) + { + DEBUG( "core_operation_roam_c::next_state() - TX level has changed, notifying change" ); + + adaptation_m->notify( + core_notification_tx_power_level_changed, + sizeof( tx_level ), + reinterpret_cast(&tx_level) ); + + server_m->get_connection_data()->set_last_tx_level( tx_level ); + } + + return failure_reason_m; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_roam_c::cancel() + { + DEBUG( "core_operation_roam_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_req_connect: + { + operation_state_m = core_state_fail_connect; + + return next_state(); + } + default: + { + return failure_reason_m; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_roam_c::is_security_association_available( + const core_ap_data_c& ap_data ) + { + DEBUG( "core_operation_roam_c::is_security_association_available() " ); + + core_type_list_c network_id_list; + + /*const*/ core_mac_address_s bssid( ap_data.bssid() ); + network_id_c * network_id = new network_id_c( + &bssid.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + if ( !network_id ) + { + DEBUG( "core_operation_roam_c::is_security_association_available() - unable to create network_id_c" ); + return false_t; + } + + network_id_list.append( network_id ); + + wlan_eapol_if_eapol_key_authentication_type_e auth_type = core_tools_c::eap_authentication_type( + server_m->get_connection_data()->iap_data(), + ap_data ); + + core_error_e ret = server_m->get_eapol_instance().check_pmksa_cache( + network_id_list, + auth_type, + core_tools_c::eapol_cipher( ap_data.best_pairwise_cipher() ), + core_tools_c::eapol_cipher( ap_data.best_group_cipher() ) ); + if ( ret != core_error_ok ) + { + DEBUG1( "core_operation_roam_c::is_security_association_available() - check_pmksa_cache returned %i", ret ); + if ( ret == core_error_request_pending ) + { + DEBUG( "core_operation_roam_c::is_security_association_available() - check_pmksa_cache returns core_error_request_pending! Implement complete_check_pmksa_cache for asynchronous operation! " ); + } + + return false_t; + } + + // Ok, because ret == core_error_ok, we know that complete_check_pmksa_cache is already called from EAPOL. + // If ret == core_error_request_pending, we should wait until complete_check_pmksa_cache. + core_type_list_c< core_mac_address_s > & pmksa_list = server_m->get_eapol_instance().get_completed_check_pmksa_cache_list(); + + DEBUG1( "core_operation_roam_c::is_security_association_available() - pmksa_list.count() = %i", pmksa_list.count() ); + + if ( !pmksa_list.count() ) + { + pmksa_list.clear(); + return false_t; + } + + core_mac_address_s* list_obj = pmksa_list.first(); + if ( !list_obj ) + { + pmksa_list.clear(); + return false_t; + } + + if ( *list_obj != bssid ) + { + pmksa_list.clear(); + return false_t; + } + + pmksa_list.clear(); + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connect_status_e core_operation_roam_c::connect_status( + core_error_e request_status, + core_management_status_e management_status ) + { + DEBUG( "core_operation_roam_c::connect_status()" ); + + core_iap_data_c& iap_data( server_m->get_connection_data()->iap_data() ); + + if ( management_status == core_management_status_assoc_denied_full_ap ) + { + DEBUG( "core_operation_roam_c::connect_status() - AP full" ); + return core_connect_ap_full; + } + + if ( request_status == core_error_eapol_auth_start_timeout ) + { + DEBUG( "core_operation_roam_c::connect_status() - EAPOL authentication timeout before authentication was started" ); + return core_connect_eapol_auth_start_timeout; + } + + switch( iap_data.security_mode() ) + { + case core_security_mode_wep: + { + if ( management_status == core_management_status_auth_algo_not_supported ) + { + if ( iap_data.authentication_mode() == core_authentication_mode_open ) + { + DEBUG( "core_operation_roam_c::connect_status() - open authentication unsupported (WEP)" ); + return core_connect_wep_open_authentication_unsupported; + } + else + { + DEBUG( "core_operation_roam_c::connect_status() - shared authentication unsupported (WEP)" ); + return core_connect_wep_shared_authentication_unsupported; + } + } + else if ( iap_data.authentication_mode() == core_authentication_mode_shared && + ( management_status == core_management_status_auth_challenge_failure || + management_status == core_management_status_auth_frame_out_of_sequence || + request_status == core_error_timeout ) ) + { + DEBUG( "core_operation_roam_c::connect_status() - shared authentication failed (WEP)" ); + return core_connect_wep_shared_authentication_failed; + } + else if ( management_status == core_management_status_unsupported_capabilities && + !current_ap_m->is_privacy_enabled() ) + { + DEBUG( "core_operation_roam_c::connect_status() - association using privacy failed (WEP)" ); + return core_connect_iap_wep_but_ap_has_no_privacy; + } + + break; + } + case core_security_mode_allow_unsecure: + { + break; + } + case core_security_mode_802dot1x: + { + if ( request_status == core_error_eapol_total_failure || + request_status == core_error_eapol_failure ) + { + DEBUG( "core_operation_roam_c::connect_status() - 802.1x EAP failure" ); + return eap_connect_status( + iap_data.security_mode(), + server_m->get_connection_data()->last_failed_eap_type(), + server_m->get_connection_data()->last_eap_error() ); + } + else if ( management_status == core_management_status_auth_algo_not_supported ) + { + DEBUG( "core_operation_roam_c::connect_status() - authentication algorithm not supported (802.1x)" ); + return core_connect_802_1x_authentication_algorithm_not_supported; + } + + break; + } + case core_security_mode_wpa: + /** Falls through on purpose. */ + case core_security_mode_wpa2only: + { + if ( request_status == core_error_eapol_total_failure || + request_status == core_error_eapol_failure ) + { + if ( iap_data.is_psk_used() ) + { + DEBUG( "core_operation_roam_c::connect_status() - WPA-PSK failure" ); + return core_connect_wpa_psk_failure; + } + else + { + DEBUG( "core_operation_roam_c::connect_status() - WPA EAP failure" ); + return eap_connect_status( + iap_data.security_mode(), + server_m->get_connection_data()->last_failed_eap_type(), + server_m->get_connection_data()->last_eap_error() ); + } + } + + break; + } + case core_security_mode_wapi: + { + if ( request_status == core_error_eapol_total_failure || + request_status == core_error_eapol_failure ) + { + if ( iap_data.is_psk_used() ) + { + DEBUG( "core_operation_roam_c::connect_status() - WAPI-PSK failure" ); + return core_connect_wapi_psk_failure; + } + else + { + DEBUG( "core_operation_roam_c::connect_status() - WAPI certificate failure" ); + return core_connect_wapi_certificate_failure; + } + } + + break; + } + + default: + { + ASSERT( false_t ); + } + } + + return core_connect_undefined; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_blacklist_reason_e core_operation_roam_c::is_fatal_failure( + core_error_e request_status, + core_management_status_e management_status, + bool_t is_cached_sa_used ) const + { + DEBUG( "core_operation_roam_c::is_fatal_failure()" ); + + /** + * EAPOL failures in 802.1x/WPA mode are all fatal but blacklisting + * is only done with core_error_eapol_failure because others cause + * the connection to be shutdown immediately. + */ + if( request_status == core_error_eapol_failure && + server_m->get_connection_data()->iap_data().is_eap_used() ) + { + DEBUG( "core_operation_roam_c::is_fatal_failure() - fatal, EAP failure" ); + return core_ap_blacklist_reason_eapol_failure; + } + + /** + * Don't consider a failed (re-)association attempt as fatal since it's + * possible AP just doesn't have our authentication cached any more. + */ + if ( is_cached_sa_used ) + { + DEBUG( "core_operation_roam_c::is_fatal_failure() - not fatal, a reassociation attempt" ); + return core_ap_blacklist_reason_none; + } + + /** + * Non-fatal WPX management status codes should not cause blacklisting. + */ + if ( server_m->get_wpx_adaptation_instance().is_wpx_management_status( management_status ) && + !server_m->get_wpx_adaptation_instance().is_fatal_wpx_management_status( management_status ) ) + { + DEBUG( "core_operation_roam_c::is_fatal_failure() - not fatal, WPX-specific management status" ); + return core_ap_blacklist_reason_none; + } + + if ( management_status != core_management_status_success && + management_status != core_management_status_assoc_denied_full_ap ) + { + DEBUG1( "core_operation_roam_c::is_fatal_failure() - fatal, management status %u", + management_status ); + return core_ap_blacklist_reason_association_status; + } + + DEBUG( "core_operation_roam_c::is_fatal_failure() - not fatal" ); + return core_ap_blacklist_reason_none; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connect_status_e core_operation_roam_c::eap_connect_status( + core_security_mode_e security_mode, + u32_t eap_type, + u32_t eap_error ) const + { + DEBUG( "core_operation_roam_c::eap_connect_status()" ); + DEBUG1( "core_operation_roam_c::eap_connect_status() - eap_type %u", + eap_type ); + DEBUG1( "core_operation_roam_c::eap_connect_status() - eap_error %u", + eap_error ); + + core_connect_status_e status( core_connect_wpa_eap_failure ); + if ( security_mode == core_security_mode_802dot1x ) + { + status = core_connect_802_1x_failure; + } + + /** + * Handle EAP type specific errors. + */ + switch ( eap_type ) + { + case wlan_eapol_if_eap_type_tls: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_certificate_expired: + case wlan_eapol_if_eap_status_certificate_revoked: + status = core_connect_eap_tls_server_certificate_expired; + break; + case wlan_eapol_if_eap_status_unsupported_certificate: + status = core_connect_eap_tls_server_certificate_unknown; + break; + case wlan_eapol_if_eap_status_user_certificate_unknown: + status = core_connect_eap_tls_user_certificate_unknown; + break; + case wlan_eapol_if_eap_status_illegal_cipher_suite: + status = core_connect_eap_tls_illegal_cipher_suite; + break; + case wlan_eapol_if_eap_status_bad_certificate: + status = core_connect_eap_tls_user_rejected; + break; + default: + status = core_connect_eap_tls_failure; + } + break; + } + case wlan_eapol_if_eap_type_leap: + { + status = core_connect_eap_leap_failure; + break; + } + case wlan_eapol_if_eap_type_gsmsim: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_identity_query_failed: + status = core_connect_eap_sim_identity_query_failed; + break; + case wlan_eapol_if_eap_status_user_has_not_subscribed_to_the_requested_service: + status = core_connect_eap_sim_user_has_not_subscribed_to_the_requested_service; + break; + case wlan_eapol_if_eap_status_users_calls_are_barred: + status = core_connect_eap_sim_users_calls_are_barred; + break; + default: + status = core_connect_eap_sim_failure; + } + break; + } + case wlan_eapol_if_eap_type_ttls: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_certificate_expired: + case wlan_eapol_if_eap_status_certificate_revoked: + status = core_connect_eap_ttls_server_certificate_expired; + break; + case wlan_eapol_if_eap_status_unsupported_certificate: + status = core_connect_eap_ttls_server_certificate_unknown; + break; + case wlan_eapol_if_eap_status_user_certificate_unknown: + status = core_connect_eap_ttls_user_certificate_unknown; + break; + case wlan_eapol_if_eap_status_illegal_cipher_suite: + status = core_connect_eap_ttls_illegal_cipher_suite; + break; + case wlan_eapol_if_eap_status_bad_certificate: + status = core_connect_eap_ttls_user_rejected; + break; + default: + status = core_connect_eap_ttls_failure; + } + break; + } + case wlan_eapol_if_eap_type_aka: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_identity_query_failed: + status = core_connect_eap_sim_identity_query_failed; + break; + case wlan_eapol_if_eap_status_user_has_not_subscribed_to_the_requested_service: + status = core_connect_eap_sim_user_has_not_subscribed_to_the_requested_service; + break; + case wlan_eapol_if_eap_status_users_calls_are_barred: + status = core_connect_eap_sim_users_calls_are_barred; + break; + default: + status = core_connect_eap_aka_failure; + } + break; + } + case wlan_eapol_if_eap_type_peap: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_certificate_expired: + case wlan_eapol_if_eap_status_certificate_revoked: + status = core_connect_eap_peap_server_certificate_expired; + break; + case wlan_eapol_if_eap_status_unsupported_certificate: + status = core_connect_eap_peap_server_certificate_unknown; + break; + case wlan_eapol_if_eap_status_user_certificate_unknown: + status = core_connect_eap_peap_user_certificate_unknown; + break; + case wlan_eapol_if_eap_status_illegal_cipher_suite: + status = core_connect_eap_peap_illegal_cipher_suite; + break; + case wlan_eapol_if_eap_status_bad_certificate: + status = core_connect_eap_peap_user_rejected; + break; + default: + status = core_connect_eap_peap_failure; + } + break; + } + case wlan_eapol_if_eap_type_mschapv2: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_password_expired: + status = core_connect_eap_mschapv2_password_expired; + break; + case wlan_eapol_if_eap_status_no_dialin_permission: + status = core_connect_eap_mschapv2_no_dialin_permission; + break; + case wlan_eapol_if_eap_status_account_disabled: + status = core_connect_eap_mschapv2_account_disabled; + break; + case wlan_eapol_if_eap_status_restricted_logon_hours: + status = core_connect_eap_mschapv2_restricted_logon_hours; + break; + default: + status = core_connect_eap_mschapv2_failure; + } + break; + } + case wlan_eapol_if_eap_type_fast: + { + switch ( eap_error ) + { + case wlan_eapol_if_eap_status_tunnel_compromise_error: + status = core_connect_eap_fast_tunnel_compromise_error; + break; + case wlan_eapol_if_eap_status_unexpected_tlv_exhanged: + status = core_connect_eap_fast_unexpected_tlv_exhanged; + break; + case wlan_eapol_if_eap_status_no_pac_nor_certs_to_authenticate_with_provision_disabled: + status = core_connect_eap_fast_no_pac_nor_certs_to_authenticate_with_provision_disabled; + break; + case wlan_eapol_if_eap_status_no_matching_pac_for_aid: + status = core_connect_eap_fast_no_matching_pac_for_aid; + break; + case wlan_eapol_if_eap_status_pac_store_corrupted: + status = core_connect_eap_fast_pac_store_corrupted; + break; + case wlan_eapol_if_eap_status_authentication_failure: /* flow through on purpose */ + default: + status = core_connect_eap_fast_authentication_failed; + } + break; + } + default: + break; + } + + return status; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_roam_c::process_frame( + core_ap_data_c& ap_data ) + { + connect_status_m = core_tools_parser_c::is_ap_suitable( + server_m->get_wpx_adaptation_instance(), + ap_data, + server_m->get_connection_data()->iap_data(), + server_m->get_core_settings(), + *server_m->get_connection_data(), + min_required_rcpi_m, + min_medium_time_m, + server_m->is_cm_active(), + current_bssid_m ); + + if( connect_status_m == core_connect_ok ) + { + roaming_list_entry_s* entry = new roaming_list_entry_s; + if( !entry ) + { + DEBUG( "core_operation_roam_c::process_frame() - unable to roaming_list_entry_s instance()" ); + + return false_t; + } + + entry->ap_data = NULL; + entry->is_cached_sa_available = false_t; + + entry->ap_data = core_ap_data_c::instance( ap_data ); + if( !entry->ap_data ) + { + DEBUG( "core_operation_roam_c::process_frame() - unable to create core_ap_data_c instance()" ); + + delete entry; + entry = NULL; + + return false_t; + } + + u32_t entry_score( entry->ap_data->rcpi() ); + + /** + * If this is a roaming situation, APs supporting WPX fast-roam or with + * cached PMKSAs are preferred over others. + */ + if( server_m->get_connection_data()->current_ap_data() && + server_m->get_connection_data()->iap_data().is_802dot1x_used() && + entry->ap_data->is_wpx_fast_roam_available() && + is_security_association_available( *server_m->get_connection_data()->current_ap_data() ) ) + { + DEBUG( "core_operation_roam_c::process_frame() - WPX fast-roam supported" ); + + entry->is_cached_sa_available = true_t; + entry_score += CORE_ROAMING_LIST_BONUS_WPX_FAST_ROAM; + } + else if( server_m->get_connection_data()->iap_data().is_eap_used() && + is_security_association_available( *entry->ap_data ) ) + { + DEBUG( "core_operation_roam_c::process_frame() - a cached PMKSA found" ); + + entry->is_cached_sa_available = true_t; + entry_score += CORE_ROAMING_LIST_BONUS_PMKSA; + } + + // These conditions could be added to previous conditions... + if( server_m->get_connection_data()->current_ap_data() ) // previous connection exists + { + if( !server_m->get_connection_data()->current_ap_data()->is_wpx_fast_roam_available() && // previous connection was not WPX + entry->ap_data->is_wpx_fast_roam_available() ) // AND new connection is WPX + { + DEBUG( "core_operation_roam_c::process_frame() - reassociation is not possible, previous connection was not WPX, but new connection is WPX" ); + entry->is_cached_sa_available = false_t; + } + } + else // previous connection does not exists + { + if( entry->ap_data->is_wpx_fast_roam_available() ) // new connection has WPX + { + DEBUG( "core_operation_roam_c::process_frame() - reassociation is not possible, there is no previous connection and new is WPX" ); + entry->is_cached_sa_available = false_t; + } + } + + /** + * If AP advertises QBSS Load IE, check the amount of connected + * stations and adjust the score accordingly. + */ + const core_frame_qbss_load_ie_c* qbss_load_ie = entry->ap_data->qbss_load_ie(); + if( qbss_load_ie ) + { + DEBUG1( "core_ap_data_c::process_frame() - QBSS Load IE detected, %u station(s) associated", + qbss_load_ie->station_count() ); + + delete qbss_load_ie; + } + + roaming_list_m.append( + entry, + entry_score ); + + return true_t; + } + + DEBUG1( "core_operation_roam_c::process_frame() - AP is unsuitable, reason %u", + connect_status_m ); + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_roam_c::update_roam_failure_count( + core_error_e request_status, + core_management_status_e management_status ) + { + core_roam_failed_reason_e failure_reason( core_roam_failed_reason_none ); + + if ( request_status == core_error_eapol_failure || + request_status == core_error_eapol_total_failure ) + { + failure_reason = core_roam_failed_reason_eapol_failure; + } + else if ( request_status == core_error_timeout ) + { + failure_reason = core_roam_failed_reason_timeout; + } + else if ( management_status != core_management_status_success ) + { + failure_reason = core_roam_failed_reason_ap_status_code; + } + else + { + failure_reason = core_roam_failed_reason_other_failure; + } + + server_m->get_core_settings().roam_metrics().inc_roam_attempt_failed_count( + failure_reason ); + if ( server_m->get_connection_data()->last_roam_failed_reason() == core_roam_failed_reason_none || + server_m->get_connection_data()->last_roam_failed_reason() == core_roam_failed_reason_no_suitable_ap ) + { + server_m->get_connection_data()->set_last_roam_failed_reason( failure_reason ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_roam_c::handle_neighbor_request() + { + /* neighbor report request */ + DEBUG( "core_operation_roam_c::handle_neighbor_request() - Neighbor report bit is on" ); + + core_frame_action_c* request = NULL; + + // create IE + core_frame_nr_ie_c* nr_request = core_frame_nr_ie_c::instance( ssid_m ); + if ( nr_request ) + { + // create frame, frame ownership will belong to caller of this method + request = core_frame_action_nr_c::instance( + 0, // Duration + current_ap_m->bssid(), // Destination + server_m->own_mac_addr(), // Source + current_ap_m->bssid(), // BSSID + 0, // Sequence Control + core_frame_radio_measurement_action_c::core_dot11_action_rm_type_neighbor_req, // Action Type + 0, // Dialog Token + nr_request ); + + if ( !request ) + { + DEBUG( "core_operation_roam_c::handle_neighbor_request() - Unable to instantiate core_frame_action_nr_c" ); + } + + delete nr_request; + nr_request = NULL; + } + else + { + DEBUG( "core_operation_roam_c::handle_neighbor_request() - Unable to instantiate core_frame_nr_ie_c" ); + } + + if ( request ) + { + DEBUG1( "core_operation_roam_c::handle_neighbor_request() - sending frame (%u bytes): ", + request->data_length() ); + DEBUG_BUFFER( + request->data_length(), + request->data() ); + + server_m->send_management_frame( + core_frame_type_dot11, + request->data_length(), + request->data(), + current_ap_m->bssid() ); + + delete request; + request = NULL; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_scan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_scan.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,575 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* ST-Ericsson +* +* Description: Statemachine for scanning +* +*/ + + +#include "core_operation_scan.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_frame_beacon.h" +#include "core_scan_list.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_scan_c::core_operation_scan_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + u8_t scan_max_age, + ScanList& scan_data, + bool_t passive_scan_all_channels, + bool_t is_current_ap_added ) : + core_operation_base_c( core_operation_scan, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + scan_mode_m( scan_mode ), + scan_ssid_m( scan_ssid ), + scan_channels_m( scan_channels ), + scan_max_age_m( scan_max_age ), + scan_data_m( scan_data ), + passive_scan_all_channels_m( passive_scan_all_channels ), + region_from_ap_m( core_wlan_region_fcc ), + is_current_ap_added_m( is_current_ap_added ), + current_rcpi_m( 0 ) + { + DEBUG( "core_operation_scan_c::core_operation_scan_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_scan_c::~core_operation_scan_c() + { + DEBUG( "core_operation_scan_c::~core_operation_scan_c()" ); + + server_m->unregister_event_handler( this ); + server_m->unregister_frame_handler( this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_scan_c::next_state() + { + DEBUG( "core_operation_scan_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_scan_start; + + u32_t min_ch_time( server_m->get_device_settings().active_scan_min_ch_time ); + u32_t max_ch_time( server_m->get_device_settings().active_scan_max_ch_time ); + if ( scan_mode_m == core_scan_mode_passive ) + { + min_ch_time = server_m->get_device_settings().passive_scan_min_ch_time; + max_ch_time = server_m->get_device_settings().passive_scan_max_ch_time; + } + + if ( scan_ssid_m.length ) + { + DEBUG1S( "core_operation_scan_c::next_state() - requesting a direct scan with SSID ", + scan_ssid_m.length, &scan_ssid_m.ssid[0] ); + } + else + { + DEBUG( "core_operation_scan_c::next_state() - requesting a broadcast scan" ); + } + + bool_t is_split_scan( false_t ); + if ( server_m->get_core_settings().is_connected() ) + { + is_split_scan = true_t; + DEBUG( "core_operation_scan_c::next_state() - requesting a split-scan" ); + } + else + { + DEBUG( "core_operation_scan_c::next_state() - requesting a regular scan" ); + } + + server_m->get_scan_list().remove_entries_by_age( + server_m->get_device_settings().scan_list_expiration_time ); + + server_m->get_scan_list().set_tag( + core_scan_list_tag_scan ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + scan_mode_m, + scan_ssid_m, + server_m->get_device_settings().scan_rate, + server_m->get_core_settings().valid_scan_channels( scan_channels_m ), + min_ch_time, + max_ch_time, + is_split_scan ); + + break; + } + case core_state_scan_start: + { + DEBUG( "core_operation_scan_c::next_state() - scan request completed, waiting for scan completion" ); + + break; + } + case core_state_scan_complete: + { + /* If country information is not known then channels 12 and 13 can be scanned in passive mode */ + if ( server_m->get_core_settings().mcc_known() || scan_ssid_m.length || !passive_scan_all_channels_m ) + { + /* All possible scans are done. + * When MCC information is known, the allowed scan channels are known and handled already. + * If SSID is given then direct scan would be required so no need to do passive broadcast scan. + * If operation does not require passive scanning on channels 12 and 13, this is not done. + */ + return goto_state( core_state_scan_complete_handle_result ); + } + + operation_state_m = core_state_scan_start_unknown_region; + + u32_t min_ch_time( server_m->get_device_settings().passive_scan_min_ch_time ); + u32_t max_ch_time( server_m->get_device_settings().passive_scan_max_ch_time ); + + bool_t is_split_scan( false_t ); + if ( server_m->get_core_settings().is_connected() ) + { + is_split_scan = true_t; + DEBUG( "core_operation_scan_c::next_state() - requesting a split-scan for channels 12 and 13" ); + } + else + { + DEBUG( "core_operation_scan_c::next_state() - requesting a regular scan for channels 12 and 13" ); + } + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_passive, + scan_ssid_m, + server_m->get_device_settings().scan_rate, + server_m->get_core_settings().invalid_scan_channels( scan_channels_m ), + min_ch_time, + max_ch_time, + is_split_scan ); + + break; + } + case core_state_scan_start_unknown_region: + { + DEBUG( "core_operation_scan_c::next_state() - scan request for channels 12 and 13 completed, waiting for scan completion" ); + + break; + } + case core_state_scan_complete_unknown_region: + { + server_m->unregister_frame_handler( this ); + server_m->get_scan_list().print_contents(); // Additional print + + operation_state_m = core_state_scan_complete_store_country_info; + + /* If WLAN region was not known before the scan, then check if country information is present + * in the scan results. APs on channels 12 and 13 must be ignored if country information indicates this. + */ + core_scan_list_iterator_by_tag_c iter_country_beacon( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + + core_wlan_region_e found_region = core_wlan_region_undefined; + bool_t inconsistent_info( false_t ); + for ( core_ap_data_c* ap_data = iter_country_beacon.first(); ap_data; ap_data = iter_country_beacon.next() ) + { + core_country_string_s country_info = ap_data->country_info(); + core_wlan_region_e ap_region = core_wlan_region_undefined; + if ( country_info.country[0] != 0 ) + { + ap_region = core_tools_c::convert_country_to_region( country_info ); + if ( found_region != core_wlan_region_undefined ) + { + if ( ap_region != found_region ) + { + inconsistent_info = true_t; + } + } + else + { + found_region = ap_region; + } + } + } + if ( found_region != core_wlan_region_undefined ) + { + if ( !inconsistent_info ) + { + region_from_ap_m = found_region; + } + else + { + region_from_ap_m = core_wlan_region_etsi; + } + adaptation_m->store_ap_country_info( request_id_m, region_from_ap_m, inconsistent_info ); + } + else + { + DEBUG( "core_operation_scan_c::next_state() - country info not found, continue with handling scan results" ); + return goto_state( core_state_scan_complete_handle_result ); + } + break; + } + + case core_state_scan_complete_store_country_info: + { + operation_state_m = core_state_scan_complete_handle_result; + + /* Set the new region information also to core settings */ + DEBUG1( "core_operation_scan_c::next_state() - current region %u", + region_from_ap_m ); + server_m->get_core_settings().set_regional_domain( + region_from_ap_m ); + server_m->get_core_settings().set_mcc_known( true_t ); + + return goto_state( core_state_scan_complete_handle_result ); + } + + case core_state_scan_complete_handle_result: + { + /* If region is FCC, then ignore and remove the APs from channels 12 and 13 */ + if ( server_m->get_core_settings().regional_domain() == core_wlan_region_fcc ) + { + DEBUG( "core_operation_scan_c::next_state() - remove APs that were found on channels 12 and 13" ); + remove_disallowed_aps(); + } + + DEBUG( "core_operation_scan_c::next_state() - final scan list" ); + server_m->get_scan_list().print_contents(); // Additional print + + /** + * If we have an ongoing connection, we'll have to see whether + * the current AP was found in the scan. + */ + core_ssid_s current_ssid( BROADCAST_SSID ); + core_mac_address_s current_bssid( ZERO_MAC_ADDR ); + bool_t is_current_ap_in_list( true_t ); + if ( is_current_ap_added_m && + server_m->get_connection_data() && + server_m->get_connection_data()->current_ap_data() ) + { + current_ssid = + server_m->get_connection_data()->ssid(); + current_bssid = + server_m->get_connection_data()->current_ap_data()->bssid(); + + /** + * Current AP only needs to be added in a broadcast scan or a direct + * scan done with the same SSID. + */ + if ( !scan_ssid_m.length || + scan_ssid_m == current_ssid ) + { + is_current_ap_in_list = false_t; + } + } + + if ( scan_ssid_m.length ) + { + core_scan_list_iterator_by_tag_and_ssid_c iter( + server_m->get_scan_list(), + core_scan_list_tag_scan, + scan_ssid_m ); + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + const core_mac_address_s bssid = ap_data->bssid(); + + if ( !server_m->get_core_settings().is_mac_in_permanent_blacklist( bssid ) ) + { + if ( !is_current_ap_in_list && + current_bssid == bssid && + current_ssid == ap_data->ssid() ) + { + is_current_ap_in_list = true_t; + } + + core_tools_c::add_beacon_to_scan_list( + scan_data_m, + *ap_data, + ap_data->rcpi() ); + } + } + } + else if ( !scan_max_age_m ) + { + core_scan_list_iterator_by_tag_c iter( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + const core_mac_address_s bssid = ap_data->bssid(); + + if ( !server_m->get_core_settings().is_mac_in_permanent_blacklist( bssid ) ) + { + if ( !is_current_ap_in_list && + current_bssid == bssid && + current_ssid == ap_data->ssid() ) + { + is_current_ap_in_list = true_t; + } + + core_tools_c::add_beacon_to_scan_list( + scan_data_m, + *ap_data, + ap_data->rcpi() ); + } + } + } + else + { + core_scan_list_iterator_by_age_c iter( + server_m->get_scan_list(), + scan_max_age_m ); + for ( core_ap_data_c* ap_data = iter.first(); ap_data; ap_data = iter.next() ) + { + const core_mac_address_s bssid = ap_data->bssid(); + + if ( !server_m->get_core_settings().is_mac_in_permanent_blacklist( bssid ) ) + { + if ( !is_current_ap_in_list && + current_bssid == bssid && + current_ssid == ap_data->ssid() ) + { + is_current_ap_in_list = true_t; + } + + core_tools_c::add_beacon_to_scan_list( + scan_data_m, + *ap_data, + ap_data->rcpi() ); + } + } + } + + if ( is_current_ap_in_list ) + { + return goto_state( core_state_scanning_done ); + } + + operation_state_m = core_state_rcpi_received; + + DEBUG( "core_operation_scan_c::next_state() - current AP was not found in scan" ); + DEBUG( "core_operation_scan_c::next_state() - requesting RCPI" ); + + drivers_m->get_current_rcpi( + request_id_m, + current_rcpi_m ); + + break; + } + case core_state_rcpi_received: + { + DEBUG1( "core_operation_scan_c::next_state() - current RCPI is %u", + current_rcpi_m ); + DEBUG( "core_operation_scan_c::next_state() - appending current AP to the scan list" ); + + core_tools_c::add_beacon_to_scan_list( + scan_data_m, + *server_m->get_connection_data()->current_ap_data(), + current_rcpi_m ); + + return goto_state( core_state_scanning_done ); + } + case core_state_scanning_done: + { + DEBUG( "core_operation_scan_c::next_state() - scan complete" ); + DEBUG1( "core_operation_scan_c::next_state() - scan list contains %u AP(s)", + scan_data_m.Count() ); + DEBUG1( "core_operation_scan_c::next_state() - scan list size is %u bytes", + scan_data_m.Size() ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_scan_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG1( "core_operation_scan_c::user_cancel(do_graceful_cancel=%d)", do_graceful_cancel ); + + /** + * If region is FCC and region information is not known, then ignore + * and remove the APs from channels 12 and 13 + */ + if ( !server_m->get_core_settings().mcc_known() && + server_m->get_core_settings().regional_domain() == core_wlan_region_fcc ) + { + DEBUG( "core_operation_scan_c::next_state() - remove APs that were found on channels 12 and 13" ); + remove_disallowed_aps(); + } + + if ( !do_graceful_cancel ) + { + /** + * If we are in a middle of a scan, we have to schedule our own + * event. + */ + if ( ( operation_state_m == core_state_scan_start || + operation_state_m == core_state_scan_start_unknown_region ) && + server_m->event_handler() == this && + server_m->frame_handler() == this ) + { + asynch_default_user_cancel(); + + return; + } + + /** + * Everything else is handled by the default implementation. + */ + core_operation_base_c::user_cancel( do_graceful_cancel ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_scan_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ) + { + DEBUG( "core_operation_scan_c::receive_frame()" ); + + if ( frame->type() != core_frame_dot11_c::core_dot11_type_beacon && + frame->type() != core_frame_dot11_c::core_dot11_type_probe_resp ) + { + DEBUG( "core_operation_scan_c::receive_frame() - not a beacon or a probe" ); + return false_t; + } + + core_ap_data_c* ap_data = core_ap_data_c::instance( + server_m->get_wpx_adaptation_instance(), + frame, + rcpi, + false_t ); + if ( ap_data ) + { + const core_ssid_s ssid = ap_data->ssid(); + DEBUG1S( "core_operation_scan_c::receive_frame() - SSID: ", + ssid.length, &ssid.ssid[0] ); + + core_mac_address_s bssid( + ap_data->bssid() ); + DEBUG6( "core_operation_scan_c::receive_frame() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + server_m->get_scan_list().update_entry( *ap_data ); + + delete ap_data; + ap_data = NULL; + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_operation_scan_c::notify( + core_am_indication_e indication ) + { + if ( operation_state_m == core_state_scan_start && + indication == core_am_indication_wlan_scan_complete ) + { + server_m->unregister_event_handler( this ); + + DEBUG( "core_operation_scan_c::notify() - scan complete" ); + + asynch_goto( core_state_scan_complete, CORE_TIMER_IMMEDIATELY ); + + return true_t; + } + else if ( operation_state_m == core_state_scan_start_unknown_region && + indication == core_am_indication_wlan_scan_complete ) + { + server_m->unregister_event_handler( this ); + + DEBUG( "core_operation_scan_c::notify() - scan complete for channels 12 and 13" ); + + asynch_goto( core_state_scan_complete_unknown_region, CORE_TIMER_IMMEDIATELY ); + + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_operation_scan_c::remove_disallowed_aps() + { + core_type_list_c remove_ap_list; + + core_scan_list_iterator_by_tag_c iter_removed_aps( + server_m->get_scan_list(), + core_scan_list_tag_scan ); + + core_ap_data_c* ap_data = iter_removed_aps.first(); + while (ap_data) + { + if ( !server_m->get_core_settings().is_valid_channel( + SCAN_BAND_2DOT4GHZ, + ap_data->channel() ) ) + { + core_mac_address_s* ignored_ap = new core_mac_address_s; + if ( ignored_ap ) + { + *ignored_ap = ap_data->bssid(); + remove_ap_list.append( ignored_ap ); + } + } + ap_data = iter_removed_aps.next(); + } + + core_mac_address_s* ignored_bssid = remove_ap_list.first(); + while (ignored_bssid ) + { + server_m->get_scan_list().remove_entries_by_bssid( *ignored_bssid ); + ignored_bssid = remove_ap_list.next(); + } + remove_ap_list.clear(); + + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_set_arp_filter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_set_arp_filter.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for updating arp filter +* +*/ + + +#include "core_operation_set_arp_filter.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_set_arp_filter_c::core_operation_set_arp_filter_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_arp_filter_s& filter ) : + core_operation_base_c( core_operation_set_arp_filter, request_id, server, + drivers, adaptation, core_base_flag_none ), + arp_filter_m( filter ) + { + DEBUG( "core_operation_set_arp_filter_c::core_operation_set_arp_filter_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_set_arp_filter_c::~core_operation_set_arp_filter_c() + { + DEBUG( "core_operation_set_arp_filter_c::~core_operation_set_arp_filter_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_set_arp_filter_c::next_state() + { + DEBUG( "core_operation_set_arp_filter_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + + if ( !server_m->get_core_settings().is_driver_loaded() ) + { + DEBUG( "core_operation_set_arp_filter_c::next_state() - driver not loaded, enabling not possible, completing operation" ); + + return core_error_ok; + } + + operation_state_m = core_state_set_arp_filter; + + if ( arp_filter_m.enable_filter ) + { + DEBUG( "core_operation_set_arp_filter_c::next_state() - setting ARP IP filter" ); + DEBUG4( "core_operation_set_arp_filter_c::next_state() - IP addr: %d.%d.%d.%d", + ( arp_filter_m.ipv4_addr & 0x000000ff ), + ( arp_filter_m.ipv4_addr & 0x0000ff00 ) >> 8, + ( arp_filter_m.ipv4_addr & 0x00ff0000 ) >> 16, + ( arp_filter_m.ipv4_addr & 0xff000000 ) >> 24 ); + } + else + { + DEBUG( "core_operation_set_arp_filter_c::next_state() - disabling ARP IP filter" ); + } + + drivers_m->set_arp_filter( request_id_m, arp_filter_m ); + + break; + } + case core_state_set_arp_filter: + { + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_set_power_save_settings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_set_power_save_settings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for setting the power save settings. +* +*/ + + +#include "core_operation_set_power_save_settings.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_set_power_save_settings_c::core_operation_set_power_save_settings_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_power_save_settings_s& settings ) : + core_operation_base_c( core_operation_set_power_save_settings, request_id, server, drivers, adaptation, + core_base_flag_none ), + power_save_settings_m( settings ) + { + DEBUG( "core_operation_set_power_save_settings_c::core_operation_set_power_save_settings_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_set_power_save_settings_c::~core_operation_set_power_save_settings_c() + { + DEBUG( "core_operation_set_power_save_settings_c::~core_operation_set_power_save_settings_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_set_power_save_settings_c::next_state() + { + DEBUG( "core_operation_set_power_save_settings_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + server_m->get_core_settings().set_power_save_settings( + power_save_settings_m ); + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_set_power_save_settings_c::next_state() - not connected, no reason to set anything" ); + + return core_error_ok; + } + + operation_state_m = core_state_set_power_save_settings; + + DEBUG( "core_operation_set_power_save_settings_c::next_state() - setting power save settings" ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_uapsd_power_save_for_voice: %u", + power_save_settings_m.stay_in_uapsd_power_save_for_voice ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_uapsd_power_save_for_video: %u", + power_save_settings_m.stay_in_uapsd_power_save_for_video ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_uapsd_power_save_for_best_effort: %u", + power_save_settings_m.stay_in_uapsd_power_save_for_best_effort ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_uapsd_power_save_for_background: %u", + power_save_settings_m.stay_in_uapsd_power_save_for_background ); + + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_legacy_power_save_for_voice: %u", + power_save_settings_m.stay_in_legacy_power_save_for_voice ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_legacy_power_save_for_video: %u", + power_save_settings_m.stay_in_legacy_power_save_for_video ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_legacy_power_save_for_best_effort: %u", + power_save_settings_m.stay_in_legacy_power_save_for_best_effort ); + DEBUG1( "core_operation_set_power_save_settings_c::nex() - stay_in_legacy_power_save_for_background: %u", + power_save_settings_m.stay_in_legacy_power_save_for_background ); + + drivers_m->set_power_save_settings( + request_id_m, + power_save_settings_m ); + + break; + } + case core_state_set_power_save_settings: + { + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_set_uapsd_settings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_set_uapsd_settings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for setting U-APSD settings. +* +*/ + + +#include "core_operation_set_uapsd_settings.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_set_uapsd_settings_c::core_operation_set_uapsd_settings_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_uapsd_settings_s& settings ) : + core_operation_base_c( core_operation_set_uapsd_settings, request_id, server, drivers, adaptation, + core_base_flag_none ), + uapsd_settings_m( settings ) + { + DEBUG( "core_operation_set_uapsd_settings_c::core_operation_set_uapsd_settings_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_set_uapsd_settings_c::~core_operation_set_uapsd_settings_c() + { + DEBUG( "core_operation_set_uapsd_settings_c::~core_operation_set_uapsd_settings_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_set_uapsd_settings_c::next_state() + { + DEBUG( "core_operation_set_uapsd_settings_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + server_m->get_core_settings().set_uapsd_settings( + uapsd_settings_m ); + + if ( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_set_uapsd_settings_c::next_state() - not connected, no reason to set anything" ); + + return core_error_ok; + } + + operation_state_m = core_state_set_uapsd_settings; + + DEBUG( "core_operation_set_uapsd_settings_c::next_state() - setting U-APSD settings" ); + DEBUG1( "core_operation_set_uapsd_settings_c::next_state() - max_service_period: %u", + uapsd_settings_m.max_service_period ); + DEBUG1( "core_operation_set_uapsd_settings_c::next_state() - uapsd_enabled_for_voice: %u", + uapsd_settings_m.uapsd_enabled_for_voice ); + DEBUG1( "core_operation_set_uapsd_settings_c::next_state() - uapsd_enabled_for_video: %u", + uapsd_settings_m.uapsd_enabled_for_video ); + DEBUG1( "core_operation_set_uapsd_settings_c::next_state() - uapsd_enabled_for_best_effort: %u", + uapsd_settings_m.uapsd_enabled_for_best_effort ); + DEBUG1( "core_operation_set_uapsd_settings_c::next_state() - uapsd_enabled_for_background: %u", + uapsd_settings_m.uapsd_enabled_for_background ); + + drivers_m->set_uapsd_settings( + request_id_m, + uapsd_settings_m ); + + break; + } + case core_state_set_uapsd_settings: + { + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_unload_drivers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_unload_drivers.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for unloading drivers +* +*/ + +/* +* %version: 11 % +*/ + +#include "core_operation_unload_drivers.h" +#include "core_operation_release.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_unload_drivers_c::core_operation_unload_drivers_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_unload_drivers, request_id, server, drivers, adaptation, + core_base_flag_only_one_instance ) + { + DEBUG( "core_operation_unload_drivers_c::core_operation_unload_drivers_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_unload_drivers_c::~core_operation_unload_drivers_c() + { + DEBUG( "core_operation_unload_drivers_c::~core_operation_unload_drivers_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_unload_drivers_c::next_state() + { + DEBUG( "core_operation_unload_drivers_c::next_state()" ); + switch( operation_state_m ) + { + case core_state_init: + { + DEBUG( "- core_state_init" ); + if( server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_operation_unload_drivers_c::next_state() - still connected, notifying state change" ); + // connection is open, first send state change notification + u8_t buf[5]; + buf[0] = static_cast( core_connection_state_notconnected ); + buf[1] = static_cast( core_release_reason_hw_failure ); + adaptation_m->notify( + core_notification_connection_state_changed, + sizeof( buf ), + buf ); + + server_m->get_connection_data()->set_last_connection_state( + core_connection_state_notconnected ); + + // Delay unloading a little bit so that data pipe can be + // disconnected from adaptation side + return asynch_goto( core_state_notifying, DELAY_FOR_AGENT ); + } + else + { + // not connected, jump directly to unloading drivers + return goto_state( core_state_releasing ); + } + } + case core_state_notifying: + { + DEBUG( "core_operation_connect_c::next_state() - notification sent, releasing" ); + core_operation_base_c* operation = new core_operation_release_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + core_release_reason_hw_failure ); + operation_state_m = core_state_releasing; + return run_sub_operation( operation ); + } + case core_state_releasing: + { + DEBUG( "core_operation_unload_drivers_c::next_state() - unloading drivers" ); + drivers_m->unload_drivers( request_id_m ); + operation_state_m = core_state_unloading; + break; + } + case core_state_unloading: + { + DEBUG( "core_operation_unload_drivers_c::next_state() - unloading done" ); + server_m->get_core_settings().set_driver_state( false_t ); + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_device_settings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_device_settings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating device settings +* +*/ + + +#include "core_operation_update_device_settings.h" +#include "core_operation_update_power_mode.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_device_settings_c::core_operation_update_device_settings_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_update_device_settings, request_id, server, drivers, adaptation, + core_base_flag_none ) + { + DEBUG( "core_operation_update_device_settings_c::core_operation_update_device_settings_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_device_settings_c::~core_operation_update_device_settings_c() + { + DEBUG( "core_operation_update_device_settings_c::~core_operation_update_device_settings_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_update_device_settings_c::next_state() + { + DEBUG( "core_operation_update_device_settings_c::next_state()" ); + + switch( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_req_set_power_mode; + + /** + * Currently power save mode is the only device setting that will cause + * an immediate operation. + * + * However, we do not want to disturb DHCP negotiation. + */ + if( !server_m->is_dhcp_timer_active() ) + { + core_operation_base_c* operation = new core_operation_update_power_mode_c( + request_id_m, + server_m, + drivers_m, + adaptation_m ); + + return run_sub_operation( operation ); + } + + return core_error_ok; + } + case core_state_req_set_power_mode: + { + DEBUG( "core_operation_update_device_settings_c::next_state() - device settings updated" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_power_mode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_power_mode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating power mode +* +*/ + + +#include "core_operation_update_power_mode.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_power_mode_c::core_operation_update_power_mode_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_update_power_mode, request_id, server, drivers, adaptation, + core_base_flag_connection_needed | core_base_flag_only_one_instance ), + preferred_mode_m( + server_m->get_core_settings().preferred_power_save_mode() ), + power_mode_m( CORE_POWER_MODE_CAM ) + { + DEBUG( "core_operation_update_power_mode_c::core_operation_update_power_mode_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_power_mode_c::core_operation_update_power_mode_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_power_save_mode_s& mode ) : + core_operation_base_c( core_operation_update_power_mode, request_id, server, drivers, adaptation, + core_base_flag_connection_needed | core_base_flag_only_one_instance ), + preferred_mode_m( mode ), + power_mode_m( CORE_POWER_MODE_CAM ) + { + DEBUG( "core_operation_update_power_mode_c::core_operation_update_power_mode_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_power_mode_c::~core_operation_update_power_mode_c() + { + DEBUG( "core_operation_update_power_mode_c::~core_operation_update_power_mode_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_update_power_mode_c::next_state() + { + DEBUG( "core_operation_update_power_mode_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_req_set_power_mode; + + if ( !server_m->get_core_settings().is_driver_loaded() || + !server_m->get_connection_data() ) + { + DEBUG( "core_operation_update_power_mode_c::next_state() - not connected, no reason to set power save mode" ); + + return core_error_ok; + } + + /** + * Determine the correct mode to use. + */ + power_mode_m = determine_power_mode(); + + const core_power_mode_s& current_mode( + server_m->get_core_settings().power_mode() ); + + if( power_mode_m.mode == current_mode.mode && + power_mode_m.wakeup_mode_light == current_mode.wakeup_mode_light && + power_mode_m.wakeup_interval_light == current_mode.wakeup_interval_light && + power_mode_m.wakeup_mode_deep == current_mode.wakeup_mode_deep && + power_mode_m.wakeup_interval_deep == current_mode.wakeup_interval_deep ) + { + DEBUG1( "core_operation_update_power_mode_c::next_state() - power save mode (%u) already set", + power_mode_m.mode ); + + return core_error_ok; + } + +#ifdef _DEBUG + if( power_mode_m.mode == core_power_mode_cam ) + { + DEBUG( "core_operation_update_power_mode_c::next_state() - setting power mode to core_power_mode_cam" ); + } + else + { + DEBUG4( "core_operation_update_power_mode_c::next_state() - setting power mode to core_power_mode_ps (light %u, %u) (deep %u, %u)", + power_mode_m.wakeup_mode_light, power_mode_m.wakeup_interval_light, + power_mode_m.wakeup_mode_deep, power_mode_m.wakeup_interval_deep ); + } +#endif // _DEBUG + + drivers_m->set_power_mode( + request_id_m, + power_mode_m ); + + break; + } + case core_state_req_set_power_mode: + { + DEBUG1( "core_operation_update_power_mode_c::next_state() - power save mode (%u) successfully set", + power_mode_m.mode ); + + server_m->get_core_settings().set_power_mode( power_mode_m ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_power_mode_s core_operation_update_power_mode_c::determine_power_mode() const + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode()" ); + + if( !server_m->get_device_settings().power_save_enabled ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_CAM, disabled in settings" ); + + return CORE_POWER_MODE_CAM; + } + + if ( server_m->get_connection_data() && + server_m->get_connection_data()->iap_data().operating_mode() == core_operating_mode_ibss ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_CAM, IBSS network" ); + + return CORE_POWER_MODE_CAM; + } + + if( preferred_mode_m.mode == core_power_save_mode_none ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_CAM, preferred mode" ); + + return CORE_POWER_MODE_CAM; + } + + if( preferred_mode_m.mode == core_power_save_mode_beacon ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_PS_BEACON, preferred mode" ); + + core_power_mode_s mode( CORE_POWER_MODE_PS_BEACON ); + mode.wakeup_interval_light = preferred_mode_m.wakeup_interval; + mode.wakeup_interval_deep = preferred_mode_m.wakeup_interval; + + return mode; + } + + if( preferred_mode_m.mode == core_power_save_mode_dtim ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_PS_DTIM, preferred mode" ); + + core_power_mode_s mode( CORE_POWER_MODE_PS_DTIM ); + mode.wakeup_interval_light = preferred_mode_m.wakeup_interval; + mode.wakeup_interval_deep = preferred_mode_m.wakeup_interval; + + return mode; + } + + u8_t wakeup_interval( 1 ); + bool_t is_power_save_test_success( true_t ); + if( server_m->get_connection_data() && + server_m->get_connection_data()->current_ap_data() ) + { + u32_t dtim_skip_interval( + server_m->get_connection_data()->current_ap_data()->dtim_period() * + server_m->get_connection_data()->current_ap_data()->beacon_interval() * + MILLISECONDS_FROM_MICROSECONDS ); + + /** + * DTIM period can be zero if we haven't received a beacon from + * the AP yet. + */ + if( dtim_skip_interval ) + { + DEBUG1( "core_operation_update_power_mode_c::determine_power_mode() - max_dtim_skip_interval: %u", + server_m->get_device_settings().max_dtim_skip_interval ); + DEBUG1( "core_operation_update_power_mode_c::determine_power_mode() - dtim_skip_interval: %u", + dtim_skip_interval ); + + while( dtim_skip_interval * ( wakeup_interval + 1 ) <= server_m->get_device_settings().max_dtim_skip_interval ) + { + ++wakeup_interval; + } + } + + core_mac_address_s bssid( + server_m->get_connection_data()->current_ap_data()->bssid() ); + server_m->get_connection_data()->is_ap_power_save_test_run( + bssid, is_power_save_test_success ); + } + + if( preferred_mode_m.mode == core_power_save_mode_dtim_skipping ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_PS_DTIM, preferred mode" ); + + core_power_mode_s mode( CORE_POWER_MODE_PS_DTIM ); + mode.wakeup_interval_light = wakeup_interval; + mode.wakeup_interval_deep = wakeup_interval; + + return mode; + } + + if( !is_power_save_test_success ) + { + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_CAM, AP power save test failure" ); + + return CORE_POWER_MODE_CAM; + } + + DEBUG( "core_operation_update_power_mode_c::determine_power_mode() - CORE_POWER_MODE_PS" ); + + core_power_mode_s mode( CORE_POWER_MODE_PS ); + mode.wakeup_interval_deep = wakeup_interval; + + return mode; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_rxtx_parameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_rxtx_parameters.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating rxtx parameters +* +*/ + + +#include "core_operation_update_rxtx_parameters.h" +#include "core_operation_update_tx_rate_policies.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +/** Beacon lost value to be used when BT connection is disabled. */ +const u32_t CORE_BEACON_LOST_COUNT_NO_BT = 15; +/** Beacon lost value to be used when BT connection is active. */ +const u32_t CORE_BEACON_LOST_COUNT_BT = 20; +/** + * Number of consecutive packets that have to be lost before + * core_am_indication_wlan_tx_fail is indicated. + */ +const u32_t CORE_FAILED_TX_PACKETS_COUNT = 4; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_rxtx_parameters_c::core_operation_update_rxtx_parameters_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_update_rxtx_parameters, request_id, server, drivers, adaptation, + core_base_flag_only_one_instance ) + { + DEBUG( "core_operation_update_rxtx_parameters_c::core_operation_update_rxtx_parameters_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_rxtx_parameters_c::~core_operation_update_rxtx_parameters_c() + { + DEBUG( "core_operation_update_rxtx_parameters_c::~core_operation_update_rxtx_parameters_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_update_rxtx_parameters_c::next_state() + { + DEBUG( "core_operation_update_rxtx_parameters_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_req_set_bss_lost_parameters; + + if( !server_m->get_core_settings().is_driver_loaded() ) + { + DEBUG( "core_operation_update_rxtx_parameters_c::next_state() - driver not loaded, completing operation" ); + return core_error_ok; + } + + core_bss_lost_parameters_s parameters = + { CORE_BEACON_LOST_COUNT_NO_BT, CORE_FAILED_TX_PACKETS_COUNT }; + if ( server_m->get_core_settings().is_bt_connection_established() ) + { + DEBUG( "core_operation_update_rxtx_parameters_c::next_state() - BT connection on, adjusting beacon lost count" ); + parameters.beacon_lost_count = CORE_BEACON_LOST_COUNT_BT; + } + + DEBUG( "core_operation_update_rxtx_parameters_c::next_state() - setting bss lost parameters" ); + DEBUG1( "core_operation_update_rxtx_parameters_c::next_state() - beacon_lost_count = %u", + parameters.beacon_lost_count ); + DEBUG1( "core_operation_update_rxtx_parameters_c::next_state() - failed_tx_packet_count = %u", + parameters.failed_tx_packet_count ); + + drivers_m->set_bss_lost_parameters( + request_id_m, + parameters ); + + break; + } + case core_state_req_set_bss_lost_parameters: + { + operation_state_m = core_state_req_set_tx_rate_policies; + + if ( server_m->get_core_settings().is_connected() && + server_m->get_connection_data() && + server_m->get_connection_data()->current_ap_data() ) + { + core_operation_base_c* operation = new core_operation_update_tx_rate_policies_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + *server_m->get_connection_data()->current_ap_data() ); + + return run_sub_operation( operation ); + } + + DEBUG( "core_operation_update_rxtx_parameters_c::next_state() - not connected, no need to set TX rate policies" ); + + return goto_state( core_state_req_set_tx_rate_policies ); + } + case core_state_req_set_tx_rate_policies: + { + DEBUG( "core_operation_update_rxtx_parameters_c::next_state() - all set" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_tx_rate_policies.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_update_tx_rate_policies.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,288 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating the currently active TX rate policies. +* +*/ + +/* +* %version: 3 % +*/ + +#include "core_operation_update_tx_rate_policies.h" +#include "core_tx_rate_policies.h" +#include "core_frame_dot11_ie.h" +#include "core_server.h" +#include "core_tools_parser.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_tx_rate_policies_c::core_operation_update_tx_rate_policies_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_ap_data_c& ap_data ) : + core_operation_base_c( core_operation_scan, request_id, server, drivers, adaptation, + core_base_flag_only_one_instance ), + current_ap_m( &ap_data ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::core_operation_update_tx_rate_policies_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_tx_rate_policies_c::core_operation_update_tx_rate_policies_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_scan, request_id, server, drivers, adaptation, + core_base_flag_only_one_instance ), + current_ap_m( NULL ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::core_operation_update_tx_rate_policies_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_update_tx_rate_policies_c::~core_operation_update_tx_rate_policies_c() + { + DEBUG( "core_operation_update_tx_rate_policies_c::~core_operation_update_tx_rate_policies_c()" ); + + current_ap_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_operation_update_tx_rate_policies_c::next_state() + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_success; + + if( !server_m->get_core_settings().is_driver_loaded() ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - driver not loaded, completing operation" ); + return core_error_ok; + } + + if ( !current_ap_m ) + { + if ( !server_m->get_connection_data() || + !server_m->get_connection_data()->current_ap_data() ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - no current AP defined, completing operation" ); + return core_error_ok; + } + + current_ap_m = server_m->get_connection_data()->current_ap_data(); + } + + u32_t basic_rates( 0 ); + u32_t supported_rates( 0 ); + for( core_frame_dot11_ie_c* ie = current_ap_m->frame()->first_ie(); ie; ie = current_ap_m->frame()->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_supported_rates || + ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_extended_rates ) + { + u32_t temp_basic_rates( 0 ); + u32_t temp_supported_rates( 0 ); + + core_tools_parser_c::parse_rates( + ie->data() + CORE_FRAME_DOT11_IE_HEADER_LENGTH, + ie->length(), + temp_basic_rates, + temp_supported_rates ); + + basic_rates |= temp_basic_rates; + supported_rates |= temp_supported_rates; + } + + delete ie; + } + + DEBUG_RATES( "core_operation_update_tx_rate_policies_c::next_state() - AP basic rates: ", + basic_rates ); + DEBUG_RATES( "core_operation_update_tx_rate_policies_c::next_state() - AP supported rates: ", + supported_rates ); + + core_ap_type_e current_ap_type( + core_ap_type_802p11bg ); + + /** + * AP is 802.11b only if only 802.11b rates are advertised as supported rates. + */ + if ( !( supported_rates & ~CORE_TX_RATES_802P11B ) ) + { + current_ap_type = core_ap_type_802p11b_only; + } + /** + * AP is 802.11g only if any of the 802.11g rates is a basic rate. + */ + else if ( basic_rates & CORE_TX_RATES_802P11G ) + { + current_ap_type = core_ap_type_802p11g_only; + } + + /** + * It's possible AP has given us TX rates to be used. + */ + u32_t override_voice_rates( 0 ); + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + core_traffic_stream_c* iter = ts_list.first(); + while( iter && !override_voice_rates ) + { + if ( core_tools_c::convert_user_priority_to_ac( iter->user_priority() ) == core_access_class_voice && + iter->status() == core_traffic_stream_status_active && + iter->override_rates() ) + { + override_voice_rates = iter->override_rates(); + DEBUG_RATES( "core_operation_update_tx_rate_policies_c::next_state() - AP override rates for Voice: ", + override_voice_rates ); + } + + iter = ts_list.next(); + } + + core_tx_rate_policies_s policies; + core_tx_rate_policy_mappings_s mappings; + + if ( server_m->get_core_settings().is_bt_connection_established() ) + { + policies.policy_count = 1; + mappings.policy_for_best_effort = 0; + mappings.policy_for_background = 0; + mappings.policy_for_video = 0; + mappings.policy_for_voice = 0; + + if ( current_ap_type == core_ap_type_802p11b_only ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - using 802.11b-only BT TX rate policy" ); + + policies.policy[0] = TX_RATE_POLICY_BLUETOOTH_B; + } + else if ( current_ap_type == core_ap_type_802p11g_only ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - using 802.11g-only BT TX rate policy" ); + + policies.policy[0] = TX_RATE_POLICY_BLUETOOTH_G; + } + else + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - using 802.11bg BT TX rate policy" ); + + policies.policy[0] = TX_RATE_POLICY_BLUETOOTH_BG; + } + } + else + { + policies.policy_count = 2; + mappings.policy_for_best_effort = 0; + mappings.policy_for_background = 0; + mappings.policy_for_video = 0; + mappings.policy_for_voice = 1; + + if ( current_ap_type == core_ap_type_802p11b_only ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - using 802.11b-only default and voice TX rate policy" ); + + policies.policy[0] = TX_RATE_POLICY_B; + policies.policy[1] = TX_RATE_POLICY_VOICE_B; + } + else if ( current_ap_type == core_ap_type_802p11g_only ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - using 802.11g-only default and voice TX rate policy" ); + + policies.policy[0] = TX_RATE_POLICY_G; + policies.policy[1] = TX_RATE_POLICY_VOICE_G; + } + else + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - using 802.11bg default and voice TX rate policy" ); + + policies.policy[0] = TX_RATE_POLICY_BG; + policies.policy[1] = TX_RATE_POLICY_VOICE_BG; + } + + if ( override_voice_rates ) + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - generating a new voice TX rate policy based on override rates" ); + DEBUG_RATES( "core_operation_update_tx_rate_policies_c::next_state() - initial rate: ", + core_tools_c::highest_tx_rate( override_voice_rates ) ); + + core_tx_rate_policy_s voice_policy; + core_tools_c::fillz( + &voice_policy, + sizeof( voice_policy ) ); + voice_policy = + core_tools_c::convert_tx_rates_to_tx_policy( override_voice_rates ); + voice_policy.initial_tx_rate = + core_tools_c::highest_tx_rate( override_voice_rates ); + policies.policy[1] = voice_policy; + } + } + + /** + * Fill in the default retry limits if not overridden by the policy. + */ + for ( u8_t idx( 0 ); idx < policies.policy_count; ++idx ) + { + if ( !policies.policy[idx].short_retry_limit ) + { + policies.policy[idx].short_retry_limit = + server_m->get_device_settings().short_retry; + } + if ( ! policies.policy[idx].long_retry_limit ) + { + policies.policy[idx].long_retry_limit = + server_m->get_device_settings().long_retry; + } + } + + DEBUG( "core_operation_update_rxtx_parameters_c::next_state() - setting TX rate policies" ); + + drivers_m->set_tx_rate_policies( + request_id_m, + policies, + mappings ); + + break; + } + case core_state_success: + { + DEBUG( "core_operation_update_tx_rate_policies_c::next_state() - TX rate policies set" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_roam_metrics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_roam_metrics.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing roaming metrics. +* +*/ + +/* +* %version: 6 % +*/ + +#include "core_roam_metrics.h" +#include "core_am_tools.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_roam_metrics_c::core_roam_metrics_c() : + roam_ts_userdata_disabled_m( 0 ), + roam_ts_userdata_enabled_m( 0 ), + roam_ts_connect_start_m( 0 ), + roam_ts_connect_completed_m( 0 ), + roam_success_count_m( 0 ) + { + clear_metrics(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_roam_metrics_c::~core_roam_metrics_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::clear_metrics() + { + roam_ts_userdata_disabled_m = 0; + roam_ts_userdata_enabled_m = 0; + roam_ts_connect_start_m = 0; + roam_ts_connect_completed_m = 0; + roam_success_count_m = 0; + + core_tools_c::fillz( + &roam_attempt_count_m[0], + sizeof ( roam_attempt_count_m ) ); + core_tools_c::fillz( + &roam_attempt_failed_count_m[0], + sizeof ( roam_attempt_failed_count_m ) ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u64_t core_roam_metrics_c::roam_ts_userdata_disabled() const + { + return roam_ts_userdata_disabled_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::set_roam_ts_userdata_disabled() + { + roam_ts_userdata_disabled_m = core_am_tools_c::timestamp(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u64_t core_roam_metrics_c::roam_ts_userdata_enabled() const + { + return roam_ts_userdata_enabled_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::set_roam_ts_userdata_enabled() + { + roam_ts_userdata_enabled_m = core_am_tools_c::timestamp(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u64_t core_roam_metrics_c::roam_ts_connect_started() const + { + return roam_ts_connect_start_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::set_roam_ts_connect_started() + { + roam_ts_connect_start_m = core_am_tools_c::timestamp(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u64_t core_roam_metrics_c::roam_ts_connect_completed() const + { + return roam_ts_connect_completed_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::set_roam_ts_connect_completed() + { + roam_ts_connect_completed_m = core_am_tools_c::timestamp(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_roam_metrics_c::roam_total_delay() const + { + return static_cast( roam_ts_userdata_enabled_m - roam_ts_userdata_disabled_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_roam_metrics_c::roam_connect_delay() const + { + return static_cast( roam_ts_connect_completed_m - roam_ts_connect_start_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_roam_metrics_c::roam_success_count() const + { + return roam_success_count_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::inc_roam_success_count() + { + ++roam_success_count_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_roam_metrics_c::roam_attempt_count( + core_roam_reason_e reason ) const + { + return roam_attempt_count_m[reason]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::inc_roam_attempt_count( + core_roam_reason_e reason ) + { + ++roam_attempt_count_m[reason]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_roam_metrics_c::roam_attempt_failed_count( + core_roam_failed_reason_e reason ) const + { + return roam_attempt_failed_count_m[reason]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::inc_roam_attempt_failed_count( + core_roam_failed_reason_e reason ) + { + ++roam_attempt_failed_count_m[reason]; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_roam_metrics_c::trace_current_roam_metrics() const + { +#ifdef _DEBUG + DEBUG( "core_roam_metrics_c::next_state() - current roam metrics:" ); + DEBUG1( "core_roam_metrics_c::next_state() - last roam total delay in ms: %u", + roam_total_delay() / MILLISECONDS_FROM_MICROSECONDS ); + DEBUG1( "core_roam_metrics_c::next_state() - last roam connect delay in ms: %u", + roam_connect_delay() / MILLISECONDS_FROM_MICROSECONDS ); + DEBUG1( "core_roam_metrics_c::next_state() - roam success count: %u", + roam_success_count() ); + + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to initial connect: %u", + roam_attempt_count( core_roam_reason_initial_connect ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to BSS lost: %u", + roam_attempt_count( core_roam_reason_bss_lost ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to media disconnect: %u", + roam_attempt_count( core_roam_reason_media_disconnect ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to signal strength: %u", + roam_attempt_count( core_roam_reason_signal_strength ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to signal prediction: %u", + roam_attempt_count( core_roam_reason_signal_loss_prediction ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to failed reauth: %u", + roam_attempt_count( core_roam_reason_failed_reauthentication ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts due to directed roam request: %u", + roam_attempt_count( core_roam_reason_directed_roam ) ); + + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts failed due to timeout: %u", + roam_attempt_failed_count( core_roam_failed_reason_timeout ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts failed due to no suitable ap: %u", + roam_attempt_failed_count( core_roam_failed_reason_no_suitable_ap ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts failed due to AP's status code: %u", + roam_attempt_failed_count( core_roam_failed_reason_ap_status_code ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts failed due to EAPOL failure: %u", + roam_attempt_failed_count( core_roam_failed_reason_eapol_failure ) ); + DEBUG1( "core_roam_metrics_c::next_state() - roam attempts failed due to other failure: %u", + roam_attempt_failed_count( core_roam_failed_reason_other_failure ) ); +#endif // _DEBUG + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_scan_channels.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_scan_channels.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for manipulating scan channels masks. +* +*/ + + +#include "core_scan_channels.h" +#include "core_tools.h" +#include "am_debug.h" + +const u16_t SCAN_BAND_2DOT4GHZ_MASK = 0x1FFF; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_c::core_scan_channels_c() : + channels2dot4ghz_m( 0 ) + { + DEBUG( "core_scan_channels_c::core_scan_channels_c()" ); + + core_tools_c::fillz( + reinterpret_cast( &channel_mask_m ), + sizeof( channel_mask_m ) ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_c::core_scan_channels_c( + const core_scan_channels_s& channels ) : + channels2dot4ghz_m( 0 ) + { + DEBUG( "core_scan_channels_c::core_scan_channels_c() (channels)" ); + + set( channels ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_c::core_scan_channels_c( + const core_scan_channels_c& channels ) : + channels2dot4ghz_m( 0 ) + { + DEBUG( "core_scan_channels_c::core_scan_channels_c() (channels)" ); + + set( channels ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_c::~core_scan_channels_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_scan_channels_s& core_scan_channels_c::channels() + { + if ( channel_mask_m.band & SCAN_BAND_2DOT4GHZ ) + { + core_tools_c::copy( + &channel_mask_m.channels2dot4ghz[0], + reinterpret_cast( &channels2dot4ghz_m ), + sizeof( channels2dot4ghz_m ) ); + } + + return channel_mask_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_channels_c::set( + const core_scan_channels_s& channels ) + { + channel_mask_m = channels; + channels2dot4ghz_m = 0; + + if ( channel_mask_m.band & SCAN_BAND_2DOT4GHZ ) + { + core_tools_c::copy( + reinterpret_cast( &channels2dot4ghz_m ), + &channels.channels2dot4ghz[0], + sizeof( channels2dot4ghz_m ) ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_channels_c::set( + const core_scan_channels_c& channels ) + { + channel_mask_m.band = channels.channel_mask_m.band; + channels2dot4ghz_m = 0; + + if ( channel_mask_m.band & SCAN_BAND_2DOT4GHZ ) + { + channels2dot4ghz_m = channels.channels2dot4ghz_m; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_channels_c::merge( + const core_scan_channels_c& channels ) + { + channel_mask_m.band |= channels.channel_mask_m.band; + + if ( channels.channel_mask_m.band & SCAN_BAND_2DOT4GHZ ) + { + channels2dot4ghz_m |= channels.channels2dot4ghz_m; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_channels_c::add( + u8_t band, + u8_t channel ) + { + if ( band & SCAN_BAND_2DOT4GHZ && + channel && + channel <= SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO ) + { + channel_mask_m.band |= band; + + channels2dot4ghz_m |= static_cast( 1 << ( channel - 1 ) ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_channels_c::invert_channels() + { + channels2dot4ghz_m ^= SCAN_BAND_2DOT4GHZ_MASK; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_channels_c::remove( + u8_t band, + u8_t channel ) + { + if ( band & SCAN_BAND_2DOT4GHZ && + channel && + channel <= SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO ) + { + u16_t mask = static_cast( 1 << ( channel - 1 ) ); + mask ^= SCAN_BAND_2DOT4GHZ_MASK; + channels2dot4ghz_m &= mask; + + if( channels2dot4ghz_m == 0 ) + { + channel_mask_m.band &= ( ~SCAN_BAND_2DOT4GHZ ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_scan_channels_c::is_empty( + u8_t band ) + { + if ( ( band & SCAN_BAND_2DOT4GHZ ) && + ( channel_mask_m.band & SCAN_BAND_2DOT4GHZ ) && + ( channels2dot4ghz_m & SCAN_BAND_2DOT4GHZ_MASK ) ) + { + return false_t; + } + + return true_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_scan_list.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_scan_list.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,361 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of core_scan_list_c class. +* +*/ + +/* +* %version: 14 % +*/ + +#include "core_scan_list.h" +#include "core_tools.h" +#include "core_am_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_c::core_scan_list_c() : + scan_list_m( ) + { + DEBUG( "core_scan_list_c::core_scan_list_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_c::~core_scan_list_c() + { + DEBUG( "core_scan_list_c::~core_scan_list_c()" ); + + for ( core_scan_list_entry_s* iter = scan_list_m.first(); iter; iter = scan_list_m.next() ) + { + delete iter->ap_data; + } + + scan_list_m.clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_scan_list_c::count() const + { + return scan_list_m.count(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_scan_list_c::update_entry( + core_ap_data_c& ap_data ) + { + bool_t is_match_found( false_t ); + const core_mac_address_s bssid( + ap_data.bssid() ); + core_ssid_s ssid( + ap_data.ssid() ); + u64_t timestamp( + core_am_tools_c::timestamp() ); + + DEBUG6( "core_scan_list_c::update_entry() - searching for entries with BSSID %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + DEBUG1S( "core_scan_list_c::update_entry() - and with SSID ", + ssid.length, &ssid.ssid[0] ); + + core_scan_list_entry_s* iter = scan_list_m.first(); + while( iter ) + { + bool_t is_goto_next_entry( true_t ); + + if ( iter->ap_data->bssid() == bssid ) + { + if ( iter->ap_data->ssid() == ssid ) + { + if ( !is_match_found ) + { + if ( !iter->tags && iter->ap_data->rcpi() >= ap_data.rcpi() ) + { + if ( ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) + { + DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) already received, ignoring beacon entry", + static_cast( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); + } + else + { + DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) already received, ignoring probe entry", + static_cast( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); + } + + is_match_found = true_t; + } + else + { + if ( ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) + { + DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) found, replacing entry with a beacon entry", + static_cast( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); + } + else + { + DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) found, replacing entry with a probe entry", + static_cast( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); + } + + is_match_found = true_t; + + *(iter->ap_data) = ap_data; + iter->timestamp = timestamp; + iter->tags = 0; + } + } + else + { + DEBUG( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID found (duplicate), removing entry" ); + + core_scan_list_entry_s* temp = iter; + iter = scan_list_m.next(); + scan_list_m.remove( temp ); + + is_goto_next_entry = false_t; + } + } + else if ( iter->ap_data->frame()->type() == core_frame_dot11_c::core_dot11_type_beacon && + ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) + { + /** + * If both the new entry and the old entry are beacons with different SSIDs, + * it means the SSID has changed and the old entry needs to be replaced or + * removed. + */ + if ( !is_match_found ) + { + DEBUG( "core_scan_list_c::update_entry() - two beacons with the same BSSID but different SSID found, replacing entry" ); + is_match_found = true_t; + + *(iter->ap_data) = ap_data; + iter->timestamp = timestamp; + iter->tags = 0; + } + else + { + DEBUG( "core_scan_list_c::update_entry() - two beacons with the same BSSID but different SSID found (duplicate), removing entry" ); + + core_scan_list_entry_s* temp = iter; + iter = scan_list_m.next(); + scan_list_m.remove( temp ); + + is_goto_next_entry = false_t; + } + } +#if 0 + else + { + DEBUG( "core_scan_list_c::update_entry() - an entry with matching BSSID found but SSID doesn't match, refreshing entry timestamp" ); + iter->timestamp = timestamp; + } +#endif // 0 + } + + if ( is_goto_next_entry ) + { + iter = scan_list_m.next(); + } + } + + if ( !is_match_found ) + { + if ( ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) + { + DEBUG( "core_scan_list_c::update_entry() - no entry matching BSSID and SSID found, adding a new beacon entry" ); + } + else + { + DEBUG( "core_scan_list_c::update_entry() - no entry matching BSSID and SSID found, adding a new probe entry" ); + } + + core_scan_list_entry_s* entry = new core_scan_list_entry_s; + if ( entry ) + { + entry->ap_data = core_ap_data_c::instance( ap_data ); + entry->timestamp = timestamp; + entry->tags = 0; + + scan_list_m.append( entry ); + } + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::remove_entries_by_bssid( + const core_mac_address_s& bssid ) + { + DEBUG6( "core_scan_list_c::remove_entries_by_bssid() - removing entries with BSSID %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + + core_type_list_iterator_c iter( scan_list_m ); + for( core_scan_list_entry_s* current = iter.first(); current; current = iter.next() ) + { + if ( current->ap_data->bssid() == bssid ) + { + DEBUG( "core_scan_list_c::remove_entries_by_bssid() - matching entry found" ); + + iter.remove(); + + delete current->ap_data; + delete current; + current = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::remove_entries_by_age( + u32_t age ) + { + DEBUG1( "core_scan_list_c::remove_entries_by_age() - removing entries older than %u microsecond(s)", + age ); + + u64_t timestamp( + core_am_tools_c::timestamp() ); + + core_type_list_iterator_c iter( scan_list_m ); + for( core_scan_list_entry_s* current = iter.first(); current; current = iter.next() ) + { + if ( static_cast( timestamp - current->timestamp ) > age ) + { +#ifdef _DEBUG + core_mac_address_s bssid( + current->ap_data->bssid() ); + + DEBUG7( "core_scan_list_c::remove_entries_by_age() - BSSID %02X:%02X:%02X:%02X:%02X:%02X [%u second(s)] removed", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5], + static_cast( timestamp - current->timestamp ) / SECONDS_FROM_MICROSECONDS ); +#endif // _DEBUG + + iter.remove(); + + delete current->ap_data; + delete current; + current = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::set_tag( + u8_t tag ) + { + for( core_scan_list_entry_s* iter = scan_list_m.first(); iter; iter = scan_list_m.next() ) + { + iter->tags |= tag; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::clear_tag( + u8_t tag ) + { + for( core_scan_list_entry_s* iter = scan_list_m.first(); iter; iter = scan_list_m.next() ) + { + iter->tags &= ~tag; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::clear_all_tags() + { + for( core_scan_list_entry_s* iter = scan_list_m.first(); iter; iter = scan_list_m.next() ) + { + iter->tags = 0; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::print_contents() + { + u32_t size( sizeof( *this ) ); + u64_t timestamp = core_am_tools_c::timestamp(); + + for( core_scan_list_entry_s* iter = scan_list_m.first(); iter; iter = scan_list_m.next() ) + { + const core_mac_address_s bssid( + iter->ap_data->bssid() ); + core_ssid_s ssid( + iter->ap_data->ssid() ); + + DEBUG6( "core_scan_list_c::print_contents() - BSSID %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); + DEBUG1S( "core_scan_list_c::print_contents() - SSID ", + ssid.length, &ssid.ssid[0] ); + DEBUG1( "core_scan_list_c::print_contents() - age %u second(s)", + static_cast( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS ); + DEBUG1( "core_scan_list_c::print_contents() - tags 0x%02X", + iter->tags ); + + DEBUG( "core_scan_list_c::print_contents()" ); + + size += sizeof( *iter ) + sizeof( *iter->ap_data ) + + sizeof( *iter->ap_data->frame() ) + iter->ap_data->frame()->data_length(); + } + + DEBUG2( "core_scan_list_c::print_contents() - total size for scan list is %u bytes with %u AP(s)", + size, count() ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_scan_list_c::get_channels_by_ssid( + core_scan_channels_c& channels, + const core_ssid_s& ssid ) + { + DEBUG( "core_scan_list_c::get_channels_by_ssid()" ); + + core_type_list_iterator_c iter( scan_list_m ); + for( core_scan_list_entry_s* current = iter.first(); current; current = iter.next() ) + { + if ( current->ap_data->ssid() == ssid ) + { + channels.add( + current->ap_data->band(), + current->ap_data->channel() ); + } + } + + DEBUG2( "core_scan_list_c::get_channels_by_ssid() - channels 0x%02X%02X", + channels.channels().channels2dot4ghz[1], + channels.channels().channels2dot4ghz[0] ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_scan_list_iterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_scan_list_iterator.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,282 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementations for the scan list iterators +* +*/ + + +#include "core_scan_list_iterator.h" +#include "core_scan_list.h" +#include "core_tools.h" +#include "core_am_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_tag_c::core_scan_list_iterator_by_tag_c( + core_scan_list_c& scan_list, + u8_t tag ) : + scan_list_m( scan_list ), + tag_m( tag ) + { + DEBUG( "core_scan_list_iterator_by_tag_c::core_scan_list_iterator_by_tag_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_tag_c::~core_scan_list_iterator_by_tag_c() + { + DEBUG( "core_scan_list_iterator_by_tag_c::~core_scan_list_iterator_by_tag_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_c::first() + { + for( core_scan_list_c::core_scan_list_entry_s* iter = scan_list_m.scan_list_m.first(); iter; iter = scan_list_m.scan_list_m.next() ) + { + if ( !( iter->tags & tag_m ) ) + { + return iter->ap_data; + } + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_c::next() + { + for( core_scan_list_c::core_scan_list_entry_s* iter = scan_list_m.scan_list_m.next(); iter; iter = scan_list_m.scan_list_m.next() ) + { + if ( !( iter->tags & tag_m ) ) + { + return iter->ap_data; + } + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_c::current() + { + if ( scan_list_m.scan_list_m.current() ) + { + return scan_list_m.scan_list_m.current()->ap_data; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_age_c::core_scan_list_iterator_by_age_c( + core_scan_list_c& scan_list, + u32_t maximum_age ) : + scan_list_m( scan_list ), + maximum_age_m( maximum_age ) + { + DEBUG( "core_scan_list_iterator_by_age_c::core_scan_list_iterator_by_age_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_age_c::~core_scan_list_iterator_by_age_c() + { + DEBUG( "core_scan_list_iterator_by_age_c::~core_scan_list_iterator_by_age_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_age_c::first() + { + for( core_scan_list_c::core_scan_list_entry_s* iter = scan_list_m.scan_list_m.first(); iter; iter = scan_list_m.scan_list_m.next() ) + { + u64_t difference = ( core_am_tools_c::timestamp() - iter->timestamp ) / SECONDS_FROM_MICROSECONDS; + + if ( maximum_age_m == SCAN_LIST_AGE_ANY || + difference <= maximum_age_m ) + { + return iter->ap_data; + } + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_age_c::next() + { + for( core_scan_list_c::core_scan_list_entry_s* iter = scan_list_m.scan_list_m.next(); iter; iter = scan_list_m.scan_list_m.next() ) + { + u64_t difference = ( core_am_tools_c::timestamp() - iter->timestamp ) / SECONDS_FROM_MICROSECONDS; + + if ( maximum_age_m == SCAN_LIST_AGE_ANY || + difference <= maximum_age_m ) + { + return iter->ap_data; + } + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_age_c::current() + { + if ( scan_list_m.scan_list_m.current() ) + { + return scan_list_m.scan_list_m.current()->ap_data; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_tag_and_ssid_c::core_scan_list_iterator_by_tag_and_ssid_c( + core_scan_list_c& scan_list, + u8_t tag, + const core_ssid_s& ssid ) : + core_scan_list_iterator_by_tag_c( scan_list, tag ), + ssid_m( ssid ) + { + DEBUG( "core_scan_list_iterator_by_tag_and_ssid_c::core_scan_list_iterator_by_tag_and_ssid_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_tag_and_ssid_c::~core_scan_list_iterator_by_tag_and_ssid_c() + { + DEBUG( "core_scan_list_iterator_by_tag_and_ssid_c::~core_scan_list_iterator_by_tag_and_ssid_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_and_ssid_c::first() + { + core_ap_data_c* iter = core_scan_list_iterator_by_tag_c::first(); + while ( iter ) + { + if ( iter->ssid() == ssid_m ) + { + return iter; + } + + iter = core_scan_list_iterator_by_tag_c::next(); + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_and_ssid_c::next() + { + core_ap_data_c* iter = core_scan_list_iterator_by_tag_c::next(); + while ( iter ) + { + if ( iter->ssid() == ssid_m ) + { + return iter; + } + + iter = core_scan_list_iterator_by_tag_c::next(); + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_tag_and_ssid_and_bssid_c::core_scan_list_iterator_by_tag_and_ssid_and_bssid_c( + core_scan_list_c& scan_list, + u8_t tag, + const core_ssid_s& ssid, + const core_mac_address_s& bssid ) : + core_scan_list_iterator_by_tag_and_ssid_c( scan_list, tag, ssid ), + bssid_m( bssid ) + { + DEBUG( "core_scan_list_iterator_by_tag_and_ssid_and_bssid_c::core_scan_list_iterator_by_tag_and_ssid_and_bssid_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_iterator_by_tag_and_ssid_and_bssid_c::~core_scan_list_iterator_by_tag_and_ssid_and_bssid_c() + { + DEBUG( "core_scan_list_iterator_by_tag_and_ssid_and_bssid_c::~core_scan_list_iterator_by_tag_and_ssid_and_bssid_c" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_and_ssid_and_bssid_c::first() + { + core_ap_data_c* iter = core_scan_list_iterator_by_tag_and_ssid_c::first(); + while( iter ) + { + if( bssid_m == BROADCAST_MAC_ADDR || + iter->bssid() == bssid_m ) + { + return iter; + } + + iter = core_scan_list_iterator_by_tag_and_ssid_c::next(); + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_data_c* core_scan_list_iterator_by_tag_and_ssid_and_bssid_c::next() + { + core_ap_data_c* iter = core_scan_list_iterator_by_tag_and_ssid_c::next(); + while( iter ) + { + if( bssid_m == BROADCAST_MAC_ADDR || + iter->bssid() == bssid_m ) + { + return iter; + } + + iter = core_scan_list_iterator_by_tag_and_ssid_c::next(); + } + + return NULL; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2495 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Main class for core server +* +*/ + +/* +* %version: 89 % +*/ + +#include "core_server.h" +#include "abs_core_server_callback.h" +#include "abs_core_driverif.h" +#include "abs_core_timer.h" +#include "abs_core_frame_handler.h" +#include "abs_core_event_handler.h" +#include "core_timer_factory.h" +#include "core_operation_connect.h" +#include "core_operation_update_device_settings.h" +#include "core_operation_scan.h" +#include "core_operation_get_available_iaps.h" +#include "core_operation_release.h" +#include "core_operation_unload_drivers.h" +#include "core_operation_check_rcpi.h" +#include "core_operation_handle_frame.h" +#include "core_operation_null.h" +#include "core_operation_get_rcpi.h" +#include "core_operation_configure_multicast_group.h" +#include "core_operation_update_power_mode.h" +#include "core_operation_update_rxtx_parameters.h" +#include "core_operation_get_statistics.h" +#include "core_operation_set_uapsd_settings.h" +#include "core_operation_set_power_save_settings.h" +#include "core_operation_protected_setup.h" +#include "core_operation_create_ts.h" +#include "core_operation_delete_ts.h" +#include "core_operation_power_save_test.h" +#include "core_operation_set_arp_filter.h" +#include "core_operation_directed_roam.h" +#include "core_frame_ethernet.h" +#include "core_connection_data.h" +#include "core_eapol_handler.h" +#include "core_frame_dot11.h" +#include "core_frame_echo_test.h" +#include "am_debug.h" +#include "core_callback.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "core_wpx_adaptation_factory.h" +#include "core_traffic_stream_list_iter.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_server_c::core_server_c( + abs_core_server_callback_c& callback, + abs_core_driverif_c& drivers, + const core_device_settings_s& settings, + const core_mac_address_s& mac_address, + u32_t features ) : + callback_m( callback ), + drivers_m( drivers ), + device_settings_m( settings ), + queue_m( ), + queue_timer_m( NULL ), + driver_unload_timer_m( NULL ), + core_settings_m( features ), + connection_data_m( NULL ), + own_mac_addr_m( mac_address ), + eapol_handler_m( NULL ), + eapol_m( NULL ), + cm_timer_m( ), + roam_timer_m( NULL ), + operation_timer_m( NULL ), + driver_dhcp_timer_m( NULL ), + frame_handler_m( NULL ), + event_handler_m( NULL ), + scan_list_m( ), + wpx_adaptation_m( NULL ) + { + DEBUG( "core_server_c::core_server_c()" ); + queue_m.clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_server_c::~core_server_c() + { + DEBUG( "core_server_c::~core_server_c()" ); + + queue_m.clear(); + delete connection_data_m; + + if ( queue_timer_m ) + { + queue_timer_m->stop(); + core_timer_factory_c::destroy_timer( queue_timer_m ); + queue_timer_m = NULL; + } + if ( driver_unload_timer_m ) + { + driver_unload_timer_m->stop(); + core_timer_factory_c::destroy_timer( driver_unload_timer_m ); + driver_unload_timer_m = NULL; + } + if ( roam_timer_m ) + { + roam_timer_m->stop(); + core_timer_factory_c::destroy_timer( roam_timer_m ); + roam_timer_m = NULL; + } + if ( operation_timer_m ) + { + operation_timer_m->stop(); + core_timer_factory_c::destroy_timer( operation_timer_m ); + operation_timer_m = NULL; + } + if ( driver_dhcp_timer_m ) + { + driver_dhcp_timer_m->stop(); + core_timer_factory_c::destroy_timer( driver_dhcp_timer_m ); + driver_dhcp_timer_m = NULL; + } + if ( eapol_m ) + { + eapol_m->shutdown(); + delete eapol_m; + } + delete wpx_adaptation_m; + delete eapol_handler_m; + frame_handler_m = NULL; + event_handler_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::init() + { + DEBUG( "core_server_c::init()" ); + + drivers_m.init( this ); + + core_callback_c* queue_timer_callback = + new core_callback_c( &(core_server_c::queue_timer_expired), this ); + if( !queue_timer_callback ) + { + DEBUG("ERROR creating callback object"); + return core_error_no_memory; + } + queue_timer_m = core_timer_factory_c::create_timer( queue_timer_callback ); + if( !queue_timer_m ) + { + DEBUG( "ERROR creating timer" ); + delete queue_timer_callback; + return core_error_no_memory; + } + + core_callback_c* unload_timer_callback = + new core_callback_c( &(core_server_c::unload_timer_expired), this ); + if( !unload_timer_callback ) + { + DEBUG("ERROR creating callback object"); + return core_error_no_memory; + } + driver_unload_timer_m = core_timer_factory_c::create_timer( unload_timer_callback ); + if( !driver_unload_timer_m ) + { + DEBUG( "ERROR creating timer" ); + delete unload_timer_callback; + return core_error_no_memory; + } + + core_callback_c* roam_timer_callback = + new core_callback_c( &(core_server_c::roam_timer_expired), this ); + if( !roam_timer_callback ) + { + DEBUG("ERROR creating callback object"); + return core_error_no_memory; + } + roam_timer_m = core_timer_factory_c::create_timer( roam_timer_callback ); + if( !roam_timer_m ) + { + DEBUG( "ERROR creating timer" ); + delete roam_timer_callback; + return core_error_no_memory; + } + + core_callback_c* operation_timer_callback = + new core_callback_c( &(core_server_c::operation_timer_expired), this ); + if( !operation_timer_callback ) + { + DEBUG("ERROR creating callback object"); + return core_error_no_memory; + } + operation_timer_m = core_timer_factory_c::create_timer( operation_timer_callback ); + if( !operation_timer_m ) + { + DEBUG( "ERROR creating timer" ); + delete operation_timer_callback; + return core_error_no_memory; + } + + core_callback_c* dhcp_timer_callback = + new core_callback_c( &(core_server_c::dhcp_timer_expired), this ); + if( !dhcp_timer_callback ) + { + DEBUG("ERROR creating callback object"); + return core_error_no_memory; + } + driver_dhcp_timer_m = core_timer_factory_c::create_timer( dhcp_timer_callback ); + if( !driver_dhcp_timer_m ) + { + DEBUG( "ERROR creating timer" ); + delete dhcp_timer_callback; + return core_error_no_memory; + } + + wpx_adaptation_m = core_wpx_adaptation_factory_c::instance( + this, &drivers_m, &callback_m ); + if ( !wpx_adaptation_m ) + { + DEBUG("ERROR creating WPX adaptation"); + return core_error_no_memory; + } + + eapol_handler_m = new core_eapol_handler_c( + this, &drivers_m, &callback_m ); + if ( !eapol_handler_m ) + { + DEBUG("ERROR creating eapol handler"); + return core_error_no_memory; + } + + core_settings_m.set_rcpi_boundaries( + device_settings_m.rcpi_trigger, + device_settings_m.rcpi_trigger + device_settings_m.rcpi_difference ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_device_settings_s& core_server_c::get_device_settings() + { + return device_settings_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_settings_c& core_server_c::get_core_settings() + { + return core_settings_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connection_data_c* core_server_c::get_connection_data() + { + return connection_data_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_wlan_eapol_interface_c& core_server_c::get_eapol_instance() + { + return *eapol_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::set_eapol_handler( + abs_wlan_eapol_callback_interface_c* handler ) + { + eapol_handler_m->set_eapol_handler( handler ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_mac_address_s& core_server_c::own_mac_addr() + { + return own_mac_addr_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::queue_int_operation( + core_operation_base_c* operation ) + { + DEBUG( "core_server_c::queue_int_operation()" ); + + if ( !operation ) + { + DEBUG( "core_server_c::queue_int_operation() - no operation" ); + + return core_error_no_memory; + } + else if ( operation->is_flags( core_operation_base_c::core_base_flag_only_one_instance ) && + is_operation_in_queue_with_type( operation->operation_type() ) ) + { + DEBUG( "core_server_c::queue_int_operation() - only one instance allowed in the operation queue" ); + + delete operation; + operation = NULL; + + return core_error_already_exists; + } + else + { + core_error_e ret = queue_m.append( operation ); + if ( ret != core_error_ok ) + { + DEBUG1( "core_server_c::queue_int_operation() - unable to queue the request (%u)", + ret ); + + delete operation; + operation = NULL; + + return ret; + } + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::queue_int_operation_and_run_next( + core_operation_base_c* operation ) + { + DEBUG( "core_server_c::queue_int_operation_and_run_next()" ); + + core_error_e ret = queue_int_operation( operation ); + if ( ret != core_error_ok ) + { + return ret; + } + + schedule_operation(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::init_connection_data( + const core_iap_data_s& iap_data, + const core_device_settings_s& device_settings ) + { + connection_data_m = new core_connection_data_c( iap_data, device_settings ); + + if ( !connection_data_m ) + { + return core_error_no_memory; + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::clear_connection_data() + { + DEBUG( "core_server_c::clear_connection_data()" ); + + delete connection_data_m; + connection_data_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::schedule_roam_timer( + u32_t delay ) + { + DEBUG1( "core_server_c::schedule_roam_timer() - delay %u", + delay ); + + ASSERT( !roam_timer_m->is_active() ); + + roam_timer_m->start( + delay ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_roam_timer() + { + DEBUG( "core_server_c::cancel_roam_timer()" ); + + roam_timer_m->stop(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::roam_timer_expired( + void* this_ptr ) + { + DEBUG("core_server_c::roam_timer_expired()"); + core_server_c* self = static_cast( this_ptr ); + + // send an indication to adaptation + self->callback_m.notify( + core_notification_rcpi_roam_attempt_started, + 0, + NULL ); + + core_operation_base_c* command = new core_operation_check_rcpi_c( + REQUEST_ID_CORE_INTERNAL, + self, + &(self->drivers_m), + &(self->callback_m), + core_operation_check_rcpi_c::core_rcpi_check_reason_timer ); + + self->queue_int_operation_and_run_next( command ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::schedule_operation_timer( + u32_t delay ) + { + DEBUG1( "core_server_c::schedule_operation_timer() - delay %u", + delay ); + + ASSERT( !operation_timer_m->is_active() ); + operation_timer_m->start( + delay ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_operation_timer() + { + DEBUG( "core_server_c::cancel_operation_timer()" ); + operation_timer_m->stop(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::operation_timer_expired( + void* this_ptr ) + { + DEBUG("core_server_c::operation_timer_expired()"); + core_server_c* self = static_cast( this_ptr ); + + core_operation_base_c* command = self->queue_m.first(); + ASSERT( command ); + ASSERT( command->is_executing() ); + self->request_complete( command->request_id(), core_error_ok ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::is_operation_in_queue_with_flags( + u32_t feature_flags ) + { + core_type_list_iterator_c iter( queue_m ); + for( core_operation_base_c* current = iter.first(); current; current = iter.next() ) + { + if ( current->is_flags( feature_flags ) ) + { + return true_t; + } + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::is_operation_in_queue_with_type( + u32_t type ) + { + core_type_list_iterator_c iter( queue_m ); + for( core_operation_base_c* current = iter.first(); current; current = iter.next() ) + { + if ( current->operation_type() == type ) + { + return true_t; + } + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::is_dhcp_timer_active() + { + return driver_dhcp_timer_m->is_active(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::schedule_dhcp_timer( + u32_t delay ) + { + DEBUG1( "core_server_c::schedule_dhcp_timer() - delay %u", + delay ); + + ASSERT( !is_dhcp_timer_active() ); + + driver_dhcp_timer_m->start( + delay ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_dhcp_timer() + { + DEBUG( "core_server_c::cancel_dhcp_timer()" ); + + driver_dhcp_timer_m->stop(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::dhcp_timer_expired( + void* this_ptr ) + { + DEBUG( "core_server_c::dhcp_timer_expired()" ); + + core_server_c* self = static_cast( this_ptr ); + + core_operation_base_c* command = new core_operation_power_save_test_c( + REQUEST_ID_CORE_INTERNAL, + self, + &(self->drivers_m), + &(self->callback_m) ); + + self->queue_int_operation_and_run_next( command ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::schedule_unload_timer( + u32_t delay ) + { + DEBUG1( "core_server_c::schedule_unload_timer() - delay %u", + delay ); + + ASSERT( !driver_unload_timer_m->is_active() ); + + driver_unload_timer_m->start( + delay ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_unload_timer() + { + DEBUG( "core_server_c::cancel_unload_timer()" ); + + driver_unload_timer_m->stop(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_operations_with_flags( + u32_t feature_flags ) + { + DEBUG( "core_server_c::cancel_operations_with_flags()" ); + DEBUG1( "core_server_c::cancel_operations_with_flags() - feature_flags %u", + feature_flags ); + + core_operation_base_c* command = queue_m.first(); + while ( command ) + { + if ( !command->is_executing() && + command->is_flags( feature_flags ) ) + { + DEBUG2( "core_server_c::cancel_operations_with_flags() - canceling operation (id %u, type %u)", + command->request_id(), command->operation_type() ); + if ( command->request_id() != REQUEST_ID_CORE_INTERNAL ) + { + DEBUG( "core_server_c::cancel_operations_with_flags() - adaptation request, completing it" ); + callback_m.request_complete( + command->request_id(), + core_error_cancel ); + } + + queue_m.remove( command ); + delete command; + command = queue_m.first(); + } + else + { + command = queue_m.next(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_operations_with_type( + u32_t type ) + { + DEBUG( "core_server_c::cancel_operation_with_type()" ); + DEBUG1( "core_server_c::cancel_operation_with_type() - type %u", + type ); + + core_operation_base_c* command = queue_m.first(); + while ( command ) + { + if ( !command->is_executing() && + command->operation_type() == type ) + { + DEBUG2( "core_server_c::cancel_operation_with_type() - canceling operation (id %u, type %u)", + command->request_id(), command->operation_type() ); + if ( command->request_id() != REQUEST_ID_CORE_INTERNAL ) + { + DEBUG( "core_server_c::cancel_operation_with_type() - adaptation request, completing it" ); + callback_m.request_complete( + command->request_id(), + core_error_cancel ); + } + + queue_m.remove( command ); + delete command; + command = queue_m.first(); + } + else + { + command = queue_m.next(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_all_operations( + bool_t is_graceful_cancel ) + { + DEBUG( "core_server_c::cancel_all_operations()" ); + + core_operation_base_c* command = queue_m.first(); + while ( command ) + { + if ( !command->is_executing() ) + { + DEBUG2( "core_server_c::cancel_all_operations() - canceling operation (id %u, type %u)", + command->request_id(), command->operation_type() ); + if ( command->request_id() != REQUEST_ID_CORE_INTERNAL ) + { + DEBUG( "core_server_c::cancel_all_operations() - adaptation request, completing it" ); + callback_m.request_complete( + command->request_id(), + core_error_cancel ); + } + + queue_m.remove( command ); + delete command; + command = queue_m.first(); + } + else + { + command = queue_m.next(); + } + } + + command = queue_m.first(); + if ( command ) + { + if( is_graceful_cancel ) + { + DEBUG2( "core_server_c::cancel_all_operations() - canceling currently executing operation (id %u, type %u) (graceful cancel)", + command->request_id(), command->operation_type() ); + } + else + { + DEBUG2( "core_server_c::cancel_all_operations() - canceling currently executing operation (id %u, type %u) (forced cancel)", + command->request_id(), command->operation_type() ); + } + + ASSERT( command->is_executing() ); + + // Let operation handle it's own cancelling + command->user_cancel_operation( is_graceful_cancel ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::create_eapol_instance( + core_eapol_operating_mode_e mode ) + { + DEBUG( "core_server_c::create_eapol_instance()" ); + + if ( eapol_m && + eapol_m->operating_mode() == mode ) + { + DEBUG( "core_server_c::create_eapol_instance() - an instance already exists" ); + + return true_t; + } + + if ( eapol_m ) + { + DEBUG( "core_server_c::create_eapol_instance() - deleting old core_wlan_eapol_interface_c instance" ); + + eapol_m->shutdown(); + delete eapol_m; + eapol_m = NULL; + } + + DEBUG1( "core_server_c::create_eapol_instance() - creating core_wlan_eapol_interface_c (mode %u)", + mode ); + + eapol_m = new core_wlan_eapol_interface_c( callback_m ); + if ( !eapol_m ) + { + DEBUG( "core_server_c::create_eapol_instance() - unable to create core_wlan_eapol_interface_c" ); + return false_t; + } + core_error_e error = eapol_m->load_eapol( mode, eapol_handler_m ); + if ( error != core_error_ok ) + { + DEBUG1( "core_server_c::create_eapol_instance() - load_eapol failed with %i", error ); + delete eapol_m; + eapol_m = NULL; + return false_t; + } + error = eapol_m->configure(); + if ( error != core_error_ok ) + { + DEBUG1( "core_server_c::create_eapol_instance() - configure failed with %i", error ); + delete eapol_m; + eapol_m = NULL; + return false_t; + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +abs_core_frame_handler_c* core_server_c::frame_handler() + { + return frame_handler_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::register_frame_handler( + abs_core_frame_handler_c* handler ) + { + ASSERT( handler ); + ASSERT( handler == frame_handler_m || !frame_handler_m ); + + frame_handler_m = handler; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::unregister_frame_handler( + abs_core_frame_handler_c* handler ) + { + ASSERT( handler ); + + if ( frame_handler_m != handler ) + { + DEBUG1( "core_server_c::unregister_frame_handler() - handler 0x%08X not registered", + handler ); + + return; + } + + frame_handler_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_list_c& core_server_c::get_scan_list() + { + return scan_list_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +abs_core_event_handler_c* core_server_c::event_handler() + { + return event_handler_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::register_event_handler( + abs_core_event_handler_c* handler ) + { + ASSERT( handler ); + ASSERT( handler == event_handler_m || !event_handler_m ); + + event_handler_m = handler; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::unregister_event_handler( + abs_core_event_handler_c* handler ) + { + ASSERT( handler ); + + if ( event_handler_m != handler ) + { + DEBUG1( "core_server_c::unregister_event_handler() - handler 0x%08X not registered", + handler ); + + return; + } + + event_handler_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::schedule_roam( + core_operation_handle_bss_lost_c::core_bss_lost_reason_e reason ) + { + if ( !is_operation_in_queue_with_type( core_operation_handle_bss_lost ) ) + { + DEBUG( "core_server_c::schedule_roam() - scheduling a core_operation_handle_bss_lost operation" ); + + core_operation_base_c* command = new core_operation_handle_bss_lost_c( + REQUEST_ID_CORE_INTERNAL, + this, + &drivers_m, + &callback_m, + reason ); + + queue_int_operation_and_run_next( command ); + } + else + { + DEBUG( "core_server_c::schedule_roam() - core_operation_handle_bss_lost already in the queue" ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::send_management_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + const core_mac_address_s& destination ) + { + /** Management frames can be sent without downgraded user priority. */ + drivers_m.send_frame( + frame_type, + frame_length, + frame_data, + core_tools_c::convert_ac_to_user_priority( core_access_class_voice ), + destination, + true_t ); + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::send_data_frame( + const core_ap_data_c& ap_data, + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + core_access_class_e frame_priority, + const core_mac_address_s& destination, + bool_t send_unencrypted ) + { + DEBUG( "core_server_c::send_data_frame()" ); + + u8_t initial_priority( + core_tools_c::convert_ac_to_user_priority( frame_priority ) ); + u8_t user_priority = initial_priority; + + if ( ap_data.is_wmm_ie_present() ) + { + /** + * Collect a list of active streams per user priority. + */ + bool_t is_ts_for_user_priority[MAX_QOS_USER_PRIORITY]; + core_tools_c::fillz( + &is_ts_for_user_priority[0], + sizeof( is_ts_for_user_priority ) ); + + core_traffic_stream_list_iter_c iter( + get_connection_data()->traffic_stream_list() ); + + core_traffic_stream_c* entry = iter.first(); + while( entry ) + { + if ( entry->status() == core_traffic_stream_status_active ) + { + is_ts_for_user_priority[entry->user_priority()] = true_t; + } + + entry = iter.next(); + } + + /** + * See if downgrade should be done. + */ + bool_t is_send_ok( false_t ); + + while ( user_priority <= initial_priority && !is_send_ok ) + { + core_access_class_e ac( + core_tools_c::convert_user_priority_to_ac( user_priority ) ); + +#if 0 + DEBUG1( "core_server_c::send_data_frame() - user_priority is %u", + user_priority ); + DEBUG1( "core_server_c::send_data_frame() - ac is %u", + ac ); + DEBUG1( "core_server_c::send_data_frame() - is_admission_control_required is %u", + ap_data.is_admission_control_required( ac ) ); + DEBUG1( "core_server_c::send_data_frame() - is_ts_for_user_priority is %u", + is_ts_for_user_priority[user_priority] ); +#endif // 0 + + if ( !ap_data.is_admission_control_required( ac ) || + is_ts_for_user_priority[user_priority] ) + { + is_send_ok = true_t; + } + else + { + user_priority--; + } + } + + if ( !is_send_ok ) + { + DEBUG( "core_server_c::send_data_frame() - unable to send the frame due to admission control settings" ); + return false_t; + } + } + + if ( user_priority == initial_priority ) + { + DEBUG1( "core_server_c::send_data_frame() - no need to downgrade user priority %u", + user_priority ); + } + else + { + DEBUG2( "core_server_c::send_data_frame() - user priority %u downgraded to %u", + initial_priority, user_priority ); + } + + drivers_m.send_frame( + frame_type, + frame_length, + frame_data, + user_priority, + destination, + send_unencrypted ); + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +abs_core_wpx_adaptation_c& core_server_c::get_wpx_adaptation_instance() + { + return *wpx_adaptation_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::set_protected_setup_handler( + abs_core_protected_setup_handler_c* handler ) + { + eapol_handler_m->set_protected_setup_handler( handler ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::connect( + u32_t request_id, + const core_iap_data_s& settings, + core_connect_status_e& connect_status, + core_type_list_c* ssid_list ) + { + DEBUG( "core_server_c::connect()" ); + + core_operation_base_c* command = new core_operation_connect_c( + request_id, this, &drivers_m, &callback_m, settings, ssid_list, connect_status ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::release( + u32_t request_id ) + { + DEBUG( "core_server_c::release()" ); + + /** + * Cancel all pending roaming operations. + */ + cancel_operations_with_flags( + core_operation_base_c::core_base_flag_roam_operation ); + + /** + * If there's an executing roam operation, let it handle + * its own cancel. + */ + core_operation_base_c* operation = queue_m.first(); + if( operation && + operation->is_flags( core_operation_base_c::core_base_flag_roam_operation ) ) + { + operation->user_cancel_operation( true_t ); // Using graceful cancel + } + + core_operation_base_c* command = new core_operation_release_c( + request_id, this, &drivers_m, &callback_m, core_release_reason_external_request ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::get_scan_result( + u32_t request_id, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + u8_t scan_max_age, + ScanList& scan_data, + bool_t is_current_ap_added ) + { + DEBUG( "core_server_c::get_scan_result()" ); + + core_operation_base_c* command = new core_operation_scan_c( + request_id, this, &drivers_m, &callback_m, + scan_mode, scan_ssid, scan_channels, scan_max_age, scan_data, + true_t, + is_current_ap_added ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::get_available_iaps( + u32_t request_id, + bool_t is_active_scan_allowed, + core_type_list_c& iap_data_list, + core_type_list_c& iap_id_list, + core_type_list_c* iap_ssid_list, + ScanList& scan_data ) + { + DEBUG( "core_server_c::get_available_iaps()" ); + + core_operation_base_c* command = new core_operation_get_available_iaps_c( + request_id, + this, + &drivers_m, + &callback_m, + is_active_scan_allowed, + iap_data_list, + iap_id_list, + iap_ssid_list, + scan_data ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::get_current_rcpi( + u32_t request_id, + u32_t& rcpi ) + { + DEBUG( "core_server_c::get_current_rcpi()" ); + + core_operation_base_c* command = new core_operation_get_rcpi_c( + request_id, this, &drivers_m, &callback_m, rcpi ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::disable_wlan( + u32_t request_id ) + { + DEBUG( "core_server_c::disable_wlan()" ); + + get_core_settings().set_wlan_enabled( false_t ); + + /** + * Schedule an immediate driver unload. + */ + unload_drivers(); + + core_operation_base_c* command = new core_operation_null_c( + request_id, this, &drivers_m, &callback_m, core_error_ok ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::enable_wlan( + u32_t request_id ) + { + DEBUG( "core_server_c::enable_wlan()" ); + + core_settings_m.set_wlan_enabled( true_t ); + + core_operation_base_c* command = new core_operation_null_c( + request_id, this, &drivers_m, &callback_m, core_error_ok ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::unload_drivers() + { + DEBUG( "core_server_c::unload_drivers()" ); + + /** + * If drivers are loaded, schedule an immediate unload. + */ + if( get_core_settings().is_driver_loaded() ) + { + cancel_unload_timer(); + schedule_unload_timer( CORE_TIMER_IMMEDIATELY ); + + return core_error_ok; + } + else + { + return core_error_drivers_not_loaded; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::get_packet_statistics( + u32_t request_id, + core_packet_statistics_s& statistics ) + { + DEBUG( "core_server_c::get_packet_statistics()" ); + + core_operation_base_c* command = new core_operation_get_statistics_c( + request_id, this, &drivers_m, &callback_m, statistics ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::create_traffic_stream( + u32_t request_id, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e& stream_status ) + { + DEBUG( "core_server_c::create_traffic_stream()" ); + + core_operation_base_c* command = new core_operation_create_ts_c( + request_id, + this, + &drivers_m, + &callback_m, + tid, + user_priority, + is_automatic_stream, + params, + stream_id, + stream_status ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::delete_traffic_stream( + u32_t request_id, + u32_t stream_id ) + { + DEBUG( "core_server_c::delete_traffic_stream()" ); + + core_operation_base_c* command = new core_operation_delete_ts_c( + request_id, + this, + &drivers_m, + &callback_m, + stream_id ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::run_protected_setup( + u32_t request_id, + const core_iap_data_s& iap_data, + core_type_list_c& iap_data_list, + core_protected_setup_status_e& protected_setup_status ) + { + DEBUG( "core_server_c::run_protected_setup()" ); + + core_operation_base_c* command = new core_operation_protected_setup_c( + request_id, this, &drivers_m, &callback_m, iap_data, iap_data_list, + protected_setup_status ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::directed_roam( + u32_t request_id, + const core_mac_address_s& bssid ) + { + DEBUG( "core_server_c::directed_roam()" ); + + core_operation_base_c* command = new core_operation_directed_roam_c( + request_id, this, &drivers_m, &callback_m, bssid ); + + queue_ext_operation_and_run_next( command, request_id ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_current_bssid( + core_mac_address_s& bssid ) + { + DEBUG( "core_server_c::get_current_bssid()" ); + + bssid = ZERO_MAC_ADDR; + if ( core_settings_m.is_connected() && + connection_data_m && + connection_data_m->current_ap_data() ) + { + bssid = connection_data_m->current_ap_data()->bssid(); + + return core_error_ok; + } + + return core_error_not_connected; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_current_ssid( + core_ssid_s& ssid ) + { + DEBUG( "core_server_c::get_current_ssid()" ); + + ssid = BROADCAST_SSID; + if ( core_settings_m.is_connected() && + connection_data_m && + connection_data_m->current_ap_data() ) + { + ssid = connection_data_m->ssid(); + + return core_error_ok; + } + + return core_error_not_connected; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_current_security_mode( + core_connection_security_mode_e& mode ) + { + DEBUG( "core_server_c::get_current_security_mode()" ); + + mode = core_connection_security_mode_open; + if ( core_settings_m.is_connected() && + connection_data_m && + connection_data_m->current_ap_data() ) + { + mode = core_tools_c::security_mode( + connection_data_m->iap_data(), + *connection_data_m->current_ap_data() ); + + return core_error_ok; + } + + return core_error_not_connected; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_current_connection_state( + core_connection_state_e& state ) + { + DEBUG( "core_server_c::get_current_connection_state()" ); + + state = core_settings_m.connection_state(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::update_device_settings( + core_device_settings_s& settings ) + { + DEBUG( "core_server_c::update_device_settings()" ); + + device_settings_m = settings; + + core_operation_base_c* command = new core_operation_update_device_settings_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m ); + + queue_int_operation_and_run_next( command ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::set_power_save_mode( + const core_power_save_mode_s& mode ) + { + DEBUG( "core_server_c::set_power_save_mode()" ); + + core_settings_m.set_preferred_power_save_mode( mode ); + + core_operation_base_c* command = new core_operation_update_power_mode_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m ); + + queue_int_operation_and_run_next( command ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::add_bssid_to_rogue_list( + const core_mac_address_s& bssid ) + { + DEBUG( "core_server_c::add_bssid_to_rogue_list()" ); + + core_settings_m.add_mac_to_permanent_blacklist( + bssid, core_ap_blacklist_reason_external ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::remove_bssid_from_rogue_list( + const core_mac_address_s& bssid ) + { + DEBUG( "core_server_c::remove_bssid_from_rogue_list()" ); + + core_settings_m.remove_mac_from_permanent_blacklist( bssid ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_rogue_list( + core_type_list_c& rogue_list ) + { + DEBUG( "core_server_c::get_rogue_list()" ); + + core_type_list_c& perm_list = core_settings_m.permanent_blacklist(); + DEBUG1( "core_server_c::get_rogue_list() - %d permanent addresses", perm_list.count() ); + + // Loop through permanent blacklist + core_ap_blacklist_entry_s* addr = perm_list.first(); + while ( addr ) + { + // Address must be copied, because rogue_list get ownership for its entries. + core_mac_address_s* copy_addr = new core_mac_address_s; + if ( !copy_addr ) + { + return core_error_no_memory; + } + *copy_addr = addr->bssid; + DEBUG_MAC( copy_addr->addr ); + + core_error_e status = rogue_list.append( copy_addr ); + if ( status != core_error_ok ) + { + return status; + } + + addr = perm_list.next(); + } + + // Check if connection is available. + if ( connection_data_m ) + { + core_type_list_c& temp_list = connection_data_m->temporary_blacklist(); + DEBUG1( "core_server_c::get_rogue_list() - %d temporary addresses", temp_list.count() ); + + // Loop through temporary blacklist + addr = temp_list.first(); + while ( addr ) + { + // Address must be copied, because rogue_list get ownership for its entries. + core_mac_address_s* copy_addr = new core_mac_address_s; + if ( !copy_addr ) + { + return core_error_no_memory; + } + *copy_addr = addr->bssid; + DEBUG_MAC( copy_addr->addr ); + + core_error_e status = rogue_list.append( copy_addr ); + if ( status != core_error_ok ) + { + return status; + } + + addr = temp_list.next(); + } + } + else + { + DEBUG( "core_server_c::get_rogue_list() - connection is not available, temporary blacklist is empty" ); + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::set_rcp_level_notification_boundary( + const i32_t rcp_level_boundary, + const i32_t hysteresis ) + { + DEBUG( "core_server_c::set_rcp_level_notification_boundary()" ); + + core_settings_m.set_rcpi_boundaries( + rcp_level_boundary, + rcp_level_boundary + hysteresis ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::clear_packet_statistics() + { + DEBUG( "core_server_c::clear_packet_statistics()" ); + + core_settings_m.clear_connection_statistics(); + core_settings_m.roam_metrics().clear_metrics(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_uapsd_settings( + core_uapsd_settings_s& settings ) + { + DEBUG( "core_server_c::get_uapsd_settings()" ); + + settings = core_settings_m.uapsd_settings(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::set_uapsd_settings( + const core_uapsd_settings_s& settings ) + { + DEBUG( "core_server_c::set_uapsd_settings()" ); + + core_operation_base_c* command = new core_operation_set_uapsd_settings_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, settings ); + + queue_int_operation_and_run_next( command ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_power_save_settings( + core_power_save_settings_s& settings ) + { + DEBUG( "core_server_c::get_power_save_settings()" ); + + settings = core_settings_m.power_save_settings(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::set_power_save_settings( + const core_power_save_settings_s& settings ) + { + DEBUG( "core_server_c::set_power_save_settings()" ); + + core_operation_base_c* command = new core_operation_set_power_save_settings_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, settings ); + + queue_int_operation_and_run_next( command ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_current_ap_info( + core_ap_information_s& info ) + { + DEBUG( "core_server_c::get_current_ap_info()" ); + + if ( core_settings_m.is_connected() && + connection_data_m && + connection_data_m->current_ap_data() ) + { + info = core_tools_parser_c::get_ap_info( + connection_data_m->iap_data(), + *connection_data_m->current_ap_data() ); + + return core_error_ok; + } + + return core_error_not_connected; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::get_roam_metrics( + core_roam_metrics_s& roam_metrics ) + { + DEBUG( "core_server_c::get_roam_metrics()" ); + + core_roam_metrics_c& metrics = get_core_settings().roam_metrics(); + + roam_metrics.connection_attempt_total_count = metrics.roam_attempt_count( core_roam_reason_initial_connect ); + roam_metrics.unsuccesfull_connection_attempt_count = + metrics.roam_attempt_failed_count( core_roam_failed_reason_timeout ) + + metrics.roam_attempt_failed_count( core_roam_failed_reason_ap_status_code ) + + metrics.roam_attempt_failed_count( core_roam_failed_reason_eapol_failure ) + + metrics.roam_attempt_failed_count( core_roam_failed_reason_other_failure ); + + roam_metrics.roaming_counter = metrics.roam_success_count(); + roam_metrics.coverage_loss_count = metrics.roam_attempt_count( core_roam_reason_bss_lost ); + + roam_metrics.last_roam_total_duration = metrics.roam_total_delay() / MILLISECONDS_FROM_MICROSECONDS; + roam_metrics.last_roam_data_path_broken_duration = metrics.roam_total_delay() / MILLISECONDS_FROM_MICROSECONDS; + + roam_metrics.last_roam_reason = core_roam_reason_none; + if ( get_connection_data() ) + { + roam_metrics.last_roam_reason = get_connection_data()->last_roam_reason(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::set_arp_filter( + const core_arp_filter_s& filter ) + { + DEBUG( "core_server_c::set_arp_filter()" ); + + core_operation_base_c* command = new core_operation_set_arp_filter_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, filter ); + + queue_int_operation_and_run_next( command ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::configure_multicast_group( + bool_t join_group, + const core_mac_address_s& multicast_addr ) + { + DEBUG( "core_server_c::configure_multicast_group" ); + + core_operation_base_c* command = new core_operation_configure_multicast_group_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, join_group, multicast_addr ); + + queue_int_operation_and_run_next( command ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_server_c::get_current_ac_traffic_info( + core_ac_traffic_information_s& info ) + { + DEBUG( "core_server_c::get_current_ac_traffic_info()" ); + + if ( core_settings_m.is_connected() && + connection_data_m && + connection_data_m->current_ap_data() ) + { + info.status_for_voice = connection_data_m->ac_traffic_status( + core_access_class_voice ); + info.status_for_video = connection_data_m->ac_traffic_status( + core_access_class_video ); + info.status_for_best_effort = connection_data_m->ac_traffic_status( + core_access_class_best_effort ); + info.status_for_background = connection_data_m->ac_traffic_status( + core_access_class_background ); + info.mode_for_voice = connection_data_m->ac_traffic_mode( + core_access_class_voice ); + info.mode_for_video = connection_data_m->ac_traffic_mode( + core_access_class_video ); + info.mode_for_best_effort = connection_data_m->ac_traffic_mode( + core_access_class_best_effort ); + info.mode_for_background = connection_data_m->ac_traffic_mode( + core_access_class_background ); + + return core_error_ok; + } + + return core_error_not_connected; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::request_complete( + u32_t /* request_id */, + core_error_e status ) + { + DEBUG( "core_server_c::request_complete()" ); + + core_operation_base_c* operation = queue_m.first(); + + ASSERT( operation ); + ASSERT( operation->is_executing() ); + + core_error_e ret = operation->continue_operation( status ); + if ( ret == core_error_request_pending ) + { + DEBUG( "core_server_c::request_complete() - operation is not done yet" ); + return; + } + + DEBUG1( "core_server_c::request_complete() - operation completed with code %u", + ret ); + + if ( operation->request_id() != REQUEST_ID_CORE_INTERNAL ) + { + callback_m.request_complete( + operation->request_id(), + ret ); + } + + queue_m.remove( operation ); + delete operation; + operation = NULL; + + schedule_operation(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::cancel_request( + u32_t request_id ) + { + DEBUG( "core_server_c::cancel_request()" ); + + // Find correct operation + core_operation_base_c* operation = queue_m.first(); + while ( operation ) + { + if ( operation->request_id() == request_id ) + { + break; + } + operation = queue_m.next(); + } + + if ( !operation ) + { + DEBUG( "core_server_c::cancel_request() - operation not found" ); + return; + } + + if ( operation->is_executing() ) + { + // Let operation handle it's own cancelling + operation->user_cancel_operation( true_t ); // Using graceful cancel + } + else + { + // When operation is not yet running, we don't need to ask for it's permissions... + queue_m.remove( operation ); + delete operation; + operation = NULL; + + // Use null operation for completing correctly + operation = new core_operation_null_c( + request_id, this, &drivers_m, &callback_m, core_error_cancel ); + queue_ext_operation_and_run_next( operation, request_id ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::receive_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + u8_t frame_rcpi ) + { + DEBUG( "core_server_c::receive_frame()" ); + + DEBUG1( "core_server_c::receive_frame() - frame type: %u", frame_type ); + DEBUG1( "core_server_c::receive_frame() - frame (%u bytes): ", + frame_length ); + DEBUG_BUFFER( + frame_length, + frame_data ); + + if ( frame_type == core_frame_type_ethernet ) + { + core_frame_ethernet_c* frame = core_frame_ethernet_c::instance( + frame_length, + frame_data, + false_t ); + if ( frame ) + { + /** + * Currently all Ethernet frames are for EAPOL. + */ + + /** + * If an Ethernet frame is received during a roam, store it + * for later use. + */ + if ( get_connection_data()->is_eapol_connecting() ) + { + DEBUG( "core_server_c::receive_frame() - (re-)association in progress, storing EAPOL frame" ); + + (void)eapol_m->store_frame( *frame ); + } + /** + * Frames are discarded during disconnect. + */ + else if ( get_connection_data()->is_disconnecting() ) + { + DEBUG( "core_server_c::receive_frame() - disconnect in progress, discarding EAPOL frame" ); + } + /** + * Otherwise send it to EAPOL for processing. + */ + else if ( eapol_m ) + { + // Clear stored frame so that it is not sent later. + eapol_m->clear_stored_frame(); + + (void)eapol_m->process_frame( *frame ); + } + else + { + DEBUG( "core_server_c::receive_frame() - EAPOL not instantiated, discarding EAPOL frame" ); + } + + delete frame; + frame = NULL; + } + + return; + } + + /** + * WPX frames are handled separately. + */ + if ( wpx_adaptation_m->handle_wpx_frame( + frame_type, + frame_length, + frame_data ) ) + { + return; + } + + /** + * Offer dot11 and echo test frames to the registered frame handler. + */ + bool_t is_handled( false_t ); + + if ( frame_type == core_frame_type_dot11 && + frame_handler_m ) + { + core_frame_dot11_c* frame = core_frame_dot11_c::instance( + frame_length, + frame_data, + false_t ); + if ( frame && + frame_handler_m->receive_frame( frame, frame_rcpi ) ) + { + DEBUG( "core_server_c::receive_frame() - dot11 frame handled by the operation" ); + + is_handled = true_t; + } + + delete frame; + frame = NULL; + } + else if ( frame_type == core_frame_type_test && + frame_handler_m ) + { + core_frame_ethernet_c* frame = core_frame_ethernet_c::instance( + frame_length, + frame_data, + false_t ); + if ( frame ) + { + core_frame_echo_test_c* test_frame = core_frame_echo_test_c::instance( + *frame ); + if ( test_frame && + frame_handler_m->receive_test_frame( test_frame, frame_rcpi ) ) + { + DEBUG( "core_server_c::receive_frame() - echo test frame handled by the operation" ); + + is_handled = true_t; + } + + delete test_frame; + test_frame = NULL; + + delete frame; + frame = NULL; + } + } + + /** + * All other frames are processed in an operation. + */ + if ( !is_handled ) + { + DEBUG( "core_server_c::receive_frame() - queueing the frame for processing" ); + + core_operation_base_c* command = new core_operation_handle_frame_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, + frame_type, frame_length, frame_data ); + + queue_int_operation_and_run_next( command ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::notify( + core_am_indication_e indication ) + { + DEBUG( "core_server_c::notify()" ); + +#ifdef _DEBUG + switch ( indication ) + { + case core_am_indication_wlan_media_disconnect: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_media_disconnect" ); + break; + case core_am_indication_wlan_hw_failed: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_hw_failed" ); + break; + case core_am_indication_wlan_beacon_lost: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_beacon_lost" ); + break; + case core_am_indication_wlan_power_mode_failure: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_power_mode_failure" ); + break; + case core_am_indication_wlan_tx_fail: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_tx_fail" ); + break; + case core_am_indication_wlan_bss_regained: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_bss_regained" ); + break; + case core_am_indication_wlan_wep_decrypt_failure: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_wep_decrypt_failure" ); + break; + case core_am_indication_wlan_pairwise_key_mic_failure: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_pairwise_key_mic_failure" ); + break; + case core_am_indication_wlan_group_key_mic_failure: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_group_key_mic_failure" ); + break; + case core_am_indication_wlan_scan_complete: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_scan_complete" ); + break; + case core_am_indication_wlan_rcpi_trigger: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_rcpi_trigger" ); + break; + case core_am_indication_wlan_signal_loss_prediction: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_signal_loss_prediction" ); + break; + case core_am_indication_wlan_power_save_test_trigger: + DEBUG( "core_server_c::notify() - core_am_indication_wlan_power_save_test_trigger" ); + break; + case core_am_indication_os_power_standby: + DEBUG( "core_server_c::notify() - core_am_indication_os_power_standby" ); + break; + case core_am_indication_bt_connection_established: + DEBUG( "core_server_c::notify() - core_am_indication_bt_connection_established" ); + break; + case core_am_indication_bt_connection_disconnected: + DEBUG( "core_server_c::notify() - core_am_indication_bt_connection_disconnected" ); + break; + case core_am_indication_voice_call_on: + DEBUG( "core_server_c::notify() - core_am_indication_voice_call_on" ); + break; + case core_am_indication_voice_call_off: + DEBUG( "core_server_c::notify() - core_am_indication_voice_call_off" ); + break; + default: + break; + } +#endif // _DEBUG + + if ( event_handler_m && + event_handler_m->notify( indication ) ) + { + DEBUG( "core_server_c::notify() - indication handled by the operation" ); + + return; + } + + switch ( indication ) + { + case core_am_indication_os_power_standby: + { + /** + * Cancel all operations including the currently executing one. + */ + cancel_all_operations( true_t ); + + /** + * Force an immediate driver unload. + */ + queue_unload_drivers(); + + break; + } + case core_am_indication_wlan_hw_failed: + { + /** + * Cancel all operations including the currently executing one. + */ + cancel_all_operations( false_t ); + + /** + * Force an immediate driver unload. + */ + queue_unload_drivers(); + + break; + } + case core_am_indication_wlan_media_disconnect: + { + /** + * If the current operation is connect, handle_bss_lost or protected_setup, the indication + * is silently ignored. Otherwise this indication is handled like a BSS lost. + */ + core_operation_base_c* op = queue_m.first(); + if( op && + op->is_executing() && + ( op->operation_type() == core_operation_handle_bss_lost || + op->operation_type() == core_operation_connect || + op->operation_type() == core_operation_protected_setup ) ) + { + DEBUG( "core_server_c::notify() - ignoring indication" ); + } + else + { + schedule_roam( + core_operation_handle_bss_lost_c::core_bss_lost_reason_media_disconnect ); + } + + break; + } + case core_am_indication_wlan_beacon_lost: + /** Falls through on purpose. */ + case core_am_indication_wlan_power_mode_failure: + /** Falls through on purpose. */ + case core_am_indication_wlan_tx_fail: + { + // bss_lost is only handled in infrastructure mode + if ( connection_data_m->iap_data().operating_mode() == core_operating_mode_infrastructure ) + { + // send an indication to adaptation + callback_m.notify( + core_notification_bss_lost, + 0, + NULL ); + + schedule_roam( + core_operation_handle_bss_lost_c::core_bss_lost_reason_bss_lost ); + } + + break; + } + case core_am_indication_wlan_pairwise_key_mic_failure: + { + DEBUG( "core_server_c::notify() - a pairwise MIC failure has occured" ); + + mic_failure( false_t ); + + break; + } + case core_am_indication_wlan_group_key_mic_failure: + { + DEBUG( "core_server_c::notify() - a group MIC failure has occured" ); + + mic_failure( true_t ); + + break; + } + case core_am_indication_wlan_bss_regained: + // Do nothing. + break; + case core_am_indication_wlan_wep_decrypt_failure: + // Do nothing. + break; + case core_am_indication_bt_connection_established: + { + core_settings_m.set_bt_connection_established( true_t ); + core_operation_base_c* command = new core_operation_update_rxtx_parameters_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m ); + + queue_int_operation_and_run_next( command ); + + break; + } + case core_am_indication_bt_connection_disconnected: + { + core_settings_m.set_bt_connection_established( false_t ); + core_operation_base_c* command = new core_operation_update_rxtx_parameters_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m ); + + queue_int_operation_and_run_next( command ); + + break; + } + case core_am_indication_wlan_scan_complete: + { + DEBUG( "core_server_c::notify() - scan complete received without pending scan operations" ); + ASSERT( false_t ); + + break; + } + case core_am_indication_wlan_rcpi_trigger: + { + if ( !is_operation_in_queue_with_type( core_operation_check_rcpi ) && + !is_operation_in_queue_with_type( core_operation_handle_bss_lost ) ) + { + // send an indication to adaptation + callback_m.notify( + core_notification_rcpi_roam_attempt_started, + 0, + NULL ); + + // create operation to handle the indication + core_operation_base_c* command = new core_operation_check_rcpi_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, core_operation_check_rcpi_c::core_rcpi_check_reason_rcpi_trigger ); + + queue_int_operation_and_run_next( command ); + } + else + { + DEBUG( "core_server_c::notify() - roaming operation already in queue " ); + } + + break; + } + case core_am_indication_wlan_signal_loss_prediction: + { + if ( !is_operation_in_queue_with_type( core_operation_check_rcpi ) && + !is_operation_in_queue_with_type( core_operation_handle_bss_lost ) ) + { + // send an indication to adaptation + /* + callback_m.notify( + core_notification_rcpi_roam_attempt_started, + 0, + NULL ); + */ + + // create operation to handle the indication + /* + core_operation_base_c* command = new core_operation_check_rcpi_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, core_operation_check_rcpi_c::core_rcpi_check_reason_signal_loss_prediction ); + + queue_int_operation_and_run_next( command, LIST_HIGH_PRIORITY ); + */ + } + else + { + DEBUG( "core_server_c::notify() - roaming operation already in queue " ); + } + + break; + } + case core_am_indication_wlan_power_save_test_trigger: + { + DEBUG( "core_server_c::notify() - scheduling a power save test" ); + + core_operation_base_c* command = new core_operation_power_save_test_c( + REQUEST_ID_CORE_INTERNAL, + this, + &drivers_m, + &callback_m ); + + queue_int_operation_and_run_next( command ); + + break; + } + case core_am_indication_voice_call_on: + { + DEBUG( "core_server_c::notify() - voice call is on" ); + connection_data_m->set_voice_call_state( true_t ); + break; + } + case core_am_indication_voice_call_off: + { + DEBUG( "core_server_c::notify() - voice call is off" ); + connection_data_m->set_voice_call_state( false_t ); + break; + } + case core_am_indication_wlan_ap_ps_mode_error: + // Do nothing. + break; + default: + DEBUG( "core_server_c::notify() - unknown indication" ); + ASSERT( false_t ); + break; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::schedule_operation() + { + DEBUG( "core_server_c::schedule_operation()" ); + + core_operation_base_c* operation = queue_m.first(); + + DEBUG1( "core_server_c::schedule_operation() - %u operation(s) in the queue", + queue_m.count()); + +#ifdef _DEBUG + if( operation && operation->is_executing() ) + { + DEBUG2("core_server_c::schedule_operation() - operation 0x%08X (type %u) is executing", + operation, operation->operation_type() ); + } +#endif // _DEBUG + + if( !operation && + core_settings_m.connection_state() == core_connection_state_notconnected && + core_settings_m.is_driver_loaded() && + !driver_unload_timer_m->is_active() ) + { + // If 1) no more operations and + // 2) no connection exists and + // 3) drivers are loaded and + // 4) driver not already active, + // start unload timer + DEBUG( "core_server_c::schedule_operation() - starting unload timer" ); + schedule_unload_timer( + device_settings_m.unload_driver_timer * SECONDS_FROM_MICROSECONDS ); + + return; + } + + if ( operation && + !operation->is_executing() && + !queue_timer_m->is_active() ) + { + DEBUG( "core_server_c::schedule_operation() - scheduling a new operation" ); + queue_timer_m->start( CORE_TIMER_IMMEDIATELY ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_server_c::is_cm_active() + { + return !cm_timer_m.is_wpa_allowed(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::queue_ext_operation_and_run_next( + core_operation_base_c* operation, + u32_t request_id ) + { + DEBUG1( "core_server_c::queue_ext_operation_and_run_next() - request id %u", + request_id ); + if( !operation ) + { + DEBUG( "core_server_c::queue_ext_operation_and_run_next() - no operation, completing request." ); + callback_m.request_complete( request_id, core_error_no_memory ); + } + else if ( operation->is_flags( core_operation_base_c::core_base_flag_only_one_instance ) && + is_operation_in_queue_with_type( operation->operation_type() ) ) + { + DEBUG( "core_server_c::queue_ext_operation_and_run_next() - only one instance allowed in the operation queue, completing request" ); + callback_m.request_complete( request_id, core_error_ok ); + + delete operation; + operation = NULL; + } + else + { + core_error_e ret = queue_m.append( operation ); + if ( ret != core_error_ok ) + { + DEBUG1( "core_server_c::queue_ext_operation_and_run_next() - unable to queue the request (%u)", + ret ); + callback_m.request_complete( request_id, ret ); + + delete operation; + operation = NULL; + } + } + + schedule_operation(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::queue_timer_expired( void* this_ptr ) + { + DEBUG( "core_server_c::queue_timer_expired()" ); + core_server_c* self = static_cast( this_ptr ); + + core_operation_base_c* operation = self->queue_m.first(); + if( !operation ) + { + /** + * This shouldn't normally happen but it can happen if we have + * schedule an operation and cancel it before it has a chance to + * start executing. + */ + + return; + } + + ASSERT( operation ); + ASSERT( !operation->is_executing() ); + + // Set operation priority in the queue to maximum + self->queue_m.remove( operation ); + self->queue_m.append( operation, LIST_TOP_PRIORITY ); + + // If operation says it needs drivers, stop driver unload timer + if( operation->is_flags( core_operation_base_c::core_base_flag_drivers_needed ) && + self->driver_unload_timer_m->is_active() ) + { + DEBUG( "core_server_c::queue_timer_expired() - stopping unload timer" ); + self->cancel_unload_timer(); + } + + core_error_e ret = operation->start_operation(); + if( ret == core_error_request_pending ) + { + DEBUG( "core_server_c::queue_timer_expired() - operation is not done yet" ); + return; + } + + DEBUG1( "core_server_c::queue_timer_expired() - operation completed with code %u", + ret ); + + if ( operation->request_id() != REQUEST_ID_CORE_INTERNAL ) + { + self->callback_m.request_complete( + operation->request_id(), + ret ); + } + + self->queue_m.remove( operation ); + delete operation; + operation = NULL; + + self->schedule_operation(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::unload_timer_expired( void* this_ptr ) + { + DEBUG("core_server_c::unload_timer_expired()"); + core_server_c* self = static_cast( this_ptr ); + + /** + * Due to configurable unload timer value and different platform timing issues + * it's possible that a new operation has been added to the operation queue + * AFTER this timer was started but the queue timer has not yet been triggered. + * + * Therefore we have to abort driver unloading if there's an operation in the + * queue that requires drivers. + */ + if( self->is_operation_in_queue_with_flags( + core_operation_base_c::core_base_flag_drivers_needed ) ) + { + DEBUG( "core_server_c::unload_timer_expired() - operation in queue, aborting driver unloading" ); + + return; + } + + self->queue_unload_drivers(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::mic_failure( + bool_t is_group_key_fail ) + { + DEBUG( "core_server_c::mic_failure()" ); + + core_connection_security_mode_e mode = core_connection_security_mode_open; + + if( core_error_ok != get_current_security_mode( mode ) ) + { + DEBUG( "core_server_c::mic_failure() - not connected, ignoring mic failure" ); + return; + } + + if( mode != core_connection_security_mode_wpa && + mode != core_connection_security_mode_wpa_psk ) + { + DEBUG( "core_server_c::mic_failure() - security mode not WPA, ignoring mic failure" ); + return; + } + + if( is_group_key_fail ) + { + if( connection_data_m->current_ap_data() != NULL && + connection_data_m->current_ap_data()->best_group_cipher() != core_cipher_suite_tkip ) + { + DEBUG( "core_server_c::mic_failure() - TKIP not the best group cipher, ignoring mic failure" ); + return; + } + } + else + { + if( connection_data_m->current_ap_data() != NULL && + connection_data_m->current_ap_data()->best_pairwise_cipher() != core_cipher_suite_tkip ) + { + DEBUG( "core_server_c::mic_failure() - TKIP not the best pairwise cipher, ignoring mic failure" ); + return; + } + } + + const core_mac_address_s bssid( + connection_data_m->current_ap_data()->bssid() ); + + cm_timer_m.mic_failure(); + + network_id_c network_id( + const_cast( &bssid.addr[0] ), + MAC_ADDR_LEN, + &own_mac_addr_m.addr[0], + MAC_ADDR_LEN, + eapol_m->ethernet_type() ); + + ASSERT( eapol_m ); + (void)eapol_m->tkip_mic_failure( + &network_id, + !cm_timer_m.is_wpa_allowed() ? true_t : false_t, + is_group_key_fail ? wlan_eapol_if_eapol_tkip_mic_failure_type_group_key : + wlan_eapol_if_eapol_tkip_mic_failure_type_pairwise_key ); + + + if ( !cm_timer_m.is_wpa_allowed() ) + { + DEBUG( "core_server_c::mic_failure() - two MIC failures within 60 seconds, disconnecting" ); + + core_operation_base_c* command = new core_operation_release_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m, core_release_reason_tkip_mic_failure ); + + queue_int_operation_and_run_next( command ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_server_c::queue_unload_drivers() + { + DEBUG( "core_server_c::queue_unload_drivers()" ); + + core_operation_base_c* command = new core_operation_unload_drivers_c( + REQUEST_ID_CORE_INTERNAL, this, &drivers_m, &callback_m ); + + queue_int_operation_and_run_next( command ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server_factory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_server_factory.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Static factory class for instantiating a class +* implementing abs_core_server_c interface +* +*/ + + +// ======== MEMBER FUNCTIONS ======== + +#include "core_server_factory.h" +#include "core_server.h" +#include "am_debug.h" + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +abs_core_server_c* core_server_factory_c::instance( + abs_core_server_callback_c& callback, + abs_core_driverif_c& drivers, + core_device_settings_s& settings, + core_mac_address_s& mac_address, + u32_t features ) + { + DEBUG( "core_server_factory_c::instance() " ); + + core_server_c* server = new core_server_c( + callback, drivers, settings, mac_address, features ); + if ( !server ) + { + DEBUG( "core_server_factory_c::instance() - unable to create core_server_c" ); + return NULL; + } + + core_error_e ret = server->init(); + if ( ret != core_error_ok ) + { + DEBUG1( "core_server_factory_c::instance() - init() failed with %u", + ret ); + delete server; + server = NULL; + + return NULL; + } + + return server; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_settings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,757 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class encapsulating core engine settings and statuses. +* +*/ + + +#include "core_settings.h" +#include "core_settings_default.h" +#include "core_scan_channels.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_settings_c::core_settings_c( + u32_t features ) : + is_wlan_enabled_m( true_t ), + is_driver_loaded_m( false_t ), + connection_state_m( core_connection_state_notconnected ), + power_mode_m( CORE_POWER_MODE_CAM ), + preferred_power_save_m( CORE_POWER_SAVE_MODE_AUTOMATIC ), + perm_whitelist_m( ), + perm_blacklist_m( ), + rcp_decline_boundary_m( 0 ), + rcp_improve_boundary_m( 0 ), + region_m( core_wlan_region_fcc ), + mcc_known_m( false_t ), + is_bt_connection_established_m( false_t ), + roam_metrics_m( ), + uapsd_settings_m( DEFAULT_UAPSD_SETTINGS ), + power_save_settings_m( DEFAULT_POWER_SAVE_SETTINGS ), + block_ack_usage_m( DEFAULT_BLOCK_ACK_USAGE ), + weak_iap_list_m( ), + features_m( features ) + { + DEBUG( "core_settings_c::core_settings_c()" ); + + clear_connection_statistics(); + + core_tools_c::fillz( + &long_beacon_interval_channels_m.channel_scan_count[0], + sizeof ( long_beacon_interval_channels_m ) ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_settings_c::~core_settings_c() + { + DEBUG( "core_settings_c::~core_settings_c()" ); + + perm_whitelist_m.clear(); + perm_blacklist_m.clear(); + weak_iap_list_m.clear(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_driver_loaded() const + { + return is_driver_loaded_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_driver_state( + bool_t is_driver_loaded ) + { + is_driver_loaded_m = is_driver_loaded; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_wlan_enabled() const + { + return is_wlan_enabled_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_wlan_enabled( + bool_t is_wlan_enabled ) + { + is_wlan_enabled_m = is_wlan_enabled; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_power_mode_s& core_settings_c::power_mode() const + { + return power_mode_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_power_mode( + const core_power_mode_s& mode ) + { + power_mode_m = mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_power_save_mode_s& core_settings_c::preferred_power_save_mode() const + { + return preferred_power_save_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_preferred_power_save_mode( + const core_power_save_mode_s& mode ) + { + preferred_power_save_m = mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connection_state_e core_settings_c::connection_state() const + { + return connection_state_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_connection_state( + core_connection_state_e state ) + { + connection_state_m = state; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_connected() const + { + if( connection_state_m == core_connection_state_notconnected ) + { + return false_t; + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_permanent_whitelist_empty() const + { + return !perm_whitelist_m.count(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_mac_in_permanent_whitelist( + const core_mac_address_s& mac ) + { + core_mac_address_s* addr = perm_whitelist_m.first(); + while ( addr ) + { + if ( *addr == mac ) + { + return true_t; + } + + addr = perm_whitelist_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_mac_in_permanent_blacklist( + const core_mac_address_s& mac ) + { + core_ap_blacklist_entry_s* addr = perm_blacklist_m.first(); + while ( addr ) + { + if ( addr->bssid == mac ) + { + return true_t; + } + + addr = perm_blacklist_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::add_mac_to_permanent_whitelist( + const core_mac_address_s& mac ) + { + if ( !is_mac_in_permanent_whitelist( mac ) ) + { + core_mac_address_s* entry = new core_mac_address_s; + if ( entry ) + { + *entry = mac; + perm_whitelist_m.append( entry ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::remove_mac_from_permanent_whitelist( + const core_mac_address_s& mac ) + { + core_mac_address_s* addr = perm_whitelist_m.first(); + while ( addr ) + { + if ( *addr == mac ) + { + perm_whitelist_m.remove( addr ); + delete addr; + + return; + } + + addr = perm_whitelist_m.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::add_mac_to_permanent_blacklist( + const core_mac_address_s& mac, + core_ap_blacklist_reason_e reason ) + { + if ( !is_mac_in_permanent_blacklist( mac ) ) + { + core_ap_blacklist_entry_s* entry = new core_ap_blacklist_entry_s; + if ( entry ) + { + entry->bssid = mac; + entry->reason = reason; + perm_blacklist_m.append( entry ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::remove_mac_from_permanent_blacklist( + const core_mac_address_s& mac ) + { + core_ap_blacklist_entry_s* addr = perm_blacklist_m.first(); + while ( addr ) + { + if ( addr->bssid == mac ) + { + perm_blacklist_m.remove( addr ); + delete addr; + + return; + } + + addr = perm_blacklist_m.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_type_list_c& core_settings_c::permanent_blacklist() + { + return perm_blacklist_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_rcpi_boundaries( + u32_t rcp_decline_boundary, + u32_t rcp_improve_boundary ) + { + rcp_decline_boundary_m = rcp_decline_boundary; + rcp_improve_boundary_m = rcp_improve_boundary; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_settings_c::rcp_decline_boundary() const + { + return rcp_decline_boundary_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_settings_c::rcp_improve_boundary() const + { + return rcp_improve_boundary_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_wlan_region_e core_settings_c::regional_domain() const + { + return region_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_regional_domain( + core_wlan_region_e region ) + { + region_m = region; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::mcc_known() const + { + return mcc_known_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_mcc_known( + bool_t mcc_known ) + { + mcc_known_m = mcc_known; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_valid_channel( + u8_t band, + u8_t channel ) const + { + if ( band & SCAN_BAND_2DOT4GHZ ) + { + if( !channel ) + { + return false_t; + } + + if( region_m == core_wlan_region_fcc && + channel > SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_FCC ) + { + return false_t; + } + else if ( channel > SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO ) + { + return false_t; + } + + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_s core_settings_c::all_valid_scan_channels() const + { + if( region_m == core_wlan_region_fcc ) + { + return SCAN_CHANNELS_2DOT4GHZ_US; + } + + return SCAN_CHANNELS_2DOT4GHZ_ETSI; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_s core_settings_c::valid_scan_channels( + const core_scan_channels_s& channels ) + { + core_scan_channels_c filtered_channels; + + if ( channels.band & SCAN_BAND_2DOT4GHZ ) + { + u16_t mask( 0 ); + core_tools_c::copy( + reinterpret_cast( &mask ), + &channels.channels2dot4ghz[0], + sizeof( mask ) ); + + for ( u8_t channel( 0 ); channel < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO; ++channel ) + { + if ( mask & ( 1 << channel ) && + is_valid_channel( + SCAN_BAND_2DOT4GHZ, + channel + 1 ) ) + { + filtered_channels.add( + SCAN_BAND_2DOT4GHZ, + channel + 1 ); + } + } + } + + return filtered_channels.channels(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_scan_channels_s core_settings_c::invalid_scan_channels( + const core_scan_channels_s& channels ) + { + core_scan_channels_c filtered_channels; + + if ( channels.band & SCAN_BAND_2DOT4GHZ ) + { + u16_t mask( 0 ); + core_tools_c::copy( + reinterpret_cast( &mask ), + &channels.channels2dot4ghz[0], + sizeof( mask ) ); + + for ( u8_t channel( 0 ); channel < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO; ++channel ) + { + if ( !( mask & ( 1 << channel ) && + is_valid_channel( + SCAN_BAND_2DOT4GHZ, + channel + 1 ) ) ) + { + filtered_channels.add( + SCAN_BAND_2DOT4GHZ, + channel + 1 ); + } + } + } + + return filtered_channels.channels(); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_bt_connection_established() const + { + return is_bt_connection_established_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_bt_connection_established( + bool_t established ) + { + is_bt_connection_established_m = established; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_packet_statistics_by_access_category_s& core_settings_c::connection_statistics_by_access_category() + { + return current_statistics_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_packet_statistics_s core_settings_c::connection_statistics() + { + core_packet_statistics_s statistics; + core_tools_c::fillz( + &statistics, + sizeof( statistics ) ); + + for ( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) + { + statistics.rx_frames += current_statistics_m.ac[idx].rx_frames; + statistics.tx_frames += current_statistics_m.ac[idx].tx_frames; + statistics.rx_multicast_frames += current_statistics_m.ac[idx].rx_multicast_frames; + statistics.tx_multicast_frames += current_statistics_m.ac[idx].tx_multicast_frames; + statistics.tx_retries += current_statistics_m.ac[idx].tx_retries; + statistics.tx_errors += current_statistics_m.ac[idx].tx_errors; + } + statistics.fcs_errors = current_statistics_m.fcs_errors; + + return statistics; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::update_connection_statistics( + const core_packet_statistics_by_access_category_s& statistics ) + { + DEBUG( "core_settings_c::update_connection_statistics()" ); + + for ( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) + { + DEBUG1( "core_settings_c::update_connection_statistics() - delta statistics for AC %u:", + idx ); + DEBUG1( "core_settings_c::update_connection_statistics() - rx_frames: %u", + statistics.ac[idx].rx_frames ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_frames: %u", + statistics.ac[idx].tx_frames ); + DEBUG1( "core_settings_c::update_connection_statistics() - rx_multicast_frames: %u", + statistics.ac[idx].rx_multicast_frames ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_multicast_frames: %u", + statistics.ac[idx].tx_multicast_frames ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_retries: %u", + statistics.ac[idx].tx_retries ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_errors: %u", + statistics.ac[idx].tx_errors ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_media_delay: %u", + statistics.ac[idx].tx_media_delay ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay: %u", + statistics.ac[idx].tx_total_delay ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin0: %u", + statistics.ac[idx].tx_total_delay_bin0 ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin1: %u", + statistics.ac[idx].tx_total_delay_bin1 ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin2: %u", + statistics.ac[idx].tx_total_delay_bin2 ); + DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin3: %u", + statistics.ac[idx].tx_total_delay_bin3 ); + + current_statistics_m.ac[idx].rx_frames += statistics.ac[idx].rx_frames; + current_statistics_m.ac[idx].tx_frames += statistics.ac[idx].tx_frames; + current_statistics_m.ac[idx].rx_multicast_frames += statistics.ac[idx].rx_multicast_frames; + current_statistics_m.ac[idx].tx_multicast_frames += statistics.ac[idx].tx_multicast_frames; + current_statistics_m.ac[idx].tx_retries += statistics.ac[idx].tx_retries; + current_statistics_m.ac[idx].tx_errors += statistics.ac[idx].tx_errors; + + current_statistics_m.ac[idx].tx_media_delay = statistics.ac[idx].tx_media_delay; + current_statistics_m.ac[idx].tx_total_delay = statistics.ac[idx].tx_total_delay; + + current_statistics_m.ac[idx].tx_total_delay_bin0 += statistics.ac[idx].tx_total_delay_bin0; + current_statistics_m.ac[idx].tx_total_delay_bin1 += statistics.ac[idx].tx_total_delay_bin1; + current_statistics_m.ac[idx].tx_total_delay_bin2 += statistics.ac[idx].tx_total_delay_bin2; + current_statistics_m.ac[idx].tx_total_delay_bin3 += statistics.ac[idx].tx_total_delay_bin3; + } + + DEBUG1( "core_settings_c::update_connection_statistics() - delta fcs_errors: %u", + statistics.fcs_errors ); + current_statistics_m.fcs_errors += statistics.fcs_errors; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::clear_connection_statistics() + { + core_tools_c::fillz( + ¤t_statistics_m, + sizeof( current_statistics_m ) ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_roam_metrics_c& core_settings_c::roam_metrics() + { + return roam_metrics_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_long_beacon_interval_channels_s& core_settings_c::long_beacon_interval_channels() + { + return long_beacon_interval_channels_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_uapsd_settings_s& core_settings_c::uapsd_settings() + { + return uapsd_settings_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_uapsd_enable_for_access_class( + core_access_class_e access_class ) + { + if ( access_class == core_access_class_voice && + uapsd_settings_m.uapsd_enabled_for_voice ) + { + return true_t; + } + else if ( access_class == core_access_class_video && + uapsd_settings_m.uapsd_enabled_for_video ) + { + return true_t; + } + else if ( access_class == core_access_class_best_effort && + uapsd_settings_m.uapsd_enabled_for_best_effort ) + { + return true_t; + } + else if ( access_class == core_access_class_background && + uapsd_settings_m.uapsd_enabled_for_background ) + { + return true_t; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_uapsd_settings( + const core_uapsd_settings_s& settings ) + { + uapsd_settings_m = settings; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_power_save_settings_s& core_settings_c::power_save_settings() + { + return power_save_settings_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_power_save_settings( + const core_power_save_settings_s& settings ) + { + power_save_settings_m = settings; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_block_ack_usage_s& core_settings_c::block_ack_usage() + { + return block_ack_usage_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::set_block_ack_usage( + const core_block_ack_usage_s& usage ) + { + block_ack_usage_m = usage; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::add_iap_id_to_weak_iap_list( u32_t iap_id ) + { + if ( !is_iap_id_in_weak_list( iap_id ) ) + { + u32_t* weak_iap_id = new u32_t; + if ( weak_iap_id ) + { + *weak_iap_id = iap_id; + weak_iap_list_m.append( weak_iap_id ); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_iap_id_in_weak_list( u32_t iap_id ) + { + u32_t* iap_id_p = weak_iap_list_m.first(); + while ( iap_id_p ) + { + if ( *iap_id_p == iap_id ) + { + return true_t; + } + + iap_id_p = weak_iap_list_m.next(); + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_settings_c::remove_iap_id_from_weak_list( u32_t iap_id ) + { + u32_t* iap_id_p = weak_iap_list_m.first(); + while ( iap_id_p ) + { + if ( *iap_id_p == iap_id ) + { + weak_iap_list_m.remove( iap_id_p ); + delete iap_id_p; + + return; + } + + iap_id_p = weak_iap_list_m.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_settings_c::is_feature_enabled( + core_feature_e feature ) const + { + if( features_m & feature ) + { + return true_t; + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_adhoc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_adhoc.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,444 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for establishing an adhoc network +* +*/ + + +#include "core_sub_operation_adhoc.h" +#include "core_tx_rate_policies.h" +#include "core_frame_dot11.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +/** The channel definition for automatic channel selection. */ +const u32_t AUTOMATIC_CHANNEL = 0; + +const u32_t CH_WEIGHT_1 = 4; +const u32_t CH_WEIGHT_2 = 2; +const u32_t CH_WEIGHT_3 = 1; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_adhoc_c::core_sub_operation_adhoc_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_ap_data_c** ap_data ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + ptr_ap_data_m( ap_data ), + channel_m( 0 ) + { + DEBUG( "core_sub_operation_adhoc_c::core_sub_operation_adhoc_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_adhoc_c::~core_sub_operation_adhoc_c() + { + DEBUG( "core_sub_operation_adhoc_c::~core_sub_operation_adhoc_c()" ); + + server_m->unregister_event_handler( this ); + server_m->unregister_frame_handler( this ); + ptr_ap_data_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_adhoc_c::next_state() + { + DEBUG( "core_sub_operation_adhoc_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + core_tools_c::fillz( + &noise_per_channel_m[0], + SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO * sizeof( u32_t ) ); + + core_iap_data_c* iap = &(server_m->get_connection_data()->iap_data()); + ASSERT( iap->adhoc_channel() <= SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_FCC ); // FCC limitations: no ch 12 or 13 + ASSERT( iap->ssid().length ); + ASSERT( iap->ssid().length <= MAX_SSID_LEN ); + ASSERT( iap->security_mode() == core_security_mode_allow_unsecure || + iap->security_mode() == core_security_mode_wep ); + + channel_m = iap->adhoc_channel(); + if ( channel_m != AUTOMATIC_CHANNEL ) + { + return goto_state( core_state_req_set_tx_rate_policies ); + } + + /** + * Do a broadcast scan to detect the channel with least traffic. + */ + operation_state_m = core_state_scan_start; + + server_m->get_scan_list().remove_entries_by_age( + server_m->get_device_settings().scan_list_expiration_time ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_passive, + BROADCAST_SSID, + server_m->get_device_settings().scan_rate, + server_m->get_core_settings().all_valid_scan_channels(), + server_m->get_device_settings().passive_scan_min_ch_time, + server_m->get_device_settings().passive_scan_max_ch_time, + false_t ); + + break; + } + case core_state_scan_start: + { + DEBUG( "core_sub_operation_adhoc_c::next_state() - scan request completed, waiting for scan completion" ); + + break; + } + case core_state_scan_complete: + { + server_m->unregister_frame_handler( this ); + + DEBUG( "core_sub_operation_adhoc_c::next_state() - selecting channel with least noise" ); + + /** + * All channels are now checked and the noise marked. + * Now, we have to found the smallest noise. + */ + u32_t tmp_best_noise( 0xFFFFFFFF ); + u8_t tmp_best_channel( 0 ); + for ( u8_t idx = 0; idx < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_FCC; ++idx ) // Only ch 1 - 11 + { + DEBUG2( "core_sub_operation_adhoc_c::next_state() - NoiseTable[%u] = %u", + idx, noise_per_channel_m[idx] ); + if ( noise_per_channel_m[idx] < tmp_best_noise ) + { + tmp_best_noise = noise_per_channel_m[idx]; + tmp_best_channel = idx; + } + } + channel_m = tmp_best_channel + 1; + DEBUG1( "core_sub_operation_adhoc_c::next_state() - channel %u selected", + channel_m ); + + return goto_state( core_state_req_set_tx_rate_policies ); + } + case core_state_req_set_tx_rate_policies: + { + operation_state_m = core_state_req_start_adhoc; + + core_tx_rate_policies_s policies; + core_tx_rate_policy_mappings_s mappings; + + if ( server_m->get_core_settings().is_bt_connection_established() ) + { + DEBUG( "core_sub_operation_adhoc_c::next_state() - using 802.11bg BT TX rate policy" ); + + policies.policy_count = 1; + policies.policy[0] = TX_RATE_POLICY_BLUETOOTH_BG; + mappings.policy_for_best_effort = 0; + mappings.policy_for_background = 0; + mappings.policy_for_video = 0; + mappings.policy_for_voice = 0; + } + else + { + DEBUG( "core_sub_operation_adhoc_c::next_state() - using 802.11bg default and voice TX rate policy" ); + + policies.policy_count = 2; + policies.policy[0] = TX_RATE_POLICY_BG; + policies.policy[1] = TX_RATE_POLICY_VOICE_BG; + mappings.policy_for_best_effort = 0; + mappings.policy_for_background = 0; + mappings.policy_for_video = 0; + mappings.policy_for_voice = 1; + } + + /** + * Fill in the default retry limits if not overridden by the policy. + */ + for ( u8_t idx( 0 ); idx < policies.policy_count; ++idx ) + { + if ( !policies.policy[idx].short_retry_limit ) + { + policies.policy[idx].short_retry_limit = + server_m->get_device_settings().short_retry; + } + if ( ! policies.policy[idx].long_retry_limit ) + { + policies.policy[idx].long_retry_limit = + server_m->get_device_settings().long_retry; + } + } + + DEBUG( "core_sub_operation_adhoc_c::next_state() - setting TX rate policies" ); + + drivers_m->set_tx_rate_policies( + request_id_m, + policies, + mappings ); + + break; + } + case core_state_req_start_adhoc: + { + DEBUG( "core_sub_operation_adhoc_c::next_state() - TX rate policies set" ); + + operation_state_m = core_state_adhoc_started; + + core_encryption_mode_e encryption_mode = core_encryption_mode_disabled; + if( server_m->get_connection_data()->iap_data().security_mode() == + core_security_mode_wep ) + { + encryption_mode = core_encryption_mode_wep; + } + + DEBUG1( "core_sub_operation_adhoc_c::next_state() - starting the adhoc on channel %u", + channel_m ); + + server_m->register_frame_handler( this ); + + drivers_m->start_ibss( + request_id_m, + server_m->get_connection_data()->iap_data().ssid(), + server_m->get_device_settings().beacon, + channel_m, + encryption_mode ); + + break; + } + case core_state_adhoc_started: + { + /** + * If our own beacon has already been received, proceed to the + * next state. + */ + if( *ptr_ap_data_m ) + { + return goto_state( core_state_adhoc_complete ); + } + + return goto_state( core_state_adhoc_frame ); + } + case core_state_adhoc_frame: + { + DEBUG( "core_sub_operation_adhoc_c::next_state() - waiting for beacon frame" ); + + break; + } + case core_state_adhoc_complete: + { + server_m->unregister_frame_handler( this ); + + DEBUG( "core_sub_operation_adhoc_c::next_state() - all done" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_adhoc_c::cancel() + { + DEBUG( "core_sub_operation_adhoc_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_adhoc_started: + { + /** The connection attempt failed, we are no longer connected. */ + return next_state(); + } + default: + { + return failure_reason_m; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_adhoc_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG( "core_sub_operation_adhoc_c::user_cancel()" ); + + if ( !do_graceful_cancel ) + { + /** + * If we are in a middle of a scan, we have to schedule our own + * event. + */ + if ( operation_state_m == core_state_scan_start && + server_m->event_handler() == this && + server_m->frame_handler() == this ) + { + asynch_default_user_cancel(); + + return; + } + + /** + * If we are waiting for a beacon, we have to schedule our own + * event. + */ + if ( operation_state_m == core_state_adhoc_frame ) + { + asynch_default_user_cancel(); + + return; + } + + /** + * Everything else is handled by the default implementation. + */ + core_operation_base_c::user_cancel( do_graceful_cancel ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_adhoc_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ) + { + DEBUG( "core_sub_operation_adhoc_c::receive_frame()" ); + + if ( frame->type() != core_frame_dot11_c::core_dot11_type_beacon && + frame->type() != core_frame_dot11_c::core_dot11_type_probe_resp ) + { + DEBUG( "core_sub_operation_adhoc_c::receive_frame() - not a beacon or a probe" ); + return false_t; + } + + core_ap_data_c* ap_data = core_ap_data_c::instance( + server_m->get_wpx_adaptation_instance(), + frame, + rcpi, + true_t ); + if ( ap_data ) + { + server_m->get_scan_list().update_entry( *ap_data ); + + if ( operation_state_m == core_state_scan_start ) + { + u8_t channel = ap_data->channel(); + DEBUG1( "core_sub_operation_adhoc_c::next_state() - AP in channel %u", + channel ); + + if ( channel && channel <= SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO ) + { + /** + * Add the ch table as follows: + * channel of the AP ==> increase by CH_WEIGHT_1 + * channels +-1 ==> increase by CH_WEIGHT_2 + * channels +-2 ==> increase by CH_WEIGHT_3 + * + * Note that the legal channels are 1 - 13 BUT the + * array is 0 - 12! Beware edges! + */ + noise_per_channel_m[channel - 1] += CH_WEIGHT_1; + if ( channel > 1 ) + { + noise_per_channel_m[channel - 2] += CH_WEIGHT_2; + } + if ( channel > 2) + { + noise_per_channel_m[channel - 3] += CH_WEIGHT_3; + } + if ( channel < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO -2 ) + { + noise_per_channel_m[channel] += CH_WEIGHT_2; + } + if ( channel < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO -3 ) + { + noise_per_channel_m[channel + 1] += CH_WEIGHT_3; + } + } + } + else if ( operation_state_m == core_state_adhoc_started || + operation_state_m == core_state_adhoc_frame ) + { + if ( frame->type() == core_frame_dot11_c::core_dot11_type_beacon ) + { + DEBUG( "core_sub_operation_adhoc_c::next_state() - beacon received" ); + + ASSERT( !ap_data->is_infra() ); + ASSERT( !*ptr_ap_data_m ); + + *ptr_ap_data_m = ap_data; + + /** + * If we are just waiting for the beacon frame, we have to schedule + * our own timer to proceed. + */ + if( operation_state_m == core_state_adhoc_frame ) + { + asynch_goto( core_state_adhoc_complete, CORE_TIMER_IMMEDIATELY ); + } + + return true_t; + } + } + + delete ap_data; + ap_data = NULL; + } + + return true_t; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_adhoc_c::notify( + core_am_indication_e indication ) + { + if ( operation_state_m == core_state_scan_start && + indication == core_am_indication_wlan_scan_complete ) + { + server_m->unregister_event_handler( this ); + + DEBUG( "core_sub_operation_adhoc_c::notify() - scan complete" ); + + asynch_goto( core_state_scan_complete, CORE_TIMER_IMMEDIATELY ); + + return true_t; + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_connect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_connect.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,381 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for connecting to a network +* +*/ + + +#include "core_sub_operation_connect.h" +#include "core_operation_update_tx_rate_policies.h" +#include "core_frame_beacon.h" +#include "core_frame_dot11_ie.h" +#include "core_frame_assoc_resp.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_connect_c::core_sub_operation_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + core_management_status_e& connect_status, + const core_ssid_s& ssid, + core_ap_data_c& ap_data, + u16_t auth_algorithm, + core_encryption_mode_e encryption_level, + core_cipher_key_type_e pairwise_key_type, + core_type_list_c& assoc_ie_list, + core_frame_assoc_resp_c** assoc_resp, + bool_t is_pairwise_key_invalidated, + bool_t is_group_key_invalidated ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + is_connected_m( is_connected ), + connect_status_m( connect_status ), + ssid_m( ssid ), + ap_data_m( ap_data ), + auth_algorithm_m( auth_algorithm ), + encryption_m( encryption_level ), + pairwise_key_type_m( pairwise_key_type ), + tx_level_m( 0 ), + assoc_ie_list_m( assoc_ie_list ), + assoc_ie_data_m( NULL ), + assoc_resp_m( assoc_resp ), + is_pairwise_key_invalidated_m( is_pairwise_key_invalidated ), + is_group_key_invalidated_m( is_group_key_invalidated ) + { + DEBUG( "core_sub_operation_connect_c::core_sub_operation_connect_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_connect_c::~core_sub_operation_connect_c() + { + DEBUG( "core_sub_operation_connect_c::~core_sub_operation_connect_c()" ); + + server_m->unregister_frame_handler( this ); + delete[] assoc_ie_data_m; + assoc_resp_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_connect_c::next_state() + { + DEBUG( "core_sub_operation_connect_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_req_set_tx_level; + + tx_level_m = server_m->get_device_settings().tx_power_level; + + u32_t max_tx_power_level = ap_data_m.max_tx_power_level(); + if ( max_tx_power_level < tx_level_m ) + { + tx_level_m = max_tx_power_level; + DEBUG1( "core_sub_operation_connect_c::next_state() - setting maximum tx level to %u", + tx_level_m ); + + drivers_m->set_tx_power_level( + request_id_m, + tx_level_m ); + } + else + { + DEBUG( "core_sub_operation_connect_c::next_state() - no reason to set tx level" ); + + return next_state(); + } + + break; + } + case core_state_req_set_tx_level: + { + operation_state_m = core_state_req_set_tx_rate_policies; + + if ( server_m->get_connection_data()->last_tx_level() != tx_level_m ) + { + DEBUG( "core_sub_operation_connect_c::next_state() - TX level has changed, notifying change" ); + + adaptation_m->notify( + core_notification_tx_power_level_changed, + sizeof( tx_level_m ), + reinterpret_cast(&tx_level_m) ); + + server_m->get_connection_data()->set_last_tx_level( tx_level_m ); + } + + core_operation_base_c* operation = new core_operation_update_tx_rate_policies_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + ap_data_m ); + + return run_sub_operation( operation ); + } + case core_state_req_set_tx_rate_policies: + { + operation_state_m = core_state_connect; + + DEBUG6( "core_sub_operation_connect_c::next_state() - trying to associate to %02X:%02X:%02X:%02X:%02X:%02X", + ap_data_m.bssid().addr[0], ap_data_m.bssid().addr[1], ap_data_m.bssid().addr[2], + ap_data_m.bssid().addr[3], ap_data_m.bssid().addr[4], ap_data_m.bssid().addr[5] ); + + server_m->get_wpx_adaptation_instance().get_association_request_wpx_ie( + ap_data_m, + assoc_ie_list_m ); + + if( ap_data_m.is_radio_measurement_supported() == true_t && + server_m->get_core_settings().is_feature_enabled( core_feature_802dot11k ) ) + { + u8_t max_capability = ap_data_m.max_tx_power_level(); + + /** + * Power capability IE. + */ + core_frame_radio_mgmt_ie_c* capability_ie = core_frame_radio_mgmt_ie_c::instance( + CORE_FRAME_RADIO_MGMT_IE_LENGTH, + CORE_FRAME_RADIO_MGMT_IE_MIN_POWER_CAPABILITY, + max_capability ); + if ( capability_ie ) + { + assoc_ie_list_m.append( + capability_ie, + capability_ie->element_id() ); + } + + /** + * RRM enabled capabilities IE. + */ + const u64_t rrm_capability( RRM_CAPABILITY_BIT_MASK ); + + core_frame_rrm_mgmt_ie_c* rrm_capability_ie = core_frame_rrm_mgmt_ie_c::instance( + reinterpret_cast(&rrm_capability) ); + if ( rrm_capability_ie ) + { + assoc_ie_list_m.append( + rrm_capability_ie, + rrm_capability_ie->element_id() ); + } + } + + /** + * Copy all the IEs to a buffer. + */ + u32_t assoc_ie_data_length( 0 ); + u32_t assoc_ie_data_index( 0 ); + + core_frame_dot11_ie_c* ie = assoc_ie_list_m.first(); + while( ie ) + { + assoc_ie_data_length += ie->data_length(); + + ie = assoc_ie_list_m.next(); + } + + if ( assoc_ie_data_length ) + { + assoc_ie_data_m = new u8_t[assoc_ie_data_length]; + ie = assoc_ie_list_m.first(); + while( ie ) + { + DEBUG2( "core_sub_operation_connect_c::next_state() - adding IE ID %u (0x%02X)", + ie->element_id(), ie->element_id() ); + DEBUG_BUFFER( + ie->data_length(), + ie->data() ); + + core_tools_c::copy( + &assoc_ie_data_m[assoc_ie_data_index], + ie->data(), + ie->data_length() ); + + assoc_ie_data_index += ie->data_length(); + ie = assoc_ie_list_m.next(); + } + } + else + { + DEBUG( "core_sub_operation_connect_c::next_state() - no IEs to add to the (re-)association request" ); + } + + server_m->get_core_settings().roam_metrics().set_roam_ts_connect_started(); + + server_m->register_frame_handler( this ); + + drivers_m->connect( + request_id_m, + connect_status_m, + ssid_m, + ap_data_m.bssid(), + auth_algorithm_m, + encryption_m, + pairwise_key_type_m, + ap_data_m.is_infra(), + assoc_ie_data_length, + assoc_ie_data_m, + ap_data_m.frame()->payload_data_length(), + ap_data_m.frame()->payload_data(), + is_pairwise_key_invalidated_m, + is_group_key_invalidated_m, + ap_data_m.is_radio_measurement_supported() ); + + break; + } + case core_state_connect: + { + operation_state_m = core_state_connect_frame; + + /** + * If (re-)association response frame is not needed or it has + * already been received, proceed to the next state. + */ + if( !assoc_resp_m || + *assoc_resp_m ) + { + return goto_state( core_state_connect_complete ); + } + + return goto_state( core_state_connect_frame ); + } + case core_state_connect_frame: + { + DEBUG( "core_sub_operation_connect_c::next_state() - waiting for (re-)association response frame" ); + + break; + } + case core_state_connect_complete: + { + server_m->unregister_frame_handler( this ); + server_m->get_core_settings().roam_metrics().set_roam_ts_connect_completed(); + server_m->get_wpx_adaptation_instance().handle_association_response( + ap_data_m, + assoc_resp_m ? *assoc_resp_m : NULL ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_connect_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG( "core_sub_operation_connect_c::user_cancel()" ); + + if ( !do_graceful_cancel ) + { + /** + * If we are waiting for a beacon, we have to schedule our own + * event. + */ + if ( operation_state_m == core_state_connect_frame ) + { + asynch_default_user_cancel(); + + return; + } + } + + /** + * Everything else is handled by the default implementation. + */ + core_operation_base_c::user_cancel( do_graceful_cancel ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_connect_c::cancel() + { + DEBUG( "core_sub_operation_connect_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_connect: + { + /** The connection attempt failed, we are no longer connected. */ + is_connected_m = false_t; + + return goto_state( core_state_connect_complete ); + } + default: + { + return failure_reason_m; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_connect_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t /* rcpi */ ) + { + DEBUG( "core_sub_operation_connect_c::receive_frame()" ); + + if ( frame->type() != core_frame_dot11_c::core_dot11_type_association_resp && + frame->type() != core_frame_dot11_c::core_dot11_type_reassociation_resp ) + { + DEBUG( "core_sub_operation_connect_c::receive_frame() - not a (re-)association response" ); + return false_t; + } + + if ( !assoc_resp_m ) + { + DEBUG( "core_sub_operation_connect_c::receive_frame() - parent operation not interested in (re-)association response" ); + return true_t; + } + else if ( *assoc_resp_m ) + { + DEBUG( "core_sub_operation_connect_c::receive_frame() - (re-)association response already received" ); + return true_t; + } + + DEBUG( "core_sub_operation_connect_c::receive_frame() - (re-)association response received" ); + *assoc_resp_m = core_frame_assoc_resp_c::instance( *frame, true_t ); + + /** + * If we are just waiting for the response frame, we have to schedule + * our own timer to proceed. + */ + if( operation_state_m == core_state_connect_frame ) + { + asynch_goto( core_state_connect_complete, CORE_TIMER_IMMEDIATELY ); + } + + return true_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_create_ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_create_ts.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for creating a traffic stream. +* +*/ + +/* +* %version: 12 % +*/ + +#include "core_sub_operation_create_ts.h" +#include "core_server.h" +#include "core_frame_wmm_ie.h" +#include "core_frame_wmm_ie_tspec.h" +#include "core_frame_action_wmm.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "am_debug.h" + +const u32_t CORE_AP_RESP_WAITING_TIME = 1000000; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_create_ts_c::core_sub_operation_create_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_ap_data_c& ap_data, + u8_t tid, + u8_t user_priority, + core_traffic_stream_params_s& tspec, + core_traffic_stream_status_e& stream_status ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_none ), + current_ap_m( ap_data ), + tid_m( tid ), + user_priority_m( user_priority ), + tspec_m( tspec ), + stream_status_m( stream_status ) + { + DEBUG( "core_sub_operation_create_ts_c::core_sub_operation_create_ts_c()" ); + + stream_status_m = core_traffic_stream_status_inactive_other; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_create_ts_c::~core_sub_operation_create_ts_c() + { + DEBUG( "core_sub_operation_create_ts_c::~core_sub_operation_create_ts_c()" ); + + server_m->unregister_frame_handler( this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_create_ts_c::next_state() + { + DEBUG( "core_sub_operation_create_ts_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + bool_t is_uapsd( true_t ); + if ( !current_ap_m.is_uapsd_supported() || + !server_m->get_core_settings().is_uapsd_enable_for_access_class( + core_tools_c::convert_user_priority_to_ac( user_priority_m ) ) ) + { + is_uapsd = false_t; + } + DEBUG1( "core_sub_operation_create_ts_c::next_state() - U-APSD %u", is_uapsd ); + + core_frame_wmm_ie_tspec_c* tspec_ie = core_frame_wmm_ie_tspec_c::instance( + tid_m, + user_priority_m, + is_uapsd, + tspec_m.is_periodic_traffic, + tspec_m.direction, + tspec_m.nominal_msdu_size, + tspec_m.maximum_msdu_size, + tspec_m.minimum_service_interval, + tspec_m.maximum_service_interval, + tspec_m.inactivity_interval, + tspec_m.suspension_interval, + tspec_m.service_start_time, + tspec_m.minimum_data_rate, + tspec_m.mean_data_rate, + tspec_m.peak_data_rate, + tspec_m.maximum_burst_size, + tspec_m.delay_bound, + tspec_m.minimum_phy_rate, + tspec_m.surplus_bandwidth_allowance, + tspec_m.medium_time ); + if ( !tspec_ie ) + { + DEBUG( "core_sub_operation_create_ts_c::next_state() - unable to allocate a WMM TSPEC IE" ); + return core_error_no_memory; + } + + DEBUG( "core_sub_operation_create_ts_c::next_state() - TSPEC IE:" ); + DEBUG_BUFFER( tspec_ie->data_length(), tspec_ie->data() ); + + const core_mac_address_s dest( + current_ap_m.bssid() ); + const core_mac_address_s src( + server_m->own_mac_addr() ); + + core_frame_action_wmm_c* frame = core_frame_action_wmm_c::instance( + 0, // Duration + dest, // Destination + src, // Source + dest, // BSSID + 0, // Sequence Control + core_frame_action_wmm_c::core_dot11_action_wmm_type_addts_req, // Action Type + 255, // Dialog Token + core_frame_action_wmm_c::core_dot11_action_wmm_status_admission_accepted, // Status + tspec_ie ); + + delete tspec_ie; + tspec_ie = NULL; + + if ( !frame ) + { + DEBUG( "core_sub_operation_create_ts_c::next_state() - unable to allocate an action frame" ); + return core_error_no_memory; + } + + /** + * Handle the WPX-specific features in traffic stream creation. + */ + server_m->get_wpx_adaptation_instance().handle_ts_create_request( + current_ap_m, + frame, + tid_m, + tspec_m ); + + DEBUG( "core_sub_operation_create_ts_c::next_state() - ADDTS REQ:" ); + DEBUG_BUFFER( frame->data_length(), frame->data() ); + + operation_state_m = core_state_request_sent; + + server_m->register_frame_handler( this ); + + server_m->send_management_frame( + core_frame_type_dot11, + frame->data_length(), + frame->data(), + dest ); + + delete frame; + frame = NULL; + + /** + * Schedule a timeout if no response is received. + */ + server_m->schedule_operation_timer( + CORE_AP_RESP_WAITING_TIME ); + + break; + } + case core_state_request_sent: + { + server_m->unregister_frame_handler( this ); + + DEBUG( "core_sub_operation_create_ts_c::next_state() - timer has expired, no response from AP received" ); + + return core_error_general; + } + case core_state_invalid_parameters: + { + DEBUG( "core_sub_operation_create_ts_c::next_state() - AP has downgraded our parameters, retrying" ); + + return goto_state( core_state_init ); + } + case core_state_failure: + { + server_m->unregister_frame_handler( this ); + + DEBUG( "core_sub_operation_create_ts_c::next_state() - AP has rejected our traffic stream request" ); + + return core_error_general; + } + case core_state_success: + { + server_m->unregister_frame_handler( this ); + + DEBUG( "core_sub_operation_create_ts_c::next_state() - traffic stream created successfully" ); + + DEBUG_RATES( "core_sub_operation_create_ts_c::next_state() - nominal PHY rate: ", + tspec_m.nominal_phy_rate ); + DEBUG_RATES( "core_sub_operation_create_ts_c::next_state() - override tx rates: ", + tspec_m.override_rates ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_create_ts_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t /* rcpi */ ) + { + DEBUG( "core_sub_operation_create_ts_c::receive_frame()" ); + + if ( frame->type() != core_frame_dot11_c::core_dot11_type_action ) + { + DEBUG( "core_sub_operation_create_ts_c::receive_frame() - not an action frame" ); + return false_t; + } + + core_frame_action_c* action = core_frame_action_c::instance( + *frame ); + if ( action ) + { + DEBUG( "core_sub_operation_create_ts_c::receive_frame() - 802.11 action frame found" ); + DEBUG1( "core_sub_operation_create_ts_c::receive_frame() - 802.11 action category: 0x%02X", + action->category() ); + if ( action->category() == core_frame_action_c::core_dot11_action_category_wmm_qos ) + { + core_frame_action_wmm_c* wmm_action = core_frame_action_wmm_c::instance( *action ); + if ( wmm_action ) + { + DEBUG( "core_sub_operation_create_ts_c::receive_frame() - 802.11 WMM action frame found" ); + DEBUG1( "core_sub_operation_create_ts_c::receive_frame() - 802.11 WMM action type: 0x%02X", + wmm_action->action_type() ); + DEBUG1( "core_sub_operation_create_ts_c::receive_frame() - 802.11 WMM action dialog token: 0x%02X", + wmm_action->dialog_token() ); + DEBUG1( "core_sub_operation_create_ts_c::receive_frame() - 802.11 WMM action status: 0x%02X", + wmm_action->status() ); + + /** + * Get traffic stream parameters from the response. + */ + bool_t ret = core_tools_parser_c::get_wmm_traffic_stream_params( + *wmm_action, + tid_m, + tspec_m ); + if ( !ret ) + { + DEBUG1( "core_sub_operation_create_ts_c::receive_frame() - TSPEC with TID %u not found, ignoring frame", + tid_m ); + + delete wmm_action; + wmm_action = NULL; + + delete action; + action = NULL; + + return true_t; + } + + server_m->get_wpx_adaptation_instance().get_wpx_traffic_stream_params( + wmm_action, + tid_m, + tspec_m ); + + server_m->cancel_operation_timer(); + + if ( wmm_action->status() == core_frame_action_wmm_c::core_dot11_action_wmm_status_admission_accepted ) + { + stream_status_m = core_traffic_stream_status_active; + + server_m->get_wpx_adaptation_instance().handle_ts_create_success( + wmm_action, + tid_m, + user_priority_m ); + + asynch_goto( core_state_success, CORE_TIMER_IMMEDIATELY ); + } + else if ( wmm_action->status() == core_frame_action_wmm_c::core_dot11_action_wmm_status_invalid_parameters ) + { + asynch_goto( core_state_invalid_parameters, CORE_TIMER_IMMEDIATELY ); + } + else + { + stream_status_m = server_m->get_wpx_adaptation_instance().get_wpx_traffic_stream_status( + wmm_action->status() ); + + asynch_goto( core_state_failure, CORE_TIMER_IMMEDIATELY ); + } + + delete wmm_action; + } + } + + delete action; + action = NULL; + } + + return true_t; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_echo_test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_echo_test.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for running an echo test. +* +*/ + + +#include "core_sub_operation_echo_test.h" +#include "core_operation_update_power_mode.h" +#include "core_frame_echo_test.h" +#include "core_tools.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_echo_test_c::core_sub_operation_echo_test_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_ap_data_c& ap_data, + u8_t max_retry_count, + u32_t timeout, + bool_t test_mode ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_connection_needed ), + current_ap_m( ap_data ), + max_retry_count_m( max_retry_count ), + retry_count_m( 0 ), + timeout_m( timeout ), + token_m( 0 ), + return_status_m( core_error_ok ), + is_unicast_mode_m( test_mode ) + { + DEBUG( "core_sub_operation_echo_test_c::core_sub_operation_echo_test_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_echo_test_c::~core_sub_operation_echo_test_c() + { + DEBUG( "core_sub_operation_echo_test_c::~core_sub_operation_echo_test_c()" ); + + server_m->unregister_frame_handler( this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_echo_test_c::next_state() + { + DEBUG( "core_sub_operation_echo_test_c::next_state()" ); + + core_frame_echo_test_c* frame = NULL; + + switch ( operation_state_m ) + { + case core_state_init: + { + if ( is_unicast_mode_m ) + { + frame = core_frame_echo_test_c::instance( + server_m->own_mac_addr(), + server_m->own_mac_addr(), + ++token_m ); + } + else + { + frame = core_frame_echo_test_c::instance( + BROADCAST_MAC_ADDR, + server_m->own_mac_addr(), + ++token_m ); + } + if ( !frame ) + { + DEBUG( "core_sub_operation_echo_test_c::next_state() - unable to generate a test frame" ); + + return core_error_no_memory; + } + + if ( is_unicast_mode_m ) + { + DEBUG( "core_sub_operation_echo_test_c::next_state() - sending a unicast echo test frame:" ); + DEBUG_BUFFER( frame->data_length(), frame->data() ); + + operation_state_m = core_state_echo_frame_unicast_timeout; + + server_m->register_frame_handler( this ); + + server_m->send_data_frame( + current_ap_m, + core_frame_type_test, + frame->data_length(), + frame->data(), + core_access_class_best_effort, + server_m->own_mac_addr() ); + } + else + { + DEBUG( "core_sub_operation_echo_test_c::next_state() - sending a broadcast echo test frame:" ); + DEBUG_BUFFER( frame->data_length(), frame->data() ); + + operation_state_m = core_state_echo_frame_broadcast_timeout; + + server_m->register_frame_handler( this ); + + server_m->send_data_frame( + current_ap_m, + core_frame_type_test, + frame->data_length(), + frame->data(), + core_access_class_best_effort, + BROADCAST_MAC_ADDR ); + } + + delete frame; + frame = NULL; + + /** + * Schedule a timeout if no response is received. + */ + server_m->schedule_operation_timer( + timeout_m ); + + break; + } + case core_state_echo_frame_broadcast_timeout: + { + /** + * Timeout, no response to broadcast frame was received. + */ + + DEBUG( "core_sub_operation_echo_test_c::next_state() - timeout while waiting for a broadcast frame" ); + + server_m->unregister_frame_handler( this ); + ++retry_count_m; + if ( retry_count_m < max_retry_count_m ) + { + DEBUG1( "core_sub_operation_echo_test_c::next_state() - %u broadcast retries still left, retrying", + max_retry_count_m - retry_count_m ); + + return goto_state( core_state_init ); + } + else + { + DEBUG( "core_sub_operation_echo_test_c::next_state() - no broadcast retries left" ); + } + + return core_error_timeout; + } + case core_state_echo_frame_unicast_timeout: + { + /** + * Timeout, no response to unicast frame was received. + */ + + DEBUG( "core_sub_operation_echo_test_c::next_state() - timeout while waiting for a unicast frame" ); + + server_m->unregister_frame_handler( this ); + ++retry_count_m; + if ( retry_count_m < max_retry_count_m ) + { + DEBUG1( "core_sub_operation_echo_test_c::next_state() - %u unicast retries still left, retrying", + max_retry_count_m - retry_count_m ); + + return goto_state( core_state_init ); + } + else + { + DEBUG( "core_sub_operation_echo_test_c::next_state() - no unicast retries left" ); + } + + return core_error_timeout; + } + case core_state_echo_frame_unicast: + { + /** + * A unicast frame received successfully. + */ + DEBUG( "core_sub_operation_echo_test_c::next_state() unicast - echo test success" ); + + return core_error_ok; + } + case core_state_echo_frame_broadcast: + { + /** + * A broadcast frame received successfully. + */ + DEBUG( "core_sub_operation_echo_test_c::next_state() broadcast - echo test success" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_echo_test_c::receive_test_frame( + const core_frame_echo_test_c* frame, + u8_t /* rcpi */ ) + { + DEBUG( "core_sub_operation_echo_test_c::receive_test_frame()" ); + + if ( frame->token() != token_m ) + { + DEBUG2( "core_sub_operation_echo_test_c::receive_test_frame() - token doesn't match, received %u, expected %u", + frame->token(), token_m ); + } + + if ( operation_state_m == core_state_echo_frame_unicast_timeout && + frame->destination() == server_m->own_mac_addr() && + frame->source() == server_m->own_mac_addr() ) + { + DEBUG( "core_sub_operation_echo_test_c::receive_test_frame() - unicast echo test frame received" ); + + server_m->cancel_operation_timer(); + + asynch_goto( core_state_echo_frame_unicast, CORE_TIMER_IMMEDIATELY ); + } + else if ( operation_state_m == core_state_echo_frame_broadcast_timeout && + frame->destination() == BROADCAST_MAC_ADDR && + frame->source() == server_m->own_mac_addr() ) + { + DEBUG( "core_sub_operation_echo_test_c::receive_test_frame() - broadcast echo test frame received" ); + + server_m->cancel_operation_timer(); + + asynch_goto( core_state_echo_frame_broadcast, CORE_TIMER_IMMEDIATELY ); + } + else + { + DEBUG( "core_sub_operation_echo_test_c::receive_test_frame() - unknown echo test frame" ); + DEBUG( "core_sub_operation_echo_test_c::receive_test_frame() - destination:" ); + DEBUG_MAC( frame->destination().addr ); + DEBUG( "core_sub_operation_echo_test_c::receive_test_frame() - source:" ); + DEBUG_MAC( frame->source().addr ); + DEBUG1( "core_sub_operation_echo_test_c::receive_test_frame() - token: %u", + frame->token() ); + } + + return true_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_load_drivers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_load_drivers.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,370 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for loading the drivers +* +*/ + + +#include "core_sub_operation_load_drivers.h" +#include "core_operation_update_rxtx_parameters.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_load_drivers_c::core_sub_operation_load_drivers_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_none ), + region_m( core_wlan_region_etsi ), + mcc_known_m( false_t ) + { + DEBUG( "core_sub_operation_load_drivers_c::core_sub_operation_load_drivers_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_load_drivers_c::~core_sub_operation_load_drivers_c() + { + DEBUG( "core_sub_operation_load_drivers_c::~core_sub_operation_load_drivers_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_load_drivers_c::next_state() + { + DEBUG( "core_sub_operation_load_drivers_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + if ( !server_m->get_core_settings().is_wlan_enabled() ) + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - WLAN is disabled, drivers cannot be loaded" ); + return core_error_wlan_disabled; + } + + if ( server_m->get_core_settings().is_driver_loaded() ) + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - drivers already loaded" ); + return core_error_ok; + } + + DEBUG( "core_sub_operation_load_drivers_c::next_state() - requesting region" ); + + operation_state_m = core_state_req_region; + + adaptation_m->get_regulatory_domain( + request_id_m, + region_m, + mcc_known_m ); + + break; + } + case core_state_req_region: + { + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - current region %u", + region_m ); + server_m->get_core_settings().set_regional_domain( + region_m ); + server_m->get_core_settings().set_mcc_known( mcc_known_m ); + + DEBUG( "core_sub_operation_load_drivers_c::next_state() - loading drivers" ); + + operation_state_m = core_state_req_load_drivers; + + drivers_m->load_drivers( + request_id_m, + server_m->get_device_settings().rts, + server_m->get_device_settings().max_tx_msdu_life_time, + server_m->get_device_settings().qos_null_frame_entry_timeout, + server_m->get_device_settings().qos_null_frame_entry_tx_count, + server_m->get_device_settings().qos_null_frame_interval, + server_m->get_device_settings().qos_null_frame_exit_timeout, + server_m->get_device_settings().keep_alive_interval, + server_m->get_device_settings().sp_rcpi_target, + server_m->get_device_settings().sp_time_target, + server_m->get_device_settings().sp_min_indication_interval ); + + break; + } + case core_state_req_load_drivers: + { + server_m->get_core_settings().set_driver_state( true_t ); + + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - setting tx power (%u)", + server_m->get_device_settings().tx_power_level ); + + operation_state_m = core_state_req_set_tx_power; + + drivers_m->set_tx_power_level( + request_id_m, + server_m->get_device_settings().tx_power_level ); + + break; + } + case core_state_req_set_tx_power: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting power mode to CORE_POWER_MODE_CAM" ); + + operation_state_m = core_state_req_set_rxtx_parameters; + + server_m->get_core_settings().set_power_mode( + CORE_POWER_MODE_CAM ); + + drivers_m->set_power_mode( + request_id_m, + CORE_POWER_MODE_CAM ); + + break; + } + case core_state_req_set_rxtx_parameters: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting rxtx parameters" ); + + operation_state_m = core_state_req_set_uapsd_settings; + + core_operation_base_c* operation = new core_operation_update_rxtx_parameters_c( + request_id_m, + server_m, + drivers_m, + adaptation_m ); + + return run_sub_operation( operation ); + } + case core_state_req_set_uapsd_settings: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting U-APSD settings" ); + + operation_state_m = core_state_req_set_power_save_settings; + + const core_uapsd_settings_s& settings( + server_m->get_core_settings().uapsd_settings() ); + + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - max_service_period: %u", + settings.max_service_period ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - uapsd_enabled_for_voice: %u", + settings.uapsd_enabled_for_voice ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - uapsd_enabled_for_video: %u", + settings.uapsd_enabled_for_video ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - uapsd_enabled_for_best_effort: %u", + settings.uapsd_enabled_for_best_effort ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - uapsd_enabled_for_background: %u", + settings.uapsd_enabled_for_background ); + + drivers_m->set_uapsd_settings( + request_id_m, + settings ); + + break; + } + case core_state_req_set_power_save_settings: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting power save settings" ); + + operation_state_m = core_state_req_set_power_mode_mgmt_settings; + + const core_power_save_settings_s& settings( + server_m->get_core_settings().power_save_settings() ); + + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_uapsd_power_save_for_voice: %u", + settings.stay_in_uapsd_power_save_for_voice ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_uapsd_power_save_for_video: %u", + settings.stay_in_uapsd_power_save_for_video ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_uapsd_power_save_for_best_effort: %u", + settings.stay_in_uapsd_power_save_for_best_effort ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_uapsd_power_save_for_background: %u", + settings.stay_in_uapsd_power_save_for_background ); + + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_legacy_power_save_for_voice: %u", + settings.stay_in_legacy_power_save_for_voice ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_legacy_power_save_for_video: %u", + settings.stay_in_legacy_power_save_for_video ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_legacy_power_save_for_best_effort: %u", + settings.stay_in_legacy_power_save_for_best_effort ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - stay_in_legacy_power_save_for_background: %u", + settings.stay_in_legacy_power_save_for_background ); + + drivers_m->set_power_save_settings( + request_id_m, + settings ); + + break; + } + case core_state_req_set_power_mode_mgmt_settings: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting power mode mgmt settings" ); + + operation_state_m = core_state_req_set_block_ack_usage; + + core_power_mode_mgmt_parameters_s settings; + settings.active_to_light_timeout = + server_m->get_device_settings().ps_active_to_light_timeout; + settings.active_to_light_threshold = + server_m->get_device_settings().ps_active_to_light_threshold; + settings.light_to_active_timeout = + server_m->get_device_settings().ps_light_to_active_timeout; + settings.light_to_active_threshold = + server_m->get_device_settings().ps_light_to_active_threshold; + settings.light_to_deep_timeout = + server_m->get_device_settings().ps_light_to_deep_timeout; + settings.light_to_deep_threshold = + server_m->get_device_settings().ps_light_to_deep_threshold; + settings.uapsd_rx_frame_length_threshold = + server_m->get_device_settings().ps_uapsd_rx_frame_length; + + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - active_to_light_timeout: %u", + settings.active_to_light_timeout ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - active_to_light_threshold: %u", + settings.active_to_light_threshold ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - light_to_active_timeout: %u", + settings.light_to_active_timeout ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - light_to_active_threshold: %u", + settings.light_to_active_threshold ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - light_to_deep_timeout: %u", + settings.light_to_deep_timeout ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - light_to_deep_threshold: %u", + settings.light_to_deep_threshold ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - uapsd_rx_frame_length_threshold: %u", + settings.uapsd_rx_frame_length_threshold ); + + drivers_m->set_power_mode_mgmt_parameters( + request_id_m, + settings ); + + break; + } + case core_state_req_set_block_ack_usage: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting block ACK usage" ); + + operation_state_m = core_state_req_set_wpx_settings; + + const core_block_ack_usage_s& usage( + server_m->get_core_settings().block_ack_usage() ); + + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - tx_usage: 0x%02X", + usage.tx_usage ); + DEBUG1( "core_sub_operation_load_drivers_c::next_state() - rx_usage: 0x%02X", + usage.rx_usage ); + + drivers_m->set_block_ack_usage( + request_id_m, + usage ); + + break; + } + case core_state_req_set_wpx_settings: + { + core_operation_base_c* operation = + server_m->get_wpx_adaptation_instance().get_wpx_load_drivers_operation(); + if( !operation ) + { + return goto_state( core_state_done ); + } + + DEBUG( "core_sub_operation_load_drivers_c::next_state() - setting WPX specific settings" ); + + return run_sub_operation( operation, core_state_done ); + } + case core_state_done: + { + DEBUG( "core_sub_operation_load_drivers_c::next_state() - all operations done" ); + + return core_error_ok; + } + case core_state_cancel_req_unload_drivers: + { + server_m->get_core_settings().set_driver_state( false_t ); + + DEBUG( "core_sub_operation_load_drivers_c::next_state() - unloading done " ); + + return failure_reason_m; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_load_drivers_c::user_cancel( + bool_t /* do_graceful_cancel */ ) + { + DEBUG( "core_sub_operation_load_drivers_c::user_cancel()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_load_drivers_c::cancel() + { + DEBUG( "core_sub_operation_load_drivers_c::cancel() " ); + + switch ( operation_state_m ) + { + case core_state_init: + /** Falls through on purpose. */ + case core_state_req_region: + /** Falls through on purpose. */ + case core_state_req_load_drivers: + { + /* Also in this case we need to make unload because it can happen that loading returns + * failure but there is still need to unload */ + + DEBUG( "core_sub_operation_load_drivers_c::cancel() - unloading drivers, load failed" ); + + operation_state_m = core_state_cancel_req_unload_drivers; + + drivers_m->unload_drivers( + request_id_m ); + + break; + } + case core_state_cancel_req_unload_drivers: + { + DEBUG( "core_sub_operation_load_drivers_c::cancel() - unloading failed, ignoring " ); + + return failure_reason_m; + } + default: + { + ASSERT( server_m->get_core_settings().is_driver_loaded() ); + DEBUG( "core_sub_operation_load_drivers_c::cancel() - unloading drivers " ); + + operation_state_m = core_state_cancel_req_unload_drivers; + + drivers_m->unload_drivers( + request_id_m ); + + break; + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_roam_scan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_roam_scan.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for doing scans when roaming +* +*/ + +/* +* %version: 22 % +*/ + +#include "core_sub_operation_roam_scan.h" +#include "core_frame_dot11.h" +#include "core_server.h" +#include "core_tools_parser.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_roam_scan_c::core_sub_operation_roam_scan_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + const core_ssid_s& scan_ssid, + const core_scan_channels_s& scan_channels, + bool_t is_connected, + bool_t is_first_match_selected ) : + core_operation_base_c( core_operation_scan, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + scan_ssid_m( scan_ssid ), + scan_channels_m( scan_channels ), + is_connected_m( is_connected ), + is_first_match_selected( is_first_match_selected ) + { + DEBUG( "core_sub_operation_roam_scan_c::core_sub_operation_roam_scan_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_roam_scan_c::~core_sub_operation_roam_scan_c() + { + DEBUG( "core_sub_operation_roam_scan_c::~core_sub_operation_roam_scan_c()" ); + + server_m->unregister_event_handler( this ); + server_m->unregister_frame_handler( this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_roam_scan_c::next_state() + { + DEBUG( "core_sub_operation_roam_scan_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_scan_start; + + if ( scan_ssid_m.length ) + { + DEBUG1S( "core_sub_operation_roam_scan_c::next_state() - requesting a direct scan with SSID ", + scan_ssid_m.length, &scan_ssid_m.ssid[0] ); + } + else + { + DEBUG( "core_sub_operation_roam_scan_c::next_state() - requesting a broadcast scan" ); + } + + if ( is_connected_m ) + { + DEBUG( "core_sub_operation_roam_scan_c::next_state() - requesting a split-scan" ); + } + else + { + DEBUG( "core_sub_operation_roam_scan_c::next_state() - requesting a regular scan" ); + } + + DEBUG2( "core_sub_operation_roam_scan_c::next_state() - requesting scan on channels 0x%02X%02X", + scan_channels_m.channels2dot4ghz[1], + scan_channels_m.channels2dot4ghz[0] ); + + server_m->get_scan_list().remove_entries_by_age( + server_m->get_device_settings().scan_list_expiration_time ); + + server_m->register_event_handler( this ); + server_m->register_frame_handler( this ); + + drivers_m->scan( + request_id_m, + core_scan_mode_active, + scan_ssid_m, + server_m->get_device_settings().scan_rate, + server_m->get_core_settings().valid_scan_channels( scan_channels_m ), + server_m->get_device_settings().active_scan_min_ch_time, + server_m->get_device_settings().active_scan_max_ch_time, + is_connected_m ); + + break; + } + case core_state_scan_start: + { + operation_state_m = core_state_scan_started; + + DEBUG( "core_sub_operation_roam_scan_c::next_state() - scan start completed, waiting for scan completion" ); + + break; + } + case core_state_scan_stop: + { + operation_state_m = core_state_scan_stopped; + + DEBUG( "core_sub_operation_roam_scan_c::next_state() - scan stop completed, waiting for scan completion" ); + + break; + } + case core_state_scan_stopped: + { + DEBUG( "core_sub_operation_roam_scan_c::next_state() - invalid state transition in core_state_scan_stopped" ); + ASSERT( false_t ); + } + case core_state_scan_complete: + { + server_m->unregister_frame_handler( this ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_roam_scan_c::user_cancel( + bool_t do_graceful_cancel ) + { + DEBUG( "core_sub_operation_roam_scan_c::user_cancel()" ); + + if ( !do_graceful_cancel ) + { + /** + * If we are in a middle of a scan, we have to schedule our own + * event. + */ + if ( operation_state_m == core_state_scan_started ) + { + asynch_default_user_cancel(); + + return; + } + + /** + * Everything else is handled by the default implementation. + */ + core_operation_base_c::user_cancel( do_graceful_cancel ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_roam_scan_c::receive_frame( + const core_frame_dot11_c* frame, + u8_t rcpi ) + { + DEBUG( "core_sub_operation_roam_scan_c::receive_frame()" ); + + if ( frame->type() != core_frame_dot11_c::core_dot11_type_beacon && + frame->type() != core_frame_dot11_c::core_dot11_type_probe_resp ) + { + DEBUG( "core_sub_operation_roam_scan_c::receive_frame() - not a beacon or a probe" ); + return false_t; + } + + core_ap_data_c* ap_data = core_ap_data_c::instance( + server_m->get_wpx_adaptation_instance(), + frame, + rcpi, + false_t ); + if ( ap_data ) + { + const core_ssid_s ssid( + ap_data->ssid() ); + +#ifdef _DEBUG + DEBUG1S( "core_sub_operation_roam_scan_c::receive_frame() - SSID: ", + ssid.length, &ssid.ssid[0] ); + + const core_mac_address_s bssid( + ap_data->bssid() ); + DEBUG6( "core_sub_operation_roam_scan_c::receive_frame() - BSSID: %02X:%02X:%02X:%02X:%02X:%02X", + bssid.addr[0], bssid.addr[1], bssid.addr[2], + bssid.addr[3], bssid.addr[4], bssid.addr[5] ); +#endif // _DEBUG + + server_m->get_scan_list().update_entry( *ap_data ); + + /** + * The current implementation assumes that scan is only stopped + * in an emergency situation so there's no need to check for + * admission control parameters. + */ + if ( operation_state_m == core_state_scan_started && + is_first_match_selected && + scan_ssid_m == ssid && + core_tools_parser_c::is_ap_suitable( + server_m->get_wpx_adaptation_instance(), + *ap_data, + server_m->get_connection_data()->iap_data(), + server_m->get_core_settings(), + *server_m->get_connection_data(), + server_m->get_device_settings().scan_stop_rcpi_threshold, + MEDIUM_TIME_NOT_DEFINED, + server_m->is_cm_active(), + ZERO_MAC_ADDR ) == core_connect_ok ) + { + DEBUG( "core_sub_operation_roam_scan_c::receive_frame() - AP is suitable, requesting scan to be stopped" ); + + operation_state_m = core_state_scan_stop; + + drivers_m->stop_scan( + request_id_m ); + } + else if ( operation_state_m == core_state_scan_start ) + { + DEBUG( "core_sub_operation_roam_scan_c::receive_frame() - scan frame received while starting scan" ); + } + else if ( operation_state_m == core_state_scan_stop ) + { + DEBUG( "core_sub_operation_roam_scan_c::receive_frame() - scan frame received while stopping scan" ); + } + else if ( operation_state_m == core_state_scan_stopped ) + { + DEBUG( "core_sub_operation_roam_scan_c::receive_frame() - scan frame after scan was stopped" ); + } + + delete ap_data; + ap_data = NULL; + } + + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_roam_scan_c::notify( + core_am_indication_e indication ) + { + if ( indication == core_am_indication_wlan_scan_complete ) + { + server_m->unregister_event_handler( this ); + + if ( operation_state_m == core_state_scan_start ) + { + DEBUG( "core_sub_operation_roam_scan_c::notify() - scan complete received while starting scan" ); + + /** + * No need to do anything here, state will be changed when the request completes. + */ + operation_state_m = core_state_scan_complete; + } + else if ( operation_state_m == core_state_scan_started ) + { + DEBUG( "core_sub_operation_roam_scan_c::notify() - scan complete" ); + + asynch_goto( core_state_scan_complete, CORE_TIMER_IMMEDIATELY ); + } + else if ( operation_state_m == core_state_scan_stop ) + { + DEBUG( "core_sub_operation_roam_scan_c::notify() - scan complete received while stopping scan" ); + + /** + * No need to do anything here, state will be changed when the request completes. + */ + operation_state_m = core_state_scan_complete; + } + else if ( operation_state_m == core_state_scan_stopped ) + { + DEBUG( "core_sub_operation_roam_scan_c::notify() - scan complete after scan stop completed" ); + + asynch_goto( core_state_scan_complete, CORE_TIMER_IMMEDIATELY ); + } + else + { + DEBUG( "core_sub_operation_roam_scan_c::notify() - scan complete in unknown state" ); + ASSERT( false_t ); + } + + return true_t; + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_roam_update_ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_roam_update_ts.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,736 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for updating traffic stream statuses after roam. +* +*/ + +/* +* %version: 12 % +*/ + +#include "core_sub_operation_roam_update_ts.h" +#include "core_sub_operation_create_ts.h" +#include "core_frame_wmm_ie.h" +#include "core_server.h" +#include "core_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_roam_update_ts_c::core_sub_operation_roam_update_ts_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + core_ap_data_c& ap_data ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_none ), + current_ap_m( ap_data ), + virtual_stream_list_m(), + virtual_stream_iter_m( virtual_stream_list_m ), + stream_list_m(), + stream_iter_m( stream_list_m ), + tid_m( 0 ), + user_priority_m( 0 ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::core_sub_operation_roam_update_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_roam_update_ts_c::~core_sub_operation_roam_update_ts_c() + { + DEBUG( "core_sub_operation_roam_update_ts_c::~core_sub_operation_roam_update_ts_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_roam_update_ts_c::next_state() + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state()" ); + + switch( operation_state_m ) + { + case core_state_init: + { + if( !server_m->get_core_settings().is_connected() ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - not connected, nothing to do" ); + + return core_error_general; + } + + bool_t is_ac_required[MAX_QOS_ACCESS_CLASS] = + { + current_ap_m.is_admission_control_required( + core_access_class_best_effort ), + current_ap_m.is_admission_control_required( + core_access_class_background ), + current_ap_m.is_admission_control_required( + core_access_class_video ), + current_ap_m.is_admission_control_required( + core_access_class_voice ) + }; + + /** + * If admission control is mandatory for an access class, send an indication + * to notify clients that this access class is no longer admitted. + * + * If admission control is not mandatory, send an indication that + * this access class is admitted. + */ + for( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) + { + if( is_ac_required[idx] ) + { + server_m->get_connection_data()->set_ac_traffic_status( + static_cast( idx ), + core_access_class_traffic_status_not_admitted ); + + DEBUG1( "core_operation_handle_delete_ts_c::next_state() - traffic no longer admitted on AC %u, notifying clients", + idx ); + + u8_t buf[5]; + buf[0] = idx; + buf[1] = static_cast( + core_access_class_traffic_status_not_admitted ); + adaptation_m->notify( + core_notification_ac_traffic_status_changed, + sizeof( buf ), + buf ); + } + else + { + server_m->get_connection_data()->set_ac_traffic_status( + static_cast( idx ), + core_access_class_traffic_status_admitted ); + + DEBUG1( "core_operation_handle_delete_ts_c::next_state() - traffic admitted on AC %u, notifying clients", + idx ); + + u8_t buf[5]; + buf[0] = idx; + buf[1] = static_cast( + core_access_class_traffic_status_admitted ); + adaptation_m->notify( + core_notification_ac_traffic_status_changed, + sizeof( buf ), + buf ); + } + } + + core_traffic_stream_list_c& ts_list( + server_m->get_connection_data()->traffic_stream_list() ); + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_traffic_stream_list_iter_c ts_iter( ts_list ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - traffic streams before processing:" ); + virtual_ts_list.print_contents(); + ts_list.print_contents(); + + /** + * Create a list of virtual traffic streams that are currently + * inactive and need to be created, i.e. admission control is + * mandatory for the access class. + */ + core_virtual_traffic_stream_c* virtual_iter = virtual_ts_iter.first(); + while( virtual_iter ) + { + if( is_ac_required[virtual_iter->access_class()] && + virtual_iter->status() != core_traffic_stream_status_active ) + { + DEBUG1( "core_sub_operation_roam_update_ts_c::next_state() - virtual traffic stream with ID %u needs to created", + virtual_iter->id() ); + + virtual_stream_list_m.add_traffic_stream( + *virtual_iter ); + } + + virtual_iter = virtual_ts_iter.next(); + } + + /** + * Delete all traffic streams that are no longer needed or that have + * been marked as rejected. Create a list of traffic streams that + * need to be re-created. + * + * There is no need to reset the TX queue parameters since + * UMAC will reset them automatically after an association. + */ + core_traffic_stream_c* iter = ts_iter.first(); + while( iter ) + { + if( !is_ac_required[iter->access_class()] ) + { + DEBUG2( "core_sub_operation_roam_update_ts_c::next_state() - traffic stream (TID %u, user priority %u) is no longer needed, deleting", + iter->tid(), iter->user_priority() ); + + /** + * Send a status update to all affected virtual traffic streams. + */ + set_virtual_traffic_stream_inactive_by_tid( + iter->tid(), + core_traffic_stream_status_inactive_not_required ); + + /** + * Delete the actual traffic stream. + */ + server_m->get_wpx_adaptation_instance().handle_ts_delete( + iter->tid(), iter->user_priority() ); + ts_iter.remove(); + } + else if( iter->status() == core_traffic_stream_status_undefined ) + { + DEBUG2( "core_sub_operation_roam_update_ts_c::next_state() - traffic stream (TID %u, user priority %u) needs to be re-created", + iter->tid(), iter->user_priority() ); + + stream_list_m.update_traffic_stream( *iter ); + } + else if( iter->status() != core_traffic_stream_status_active ) + { + DEBUG2( "core_sub_operation_roam_update_ts_c::next_state() - traffic stream (TID %u, user priority %u) is marked as rejected, deleting", + iter->tid(), iter->user_priority() ); + + /** + * Send a status update to all affected virtual traffic streams. + */ + set_virtual_traffic_stream_inactive_by_tid( + iter->tid(), + iter->status() ); + + /** + * Delete the actual traffic stream. + */ + server_m->get_wpx_adaptation_instance().handle_ts_delete( + iter->tid(), iter->user_priority() ); + ts_iter.remove(); + } + + iter = ts_iter.next(); + } + + (void)stream_iter_m.first(); + + return goto_state( core_state_recreate_next ); + } + case core_state_recreate_next: + { + core_traffic_stream_c* iter = stream_iter_m.current(); + if( !iter ) + { + /** + * All previously active traffic streams have now been re-created, + * process the virtual traffic streams that need to be created next. + */ + (void)virtual_stream_iter_m.first(); + + return goto_state( core_state_recreate_virtual_next ); + } + + tid_m = iter->tid(); + user_priority_m = iter->user_priority(); + + DEBUG2( "core_sub_operation_roam_update_ts_c::next_state() - trying to recreate traffic stream (TID %u, user priority %u)", + tid_m, user_priority_m ); + + params_m.is_periodic_traffic = iter->is_periodic_traffic(); + params_m.direction = iter->direction(); + params_m.nominal_msdu_size = iter->nominal_msdu_size(); + params_m.maximum_msdu_size = iter->maximum_msdu_size(); + params_m.minimum_service_interval = iter->minimum_service_interval(); + params_m.maximum_service_interval = iter->maximum_service_interval(); + params_m.inactivity_interval = iter->inactivity_interval(); + params_m.suspension_interval = iter->suspension_interval(); + params_m.service_start_time = iter->service_start_time(); + params_m.minimum_data_rate = iter->minimum_data_rate(); + params_m.mean_data_rate = iter->mean_data_rate(); + params_m.peak_data_rate = iter->peak_data_rate(); + params_m.maximum_burst_size = iter->maximum_burst_size(); + params_m.delay_bound = iter->delay_bound(); + params_m.minimum_phy_rate = iter->minimum_phy_rate(); + params_m.surplus_bandwidth_allowance = iter->surplus_bandwidth_allowance(); + params_m.medium_time = iter->medium_time(); + params_m.nominal_phy_rate = iter->nominal_phy_rate(); + params_m.override_rates = iter->override_rates(); + params_m.override_max_tx_msdu_lifetime = iter->max_tx_msdu_lifetime(); + + core_operation_base_c* operation = new core_sub_operation_create_ts_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + current_ap_m, + tid_m, + user_priority_m, + params_m, + stream_status_m ); + + return run_sub_operation( operation, core_state_recreate_success ); + } + case core_state_recreate_success: + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - traffic stream created successfully" ); + + /** + * Store the new traffic stream parameters. + */ + core_traffic_stream_c* iter = stream_iter_m.current(); + iter->set_status( core_traffic_stream_status_active ); + iter->set_traffic_values( params_m ); + server_m->get_connection_data()->traffic_stream_list().update_traffic_stream( *iter ); + + /** + * Move to the next entry. + */ + stream_iter_m.remove(); + (void)stream_iter_m.first(); + + return goto_state( core_state_recreate_next ); + } + case core_state_recreate_fail: + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - traffic stream creation failed" ); + + /** + * Send a status update to all affected virtual traffic streams. + */ + set_virtual_traffic_stream_inactive_by_tid( + tid_m, + core_traffic_stream_status_inactive_other ); + + /** + * Delete the actual traffic stream. + */ + server_m->get_wpx_adaptation_instance().handle_ts_delete( + tid_m, user_priority_m ); + server_m->get_connection_data()->traffic_stream_list().remove_traffic_stream_by_tid( tid_m ); + + /** + * Move to the next entry. + */ + stream_iter_m.remove(); + (void)stream_iter_m.first(); + + return goto_state( core_state_recreate_next ); + } + case core_state_recreate_virtual_next: + { + core_virtual_traffic_stream_c* virtual_iter = virtual_stream_iter_m.current(); + if( !virtual_iter ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - traffic streams after processing:" ); + server_m->get_connection_data()->virtual_traffic_stream_list().print_contents(); + server_m->get_connection_data()->traffic_stream_list().print_contents(); + (void)server_m->get_connection_data()->traffic_stream_list().first(); + + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - setting TX queue parameters" ); + return goto_state( core_state_set_params_next ); + } + + tid_m = virtual_iter->requested_tid(); + user_priority_m = virtual_iter->user_priority(); + params_m = virtual_iter->params(); + stream_status_m = core_traffic_stream_status_inactive_other; + if( tid_m != TRAFFIC_STREAM_TID_NONE ) + { + /** + * If TID has been specified for the virtual traffic stream, check + * whether it clashes with an existing traffic stream. + */ + if( server_m->get_connection_data()->traffic_stream_list().is_traffic_stream_for_tid( tid_m ) ) + { + DEBUG1( "core_operation_create_ts_c::next_state() - stream already exists for TID %u", + tid_m ); + + return goto_state( core_state_recreate_virtual_fail ); + } + } + else + { + /** + * If TID has been left unspecified, select the next free + * TID. + * + * First try to select the next free TID from virtual traffic + * stream list. In the unlikely scenario where all TIDs are + * in use, try the traffic stream list next. + */ + tid_m = server_m->get_connection_data()->virtual_traffic_stream_list().next_tid(); + if( tid_m == MAX_TRAFFIC_STREAM_TID ) + { + tid_m = server_m->get_connection_data()->traffic_stream_list().next_tid(); + if( tid_m == MAX_TRAFFIC_STREAM_TID ) + { + DEBUG1( "core_operation_create_ts_c::next_state() - no free TIDs for stream ID %u", + virtual_iter->id() ); + + return goto_state( core_state_recreate_virtual_fail ); + } + } + } + + /** + * Traffic stream to be created. + */ + core_traffic_stream_c iter( + tid_m, + user_priority_m ); + iter.set_default_traffic_values( params_m ); + iter.reset_to_default_values(); + stream_list_m.update_traffic_stream( + iter ); + (void)stream_iter_m.first(); + + DEBUG2( "core_sub_operation_roam_update_ts_c::next_state() - trying to create traffic stream (TID %u, user priority %u)", + tid_m, user_priority_m ); + + core_operation_base_c* operation = new core_sub_operation_create_ts_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + current_ap_m, + tid_m, + user_priority_m, + params_m, + stream_status_m ); + + return run_sub_operation( operation, core_state_recreate_virtual_success ); + } + case core_state_recreate_virtual_success: + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - virtual traffic stream created successfully" ); + + /** + * Store the new traffic stream parameters. + */ + core_virtual_traffic_stream_c* virtual_iter = virtual_stream_iter_m.current(); + core_traffic_stream_c* iter = stream_iter_m.current(); + iter->set_status( core_traffic_stream_status_active ); + iter->set_traffic_values( params_m ); + server_m->get_connection_data()->traffic_stream_list().update_traffic_stream( *iter ); + + /** + * Send a status update to all affected virtual traffic streams. + */ + set_virtual_traffic_stream_active_by_id( + virtual_iter->id(), + tid_m ); + + /** + * Move to the next entry. + */ + stream_iter_m.remove(); + virtual_stream_iter_m.remove(); + (void)virtual_stream_iter_m.first(); + + return goto_state( core_state_recreate_virtual_next ); + } + case core_state_recreate_virtual_fail: + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - virtual traffic stream creation failed" ); + + core_virtual_traffic_stream_c* iter = virtual_stream_iter_m.current(); + + /** + * Send a status update to all affected virtual traffic streams. + */ + set_virtual_traffic_stream_inactive_by_id( + iter->id(), + stream_status_m ); + + /** + * Move to the next entry. + */ + stream_iter_m.remove(); + virtual_stream_iter_m.remove(); + (void)virtual_stream_iter_m.first(); + + return goto_state( core_state_recreate_virtual_next ); + } + case core_state_set_params_next: + { + operation_state_m = core_state_set_params_success; + + core_traffic_stream_c* iter = server_m->get_connection_data()->traffic_stream_list().current(); + if( !iter ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::next_state() - all TX queue parameters set" ); + + return core_error_ok; + } + + ASSERT( iter->status() == core_traffic_stream_status_active ); + + if( iter->direction() == core_traffic_stream_direction_uplink || + iter->direction() == core_traffic_stream_direction_bidirectional ) + { + server_m->get_connection_data()->set_ac_traffic_status( + iter->access_class(), + core_access_class_traffic_status_admitted ); + + /** + * Send an indication to notify clients that this access class + * is now admitted. + */ + u8_t buf[5]; + buf[0] = static_cast( + iter->access_class() ); + buf[1] = static_cast( + core_access_class_traffic_status_admitted ); + adaptation_m->notify( + core_notification_ac_traffic_status_changed, + sizeof( buf ), + buf ); + + /** + * Set TX queue parameters to the drivers based on the created + * traffic stream. + */ + DEBUG3( "core_sub_operation_roam_update_ts_c::next_state() - setting queue_id %u; medium_time %u, max_tx_msdu_lifetime %u", + iter->access_class(), + iter->medium_time(), + iter->max_tx_msdu_lifetime() ); + + drivers_m->set_tx_queue_parameters( + request_id_m, + iter->access_class(), + iter->medium_time(), + iter->max_tx_msdu_lifetime() ); + } + else + { + /** + * Since TX queue parameters apply only to uplink, there is nothing + * more to do on downlink streams. Move to the next entry. + */ + (void)server_m->get_connection_data()->traffic_stream_list().next(); + + return goto_state( core_state_set_params_next ); + } + + break; + } + case core_state_set_params_success: + { + /** + * Move to the next entry. + */ + (void)server_m->get_connection_data()->traffic_stream_list().next(); + + return goto_state( core_state_set_params_next ); + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_roam_update_ts_c::cancel() + { + DEBUG( "core_sub_operation_roam_update_ts_c::cancel()" ); + + switch ( operation_state_m ) + { + case core_state_recreate_success: + { + /** + * Unable to create a traffic stream. + */ + return goto_state( core_state_recreate_fail ); + } + case core_state_recreate_virtual_success: + { + /** + * Unable to create a virtual traffic stream. + */ + return goto_state( core_state_recreate_virtual_fail ); + } + case core_state_set_params_success: + { + /** + * Ignore errors when setting TX queue parameters. + */ + return goto_state( core_state_set_params_success ); + } + default: + { + return failure_reason_m; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_inactive_by_tid( + u8_t tid, + core_traffic_stream_status_e stream_status ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_inactive_by_tid()" ); + + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + core_virtual_traffic_stream_c* virtual_iter = virtual_ts_iter.first(); + while( virtual_iter ) + { + if( virtual_iter->tid() == tid ) + { + u32_t id( virtual_iter->id() ); + + /** + * The virtual traffic stream is no longer mapped to any actual + * traffic stream. + */ + virtual_iter->set_tid( + TRAFFIC_STREAM_TID_NONE ); + virtual_iter->set_status( + stream_status ); + + DEBUG1( "core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_inactive_by_tid() - virtual traffic stream with ID %u is inactive", + id ); + + u8_t buf[5]; + core_tools_c::copy( + &buf[0], + reinterpret_cast( &id ), + sizeof( u32_t ) ); + buf[4] = static_cast( stream_status ); + + adaptation_m->notify( + core_notification_ts_status_changed, + sizeof( buf ), + buf ); + } + + virtual_iter = virtual_ts_iter.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_inactive_by_id( + u32_t id, + core_traffic_stream_status_e stream_status ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_inactive_by_id()" ); + + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + core_virtual_traffic_stream_c* virtual_iter = virtual_ts_iter.first(); + while( virtual_iter ) + { + if( virtual_iter->id() == id ) + { + u32_t id( virtual_iter->id() ); + + /** + * The virtual traffic stream is no longer mapped to any actual + * traffic stream. + */ + virtual_iter->set_tid( + TRAFFIC_STREAM_TID_NONE ); + virtual_iter->set_status( + stream_status ); + + DEBUG1( "core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_inactive_by_tid() - virtual traffic stream with ID %u is inactive", + id ); + + u8_t buf[5]; + core_tools_c::copy( + &buf[0], + reinterpret_cast( &id ), + sizeof( u32_t ) ); + buf[4] = static_cast( stream_status ); + + adaptation_m->notify( + core_notification_ts_status_changed, + sizeof( buf ), + buf ); + + return; + } + + virtual_iter = virtual_ts_iter.next(); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_active_by_id( + u32_t id, + u8_t tid ) + { + DEBUG( "core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_active_by_id()" ); + + core_virtual_traffic_stream_list_c& virtual_ts_list( + server_m->get_connection_data()->virtual_traffic_stream_list() ); + core_virtual_traffic_stream_list_iter_c virtual_ts_iter( virtual_ts_list ); + + core_virtual_traffic_stream_c* virtual_iter = virtual_ts_iter.first(); + while( virtual_iter ) + { + if( virtual_iter->id() == id ) + { + u32_t id( virtual_iter->id() ); + + /** + * The virtual traffic stream is no longer mapped to any actual + * traffic stream. + */ + virtual_iter->set_tid( + tid ); + virtual_iter->set_status( + core_traffic_stream_status_active ); + + DEBUG1( "core_sub_operation_roam_update_ts_c::set_virtual_traffic_stream_active_by_id() - virtual traffic stream with ID %u is active", + id ); + + u8_t buf[5]; + core_tools_c::copy( + &buf[0], + reinterpret_cast( &id ), + sizeof( u32_t ) ); + buf[4] = static_cast( core_traffic_stream_status_active ); + + adaptation_m->notify( + core_notification_ts_status_changed, + sizeof( buf ), + buf ); + + return; + } + + virtual_iter = virtual_ts_iter.next(); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_set_static_wep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_set_static_wep.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Statemachine for settings static WEP keys +* +*/ + + +#include "core_sub_operation_set_static_wep.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_set_static_wep_c::core_sub_operation_set_static_wep_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ) + { + DEBUG( "core_sub_operation_set_static_wep_c::core_sub_operation_set_static_wep_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_set_static_wep_c::~core_sub_operation_set_static_wep_c() + { + DEBUG( "core_sub_operation_set_static_wep_c::~core_sub_operation_set_static_wep_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_set_static_wep_c::next_state() + { + DEBUG( "core_sub_operation_set_static_wep_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + operation_state_m = core_state_req_set_key1; + + if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_length ) + { + DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #1" ); + + drivers_m->add_cipher_key( + core_cipher_key_type_wep, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_index, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_length, + &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_data[0], + BROADCAST_MAC_ADDR, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_index == + server_m->get_connection_data()->iap_data().default_wep_key_index() ); + } + + if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_length ) + { + DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #2" ); + + drivers_m->add_cipher_key( + core_cipher_key_type_wep, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_index, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_length, + &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_data[0], + BROADCAST_MAC_ADDR, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_index == + server_m->get_connection_data()->iap_data().default_wep_key_index() ); + } + + if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_length ) + { + DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #3" ); + + drivers_m->add_cipher_key( + core_cipher_key_type_wep, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_index, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_length, + &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_data[0], + BROADCAST_MAC_ADDR, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_index == + server_m->get_connection_data()->iap_data().default_wep_key_index() ); + } + + if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_length ) + { + DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #4" ); + + drivers_m->add_cipher_key( + core_cipher_key_type_wep, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_index, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_length, + &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_data[0], + BROADCAST_MAC_ADDR, + server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_index == + server_m->get_connection_data()->iap_data().default_wep_key_index() ); + } + + DEBUG( "core_sub_operation_set_static_wep_c::next_state() - WEP keys set" ); + + return core_error_ok; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wep_connect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wep_connect.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for connecting to a WEP network. +* +*/ + + +#include "core_sub_operation_wep_connect.h" +#include "core_sub_operation_connect.h" +#include "core_server.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_wep_connect_c::core_sub_operation_wep_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + core_management_status_e& connect_status, + const core_ssid_s& ssid, + core_ap_data_c& ap_data, + core_authentication_mode_e auth_mode, + core_encryption_mode_e encryption_level, + core_type_list_c& assoc_ie_list, + core_frame_assoc_resp_c** assoc_resp ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + is_connected_m( is_connected ), + connect_status_m( connect_status ), + ssid_m( ssid ), + ap_data_m( ap_data ), + initial_auth_mode_m( auth_mode ), + auth_mode_m( auth_mode ), + encryption_m( encryption_level ), + assoc_ie_list_m( assoc_ie_list ), + assoc_resp_m( assoc_resp ) + { + DEBUG( "core_sub_operation_wep_connect_c::core_sub_operation_wep_connect_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_wep_connect_c::~core_sub_operation_wep_connect_c() + { + DEBUG( "core_sub_operation_wep_connect_c::~core_sub_operation_wep_connect_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wep_connect_c::next_state() + { + DEBUG( "core_sub_operation_wep_connect_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + ASSERT( auth_mode_m == core_authentication_mode_open || + auth_mode_m == core_authentication_mode_shared ); + + if ( auth_mode_m == core_authentication_mode_open ) + { + DEBUG( "core_sub_operation_wep_connect_c::next_state() - attempting association with core_authentication_mode_open" ); + } + else + { + DEBUG( "core_sub_operation_wep_connect_c::next_state() - attempting association with core_authentication_mode_shared" ); + } + + core_operation_base_c* operation = new core_sub_operation_connect_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + connect_status_m, + ssid_m, + ap_data_m, + auth_mode_m, + server_m->get_wpx_adaptation_instance().encryption_mode( + ap_data_m, encryption_m ), + core_cipher_key_type_none, + assoc_ie_list_m, + assoc_resp_m, + true_t, // ignored, pairwise key not used + false_t ); + + return run_sub_operation( operation, core_state_connect ); + } + case core_state_connect: + { + DEBUG( "core_sub_operation_wep_connect_c::next_state() - association success" ); + + return core_error_ok; + } + case core_state_connect_failed: + { + DEBUG( "core_sub_operation_wep_connect_c::next_state() - association failed" ); + + DEBUG1( "core_sub_operation_wep_connect_c::next_state() - failure_reason_m is %u", + failure_reason_m ); + DEBUG1( "core_sub_operation_wep_connect_c::next_state() - management_status_m is %u", + connect_status_m ); + + /** + * We are only interested in management status codes that indicate + * that the AP doesn't support the selected authentication mode. + */ + if ( connect_status_m == core_management_status_auth_algo_not_supported && + auth_mode_m == initial_auth_mode_m ) + { + if ( auth_mode_m == core_authentication_mode_open ) + { + DEBUG( "core_sub_operation_wep_connect_c::next_state() - core_authentication_mode_open failed, trying with core_authentication_mode_shared" ); + auth_mode_m = core_authentication_mode_shared; + } + else + { + DEBUG( "core_sub_operation_wep_connect_c::next_state() - core_authentication_mode_shared failed, trying with core_authentication_mode_open" ); + auth_mode_m = core_authentication_mode_open; + } + + /** + * Update the used authentication mode to IAP data so that + * processing in parent operations is done correctly. + */ + server_m->get_connection_data()->iap_data().set_authentication_mode( auth_mode_m ); + + return goto_state( core_state_init ); + } + + return failure_reason_m; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wep_connect_c::cancel() + { + switch ( operation_state_m ) + { + case core_state_connect: + { + return goto_state( core_state_connect_failed ); + } + default: + { + return failure_reason_m; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wpa_connect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_wpa_connect.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1016 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: State machine for connecting to a WPA network +* +*/ + + +#include "core_sub_operation_wpa_connect.h" +#include "core_sub_operation_connect.h" +#include "core_server.h" +#include "core_tools.h" +#include "core_tools_parser.h" +#include "core_ap_data.h" +#include "core_frame_rsn_ie.h" +#include "core_frame_wpa_ie.h" +#include "core_frame_wapi_ie.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_wpa_connect_c::core_sub_operation_wpa_connect_c( + u32_t request_id, + core_server_c* server, + abs_core_driverif_c* drivers, + abs_core_server_callback_c* adaptation, + bool_t& is_connected, + core_management_status_e& connect_status, + const core_ssid_s& ssid, + core_ap_data_c& ap_data, + bool_t& is_cached_sa_used, + core_type_list_c& assoc_ie_list, + core_frame_assoc_resp_c** assoc_resp ) : + core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, + core_base_flag_drivers_needed ), + abs_wlan_eapol_callback_interface_c(), + is_connected_m( is_connected ), + is_cached_sa_used_m( is_cached_sa_used ), + connect_status_m( connect_status ), + ssid_m( ssid ), + ap_data_m( ap_data ), + current_bssid_m( ZERO_MAC_ADDR ), + pmkid_length_m( 0 ), + sent_ie_m( NULL ), + auth_algorithm_m( core_authentication_mode_open ), + eapol_auth_type_m( wlan_eapol_if_eapol_key_authentication_type_none ), + assoc_ie_list_m( assoc_ie_list ), + assoc_resp_m( assoc_resp ), + is_key_caching_used_m( false_t ) + { + DEBUG( "core_sub_operation_wpa_connect_c::core_sub_operation_wpa_connect_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_sub_operation_wpa_connect_c::~core_sub_operation_wpa_connect_c() + { + DEBUG( "core_sub_operation_wpa_connect_c::~core_sub_operation_wpa_connect_c()" ); + + /** + * Ownership of sent_ie_m has been transferred to assoc_ie_list_m, + * no need delete it. + */ + sent_ie_m = NULL; + + server_m->set_eapol_handler( NULL ); + server_m->unregister_event_handler( this ); + assoc_resp_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::next_state() + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state()" ); + + switch ( operation_state_m ) + { + case core_state_init: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_authentication_started as true" ); + server_m->get_connection_data()->set_eapol_authentication_started( + true_t ); + server_m->get_connection_data()->set_eapol_auth_bssid( + ZERO_MAC_ADDR ); + + eapol_auth_type_m = core_tools_c::eap_authentication_type( + server_m->get_connection_data()->iap_data(), + ap_data_m ); + current_bssid_m = ap_data_m.bssid(); + + server_m->set_eapol_handler( this ); + + server_m->get_eapol_instance().clear_stored_frame(); + + /** + * If roaming to a WPA2-EAP AP without a cached PMKSA, attempt + * to use proactive key caching if not previously done so. + */ + if( !is_key_caching_used_m && + !is_cached_sa_used_m && + server_m->get_connection_data()->current_ap_data() && + eapol_auth_type_m == wlan_eapol_if_eapol_key_authentication_type_rsna_eap ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - attempting to use proactive key caching" ); + + is_cached_sa_used_m = true_t; + is_key_caching_used_m = true_t; + } + else if( is_key_caching_used_m ) + { + is_cached_sa_used_m = false_t; + is_key_caching_used_m = false_t; + } + + // update_wlan_database_reference_values must be sent before start_authentication and start_reassociation. + u32_t reference[2] = { + 3, // ELan + server_m->get_connection_data()->iap_data().id() }; + core_error_e ret = server_m->get_eapol_instance().update_wlan_database_reference_values( + reinterpret_cast( reference ), 2*sizeof( u32_t ) ); + + if( is_cached_sa_used_m ) + { + if( eapol_auth_type_m == wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - starting a WPX fast-roam reassociation" ); + + core_error_e ret = server_m->get_wpx_adaptation_instance().handle_fast_roam_start_reassociation( + ap_data_m, + assoc_ie_list_m ); + DEBUG1( "core_sub_operation_wpa_connect_c::next_state() - handle_fast_roam_start_reassociation returned with %u", + ret ); + /* + * State machine will move forward from here by: + * - complete_start_wpx_fast_roam_reassociation() + * -> core_state_do_connect + * - Error message (start_wpx_fast_roam_reassociation) + * -> core_state_init (with is_cached_sa_used_m = false_t) + */ + } + else + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - starting a reassociation" ); + + operation_state_m = core_state_do_connect; + + core_mac_address_s previous_bssid( ZERO_MAC_ADDR ); + if( server_m->get_connection_data()->current_ap_data() ) + { + previous_bssid = server_m->get_connection_data()->current_ap_data()->bssid(); + } + + network_id_c previous_ap( + &previous_bssid.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + network_id_c new_ap( + ¤t_bssid_m.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + ret = server_m->get_eapol_instance().start_reassociation( + &previous_ap, &new_ap, eapol_auth_type_m ); + DEBUG1( "core_sub_operation_wpa_connect_c::next_state() - start_reassociation returned with %u", + ret ); + /* + * State machine will move forward from here by: + * - reassociate(), when reassociation is possible + * -> core_state_do_connect + * - Error message (start_reassociation), when start_reassociation is not possible + * -> core_state_start_authentication_needed + */ + } + } + else + { + // Full authentication is needed. + operation_state_m = core_state_start_authentication_needed; + return next_state(); + } + break; + } + case core_state_start_authentication_needed: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - starting a full authentication" ); + + operation_state_m = core_state_do_connect; + + network_id_c network_id( + ¤t_bssid_m.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + core_error_e ret = server_m->get_eapol_instance().start_authentication( + const_cast( &ssid_m.ssid[0] ), ssid_m.length, + eapol_auth_type_m, + const_cast( &server_m->get_connection_data()->iap_data().psk_key().key_data[0] ), + server_m->get_connection_data()->iap_data().psk_key().key_length, + server_m->get_connection_data()->iap_data().is_psk_overridden(), + &network_id ); + DEBUG1( "core_sub_operation_wpa_connect_c::next_state() - start_authentication returned with %u", + ret ); + + break; + } + case core_state_do_connect: + { + core_key_management_e key_management( core_key_management_eap ); + core_encryption_mode_e encryption_mode( core_encryption_mode_wpa ); + bool_t is_pairwise_key_invalidated( true_t ); + + switch ( eapol_auth_type_m ) + { + case wlan_eapol_if_eapol_key_authentication_type_rsna_eap: + /** Falls through on purpose. */ + case wlan_eapol_if_eapol_key_authentication_type_wpa_eap: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_eap" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_wpa" ); + key_management = core_key_management_eap; + encryption_mode = core_encryption_mode_wpa; + break; + } + case wlan_eapol_if_eapol_key_authentication_type_wfa_sc: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_eap" ); + key_management = core_key_management_eap; + + if ( ap_data_m.is_privacy_enabled() ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_wpa" ); + encryption_mode = core_encryption_mode_wpa; + } + else + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_disabled" ); + encryption_mode = core_encryption_mode_disabled; + } + break; + } + case wlan_eapol_if_eapol_key_authentication_type_rsna_psk: + /** Falls through on purpose. */ + case wlan_eapol_if_eapol_key_authentication_type_wpa_psk: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_preshared" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_wpa" ); + key_management = core_key_management_preshared; + encryption_mode = core_encryption_mode_wpa; + break; + } + case wlan_eapol_if_eapol_key_authentication_type_802_1x: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_eap" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_802dot1x" ); + key_management = core_key_management_eap; + encryption_mode = core_encryption_mode_802dot1x; + break; + } + case wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_encryption_mode_802dot1x" ); + key_management = core_key_management_wpx_fast_roam; + encryption_mode = core_encryption_mode_802dot1x; + if( is_cached_sa_used_m ) + { + is_pairwise_key_invalidated = false_t; + } + break; + } + case wlan_eapol_if_eapol_key_authentication_type_wapi: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_wapi_certificate" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_security_mode_wapi" ); + key_management = core_key_management_wapi_certificate; + encryption_mode = core_encryption_mode_wpi; + break; + } + case wlan_eapol_if_eapol_key_authentication_type_wapi_psk: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using key management core_key_management_wapi_psk" ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - using encryption mode core_security_mode_wapi" ); + key_management = core_key_management_wapi_psk; + encryption_mode = core_encryption_mode_wpi; + break; + } + default: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - unknown authentication type" ); + ASSERT( false_t ); + } + } + + operation_state_m = core_state_req_connect; + + if( ap_data_m.is_rsn_ie_present() ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - generating RSN IE" ); + + sent_ie_m = core_frame_rsn_ie_c::instance( + server_m->get_wpx_adaptation_instance(), + ap_data_m.best_group_cipher(), + ap_data_m.best_pairwise_cipher(), + key_management, + pmkid_length_m, + &pmkid_data_m[0] ); + } + else if( ap_data_m.is_wpa_ie_present() ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - generating WPA IE" ); + + sent_ie_m = core_frame_wpa_ie_c::instance( + server_m->get_wpx_adaptation_instance(), + ap_data_m.best_group_cipher(), + ap_data_m.best_pairwise_cipher(), + key_management ); + } + else if( ap_data_m.is_wapi_ie_present() ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - generating WAPI IE" ); + + sent_ie_m = core_frame_wapi_ie_c::instance( + ap_data_m.best_group_cipher(), + ap_data_m.best_pairwise_cipher(), + key_management, + 0, + pmkid_length_m, + &pmkid_data_m[0] ); + } + + if( sent_ie_m && + eapol_auth_type_m != wlan_eapol_if_eapol_key_authentication_type_wfa_sc ) + { + assoc_ie_list_m.append( + sent_ie_m, + sent_ie_m->element_id() ); + } + + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_connecting as true" ); + server_m->get_connection_data()->set_eapol_connecting( + true_t ); + + core_operation_base_c* operation = new core_sub_operation_connect_c( + request_id_m, + server_m, + drivers_m, + adaptation_m, + is_connected_m, + connect_status_m, + ssid_m, + ap_data_m, + auth_algorithm_m, + server_m->get_wpx_adaptation_instance().encryption_mode( + ap_data_m, encryption_mode ), + core_tools_c::cipher_key_type( + ap_data_m.best_pairwise_cipher() ), + assoc_ie_list_m, + assoc_resp_m, + is_pairwise_key_invalidated, + true_t ); + + return run_sub_operation( operation ); + } + case core_state_req_connect: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - connection success" ); + + operation_state_m = core_state_req_state_notification; + + network_id_c network( + ¤t_bssid_m.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + const core_frame_dot11_ie_c* ie = NULL; + if( ap_data_m.is_rsn_ie_present() ) + { + ie = ap_data_m.rsn_ie(); + } + else if( ap_data_m.is_wpa_ie_present() ) + { + ie = ap_data_m.wpa_ie(); + } + else if( ap_data_m.is_wapi_ie_present() ) + { + ie = ap_data_m.wapi_ie(); + } + + core_frame_dot11_ie_c * recv_ie = NULL; + core_frame_dot11_ie_c * sent_ie = NULL; + + if ( sent_ie_m ) + { + sent_ie = sent_ie_m; + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - sent IE: " ); + DEBUG_BUFFER( sent_ie_m->data_length(), sent_ie_m->data() ); + } + + if ( ie ) + { + recv_ie = core_frame_dot11_ie_c::instance( ie->data_length(), ie->data() ); + + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - received IE: " ); + DEBUG_BUFFER( ie->data_length(), ie->data() ); + } + + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_connecting as false" ); + server_m->get_connection_data()->set_eapol_connecting( + false_t ); + server_m->get_connection_data()->set_eapol_auth_bssid( + current_bssid_m ); + + /** + * WPX fast-roam reassociation is handled differently, EAPOL indication will + * move the state machine forward. + */ + if ( is_cached_sa_used_m && + eapol_auth_type_m == wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam ) + { + server_m->get_wpx_adaptation_instance().handle_fast_roam_reassoc_resp( + assoc_resp_m ? *assoc_resp_m : NULL ); + + delete recv_ie; + recv_ie = NULL; + delete ie; + ie = NULL; + return core_error_request_pending; + } + + u8_t * temp_recv_ie( NULL ); + u32_t temp_recv_ie_length( 0 ); + u8_t * temp_sent_ie( NULL ); + u32_t temp_sent_ie_length( 0 ); + + if ( recv_ie ) + { + temp_recv_ie = const_cast( recv_ie->data() ); + temp_recv_ie_length = recv_ie->data_length(); + } + if ( sent_ie_m ) + { + temp_sent_ie = const_cast( sent_ie->data() ); + temp_sent_ie_length = sent_ie->data_length(); + } + + if ( is_cached_sa_used_m ) + { + server_m->get_eapol_instance().complete_reassociation( + wlan_eapol_if_eapol_wlan_authentication_state_association_ok, + &network, + temp_recv_ie, temp_recv_ie_length, + temp_sent_ie, temp_sent_ie_length, + core_tools_c::eapol_cipher( ap_data_m.best_pairwise_cipher() ), + core_tools_c::eapol_cipher( ap_data_m.best_group_cipher() ) ); + } + else + { + server_m->get_eapol_instance().complete_association( + wlan_eapol_if_eapol_wlan_authentication_state_association_ok, + &network, + temp_recv_ie, temp_recv_ie_length, + temp_sent_ie, temp_sent_ie_length, + core_tools_c::eapol_cipher( ap_data_m.best_pairwise_cipher() ), + core_tools_c::eapol_cipher( ap_data_m.best_group_cipher() ) ); + } + + delete recv_ie; + recv_ie = NULL; + delete ie; + ie = NULL; + + // Send EAPOL frame after timer. This will allow new EAPOL frames to come from queue. + return asynch_goto( core_state_process_eapol_frame, CORE_TIMER_IMMEDIATELY ); + } + case core_state_process_eapol_frame: + { + operation_state_m = core_state_req_state_notification; + + server_m->get_eapol_instance().process_stored_frame(); + server_m->register_event_handler( this ); + + break; + } + case core_state_req_state_notification: + { + server_m->unregister_event_handler( this ); + + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - authentication success" ); + + return core_error_ok; + } + case core_state_req_connect_failed: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - connection failed" ); + + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_authentication_started as false" ); + server_m->get_connection_data()->set_eapol_authentication_started( + false_t ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_connecting as false" ); + server_m->get_connection_data()->set_eapol_connecting( + false_t ); + + /** The connection attempt failed, we are no longer connected. */ + is_connected_m = false_t; + + /** + * WPX fast-roam reassociation is handled differently, EAPOL indication will + * move the state machine forward. + * + * This completion should be before clearing eapol_handler. + * Otherwise we don't get error message. + */ + if ( is_cached_sa_used_m && + eapol_auth_type_m == wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam ) + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - calling EAPOL complete_fast_roam_reassociation (this_ap_failed)" ); + server_m->get_wpx_adaptation_instance().handle_fast_roam_reassoc_resp( NULL ); + + return core_error_request_pending; + } + + /** + * We already know the connection has failed so don't process the failure + * indication from EAPOL. + */ + server_m->set_eapol_handler( NULL ); + + wlan_eapol_if_eapol_wlan_authentication_state_e eapol_reason( + wlan_eapol_if_eapol_wlan_authentication_state_this_ap_failed ); + + if ( connect_status_m == core_management_status_auth_algo_not_supported ) + { + eapol_reason = wlan_eapol_if_eapol_wlan_authentication_state_802_11_auth_algorithm_not_supported; + } + else if ( failure_reason_m == core_error_timeout ) + { + eapol_reason = wlan_eapol_if_eapol_wlan_authentication_state_no_response; + } + + network_id_c network( + ¤t_bssid_m.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + if ( is_cached_sa_used_m ) + { + DEBUG1( "core_sub_operation_wpa_connect_c::next_state() - calling EAPOL complete_reassociation with code %u", + eapol_reason ); + + server_m->get_eapol_instance().complete_reassociation( + eapol_reason, + &network, + NULL, 0, + NULL, 0, + wlan_eapol_if_rsna_cipher_none, + wlan_eapol_if_rsna_cipher_none ); + } + else + { + DEBUG1( "core_sub_operation_wpa_connect_c::next_state() - calling EAPOL complete_association with code %u", + eapol_reason ); + + server_m->get_eapol_instance().complete_association( + eapol_reason, + &network, + NULL, 0, + NULL, 0, + wlan_eapol_if_rsna_cipher_none, + wlan_eapol_if_rsna_cipher_none ); + } + + return cancel(); + } + case core_state_req_association_failed: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - association, reassociation or WPX fast-roam reassociation failed" ); + + server_m->set_eapol_handler( NULL ); + + return cancel(); + } + case core_state_bss_lost: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - authentication failed due to BSS lost" ); + + /** The connection attempt failed, we are no longer connected. */ + is_connected_m = false_t; + + return core_error_timeout; + } + case core_state_user_cancel: + { + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - pending request has been completed, proceeding with user cancel" ); + + network_id_c network( + ¤t_bssid_m.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + DEBUG6( "core_sub_operation_wpa_connect_c::next_state() - EAPOL disassociation from BSSID %02X:%02X:%02X:%02X:%02X:%02X", + current_bssid_m.addr[0], current_bssid_m.addr[1], current_bssid_m.addr[2], + current_bssid_m.addr[3], current_bssid_m.addr[4], current_bssid_m.addr[5] ); + + server_m->get_eapol_instance().disassociation( &network ); + + /** The connection attempt failed, we are no longer connected. */ + is_connected_m = false_t; + + return core_error_cancel; + } + default: + { + ASSERT( false_t ); + } + } + + return core_error_request_pending; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::cancel() + { + DEBUG( "core_sub_operation_wpa_connect_c::cancel()" ); + + switch( operation_state_m ) + { + case core_state_req_connect: + { + return goto_state( core_state_req_connect_failed ); + } + case core_state_req_state_notification: + { + if( server_m->get_connection_data()->is_eapol_require_immediate_reconnect() || + ( is_key_caching_used_m && + failure_reason_m == core_error_eapol_auth_start_timeout ) ) + { + DEBUG( "core_sub_operation_wpa_connect_c::cancel() - re-attempting authentication" ); + server_m->get_connection_data()->set_eapol_require_immediate_reconnect( false_t ); + assoc_ie_list_m.clear(); + + return asynch_goto( core_state_init, 100000 ); // 100 ms delay before new connect + } + + /** The connection attempt failed, we are no longer connected. */ + is_connected_m = false_t; + + return failure_reason_m; + } + default: + { + return failure_reason_m; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_wpa_connect_c::user_cancel( + bool_t /* do_graceful_cancel */ ) + { + DEBUG( "core_sub_operation_wpa_connect_c::user_cancel()" ); + + /** + * Do not handle any EAPOL indications that might occur during our + * transition to core_state_user_cancel state. + */ + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_authenticating as false" ); + server_m->get_connection_data()->set_eapol_authenticating( + false_t ); + DEBUG( "core_sub_operation_wpa_connect_c::next_state() - marking is_eapol_authentication_started as false" ); + server_m->get_connection_data()->set_eapol_authentication_started( + false_t ); + + /** + * If we are waiting for an EAPOL indication, we'll have to schedule + * our own timer to proceed. + */ + if( operation_state_m == core_state_req_state_notification ) + { + asynch_goto( core_state_user_cancel, CORE_TIMER_IMMEDIATELY ); + + return; + } + + /** + * Otherwise we'll just wait for the pending request complete + * before continuing. + */ + operation_state_m = core_state_user_cancel; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::packet_send( + network_id_c * send_network_id, + u8_t * packet_data, + u32_t packet_data_length, + bool_t send_unencrypted ) + { + DEBUG( "core_sub_operation_wpa_connect_c::packet_send()" ); + + server_m->send_data_frame( + ap_data_m, + core_frame_type_ethernet, + static_cast( packet_data_length ), + packet_data, + core_access_class_voice, + send_network_id->destination(), + send_unencrypted ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::associate( + wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ) + { + DEBUG( "core_sub_operation_wpa_connect_c::associate()" ); + + auth_algorithm_m = server_m->get_wpx_adaptation_instance().authentication_algorithm( + eapol_auth_type_m, + authentication_mode ); + + next_state(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::disassociate( + network_id_c * /*receive_network_id*/, + const bool_t /* self_disassociation */ ) + { + DEBUG( "core_sub_operation_wpa_connect_c::disassociate()" ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::packet_data_session_key( + network_id_c * send_network_id, + session_key_c * key ) + { + DEBUG( "core_sub_operation_wpa_connect_c::packet_data_session_key()" ); + ASSERT ( key != NULL ); + ASSERT ( send_network_id != NULL ); + + core_mac_address_s mac( BROADCAST_MAC_ADDR ); + + if ( key->eapol_key_type == wlan_eapol_if_eapol_key_type_unicast ) + { + mac = send_network_id->destination(); + } + + core_cipher_key_type_e type = + core_tools_c::cipher_key_type( + key->eapol_key_type, + ap_data_m.best_pairwise_cipher(), + ap_data_m.best_group_cipher() ); + + ASSERT( drivers_m ); + drivers_m->add_cipher_key( + type, + static_cast( key->key_index ), + static_cast( key->key_length ), + key->key, + mac, + true_t ); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_wpa_connect_c::state_notification( + state_notification_c * /*state*/ ) + { + DEBUG( "core_sub_operation_wpa_connect_c::state_notification()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::reassociate( + network_id_c * /* send_network_id */, + const wlan_eapol_if_eapol_key_authentication_type_e /* authentication_type */, + u8_t * PMKID, + u32_t PMKID_length ) + { + DEBUG( "core_sub_operation_wpa_connect_c::reassociate()" ); + + if( PMKID ) + { + pmkid_length_m = PMKID_length; + core_tools_c::copy( + &pmkid_data_m[0], + PMKID, + pmkid_length_m ); + } + + DEBUG( "core_sub_operation_wpa_connect_c::reassociate() - using open authentication algorithm" ); + auth_algorithm_m = core_authentication_mode_open; + + next_state(); + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::complete_check_pmksa_cache( + core_type_list_c & /* network_id_list */ ) + { + DEBUG( "core_sub_operation_wpa_connect_c::complete_check_pmksa_cache()" ); + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::complete_start_wpx_fast_roam_reassociation( + network_id_c * /* receive_network_id */, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ) + { + DEBUG( "core_sub_operation_wpa_connect_c::complete_start_wpx_fast_roam_reassociation()" ); + + // Generate a WPX fast-roam IE and append it to assoc_ie_list. + // Actually this could be done with core_wpx_frame_fast_roam_req_ie_c::instance() to make sure it's size is correct. + core_frame_dot11_ie_c* ie = core_frame_dot11_ie_c::instance( + reassociation_request_ie_length, + reassociation_request_ie, + true_t ); + if ( !ie ) + { + DEBUG( "core_sub_operation_wpa_connect_c::complete_start_wpx_fast_roam_reassociation() - unable to generate a dot11 IE" ); + is_cached_sa_used_m = false_t; + //asynch_goto( core_state_init, CORE_TIMER_IMMEDIATELY ); + return core_error_no_memory; + } + + assoc_ie_list_m.append( + ie, + ie->element_id() ); + + if( eapol_auth_type_m == wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam && + is_cached_sa_used_m ) + { + server_m->get_connection_data()->set_eapol_authenticating( + true_t ); + } + + asynch_goto( core_state_do_connect, CORE_TIMER_IMMEDIATELY ); + return core_error_ok; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_sub_operation_wpa_connect_c::new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & /* credential_list */ ) + { + DEBUG( "core_sub_operation_wpa_connect_c::new_protected_setup_credentials()" ); + + ASSERT( false_t ); + + return core_error_ok; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_sub_operation_wpa_connect_c::handle_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ) + { + DEBUG3( "core_sub_operation_wpa_connect_c::handle_error() - Received error message: errorcode=%i, function=%i (operation_state_m=%i)", + errorcode, + function, + operation_state_m ); + + if ( errorcode != wlan_eapol_if_error_ok + && errorcode != wlan_eapol_if_error_pending_request ) + { + if ( function == wlan_eapol_if_message_type_function_start_reassociation ) + { + // Full authentication is needed. + is_cached_sa_used_m = false_t; + asynch_goto( core_state_start_authentication_needed, CORE_TIMER_IMMEDIATELY ); + } + else if ( function == wlan_eapol_if_message_type_function_start_wpx_fast_roam_reassociation ) + { + is_cached_sa_used_m = false_t; + + asynch_goto( core_state_init, CORE_TIMER_IMMEDIATELY ); + } + else if ( function == wlan_eapol_if_message_type_function_complete_association + || function == wlan_eapol_if_message_type_function_complete_reassociation + || function == wlan_eapol_if_message_type_function_complete_wpx_fast_roam_reassociation ) + { + DEBUG( "core_sub_operation_wpa_connect_c::handle_error() - (WPX fast-roam) (re-)association failed" ); + asynch_goto( core_state_req_association_failed, CORE_TIMER_IMMEDIATELY ); + } + /*else if ( function == wlan_eapol_if_message_type_function_start_authentication ) + { + }*/ + else + { + DEBUG( "core_sub_operation_wpa_connect_c::handle_error() - Error ignored." ); + } + } + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_sub_operation_wpa_connect_c::notify( + core_am_indication_e indication ) + { + if ( operation_state_m == core_state_req_state_notification && + ( indication == core_am_indication_wlan_media_disconnect || + indication == core_am_indication_wlan_beacon_lost || + indication == core_am_indication_wlan_power_mode_failure || + indication == core_am_indication_wlan_tx_fail ) ) + { + server_m->unregister_event_handler( this ); + + if ( indication == core_am_indication_wlan_media_disconnect ) + { + DEBUG( "core_sub_operation_wpa_connect_c::notify() - AP has disconnected us during authentication, notifying EAPOL" ); + } + else + { + DEBUG( "core_sub_operation_wpa_connect_c::notify() - connection to the AP has been lost, notifying EAPOL" ); + } + + network_id_c network( + ¤t_bssid_m.addr[0], + MAC_ADDR_LEN, + &server_m->own_mac_addr().addr[0], + MAC_ADDR_LEN, + server_m->get_eapol_instance().ethernet_type() ); + + DEBUG6( "core_sub_operation_wpa_connect_c::notify() - EAPOL disassociation from BSSID %02X:%02X:%02X:%02X:%02X:%02X", + current_bssid_m.addr[0], current_bssid_m.addr[1], current_bssid_m.addr[2], + current_bssid_m.addr[3], current_bssid_m.addr[4], current_bssid_m.addr[5] ); + + server_m->get_eapol_instance().disassociation( &network ); + + if ( indication != core_am_indication_wlan_media_disconnect ) + { + DEBUG( "core_sub_operation_wpa_connect_c::notify() - marking is_eapol_authenticating as false" ); + server_m->get_connection_data()->set_eapol_authenticating( + false_t ); + DEBUG( "core_sub_operation_wpa_connect_c::notify() - marking is_eapol_authentication_started as false" ); + server_m->get_connection_data()->set_eapol_authentication_started( + false_t ); + + asynch_goto( core_state_bss_lost ); + + return true_t; + } + + /** + * EAPOL indication will move the state machine forward. + */ + + return true_t; + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_timer_counter_measures.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_timer_counter_measures.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Timer for handling WPA TKIP counter measures +* +*/ + + +#include "core_timer_factory.h" +#include "core_timer_counter_measures.h" +#include "core_callback.h" +#include "am_debug.h" + +/** Wait time for the next secure connection failure (60 sec). */ +const uint_t CORE_CM_FAIL_WAIT_TIME = 60000000; + +/** Blocking time for WPA connections (60 sec). */ +const uint_t CORE_CM_BLOCKING_TIME = 60000000; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +core_timer_counter_measures_c::core_timer_counter_measures_c() : + state_m( core_state_not_running ), + timer_m( NULL ) + { + DEBUG( "core_timer_counter_measures_c::core_timer_counter_measures_c()" ); + + core_callback_c* timer_callback = + new core_callback_c( &(core_timer_counter_measures_c::timer_expired), this ); + if( !timer_callback ) + { + DEBUG( "core_timer_counter_measures_c::core_timer_counter_measures_c() - unable to create callbacks" ); + } + + timer_m = core_timer_factory_c::create_timer( timer_callback ); + if( !timer_m ) + { + delete timer_callback; + DEBUG( "core_timer_counter_measures_c::core_timer_counter_measures_c() - unable to create timer" ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +core_timer_counter_measures_c::~core_timer_counter_measures_c() + { + DEBUG( "core_timer_counter_measures_c::~core_timer_counter_measures_c()" ); + + if ( timer_m ) + { + timer_m->stop(); + core_timer_factory_c::destroy_timer( timer_m ); + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +bool_t core_timer_counter_measures_c::is_wpa_allowed() + { + return ( state_m != core_state_blocked ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void core_timer_counter_measures_c::mic_failure() + { + DEBUG( "core_timer_counter_measures_c::mic_failure()" ); + + switch ( state_m ) + { + case core_state_not_running: + DEBUG( "core_timer_counter_measures_c::mic_failure() - new state is core_state_activated" ); + state_m = core_state_activated; + if ( timer_m ) + { + timer_m->start( CORE_CM_FAIL_WAIT_TIME ); + } + break; + case core_state_activated: + DEBUG( "core_timer_counter_measures_c::mic_failure() - new state is core_state_blocked" ); + state_m = core_state_blocked; + if ( timer_m ) + { + timer_m->stop(); + timer_m->start( CORE_CM_BLOCKING_TIME ); + } + break; + default: + DEBUG( "core_timer_counter_measures_c::mic_failure() - indication in wrong state" ); + ASSERT( false_t ); + break; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void core_timer_counter_measures_c::timer_expired( + void* this_ptr ) + { + DEBUG( "core_timer_counter_measures_c::timer_expired()" ); + + core_timer_counter_measures_c* self = + static_cast( this_ptr ); + + switch ( self->state_m ) + { + case core_state_activated: + /** Falls through on purpose. */ + case core_state_blocked: + DEBUG( "core_timer_counter_measures_c::timer_expired() - new state is core_state_not_running" ); + self->state_m = core_state_not_running; + break; + default: + DEBUG( "core_timer_counter_measures_c::timer_expired() - expiration in wrong state" ); + ASSERT( false_t ); + break; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1115 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Simple utility functions for core +* +*/ + + +#include "core_tools.h" +#include "core_frame_beacon.h" +#include "genscanoffsets.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// core_tools_c::compare +// ----------------------------------------------------------------------------- +// +int_t core_tools_c::compare( + const u8_t* pl, + int_t ll, + const u8_t* pr, + int_t rl ) + { + if ( ll != rl ) + { + return ll - rl; + } + + if ( pl == pr ) + { + return 0; + } + + for ( int_t i( 0 ); i < ll; ++i ) + { + if ( *(pl+i) != *(pr+i) ) + { + return *(pl+i) - *(pr+i); + } + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::copy +// ----------------------------------------------------------------------------- +// +u8_t* core_tools_c::copy( + void* trg, + const void* src, + int_t len ) + { + if ( len <= 0 ) + { + return reinterpret_cast( trg ); + } + + if ( trg == src ) + { + return reinterpret_cast( trg ) + len; + } + + // ensure areas do not overlap + if ( trg > src ) + { + ASSERT( reinterpret_cast( trg ) >= ( reinterpret_cast( src ) + len ) ); + } + else + { + ASSERT( reinterpret_cast( src ) >= ( reinterpret_cast( trg ) + len ) ); + } + + for ( i32_t i( 0 ); i < len; ++i ) + { + *( reinterpret_cast( trg ) + i ) = *( reinterpret_cast( src ) + i ); + } + + return reinterpret_cast( trg ) + len; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::fillz +// ----------------------------------------------------------------------------- +// +void core_tools_c::fillz( + void* trg, + int_t len ) + { + if ( len <= 0 ) + { + return; + } + + for ( int_t i( 0 ); i < len; ++i ) + { + *( reinterpret_cast( trg ) + i ) = 0; + } + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_host_to_big_endian +// ----------------------------------------------------------------------------- +// +u16_t core_tools_c::convert_host_to_big_endian( + u16_t src ) + { + return( static_cast( ( src >> 8 ) | ( src << 8 ) ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_host_to_big_endian +// ----------------------------------------------------------------------------- +// +u32_t core_tools_c::convert_host_to_big_endian( + u32_t src ) + { + return( static_cast( ( ( src & 0xFF ) << 24 ) | + ( ( src & 0xFF00 ) << 8 ) | + ( ( src & 0xFF0000 ) >> 8 ) | + ( ( src & 0xFF000000 ) >> 24 ) ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_big_endian_to_host +// ----------------------------------------------------------------------------- +// +u16_t core_tools_c::convert_big_endian_to_host( + u16_t src ) + { + return( static_cast( ( src >> 8 ) | ( src << 8 ) ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_big_endian_to_host +// ----------------------------------------------------------------------------- +// +u32_t core_tools_c::convert_big_endian_to_host( + u32_t src ) + { + return( static_cast( ( ( src & 0xFF ) << 24 ) | + ( ( src & 0xFF00 ) << 8 ) | + ( ( src & 0xFF0000 ) >> 8 ) | + ( ( src & 0xFF000000 ) >> 24 ) ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::get_u16_big_endian +// ----------------------------------------------------------------------------- +// +u16_t core_tools_c::get_u16_big_endian( + const u8_t* data, + u16_t index ) + { + return core_tools_c::convert_big_endian_to_host( + get_u16( data, index ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::get_u16 +// ----------------------------------------------------------------------------- +// +u16_t core_tools_c::get_u16( + const u8_t* data, + u16_t index ) + { + u16_t temp16( 0 ); + core_tools_c::copy( reinterpret_cast( &temp16 ), + data + index, + sizeof( temp16 ) ); + + return temp16; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::get_u32_big_endian +// ----------------------------------------------------------------------------- +// +u32_t core_tools_c::get_u32_big_endian( + const u8_t* data, + u16_t index ) + { + return core_tools_c::convert_big_endian_to_host( + get_u32( data, index ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::get_u32 +// ----------------------------------------------------------------------------- +// +u32_t core_tools_c::get_u32( + const u8_t* data, + u16_t index ) + { + u32_t temp32( 0 ); + core_tools_c::copy( reinterpret_cast( &temp32 ), + data + index, + sizeof( temp32 ) ); + + return temp32; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::get_u64 +// ----------------------------------------------------------------------------- +// +u64_t core_tools_c::get_u64( + const u8_t* data, + u16_t index ) + { + u64_t temp64( 0 ); + core_tools_c::copy( reinterpret_cast( &temp64 ), + data + index, + sizeof( temp64 ) ); + + return temp64; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::insert_u16_big_endian +// ----------------------------------------------------------------------------- +// +void core_tools_c::insert_u16_big_endian( + u8_t* data, + u16_t index, + u16_t value ) + { + u16_t temp16( + convert_host_to_big_endian( value ) ); + + core_tools_c::copy( + &data[index], + reinterpret_cast( &temp16 ), + sizeof( temp16 ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::insert_u16 +// ----------------------------------------------------------------------------- +// +void core_tools_c::insert_u16( + u8_t* data, + u16_t index, + u16_t value ) + { + u16_t temp16( value ); + + core_tools_c::copy( + &data[index], + reinterpret_cast( &temp16 ), + sizeof( temp16 ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::insert_u32_big_endian +// ----------------------------------------------------------------------------- +// +void core_tools_c::insert_u32_big_endian( + u8_t* data, + u16_t index, + u32_t value ) + { + u32_t temp32( + convert_host_to_big_endian( value ) ); + + core_tools_c::copy( + &data[index], + reinterpret_cast( &temp32 ), + sizeof( temp32 ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::insert_u32 +// ----------------------------------------------------------------------------- +// +void core_tools_c::insert_u32( + u8_t* data, + u16_t index, + u32_t value ) + { + u32_t temp32( value ); + + core_tools_c::copy( + &data[index], + reinterpret_cast( &temp32 ), + sizeof( temp32 ) ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::append_u16_big_endian +// ----------------------------------------------------------------------------- +// +void core_tools_c::append_u16_big_endian( + u8_t* data, + u16_t& data_length, + u16_t value ) + { + insert_u16_big_endian( + data, + data_length, + value ); + data_length += sizeof( value ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::append_u16 +// ----------------------------------------------------------------------------- +// +void core_tools_c::append_u16( + u8_t* data, + u16_t& data_length, + u16_t value ) + { + insert_u16( + data, + data_length, + value ); + data_length += sizeof( value ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::append_u32_big_endian +// ----------------------------------------------------------------------------- +// +void core_tools_c::append_u32_big_endian( + u8_t* data, + u16_t& data_length, + u32_t value ) + { + insert_u32_big_endian( + data, + data_length, + value ); + data_length += sizeof( value ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::append_u32 +// ----------------------------------------------------------------------------- +// +void core_tools_c::append_u32( + u8_t* data, + u16_t& data_length, + u32_t value ) + { + insert_u32( + data, + data_length, + value ); + data_length += sizeof( value ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::cipher_key_type +// ----------------------------------------------------------------------------- +// +core_cipher_key_type_e core_tools_c::cipher_key_type( + core_cipher_suite_e cipher ) + { + switch( cipher ) + { + case core_cipher_suite_wep40: + /** Falls through on purpose. */ + case core_cipher_suite_wep104: + return core_cipher_key_type_wep; + case core_cipher_suite_tkip: + return core_cipher_key_type_tkip; + case core_cipher_suite_ccmp: + return core_cipher_key_type_ccmp; + case core_cipher_suite_wpi: + return core_cipher_key_type_wpi; + default: + return core_cipher_key_type_none; + } + } + +// ----------------------------------------------------------------------------- +// core_tools_c::cipher_key_type +// ----------------------------------------------------------------------------- +// +core_cipher_key_type_e core_tools_c::cipher_key_type( + wlan_eapol_if_eapol_key_type_e type, + core_cipher_suite_e pairwise_cipher, + core_cipher_suite_e group_cipher ) + { + core_cipher_key_type_e return_type( core_cipher_key_type_ccmp ); + + switch( type ) + { + case wlan_eapol_if_eapol_key_type_unicast: + { + if( pairwise_cipher == core_cipher_suite_ccmp ) + { + DEBUG( "core_tools_c::cipher_key_type() - pairwise CCMP key" ); + return_type = core_cipher_key_type_ccmp; + } + else if( pairwise_cipher == core_cipher_suite_tkip ) + { + DEBUG( "core_tools_c::cipher_key_type() - pairwise TKIP key" ); + return_type = core_cipher_key_type_tkip; + } + else if( pairwise_cipher == core_cipher_suite_wpi ) + { + DEBUG( "core_tools_c::cipher_key_type() - pairwise WPI key" ); + return_type = core_cipher_key_type_wpi; + } + else + { + DEBUG( "core_tools_c::cipher_key_type() - pairwise WEP key" ); + return_type = core_cipher_key_type_wep; + } + break; + } + case wlan_eapol_if_eapol_key_type_broadcast: + { + if( group_cipher == core_cipher_suite_ccmp ) + { + DEBUG( "core_tools_c::cipher_key_type() - group CCMP key" ); + return_type = core_cipher_key_type_ccmp; + } + else if( group_cipher == core_cipher_suite_tkip ) + { + DEBUG( "core_tools_c::cipher_key_type() - group TKIP key" ); + return_type = core_cipher_key_type_tkip; + } + else if( pairwise_cipher == core_cipher_suite_wpi ) + { + DEBUG( "core_tools_c::cipher_key_type() - group WPI key" ); + return_type = core_cipher_key_type_wpi; + } + else + { + DEBUG( "core_tools_c::cipher_key_type() - group WEP key" ); + return_type = core_cipher_key_type_wep; + } + break; + } + case wlan_eapol_if_eapol_key_type_pmkid: + { + DEBUG( "core_tools_c::cipher_key_type() - PMKID" ); + ASSERT( false_t ); + break; + } + default: + { + DEBUG1( "core_tools_c::cipher_key_type() - unknown EAPOL key type %u", + type ); + ASSERT( false_t ); + } + } + + return return_type; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::cipher_key_type +// ----------------------------------------------------------------------------- +// +wlan_eapol_if_eapol_key_authentication_type_e core_tools_c::eap_authentication_type( + const core_iap_data_c& iap_data, + const core_ap_data_c& ap_data ) + { + core_security_mode_e mode = + iap_data.security_mode(); + bool_t is_psk_required = + iap_data.is_psk_used(); + + if( mode == core_security_mode_802dot1x && + !ap_data.is_rsn_ie_present() && + !ap_data.is_wpa_ie_present() ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_802_1x" ); + return wlan_eapol_if_eapol_key_authentication_type_802_1x; + } + else if( mode == core_security_mode_802dot1x && + ap_data.key_management_suites() & core_key_management_wpx_fast_roam ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam" ); + return wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam; + } + if( mode == core_security_mode_protected_setup ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wfa_sc" ); + return wlan_eapol_if_eapol_key_authentication_type_wfa_sc; + } + else if( iap_data.is_eap_used() ) + { + if( ap_data.is_rsn_ie_present() ) + { + if( !is_psk_required && + ap_data.key_management_suites() & core_key_management_eap ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_rsna_eap" ); + return wlan_eapol_if_eapol_key_authentication_type_rsna_eap; + } + else if( is_psk_required && + ap_data.key_management_suites() & core_key_management_preshared ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_rsna_psk" ); + return wlan_eapol_if_eapol_key_authentication_type_rsna_psk; + } + } + else if( ap_data.is_wpa_ie_present() ) + { + if( !is_psk_required && + ap_data.key_management_suites() & core_key_management_eap ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wpa_eap" ); + return wlan_eapol_if_eapol_key_authentication_type_wpa_eap; + } + else if( is_psk_required && + ap_data.key_management_suites() & core_key_management_preshared ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wpa_psk" ); + return wlan_eapol_if_eapol_key_authentication_type_wpa_psk; + } + } + } + else if( iap_data.is_wapi_used() ) + { + if( !is_psk_required && + ap_data.key_management_suites() & core_key_management_wapi_certificate ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wapi" ); + return wlan_eapol_if_eapol_key_authentication_type_wapi; + } + else if( is_psk_required && + ap_data.key_management_suites() & core_key_management_wapi_psk ) + { + DEBUG( "core_tools_c::eap_authentication_type() - wlan_eapol_if_eapol_key_authentication_type_wapi_psk" ); + return wlan_eapol_if_eapol_key_authentication_type_wapi_psk; + } + } + + DEBUG( "core_tools_c::eap_authentication_type() - unable to select security" ); + + return wlan_eapol_if_eapol_key_authentication_type_none; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::eapol_cipher +// ----------------------------------------------------------------------------- +// +wlan_eapol_if_rsna_cipher_e core_tools_c::eapol_cipher( + core_cipher_suite_e cipher ) + { + switch( cipher ) + { + case core_cipher_suite_wep40: + return wlan_eapol_if_rsna_cipher_wep_40; + case core_cipher_suite_wep104: + return wlan_eapol_if_rsna_cipher_wep_104; + case core_cipher_suite_tkip: + return wlan_eapol_if_rsna_cipher_tkip; + case core_cipher_suite_ccmp: + return wlan_eapol_if_rsna_cipher_ccmp; + case core_cipher_suite_wpi: + return wlan_eapol_if_wapi_cipher_wpi; + default: + return wlan_eapol_if_rsna_cipher_none; + } + } + +// ----------------------------------------------------------------------------- +// core_tools_c::add_beacon_to_scan_list +// ----------------------------------------------------------------------------- +// +void core_tools_c::add_beacon_to_scan_list( + ScanList& scan_list, + const core_ap_data_c& ap_data, + u32_t rcpi ) + { + const u32_t frame_length = ap_data.frame()->data_length(); + + u8_t* buffer = new u8_t[frame_length + DOT11_BASE_OFFSET]; + if ( !buffer ) + { + DEBUG( "core_tools_c::add_beacon_to_scan_list() - unable to create a frame buffer" ); + + return; + } + + core_tools_c::fillz( + buffer, + frame_length ); + + /** + * Set the RCPI value. + */ + core_tools_c::insert_u32( + buffer, + CNTRL_RX_LEVEL_OFFSET, + rcpi ); + + /** + * Set the frame length. + */ + core_tools_c::insert_u32( + buffer, + CNTRL_LENGTH_OFFSET, + frame_length ); + + /** + * Copy the actual frame data. + */ + core_tools_c::copy( + &buffer[DOT11_BASE_OFFSET], + ap_data.frame()->data(), + frame_length ); + + u32_t list_length = scan_list.Append( + frame_length + DOT11_BASE_OFFSET, + reinterpret_cast( buffer ) ); + if ( list_length == APPEND_FAILED_NO_MEMORY ) + { + DEBUG( "core_tools_c::add_beacon_to_scan_list() - unable to append to the scan list" ); + } + else + { + DEBUG( "core_tools_c::add_beacon_to_scan_list() - BSSID added to the list" ); + DEBUG1( "core_tools_c::add_beacon_to_scan_list() - entry length: %u", + frame_length + DOT11_BASE_OFFSET ); + DEBUG1( "core_tools_c::add_beacon_to_scan_list() - list size after append: %u", + list_length ); + } + + delete[] buffer; + buffer = NULL; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_user_priority_to_ac +// ----------------------------------------------------------------------------- +// +core_access_class_e core_tools_c::convert_user_priority_to_ac( + u8_t user_priority ) + { + /** + * Mapping of 802.1D Priority to Access Class from WMM specification. + */ + const u8_t mapping_table[MAX_QOS_USER_PRIORITY] = + { + core_access_class_best_effort, + core_access_class_background, + core_access_class_background, + core_access_class_best_effort, + core_access_class_video, + core_access_class_video, + core_access_class_voice, + core_access_class_voice + }; + + if ( user_priority >= MAX_QOS_USER_PRIORITY ) + { + return core_access_class_best_effort; + } + + return static_cast( mapping_table[user_priority] ); + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_ac_to_user_priority +// ----------------------------------------------------------------------------- +// +u8_t core_tools_c::convert_ac_to_user_priority( + core_access_class_e access_class ) + { + /** + * Based on 802.1D mapping from WMM specification. + */ + const u8_t mapping_table[MAX_QOS_ACCESS_CLASS] = + { + 3, // core_access_class_best_effort + 2, // core_access_class_background + 5, // core_access_class_video + 7, // core_access_class_voice + }; + + return mapping_table[access_class]; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_tx_rate_to_tx_rate_enum +// ----------------------------------------------------------------------------- +// +core_tx_rate_e core_tools_c::convert_tx_rate_to_tx_rate_enum( + u8_t tx_rate ) + { + switch( tx_rate ) + { + case core_tx_rate_value_1mbit: + return core_tx_rate_1mbit; + case core_tx_rate_value_2mbit: + return core_tx_rate_2mbit; + case core_tx_rate_value_5p5mbit: + return core_tx_rate_5p5mbit; + case core_tx_rate_value_6mbit: + return core_tx_rate_6mbit; + case core_tx_rate_value_9mbit: + return core_tx_rate_9mbit; + case core_tx_rate_value_11mbit: + return core_tx_rate_11mbit; + case core_tx_rate_value_12mbit: + return core_tx_rate_12mbit; + case core_tx_rate_value_18mbit: + return core_tx_rate_18mbit; + case core_tx_rate_value_22mbit: + return core_tx_rate_22mbit; + case core_tx_rate_value_24mbit: + return core_tx_rate_24mbit; + case core_tx_rate_value_33mbit: + return core_tx_rate_33mbit; + case core_tx_rate_value_36mbit: + return core_tx_rate_36mbit; + case core_tx_rate_value_48mbit: + return core_tx_rate_48mbit; + case core_tx_rate_value_54mbit: + return core_tx_rate_54mbit; + default: + return core_tx_rate_none; + } + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_tx_rate_enum_to_tx_rate +// ----------------------------------------------------------------------------- +// +u8_t core_tools_c::convert_tx_rate_enum_to_tx_rate( + core_tx_rate_e tx_rate ) + { + switch( tx_rate ) + { + case core_tx_rate_1mbit: + return core_tx_rate_value_1mbit; + case core_tx_rate_2mbit: + return core_tx_rate_value_2mbit; + case core_tx_rate_5p5mbit: + return core_tx_rate_value_5p5mbit; + case core_tx_rate_6mbit: + return core_tx_rate_value_6mbit; + case core_tx_rate_9mbit: + return core_tx_rate_value_9mbit; + case core_tx_rate_11mbit: + return core_tx_rate_value_11mbit; + case core_tx_rate_12mbit: + return core_tx_rate_value_12mbit; + case core_tx_rate_18mbit: + return core_tx_rate_value_18mbit; + case core_tx_rate_22mbit: + return core_tx_rate_value_22mbit; + case core_tx_rate_24mbit: + return core_tx_rate_value_24mbit; + case core_tx_rate_33mbit: + return core_tx_rate_value_33mbit; + case core_tx_rate_36mbit: + return core_tx_rate_value_36mbit; + case core_tx_rate_48mbit: + return core_tx_rate_value_48mbit; + case core_tx_rate_54mbit: + return core_tx_rate_value_54mbit; + default: + return core_tx_rate_value_none; + } + } + +// ----------------------------------------------------------------------------- +// core_tools_c::highest_tx_rate +// ----------------------------------------------------------------------------- +// +core_tx_rate_e core_tools_c::highest_tx_rate( + u32_t tx_rates ) + { + if ( tx_rates & core_tx_rate_54mbit ) + { + return core_tx_rate_54mbit; + } + else if ( tx_rates & core_tx_rate_48mbit ) + { + return core_tx_rate_48mbit; + } + else if ( tx_rates & core_tx_rate_36mbit ) + { + return core_tx_rate_36mbit; + } + else if ( tx_rates & core_tx_rate_33mbit ) + { + return core_tx_rate_33mbit; + } + else if ( tx_rates & core_tx_rate_24mbit ) + { + return core_tx_rate_24mbit; + } + else if ( tx_rates & core_tx_rate_22mbit ) + { + return core_tx_rate_22mbit; + } + else if ( tx_rates & core_tx_rate_18mbit ) + { + return core_tx_rate_18mbit; + } + else if ( tx_rates & core_tx_rate_12mbit ) + { + return core_tx_rate_12mbit; + } + else if ( tx_rates & core_tx_rate_11mbit ) + { + return core_tx_rate_11mbit; + } + else if ( tx_rates & core_tx_rate_9mbit ) + { + return core_tx_rate_9mbit; + } + else if ( tx_rates & core_tx_rate_6mbit ) + { + return core_tx_rate_6mbit; + } + else if ( tx_rates & core_tx_rate_5p5mbit ) + { + return core_tx_rate_5p5mbit; + } + else if ( tx_rates & core_tx_rate_2mbit ) + { + return core_tx_rate_2mbit; + } + else if ( tx_rates & core_tx_rate_1mbit ) + { + return core_tx_rate_1mbit; + } + + return core_tx_rate_none; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_tx_rates_to_tx_policy +// ----------------------------------------------------------------------------- +// +core_tx_rate_policy_s core_tools_c::convert_tx_rates_to_tx_policy( + u32_t tx_rates ) + { + const u8_t RETRIES = 1; + + core_tx_rate_policy_s policy; + core_tools_c::fillz( + &policy, + sizeof( policy ) ); + + if ( tx_rates & core_tx_rate_54mbit ) + { + policy.tx_policy_54 = RETRIES; + } + if( tx_rates & core_tx_rate_48mbit ) + { + policy.tx_policy_48 = RETRIES; + } + if( tx_rates & core_tx_rate_36mbit ) + { + policy.tx_policy_36 = RETRIES; + } + if( tx_rates & core_tx_rate_33mbit ) + { + policy.tx_policy_33 = RETRIES; + } + if( tx_rates & core_tx_rate_24mbit ) + { + policy.tx_policy_24 = RETRIES; + } + if( tx_rates & core_tx_rate_22mbit ) + { + policy.tx_policy_22 = RETRIES; + } + if( tx_rates & core_tx_rate_18mbit ) + { + policy.tx_policy_18 = RETRIES; + } + if( tx_rates & core_tx_rate_12mbit ) + { + policy.tx_policy_12 = RETRIES; + } + if( tx_rates & core_tx_rate_11mbit ) + { + policy.tx_policy_11 = RETRIES; + } + if( tx_rates & core_tx_rate_9mbit ) + { + policy.tx_policy_9 = RETRIES; + } + if( tx_rates & core_tx_rate_6mbit ) + { + policy.tx_policy_6 = RETRIES; + } + if( tx_rates & core_tx_rate_5p5mbit ) + { + policy.tx_policy_5p5 = RETRIES; + } + if( tx_rates & core_tx_rate_2mbit ) + { + policy.tx_policy_2 = RETRIES; + } + if( tx_rates & core_tx_rate_1mbit ) + { + policy.tx_policy_1 = RETRIES; + } + + /** + * short_retry_limit, long_retry_limit, flags and initial_tx_rate + * will be filled later. + */ + + return policy; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::security_mode +// ----------------------------------------------------------------------------- +// +core_connection_security_mode_e core_tools_c::security_mode( + const core_iap_data_c& iap_data, + const core_ap_data_c& ap_data ) + { + // Check for open connection + // (open security map 1:1 with iap's security mode) + if( iap_data.security_mode() == core_security_mode_allow_unsecure ) + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_open" ); + return core_connection_security_mode_open; + } + + // Check for wep connection + if( iap_data.security_mode() == core_security_mode_wep ) + { + DEBUG( "core_tools_c::security_mode() - core_security_mode_wep" ); + if ( iap_data.authentication_mode() == core_authentication_mode_shared ) + { + return core_connection_security_mode_wep_shared; + } + return core_connection_security_mode_wep_open; + } + + // Check for WPX fast-roam + if( ( iap_data.security_mode() == core_security_mode_802dot1x ) && + ( ap_data.key_management_suites() & core_key_management_wpx_fast_roam ) ) + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_802d1x" ); + return core_connection_security_mode_802d1x; + } + + // Check for wpa/wpa2 + if( ap_data.key_management_suites() & core_key_management_eap ) + { + if( ap_data.is_rsn_ie_present() && + ap_data.group_cipher() == core_cipher_suite_ccmp && + ap_data.pairwise_ciphers() == core_cipher_suite_ccmp ) + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_wpa2" ); + return core_connection_security_mode_wpa2; + } + else + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_wpa" ); + return core_connection_security_mode_wpa; + } + } + + // Check for wpa_psk/wpa2_psk + if( ap_data.key_management_suites() & core_key_management_preshared ) + { + if( ap_data.is_rsn_ie_present() && + ap_data.group_cipher() == core_cipher_suite_ccmp && + ap_data.pairwise_ciphers() == core_cipher_suite_ccmp ) + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_wpa2_psk" ); + return core_connection_security_mode_wpa2_psk; + } + else + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_wpa_psk" ); + return core_connection_security_mode_wpa_psk; + } + } + + if( ap_data.key_management_suites() & core_key_management_wapi_certificate ) + { + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_wapi" ); + return core_connection_security_mode_wapi; + } + + if( ap_data.key_management_suites() & core_key_management_wapi_psk ) + { + DEBUG( "core_tools_c::security_mode() - core_key_management_wapi_psk" ); + return core_connection_security_mode_wapi_psk; + } + + // 802.1x is the only one left + DEBUG( "core_tools_c::security_mode() - core_connection_security_mode_802d1x" ); + return core_connection_security_mode_802d1x; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_eapol_error_to_protected_setup_status +// ----------------------------------------------------------------------------- +// +core_protected_setup_status_e core_tools_c::convert_eapol_error_to_protected_setup_status( + const wlan_eapol_if_eap_status_e error ) + { + core_protected_setup_status_e status( core_protected_setup_status_undefined ); + switch ( error ) + { + case wlan_eapol_if_eap_status_OOB_interface_read_error: + status = core_protected_setup_status_OOB_interface_read_error; + break; + case wlan_eapol_if_eap_status_decryption_CRC_failure: + status = core_protected_setup_status_decryption_CRC_failure; + break; + case wlan_eapol_if_eap_status_RF_band_2_4_ghz_not_supported: + status = core_protected_setup_status_RF_band_2_4_ghz_not_supported; + break; + case wlan_eapol_if_eap_status_RF_band_5_0_ghz_not_supported: + status = core_protected_setup_status_RF_band_5_0_ghz_not_supported; + break; + case wlan_eapol_if_eap_status_signal_too_weak: + status = core_protected_setup_status_signal_too_weak; + break; + case wlan_eapol_if_eap_status_authentication_failure: // Falls through on purpose. + case wlan_eapol_if_eap_status_network_authentication_failure: + status = core_protected_setup_status_network_auth_failure; + break; + case wlan_eapol_if_eap_status_network_association_failure: + status = core_protected_setup_status_network_assoc_failure; + break; + case wlan_eapol_if_eap_status_no_DHCP_response: + status = core_protected_setup_status_no_DHCP_response; + break; + case wlan_eapol_if_eap_status_failed_DHCP_configure: + status = core_protected_setup_status_failed_DHCP_configure; + break; + case wlan_eapol_if_eap_status_ip_address_conflict: + status = core_protected_setup_status_ip_address_conflict; + break; + case wlan_eapol_if_eap_status_could_not_connect_to_registrar: + status = core_protected_setup_status_could_not_connect_to_registrar; + break; + case wlan_eapol_if_eap_status_multiple_PBC_sessions_detected: + status = core_protected_setup_status_multiple_PBC_sessions_detected; + break; + case wlan_eapol_if_eap_status_rogue_activity_suspected: + status = core_protected_setup_status_rogue_activity_suspected; + break; + case wlan_eapol_if_eap_status_device_busy: + status = core_protected_setup_status_device_busy; + break; + case wlan_eapol_if_eap_status_setup_locked: + status = core_protected_setup_status_setup_locked; + break; + case wlan_eapol_if_eap_status_message_timeout: + status = core_protected_setup_status_message_timeout; + break; + case wlan_eapol_if_eap_status_registration_session_timeout: + status = core_protected_setup_status_registration_session_timeout; + break; + case wlan_eapol_if_eap_status_device_password_authentication_failure: + status = core_protected_setup_status_device_password_authentication_failure; + break; + case wlan_eapol_if_eap_status_pin_code_authentication_not_supported: + status = core_protected_setup_status_pin_code_authentication_not_supported; + break; + case wlan_eapol_if_eap_status_push_button_authentication_not_supported: + status = core_protected_setup_status_push_button_authentication_not_supported; + break; + default: + status = core_protected_setup_status_undefined; + break; + } + + return status; + } + +// ----------------------------------------------------------------------------- +// core_tools_c::convert_country_to_region +// ----------------------------------------------------------------------------- +// +core_wlan_region_e core_tools_c::convert_country_to_region( + const core_country_string_s& found_country ) + { + bool_t match( true_t ); + for ( u8_t i(0); i < country_info_table_length; i++ ) + { + match = true_t; + for ( u8_t j( 0 ); j < MAX_COUNTRY_STRING_LENGTH-1; ++j ) + { + if ( *( country_info_table[i].country+j ) != *( found_country.country+j ) ) + { + match = false_t; + break; + } + } + if( match ) + { + return core_wlan_region_fcc; + } + } + return core_wlan_region_etsi; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools_parser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_tools_parser.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,735 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Simple parser functions for core +* +*/ + +/* +* %version: 35 % +*/ + +#include "core_tools_parser.h" +#include "core_tools.h" +#include "core_frame_beacon.h" +#include "core_frame_dot11.h" +#include "core_frame_wmm_ie.h" +#include "core_frame_wmm_ie_tspec.h" +#include "core_frame_qbss_load_ie.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connect_status_e core_tools_parser_c::is_ap_compatible_with_iap( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_ap_data_c& ap_data, + core_iap_data_c& iap_data, + core_settings_c& core_settings, + bool_t is_cm_active, + bool_t ignore_channels ) + { + const core_mac_address_s mac = ap_data.bssid(); + + DEBUG6( "core_tools_parser_c::is_ap_compatible_with_iap() - BSSID %02X:%02X:%02X:%02X:%02X:%02X", + mac.addr[0], mac.addr[1], mac.addr[2], + mac.addr[3], mac.addr[4], mac.addr[5] ); + + if ( iap_data.operating_mode() == core_operating_mode_infrastructure && + !ap_data.is_infra() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - IAP is infrastructure, AP is IBSS" ); + return core_connect_mode_infra_required_but_ibss_found; + } + else if ( iap_data.operating_mode() == core_operating_mode_ibss && + ap_data.is_infra() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - IAP is IBSS, AP is infrastructure" ); + return core_connect_mode_ibss_required_but_infra_found; + } + + if ( !core_settings.is_permanent_whitelist_empty() || + !iap_data.is_iap_whitelist_empty() ) + { + if ( !core_settings.is_mac_in_permanent_whitelist(mac ) && + !iap_data.is_mac_in_iap_whitelist( mac ) ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - whitelist defined, not in list" ); + return core_connect_ap_not_whitelisted; + } + } + + if ( core_settings.is_mac_in_permanent_blacklist( mac ) || + iap_data.is_mac_in_iap_blacklist( mac ) ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - blacklisted" ); + return core_connect_ap_permanently_blacklisted; + } + + if ( !ignore_channels ) + { + if ( !core_settings.is_valid_channel( + ap_data.band(), ap_data.channel() ) ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - invalid channel" ); + return core_connect_ap_outside_defined_region; + } + } + + core_connect_status_e wpx_reason( core_connect_ok ); + + switch ( iap_data.security_mode() ) + { + case core_security_mode_allow_unsecure: + /** + * Check WPX requirements. + */ + if ( !wpx_adaptation.is_ap_wpx_compatible_with_iap( + wpx_reason, + ap_data, + iap_data ) ) + { + return wpx_reason; + } + + /** + * The only requirement in this mode is that the AP doesn't have privacy enabled. + */ + if ( ap_data.is_privacy_enabled() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - AP has privacy enabled" ); + return core_connect_iap_open_but_ap_requires_encryption; + } + + break; + case core_security_mode_wep: + /** + * Check WPX requirements. + */ + if ( !wpx_adaptation.is_ap_wpx_compatible_with_iap( + wpx_reason, + ap_data, + iap_data ) ) + { + return wpx_reason; + } + + /** + * Privacy has to be enabled. + */ + if ( !ap_data.is_privacy_enabled() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - AP doesn't have privacy enabled" ); + return core_connect_iap_wep_but_ap_has_no_privacy; + } + + /** + * If WPA IE or RSN IE is present, static WEP is not supported. + */ + if ( ap_data.is_wpa_ie_present() || + ap_data.is_rsn_ie_present() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - AP has WPA/RSN IE present" ); + return core_connect_iap_wep_but_ap_has_wpa_ie; + } + + break; + case core_security_mode_802dot1x: + /** + * Check WPX requirements. + */ + if ( !wpx_adaptation.is_ap_wpx_compatible_with_iap( + wpx_reason, + ap_data, + iap_data ) ) + { + return wpx_reason; + } + + /** + * If WPA IE or RSN IE is present, we must check that AP supports EAP or WPX fast-roam. + */ + if ( ap_data.is_wpa_ie_present() || + ap_data.is_rsn_ie_present() ) + { + u32_t key_management = ap_data.key_management_suites() & + ( core_key_management_eap | core_key_management_wpx_fast_roam ); + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no EAP as key management" ); + return core_connect_wpa_eap_required_but_ap_has_no_support; + } + } + + break; + case core_security_mode_wpa: + { + /** + * Check WPX requirements. + */ + if ( !wpx_adaptation.is_ap_wpx_compatible_with_iap( + wpx_reason, + ap_data, + iap_data ) ) + { + return wpx_reason; + } + + /** + * In this mode WPA IE or RSN IE must be present and we must have valid + * ciphers (TKIP or CCMP) and a valid key management suite (EAP or PSK). + * Privacy is required. + */ + if ( !ap_data.is_privacy_enabled() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - AP doesn't have privacy enabled" ); + return core_connect_iap_wpa_but_ap_has_no_privacy; + } + + if ( !ap_data.is_wpa_ie_present() && + !ap_data.is_rsn_ie_present() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no WPA IE or RSN IE present" ); + return core_connect_wpa_ie_required_but_ap_has_none; + } + + if ( iap_data.is_psk_used() ) + { + u32_t key_management = ap_data.key_management_suites() & + core_key_management_preshared; + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no PSK as key management" ); + return core_connect_wpa_psk_required_but_ap_has_no_support; + } + } + else + { + u32_t key_management = ap_data.key_management_suites() & + core_key_management_eap; + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no EAP as key management" ); + return core_connect_wpa_eap_required_but_ap_has_no_support; + } + } + + u32_t pairwise_ciphers = ap_data.pairwise_ciphers() & + ( core_cipher_suite_tkip | core_cipher_suite_ccmp ); + u32_t group_cipher = ap_data.group_cipher() & + ( core_cipher_suite_tkip | core_cipher_suite_ccmp ); + if ( !pairwise_ciphers || + !group_cipher ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no valid ciphers" ); + return core_connect_wpa_ap_has_no_valid_ciphers; + } + + if ( is_cm_active && + ( ap_data.best_pairwise_cipher() == core_cipher_suite_tkip || + ap_data.best_group_cipher() == core_cipher_suite_tkip ) ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - WPA counter measures active" ); + return core_connect_wpa_counter_measures_active; + } + + break; + } + case core_security_mode_wpa2only: + { + /** + * Check WPX requirements. + */ + if ( !wpx_adaptation.is_ap_wpx_compatible_with_iap( + wpx_reason, + ap_data, + iap_data ) ) + { + return wpx_reason; + } + + /** + * RSN IE, CCMP cipher and valid key management suite (EAP or PSK) are required in + * this mode. Privacy is required. + */ + if ( !ap_data.is_privacy_enabled() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - AP doesn't have privacy enabled" ); + return core_connect_iap_wpa_but_ap_has_no_privacy; + } + + if ( !ap_data.is_rsn_ie_present() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no RSN IE present" ); + return core_connect_wpa_ie_required_but_ap_has_none; + } + + if ( iap_data.is_psk_used() ) + { + u32_t key_management = ap_data.key_management_suites() & + core_key_management_preshared; + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no PSK as key management" ); + return core_connect_wpa_psk_required_but_ap_has_no_support; + } + } + else + { + u32_t key_management = ap_data.key_management_suites() & + core_key_management_eap; + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no EAP as key management" ); + return core_connect_wpa_eap_required_but_ap_has_no_support; + } + } + + u32_t pairwise_ciphers = ap_data.pairwise_ciphers() & + core_cipher_suite_ccmp; + u32_t group_cipher = ap_data.group_cipher() & + core_cipher_suite_ccmp; + if ( !pairwise_ciphers || + !group_cipher ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - CCMP not supported" ); + return core_connect_wpa_ap_has_no_valid_ciphers; + } + + break; + } + case core_security_mode_wapi: + { + /** + * Check WPX requirements. + */ + if ( !wpx_adaptation.is_ap_wpx_compatible_with_iap( + wpx_reason, + ap_data, + iap_data ) ) + { + return wpx_reason; + } + + /** + * In this mode WAPI IE must be present and we must have valid ciphers + * and a valid key management suite. Privacy is required. + */ + if ( !ap_data.is_privacy_enabled() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - AP doesn't have privacy enabled" ); + return core_connect_iap_wapi_but_ap_has_no_privacy; + } + + if ( !ap_data.is_wapi_ie_present() ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no WAPI IE present" ); + return core_connect_wapi_ie_required_but_ap_has_none; + } + + if ( iap_data.is_psk_used() ) + { + u32_t key_management = ap_data.key_management_suites() & + core_key_management_wapi_psk; + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no WAPI PSK as key management" ); + return core_connect_wapi_psk_required_but_ap_has_no_support; + } + } + else + { + u32_t key_management = ap_data.key_management_suites() & + core_key_management_wapi_certificate; + if ( !key_management ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no WAPI certificate as key management" ); + return core_connect_wapi_certificate_required_but_ap_has_no_support; + } + } + + u32_t pairwise_ciphers = ap_data.pairwise_ciphers() & + core_cipher_suite_wpi; + u32_t group_cipher = ap_data.group_cipher() & + core_cipher_suite_wpi; + if ( !pairwise_ciphers || + !group_cipher ) + { + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - no valid ciphers" ); + return core_connect_wapi_ap_has_no_valid_ciphers; + } + + break; + } + } + + DEBUG( "core_tools_parser_c::is_ap_compatible_with_iap() - OK" ); + return core_connect_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_connect_status_e core_tools_parser_c::is_ap_suitable( + abs_core_wpx_adaptation_c& wpx_adaptation, + core_ap_data_c& ap_data, + core_iap_data_c& iap_data, + core_settings_c& core_settings, + core_connection_data_c& connection_data, + u8_t min_rcpi, + const medium_time_s& min_medium_time, + bool_t is_cm_active, + const core_mac_address_s& current_bssid ) + { + const core_mac_address_s bssid( + ap_data.bssid() ); + + if ( current_bssid == bssid ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - currently connected to this AP" ); + return core_connect_unspecified_failure; + } + + if ( connection_data.is_mac_in_temporary_blacklist( bssid ) ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP is temporarily blacklisted" ); + return core_connect_ap_temporarily_blacklisted; + } + + core_connect_status_e ret = core_tools_parser_c::is_ap_compatible_with_iap( + wpx_adaptation, + ap_data, + iap_data, + core_settings, + is_cm_active ); + if ( ret != core_connect_ok ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - IAP doesn't match the AP" ); + return ret; + } + + if ( min_rcpi != RCPI_VALUE_NONE && + ap_data.rcpi() < min_rcpi ) + { + DEBUG2( "core_tools_parser_c::is_ap_suitable() - signal too weak (RCPI is %u, required RCPI is %u)", + ap_data.rcpi(), min_rcpi ); + return core_connect_ap_signal_too_weak; + } + + bool_t is_ac_required_for_voice = + connection_data.traffic_stream_list().is_traffic_stream_for_access_class( core_access_class_voice ); + bool_t is_ac_required_for_video = + connection_data.traffic_stream_list().is_traffic_stream_for_access_class( core_access_class_video ); + bool_t is_ac_required_for_best_effort = + connection_data.traffic_stream_list().is_traffic_stream_for_access_class( core_access_class_best_effort ); + bool_t is_ac_required_for_background = + connection_data.traffic_stream_list().is_traffic_stream_for_access_class( core_access_class_background ); + + if ( min_medium_time != MEDIUM_TIME_NOT_DEFINED ) + { + ASSERT( is_ac_required_for_voice || + is_ac_required_for_video || + is_ac_required_for_best_effort || + is_ac_required_for_background ); + + if ( !ap_data.is_wmm_ie_present() ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP doesn't have a WMM IE" ); + return core_connect_ap_has_no_admission_control; + } + + if ( is_ac_required_for_voice && + !ap_data.is_admission_control_required( core_access_class_voice ) ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP doesn't require admission control for Voice" ); + return core_connect_ap_has_no_admission_control; + } + + if ( is_ac_required_for_video && + !ap_data.is_admission_control_required( core_access_class_video ) ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP doesn't require admission control for Video" ); + return core_connect_ap_has_no_admission_control; + } + + if ( is_ac_required_for_best_effort && + !ap_data.is_admission_control_required( core_access_class_best_effort ) ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP doesn't require admission control for Background" ); + return core_connect_ap_has_no_admission_control; + } + + if ( is_ac_required_for_background && + !ap_data.is_admission_control_required( core_access_class_background ) ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP doesn't require admission control for BestEffort" ); + return core_connect_ap_has_no_admission_control; + } + + bool_t is_adm_capacity_found( false_t ); + medium_time_s admission_capacities( + ADMISSION_CAPACITIES_NOT_DEFINED ); + ap_data.admission_capacity( admission_capacities ); + + /** + * Check required medium time by user priority. + */ + for( u8_t idx( 0 ); idx < MAX_QOS_USER_PRIORITY; ++idx ) + { + if( min_medium_time.up[idx] ) + { + if( admission_capacities.up[idx] < min_medium_time.up[idx] ) + { + DEBUG3( "core_tools_parser_c::is_ap_suitable() - not enough admission capacity for UP %u: %u, required %u", + idx, admission_capacities.up[idx], min_medium_time.up[idx] ); + + return core_connect_ap_has_no_free_admission_capability; + } + else if( admission_capacities.up[idx] != ADMISSION_CAPACITY_NOT_DEFINED ) + { + DEBUG3( "core_tools_parser_c::is_ap_suitable() - admission capacity for UP %u: %u, required %u", + idx, admission_capacities.up[idx], min_medium_time.up[idx] ); + + is_adm_capacity_found = true_t; + } + else + { + DEBUG1( "core_tools_parser_c::is_ap_suitable() - no admission capacity advertised for UP %u", + idx ); + } + } + } + + /** + * Check required medium time by access class. + */ + u16_t total_min_medium_time( 0 ); + for( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) + { + if( min_medium_time.ac[idx] ) + { + total_min_medium_time += min_medium_time.ac[idx]; + + if( admission_capacities.ac[idx] < min_medium_time.ac[idx] ) + { + DEBUG3( "core_tools_parser_c::is_ap_suitable() - not enough admission capacity for AC %u: %u, required %u", + idx, admission_capacities.ac[idx], min_medium_time.ac[idx] ); + + return core_connect_ap_has_no_free_admission_capability; + } + else if( admission_capacities.ac[idx] != ADMISSION_CAPACITY_NOT_DEFINED ) + { + DEBUG3( "core_tools_parser_c::is_ap_suitable() - admission capacity for AC %u: %u, required %u", + idx, admission_capacities.ac[idx], min_medium_time.ac[idx] ); + + is_adm_capacity_found = true_t; + } + else + { + DEBUG1( "core_tools_parser_c::is_ap_suitable() - no admission capacity advertised for AC %u", + idx ); + } + } + } + + if( !is_adm_capacity_found ) + { + const core_frame_qbss_load_ie_c* qbss_load_ie = ap_data.qbss_load_ie(); + if ( qbss_load_ie && + qbss_load_ie->admission_capacity() < total_min_medium_time ) + { + is_adm_capacity_found = true_t; + + DEBUG2( "core_tools_parser_c::is_ap_suitable() - not enough admission capacity (%u, required %u)", + qbss_load_ie->admission_capacity(), total_min_medium_time ); + delete qbss_load_ie; + + return core_connect_ap_has_no_free_admission_capability; + } + + delete qbss_load_ie; + qbss_load_ie = NULL; + } + + /** + * If the AP doesn't advertise any admission capacity information, + * we'll assume there's enough capacity. + */ + if( !is_adm_capacity_found ) + { + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP doesn't advertise any admission capacity information" ); + } + } + + DEBUG( "core_tools_parser_c::is_ap_suitable() - AP is suitable" ); + return core_connect_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_ap_information_s core_tools_parser_c::get_ap_info( + const core_iap_data_c& iap_data, + core_ap_data_c& ap_data ) + { + core_ap_information_s info; + core_tools_c::fillz( + &info, + sizeof( info ) ); + + info.ssid = ap_data.ssid(); + info.bssid = ap_data.bssid(); + info.capabilities = ap_data.capabilities(); + info.channel = ap_data.channel(); + info.rcpi = ap_data.rcpi(); + info.security_mode = core_tools_c::security_mode( + iap_data, + ap_data ); + + /** + * Parse basic and supported rates to own bitmaps. + */ + info.basic_rates = 0; + info.supported_rates = 0; + for( core_frame_dot11_ie_c* ie = ap_data.frame()->first_ie(); ie; ie = ap_data.frame()->next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_supported_rates || + ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_extended_rates ) + { + u32_t temp_basic_rates( 0 ); + u32_t temp_supported_rates( 0 ); + + core_tools_parser_c::parse_rates( + ie->data() + CORE_FRAME_DOT11_IE_HEADER_LENGTH, + ie->length(), + temp_basic_rates, + temp_supported_rates ); + + info.basic_rates |= temp_basic_rates; + info.supported_rates |= temp_supported_rates; + } + + delete ie; + } + info.is_ac_required_for_voice = + ap_data.is_admission_control_required( core_access_class_voice ); + info.is_ac_required_for_video = + ap_data.is_admission_control_required( core_access_class_video ); + info.is_ac_required_for_best_effort = + ap_data.is_admission_control_required( core_access_class_best_effort ); + info.is_ac_required_for_background = + ap_data.is_admission_control_required( core_access_class_background ); + info.is_wpx = ap_data.is_wpx(); + + return info; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_tools_parser_c::get_wmm_traffic_stream_params( + core_frame_dot11_c& frame, + u8_t tid, + core_traffic_stream_params_s& tspec ) + { + for( core_frame_dot11_ie_c* ie = frame.first_ie(); ie; ie = frame.next_ie() ) + { + if ( ie->element_id() == core_frame_dot11_ie_c::core_frame_dot11_ie_element_id_wmm_tspec ) + { + core_frame_wmm_ie_tspec_c* tspec_ie = core_frame_wmm_ie_tspec_c::instance( *ie ); + if ( tspec_ie && + tspec_ie->tid() == tid ) + { + DEBUG1( "core_tools_parser_c::get_wmm_traffic_stream_params() - TSPEC with TID %u found", + tid ); + + tspec.is_periodic_traffic = tspec_ie->is_periodic_traffic(); + tspec.direction = tspec_ie->direction(); + tspec.nominal_msdu_size = tspec_ie->nominal_msdu_size(); + tspec.maximum_msdu_size = tspec_ie->maximum_msdu_size(); + tspec.minimum_service_interval = tspec_ie->minimum_service_interval(); + tspec.maximum_service_interval = tspec_ie->maximum_service_interval(); + tspec.inactivity_interval = tspec_ie->inactivity_interval(); + tspec.suspension_interval = tspec_ie->suspension_interval(); + tspec.service_start_time = tspec_ie->service_start_time(); + tspec.minimum_data_rate = tspec_ie->minimum_data_rate(); + tspec.mean_data_rate = tspec_ie->mean_data_rate(); + tspec.peak_data_rate = tspec_ie->peak_data_rate(); + tspec.maximum_burst_size = tspec_ie->maximum_burst_size(); + tspec.delay_bound = tspec_ie->delay_bound(); + tspec.minimum_phy_rate = tspec_ie->minimum_phy_rate(); + tspec.surplus_bandwidth_allowance = tspec_ie->surplus_bandwidth_allowance(); + tspec.medium_time = tspec_ie->medium_time(); + + delete tspec_ie; + tspec_ie = NULL; + + delete ie; + ie = NULL; + + return true_t; + } + + delete tspec_ie; + tspec_ie = NULL; + } + + delete ie; + ie = NULL; + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_tools_parser_c::parse_rates( + const u8_t* data, + u8_t data_length, + u32_t& basic_rates, + u32_t& supported_rates ) + { + DEBUG( "core_tools_parser_c::parse_rates()" ); + + basic_rates = 0; + supported_rates = 0; + + for( u8_t idx( 0 ); idx < data_length; ++idx ) + { + core_tx_rate_e rate( + core_tools_c::convert_tx_rate_to_tx_rate_enum( + data[idx] & ~TX_RATE_BASIC_MASK ) ); + + supported_rates |= rate; + + if ( data[idx] & TX_RATE_BASIC_MASK ) + { + /** + * The highest bit is enabled, the rate is both a basic rate + * and a supported rate. + */ + basic_rates |= rate; + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_tools_parser_c::core_tools_parser_c() + { + DEBUG( "core_tools_parser_c::core_tools_parser_c()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_traffic_stream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_traffic_stream.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,330 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing traffic stream parameters. +* +*/ + +/* +* %version: 7 % +*/ + +#include "core_traffic_stream.h" +#include "core_tools.h" +#include "am_debug.h" + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c::core_traffic_stream_c( + u8_t tid, + u8_t user_priority ) : + tid_m( tid ), + user_priority_m( user_priority ), + status_m( core_traffic_stream_status_undefined ), + reference_count_m( 1 ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c::~core_traffic_stream_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_traffic_stream_c::tid() const + { + return tid_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_traffic_stream_c::user_priority() const + { + return user_priority_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_access_class_e core_traffic_stream_c::access_class() const + { + return core_tools_c::convert_user_priority_to_ac( user_priority_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::set_default_traffic_values( + const core_traffic_stream_params_s& params ) + { + default_params_m = params; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::set_traffic_values( + const core_traffic_stream_params_s& params ) + { + previous_params_m = params_m; + params_m = params; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::reset_to_default_values() + { + previous_params_m = params_m; + params_m = default_params_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::reset_to_previous_values() + { + params_m = previous_params_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_status_e core_traffic_stream_c::status() const + { + return status_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::set_status( + core_traffic_stream_status_e status ) + { + status_m = status; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_traffic_stream_c::reference_count() + { + return reference_count_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::inc_reference_count() + { + ++reference_count_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_c::dec_reference_count() + { + ASSERT( reference_count_m ); + --reference_count_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_traffic_stream_c::is_periodic_traffic() const + { + return params_m.is_periodic_traffic; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_direction_e core_traffic_stream_c::direction() const + { + return params_m.direction; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_traffic_stream_c::nominal_msdu_size() const + { + return params_m.nominal_msdu_size; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_traffic_stream_c::maximum_msdu_size() const + { + return params_m.maximum_msdu_size; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::minimum_service_interval() const + { + return params_m.minimum_service_interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::maximum_service_interval() const + { + return params_m.maximum_service_interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::inactivity_interval() const + { + return params_m.inactivity_interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::suspension_interval() const + { + return params_m.suspension_interval; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::service_start_time() const + { + return params_m.service_start_time; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::minimum_data_rate() const + { + return params_m.minimum_data_rate; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::mean_data_rate() const + { + return params_m.mean_data_rate; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::peak_data_rate() const + { + return params_m.peak_data_rate; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::maximum_burst_size() const + { + return params_m.maximum_burst_size; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::delay_bound() const + { + return params_m.delay_bound; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::minimum_phy_rate() const + { + return params_m.minimum_phy_rate; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_traffic_stream_c::surplus_bandwidth_allowance() const + { + return params_m.surplus_bandwidth_allowance; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_traffic_stream_c::medium_time() const + { + return params_m.medium_time; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_tx_rate_e core_traffic_stream_c::nominal_phy_rate() const + { + return params_m.nominal_phy_rate; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::override_rates() const + { + return params_m.override_rates; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_c::max_tx_msdu_lifetime() const + { + return params_m.override_max_tx_msdu_lifetime; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c& core_traffic_stream_c::operator=( + const core_traffic_stream_c& src ) + { + // Check first assignment to itself + if( &src == this) + { + DEBUG( "core_traffic_stream_c::operator=() - assignment to this" ); + return *this; + } + + tid_m = src.tid_m; + user_priority_m = src.user_priority_m; + default_params_m = src.default_params_m; + params_m = src.params_m; + previous_params_m = src.previous_params_m; + status_m = src.status_m; + reference_count_m = src.reference_count_m; + + return *this; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_traffic_stream_list.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_traffic_stream_list.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of core_traffic_stream_list_c class. +* +*/ + +/* +* %version: 10 % +*/ + +#include "core_traffic_stream_list.h" +#include "core_tools.h" +#include "core_am_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_list_c::core_traffic_stream_list_c() : + ts_list_m( ) + { + DEBUG( "core_traffic_stream_list_c::core_traffic_stream_list_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_list_c::~core_traffic_stream_list_c() + { + DEBUG( "core_traffic_stream_list_c::~core_traffic_stream_list_c()" ); + + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + delete iter->traffic_stream; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_traffic_stream_list_c::count() const + { + return ts_list_m.count(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c* core_traffic_stream_list_c::first() + { + entry_s* iter = ts_list_m.first(); + if ( iter ) + { + return iter->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c* core_traffic_stream_list_c::next() + { + entry_s* iter = ts_list_m.next(); + if ( iter ) + { + return iter->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c* core_traffic_stream_list_c::current() const + { + entry_s* iter = ts_list_m.current(); + if ( iter ) + { + return iter->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_traffic_stream_list_c::update_traffic_stream( + const core_traffic_stream_c& traffic_stream ) + { + DEBUG1( "core_traffic_stream_list_c::update_traffic_stream() - searching an entry with TID %u", + traffic_stream.tid() ); + + entry_s* iter = ts_list_m.first(); + while( iter ) + { + if ( iter->traffic_stream->tid() == traffic_stream.tid() ) + { + DEBUG( "core_traffic_stream_list_c::update_traffic_stream() - entry with matching TID found, replacing entry" ); + *iter->traffic_stream = traffic_stream; + + return core_error_ok; + } + + iter = ts_list_m.next(); + } + + DEBUG( "core_traffic_stream_list_c::update_traffic_stream() - no entry matching the TID found, adding a new entry" ); + + entry_s* entry = new entry_s; + if ( entry ) + { + entry->traffic_stream = new core_traffic_stream_c( + traffic_stream.tid(), + traffic_stream.user_priority() ); + if ( entry->traffic_stream ) + { + *entry->traffic_stream = traffic_stream; + + ts_list_m.append( entry ); + } + else + { + DEBUG( "core_traffic_stream_list_c::update_traffic_stream() - unable to create core_traffic_stream_c" ); + delete entry; + + return core_error_no_memory; + } + } + else + { + DEBUG( "core_traffic_stream_list_c::update_traffic_stream() - unable to create entry_s" ); + + return core_error_no_memory; + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_list_c::remove_traffic_stream_by_tid( + u8_t tid ) + { + DEBUG1( "core_traffic_stream_list_c::remove_traffic_stream_by_tid() - removing an entry with TID %u", tid ); + + entry_s* iter = ts_list_m.first(); + while( iter ) + { + if ( iter->traffic_stream->tid() == tid ) + { + DEBUG( "core_traffic_stream_list_c::remove_traffic_stream_by_tid() - matching entry found" ); + + ts_list_m.remove( iter ); + iter = NULL; + } + else + { + iter = ts_list_m.next(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_list_c::print_contents() + { + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + DEBUG1( "core_traffic_stream_list_c::print_contents() - TID: %u", + iter->traffic_stream->tid() ); + DEBUG1( "core_traffic_stream_list_c::print_contents() - UP: %u", + iter->traffic_stream->user_priority() ); + switch( iter->traffic_stream->direction() ) + { + case core_traffic_stream_direction_uplink: + DEBUG( "core_traffic_stream_list_c::print_contents() - direction: uplink" ); + break; + case core_traffic_stream_direction_downlink: + DEBUG( "core_traffic_stream_list_c::print_contents() - direction: downlink" ); + break; + case core_traffic_stream_direction_bidirectional: + DEBUG( "core_traffic_stream_list_c::print_contents() - direction: bi-directional" ); + break; + } + switch ( iter->traffic_stream->status() ) + { + case core_traffic_stream_status_undefined: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_undefined" ); + break; + case core_traffic_stream_status_active: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_active" ); + break; + case core_traffic_stream_status_inactive_not_required: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_not_required" ); + break; + case core_traffic_stream_status_inactive_deleted_by_ap: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_deleted_by_ap" ); + break; + case core_traffic_stream_status_inactive_no_bandwidth: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_no_bandwidth" ); + break; + case core_traffic_stream_status_inactive_invalid_parameters: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_invalid_parameters" ); + break; + case core_traffic_stream_status_inactive_other: + DEBUG( "core_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_other" ); + break; + } + DEBUG( "core_traffic_stream_list_c::print_contents()" ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +medium_time_s core_traffic_stream_list_c::admitted_medium_time() + { + medium_time_s medium_time( MEDIUM_TIME_NOT_DEFINED ); + + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + u16_t ts_medium_time( + iter->traffic_stream->medium_time() ); + if( iter->traffic_stream->direction() == core_traffic_stream_direction_bidirectional ) + { + /** + * The admitted medium time of a bi-directional stream has to be + * multiplied by two because it contains both an uplink and + * a downlink component. + */ + ts_medium_time *= 2; + } + + medium_time.up[iter->traffic_stream->user_priority()] += ts_medium_time; + medium_time.ac[iter->traffic_stream->access_class()] += ts_medium_time; + } + + return medium_time; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_traffic_stream_list_c::is_traffic_stream_for_access_class( + core_access_class_e access_class ) + { + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + if ( core_tools_c::convert_user_priority_to_ac( iter->traffic_stream->user_priority() ) == + access_class ) + { + return true_t; + } + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_traffic_stream_list_c::is_traffic_stream_for_tid( + u8_t tid ) + { + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + if( iter->traffic_stream->tid() == tid ) + { + return true_t; + } + } + + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_traffic_stream_list_c::set_traffic_stream_status( + core_traffic_stream_status_e status ) + { + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + iter->traffic_stream->set_status( status ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_traffic_stream_list_c::next_tid() + { + bool_t tid_array[MAX_TRAFFIC_STREAM_TID] = + { false_t, false_t, false_t, false_t, false_t,false_t,false_t,false_t }; + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + tid_array[iter->traffic_stream->tid()] = true_t; + } + u8_t tid( 0 ); + while( tid < MAX_TRAFFIC_STREAM_TID ) + { + if( !tid_array[tid] ) + { + return tid; + } + else + { + ++tid; + } + } + + return MAX_TRAFFIC_STREAM_TID; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_traffic_stream_list_iter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_traffic_stream_list_iter.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Iterator for traffic stream list. +* +*/ + +/* +* %version: % +*/ + +#include "core_traffic_stream_list_iter.h" + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_list_iter_c::core_traffic_stream_list_iter_c( + core_traffic_stream_list_c& list ) : + iter_m( list.ts_list_m ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_list_iter_c::~core_traffic_stream_list_iter_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c* core_traffic_stream_list_iter_c::first() + { + core_traffic_stream_list_c::entry_s* entry = iter_m.first(); + if ( entry ) + { + return entry->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c* core_traffic_stream_list_iter_c::next() + { + core_traffic_stream_list_c::entry_s* entry = iter_m.next(); + if ( entry ) + { + return entry->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_c* core_traffic_stream_list_iter_c::current() const + { + core_traffic_stream_list_c::entry_s* entry = iter_m.current(); + if ( entry ) + { + return entry->traffic_stream; + } + + return NULL; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_traffic_stream_list_iter_c::remove() + { + return iter_m.remove(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_virtual_traffic_stream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_virtual_traffic_stream.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing traffic stream parameters. +* +*/ + +/* +* %version: 1 % +*/ + +#include "core_virtual_traffic_stream.h" +#include "core_tools.h" +#include "am_debug.h" + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_c::core_virtual_traffic_stream_c( + u8_t requested_tid, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t stream_id, + core_traffic_stream_status_e stream_status ) : + requested_tid_m( requested_tid ), + tid_m( tid ), + user_priority_m( user_priority ), + is_automatic_stream_m( is_automatic_stream ), + params_m( params ), + id_m( stream_id ), + status_m( stream_status ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_c::~core_virtual_traffic_stream_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_virtual_traffic_stream_c::id() const + { + return id_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_virtual_traffic_stream_c::requested_tid() const + { + return requested_tid_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_virtual_traffic_stream_c::tid() const + { + return tid_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_virtual_traffic_stream_c::set_tid( + u8_t tid ) + { + tid_m = tid; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_virtual_traffic_stream_c::user_priority() const + { + return user_priority_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_access_class_e core_virtual_traffic_stream_c::access_class() const + { + return core_tools_c::convert_user_priority_to_ac( user_priority_m ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_virtual_traffic_stream_c::is_automatic_stream() const + { + return is_automatic_stream_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const core_traffic_stream_params_s& core_virtual_traffic_stream_c::params() const + { + return params_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_status_e core_virtual_traffic_stream_c::status() const + { + return status_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_virtual_traffic_stream_c::set_status( + core_traffic_stream_status_e status ) + { + status_m = status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_virtual_traffic_stream_list.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_virtual_traffic_stream_list.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,314 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for storing virtual traffic streams. +* +*/ + +/* +* %version: 1 % +*/ + +#include "core_virtual_traffic_stream_list.h" +#include "core_tools.h" +#include "core_am_tools.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_list_c::core_virtual_traffic_stream_list_c() : + ts_list_m( ), + next_stream_id_m( 0 ) + { + DEBUG( "core_virtual_traffic_stream_list_c::core_virtual_traffic_stream_list_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_list_c::~core_virtual_traffic_stream_list_c() + { + DEBUG( "core_virtual_traffic_stream_list_c::~core_virtual_traffic_stream_list_c()" ); + + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + delete iter->traffic_stream; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t core_virtual_traffic_stream_list_c::count() const + { + return ts_list_m.count(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_virtual_traffic_stream_list_c::add_traffic_stream( + const core_virtual_traffic_stream_c& stream ) + { + entry_s* entry = new entry_s; + if( entry ) + { + entry->traffic_stream = new core_virtual_traffic_stream_c( + stream.requested_tid(), + stream.tid(), + stream.user_priority(), + stream.is_automatic_stream(), + stream.params(), + stream.id(), + stream.status() ); + if( entry->traffic_stream ) + { + ts_list_m.append( entry ); + } + else + { + DEBUG( "core_virtual_traffic_stream_list_c::add_traffic_stream() - unable to create core_virtual_traffic_stream_c" ); + + delete entry; + entry = NULL; + + return core_error_no_memory; + } + } + else + { + DEBUG( "core_virtual_traffic_stream_list_c::update_traffic_stream() - unable to create entry_s" ); + + return core_error_no_memory; + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_virtual_traffic_stream_list_c::add_traffic_stream( + u8_t requested_tid, + u8_t tid, + u8_t user_priority, + bool_t is_automatic_stream, + const core_traffic_stream_params_s& params, + u32_t& stream_id, + core_traffic_stream_status_e stream_status ) + { + entry_s* entry = new entry_s; + if( entry ) + { + stream_id = next_stream_id_m++; + entry->traffic_stream = new core_virtual_traffic_stream_c( + requested_tid, + tid, + user_priority, + is_automatic_stream, + params, + stream_id, + stream_status ); + if( entry->traffic_stream ) + { + ts_list_m.append( entry ); + } + else + { + DEBUG( "core_virtual_traffic_stream_list_c::add_traffic_stream() - unable to create core_virtual_traffic_stream_c" ); + + delete entry; + entry = NULL; + + return core_error_no_memory; + } + } + else + { + DEBUG( "core_virtual_traffic_stream_list_c::update_traffic_stream() - unable to create entry_s" ); + + return core_error_no_memory; + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_virtual_traffic_stream_list_c::remove_traffic_stream_by_tid( + u8_t tid ) + { + DEBUG1( "core_virtual_traffic_stream_list_c::remove_traffic_stream_by_tid() - removing an entry with TID %u", + tid ); + + core_type_list_iterator_c ts_iter( ts_list_m ); + for( entry_s* iter = ts_iter.first(); iter; iter = ts_iter.next() ) + { + if( iter->traffic_stream->tid() == tid ) + { + DEBUG( "core_virtual_traffic_stream_list_c::remove_traffic_stream_by_tid() - matching entry found" ); + + ts_iter.remove(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_virtual_traffic_stream_list_c::remove_traffic_stream_by_id( + u32_t stream_id ) + { + DEBUG1( "core_virtual_traffic_stream_list_c::remove_traffic_stream_by_tid() - removing an entry with stream ID %u", + stream_id ); + + core_type_list_iterator_c ts_iter( ts_list_m ); + for( entry_s* iter = ts_iter.first(); iter; iter = ts_iter.next() ) + { + if( iter->traffic_stream->id() == stream_id ) + { + DEBUG( "core_virtual_traffic_stream_list_c::remove_traffic_stream_by_tid() - matching entry found" ); + + ts_iter.remove(); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_access_class_traffic_mode_e core_virtual_traffic_stream_list_c::traffic_mode_by_ac( + core_access_class_e access_class ) + { + core_type_list_iterator_c ts_iter( ts_list_m ); + for( entry_s* iter = ts_iter.first(); iter; iter = ts_iter.next() ) + { + if( iter->traffic_stream->access_class() == access_class && + !iter->traffic_stream->is_automatic_stream() ) + { + return core_access_class_traffic_mode_manual; + } + } + + return core_access_class_traffic_mode_automatic; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_virtual_traffic_stream_list_c::print_contents() + { + core_type_list_iterator_c ts_iter( ts_list_m ); + for( entry_s* iter = ts_iter.first(); iter; iter = ts_iter.next() ) + { + DEBUG1( "core_virtual_traffic_stream_list_c::print_contents() - stream ID: %u", + iter->traffic_stream->id() ); + DEBUG1( "core_virtual_traffic_stream_list_c::print_contents() - requested TID: %u", + iter->traffic_stream->requested_tid() ); + DEBUG1( "core_virtual_traffic_stream_list_c::print_contents() - current TID: %u", + iter->traffic_stream->tid() ); + DEBUG1( "core_virtual_traffic_stream_list_c::print_contents() - UP: %u", + iter->traffic_stream->user_priority() ); + if( iter->traffic_stream->is_automatic_stream() ) + { + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - automatic: yes" ); + } + else + { + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - automatic: no" ); + } + switch( iter->traffic_stream->params().direction ) + { + case core_traffic_stream_direction_uplink: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - direction: uplink" ); + break; + case core_traffic_stream_direction_downlink: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - direction: downlink" ); + break; + case core_traffic_stream_direction_bidirectional: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - direction: bi-directional" ); + break; + } + switch ( iter->traffic_stream->status() ) + { + case core_traffic_stream_status_undefined: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_undefined" ); + break; + case core_traffic_stream_status_active: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_active" ); + break; + case core_traffic_stream_status_inactive_not_required: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_not_required" ); + break; + case core_traffic_stream_status_inactive_deleted_by_ap: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_deleted_by_ap" ); + break; + case core_traffic_stream_status_inactive_no_bandwidth: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_no_bandwidth" ); + break; + case core_traffic_stream_status_inactive_invalid_parameters: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_invalid_parameters" ); + break; + case core_traffic_stream_status_inactive_other: + DEBUG( "core_virtual_traffic_stream_list_c::print_contents() - status: core_traffic_stream_status_inactive_other" ); + break; + } + DEBUG( "core_virtual_traffic_stream_list_c::print_contents()" ); + } + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_virtual_traffic_stream_list_c::next_tid() + { + bool_t tid_array[MAX_TRAFFIC_STREAM_TID] = + { false_t, false_t, false_t, false_t, false_t,false_t,false_t,false_t }; + for( entry_s* iter = ts_list_m.first(); iter; iter = ts_list_m.next() ) + { + if( iter->traffic_stream->requested_tid() != TRAFFIC_STREAM_TID_NONE ) + { + /** + * Both active and inactive streams that were requested + * with a certain TID. + */ + tid_array[iter->traffic_stream->requested_tid()] = true_t; + } + else if( iter->traffic_stream->tid() != TRAFFIC_STREAM_TID_NONE ) + { + /** + * Active streams. + */ + tid_array[iter->traffic_stream->tid()] = true_t; + } + } + u8_t tid( 0 ); + while( tid < MAX_TRAFFIC_STREAM_TID ) + { + if( !tid_array[tid] ) + { + return tid; + } + else + { + ++tid; + } + } + + return MAX_TRAFFIC_STREAM_TID; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_virtual_traffic_stream_list_iter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_virtual_traffic_stream_list_iter.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Iterator for a virtual traffic stream list. +* +*/ + +/* +* %version: 1 % +*/ + +#include "core_virtual_traffic_stream_list_iter.h" + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_list_iter_c::core_virtual_traffic_stream_list_iter_c( + core_virtual_traffic_stream_list_c& list ) : + iter_m( list.ts_list_m ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_list_iter_c::~core_virtual_traffic_stream_list_iter_c() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_c* core_virtual_traffic_stream_list_iter_c::first() + { + core_virtual_traffic_stream_list_c::entry_s* entry = iter_m.first(); + if( entry ) + { + return entry->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_c* core_virtual_traffic_stream_list_iter_c::next() + { + core_virtual_traffic_stream_list_c::entry_s* entry = iter_m.next(); + if( entry ) + { + return entry->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_virtual_traffic_stream_c* core_virtual_traffic_stream_list_iter_c::current() const + { + core_virtual_traffic_stream_list_c::entry_s* entry = iter_m.current(); + if( entry ) + { + return entry->traffic_stream; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_virtual_traffic_stream_list_iter_c::remove() + { + return iter_m.remove(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wlan_eapol_if_message.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wlan_eapol_if_message.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,4062 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for WLAN EAPOL Plugin interface. +* +*/ + +/* +* %version: 13 % +*/ + +#include "core_wlan_eapol_if_message.h" +#include "core_types.h" +#include "core_tools.h" + + +/** + * Constructor + */ +core_wlan_eapol_if_parameter_c::core_wlan_eapol_if_parameter_c() + : data_m( NULL ) + , buffer_length_m( 0 ) + , delete_buffer_m( false_t) + { + } + +/** + * Constructor + * + * @param data Pointer to the TLV encoded data. + * @param data_length Length of the TLV encoded data. + */ +core_wlan_eapol_if_parameter_c::core_wlan_eapol_if_parameter_c( + u8_t *data, u32_t data_length ) + : data_m( data ) + , buffer_length_m( data_length ) + , delete_buffer_m( false_t ) + { + } + + +/** + * Destructor. + */ +core_wlan_eapol_if_parameter_c::~core_wlan_eapol_if_parameter_c() + { + if ( delete_buffer_m ) + { + core_tools_c::fillz( data_m, buffer_length_m ); + delete[] data_m; + data_m = NULL; + } + } + + + +/** + * Update content of parameter + */ +void core_wlan_eapol_if_parameter_c::update( + u8_t *data, u32_t data_length ) + { + data_m = data; + buffer_length_m = data_length; + delete_buffer_m = false_t; + } + +// ============================================================================ +// General methods to handle parameters + +u32_t core_wlan_eapol_if_parameter_c::size() const + { + return WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + get_parameter_length(); + } + +wlan_eapol_if_message_type_e core_wlan_eapol_if_parameter_c::get_parameter_type() const + { + return static_cast( core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_TYPE_OFFSET )); + } + +u32_t core_wlan_eapol_if_parameter_c::get_parameter_length() const + { + return core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_LENGTH_OFFSET ); + } + +u8_t* core_wlan_eapol_if_parameter_c::get_data() const + { + return &data_m[0]; + } + + + + + +// ============================================================================ +// Parameter specific methods + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data( + wlan_eapol_if_message_type_e type, + u32_t value ) + { + DEBUG2( "core_wlan_eapol_if_parameter_c::set_parameter_data(type=%i, u32_t value=%i)", type, value ); + + if ( type == wlan_eapol_if_message_type_u8_t ) + { + return set_parameter_data_u8_t( type, value ); + } + else if ( type == wlan_eapol_if_message_type_u16_t ) + { + return set_parameter_data_u16_t( type, value ); + } + else if ( type == wlan_eapol_if_message_type_boolean ) + { + return set_parameter_data_boolean( type, value ); + } + + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( value ) ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( type, sizeof( value ) ); + add_parameter_u32_t( value ); + return core_error_ok; + } + + + + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data( + wlan_eapol_if_message_type_e type, + const u8_t* data, + u32_t length ) + { + DEBUG3( "core_wlan_eapol_if_parameter_c::set_parameter_data(type=%i, data=%08X, length=%i)", type, data, length ); + + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + length ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( type, length ); + + if ( data == NULL || length == 0 ) + { + // Variable data and Array could be empty. In that case data is NULL. + if ( type != wlan_eapol_if_message_type_array && + type != wlan_eapol_if_message_type_variable_data ) + { + DEBUG( "core_wlan_eapol_if_parameter_c::set_parameter_data() - Illegal arguments" ); + ASSERT( false_t ); + return core_error_illegal_argument; + } + return core_error_ok; + } + else + { + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET], + data, + length ); + } + return core_error_ok; + } + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data( + wlan_eapol_if_message_type_e type, + u32_t vendor_id, + u32_t vendor_type ) + { + DEBUG3( "core_wlan_eapol_if_parameter_c::set_parameter_data(type=%i, vendor_id=%06X, vendor_type=%08X)", type, vendor_id, vendor_type ); + if ( type != wlan_eapol_if_message_type_eap_type ) + { + return core_error_illegal_argument; + } + + u32_t length( 8 ); // Size of EAP type. + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + length ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( type, length ); + + const u32_t eap_type = 254; // This is constant in Extended EAP type. + vendor_id = (vendor_id & 0x00FFFFFF) ^ (eap_type<<24); + vendor_id = core_tools_c::convert_host_to_big_endian( vendor_id ); + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET], + &vendor_id, + sizeof( vendor_id ) ); + + vendor_type = core_tools_c::convert_host_to_big_endian( vendor_type ); + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( vendor_id )], + &vendor_type, + sizeof( vendor_type ) ); + + return core_error_ok; + } + + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data_boolean( + wlan_eapol_if_message_type_e type, + bool_t boolean ) + { + DEBUG2( "core_wlan_eapol_if_parameter_c::set_parameter_data_boolean(type=%i, bool_t value=%i)", type, boolean ); + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( boolean ) ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( type, sizeof( boolean ) ); + add_parameter_u32_t( boolean ); + return core_error_ok; + } + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data_u16_t( + wlan_eapol_if_message_type_e type, + u16_t value ) + { + DEBUG2( "core_wlan_eapol_if_parameter_c::set_parameter_data_u16_t(type=%i, u16_t value=%i)", type, value ); + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( value ) ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( type, sizeof( value ) ); + add_parameter_u16_t( value ); + return core_error_ok; + } + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data_u8_t( + wlan_eapol_if_message_type_e type, + u8_t value ) + { + DEBUG2( "core_wlan_eapol_if_parameter_c::set_parameter_data_u8_t(type=%i, u8_t value=%i)", type, value ); + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( value ) ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( type, sizeof( value ) ); + add_parameter_u8_t( value ); + return core_error_ok; + } + + +core_error_e core_wlan_eapol_if_parameter_c::set_parameter_data_u64_t( + u64_t data ) + { + DEBUG( "core_wlan_eapol_if_parameter_c::set_parameter_data_u64_t()" ); + + core_error_e error = reserve_buffer( WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( data ) ); + if ( error != core_error_ok ) + { + return error; + } + + add_header( wlan_eapol_if_message_type_u64_t, sizeof( data ) ); + + u64_t parameter_data = + static_cast( ((data & 0xFF) << 56) + | ((data & 0xFF00) << 40) + | ((data & 0xFF0000) << 24) + | ((data & 0xFF000000) << 8) + | (((data >> 32) & 0xFF) << 24) + | (((data >> 32) & 0xFF00) << 8) + | (((data >> 32) & 0xFF0000) >> 8) + | (((data >> 32) & 0xFF000000) >> 24) ); + + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET], + ¶meter_data, + sizeof( parameter_data ) ); + COMPILE_ASSERT( sizeof( parameter_data ) == 8 ); // Specification says this. + return core_error_ok; + } + + +// ============================================================================ + +// All 32 bit values +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + u32_t * value ) const + { + ASSERT( value ); + wlan_eapol_if_message_type_e type = get_parameter_type(); + if ( type == wlan_eapol_if_message_type_u32_t + || type == wlan_eapol_if_message_type_function + || type == wlan_eapol_if_message_type_eap_protocol_layer + || type == wlan_eapol_if_message_type_eap_status + || type == wlan_eapol_if_message_type_eapol_key_802_11_authentication_mode + || type == wlan_eapol_if_message_type_eapol_key_authentication_type + || type == wlan_eapol_if_message_type_eapol_key_type + || type == wlan_eapol_if_message_type_eapol_tkip_mic_failure_type + || type == wlan_eapol_if_message_type_eapol_wlan_authentication_state + || type == wlan_eapol_if_message_type_error + || type == wlan_eapol_if_message_type_RSNA_cipher ) + { + *value = get_parameter_u32_t(); + return core_error_ok; + } + *value = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( u32_t ) - Error: parameter not found" ); + return core_error_not_found; + } + +// +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + u64_t * value ) const + { + ASSERT( value ); + if ( get_parameter_type() == wlan_eapol_if_message_type_u64_t ) + { + *value = get_parameter_u64_t(); + return core_error_ok; + } + *value = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( u64_t ) - Error: parameter not found" ); + return core_error_not_found; + } + +// +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + bool_t * value ) const + { + ASSERT( value ); + if ( get_parameter_type() == wlan_eapol_if_message_type_boolean ) + { + *value = get_parameter_u32_t(); + return core_error_ok; + } + *value = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( bool_t ) - Error: parameter not found" ); + return core_error_not_found; + } + +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + u16_t * value ) const + { + ASSERT( value ); + if ( get_parameter_type() == wlan_eapol_if_message_type_u16_t ) + { + *value = get_parameter_u16_t(); + return core_error_ok; + } + *value = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( u16_t ) - Error: parameter not found" ); + return core_error_not_found; + } + +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + u8_t * value ) const + { + ASSERT( value ); + if ( get_parameter_type() == wlan_eapol_if_message_type_u8_t ) + { + *value = get_parameter_u8_t(); + return core_error_ok; + } + *value = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( u8_t ) - Error: parameter not found" ); + return core_error_not_found; + } + +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + u8_t ** const data, + u32_t * data_length ) const + { + ASSERT( data ); + ASSERT( data_length ); + // All structured parameters must be mentioned here. + if ( get_parameter_type() == wlan_eapol_if_message_type_variable_data + || get_parameter_type() == wlan_eapol_if_message_type_network_id + || get_parameter_type() == wlan_eapol_if_message_type_session_key + || get_parameter_type() == wlan_eapol_if_message_type_network_key + || get_parameter_type() == wlan_eapol_if_message_type_protected_setup_credential + || get_parameter_type() == wlan_eapol_if_message_type_eap_state_notification + || get_parameter_type() == wlan_eapol_if_message_type_array ) + { + *data = &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET]; + *data_length = get_parameter_length(); + // If data length is zero, it is good to set also data pointer to NULL. + if ( *data_length == 0 ) + { + *data = NULL; + } + return core_error_ok; + } + *data = NULL; + *data_length = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( non-basic types ) - Error: parameter not found" ); + return core_error_not_found; + } + + +core_error_e core_wlan_eapol_if_parameter_c::get_parameter_data( + u32_t * vendor_id, + u32_t * vendor_type ) const + { + ASSERT( vendor_id ); + ASSERT( vendor_type ); + wlan_eapol_if_message_type_e type = get_parameter_type(); + if ( type == wlan_eapol_if_message_type_eap_type ) + { + *vendor_id = core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET ); + + if( ( *vendor_id >> 24 ) == 254 ) + { + *vendor_id &= 0x00FFFFFF; // Mask EAP-type constant (254) out + + *vendor_type = core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET + sizeof( vendor_id ) ); + } + else // Not expanded EAP type, in this case EAP type is first byte of vendor_id + { + *vendor_type = ( *vendor_id >> 24 ); + *vendor_id = 0; + } + + return core_error_ok; + } + *vendor_id = 0; + *vendor_type = 0; + DEBUG( "core_wlan_eapol_if_parameter_c::get_parameter_data( vendor_id, vendor_type ) - Error: parameter not found" ); + return core_error_not_found; + } + + + +// ============================================================================ + + +core_error_e core_wlan_eapol_if_parameter_c::reserve_buffer( + u32_t needed_buffer_length ) + { + if ( needed_buffer_length <= buffer_length_m ) + { + return core_error_ok; + } + + DEBUG2( "core_wlan_eapol_if_parameter_c::reserve_buffer - increase buffer %i->%i bytes", buffer_length_m, needed_buffer_length ); + u8_t* p = new u8_t[needed_buffer_length]; + if ( !p ) + { + DEBUG( "core_wlan_eapol_if_parameter_c::reserve_buffer - Error: No enough memory!" ); + return core_error_no_memory; + } + core_tools_c::fillz( p, needed_buffer_length ); + core_tools_c::copy( + p, + &data_m[0], + buffer_length_m ); + core_tools_c::fillz( &data_m[0], buffer_length_m ); + + if ( delete_buffer_m ) + { + delete[] data_m; + } + delete_buffer_m = true_t; + data_m = p; + buffer_length_m = needed_buffer_length; + + return core_error_ok; + } + + +void core_wlan_eapol_if_parameter_c::add_header( + wlan_eapol_if_message_type_e type, + u32_t length ) + { + // Type + u32_t type_value( type ); + type_value = core_tools_c::convert_host_to_big_endian( type_value ); + core_tools_c::copy( + &data_m[0], + &type_value, + sizeof( type_value ) ); + COMPILE_ASSERT( sizeof( type_value ) == 4); // Specification says this. + + // Length + u32_t parameter_length( length ); + parameter_length = core_tools_c::convert_host_to_big_endian( parameter_length ); + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_LENGTH_OFFSET], + ¶meter_length, + sizeof( parameter_length ) ); + COMPILE_ASSERT( sizeof( parameter_length ) == 4); // Specification says this. + } + + +u64_t core_wlan_eapol_if_parameter_c::get_parameter_u64_t() const + { + u64_t value = core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET ); + value <<= 32; + value += core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET+4 ); + + return value; + } + + + +void core_wlan_eapol_if_parameter_c::add_parameter_u32_t( + u32_t data ) + { + u32_t parameter_data( data ); + parameter_data = core_tools_c::convert_host_to_big_endian( parameter_data ); + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET], + ¶meter_data, + sizeof( parameter_data ) ); + COMPILE_ASSERT( sizeof( parameter_data ) == 4); // Specification says this. + } + +u32_t core_wlan_eapol_if_parameter_c::get_parameter_u32_t() const + { + return core_tools_c::get_u32_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET ); + } + +void core_wlan_eapol_if_parameter_c::add_parameter_u16_t( + u16_t data ) + { + u16_t parameter_data( data ); + parameter_data = core_tools_c::convert_host_to_big_endian( parameter_data ); + core_tools_c::copy( + &data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET], + ¶meter_data, + sizeof( parameter_data ) ); + COMPILE_ASSERT( sizeof( data ) == 2); // Specification says this. + } + +u16_t core_wlan_eapol_if_parameter_c::get_parameter_u16_t() const + { + return core_tools_c::get_u16_big_endian( + &data_m[0], + WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET ); + } + +void core_wlan_eapol_if_parameter_c::add_parameter_u8_t( + u8_t data ) + { + data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET] = data; + COMPILE_ASSERT( sizeof( data ) == 1 ); // Specification says this. + } + +u8_t core_wlan_eapol_if_parameter_c::get_parameter_u8_t() const + { + return data_m[WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET]; + } + + + + + + + + + + + + + + + +/** + * Constructor + */ +core_wlan_eapol_if_function_c::core_wlan_eapol_if_function_c() + : data_m( NULL ) + , data_length_m( 0 ) + , buffer_length_m( 0 ) + , delete_buffer_m( false_t) + , iter_m( 0 ) + , current_parameter_m( ) + { + DEBUG( "core_wlan_eapol_if_function_c::core_wlan_eapol_if_function_c()" ); + } + +/** + * Constructor + * + * @param data Pointer to the IE data. + * @param data_length Length of the IE data. + */ +core_wlan_eapol_if_function_c::core_wlan_eapol_if_function_c( + u8_t * data, + const u32_t length ) + : data_m( data ) + , data_length_m( length ) + , buffer_length_m( 0 ) + , delete_buffer_m( false_t) + , iter_m( 0 ) + , current_parameter_m( ) + { + // Update current_parameter_m + first(); + } + +/** + * Destructor. + */ +core_wlan_eapol_if_function_c::~core_wlan_eapol_if_function_c() + { + if ( delete_buffer_m ) + { + core_tools_c::fillz( data_m, buffer_length_m ); + delete[] data_m; + data_m = NULL; + } + } + +wlan_eapol_if_message_type_e core_wlan_eapol_if_function_c::get_type() + { + first(); + return static_cast( current()->get_parameter_type() ); + } + +wlan_eapol_if_message_type_function_e core_wlan_eapol_if_function_c::get_function() + { + first(); + + u32_t function; + core_error_e error = current()->get_parameter_data( &function ); + if ( error != core_error_ok ) + { + return wlan_eapol_if_message_type_function_none; + } + return static_cast( function ); + } + +core_error_e core_wlan_eapol_if_function_c::append( + const core_wlan_eapol_if_parameter_c * const param ) + { + ASSERT( param != NULL ); + core_error_e error = reserve_buffer( data_length_m + param->size() ); + if ( error != core_error_ok ) + { + return error; + } + + core_tools_c::copy( + &data_m[data_length_m], + param->get_data(), + param->size() ); + + data_length_m += param->size(); + return core_error_ok; + } + +u32_t core_wlan_eapol_if_function_c::size() const + { + return data_length_m; + } + + +u8_t* core_wlan_eapol_if_function_c::get_data() + { + return &data_m[0]; + } + +void core_wlan_eapol_if_function_c::clear() + { + core_tools_c::fillz( data_m, buffer_length_m ); + data_length_m = 0; + first(); + } + +// ============================================================================ + +// Iterators +void core_wlan_eapol_if_function_c::first() + { + // Update current_parameter_m + iter_m = 0; + current_parameter_m.update( &data_m[iter_m], data_length_m - iter_m ); + } + +void core_wlan_eapol_if_function_c::next() + { + // Update current_parameter_m + iter_m += current_parameter_m.size(); + current_parameter_m.update( &data_m[iter_m], data_length_m - iter_m ); + + return; // ok + } + +const core_wlan_eapol_if_parameter_c* core_wlan_eapol_if_function_c::current() + { + return ¤t_parameter_m; + } + +bool_t core_wlan_eapol_if_function_c::is_done() const + { + return ( iter_m >= data_length_m ); + } + +// ============================================================================ + +core_error_e core_wlan_eapol_if_function_c::reserve_buffer( + u32_t needed_buffer_length ) + { + if ( needed_buffer_length <= buffer_length_m ) + { + return core_error_ok; + } + + DEBUG2( "core_wlan_eapol_if_function_c::reserve_buffer - increase buffer %i->%i bytes", buffer_length_m, needed_buffer_length ); + u8_t* p = new u8_t[needed_buffer_length]; + if ( !p ) + { + DEBUG( "core_wlan_eapol_if_function_c::reserve_buffer - Error: No enough memory!" ); + return core_error_no_memory; + } + core_tools_c::fillz( p, needed_buffer_length ); + core_tools_c::copy( + p, + &data_m[0], + data_length_m ); + core_tools_c::fillz( &data_m[0], buffer_length_m ); + + if ( delete_buffer_m ) + { + delete[] data_m; + } + delete_buffer_m = true_t; + data_m = p; + buffer_length_m = needed_buffer_length; + + return core_error_ok; + } + + + +// Higher level methods to handle structured parameters and functions + +core_error_e core_wlan_eapol_if_function_c::generate_network_id( + const network_id_c * network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_network_id()" ); + ASSERT( network_id != NULL); + + core_wlan_eapol_if_parameter_c source_parameter; + core_wlan_eapol_if_parameter_c destination_parameter; + core_wlan_eapol_if_parameter_c packet_type_parameter; + core_wlan_eapol_if_parameter_c network_identity; + + + core_error_e error = source_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, network_id->source_ptr, network_id->source_length ); + if ( error != core_error_ok ) + { + return error; + } + error = destination_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, network_id->destination_ptr, network_id->destination_length ); + if ( error != core_error_ok ) + { + return error; + } + error = packet_type_parameter.set_parameter_data( wlan_eapol_if_message_type_u16_t, network_id->packet_type ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c message; + + error = message.append( &source_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &destination_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &packet_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + error = network_identity.set_parameter_data( wlan_eapol_if_message_type_network_id, message.get_data(), message.size() ); + if ( error != core_error_ok ) + { + return error; + } + + return append( &network_identity ); + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_network_id( + network_id_c * network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_network_id()" ); + ASSERT( network_id ); + + if ( is_done() || current()->get_parameter_type() != wlan_eapol_if_message_type_network_id ) + { + return core_error_not_found; + } + + u8_t* network_id_data( NULL ); + u32_t network_id_data_length( 0 ); + + core_error_e error = current()->get_parameter_data( &network_id_data, &network_id_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c parsed_nwid_struct( network_id_data, network_id_data_length ); + + + // Source + parsed_nwid_struct.first(); + if ( parsed_nwid_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_nwid_struct.current()->get_parameter_data( &network_id->source_ptr, &network_id->source_length ); + if ( error != core_error_ok ) + { + return error; + } + + + // Destination + parsed_nwid_struct.next(); + if ( parsed_nwid_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_nwid_struct.current()->get_parameter_data( &network_id->destination_ptr, &network_id->destination_length ); + if ( error != core_error_ok ) + { + return error; + } + + + // Packet type + parsed_nwid_struct.next(); + if ( parsed_nwid_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u16_t ) + { + return core_error_not_found; + } + error = parsed_nwid_struct.current()->get_parameter_data( &network_id->packet_type ); + if ( error != core_error_ok ) + { + return error; + } + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::generate_network_key( + network_key_c * network_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_network_key()" ); + ASSERT( network_key ); + ASSERT( network_key->network_key ); + + core_wlan_eapol_if_parameter_c network_key_index_parameter; + core_wlan_eapol_if_parameter_c network_key_parameter; + core_wlan_eapol_if_parameter_c temp_network_key; + + + core_error_e error = network_key_index_parameter.set_parameter_data( wlan_eapol_if_message_type_u8_t, network_key->network_key_index ); + if ( error != core_error_ok ) + { + return error; + } + error = network_key_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, network_key->network_key, network_key->network_key_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c message; + + error = message.append( &network_key_index_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &network_key_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + error = temp_network_key.set_parameter_data( wlan_eapol_if_message_type_network_key, message.get_data(), message.size() ); + if ( error != core_error_ok ) + { + return error; + } + + return append( &temp_network_key ); + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_network_key( + network_key_c * network_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_network_key()" ); + ASSERT( network_key ); + + if ( is_done() || current()->get_parameter_type() != wlan_eapol_if_message_type_network_key ) + { + return core_error_not_found; + } + + u8_t* network_key_data( NULL ); + u32_t network_key_data_length( 0 ); + + core_error_e error = current()->get_parameter_data( &network_key_data, &network_key_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c parsed_network_key_struct( network_key_data, network_key_data_length ); + + + parsed_network_key_struct.first(); + if ( parsed_network_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u8_t ) + { + return core_error_not_found; + } + error = parsed_network_key_struct.current()->get_parameter_data( &network_key->network_key_index ); + if ( error != core_error_ok ) + { + return error; + } + + + parsed_network_key_struct.next(); + if ( parsed_network_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_network_key_struct.current()->get_parameter_data( &network_key->network_key, &network_key->network_key_length ); + if ( error != core_error_ok ) + { + return error; + } + + return error; + } + + + + + + + +core_error_e core_wlan_eapol_if_function_c::generate_protected_setup_credential( + protected_setup_credential_c * credential ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_protected_setup_credential()" ); + ASSERT( credential ); + + core_wlan_eapol_if_parameter_c network_index_parameter; + core_wlan_eapol_if_parameter_c ssid_parameter; + core_wlan_eapol_if_parameter_c authentication_type_parameter; + core_wlan_eapol_if_parameter_c encryption_type_parameter; + core_wlan_eapol_if_parameter_c network_key_list_parameter; + core_wlan_eapol_if_parameter_c mac_address_parameter; + + core_wlan_eapol_if_parameter_c protected_setup_credential; + + + core_error_e error = network_index_parameter.set_parameter_data( wlan_eapol_if_message_type_u8_t, credential->network_index ); + if ( error != core_error_ok ) + { + return error; + } + error = ssid_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, credential->ssid, credential->ssid_length ); + if ( error != core_error_ok ) + { + return error; + } + error = authentication_type_parameter.set_parameter_data( wlan_eapol_if_message_type_u16_t, credential->authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + error = encryption_type_parameter.set_parameter_data( wlan_eapol_if_message_type_u16_t, credential->encryption_type ); + if ( error != core_error_ok ) + { + return error; + } + + // Handle array here. + core_wlan_eapol_if_function_c array; + + credential->network_key_list.first(); + while ( credential->network_key_list.current() ) + { + core_wlan_eapol_if_function_c network_key; + error = network_key.generate_network_key( + credential->network_key_list.current() ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_key_parameter( network_key.get_data(), network_key.size() ); + + error = array.append( &network_key_parameter ); + if ( error != core_error_ok ) + { + return error; + } + credential->network_key_list.next(); + } + network_key_list_parameter.set_parameter_data( wlan_eapol_if_message_type_array, array.get_data(), array.size() ); + + + error = mac_address_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, credential->mac_address, credential->mac_address_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c message; + + error = message.append( &network_index_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &ssid_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &authentication_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &encryption_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &network_key_list_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &mac_address_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + error = protected_setup_credential.set_parameter_data( wlan_eapol_if_message_type_protected_setup_credential, message.get_data(), message.size() ); + if ( error != core_error_ok ) + { + return error; + } + + return append( &protected_setup_credential ); + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_protected_setup_credential( + protected_setup_credential_c * credential ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_protected_setup_credential()" ); + ASSERT( credential ); + + if ( is_done() || current()->get_parameter_type() != wlan_eapol_if_message_type_protected_setup_credential ) + { + return core_error_not_found; + } + + u8_t* credential_data( NULL ); + u32_t credential_data_length( 0 ); + + core_error_e error = current()->get_parameter_data( &credential_data, &credential_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c parsed_credential_struct( credential_data, credential_data_length ); + + + parsed_credential_struct.first(); + if ( parsed_credential_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u8_t ) + { + return core_error_not_found; + } + error = parsed_credential_struct.current()->get_parameter_data( &credential->network_index ); + if ( error != core_error_ok ) + { + return error; + } + + + parsed_credential_struct.next(); + if ( parsed_credential_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_credential_struct.current()->get_parameter_data( &credential->ssid, &credential->ssid_length ); + if ( error != core_error_ok ) + { + return error; + } + + + parsed_credential_struct.next(); + if ( parsed_credential_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u16_t ) + { + return core_error_not_found; + } + error = parsed_credential_struct.current()->get_parameter_data( &credential->authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + + + parsed_credential_struct.next(); + if ( parsed_credential_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u16_t ) + { + return core_error_not_found; + } + error = parsed_credential_struct.current()->get_parameter_data( &credential->encryption_type ); + if ( error != core_error_ok ) + { + return error; + } + + + parsed_credential_struct.next(); + if ( parsed_credential_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_array ) + { + return core_error_not_found; + } + + u32_t data_length; + u8_t * data; + error = parsed_credential_struct.current()->get_parameter_data( &data, &data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c array( data, data_length ); + + // Loop through array, put every parsed network_key to network_key_list. + array.first(); + while ( !array.is_done() ) + { + if ( array.current()->get_parameter_type() != wlan_eapol_if_message_type_network_key ) + { + return core_error_not_found; + } + network_key_c * network_key = new network_key_c( 0, NULL, 0 ); + if ( !network_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_protected_setup_credential() - Error: No enough memory!" ); + return core_error_no_memory; + } + error = array.parse_network_key( network_key ); + if ( error != core_error_ok ) + { + delete network_key; + network_key = NULL; + return error; + } + + error = credential->network_key_list.append( network_key ); + if ( error != core_error_ok ) + { + delete network_key; + network_key = NULL; + return error; + } + + array.next(); + } + + + parsed_credential_struct.next(); + if ( parsed_credential_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_credential_struct.current()->get_parameter_data( &credential->mac_address, &credential->mac_address_length ); + if ( error != core_error_ok ) + { + return error; + } + + + return error; + } + + + + + +core_error_e core_wlan_eapol_if_function_c::generate_session_key( + session_key_c * session_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_session_key()" ); + ASSERT( session_key ); + ASSERT( session_key->key ); + ASSERT( session_key->sequence_number ); + + core_wlan_eapol_if_parameter_c key_parameter; + core_wlan_eapol_if_parameter_c sequence_number_parameter; + core_wlan_eapol_if_parameter_c eapol_key_type_parameter; + core_wlan_eapol_if_parameter_c key_index_parameter; + core_wlan_eapol_if_parameter_c key_tx_bit_parameter; + + core_wlan_eapol_if_parameter_c session_key_parameter; + + + // Generate parameters + core_error_e error = key_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, session_key->key, session_key->key_length); + if ( error != core_error_ok ) + { + return error; + } + error = sequence_number_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, session_key->sequence_number, session_key->sequence_number_length); + if ( error != core_error_ok ) + { + return error; + } + error = eapol_key_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_key_type, session_key->eapol_key_type ); + if ( error != core_error_ok ) + { + return error; + } + error = key_index_parameter.set_parameter_data( wlan_eapol_if_message_type_u32_t, session_key->key_index ); + if ( error != core_error_ok ) + { + return error; + } + error = key_tx_bit_parameter.set_parameter_data( wlan_eapol_if_message_type_boolean, session_key->key_tx_bit ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + core_wlan_eapol_if_function_c message; + + error = message.append( &key_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &sequence_number_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &eapol_key_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &key_index_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &key_tx_bit_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + // Group parameter list to session key type + error = session_key_parameter.set_parameter_data( wlan_eapol_if_message_type_session_key, message.get_data(), message.size() ); + if ( error != core_error_ok ) + { + return error; + } + + return append( &session_key_parameter ); + } + + +core_error_e core_wlan_eapol_if_function_c::parse_session_key( + session_key_c * session_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_session_key()" ); + ASSERT( session_key ); + + if ( is_done() || current()->get_parameter_type() != wlan_eapol_if_message_type_session_key ) + { + return core_error_not_found; + } + + u8_t* session_key_data( NULL ); + u32_t session_key_data_length( 0 ); + + core_error_e error = current()->get_parameter_data( &session_key_data, &session_key_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c parsed_session_key_struct( session_key_data, session_key_data_length ); + + + // Source + parsed_session_key_struct.first(); + if ( parsed_session_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_session_key_struct.current()->get_parameter_data( &session_key->key, &session_key->key_length ); + if ( error != core_error_ok ) + { + return error; + } + + + // Sequence number + parsed_session_key_struct.next(); + if ( parsed_session_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = parsed_session_key_struct.current()->get_parameter_data( &session_key->sequence_number, &session_key->sequence_number_length ); + if ( error != core_error_ok ) + { + return error; + } + + + // EAPOL key type + parsed_session_key_struct.next(); + if ( parsed_session_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_eapol_key_type ) + { + return core_error_not_found; + } + u32_t eapol_key_type( 0 ); + error = parsed_session_key_struct.current()->get_parameter_data( &eapol_key_type ); + if ( error != core_error_ok ) + { + return error; + } + session_key->eapol_key_type = static_cast( eapol_key_type ); + + // Key index + parsed_session_key_struct.next(); + if ( parsed_session_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u32_t ) + { + return core_error_not_found; + } + error = parsed_session_key_struct.current()->get_parameter_data( &session_key->key_index ); + if ( error != core_error_ok ) + { + return error; + } + + // Key TX bit + parsed_session_key_struct.next(); + if ( parsed_session_key_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_boolean ) + { + return core_error_not_found; + } + error = parsed_session_key_struct.current()->get_parameter_data( &session_key->key_tx_bit ); + if ( error != core_error_ok ) + { + return error; + } + + return error; + } + + + + + +core_error_e core_wlan_eapol_if_function_c::generate_eap_state_notification( + state_notification_c * state_notification ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_eap_state_notification()" ); + ASSERT( state_notification ); + + core_wlan_eapol_if_parameter_c eap_state_notification; + + core_wlan_eapol_if_parameter_c protocol_layer_parameter; + core_wlan_eapol_if_parameter_c protocol_parameter; + core_wlan_eapol_if_parameter_c eap_type_parameter; + core_wlan_eapol_if_parameter_c current_state_parameter; + core_wlan_eapol_if_parameter_c is_client_parameter; + core_wlan_eapol_if_parameter_c authentication_error_parameter; + + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + core_error_e error = network_id.generate_network_id( + &state_notification->network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + + error = protocol_layer_parameter.set_parameter_data( wlan_eapol_if_message_type_eap_protocol_layer, state_notification->protocol_layer ); + if ( error != core_error_ok ) + { + return error; + } + error = protocol_parameter.set_parameter_data( wlan_eapol_if_message_type_u32_t, state_notification->protocol); + if ( error != core_error_ok ) + { + return error; + } + error = eap_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eap_type, state_notification->eap_type_vendor_id, state_notification->eap_type_vendor_type ); + if ( error != core_error_ok ) + { + return error; + } + error = current_state_parameter.set_parameter_data( wlan_eapol_if_message_type_u32_t, state_notification->current_state ); + if ( error != core_error_ok ) + { + return error; + } + error = is_client_parameter.set_parameter_data( wlan_eapol_if_message_type_boolean, state_notification->is_client ); + if ( error != core_error_ok ) + { + return error; + } + error = authentication_error_parameter.set_parameter_data( wlan_eapol_if_message_type_eap_status, state_notification->authentication_error ); + if ( error != core_error_ok ) + { + return error; + } + + // Append parameters to parameter list + core_wlan_eapol_if_function_c message; + + error = message.append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &protocol_layer_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &protocol_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &eap_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( ¤t_state_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &is_client_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = message.append( &authentication_error_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + // Group parameter list to EAP state notification type + error = eap_state_notification.set_parameter_data( wlan_eapol_if_message_type_eap_state_notification, message.get_data(), message.size() ); + if ( error != core_error_ok ) + { + return error; + } + + return append( &eap_state_notification ); + } + + +core_error_e core_wlan_eapol_if_function_c::parse_eap_state_notification( + state_notification_c * state_notification ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_eap_state_notification()" ); + ASSERT( state_notification ); + + if ( is_done() || current()->get_parameter_type() != wlan_eapol_if_message_type_eap_state_notification ) + { + return core_error_not_found; + } + + u8_t* eap_state_notification_data( NULL ); + u32_t eap_state_notification_data_length( 0 ); + + core_error_e error = current()->get_parameter_data( &eap_state_notification_data, &eap_state_notification_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c parsed_state_notification_struct( eap_state_notification_data, eap_state_notification_data_length ); + + + // Network id + parsed_state_notification_struct.first(); + error = parsed_state_notification_struct.parse_network_id( + &state_notification->network_id ); + if ( error != core_error_ok ) + { + return error; + } + + + // Protocol layer + parsed_state_notification_struct.next(); + if ( parsed_state_notification_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_eap_protocol_layer ) + { + return core_error_not_found; + } + u32_t temp_protocol_layer( 0 ); + error = parsed_state_notification_struct.current()->get_parameter_data( &temp_protocol_layer ); + if ( error != core_error_ok ) + { + return error; + } + state_notification->protocol_layer = static_cast( temp_protocol_layer ); + + + // Protocol + parsed_state_notification_struct.next(); + if ( parsed_state_notification_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u32_t ) + { + return core_error_not_found; + } + error = parsed_state_notification_struct.current()->get_parameter_data( &state_notification->protocol ); + if ( error != core_error_ok ) + { + return error; + } + + // EAP-Type + parsed_state_notification_struct.next(); + if ( parsed_state_notification_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_eap_type ) + { + return core_error_not_found; + } + error = parsed_state_notification_struct.current()->get_parameter_data( &state_notification->eap_type_vendor_id, &state_notification->eap_type_vendor_type ); + if ( error != core_error_ok ) + { + return error; + } + + // Current state + parsed_state_notification_struct.next(); + if ( parsed_state_notification_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_u32_t ) + { + return core_error_not_found; + } + error = parsed_state_notification_struct.current()->get_parameter_data( &state_notification->current_state ); + if ( error != core_error_ok ) + { + return error; + } + + // Is client + parsed_state_notification_struct.next(); + if ( parsed_state_notification_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_boolean ) + { + return core_error_not_found; + } + error = parsed_state_notification_struct.current()->get_parameter_data( &state_notification->is_client ); + if ( error != core_error_ok ) + { + return error; + } + + // Authentication error + parsed_state_notification_struct.next(); + if ( parsed_state_notification_struct.current()->get_parameter_type() != wlan_eapol_if_message_type_eap_status ) + { + return core_error_not_found; + } + u32_t temp_authentication_error( 0 ); + error = parsed_state_notification_struct.current()->get_parameter_data( &temp_authentication_error ); + if ( error != core_error_ok ) + { + return error; + } + state_notification->authentication_error = static_cast( temp_authentication_error ); + return error; + } + + +void core_wlan_eapol_if_function_c::debug_print() + { +#ifdef _DEBUG + DEBUG( " -> debug_print()" ); + + static const bool wlan_eapol_if_message_type_is_basic_type[] = + { + true, //"none", + false, //"array", + true, //"boolean", + true, //"eap_protocol_layer", + false, //"eap_state_notification", + true, //"eap_status", + true, //"eap_type", + true, //"eapol_key_802_11_authentication_mode", + true, //"eapol_key_authentication_type", + true, //"eapol_key_type", + true, //"eapol_tkip_mic_failure_type", + true, //"eapol_wlan_authentication_state", + true, //"error", + true, //"function", + false, //"network_id", + false, //"network_key", + false, //"protected_setup_credential", + true, //"RSNA_cipher", + false, //"session_key", + true, //"u8_t", + true, //"u16_t", + true, //"u32_t", + true, //"u64_t", + true, //"variable_data", + }; + + first(); + while ( !is_done() ) + { + wlan_eapol_if_message_type_e type = current()->get_parameter_type(); + debug_print_type_string( type, current()->get_parameter_length() ); + + // Basic types are printed now. Structured types are parsed recursively. + if ( wlan_eapol_if_message_type_is_basic_type[ type ]) + { + // Special handling for functions + if ( current()->get_parameter_type() == wlan_eapol_if_message_type_function ) + { + u32_t func(0); + core_error_e error = current()->get_parameter_data( &func ); + if ( error != core_error_ok ) + { + return; + } + debug_print_function_string( static_cast( func ) ); + } + else + { + DEBUG( "Data:" ); + DEBUG_BUFFER( current()->size()-WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET, + current()->get_data()+WLAN_EAPOL_MESSAGE_IF_DATA_OFFSET ); + } + } + else + { + u8_t* data( NULL ); + u32_t data_length( 0 ); + core_error_e error = current()->get_parameter_data( &data, &data_length ); + if ( error != core_error_ok ) + { + return; + } + + core_wlan_eapol_if_function_c sub_message( data, data_length ); + sub_message.debug_print(); + } + next(); + } + DEBUG( " <- debug_print()" ); +#endif // _DEBUG + } + + +#ifdef _DEBUG + +void core_wlan_eapol_if_function_c::debug_print_type_string( + wlan_eapol_if_message_type_e type, + u32_t length ) + { + switch ( type ) + { + case wlan_eapol_if_message_type_none : DEBUG2( "Type %i: none, length %i", type, length ); break; + case wlan_eapol_if_message_type_array : DEBUG2( "Type %i: array, length %i", type, length ); break; + case wlan_eapol_if_message_type_boolean : DEBUG2( "Type %i: boolean, length %i", type, length ); break; + case wlan_eapol_if_message_type_eap_protocol_layer : DEBUG2( "Type %i: eap_protocol_layer, length %i", type, length ); break; + case wlan_eapol_if_message_type_eap_state_notification : DEBUG2( "Type %i: eap_state_notification, length %i", type, length ); break; + case wlan_eapol_if_message_type_eap_status : DEBUG2( "Type %i: eap_status, length %i", type, length ); break; + case wlan_eapol_if_message_type_eap_type : DEBUG2( "Type %i: eap_type, length %i", type, length ); break; + case wlan_eapol_if_message_type_eapol_key_802_11_authentication_mode: DEBUG2( "Type %i: eapol_key_802_11_authentication_mode, length %i", type, length ); break; + case wlan_eapol_if_message_type_eapol_key_authentication_type : DEBUG2( "Type %i: eapol_key_authentication_type, length %i", type, length ); break; + case wlan_eapol_if_message_type_eapol_key_type : DEBUG2( "Type %i: eapol_key_type, length %i", type, length ); break; + case wlan_eapol_if_message_type_eapol_tkip_mic_failure_type : DEBUG2( "Type %i: eapol_tkip_mic_failure_type, length %i", type, length ); break; + case wlan_eapol_if_message_type_eapol_wlan_authentication_state : DEBUG2( "Type %i: eapol_wlan_authentication_state, length %i", type, length ); break; + case wlan_eapol_if_message_type_error : DEBUG2( "Type %i: error, length %i", type, length ); break; + case wlan_eapol_if_message_type_function : DEBUG2( "Type %i: function, length %i", type, length ); break; + case wlan_eapol_if_message_type_network_id : DEBUG2( "Type %i: network_id, length %i", type, length ); break; + case wlan_eapol_if_message_type_network_key : DEBUG2( "Type %i: network_key, length %i", type, length ); break; + case wlan_eapol_if_message_type_protected_setup_credential : DEBUG2( "Type %i: protected_setup_credential, length %i", type, length ); break; + case wlan_eapol_if_message_type_RSNA_cipher : DEBUG2( "Type %i: RSNA_cipher, length %i", type, length ); break; + case wlan_eapol_if_message_type_session_key : DEBUG2( "Type %i: session_key, length %i", type, length ); break; + case wlan_eapol_if_message_type_u8_t : DEBUG2( "Type %i: u8_t, length %i", type, length ); break; + case wlan_eapol_if_message_type_u16_t : DEBUG2( "Type %i: u16_t, length %i", type, length ); break; + case wlan_eapol_if_message_type_u32_t : DEBUG2( "Type %i: u32_t, length %i", type, length ); break; + case wlan_eapol_if_message_type_u64_t : DEBUG2( "Type %i: u64_t, length %i", type, length ); break; + case wlan_eapol_if_message_type_variable_data : DEBUG2( "Type %i: variable_data, length %i", type, length ); break; + default: DEBUG1( "Illegal type number (%i)", type ); + } + } + +void core_wlan_eapol_if_function_c::debug_print_function_string( + wlan_eapol_if_message_type_function_e function ) + { + switch ( function ) + { + case wlan_eapol_if_message_type_function_none : DEBUG1( "Function %i: none", function ); break; + case wlan_eapol_if_message_type_function_check_pmksa_cache : DEBUG1( "Function %i: check_pmksa_cache", function ); break; + case wlan_eapol_if_message_type_function_start_authentication : DEBUG1( "Function %i: start_authentication", function ); break; + case wlan_eapol_if_message_type_function_complete_association : DEBUG1( "Function %i: complete_association", function ); break; + case wlan_eapol_if_message_type_function_disassociation : DEBUG1( "Function %i: disassociation", function ); break; + case wlan_eapol_if_message_type_function_start_preauthentication : DEBUG1( "Function %i: start_preauthentication", function ); break; + case wlan_eapol_if_message_type_function_start_reassociation : DEBUG1( "Function %i: start_reassociation", function ); break; + case wlan_eapol_if_message_type_function_complete_reassociation : DEBUG1( "Function %i: complete_reassociation", function ); break; + case wlan_eapol_if_message_type_function_start_wpx_fast_roam_reassociation : DEBUG1( "Function %i: start_wpx_fast_roam_reassociation", function ); break; + case wlan_eapol_if_message_type_function_complete_wpx_fast_roam_reassociation : DEBUG1( "Function %i: complete_wpx_fast_roam_reassociation", function ); break; + case wlan_eapol_if_message_type_function_packet_process : DEBUG1( "Function %i: packet_process", function ); break; + case wlan_eapol_if_message_type_function_tkip_mic_failure : DEBUG1( "Function %i: tkip_mic_failure", function ); break; + case wlan_eapol_if_message_type_function_eap_acknowledge : DEBUG1( "Function %i: eap_acknowledge", function ); break; + case wlan_eapol_if_message_type_function_update_header_offset : DEBUG1( "Function %i: update_header_offset", function ); break; + case wlan_eapol_if_message_type_function_complete_check_pmksa_cache : DEBUG1( "Function %i: complete_check_pmksa_cache", function ); break; + case wlan_eapol_if_message_type_function_packet_send : DEBUG1( "Function %i: packet_send", function ); break; + case wlan_eapol_if_message_type_function_associate : DEBUG1( "Function %i: associate", function ); break; + case wlan_eapol_if_message_type_function_disassociate : DEBUG1( "Function %i: disassociate", function ); break; + case wlan_eapol_if_message_type_function_packet_data_session_key : DEBUG1( "Function %i: packet_data_session_key", function ); break; + case wlan_eapol_if_message_type_function_state_notification : DEBUG1( "Function %i: state_notification", function ); break; + case wlan_eapol_if_message_type_function_reassociate : DEBUG1( "Function %i: reassociate", function ); break; + case wlan_eapol_if_message_type_function_update_wlan_database_reference_values: DEBUG1( "Function %i: update_wlan_database_reference_values", function ); break; + case wlan_eapol_if_message_type_function_complete_start_wpx_fast_roam_reassociation : DEBUG1( "Function %i: complete_start_wpx_fast_roam_reassociation", function ); break; + case wlan_eapol_if_message_type_function_new_protected_setup_credentials : DEBUG1( "Function %i: new_protected_setup_credentials", function ); break; + default: DEBUG1( "Illegal function number (%i)", function ); + } + } + +#else + +void core_wlan_eapol_if_function_c::debug_print_type_string( + wlan_eapol_if_message_type_e /* type */, + u32_t /* length */ ) + { + } + +void core_wlan_eapol_if_function_c::debug_print_function_string( + wlan_eapol_if_message_type_function_e /* function */ ) + { + } + +#endif // _DEBUG + + +// ============================================================================ + +core_error_e core_wlan_eapol_if_function_c::check_pmksa_cache( + core_type_list_c & network_id_list, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) + { + DEBUG( "core_wlan_eapol_if_function_c::check_pmksa_cache()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_check_pmksa_cache ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c key_authentication_type_parameter; + core_wlan_eapol_if_parameter_c pairwise_key_cipher_suite_parameter; + core_wlan_eapol_if_parameter_c group_key_cipher_suite_parameter; + + // Generate parameters + + // Generate array + core_wlan_eapol_if_function_c network_id_array; + core_wlan_eapol_if_parameter_c network_id_array_parameter; + + network_id_list.first(); + while ( network_id_list.current() ) + { + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + network_id_list.current() ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = network_id_array.append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + network_id_list.next(); + } + + network_id_array_parameter.set_parameter_data( wlan_eapol_if_message_type_array, network_id_array.get_data(), network_id_array.size() ); + + + error = key_authentication_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_key_authentication_type, selected_eapol_key_authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + error = pairwise_key_cipher_suite_parameter.set_parameter_data( wlan_eapol_if_message_type_RSNA_cipher, pairwise_key_cipher_suite); + if ( error != core_error_ok ) + { + return error; + } + error = group_key_cipher_suite_parameter.set_parameter_data( wlan_eapol_if_message_type_RSNA_cipher, group_key_cipher_suite ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_array_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &key_authentication_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &pairwise_key_cipher_suite_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &group_key_cipher_suite_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + + +core_error_e core_wlan_eapol_if_function_c::start_authentication( + u8_t * ssid, const u32_t ssid_length, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + u8_t * wpa_psk, const u32_t wpa_psk_length, + const bool_t wpa_override_enabled, + const network_id_c * receive_network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::start_authentication()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_start_authentication ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c ssid_parameter; + core_wlan_eapol_if_parameter_c key_authentication_type_parameter; + core_wlan_eapol_if_parameter_c wpa_psk_parameter; + core_wlan_eapol_if_parameter_c wpa_override_enabled_parameter; + + + // Generate parameters + error = ssid_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, ssid, ssid_length ); + if ( error != core_error_ok ) + { + return error; + } + + error = key_authentication_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_key_authentication_type, selected_eapol_key_authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + error = wpa_psk_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, wpa_psk, wpa_psk_length ); + if ( error != core_error_ok ) + { + return error; + } + error = wpa_override_enabled_parameter.set_parameter_data( wlan_eapol_if_message_type_boolean, wpa_override_enabled ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &ssid_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &key_authentication_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &wpa_psk_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &wpa_override_enabled_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + +core_error_e core_wlan_eapol_if_function_c::complete_association( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * receive_network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) + { + DEBUG( "core_wlan_eapol_if_function_c::complete_association()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_complete_association ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c association_result_parameter; + core_wlan_eapol_if_parameter_c received_wpa_ie_parameter; + core_wlan_eapol_if_parameter_c sent_wpa_ie_parameter; + core_wlan_eapol_if_parameter_c pairwise_key_cipher_suite_parameter; + core_wlan_eapol_if_parameter_c group_key_cipher_suite_parameter; + + + // Generate parameters + error = association_result_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_wlan_authentication_state, association_result ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + + error = received_wpa_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, received_wpa_ie, received_wpa_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + error = sent_wpa_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, sent_wpa_ie, sent_wpa_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + error = pairwise_key_cipher_suite_parameter.set_parameter_data( wlan_eapol_if_message_type_RSNA_cipher, pairwise_key_cipher_suite ); + if ( error != core_error_ok ) + { + return error; + } + error = group_key_cipher_suite_parameter.set_parameter_data( wlan_eapol_if_message_type_RSNA_cipher, group_key_cipher_suite ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &association_result_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &received_wpa_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &sent_wpa_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &pairwise_key_cipher_suite_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &group_key_cipher_suite_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::disassociation( + const network_id_c * receive_network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::disassociation()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_disassociation ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::start_preauthentication( + const network_id_c * receive_network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::start_preauthentication()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_start_preauthentication ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::start_reassociation( + const network_id_c * old_receive_network_id, + const network_id_c * new_receive_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type ) + { + DEBUG( "core_wlan_eapol_if_function_c::start_reassociation()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_start_reassociation ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_function_c old_network_id; + error = old_network_id.generate_network_id( + old_receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c old_network_id_parameter( old_network_id.get_data(), old_network_id.size() ); + + + core_wlan_eapol_if_function_c new_network_id; + error = new_network_id.generate_network_id( + new_receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c new_network_id_parameter( new_network_id.get_data(), new_network_id.size() ); + + + core_wlan_eapol_if_parameter_c key_authentication_type_parameter; + error = key_authentication_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_key_authentication_type, selected_eapol_key_authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &old_network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &new_network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &key_authentication_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::complete_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * receive_network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) + { + DEBUG( "core_wlan_eapol_if_function_c::complete_reassociation()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_complete_reassociation ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c association_result_parameter; + core_wlan_eapol_if_parameter_c received_wpa_ie_parameter; + core_wlan_eapol_if_parameter_c sent_wpa_ie_parameter; + core_wlan_eapol_if_parameter_c pairwise_key_cipher_suite_parameter; + core_wlan_eapol_if_parameter_c group_key_cipher_suite_parameter; + + + // Generate parameters + error = association_result_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_wlan_authentication_state, association_result ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + + error = received_wpa_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, received_wpa_ie, received_wpa_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + error = sent_wpa_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, sent_wpa_ie, sent_wpa_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + error = pairwise_key_cipher_suite_parameter.set_parameter_data( wlan_eapol_if_message_type_RSNA_cipher, pairwise_key_cipher_suite ); + if ( error != core_error_ok ) + { + return error; + } + error = group_key_cipher_suite_parameter.set_parameter_data( wlan_eapol_if_message_type_RSNA_cipher, group_key_cipher_suite ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &association_result_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &received_wpa_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &sent_wpa_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &pairwise_key_cipher_suite_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &group_key_cipher_suite_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::start_wpx_fast_roam_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + u8_t * reassociation_request_ie, + const u32_t reassociation_request_ie_length, + const u8_t* received_wpa_ie, + u32_t received_wpa_ie_length, + const u8_t* sent_wpa_ie, + u32_t sent_wpa_ie_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::start_wpx_fast_roam_reassociation()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_start_wpx_fast_roam_reassociation ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_function_c network_id_old; + error = network_id_old.generate_network_id( + old_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c old_network_id_parameter( network_id_old.get_data(), network_id_old.size() ); + + + core_wlan_eapol_if_function_c network_id_new; + error = network_id_new.generate_network_id( + new_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c new_network_id_parameter( network_id_new.get_data(), network_id_new.size() ); + + + core_wlan_eapol_if_parameter_c reassociation_request_ie_parameter; + error = reassociation_request_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, reassociation_request_ie, reassociation_request_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c received_wpa_ie_parameter; + error = received_wpa_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, received_wpa_ie, received_wpa_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c sent_wpa_ie_parameter; + error = sent_wpa_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, sent_wpa_ie, sent_wpa_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &old_network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &new_network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &reassociation_request_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &received_wpa_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &sent_wpa_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::complete_wpx_fast_roam_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e reassociation_result, + const network_id_c * receive_network_id, + u8_t * received_reassociation_ie, const u32_t received_reassociation_ie_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::complete_wpx_fast_roam_reassociation()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_complete_wpx_fast_roam_reassociation ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_parameter_c reassociation_result_parameter; + error = reassociation_result_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_wlan_authentication_state, reassociation_result ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + core_wlan_eapol_if_parameter_c received_reassociation_ie_parameter; + error = received_reassociation_ie_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, received_reassociation_ie, received_reassociation_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &reassociation_result_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &received_reassociation_ie_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::packet_process( + const network_id_c * receive_network_id, + const u8_t * packet_data, const u32_t packet_data_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::packet_process()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_packet_process ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + core_wlan_eapol_if_parameter_c packet_data_parameter; + error = packet_data_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, packet_data, packet_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &packet_data_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::tkip_mic_failure( + const network_id_c * receive_network_id, + const bool_t is_fatal_failure, + const wlan_eapol_if_eapol_tkip_mic_failure_type_e tkip_mic_failure_type ) + { + DEBUG( "core_wlan_eapol_if_function_c::tkip_mic_failure()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_tkip_mic_failure ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + core_wlan_eapol_if_parameter_c is_fatal_failure_parameter; + error = is_fatal_failure_parameter.set_parameter_data( wlan_eapol_if_message_type_boolean, is_fatal_failure ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c tkip_mic_failure_type_parameter; + error = tkip_mic_failure_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_tkip_mic_failure_type, tkip_mic_failure_type ); + if ( error != core_error_ok ) + { + return error; + } + + // Append parameters to parameter list + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &is_fatal_failure_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &tkip_mic_failure_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::eap_acknowledge( + const network_id_c * receive_network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::eap_acknowledge()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_eap_acknowledge ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + + // Append parameters to parameter list + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::update_header_offset( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::update_header_offset()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_update_header_offset ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_parameter_c header_offset_parameter; + error = header_offset_parameter.set_parameter_data( wlan_eapol_if_message_type_u32_t, header_offset ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c MTU_parameter; + error = MTU_parameter.set_parameter_data( wlan_eapol_if_message_type_u32_t, MTU ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c trailer_length_parameter; + error = trailer_length_parameter.set_parameter_data( wlan_eapol_if_message_type_u32_t, trailer_length ); + if ( error != core_error_ok ) + { + return error; + } + + + + // Append parameters to parameter list + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &header_offset_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &MTU_parameter ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &trailer_length_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::generate_complete_check_pmksa_cache( + core_type_list_c & network_id_list ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_complete_check_pmksa_cache()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_complete_check_pmksa_cache ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c array; + core_wlan_eapol_if_parameter_c array_parameter; + + network_id_list.first(); + while ( network_id_list.current() ) + { + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + network_id_list.current() ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = array.append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + network_id_list.next(); + } + + array_parameter.set_parameter_data( wlan_eapol_if_message_type_array, array.get_data(), array.size() ); + error = append( &array_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_complete_check_pmksa_cache( + core_type_list_c & network_id_list ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_complete_check_pmksa_cache()" ); + + core_error_e error( core_error_ok ); + network_id_list.clear(); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::complete_check_pmksa_cache() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_complete_check_pmksa_cache ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_array ) + { + return core_error_not_found; + } + + u32_t data_length; + u8_t * data; + error = current()->get_parameter_data( &data, &data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c array( data, data_length ); + + // Loop through array, put every parsed network_id to network_id_list. + array.first(); + while ( !array.is_done() ) + { + if ( array.current()->get_parameter_type() != wlan_eapol_if_message_type_network_id ) + { + return core_error_not_found; + } + network_id_c * network_id = new network_id_c( NULL, 0, NULL, 0, 0 ); + if ( !network_id ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_complete_check_pmksa_cache() - Error: No enough memory!" ); + return core_error_no_memory; + } + error = array.parse_network_id( network_id ); + if ( error != core_error_ok ) + { + delete network_id; + network_id = NULL; + return error; + } + + error = network_id_list.append( network_id ); + if ( error != core_error_ok ) + { + delete network_id; + network_id = NULL; + return error; + } + + array.next(); + } + + return core_error_ok; + } + +core_error_e core_wlan_eapol_if_function_c::generate_packet_send( + network_id_c * send_network_id, + u8_t * packet_data, const u32_t packet_data_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_packet_send()" ); + ASSERT( send_network_id ); + ASSERT( packet_data ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_packet_send ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + send_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c packet_parameter; + error = packet_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, packet_data, packet_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &packet_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + +core_error_e core_wlan_eapol_if_function_c::parse_packet_send( + network_id_c * network_id, + u8_t ** packet_data, u32_t * packet_data_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_packet_send()" ); + ASSERT( network_id ); + ASSERT( packet_data ); + ASSERT( packet_data_length ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_packet_send() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_packet_send ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + error = parse_network_id( network_id ); + if ( error != core_error_ok ) + { + return error; + } + + next(); + + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = current()->get_parameter_data( packet_data, packet_data_length ); + if ( error != core_error_ok ) + { + return error; + } + + + return core_error_ok; + } + + + +core_error_e core_wlan_eapol_if_function_c::generate_associate( + const wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_associate()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_associate ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_parameter_c authentication_mode_parameter; + error = authentication_mode_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_key_802_11_authentication_mode, authentication_mode ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &authentication_mode_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::parse_associate( + wlan_eapol_if_eapol_key_authentication_mode_e * authentication_mode ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_associate()" ); + ASSERT( authentication_mode ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_associate() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_associate ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_eapol_key_802_11_authentication_mode ) + { + return core_error_not_found; + } + u32_t temp_authentication_mode( 0 ); + error = current()->get_parameter_data( &temp_authentication_mode ); + if ( error != core_error_ok ) + { + return error; + } + *authentication_mode = static_cast( temp_authentication_mode ); + + return core_error_ok; + } + + + +core_error_e core_wlan_eapol_if_function_c::generate_disassociate( + network_id_c * receive_network_id, + const bool_t self_disassociation ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_disassociate()" ); + ASSERT( receive_network_id ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_disassociate ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c self_disassociation_parameter; + error = self_disassociation_parameter.set_parameter_data( wlan_eapol_if_message_type_boolean, self_disassociation ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &self_disassociation_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + +core_error_e core_wlan_eapol_if_function_c::parse_disassociate( + network_id_c * receive_network_id, + bool_t * self_disassociation ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_disassociate()" ); + ASSERT( receive_network_id ); + ASSERT( self_disassociation ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_disassociate() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_disassociate ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + error = parse_network_id( receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + + next(); + + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_boolean ) + { + return core_error_not_found; + } + error = current()->get_parameter_data( self_disassociation ); + if ( error != core_error_ok ) + { + return error; + } + + + return core_error_ok; + } + + + + + +core_error_e core_wlan_eapol_if_function_c::generate_packet_data_session_key( + network_id_c * send_network_id, + session_key_c * session_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_packet_data_session_key()" ); + ASSERT( send_network_id ); + ASSERT( session_key ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_packet_data_session_key ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + send_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + core_wlan_eapol_if_function_c generated_session_key; + error = generated_session_key.generate_session_key( + session_key ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c session_key_parameter( generated_session_key.get_data(), generated_session_key.size() ); + + error = append( &session_key_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_packet_data_session_key( + network_id_c * send_network_id, + session_key_c * session_key ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_packet_data_session_key()" ); + ASSERT( send_network_id ); + ASSERT( session_key ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_packet_data_session_key() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_packet_data_session_key ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + error = parse_network_id( send_network_id ); + if ( error != core_error_ok ) + { + return error; + } + + next(); + + error = parse_session_key( + session_key ); + if ( error != core_error_ok ) + { + return error; + } + + return core_error_ok; + } + + + + +core_error_e core_wlan_eapol_if_function_c::generate_state_notification( + state_notification_c * state_notification ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_state_notification()" ); + ASSERT( state_notification ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_state_notification ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c state_notif; + error = state_notif.generate_eap_state_notification( + state_notification ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c state_notification_parameter( state_notif.get_data(), state_notif.size() ); + + error = append( &state_notification_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_state_notification( + state_notification_c * state_notification ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_state_notification()" ); + ASSERT( state_notification ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_state_notification() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_state_notification ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + error = parse_eap_state_notification( state_notification ); + if ( error != core_error_ok ) + { + return error; + } + + return core_error_ok; + } + + +core_error_e core_wlan_eapol_if_function_c::generate_reassociate( + network_id_c * send_network_id, + wlan_eapol_if_eapol_key_authentication_type_e authentication_type, + u8_t * pmkid, + u32_t pmkid_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_reassociate()" ); + ASSERT( send_network_id ); + ASSERT( pmkid ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_reassociate ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + send_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c authentication_type_parameter; + error = authentication_type_parameter.set_parameter_data( wlan_eapol_if_message_type_eapol_key_authentication_type, authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &authentication_type_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_parameter_c pmkid_parameter; + error = pmkid_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, pmkid, pmkid_length ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &pmkid_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + +core_error_e core_wlan_eapol_if_function_c::parse_reassociate( + network_id_c * send_network_id, + wlan_eapol_if_eapol_key_authentication_type_e * authentication_type, + u8_t ** pmkid, + u32_t * pmkid_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_reassociate()" ); + ASSERT( send_network_id ); + ASSERT( authentication_type ); + ASSERT( pmkid ); + ASSERT( pmkid_length ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_reassociate() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_reassociate ) + { + return core_error_not_found; + } + + next(); + + // Check function parameters + error = parse_network_id( send_network_id ); + if ( error != core_error_ok ) + { + return error; + } + + next(); + + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_eapol_key_authentication_type ) + { + return core_error_not_found; + } + u32_t temp_authentication_type( 0 ); + error = current()->get_parameter_data( &temp_authentication_type ); + if ( error != core_error_ok ) + { + return error; + } + *authentication_type = static_cast( temp_authentication_type ); + + next(); + + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = current()->get_parameter_data( pmkid, pmkid_length ); + if ( error != core_error_ok ) + { + return error; + } + + + return core_error_ok; + } + + +core_error_e core_wlan_eapol_if_function_c::update_wlan_database_reference_values( + u8_t * database_reference_value, const u32_t database_reference_value_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::update_wlan_database_reference_values()" ); + ASSERT( database_reference_value ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_update_wlan_database_reference_values ); + if ( error != core_error_ok ) + { + return error; + } + + + // Generate parameters + core_wlan_eapol_if_parameter_c database_reference_value_parameter; + error = database_reference_value_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, database_reference_value, database_reference_value_length ); + if ( error != core_error_ok ) + { + return error; + } + + // Append parameters to parameter list + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &database_reference_value_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + + +core_error_e core_wlan_eapol_if_function_c::generate_complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t * reassociation_request_ie, + u32_t reassociation_request_ie_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_complete_start_wpx_fast_roam_reassociation()" ); + ASSERT( receive_network_id ); + ASSERT( reassociation_request_ie ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_complete_start_wpx_fast_roam_reassociation ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c network_id; + error = network_id.generate_network_id( + receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c network_id_parameter( network_id.get_data(), network_id.size() ); + + error = append( &network_id_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + core_wlan_eapol_if_parameter_c pmkid_parameter; + error = pmkid_parameter.set_parameter_data( wlan_eapol_if_message_type_variable_data, reassociation_request_ie, reassociation_request_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &pmkid_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + +core_error_e core_wlan_eapol_if_function_c::parse_complete_start_wpx_fast_roam_reassociation( + network_id_c * receive_network_id, + u8_t ** reassociation_request_ie, + u32_t * reassociation_request_ie_length ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_complete_start_wpx_fast_roam_reassociation()" ); + ASSERT( receive_network_id ); + ASSERT( reassociation_request_ie ); + ASSERT( reassociation_request_ie_length ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_complete_start_wpx_fast_roam_reassociation() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_complete_start_wpx_fast_roam_reassociation ) + { + return core_error_not_found; + } + + next(); + + // Check function parameters + error = parse_network_id( receive_network_id ); + if ( error != core_error_ok ) + { + return error; + } + + next(); + + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_variable_data ) + { + return core_error_not_found; + } + error = current()->get_parameter_data( reassociation_request_ie, reassociation_request_ie_length ); + if ( error != core_error_ok ) + { + return error; + } + + + return core_error_ok; + } + + +core_error_e core_wlan_eapol_if_function_c::generate_error( + wlan_eapol_if_error_e errorcode, + wlan_eapol_if_message_type_function_e function ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_error()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c error_parameter; + core_wlan_eapol_if_parameter_c function_parameter; + + error = error_parameter.set_parameter_data( wlan_eapol_if_message_type_error, errorcode ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &error_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + error = function_parameter.set_parameter_data( wlan_eapol_if_message_type_function, function ); + if ( error != core_error_ok ) + { + return error; + } + error = append( &function_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + debug_print(); + + return error; + } + + + + +core_error_e core_wlan_eapol_if_function_c::parse_error( + wlan_eapol_if_error_e * errorcode, + wlan_eapol_if_message_type_function_e * function ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_error()" ); + ASSERT( errorcode ); + ASSERT( function ); + + core_error_e error( core_error_ok ); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_error() - message is empty" ); + return core_error_not_found; + } + + // Check error + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_error ) + { + return core_error_not_found; + } + u32_t temp_errorcode( 0 ); + error = current()->get_parameter_data( &temp_errorcode ); + if ( error != core_error_ok ) + { + return error; + } + *errorcode = static_cast( temp_errorcode ); + + next(); + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + *function = static_cast( function_value ); + + DEBUG2( "core_wlan_eapol_if_function_c::parse_error() - Error message received: errorcode=%i, function=%i", *errorcode, *function ); + + return core_error_ok; + } + + + +core_error_e core_wlan_eapol_if_function_c::generate_new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ) + { + DEBUG( "core_wlan_eapol_if_function_c::generate_new_protected_setup_credentials()" ); + clear(); + + core_error_e error; + core_wlan_eapol_if_parameter_c function; + + error = function.set_parameter_data( wlan_eapol_if_message_type_function, wlan_eapol_if_message_type_function_new_protected_setup_credentials ); + if ( error != core_error_ok ) + { + return error; + } + + error = append( &function ); + if ( error != core_error_ok ) + { + return error; + } + + // Generate parameters + core_wlan_eapol_if_function_c array; + core_wlan_eapol_if_parameter_c array_parameter; + + credential_list.first(); + while ( credential_list.current() ) + { + core_wlan_eapol_if_function_c credential; + error = credential.generate_protected_setup_credential( + credential_list.current() ); + if ( error != core_error_ok ) + { + return error; + } + core_wlan_eapol_if_parameter_c credential_parameter( credential.get_data(), credential.size() ); + + error = array.append( &credential_parameter ); + if ( error != core_error_ok ) + { + return error; + } + credential_list.next(); + } + + array_parameter.set_parameter_data( wlan_eapol_if_message_type_array, array.get_data(), array.size() ); + error = append( &array_parameter ); + if ( error != core_error_ok ) + { + return error; + } + + + debug_print(); + + return error; + } + + + +core_error_e core_wlan_eapol_if_function_c::parse_new_protected_setup_credentials( + core_type_list_c< protected_setup_credential_c > & credential_list ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_new_protected_setup_credentials()" ); + + core_error_e error( core_error_ok ); + credential_list.clear(); + + first(); + if ( is_done() ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_new_protected_setup_credentials() - message is empty" ); + return core_error_not_found; + } + + // Check function + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_function ) + { + return core_error_not_found; + } + + u32_t function_value(0); + current()->get_parameter_data( &function_value ); + wlan_eapol_if_message_type_function_e func( static_cast( function_value ) ); + if ( func != wlan_eapol_if_message_type_function_new_protected_setup_credentials ) + { + return core_error_not_found; + } + + next(); + + + // Check function parameters + if ( current()->get_parameter_type() != wlan_eapol_if_message_type_array ) + { + return core_error_not_found; + } + + u32_t data_length; + u8_t * data; + error = current()->get_parameter_data( &data, &data_length ); + if ( error != core_error_ok ) + { + return error; + } + + core_wlan_eapol_if_function_c array( data, data_length ); + + // Loop through array, put every parsed credential to credential_list. + array.first(); + while ( !array.is_done() ) + { + if ( array.current()->get_parameter_type() != wlan_eapol_if_message_type_protected_setup_credential ) + { + return core_error_not_found; + } + protected_setup_credential_c * credential = new protected_setup_credential_c( 0, NULL, 0, 0, 0, NULL, 0 ); + if ( !credential ) + { + DEBUG( "core_wlan_eapol_if_function_c::parse_new_protected_setup_credentials() - Error: No enough memory!" ); + return core_error_no_memory; + } + error = array.parse_protected_setup_credential( credential ); + if ( error != core_error_ok ) + { + delete credential; + credential = NULL; + return error; + } + + error = credential_list.append( credential ); + if ( error != core_error_ok ) + { + delete credential; + credential = NULL; + return error; + } + + array.next(); + } + + return core_error_ok; + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wlan_eapol_interface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wlan_eapol_interface.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,622 @@ +/* +* Copyright (c) 2001-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to EAPOL authentication protocols. +* +*/ + + +// INCLUDE FILES + +#include "core_wlan_eapol_interface.h" +#include "abs_core_server_callback.h" +#include "core_tools.h" + +// LOCAL CONSTANTS + +const uint_t CORE_EAPOL_TRAILER_LENGTH = 0; +const uint_t CORE_EAPOL_HEADER_OFFSET = 0; +const uint_t CORE_EAPOL_MTU_VALUE = 1500; + +// ================= MEMBER FUNCTIONS ======================= + +//-------------------------------------------------- + +core_wlan_eapol_interface_c::core_wlan_eapol_interface_c( + abs_core_server_callback_c& wlm_callback ) : + wlm_callback_m( wlm_callback ), + function( ), + completed_check_pmksa_cache_list( ), + stored_frame_m( NULL ), + eapol_mode_m( core_eapol_operating_mode_wfa ), + authentication_type_m( wlan_eapol_if_eapol_key_authentication_type_none ) + { + DEBUG( "core_wlan_eapol_interface_c::core_wlan_eapol_interface_c()" ); + } + +//-------------------------------------------------- + +core_wlan_eapol_interface_c::~core_wlan_eapol_interface_c() + { + DEBUG( "core_wlan_eapol_interface_c::~core_wlan_eapol_interface_c()" ); + + delete stored_frame_m; + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::convert_if_status_to_core_error( const u32_t if_status ) + { + DEBUG1( "core_wlan_eapol_interface_c::convert_if_status_to_core_error( %i )", if_status ); + + switch ( if_status ) + { + case wlan_eapol_if_error_ok: + return core_error_ok; + case wlan_eapol_if_error_pending_request: + return core_error_request_pending; + case wlan_eapol_if_error_allocation_error: + return core_error_no_memory; + case wlan_eapol_if_error_illegal_parameter: + return core_error_illegal_argument; + case wlan_eapol_if_error_process_general_error: + return core_error_general; + default: + DEBUG( "core_wlan_eapol_interface_c::convert_if_status_to_core_error - Error: unknown status" ); + return core_error_general; + } + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::load_eapol( + core_eapol_operating_mode_e mode, + abs_wlan_eapol_callback_c* const eapol_handler ) + { + DEBUG( "core_wlan_eapol_interface_c::load_eapol()" ); + + eapol_mode_m = mode; + return core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.load_eapol( mode, eapol_handler ) ); + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::shutdown() + { + DEBUG( "core_wlan_eapol_interface_c::shutdown()" ); + return core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.shutdown() ); + } + +//-------------------------------------------------- + +core_error_e core_wlan_eapol_interface_c::configure() + { + DEBUG( "core_wlan_eapol_interface_c::configure()" ); + return core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.configure( + CORE_EAPOL_HEADER_OFFSET, + CORE_EAPOL_MTU_VALUE, + CORE_EAPOL_TRAILER_LENGTH ) ); + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::check_pmksa_cache( + core_type_list_c & network_id_list, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) + { + DEBUG( "core_wlan_eapol_interface_c::check_pmksa_cache()" ); + core_error_e error = function.check_pmksa_cache( + network_id_list, + selected_eapol_key_authentication_type, + pairwise_key_cipher_suite, + group_key_cipher_suite ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::check_pmksa_cache() - Encoding function returns %i", error ); + return error; + } + return core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::start_authentication( + u8_t * ssid, const u32_t ssid_length, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, + u8_t * wpa_psk, const u32_t wpa_psk_length, + const bool_t wpa_override_enabled, + const network_id_c * network_id ) + { + DEBUG( "core_wlan_eapol_interface_c::start_authentication()" ); + + authentication_type_m = selected_eapol_key_authentication_type; + + core_error_e error = function.start_authentication( + ssid, ssid_length, + selected_eapol_key_authentication_type, + wpa_psk, wpa_psk_length, + wpa_override_enabled, + network_id ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::start_authentication() - Encoding function returns %i", error ); + return error; + } + return core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::complete_association( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) + { + DEBUG( "core_wlan_eapol_interface_c::complete_association()" ); + core_error_e error = function.complete_association( + association_result, + network_id, + received_wpa_ie, received_wpa_ie_length, + sent_wpa_ie, sent_wpa_ie_length, + pairwise_key_cipher_suite, + group_key_cipher_suite ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::complete_association() - Encoding function returns %i", error ); + return error; + } + return core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::disassociation( + const network_id_c * network_id ) ///< source includes remote address, destination includes local address. + { + DEBUG( "core_wlan_eapol_interface_c::disassociation()" ); + core_error_e error = function.disassociation( + network_id ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::disassociation() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + + +//-------------------------------------------------- + + +// +core_error_e core_wlan_eapol_interface_c::start_preauthentication( + const network_id_c * network_id ) + { + DEBUG( "core_wlan_eapol_interface_c::start_preauthentication()" ); + core_error_e error = function.start_preauthentication( + network_id ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::start_preauthentication() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::start_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type ) + { + DEBUG( "core_wlan_eapol_interface_c::start_reassociation()" ); + + authentication_type_m = selected_eapol_key_authentication_type; + + core_error_e error = function.start_reassociation( + old_network_id, + new_network_id, + selected_eapol_key_authentication_type ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::start_reassociation() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::complete_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, + const network_id_c * network_id, + u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, + u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, + const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, + const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) + { + DEBUG( "core_wlan_eapol_interface_c::complete_reassociation()" ); + core_error_e error = function.complete_reassociation( + association_result, + network_id, + received_wpa_ie, received_wpa_ie_length, + sent_wpa_ie, sent_wpa_ie_length, + pairwise_key_cipher_suite, + group_key_cipher_suite ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::complete_reassociation() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::start_wpx_fast_roam_reassociation( + const network_id_c * old_network_id, + const network_id_c * new_network_id, + u8_t * reassociation_request_ie, + const u32_t reassociation_request_ie_length, + const u8_t* received_wpa_ie, + u32_t received_wpa_ie_length, + const u8_t* sent_wpa_ie, + u32_t sent_wpa_ie_length ) + { + DEBUG( "core_wlan_eapol_interface_c::start_wpx_fast_roam_reassociation()" ); + + authentication_type_m = wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam; + + core_error_e error = function.start_wpx_fast_roam_reassociation( + old_network_id, + new_network_id, + reassociation_request_ie, + reassociation_request_ie_length, + received_wpa_ie, + received_wpa_ie_length, + sent_wpa_ie, + sent_wpa_ie_length ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::start_wpx_fast_roam_reassociation() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::complete_wpx_fast_roam_reassociation( + const wlan_eapol_if_eapol_wlan_authentication_state_e reassociation_result, + const network_id_c * network_id, + u8_t * received_reassociation_ie, const u32_t received_reassociation_ie_length ) + { + DEBUG( "core_wlan_eapol_interface_c::complete_wpx_fast_roam_reassociation()" ); + core_error_e error = function.complete_wpx_fast_roam_reassociation( + reassociation_result, + network_id, + received_reassociation_ie, received_reassociation_ie_length ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::complete_wpx_fast_roam_reassociation() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::process_frame( + const core_frame_ethernet_c& frame ) + { + DEBUG( "core_wlan_eapol_interface_c::process_frame()" ); + + core_mac_address_s destination = + frame.destination(); + core_mac_address_s source = + frame.source(); + + network_id_c network_id( + const_cast( &source.addr[0] ), + MAC_ADDR_LEN, + &destination.addr[0], + MAC_ADDR_LEN, + frame.type() ); + + core_error_e error = function.packet_process( + &network_id, + frame.data(), frame.data_length() ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::process_frame() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::tkip_mic_failure( + const network_id_c * network_id, + const bool_t is_fatal_failure, + const wlan_eapol_if_eapol_tkip_mic_failure_type_e tkip_mic_failure_type ) + { + DEBUG( "core_wlan_eapol_interface_c::tkip_mic_failure()" ); + + core_error_e error = function.tkip_mic_failure( + network_id, + is_fatal_failure, + tkip_mic_failure_type ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::tkip_mic_failure() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +// +core_error_e core_wlan_eapol_interface_c::eap_acknowledge( + const network_id_c * network_id ) + { + DEBUG( "core_wlan_eapol_interface_c::eap_acknowledge()" ); + core_error_e error = function.eap_acknowledge( + network_id ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::eap_acknowledge() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +core_error_e core_wlan_eapol_interface_c::update_header_offset( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ) + { + DEBUG( "core_wlan_eapol_interface_c::update_header_offset()" ); + core_error_e error = function.update_header_offset( + header_offset, + MTU, + trailer_length ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::update_header_offset() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +core_error_e core_wlan_eapol_interface_c::update_wlan_database_reference_values( + u8_t * database_reference_value, const u32_t database_reference_value_length ) + { + DEBUG( "core_wlan_eapol_interface_c::update_wlan_database_reference_values()" ); + core_error_e error = function.update_wlan_database_reference_values( + database_reference_value, database_reference_value_length ); + + if ( error != core_error_ok ) + { + DEBUG1( "core_wlan_eapol_interface_c::update_wlan_database_reference_values() - Encoding function returns %i", error ); + return error; + } + core_wlan_eapol_interface_c::convert_if_status_to_core_error( + wlm_callback_m.process_data( function.get_data(), function.size()) ); + return error; + } + +//-------------------------------------------------- + +core_error_e core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list( + core_type_list_c & network_id_list ) + { + DEBUG1( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - network_id_list.count() = %i", network_id_list.count() ); + + completed_check_pmksa_cache_list.clear(); + + network_id_list.first(); + while ( network_id_list.current() ) + { + if ( network_id_list.current()->source_ptr ) + { + DEBUG( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - Adding mac address to completed_check_pmksa_cache_list" ); + core_mac_address_s * mac = new core_mac_address_s( + network_id_list.current()->source() ); + if ( !mac ) + { + DEBUG( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - new core_mac_address_s failed" ); + return core_error_no_memory; + } + + core_error_e error = completed_check_pmksa_cache_list.append( mac ); + if ( error != core_error_ok ) + { + delete mac; + mac = NULL; + DEBUG1( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - completed_check_pmksa_cache_list.append( mac ) failed with code %i", error ); + return error; + } + } + else + { + DEBUG( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - source == NULL" ); + } + + network_id_list.next(); + } + + DEBUG1( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - completed_check_pmksa_cache_list.count() %i", completed_check_pmksa_cache_list.count() ); + return core_error_ok; + } + +//-------------------------------------------------- + +core_type_list_c & core_wlan_eapol_interface_c::get_completed_check_pmksa_cache_list() + { + return completed_check_pmksa_cache_list; + } + +//-------------------------------------------------- + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_wlan_eapol_interface_c::store_frame( + const core_frame_ethernet_c& frame ) + { + DEBUG( "core_wlan_eapol_interface_c::store_frame()" ); + + if ( stored_frame_m ) + { + DEBUG( "core_wlan_eapol_interface_c::store_frame() - deleting previously stored frame" ); + + delete stored_frame_m; + stored_frame_m = NULL; + } + + stored_frame_m = core_frame_ethernet_c::instance( + frame.data_length(), frame.data(), true_t ); + if ( !stored_frame_m ) + { + DEBUG( "core_wlan_eapol_interface_c::store_frame() - unable to copy the frame" ); + + return core_error_no_memory; + } + + return core_error_ok; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wlan_eapol_interface_c::clear_stored_frame() + { + delete stored_frame_m; + stored_frame_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_wlan_eapol_interface_c::process_stored_frame() + { + if ( !stored_frame_m ) + { + DEBUG( "core_wlan_eapol_interface_c::store_frame() - no stored frame" ); + + return core_error_ok; + } + + core_error_e ret = process_frame( *stored_frame_m ); + clear_stored_frame(); + + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_eapol_operating_mode_e core_wlan_eapol_interface_c::operating_mode() const + { + return eapol_mode_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +wlan_eapol_ethernet_type_e core_wlan_eapol_interface_c::ethernet_type() const + { + if( eapol_mode_m == core_eapol_operating_mode_wapi ) + { + return wlan_eapol_ethernet_type_wapi; + } + + return wlan_eapol_ethernet_type_pae; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +wlan_eapol_if_eapol_key_authentication_type_e core_wlan_eapol_interface_c::authentication_type() const + { + return authentication_type_m; + } + +// End of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wpx_adaptation_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wpx_adaptation_stub.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub version of WPX adaptation. +* +*/ + +/* +* %version: 15 % +*/ + +#include "core_wpx_adaptation_stub.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_wpx_adaptation_stub_c::core_wpx_adaptation_stub_c() + { + DEBUG( "core_wpx_adaptation_stub_c::core_wpx_adaptation_stub_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_wpx_adaptation_stub_c::~core_wpx_adaptation_stub_c() + { + DEBUG( "core_wpx_adaptation_stub_c::~core_wpx_adaptation_stub_c()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_key_management_e core_wpx_adaptation_stub_c::wpx_key_management_suite( + const u8_t* /* oui */ ) + { + return core_key_management_none; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_wpx_adaptation_stub_c::get_wpx_key_management_oui( + core_key_management_e /* key_management */, + u8_t& /* data_length */, + u8_t* /* data */ ) + { + return core_error_not_supported; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_wpx_adaptation_stub_c::is_ap_wpx_compatible_with_iap( + core_connect_status_e& /* reason */, + const core_ap_data_c& /* ap_data */, + const core_iap_data_c& /* iap_data */ ) + { + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_wpx_adaptation_stub_c::handle_wpx_frame( + core_frame_type_e /* frame_type */, + u16_t /* frame_length */, + const u8_t* /* frame_data */ ) + { + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_wpx_roam_success( + const core_ap_data_c& /* ap_data */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_wpx_connection_stop() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_error_e core_wpx_adaptation_stub_c::handle_fast_roam_start_reassociation( + core_ap_data_c& /* ap_data */, + core_type_list_c& /* assoc_ie_list */ ) + { + return core_error_not_supported; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_fast_roam_reassoc_resp( + core_frame_assoc_resp_c* /* frame */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::get_association_request_wpx_ie( + core_ap_data_c& /* ap_data */, + core_type_list_c& /* assoc_ie_list */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_wpx_adaptation_stub_c::wpx_version( + core_frame_beacon_c* /* frame */ ) + { + return 0; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t core_wpx_adaptation_stub_c::max_tx_power_level( + core_frame_beacon_c* /* frame */ ) + { + return MAX_TX_POWER_LEVEL_NOT_DEFINED; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_ts_create_request( + const core_ap_data_c& /* ap_data */, + core_frame_dot11_c* /* frame */, + u8_t /* tid */, + const core_traffic_stream_params_s& /* tspec */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::get_wpx_traffic_stream_params( + core_frame_dot11_c* /* frame */, + u8_t /* tid */, + core_traffic_stream_params_s& /* tspec */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_traffic_stream_status_e core_wpx_adaptation_stub_c::get_wpx_traffic_stream_status( + u8_t /* status */ ) + { + return core_traffic_stream_status_inactive_other; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_association_response( + core_ap_data_c& /* ap_data */, + core_frame_assoc_resp_c* /* frame */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_ts_create_success( + core_frame_dot11_c* /* frame */, + u8_t /* tid */, + u8_t /* user_priority */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void core_wpx_adaptation_stub_c::handle_ts_delete( + u8_t /* tid */, + u8_t /* user_priority */ ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_wpx_adaptation_stub_c::is_wpx_management_status( + u32_t /* management_status */ ) + { + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t core_wpx_adaptation_stub_c::is_fatal_wpx_management_status( + u32_t /* management_status */ ) + { + return false_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_encryption_mode_e core_wpx_adaptation_stub_c::encryption_mode( + core_ap_data_c& /* ap_data */, + core_encryption_mode_e mode ) + { + return mode; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u16_t core_wpx_adaptation_stub_c::authentication_algorithm( + wlan_eapol_if_eapol_key_authentication_type_e /* eapol_auth_type */, + wlan_eapol_if_eapol_key_authentication_mode_e /* eapol_auth_mode */ ) + { + DEBUG( "core_wpx_adaptation_stub_c::authentication_algorithm() - using open authentication algorithm" ); + return core_authentication_mode_open; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +core_operation_base_c* core_wpx_adaptation_stub_c::get_wpx_load_drivers_operation() + { + return NULL; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wpx_adaptation_stub_factory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_wpx_adaptation_stub_factory.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Static factory class for instantiating a stub version WPX adaptation. +* +*/ + + +// ======== MEMBER FUNCTIONS ======== + +#include "core_wpx_adaptation_factory.h" +#include "core_wpx_adaptation_stub.h" + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +abs_core_wpx_adaptation_c* core_wpx_adaptation_factory_c::instance( + core_server_c* /* server */, + abs_core_driverif_c* /* drivers */, + abs_core_server_callback_c* /* adaptation */ ) + { + DEBUG( "core_wpx_adaptation_stub_factory::instance() " ); + + core_wpx_adaptation_stub_c* instance = new core_wpx_adaptation_stub_c(); + if ( !instance ) + { + DEBUG( "core_wpx_adaptation_stub_factory::instance() - unable to core_wpx_adaptation_stub_c" ); + return NULL; + } + + return instance; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscaninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscaninfo.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,405 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class to dig information of scan results. +* +*/ + + +#include "genscaninfo.h" +#include "genscaninfoie.h" + +// Default values for information element IDs. +const u8_t WPA_IE_ID = 221; +const u8_t SCAN_WPA_OUI_LENGTH = 4; +const u8_t SCAN_WPA_OUI[] = { 0x00, 0x50, 0xF2, 0x01 }; +const u8_t SCAN_WSC_OUI[] = { 0x00, 0x50, 0xF2, 0x04 }; + +const u8_t SCAN_OUI_TYPE_OFFSET = 3; +const u8_t SCAN_OUI_SUBTYPE_OFFSET = 4; + +/** Offset from AttributeType field to DataLength field */ +const u8_t SCAN_WSC_IE_DATA_LENGTH_OFFSET = 2; + +/** Offset from AttributeType field to Data field */ +const u8_t SCAN_WSC_IE_DATA_AREA_OFFSET = 4; + +/** Offset to first Protected Setup attribute type in IE */ +const u8_t SCAN_WSC_IE_PROTECTED_SETUP_DATA_OFFSET = 2+4; + +/** IDs for different data elements in WSC IE. */ +const u16_t SCAN_WSC_IE_AP_SETUP_LOCKED = 0x1057; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +ScanInfo::ScanInfo( const ScanList& scan_list ) : + ScanListIterator( scan_list ), + ie_iter_m( current_m + MGMT_BODY_OFFSET ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanSecurityMode ScanInfo::SecurityMode() + { + ScanInfoIe ie; + return ie.SecurityMode( *this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::InformationElement( + u8_t ie_id, + u8_t& ie_length, + const u8_t** ie_data ) + { + // IE is not found when the whole scan info element is gone through. + // + // The Element format is: + // +----+----+--...--+ + // | a | b | c | + // +----+----+--...--+ + // where + // a) Element ID (1 byte) + // b) Length (1 byte) + // c) Information (length bytes) + // + + u8_t ie, len; + const u8_t* data; + + if ( FirstIE( ie, len, &data ) != WlanScanError_Ok ) + { + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + WlanScanError ret( WlanScanError_Ok ); + + while ( ie != ie_id && ret == WlanScanError_Ok ) + { + ret = NextIE( ie, len, &data ); + } + + ie_length = len; + *ie_data = data; + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::WpaIE( + u8_t& ie_length, + const u8_t** ie_data ) + { + // Element format is: + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // | ID | Len | OUI | Ver | GKCS | PKCSC | PKSCL | AKMSC | AKMSL | RSNCap | + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // where + // ID = Element ID = 221 (1 octet) + // Len = Length (1 octet) + // OUI = 00:50:F2:01 (4 octets) + // Ver = Version (2 octets) + // GKCS = Group Key Cipher Suite (4 octets) + // PKCSC = Pairwise Key Cipher Suite Count (2 octets) + // PKCSL = Pairwise Key Cipher Suite List (4*m octets) + // AKMSC = Authenticated Key Management Suite Count (2 octets) + // AKMSL = Authenticated Key Management Suite List (4*n octets) + // RSNCap = RSN Capabilities + + u8_t ie( WPA_IE_ID ), len; + const u8_t* data; + + // Find out the first element + if ( InformationElement( WPA_IE_ID, len, &data ) != WlanScanError_Ok ) + { // Okay, it didn't exist. + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + // The ID is correct but check also the UID. + WlanScanError ret( WlanScanError_Ok ); + + while ( ret == WlanScanError_Ok && + ( ie != WPA_IE_ID || + len < SCAN_WPA_OUI_LENGTH || + !( data[0] == SCAN_WPA_OUI[0] && data[1] == SCAN_WPA_OUI[1] && + data[2] == SCAN_WPA_OUI[2] && data[3] == SCAN_WPA_OUI[3] ) ) ) + { + ret = NextIE( ie, len, &data ); + } + + // Check is the element was corrupted + if ( ie != WPA_IE_ID ) + { + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + ie_length = len; + *ie_data = data; + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::InformationElement( + u8_t ie_id, + const WlanIeOui& ie_oui, + u8_t ie_oui_type, + u8_t& ie_length, + const u8_t** ie_data ) + { + // Element format is: + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // | ID | Len | OUI | | | | | | | | + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // where + // ID = Element ID (1 octet) + // Len = Length (1 octet) + // OUI = OUI (3 octets) + // OUItyp = OUI Type (1 octet) + + u8_t ie( ie_id ); + u8_t len( 0 ); + const u8_t* data; + + // Find the first element + if ( InformationElement( ie_id, len, &data ) + != WlanScanError_Ok ) + { // Okay, it didn't exist. + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + // The ID is correct but also the OUI and OUI Type need to match + WlanScanError ret( WlanScanError_Ok ); + + while ( ret == WlanScanError_Ok && + ( ie != ie_id || + !( data[0] == ie_oui[0] && + data[1] == ie_oui[1] && + data[2] == ie_oui[2] + ) || + *( data + SCAN_OUI_TYPE_OFFSET ) != ie_oui_type + ) + ) + { + ret = NextIE( ie, len, &data ); + } + + // Check if the element is corrupted + if ( ie != ie_id ) + { + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + ie_length = len; + *ie_data = data; + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::InformationElement( + u8_t ie_id, + const WlanIeOui& ie_oui, + u8_t ie_oui_type, + u8_t ie_oui_subtype, + u8_t& ie_length, + const u8_t** ie_data ) + { + // Element format is: + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // | ID | Len | OUI | | | | | | | | + // +----+-----+-----+-----+------+-------+--...--+-------+--...--+--------+ + // where + // ID = Element ID (1 octet) + // Len = Length (1 octet) + // OUI = OUI (3 octets) + // OUItyp = OUI Type (1 octet) + + u8_t ie( ie_id ); + u8_t len( 0 ); + const u8_t* data; + + // Find the first element + if ( InformationElement( ie_id, len, &data ) + != WlanScanError_Ok ) + { // Okay, it didn't exist. + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + // The ID is correct but also the OUI and OUI Type need to match + WlanScanError ret( WlanScanError_Ok ); + + while ( ret == WlanScanError_Ok && + ( ie != ie_id || + !( data[0] == ie_oui[0] && + data[1] == ie_oui[1] && + data[2] == ie_oui[2] + ) || + *( data + SCAN_OUI_TYPE_OFFSET ) != ie_oui_type || + *( data + SCAN_OUI_SUBTYPE_OFFSET ) != ie_oui_subtype + ) + ) + { + ret = NextIE( ie, len, &data ); + } + + // Check if the element is corrupted + if ( ie != ie_id ) + { + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + ie_length = len; + *ie_data = data; + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::FirstIE( + u8_t& ie_id, + u8_t& ie_length, + const u8_t** ie_data ) + { + if( !current_m ) + { + return WlanScanError_IeNotFound; + } + ie_iter_m = current_m + MGMT_BODY_OFFSET; + return CurrentIE( ie_id, ie_length, ie_data ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::NextIE( + u8_t& ie_id, + u8_t& ie_length, + const u8_t** ie_data ) + { + if( !current_m ) + { + return WlanScanError_IeNotFound; + } + ie_iter_m += *( ie_iter_m + 1 ) + 2; + return CurrentIE( ie_id, ie_length, ie_data ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +WlanScanError ScanInfo::CurrentIE( + u8_t& ie_id, + u8_t& ie_length, + const u8_t** ie_data ) const + { + if ( !current_m || ie_iter_m >= current_m + Size() ) + { + ie_id = 0; + ie_length = 0; + *ie_data = NULL; + return WlanScanError_IeNotFound; + } + + ie_id = *ie_iter_m; + ie_length = *( ie_iter_m+1 ); + *ie_data = ie_iter_m+2; + return WlanScanError_Ok; +} + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t ScanInfo::IsProtectedSetupSupported() + { + u8_t ie_length = 0; + const u8_t* ie_data = NULL; + const WlanIeOui ie_oui = { SCAN_WSC_OUI[0], SCAN_WSC_OUI[1], SCAN_WSC_OUI[2] }; + const u8_t ie_oui_type = SCAN_WSC_OUI[3]; + + WlanScanError err = InformationElement( WPA_IE_ID, + ie_oui, ie_oui_type, + ie_length, &ie_data ); + + if (err == WlanScanError_IeNotFound + || ie_data == NULL + || ie_length == 0 ) + { + return false_t; + } + + // WSC IE is found, next check whether AP setup is locked (locked state would prevent use of Protected Setup) + return !IsApSetupLocked( ie_data, ie_length ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +bool_t ScanInfo::IsApSetupLocked( + const u8_t* ie_data, + const u8_t ie_length ) const + { + u16_t index( SCAN_WSC_IE_PROTECTED_SETUP_DATA_OFFSET ); + + while ( (index + SCAN_WSC_IE_DATA_LENGTH_OFFSET + 1) < ie_length) + { + // Make big endian to little endian conversion. + u16_t attribute_type = (ie_data[index]<<8) + | (ie_data[index+1]); + + u16_t attribute_data_length = (ie_data[index + SCAN_WSC_IE_DATA_LENGTH_OFFSET]<<8) + | (ie_data[index + SCAN_WSC_IE_DATA_LENGTH_OFFSET+1]); + + // Check if all attribute data does not fit current IE. + if ( ( index + attribute_data_length + SCAN_WSC_IE_DATA_AREA_OFFSET ) > ie_length) + { + // attribute does not fit current IE + return false_t; + } + + if (attribute_type == SCAN_WSC_IE_AP_SETUP_LOCKED) + { + // AP setup locked attribute found, return its value. + return ie_data[index + SCAN_WSC_IE_DATA_AREA_OFFSET]; + } + + // update index to start of next attribute + index += SCAN_WSC_IE_DATA_AREA_OFFSET + attribute_data_length; + } + // + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscaninfoie.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscaninfoie.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,318 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the ScanInfoIe class. +* +*/ + + +#include "genscaninfoie.h" + +// Defines the id byte of the RSN Information Element. +const u8_t SCANINFOIE_RSNIE_ID = 48; + +// Defines the static offsets for different fields in RSN IE. +const u32_t SCANINFOIE_RSNIE_GROUP_SUITE_OFFSET = 2; +const u32_t SCANINFOIE_RSNIE_PAIRWISE_SUITE_COUNT_OFFSET = 6; +const u32_t SCANINFOIE_RSNIE_PAIRWISE_SUITE_OFFSET = 8; + +// Defines the OUIs used in RSN IEs. +const u32_t SCANINFOIE_OUI_LENGTH = 4; +const u8_t SCANINFOIE_RSNIE_OUI_CCMP[] = { 0x00, 0x0F, 0xAC, 0x04 }; +const u8_t SCANINFOIE_RSNIE_OUI_EAP[] = { 0x00, 0x0F, 0xAC, 0x01 }; +const u8_t SCANINFOIE_RSNIE_OUI_PSK[] = { 0x00, 0x0F, 0xAC, 0x02 }; + +// Defines the static offsets for different fields in RSN IE. +const u32_t SCANINFOIE_WPAIE_PAIRWISE_SUITE_COUNT_OFFSET = 10; +const u32_t SCANINFOIE_WPAIE_PAIRWISE_SUITE_OFFSET = 12; + +// Defines the OUIs used in WPA IEs. +const u8_t SCANINFOIE_WPAIE_OUI_EAP[] = { 0x00, 0x50, 0xF2, 0x01 }; +const u8_t SCANINFOIE_WPAIE_OUI_PSK[] = { 0x00, 0x50, 0xF2, 0x02 }; + +// Defines the id byte of the WAPI Information Element. +const u8_t SCANINFOIE_WAPI_ID = 68; + +// Defines the static offsets for different fields in WAPI IE. +const u32_t SCANINFOIE_WAPI_KEY_MANAGEMENT_COUNT_OFFSET = 2; + +// Defines the OUIs used in WAPI IEs. +const u8_t SCANINFOIE_WAPI_OUI_CERTIFICATE[] = { 0x00, 0x14, 0x72, 0x01 }; +const u8_t SCANINFOIE_WAPI_OUI_PSK[] = { 0x00, 0x14, 0x72, 0x02 }; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +ScanInfoIe::ScanInfoIe() + { + } + +// Destructor +ScanInfoIe::~ScanInfoIe() + { + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +WlanSecurityMode ScanInfoIe::SecurityMode( + ScanInfo& info ) const + { + u8_t wpaie_length( 0 ); + const u8_t* wpaie_data = NULL; + u8_t rsnie_length( 0 ); + const u8_t* rsnie_data = NULL; + u8_t wapi_length( 0 ); + const u8_t* wapi_data = NULL; + + info.InformationElement( SCANINFOIE_RSNIE_ID, rsnie_length, &rsnie_data ); + info.WpaIE( wpaie_length, &wpaie_data ); + info.InformationElement( SCANINFOIE_WAPI_ID, wapi_length, &wapi_data ); + + if ( !info.Privacy() ) + { + if ( !wpaie_length && !rsnie_length ) + { + return WlanSecurityModeOpen; + } + return WlanSecurityMode802_1x; + } + + if ( !wpaie_length && !rsnie_length && !wapi_length ) + { + return WlanSecurityModeWep; + } + + if ( rsnie_length ) + { + if ( IsKeyManagement( + ScanInfoIeTypeRsn, + ScanInfoIeKeyManagementPsk, + rsnie_length, + rsnie_data ) ) + { + if ( IsWpa2Ciphers( + ScanInfoIeTypeRsn, + rsnie_length, + rsnie_data ) ) + { + return WlanSecurityModeWpa2Psk; + } + + return WlanSecurityModeWpaPsk; + } + else if ( IsKeyManagement( + ScanInfoIeTypeRsn, + ScanInfoIeKeyManagementEap, + rsnie_length, + rsnie_data ) ) + { + if ( IsWpa2Ciphers( + ScanInfoIeTypeRsn, + rsnie_length, + rsnie_data ) ) + { + return WlanSecurityModeWpa2Eap; + } + + return WlanSecurityModeWpaEap; + } + } + + if ( wpaie_length ) + { + if ( IsKeyManagement( + ScanInfoIeTypeWpa, + ScanInfoIeKeyManagementPsk, + wpaie_length, + wpaie_data ) ) + { + return WlanSecurityModeWpaPsk; + } + else if ( IsKeyManagement( + ScanInfoIeTypeWpa, + ScanInfoIeKeyManagementEap, + wpaie_length, + wpaie_data ) ) + { + return WlanSecurityModeWpaEap; + } + } + + if ( wapi_length ) + { + if ( IsKeyManagement( + ScanInfoIeTypeWapi, + ScanInfoIeKeyManagementWapiCertificate, + wapi_length, + wapi_data ) ) + { + return WlanSecurityModeWapi; + } + else if ( IsKeyManagement( + ScanInfoIeTypeWapi, + ScanInfoIeKeyManagementWapiPsk, + wapi_length, + wapi_data ) ) + { + return WlanSecurityModeWapiPsk; + } + } + + return WlanSecurityMode802_1x; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +int ScanInfoIe::Compare( + const unsigned char* pl, + int ll, + const unsigned char* pr, + int rl ) const + { + if ( ll != rl ) + { + return ll - rl; + } + + if ( pl == pr ) + { + return 0; + } + + for ( int i( 0 ); i < ll; ++i ) + { + if ( *(pl+i) != *(pr+i) ) + { + return *(pl+i) - *(pr+i); + } + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// + +bool_t ScanInfoIe::IsKeyManagement( + ScanInfoIeType ie_type, + ScanInfoIeKeyManagement key_type, + u8_t /* ie_length */, + const u8_t* ie_data ) const + { + const u8_t* key_data = NULL; + const u8_t* key_comp = NULL; + + if ( ie_type == ScanInfoIeTypeRsn ) + { + if ( key_type == ScanInfoIeKeyManagementEap ) + { + key_comp = &SCANINFOIE_RSNIE_OUI_EAP[0]; + } + else + { + key_comp = &SCANINFOIE_RSNIE_OUI_PSK[0]; + } + u32_t suites( *( ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_COUNT_OFFSET ) ); + key_data = ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_OFFSET + + ( suites * SCANINFOIE_OUI_LENGTH ); + } + else if ( ie_type == ScanInfoIeTypeWpa ) + { + if ( key_type == ScanInfoIeKeyManagementEap ) + { + key_comp = &SCANINFOIE_WPAIE_OUI_EAP[0]; + } + else + { + key_comp = &SCANINFOIE_WPAIE_OUI_PSK[0]; + } + u32_t suites( *( ie_data + SCANINFOIE_WPAIE_PAIRWISE_SUITE_COUNT_OFFSET ) ); + key_data = ie_data + SCANINFOIE_WPAIE_PAIRWISE_SUITE_OFFSET + + ( suites * SCANINFOIE_OUI_LENGTH ); + } + else + { + if ( key_type == ScanInfoIeKeyManagementWapiCertificate ) + { + key_comp = &SCANINFOIE_WAPI_OUI_CERTIFICATE[0]; + } + else + { + key_comp = &SCANINFOIE_WAPI_OUI_PSK[0]; + } + key_data = ie_data + SCANINFOIE_WAPI_KEY_MANAGEMENT_COUNT_OFFSET; + } + + u16_t key_suites( *key_data ); + key_data += sizeof( key_suites ); + + while ( key_suites-- ) + { + if ( !Compare( + key_data + ( key_suites * SCANINFOIE_OUI_LENGTH ), SCANINFOIE_OUI_LENGTH, + key_comp, SCANINFOIE_OUI_LENGTH ) ) + { + return true_t; + } + } + + return false_t; + }; + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +bool_t ScanInfoIe::IsWpa2Ciphers( + ScanInfoIeType ie_type, + u8_t /* ie_length */, + const u8_t* ie_data ) const + { + /** + * WPA IE is not used in WPA2 + */ + if ( ie_type == ScanInfoIeTypeWpa ) + { + return false_t; + } + + const u8_t* cipher = + ie_data + SCANINFOIE_RSNIE_GROUP_SUITE_OFFSET; + + if ( Compare( + cipher, SCANINFOIE_OUI_LENGTH, + &SCANINFOIE_RSNIE_OUI_CCMP[0], SCANINFOIE_OUI_LENGTH ) ) + { + return false_t; + } + + u32_t suites( *( ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_COUNT_OFFSET ) ); + cipher = ie_data + SCANINFOIE_RSNIE_PAIRWISE_SUITE_OFFSET; + + while ( suites-- ) + { + if ( !Compare( + cipher + ( suites * SCANINFOIE_OUI_LENGTH ), SCANINFOIE_OUI_LENGTH, + &SCANINFOIE_RSNIE_OUI_CCMP[0], SCANINFOIE_OUI_LENGTH ) ) + { + return true_t; + } + } + + return false_t; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlist.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,303 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the ScanList class. +* +*/ + + +#include "genscanlist.h" +#include "genscanoffsets.h" +#include "am_debug.h" + +/** The size IE header. */ +const u8_t IE_HEADER_SIZE = 2; +/** The offset for element ID field of an IE. */ +const u8_t IE_OFFSET_ELEMENT_ID = 0; +/** The offset for length field of an IE. */ +const u8_t IE_OFFSET_LENGTH = 1; +/** The number of mandatory IEs. */ +const u8_t MANDATORY_IE_LIST_SIZE = 3; +/** Array element IDs of mandatory IEs. */ +const u8_t MANDATORY_IE_LIST[] = + { 0, // SSID + 1, // Supported Rates + 3 }; // DS + +/** Defining this enables memory allocation related traces. */ +//#define SCANLIST_DEEP_DEBUG 1 + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +ScanList::ScanList() : + data_m( NULL ), + granularity_m( SCAN_LIST_DEFAULT_GRANULARITY ), + count_m( 0 ), + size_m( 0 ), + current_max_size_m( 0 ), + max_size_m( SCAN_LIST_DEFAULT_MAX_SIZE ) + { + DEBUG( "ScanList::ScanList()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +ScanList::ScanList( + u32_t max_size, + u32_t granularity ) : + data_m( NULL ), + granularity_m( granularity ), + count_m( 0 ), + size_m( 0 ), + current_max_size_m( 0 ), + max_size_m( max_size ) + { + DEBUG( "ScanList::ScanList()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +ScanList::~ScanList() + { + DEBUG( "ScanList::~ScanList()" ); + + delete data_m; + data_m = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t ScanList::Append( + u32_t data_length, + const ScanFrame* data ) + { + DEBUG( "ScanList::Append()" ); + +#ifdef SCANLIST_DEEP_DEBUG + DEBUG1( "ScanList::Append() - data_length %u", + data_length ); + DEBUG1( "ScanList::Append() - count_m %u", + count_m ); + DEBUG1( "ScanList::Append() - current_max_size_m %u", + current_max_size_m ); + DEBUG1( "ScanList::Append() - size_m %u", + size_m ); + + DEBUG1( "ScanList::Append() - data_length w/ padding %u", + AddPadding( data_length ) ); + DEBUG1( "ScanList::Append() - size left %u", + current_max_size_m - size_m ); +#endif // SCANLIST_DEEP_DEBUG + + if( !current_max_size_m || + AddPadding( data_length ) >= ( current_max_size_m - size_m ) ) + { + /** + * Grow the container by granularity_m bytes. + */ + const u32_t prev_max_size( current_max_size_m ); + SetCurrentMaxSize( current_max_size_m + granularity_m ); + if ( current_max_size_m == prev_max_size ) + { + return APPEND_FAILED_NO_MEMORY; + } + } + + /** + * Copy the frame to the container. + */ + Copy( + &data_m[size_m], + data, + data_length ); + + /** + * Make sure the frame is valid before accepting it. + */ + if ( CheckData( &data_m[size_m] ) ) + { + size_m += AddPadding( data_length ); + ++count_m; + } + + return size_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u32_t ScanList::SetCurrentMaxSize( + u32_t max_size ) + { + DEBUG( "ScanList::SetCurrentMaxSize()" ); + +#ifdef SCANLIST_DEEP_DEBUG + DEBUG1( "ScanList::SetCurrentMaxSize() - max_size %u", + max_size ); + DEBUG1( "ScanList::SetCurrentMaxSize() - current_max_size_m %u", + current_max_size_m ); + DEBUG1( "ScanList::SetCurrentMaxSize() - max_size_m %u", + max_size_m ); + DEBUG1( "ScanList::SetCurrentMaxSize() - size_m %u", + size_m ); +#endif // SCANLIST_DEEP_DEBUG + + if ( !max_size ) + { + ClearAll(); + + DEBUG1( "ScanList::SetCurrentMaxSize() - setting current_max_size_m to %u", + current_max_size_m ); + + return current_max_size_m; + } + + if ( max_size < size_m ) + { + DEBUG1( "ScanList::SetCurrentMaxSize() - keeping current_max_size_m as %u", + current_max_size_m ); + + return current_max_size_m; + } + + if ( max_size > max_size_m ) + { + if ( current_max_size_m == max_size_m ) + { + DEBUG1( "ScanList::SetCurrentMaxSize() - keeping current_max_size_m as %u", + current_max_size_m ); + + return current_max_size_m; + } + else + { + max_size = max_size_m; + } + } + + u8_t* buffer = new u8_t[max_size]; + if ( !buffer ) + { + return current_max_size_m; + } + + if ( data_m ) + { + Copy( + &buffer[0], + &data_m[0], + size_m ); + + delete data_m; + data_m = NULL; + } + + data_m = buffer; + current_max_size_m = max_size; + + DEBUG1( "ScanList::SetCurrentMaxSize() - setting current_max_size_m to %u", + current_max_size_m ); + + return current_max_size_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t ScanList::CheckData( + const ScanFrame* data ) const + { + /** + * Calculate the length of the data. + */ + u16_t size = static_cast( + *( reinterpret_cast( data + CNTRL_LENGTH_OFFSET ) ) + CNTRL_HEADER_LEN ); + + const u8_t* current_ie = NULL; + + /** + * Search mandatory IEs. + */ + for ( u8_t i( 0 ); i < MANDATORY_IE_LIST_SIZE; ++i ) + { + /* + * Go through all IEs. + */ + bool_t is_found( false_t ); + for ( current_ie = data + MGMT_BODY_OFFSET; + !is_found; + current_ie += current_ie[IE_OFFSET_LENGTH] + IE_HEADER_SIZE ) + { + if ( current_ie < data + size ) + { /** Still searching... */ + if ( current_ie[IE_OFFSET_ELEMENT_ID] == MANDATORY_IE_LIST[i] ) + { /** We have a match! Lets find out the next one. */ + is_found = true_t; + } + } + else + { /** The IE was not found. */ + return false_t; + } + } + } + + /** + * Data is OK. + */ + return true_t; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +u8_t* ScanList::Copy( + void* target, + const void* source, + u32_t data_length ) + { + if ( data_length <= 0 ) + { + return reinterpret_cast( target ); + } + + if ( target == source ) + { + return reinterpret_cast( target ) + data_length; + } + + /** + * Ensure areas do not overlap. + */ + if ( target > source ) + { + ASSERT( reinterpret_cast( target ) >= ( reinterpret_cast( source ) + data_length ) ); + } + else + { + ASSERT( reinterpret_cast( source ) >= ( reinterpret_cast( target ) + data_length ) ); + } + + for ( u32_t i( 0 ); i < data_length; ++i ) + { + *( reinterpret_cast( target ) + i ) = *( reinterpret_cast( source ) + i ); + } + + return reinterpret_cast( target ) + data_length; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlistiterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlistiterator.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the ScanListIterator class. +* +*/ + + +#include "genscanlist.h" +#include "genscanlistiterator.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +ScanListIterator::ScanListIterator( + const ScanList& scan_list ) : + current_m( &scan_list.data_m[0] ), + scan_list_m( scan_list ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const ScanFrame* ScanListIterator::First() + { + if ( !scan_list_m.size_m ) + { + return NULL; + } + + /** + * Data exist, set the iterator to the beginning of the container. + */ + current_m = &scan_list_m.data_m[0]; + return current_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const ScanFrame* ScanListIterator::Next() + { + if ( !scan_list_m.size_m ) + { + return NULL; + } + + current_m += ScanList::AddPadding( Size() ); + return Current(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +const ScanFrame* ScanListIterator::Current() const + { + if( current_m >= scan_list_m.data_m + scan_list_m.size_m ) + { + return NULL; + } + + return current_m; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool_t ScanListIterator::IsDone() const + { + return ( current_m >= scan_list_m.data_m + scan_list_m.size_m ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlandevicesettingsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlandevicesettingsu.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,9 @@ +EXPORTS + ?ReadL@CWlanDeviceSettings@@QAEXAAUSWlanDeviceSettings@1@@Z @ 1 NONAME ; void CWlanDeviceSettings::ReadL(struct CWlanDeviceSettings::SWlanDeviceSettings &) + ?GetDefaultSettings@CWlanDeviceSettings@@SAXAAUSWlanDeviceSettings@1@@Z @ 2 NONAME ; void CWlanDeviceSettings::GetDefaultSettings(struct CWlanDeviceSettings::SWlanDeviceSettings &) + ?NewL@CWlanDeviceSettings@@SAPAV1@XZ @ 3 NONAME ; class CWlanDeviceSettings * CWlanDeviceSettings::NewL(void) + ?WriteCenRepKeyL@CWlanDeviceSettings@@QBEXKH@Z @ 4 NONAME ; void CWlanDeviceSettings::WriteCenRepKeyL(unsigned long, int) const + ?WriteL@CWlanDeviceSettings@@QAEXABUSWlanDeviceSettings@1@@Z @ 5 NONAME ; void CWlanDeviceSettings::WriteL(struct CWlanDeviceSettings::SWlanDeviceSettings const &) + ?ReadL@CWlanDeviceSettings@@QAEXHAAUSWlanDeviceSettings@1@@Z @ 6 NONAME ; void CWlanDeviceSettings::ReadL(int, struct CWlanDeviceSettings::SWlanDeviceSettings &) + ??1CWlanDeviceSettings@@UAE@XZ @ 7 NONAME ; CWlanDeviceSettings::~CWlanDeviceSettings(void) + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmplatformu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmplatformu.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,12 @@ +EXPORTS + ??1CWlmPlatform@@UAE@XZ @ 1 NONAME ; CWlmPlatform::~CWlmPlatform(void) + ?GetCurrentOperatorMccL@CWlmPlatform@@QAEXAAI@Z @ 2 NONAME ; void CWlmPlatform::GetCurrentOperatorMccL(unsigned int &) + ?GetCurrentSystemMode@CWlmPlatform@@QAE?AW4TWlanSystemMode@@XZ @ 3 NONAME ; enum TWlanSystemMode CWlmPlatform::GetCurrentSystemMode(void) + ?GetScanType@CWlmPlatform@@QAE?AW4TWLMScanType@@XZ @ 4 NONAME ; enum TWLMScanType CWlmPlatform::GetScanType(void) + ?Initialize@CWlmPlatform@@QAEXXZ @ 5 NONAME ; void CWlmPlatform::Initialize(void) + ?IsWlanDisabled@CWlmPlatform@@QAEHXZ @ 6 NONAME ; int CWlmPlatform::IsWlanDisabled(void) + ?NewL@CWlmPlatform@@SAPAV1@AAVMWlmPlatformCallback@@@Z @ 7 NONAME ; class CWlmPlatform * CWlmPlatform::NewL(class MWlmPlatformCallback &) + ?PublishMacAddress@CWlmPlatform@@QAEHAAUTMacAddress@@@Z @ 8 NONAME ; int CWlmPlatform::PublishMacAddress(struct TMacAddress &) + ?SetIconState@CWlmPlatform@@QAEHW4TWlmIconStatus@@@Z @ 9 NONAME ; int CWlmPlatform::SetIconState(enum TWlmIconStatus) + ?InitializeSystemTimeHandler@CWlmPlatform@@QAEXXZ @ 10 NONAME ; void CWlmPlatform::InitializeSystemTimeHandler(void) + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserversrvu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserversrvu.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,4 @@ +EXPORTS + ?NewL@CWlmServer@@SAPAV1@XZ @ 1 NONAME ; class CWlmServer * CWlmServer::NewL(void) + ?StartServerThread@CWlmServer@@SAHXZ @ 2 NONAME ; int CWlmServer::StartServerThread(void) + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/bwinscw/wlmserveru.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,49 @@ +EXPORTS + ?CancelCreateTrafficStream@RWLMServer@@QAEXXZ @ 1 NONAME ; void RWLMServer::CancelCreateTrafficStream(void) + ?GetScanResults@RWLMServer@@QAEXAAVScanList@@ABVTDesC8@@AAHAAIAAVTRequestStatus@@@Z @ 2 NONAME ; void RWLMServer::GetScanResults(class ScanList &, class TDesC8 const &, int &, unsigned int &, class TRequestStatus &) + ?RunProtectedSetup@RWLMServer@@QAEXAAVTRequestStatus@@KAAVTDes8@@@Z @ 3 NONAME ; void RWLMServer::RunProtectedSetup(class TRequestStatus &, unsigned long, class TDes8 &) + ?RemoveIapSsidList@RWLMServer@@QAEHI@Z @ 4 NONAME ; int RWLMServer::RemoveIapSsidList(unsigned int) + ?ClearPacketStatistics@RWLMServer@@QAEXXZ @ 5 NONAME ; void RWLMServer::ClearPacketStatistics(void) + ?AddIapSsidList@RWLMServer@@QAEHIABV?$CArrayFixFlat@V?$TBuf8@$0CA@@@@@@Z @ 6 NONAME ; int RWLMServer::AddIapSsidList(unsigned int, class CArrayFixFlat > const &) + ?GetRegulatoryDomain@RWLMServer@@QAEHAAW4TWlanRegion@@@Z @ 7 NONAME ; int RWLMServer::GetRegulatoryDomain(enum TWlanRegion &) + ?GetBSSID@RWLMServer@@QAEHAAUTMacAddress@@@Z @ 8 NONAME ; int RWLMServer::GetBSSID(struct TMacAddress &) + ?CreateTrafficStream@RWLMServer@@QAEXAAVTRequestStatus@@ABVTWlanTrafficStreamParameters@@HAAIAAW4TWlanTrafficStreamStatus@@@Z @ 9 NONAME ; void RWLMServer::CreateTrafficStream(class TRequestStatus &, class TWlanTrafficStreamParameters const &, int, unsigned int &, enum TWlanTrafficStreamStatus &) + ?Close@RWLMServer@@QAEXXZ @ 10 NONAME ; void RWLMServer::Close(void) + ?GetPowerSaveMode@RWLMServer@@QAEHAAW4TWlanPowerSave@@@Z @ 11 NONAME ; int RWLMServer::GetPowerSaveMode(enum TWlanPowerSave &) + ?GetUapsdSettings@RWLMServer@@QAEHAAUTWlanUapsdSettings@@@Z @ 12 NONAME ; int RWLMServer::GetUapsdSettings(struct TWlanUapsdSettings &) + ?GetNetworkName@RWLMServer@@QAEHAAVTDes16@@@Z @ 13 NONAME ; int RWLMServer::GetNetworkName(class TDes16 &) + ?Release@RWLMServer@@QAEHXZ @ 14 NONAME ; int RWLMServer::Release(void) + ?CancelProtectedSetup@RWLMServer@@QAEXXZ @ 15 NONAME ; void RWLMServer::CancelProtectedSetup(void) + ?GetAccessPointInfo@RWLMServer@@QAEHAAUTWlanAccessPointInfo@@@Z @ 16 NONAME ; int RWLMServer::GetAccessPointInfo(struct TWlanAccessPointInfo &) + ?GetConnectionRCPI@RWLMServer@@QAEHAAJ@Z @ 17 NONAME ; int RWLMServer::GetConnectionRCPI(long &) + ?GetSecurityMode@RWLMServer@@QAEHAAW4TWlanSecurity@@@Z @ 18 NONAME ; int RWLMServer::GetSecurityMode(enum TWlanSecurity &) + ?DirectedRoam@RWLMServer@@QAEXAAVTRequestStatus@@ABUTMacAddress@@@Z @ 19 NONAME ; void RWLMServer::DirectedRoam(class TRequestStatus &, struct TMacAddress const &) + ?ActivateNotifiesL@RWLMServer@@QAEXAAVMWLMNotify@@K@Z @ 20 NONAME ; void RWLMServer::ActivateNotifiesL(class MWLMNotify &, unsigned long) + ?ConfigureMulticast@RWLMServer@@QAEHIABUTMacAddress@@@Z @ 21 NONAME ; int RWLMServer::ConfigureMulticast(unsigned int, struct TMacAddress const &) + ?GetPacketStatistics@RWLMServer@@QAEHAAUTWlanPacketStatistics@@@Z @ 22 NONAME ; int RWLMServer::GetPacketStatistics(struct TWlanPacketStatistics &) + ?SetUapsdSettings@RWLMServer@@QAEHABUTWlanUapsdSettings@@@Z @ 23 NONAME ; int RWLMServer::SetUapsdSettings(struct TWlanUapsdSettings const &) + ?AddBssidToRoguelist@RWLMServer@@QAEHABUTMacAddress@@@Z @ 24 NONAME ; int RWLMServer::AddBssidToRoguelist(struct TMacAddress const &) + ?GetRoamMetrics@RWLMServer@@QAEHAAUTWlanRoamMetrics@@@Z @ 25 NONAME ; int RWLMServer::GetRoamMetrics(struct TWlanRoamMetrics &) + ?CancelGetScanResults@RWLMServer@@QAEXXZ @ 26 NONAME ; void RWLMServer::CancelGetScanResults(void) + ?NotifyChangedPsmSrvMode@RWLMServer@@QAEHH@Z @ 27 NONAME ; int RWLMServer::NotifyChangedPsmSrvMode(int) + ?CancelGetAvailableIaps@RWLMServer@@QAEXXZ @ 28 NONAME ; void RWLMServer::CancelGetAvailableIaps(void) + ?GetRogueList@RWLMServer@@QAEHAAV?$CArrayFixSeg@V?$TBuf8@$05@@@@@Z @ 29 NONAME ; int RWLMServer::GetRogueList(class CArrayFixSeg > &) + ?CancelDirectedRoam@RWLMServer@@QAEXXZ @ 30 NONAME ; void RWLMServer::CancelDirectedRoam(void) + ?GetAcTrafficStatus@RWLMServer@@QAEHAAV?$TFixedArray@W4TWlmAcTrafficStatus@@$03@@@Z @ 31 NONAME ; int RWLMServer::GetAcTrafficStatus(class TFixedArray &) + ?GetScanResults@RWLMServer@@QAEHAAVScanList@@ABVTDesC8@@AAHAAI@Z @ 32 NONAME ; int RWLMServer::GetScanResults(class ScanList &, class TDesC8 const &, int &, unsigned int &) + ?GetAvailableIaps@RWLMServer@@QAEXAAVTDes8@@00AAVTRequestStatus@@@Z @ 33 NONAME ; void RWLMServer::GetAvailableIaps(class TDes8 &, class TDes8 &, class TDes8 &, class TRequestStatus &) + ?GetConnectionState@RWLMServer@@QAE?AW4TWlanConnectionState@@XZ @ 34 NONAME ; enum TWlanConnectionState RWLMServer::GetConnectionState(void) + ?CancelDeleteTrafficStream@RWLMServer@@QAEXXZ @ 35 NONAME ; void RWLMServer::CancelDeleteTrafficStream(void) + ?DeleteTrafficStream@RWLMServer@@QAEXAAVTRequestStatus@@I@Z @ 36 NONAME ; void RWLMServer::DeleteTrafficStream(class TRequestStatus &, unsigned int) + ?SetPowerSaveSettings@RWLMServer@@QAEHABUTWlanPowerSaveSettings@@@Z @ 37 NONAME ; int RWLMServer::SetPowerSaveSettings(struct TWlanPowerSaveSettings const &) + ?NotifyChangedSettings@RWLMServer@@QAEXXZ @ 38 NONAME ; void RWLMServer::NotifyChangedSettings(void) + ?GetSystemMode@RWLMServer@@QAEHAAW4TWlanSystemMode@@@Z @ 39 NONAME ; int RWLMServer::GetSystemMode(enum TWlanSystemMode &) + ?Join@RWLMServer@@QAEXAAVTRequestStatus@@KPAUTWLMOverrideSettings@@@Z @ 40 NONAME ; void RWLMServer::Join(class TRequestStatus &, unsigned long, struct TWLMOverrideSettings *) + ?GetAvailableIaps@RWLMServer@@QAEHAAUTWlmAvailableIaps@@AAHAAI@Z @ 41 NONAME ; int RWLMServer::GetAvailableIaps(struct TWlmAvailableIaps &, int &, unsigned int &) + ?CancelNotifies@RWLMServer@@QAEXXZ @ 42 NONAME ; void RWLMServer::CancelNotifies(void) + ?UpdateRcpNotificationBoundary@RWLMServer@@QAEHJJ@Z @ 43 NONAME ; int RWLMServer::UpdateRcpNotificationBoundary(long, long) + ?CancelJoin@RWLMServer@@QAEXXZ @ 44 NONAME ; void RWLMServer::CancelJoin(void) + ?Connect@RWLMServer@@QAEHXZ @ 45 NONAME ; int RWLMServer::Connect(void) + ?SetPowerSaveMode@RWLMServer@@QAEHW4TWlanPowerSaveMode@@@Z @ 46 NONAME ; int RWLMServer::SetPowerSaveMode(enum TWlanPowerSaveMode) + ?GetPowerSaveSettings@RWLMServer@@QAEHAAUTWlanPowerSaveSettings@@@Z @ 47 NONAME ; int RWLMServer::GetPowerSaveSettings(struct TWlanPowerSaveSettings &) + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/cenrep/keys_wlanengine.xls Binary file wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/cenrep/keys_wlanengine.xls has changed diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/conf/wlanengine.confml Binary file wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/conf/wlanengine.confml has changed diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/conf/wlanengine_101f8e44.crml Binary file wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/conf/wlanengine_101f8e44.crml has changed diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlandevicesettingsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlandevicesettingsu.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,11 @@ +EXPORTS + _ZN19CWlanDeviceSettings18GetDefaultSettingsERNS_19SWlanDeviceSettingsE @ 1 NONAME + _ZN19CWlanDeviceSettings4NewLEv @ 2 NONAME + _ZN19CWlanDeviceSettings5ReadLERNS_19SWlanDeviceSettingsE @ 3 NONAME + _ZN19CWlanDeviceSettings5ReadLEiRNS_19SWlanDeviceSettingsE @ 4 NONAME + _ZN19CWlanDeviceSettings6WriteLERKNS_19SWlanDeviceSettingsE @ 5 NONAME + _ZN19CWlanDeviceSettingsD0Ev @ 6 NONAME + _ZN19CWlanDeviceSettingsD1Ev @ 7 NONAME + _ZN19CWlanDeviceSettingsD2Ev @ 8 NONAME + _ZNK19CWlanDeviceSettings15WriteCenRepKeyLEmi @ 9 NONAME + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmplatformu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmplatformu.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,14 @@ +EXPORTS + _ZN12CWlmPlatform10InitializeEv @ 1 NONAME + _ZN12CWlmPlatform11GetScanTypeEv @ 2 NONAME + _ZN12CWlmPlatform12SetIconStateE14TWlmIconStatus @ 3 NONAME + _ZN12CWlmPlatform14IsWlanDisabledEv @ 4 NONAME + _ZN12CWlmPlatform17PublishMacAddressER11TMacAddress @ 5 NONAME + _ZN12CWlmPlatform20GetCurrentSystemModeEv @ 6 NONAME + _ZN12CWlmPlatform22GetCurrentOperatorMccLERj @ 7 NONAME + _ZN12CWlmPlatform4NewLER20MWlmPlatformCallback @ 8 NONAME + _ZN12CWlmPlatformD0Ev @ 9 NONAME + _ZN12CWlmPlatformD1Ev @ 10 NONAME + _ZN12CWlmPlatformD2Ev @ 11 NONAME + _ZN12CWlmPlatform27InitializeSystemTimeHandlerEv @ 12 NONAME + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserversrvu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserversrvu.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,4 @@ +EXPORTS + _ZN10CWlmServer17StartServerThreadEv @ 1 NONAME + _ZN10CWlmServer4NewLEv @ 2 NONAME + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/eabi/wlmserveru.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,49 @@ +EXPORTS + _ZN10RWLMServer10CancelJoinEv @ 1 NONAME + _ZN10RWLMServer12DirectedRoamER14TRequestStatusRK11TMacAddress @ 2 NONAME + _ZN10RWLMServer12GetRogueListER12CArrayFixSegI5TBuf8ILi6EEE @ 3 NONAME + _ZN10RWLMServer13GetSystemModeER15TWlanSystemMode @ 4 NONAME + _ZN10RWLMServer14AddIapSsidListEjRK13CArrayFixFlatI5TBuf8ILi32EEE @ 5 NONAME + _ZN10RWLMServer14CancelNotifiesEv @ 6 NONAME + _ZN10RWLMServer14GetNetworkNameER6TDes16 @ 7 NONAME + _ZN10RWLMServer14GetRoamMetricsER16TWlanRoamMetrics @ 8 NONAME + _ZN10RWLMServer14GetScanResultsER8ScanListRK6TDesC8RiRj @ 9 NONAME + _ZN10RWLMServer14GetScanResultsER8ScanListRK6TDesC8RiRjR14TRequestStatus @ 10 NONAME + _ZN10RWLMServer15GetSecurityModeER13TWlanSecurity @ 11 NONAME + _ZN10RWLMServer16GetAvailableIapsER17TWlmAvailableIapsRiRj @ 12 NONAME + _ZN10RWLMServer16GetAvailableIapsER5TDes8S1_S1_R14TRequestStatus @ 13 NONAME + _ZN10RWLMServer16GetPowerSaveModeER14TWlanPowerSave @ 14 NONAME + _ZN10RWLMServer16GetUapsdSettingsER18TWlanUapsdSettings @ 15 NONAME + _ZN10RWLMServer16SetPowerSaveModeE18TWlanPowerSaveMode @ 16 NONAME + _ZN10RWLMServer16SetUapsdSettingsERK18TWlanUapsdSettings @ 17 NONAME + _ZN10RWLMServer17ActivateNotifiesLER10MWLMNotifym @ 18 NONAME + _ZN10RWLMServer17GetConnectionRCPIERl @ 19 NONAME + _ZN10RWLMServer17RemoveIapSsidListEj @ 20 NONAME + _ZN10RWLMServer17RunProtectedSetupER14TRequestStatusmR5TDes8 @ 21 NONAME + _ZN10RWLMServer18CancelDirectedRoamEv @ 22 NONAME + _ZN10RWLMServer18ConfigureMulticastEjRK11TMacAddress @ 23 NONAME + _ZN10RWLMServer18GetAcTrafficStatusER11TFixedArrayI19TWlmAcTrafficStatusLi4EE @ 24 NONAME + _ZN10RWLMServer18GetAccessPointInfoER20TWlanAccessPointInfo @ 25 NONAME + _ZN10RWLMServer18GetConnectionStateEv @ 26 NONAME + _ZN10RWLMServer19AddBssidToRoguelistERK11TMacAddress @ 27 NONAME + _ZN10RWLMServer19CreateTrafficStreamER14TRequestStatusRK28TWlanTrafficStreamParametersiRjR24TWlanTrafficStreamStatus @ 28 NONAME + _ZN10RWLMServer19DeleteTrafficStreamER14TRequestStatusj @ 29 NONAME + _ZN10RWLMServer19GetPacketStatisticsER21TWlanPacketStatistics @ 30 NONAME + _ZN10RWLMServer19GetRegulatoryDomainER11TWlanRegion @ 31 NONAME + _ZN10RWLMServer20CancelGetScanResultsEv @ 32 NONAME + _ZN10RWLMServer20CancelProtectedSetupEv @ 33 NONAME + _ZN10RWLMServer20GetPowerSaveSettingsER22TWlanPowerSaveSettings @ 34 NONAME + _ZN10RWLMServer20SetPowerSaveSettingsERK22TWlanPowerSaveSettings @ 35 NONAME + _ZN10RWLMServer21ClearPacketStatisticsEv @ 36 NONAME + _ZN10RWLMServer21NotifyChangedSettingsEv @ 37 NONAME + _ZN10RWLMServer22CancelGetAvailableIapsEv @ 38 NONAME + _ZN10RWLMServer23NotifyChangedPsmSrvModeEi @ 39 NONAME + _ZN10RWLMServer25CancelCreateTrafficStreamEv @ 40 NONAME + _ZN10RWLMServer25CancelDeleteTrafficStreamEv @ 41 NONAME + _ZN10RWLMServer29UpdateRcpNotificationBoundaryEll @ 42 NONAME + _ZN10RWLMServer4JoinER14TRequestStatusmP20TWLMOverrideSettings @ 43 NONAME + _ZN10RWLMServer5CloseEv @ 44 NONAME + _ZN10RWLMServer7ConnectEv @ 45 NONAME + _ZN10RWLMServer7ReleaseEv @ 46 NONAME + _ZN10RWLMServer8GetBSSIDER11TMacAddress @ 47 NONAME + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/backup_registration.xml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for the WlanEng +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// DOMAIN EXPORTS + +// INTERNAL EXPORTS +../inc/am_platform_libraries.h |../../../../inc/am_platform_libraries.h +../inc/wlandevicesettings.h |../../../../inc/wlandevicesettings.h +../inc/rwlmserver.h |../../../../inc/rwlmserver.h +../inc/wlmnotify.h |../../../../inc/wlmnotify.h +../inc/wlmclientserver.h |../../../../inc/wlmclientserver.h +../inc/wlanmgmtpacket.h |../../../../inc/wlanmgmtpacket.h // used by EAPOL +../inc/gendebug.h |../../../../inc/gendebug.h +../inc/am_debug.h |../../../../inc/am_debug.h +../inc/am_debug.inl |../../../../inc/am_debug.inl +../../../wlan_common/wlanengine_common_3.1/inc/genscaninfo.h |../../../../inc/genscaninfo.h +../../../wlan_common/wlanengine_common_3.1/inc/genscaninfo.inl |../../../../inc/genscaninfo.inl +../../../wlan_common/wlanengine_common_3.1/inc/genscanlist.h |../../../../inc/genscanlist.h +../../../wlan_common/wlanengine_common_3.1/inc/genscanlist.inl |../../../../inc/genscanlist.inl +../../../wlan_common/wlanengine_common_3.1/inc/genscanlistiterator.h |../../../../inc/genscanlistiterator.h +../../../wlan_common/wlanengine_common_3.1/inc/genscanlistiterator.inl |../../../../inc/genscanlistiterator.inl +../../../wlan_common/wlanengine_common_3.1/inc/genscanoffsets.h |../../../../inc/genscanoffsets.h + + +// Export backup registration file +backup_registration.xml /epoc32/data/z/private/101f8ec5/backup_registration.xml +backup_registration.xml /epoc32/release/winscw/udeb/z/private/101f8ec5/backup_registration.xml +backup_registration.xml /epoc32/release/winscw/urel/z/private/101f8ec5/backup_registration.xml + +// Export iby file +../rom/wlaneng.iby CORE_OS_LAYER_IBY_EXPORT_PATH(wlaneng.iby) + +../conf/wlanengine.confml OS_LAYER_CONFML(wlanengine.confml) +../conf/wlanengine_101f8e44.crml OS_LAYER_CRML(wlanengine_101f8e44.crml) + + +PRJ_MMPFILES +wlanscanlist.mmp +wlandevicesettings.mmp +wlmplatform.mmp +wlmserver.mmp +wlmserversrv.mmp +wlmserverexe.mmp +wlanmgmtimpl.mmp +wlancontrolimpl.mmp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlancontrolimpl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlancontrolimpl.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlancontrolimpl. +* +*/ + + +#include + +TARGET wlancontrolimpl.dll +TARGETTYPE plugin +UID 0x10009d8d 0x10282e0d + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wlancontrolimpl.cpp + +START RESOURCE ../src/10282e0d.rss +TARGET wlancontrolimpl +END // RESOURCE + +USERINCLUDE ../inc +USERINCLUDE ../../../wlan_common/wlanengine_common_3.1/inc +USERINCLUDE ../../../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY wlmserver.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlandevicesettings.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlandevicesettings.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for wlandevicesettings. +* +*/ + + +#include + +TARGET wlandevicesettings.dll +TARGETTYPE dll +UID 0x1000008d 0x101f8e44 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wlandevicesettings.cpp + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#else +DEFFILE ../bwinscw/ +#endif + +USERINCLUDE ../inc +USERINCLUDE ../../../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY commdb.lib +LIBRARY edbms.lib +DEBUGLIBRARY flogger.lib +LIBRARY centralrepository.lib +LIBRARY commsdat.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlanmgmtimpl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlanmgmtimpl.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for the CWlanMgmtImpl +* +*/ + + +#include + +TARGET wlanmgmtimpl.dll +TARGETTYPE plugin +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +UID 0x10009d8d 0x101f8efd + +SOURCEPATH ../src +SOURCE wlanmgmtimpl.cpp +SOURCE wlanscaninfoimpl.cpp + +START RESOURCE ../src/101f8efd.rss +TARGET wlanmgmtimpl +END + +USERINCLUDE ../inc +USERINCLUDE ../../../wlan_common/wlanengine_common_3.1/inc +USERINCLUDE ../../../../inc +OS_LAYER_SYSTEMINCLUDE + +//MACRO DEBUG_LEVEL=0x0000000FF + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY wlmserver.lib + +STATICLIBRARY wlanscanlist.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlanscanlist.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlanscanlist.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlanscanlist +* +*/ + + +#include + +TARGET wlanscanlist.lib +TARGETTYPE lib + +VENDORID VID_DEFAULT + +USERINCLUDE ../../../wlan_common/wlanengine_common_3.1/inc +USERINCLUDE ../../../../inc + +SOURCEPATH ../../../wlan_common/wlanengine_common_3.1/src + +SOURCE genscaninfo.cpp +SOURCE genscanlist.cpp +SOURCE genscanlistiterator.cpp +SOURCE genscaninfoie.cpp + +OS_LAYER_SYSTEMINCLUDE diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmplatform.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmplatform.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for the CWlmPlatform +* +*/ + + +#include + +TARGET wlmplatform.dll +TARGETTYPE DLL +UID 0x1000008d 0x1020738e +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#else +DEFFILE ../bwinscw/ +#endif + +SOURCEPATH ../src +SOURCE wlmplatform.cpp +SOURCE wlmplatformdata.cpp +SOURCE wlmplatformsubscriber.cpp +SOURCE wlansystemtimehandler.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY etel.lib +LIBRARY etelmm.lib +LIBRARY centralrepository.lib +LIBRARY bafl.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserver.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for the WlanEng +* +*/ + + +#include + +TARGET wlmserver.dll +TARGETTYPE dll +UID 0x1000008d 0x101f8e46 +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#if defined( ARMCC ) +DEFFILE ../eabi/ +#else +DEFFILE ../bwinscw/ +#endif + +SOURCEPATH ../src +SOURCE rwlmserver.cpp +SOURCE wlmnotify.cpp +SOURCE wlmscanrequest.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../wlan_common/wlanengine_common_3.1/inc +USERINCLUDE ../../../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib + +STATICLIBRARY wlanscanlist.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserverexe.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserverexe.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for the WlanEng +* +*/ + + +#include + +TARGET wlmserverexe.exe +TARGETTYPE exe +UID 0x1000008c 0x101f8ec5 +CAPABILITY CAP_SERVER CommDD NetworkControl +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE wlmserverexe.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../wlan_common/wlanengine_common_3.1/inc +USERINCLUDE ../../../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY wlmserversrv.lib +LIBRARY ecom.lib + +EPOCPROCESSPRIORITY high +EPOCSTACKSIZE 0x3000 diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserversrv.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserversrv.mmh Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This file contains all build information which is not depending on whether WPX exists or not. +*/ + +/* +* %version: 8 % +*/ + +TARGETTYPE dll +UID 0x1000008d 0x101f8ec4 +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#if defined( ARMCC ) +DEFFILE ../eabi/wlmserversrv.def +#else +DEFFILE ../bwinscw/wlmserversrv.def +#endif + +SOURCEPATH ../../../wlan_common/wlanengine_common_3.1/src +SOURCE core_server.cpp +SOURCE core_server_factory.cpp +SOURCE core_operation_base.cpp +SOURCE core_operation_update_device_settings.cpp +SOURCE core_operation_update_power_mode.cpp +SOURCE core_operation_update_rxtx_parameters.cpp +SOURCE core_operation_update_tx_rate_policies.cpp +SOURCE core_operation_scan.cpp +SOURCE core_operation_get_available_iaps.cpp +SOURCE core_operation_connect.cpp +SOURCE core_operation_release.cpp +SOURCE core_operation_unload_drivers.cpp +SOURCE core_operation_configure_multicast_group.cpp +SOURCE core_operation_roam.cpp +SOURCE core_operation_check_rcpi.cpp +SOURCE core_operation_handle_bss_lost.cpp +SOURCE core_operation_handle_frame.cpp +SOURCE core_operation_handle_delete_ts.cpp +SOURCE core_operation_handle_measurement_request.cpp +SOURCE core_operation_handle_neighbor_response.cpp +SOURCE core_operation_null.cpp +SOURCE core_operation_get_rcpi.cpp +SOURCE core_operation_ibss_merge.cpp +SOURCE core_operation_get_statistics.cpp +SOURCE core_operation_set_uapsd_settings.cpp +SOURCE core_operation_set_power_save_settings.cpp +SOURCE core_operation_create_ts.cpp +SOURCE core_operation_delete_ts.cpp +SOURCE core_operation_protected_setup.cpp +SOURCE core_operation_power_save_test.cpp +SOURCE core_operation_set_arp_filter.cpp +SOURCE core_operation_directed_roam.cpp +SOURCE core_sub_operation_echo_test.cpp +SOURCE core_sub_operation_load_drivers.cpp +SOURCE core_sub_operation_connect.cpp +SOURCE core_sub_operation_adhoc.cpp +SOURCE core_sub_operation_wpa_connect.cpp +SOURCE core_sub_operation_set_static_wep.cpp +SOURCE core_sub_operation_roam_scan.cpp +SOURCE core_sub_operation_roam_update_ts.cpp +SOURCE core_sub_operation_create_ts.cpp +SOURCE core_sub_operation_wep_connect.cpp +SOURCE core_settings.cpp +SOURCE core_ap_data.cpp +SOURCE core_connection_data.cpp +SOURCE core_iap_data.cpp +SOURCE core_tools.cpp +SOURCE core_tools_parser.cpp +SOURCE core_eapol_handler.cpp +SOURCE core_timer_counter_measures.cpp +SOURCE core_frame_action.cpp +SOURCE core_frame_action_rm.cpp +SOURCE core_frame_action_nr.cpp +SOURCE core_frame_action_wmm.cpp +SOURCE core_frame_radio_measurement_action.cpp +SOURCE core_frame_assoc_resp.cpp +SOURCE core_frame_dot11.cpp +SOURCE core_frame_dot11_ie.cpp +SOURCE core_frame_mgmt_ie.cpp +SOURCE core_frame_rm_ie.cpp +SOURCE core_frame_rm_ie_beacon_report.cpp +SOURCE core_frame_rm_ie_beacon_report_ie.cpp +SOURCE core_frame_rm_ie_beacon_report_frame_body_ie.cpp +SOURCE core_frame_rm_ie_beacon_request.cpp +SOURCE core_frame_rm_ie_beacon_request_ie.cpp +SOURCE core_frame_rm_ie_beacon_request_detail_ie.cpp +SOURCE core_frame_nr_ie.cpp +SOURCE core_frame_rsn_ie.cpp +SOURCE core_frame_wpa_ie.cpp +SOURCE core_frame_wmm_ie.cpp +SOURCE core_frame_wmm_ie_tspec.cpp +SOURCE core_frame_wsc_ie.cpp +SOURCE core_frame_qbss_load_ie.cpp +SOURCE core_frame_tim_ie.cpp +SOURCE core_frame_beacon.cpp +SOURCE core_frame_echo_test.cpp +SOURCE core_frame_ethernet.cpp +SOURCE core_frame_wapi_ie.cpp +SOURCE core_scan_list.cpp +SOURCE core_scan_list_iterator.cpp +SOURCE core_scan_channels.cpp +SOURCE core_traffic_stream.cpp +SOURCE core_traffic_stream_list.cpp +SOURCE core_traffic_stream_list_iter.cpp +SOURCE core_virtual_traffic_stream.cpp +SOURCE core_virtual_traffic_stream_list.cpp +SOURCE core_virtual_traffic_stream_list_iter.cpp +SOURCE core_roam_metrics.cpp +SOURCE core_wlan_eapol_interface.cpp +SOURCE core_wlan_eapol_if_message.cpp + +SOURCEPATH ../src +SOURCE wlmtimer.cpp +SOURCE wlmtimerfactory.cpp +SOURCE wlmnotification.cpp +SOURCE wlmserver.cpp +SOURCE wlmsession.cpp +SOURCE wlmdriverif.cpp +SOURCE wlanmgmtcommandhandler.cpp +SOURCE wlannotificationhandler.cpp +SOURCE wlanmgmtframehandler.cpp +SOURCE wlanscanresultcache.cpp +SOURCE wlancbwaiter.cpp +SOURCE wlanconversionutil.cpp +SOURCE wlmtools.cpp +SOURCE wlangenericplugin.cpp +SOURCE wlanssidlist.cpp +SOURCE wlanssidlistdb.cpp +SOURCE wlanbgscan.cpp +SOURCE wlanbgscanawscomms.cpp +SOURCE wlanbgscancommand.cpp +SOURCE wlantimerservices.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../inc +USERINCLUDE ../../../wlan_common/wlanengine_common_3.1/inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY esock.lib +LIBRARY insock.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib + +LIBRARY wlandevicesettings.lib +LIBRARY wlmplatform.lib +LIBRARY wlanhwinit.lib +LIBRARY wlandbif.lib +LIBRARY featmgr.lib +LIBRARY commsdat.lib + +STATICLIBRARY wlanscanlist.lib diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserversrv.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/group/wlmserversrv.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains only non-WPX specific information. +* +*/ + + +#include + +TARGET wlmserversrv.dll + +#include "wlmserversrv.mmh" + +SOURCEPATH ../../../wlan_common/wlanengine_common_3.1/src +SOURCE core_wpx_adaptation_stub_factory.cpp +SOURCE core_wpx_adaptation_stub.cpp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/am_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/am_debug.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debug utilities +* +*/ + + +#ifndef AM_DEBUG_H +#define AM_DEBUG_H + +#include + +#ifdef _DEBUG + +/** +* Class for producing debug traces +* @lib +* @since Series 60 3.0 +*/ +class Debug + { + public: + static inline void PrintBuffer( TUint aLength, const TUint8* aData ); + static inline void PrintString( const TDesC& aString, TUint aLength, const TUint8* aData ); + static inline void PrintTimestamp( const TDesC& aString ); + static inline void PrintRates( const TDesC& aString, TUint aRates ); + }; + +#define DEBUG(a) RDebug::Print(_L(a)) +#define DEBUG1(a,b) RDebug::Print(_L(a),b) +#define DEBUG2(a,b,c) RDebug::Print(_L(a),b,c) +#define DEBUG3(a,b,c,d) RDebug::Print(_L(a),b,c,d) +#define DEBUG4(a,b,c,d,e) RDebug::Print(_L(a),b,c,d,e) +#define DEBUG5(a,b,c,d,e,f) RDebug::Print(_L(a),b,c,d,e,f) +#define DEBUG6(a,b,c,d,e,f,g) RDebug::Print(_L(a),b,c,d,e,f,g) +#define DEBUG7(a,b,c,d,e,f,g,h) RDebug::Print(_L(a),b,c,d,e,f,g,h) +#define DEBUG8(a,b,c,d,e,f,g,h,i) RDebug::Print(_L(a),b,c,d,e,f,g,h,i) +#define DEBUG9(a,b,c,d,e,f,g,h,i,j) RDebug::Print(_L(a),b,c,d,e,f,g,h,i,j) +#define DEBUG_MAC(a) RDebug::Print(_L("%02X%02X%02X%02X%02X%02X"),a[0],a[1],a[2],a[3],a[4],a[5]) +#define DEBUG_RATES(a,b) Debug::PrintRates(_L(a),b) +#define DEBUG_BUFFER(a,b) Debug::PrintBuffer(a,b) +#define DEBUG1S(a,b,c) Debug::PrintString(_L(a),b,c) +#define DEBUGT(a) Debug::PrintTimestamp(_L(a)) + +#include "am_debug.inl" + +#else // _DEBUG + +#define DEBUG(a) /* _DEBUG is not defined. */ +#define DEBUG1(a,b) /* _DEBUG is not defined. */ +#define DEBUG2(a,b,c) /* _DEBUG is not defined. */ +#define DEBUG3(a,b,c,d) /* _DEBUG is not defined. */ +#define DEBUG4(a,b,c,d,e) /* _DEBUG is not defined. */ +#define DEBUG5(a,b,c,d,e,f) /* _DEBUG is not defined. */ +#define DEBUG6(a,b,c,d,e,f,g) /* _DEBUG is not defined. */ +#define DEBUG7(a,b,c,d,e,f,g,h) /* _DEBUG is not defined. */ +#define DEBUG8(a,b,c,d,e,f,g,h,i) /* _DEBUG is not defined. */ +#define DEBUG9(a,b,c,d,e,f,g,h,i,j) /* _DEBUG is not defined. */ +#define DEBUG_MAC(a) /* _DEBUG is not defined. */ +#define DEBUG_RATES(a,b) /* _DEBUG is not defined. */ +#define DEBUG_BUFFER(a,b) /* _DEBUG is not defined. */ +#define DEBUG1S(a,b,c) /* _DEBUG is not defined. */ +#define DEBUGT(a) /* _DEBUG is not defined. */ + +#endif // _DEBUG + +#endif // AM_DEBUG_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/am_debug.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/am_debug.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debug utilities +* +*/ + + +#include + + +const TUint KPrintLineLength = 300; +const TUint KPrintHexPerLine = 8; +const TUint KPrintHexLineLength = KPrintHexPerLine * 3; + +// ----------------------------------------------------------------------------- +// Debug::PrintBuffer +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintBuffer( TUint aLength, const TUint8* aData ) + { + ASSERT( aData != NULL); + TBuf line; + TUint idx( 0 ); + for ( ; idx < aLength; ++idx ) + { + if ( idx && !( idx % KPrintHexPerLine ) ) + { + RDebug::Print( line ); + line.Zero(); + } + line.AppendFormat( _L( "%02X " ), aData[idx] ); + } + RDebug::Print( line ); + } + +// ----------------------------------------------------------------------------- +// Debug::PrintString +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintString( const TDesC& aString, TUint aLength, const TUint8* aData ) + { + TBuf line; + + line.Append( aString ); + + TPtrC8 buf8( aData, aLength ); + + TBuf buf16; + buf16.Copy( buf8 ); + + line.Append( buf16 ); + + RDebug::Print( _L( "%S" ), &line ); + } + +// ----------------------------------------------------------------------------- +// Debug::PrintTimestamp +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintTimestamp( const TDesC& aString ) + { + TBuf line; + TTime time; + time.HomeTime(); + + time.FormatL( line, _L( "%H:%T:%S:%C" ) ); + line.Append( _L( " " ) ); + line.Append( aString ); + + RDebug::Print( line ); + } + +// ----------------------------------------------------------------------------- +// Debug::PrintRates +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintRates( const TDesC& aString, TUint aRates ) + { + TBuf line; + line.Append( aString ); + + if ( aRates & TWlanRate54mbit ) + { + line.Append( _L( "54Mbit/s " ) ); + } + if ( aRates & TWlanRate48mbit ) + { + line.Append( _L( "48Mbit/s " ) ); + } + if ( aRates & TWlanRate36mbit ) + { + line.Append( _L( "36Mbit/s " ) ); + } + if ( aRates & TWlanRate33mbit ) + { + line.Append( _L( "33Mbit/s " ) ); + } + if ( aRates & TWlanRate24mbit ) + { + line.Append( _L( "24Mbit/s " ) ); + } + if ( aRates & TWlanRate22mbit ) + { + line.Append( _L( "22Mbit/s " ) ); + } + if ( aRates & TWlanRate18mbit ) + { + line.Append( _L( "18Mbit/s " ) ); + } + if ( aRates & TWlanRate12mbit ) + { + line.Append( _L( "12Mbit/s " ) ); + } + if ( aRates & TWlanRate11mbit ) + { + line.Append( _L( "11Mbit/s " ) ); + } + if ( aRates & TWlanRate9mbit ) + { + line.Append( _L( "9Mbit/s " ) ); + } + if ( aRates & TWlanRate6mbit ) + { + line.Append( _L( "6Mbit/s " ) ); + } + if ( aRates & TWlanRate5p5mbit ) + { + line.Append( _L( "5.5Mbit/s " ) ); + } + if ( aRates & TWlanRate2mbit ) + { + line.Append( _L( "2Mbit/s " ) ); + } + if ( aRates & TWlanRate1mbit ) + { + line.Append( _L( "1Mbit/s " ) ); + } + + RDebug::Print( line ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/am_platform_libraries.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/am_platform_libraries.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Symbian definitions for the core engine data types +* +*/ + + +#ifndef AM_PLATFORM_LIBRARIES_H +#define AM_PLATFORM_LIBRARIES_H + +#ifndef __KERNEL_MODE__ +#include +#else +#include +#endif // __KERNEL__MODE + +/** +* The basic types cannot be included from EAPOL because +* they include user-space headers that is prohibited in +* kernel code. +* +* Therefore, we simply copy the basic types for kernel +* code. +*/ + +/** JPHC++ definitions */ +typedef signed char i8_t; +typedef unsigned char u8_t; +typedef short int i16_t; +typedef unsigned short int u16_t; +typedef long int i32_t; +typedef unsigned long int u32_t; + +#if defined(__WINSCW__) + /// This is signed 64-bit integer. + typedef long long i64_t; +#elif defined(__GNUC__) + /// This is signed 64-bit integer. + typedef long long i64_t; +#else + /// This is signed 64-bit integer. + typedef __int64 i64_t; +#endif + +#if defined(__WINSCW__) + /// This is unsigned 64-bit integer. + typedef unsigned long long u64_t; +#elif defined(__GNUC__) + /// This is unsigned 64-bit integer. + typedef unsigned long long u64_t; +#else + /// This is unsigned 64-bit integer. Actually there is not unsigned version. + typedef __int64 u64_t; +#endif + +/** NOC++ definitions */ +typedef int int_t; +typedef unsigned int uint_t; +typedef unsigned char text8_t; +typedef unsigned short int text16_t; + +typedef int bool_t; +enum _false_t { false_t = 0 }; +enum _true_t { true_t = 1 }; + +#endif // AM_PLATFORM_LIBRARIES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/gendebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/gendebug.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains methods for debug traces both in user space and kernel. +* +*/ + + +#ifndef GENDEBUG_H +#define GENDEBUG_H + +#ifndef __KERNEL_MODE__ +#include +#endif // __KERNEL_MODE__ + +/** @file gendebug.h + @brief Common helper file for debugging. + + The file contains methods for adding traces and hardcoded breakpoint. + + @page page1 A documentation for general helper module for doing debugging and tracing. + + @subsection subsec1 This subsection describes the usage of hardcoded breakpoints. + + Hardcoded breakpoints are usefull for allowing the execution to stop in right places + without bringing the OS down like using general assertions would do. Hardcoded breakpoints + must be used together with debugger. The hardcoded breakpoints are used by inserting + macro _DBG_MUST_BREAK into source code. + + @note This feature has not been implemented yet. + + @subsection subsec2 This subsection describes the usage of trace utilities. + + Tracing is the most important way of doing HW level debugging (after looking the source of course). + Most of times users don't have access to debuggers and doing debugging in the field can be greatly + improved if there are great variety of configurable traces available. + + In order to use the macro in kernel space, ALWAYS_KERNEL must be defined in the MMP-file of the module. + + To use static tracing the module using these utilities must have defined DEBUG_LEVEL (this is integer constant) in + MMP-file. This constant defines the bit-mask for the set of traces, which are put into code at the compile time. See + the macro definitions for details. + + The other way to do tracing is to use run-time tracing, which requires from user to put class member variable iDbgLevel + into their class. This variable is used the same way as the static flag by using bit-mask to define enabled traces. See + the macro definitions for details. +*/ + +#if defined(_DEBUG) +#define _DBG_MUST_BREAK +#else +#define _DBG_MUST_BREAK +#endif + +/** + * Disable useless "macro 'xxxx' could become const variable" lint warnings. + */ +//lint -save -e1923 + +/** Critical trace-level is used when system is about to down very soon because of critical error. + In most cases this trace level can be replaced by using assert with trace but in some cases + more information can be provided by using this debug level +*/ +#define CRIT_LEVEL 0x00000001 + +/** Serious trace-level is used when something bad and unexpected has happened but system might be + able to recover. In another words, software is not going to bring system forcefully down but + that's exactly what might happen due to an error. +*/ +#define SERIOUS_LEVEL 0x00000002 + +/* Error level is used to trace various errors, which are due to legal errors in normal operation. */ +#define ERROR_LEVEL 0x00000004 + +/* Warning level is used to trace various warning, which are due to abnormal behaviour. */ +#define WARNING_LEVEL 0x00000008 + +/* Info level is used to trace all general information. */ +#define INFO_LEVEL 0x00000010 + +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_1 0x000010000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_2 0x000020000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_3 0x000040000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_4 0x000080000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_5 0x000100000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_6 0x000200000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_7 0x000400000 +/* User definable trace level. This comment and definition should be replaced by the real usage. */ +#define USER_DEFINED_8 0x000800000 + +#define DEVICE_1_MASK 0x0000f000 +#define DEVICE_2_MASK 0x000f0000 +#define DEVICE_3_MASK 0x00f00000 +#define DEVICE_4_MASK 0x0f000000 + +// Override debug-level definition for your own in MMP file +#ifndef DEBUG_LEVEL +#define DEBUG_LEVEL 0x000000FF +#endif + +//lint -restore + +#pragma warning(disable : 4127) // conditional expression is constant + +#if defined(_DEBUG) || defined(TRACES) + +// Do not directly use this macro +//lint -emacro({717}, UtilDump) do while(0) +//lint -emacro({774}, UtilDump) conditional expression is constant +#define UtilDump(PFUNCTION,SRCLEVEL,TRGLEVEL,STRING) \ + do { \ + TUint32 _level = (TRGLEVEL); \ + if (SRCLEVEL & _level) { \ + PFUNCTION STRING; \ + } \ + } while (0) + + +#if defined __MOMAP15XX__ || defined ALWAYS_KERNEL + +/** Macro for static tracing. + The first parameters defines the trace level set where this trace belongs to + and the second parameter contains the trace string used in ordinary RDebug::Print + command. Example: + TraceDump(INFO_LEVEL,(_L("My %d trace",1))); + */ + +#define TraceDump(LEVEL,STRING) UtilDump(Kern::Printf,DEBUG_LEVEL,LEVEL,STRING) + + +/** Macro for dynamic tracing. + The first parameters defines the trace level set where this trace belongs to + and the second parameter contains the trace string used in ordinary RDebug::Print + command. Example: + TraceDump(INFO_LEVEL,(_L("My %d trace",1))); + */ + +#define RTraceDump(LEVEL,STRING) UtilDump(Kern::Printf,iDbgLevel,LEVEL,STRING) +#else +#define TraceDump(LEVEL,STRING) UtilDump(RDebug::Print,DEBUG_LEVEL,LEVEL,STRING) +#define RTraceDump(LEVEL,STRING) UtilDump(RDebug::Print,iDbgLevel,LEVEL,STRING) +#endif // __MOMAP15XX__ || ALWAYS_KERNEL + +#else +//lint -emacro({717}, TraceDump) do while(0) +#define TraceDump(LEVEL,STRING) do {} while (0) +//lint -emacro({717}, RTraceDump) do while(0) +#define RTraceDump(LEVEL,STRING) do {} while (0) +#endif // _DEBUG + +#endif // GENDEBUG_H + +// End of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/rwlmserver.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,576 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client side interface to WLAN Services +* +*/ + +/* +* %version: 24 % +*/ + +#ifndef RWLMSERVER_H +#define RWLMSERVER_H + +#include +#include +#include +#include "genscanlist.h" +#include "wlmnotify.h" +#include "wlancontrolinterface.h" + +class CWlmScanRequest; + +/** +* Application interface. +* This class hides inter-thread communication between client +* and server. Hides also asynchronous notification services. +* @since Series 60 3.0 +* @lib wlmserver.lib +*/ +NONSHARABLE_CLASS( RWLMServer ) : public RSessionBase, public MWLMNotify + { + friend class CWlmScanRequest; + + public: // Methods. + + /** + * Structure for storing buffers for a traffic stream create request. + */ + struct TWlmTsCreateRequest + { + TWlmTsCreateRequest( + const TWlanTrafficStreamParameters& aStreamParameters, + TUint& aStreamId, + TWlanTrafficStreamStatus& aStreamStatus ) : + iTsParameterPckg( aStreamParameters ), + iTsIdPckg( aStreamId ), + iTsStatusPckg( aStreamStatus ) {}; + + /** Buffer for storing TSPEC parameters. */ + TPckgBuf iTsParameterPckg; + + /** Buffer for storing traffic stream ID. */ + TPckg iTsIdPckg; + + /** Buffer for storing traffic stream status. */ + TPckg iTsStatusPckg; + }; + + // New methods + + /** + * Cancel pending notification message from server. + * CWLMNotify class uses this method to cancel pending message at server + * side. + */ + void CancelRequest(); + + /** + * Close the connection; release the handle to the server. + */ + IMPORT_C void Close(); + + /** + * Set a message to pend notification. + * @param aReturnValue Status of the calling active object. + * @param aReturnData (OUT) Data returned by the notification. + * @param aNotificationMask Bitmask of active notifications. + */ + void WaitForNotification( + TRequestStatus& aReturnValue, + TDes8& aReturnData, + TUint32 aNotificationMask ); + + /** + * Client activates the notification service. + * With this service client can receive asynchronous notifications from + * the server. + * @param aCallback Client's callback interface for notifications. + * @param aNotificationMask Bitmask of notifications to activate. + * @see TWLMResponses + */ + IMPORT_C void ActivateNotifiesL( + MWLMNotify& aCallback, + TUint32 aNotificationMask ); + + /** + * Client deactivates the notification service. + * This is the client's interface to stop receiveing notifications from the + * server. + */ + IMPORT_C void CancelNotifies(); + + /** + * Client makes the connection to the server. + * @return General Symbian error code. + */ + IMPORT_C TInt Connect(); + + /** + * Version information. + * @return Version information. + */ + TVersion Version() const; + + /** + * Get connection state of WLAN. + * @return Current state of WLAN connection. + */ + IMPORT_C TWlanConnectionState GetConnectionState(); + + /** + * Get current connections RCPI. + * @param aRCPI (OUT) Current signal strength of the connection, 0 if no WLAN connection. + * @return General Symbian error code. + */ + IMPORT_C TInt GetConnectionRCPI( + TInt32& aRCPI ); + + /** + * Get scan results. + * @param aResults (OUT) Results of the last scan. + * @param aSsid SSID to be scanned. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + * @return General Symbian error code. + */ + IMPORT_C TInt GetScanResults( + ScanList& aResults, + const TDesC8& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay ); + + /** + * Get scan results. + * @param aResults (OUT) Results of the last scan. + * @param aSsid SSID to be scanned. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + * @param aStatus Status of the calling active object. + */ + IMPORT_C void GetScanResults( + ScanList& aResults, + const TDesC8& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus& aStatus ); + + /** + * Cancel an outstanding scan request. + */ + IMPORT_C void CancelGetScanResults(); + + /** + * Join to a network using the settings from "IAP specific WLAN table". + * + * @param aStatus Status of the calling active object. + * @param aId Index to the "IAP specific WLAN table". + * @param aOverrides Override parameters to joining the network. + */ + IMPORT_C void Join( + TRequestStatus& aStatus, + const TUint32 aId, + TWLMOverrideSettings* aOverrides = NULL ); + + /** + * Cancel an outstanding join request. + */ + IMPORT_C void CancelJoin(); + + /** + * Reset the network connection. + * @return General Symbian error code. + */ + IMPORT_C TInt Release(); + + /** + * Get the BSSID of the current connection. + * @param aBssid The BSSID of the current connection. + * If no connection a zero address is returned. + * @return General Symbian error code. + */ + IMPORT_C TInt GetBSSID( + TMacAddress& aBssid ); + + /** + * Get the name of the current network. + * @param aNwName (OUT) The name of the current network. + * @return General Symbian error code. + */ + IMPORT_C TInt GetNetworkName( + TDes& aNwName ); + + /** + * Get current security mode. + * @param aMode (OUT) The current security mode. + * @return General Symbian error code. + */ + IMPORT_C TInt GetSecurityMode( + TWlanSecurity& aMode ); + + /** + * Get current system mode. + * @param aMode (OUT) The current system mode. + * @return General Symbian error code. + */ + IMPORT_C TInt GetSystemMode( + TWlanSystemMode& aMode ); + + /** + * Get available WLAN IAPs. + * @param aAvailableIaps Array of IAP IDs available. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + * @return General Symbian error code. + */ + IMPORT_C TInt GetAvailableIaps( + TWlmAvailableIaps& aAvailableIaps, + TInt& aCacheLifetime, + TUint& aMaxDelay ); + + /** + * Get available WLAN IAPs. + * @param aAvailableIaps Array of IAP IDs available. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + * @param aStatus Status of the calling active object. + * + * In order to call this method, an instance of TWlmAvailableIaps must + * packaged into a TPckg package buffer. This buffer + * can be passed to the called method as a descriptor. + * + * Example: + * TPckg availableIapsBuf( availableIaps ); + * GetAvailableIaps( availableIapsBuf, cacheLifetime, maxDelay, status ); + */ + IMPORT_C void GetAvailableIaps( + TDes8& aAvailableIaps, + TDes8& aCacheLifetime, + TDes8& aMaxDelay, + TRequestStatus& aStatus ); + + /** + * Cancel an outstanding IAP availability request. + */ + IMPORT_C void CancelGetAvailableIaps(); + + /** + * Notify the server about changed WLAN settings. + */ + IMPORT_C void NotifyChangedSettings(); + + /** + * Adds a BSSID to rogue list + * @param aBssid a BSSID of an accesspoint. + * @return Error code. + */ + IMPORT_C TInt AddBssidToRoguelist( + const TMacAddress& aBssid ); + + /** + * Updates the RCP notification class boundaries. + * @param aRcpLevelBoundary specifies the RCP level when notification + * should be given. This boundary is used when signal level is + * getting worse (see next parameter). + * @param aHysteresis specifies the difference between RCP notification + * trigger levels of declining and improving signal quality. + * I.e. since aRcpLevelBoundary specifies the level boundary for + * declining signal, the same boundary for imrpoving signal is + * ( aRcpLevelBoundary - aHysteresis ). + * @return Error value + */ + IMPORT_C TInt UpdateRcpNotificationBoundary( + const TInt32 aRcpLevelBoundary, + const TInt32 aHysteresis ); + + /** + * ConfigureMulticast + * @param aCommand specifies either KSoIp6JoinGroup or + * KSoIp6LeaveGroup + * @param aMulticastAddress contains the MAC address + * @return Error code. + */ + IMPORT_C TInt ConfigureMulticast( + TUint aCommand, + const TMacAddress& aMulticastAddress ); + + /** + * Get packet statistics of the current connection. + * + * @since S60 v3.2 + * @param aStatistics Packet statistics of the current connection. + * @return KErrNone if statistics were read successfully, an error otherwise. + */ + IMPORT_C TInt GetPacketStatistics( + TWlanPacketStatistics& aStatistics ); + + /** + * Clear packet statistics of the current connection. + * + * @since S60 v3.2 + */ + IMPORT_C void ClearPacketStatistics(); + + /** + * Get the current U-APSD settings. + * + * @since S60 v3.2 + * @param aSettings Current U-APSD settings. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + IMPORT_C TInt GetUapsdSettings( + TWlanUapsdSettings& aSettings ); + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param aSettings Current U-APSD settings to be set. + * @return KErrNone if settings were set successfully, an error otherwise. + */ + IMPORT_C TInt SetUapsdSettings( + const TWlanUapsdSettings& aSettings ); + + /** + * Get the current power save settings. + * + * @since S60 v3.2 + * @param aSettings power save settings. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + IMPORT_C TInt GetPowerSaveSettings( + TWlanPowerSaveSettings& aSettings ); + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param aSettings Current power save settings to be set. + * @return KErrNone if settings were set successfully, an error otherwise. + */ + IMPORT_C TInt SetPowerSaveSettings( + const TWlanPowerSaveSettings& aSettings ); + + /** + * Run Protected Setup. + * @param aStatus Status of the calling active object. + * @param aId IAP ID of network which user has selected to be configured. + * @param Results of a successful Protected Setup operation. + */ + IMPORT_C void RunProtectedSetup( + TRequestStatus& aStatus, + TUint32 aId, + TDes8& aCredentials ); + + /** + * Cancel an outstanding Protected Setup request. + */ + IMPORT_C void CancelProtectedSetup(); + + /** + * Create a virtual traffic stream. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aStreamParameters Traffic stream parameters to use. + * @param aIsAutomaticStream Whether the stream was created automatically + * by WLAN NIF. + * @param aStreamId Contains the ID assigned to this traffic stream + * on successful completion. + * @param aStreamStatus Contains the status of the traffic stream + * on successful completion. + */ + IMPORT_C void CreateTrafficStream( + TRequestStatus& aStatus, + const TWlanTrafficStreamParameters& aStreamParameters, + TBool aIsAutomaticStream, + TUint& aStreamId, + TWlanTrafficStreamStatus& aStreamStatus ); + + /** + * Cancel an outstanding traffic stream creation request. + * + * @since S60 v3.2 + */ + IMPORT_C void CancelCreateTrafficStream(); + + /** + * Delete a virtual traffic stream. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aStreamId ID of the traffic stream to delete. + */ + IMPORT_C void DeleteTrafficStream( + TRequestStatus& aStatus, + TUint aStreamId ); + /** + * Cancel an outstanding traffic stream deletion request. + * + * @since S60 v3.2 + */ + IMPORT_C void CancelDeleteTrafficStream(); + + /** + * Get information about the current AP. + * + * @since S60 v3.2 + * @param aInfo Information about the current AP. + * @return KErrNone if information is available, an error otherwise. + */ + IMPORT_C TInt GetAccessPointInfo( + TWlanAccessPointInfo& aInfo ); + + /** + * Get roam metrics of the current connection. + * + * @since S60 v3.2 + * @param aRoamMetrics Roam metrics of the current connection. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + IMPORT_C TInt GetRoamMetrics( + TWlanRoamMetrics& aRoamMetrics ); + + /** + * Return a list of BSSIDs on the rogue list. + * + * @since S60 v3.2 + * @param aRogueList List of BSSIDs on the rogue list. + * @return KErrNone if list were read successfully, an error otherwise. + */ + IMPORT_C TInt GetRogueList( + CArrayFixSeg& aRogueList ); + + /** + * Get the current regulatory domain. + * + * @since S60 v3.2 + * @param aRegion current region. + * @return KErrNone if value was read successfully, an error otherwise. + */ + IMPORT_C TInt GetRegulatoryDomain( + TWlanRegion& aRegion ); + + /** + * Get the current power save mode. + * + * @since S60 v3.2 + * @param aPowerSaveMode current power save mode. + * @return KErrNone if value was read successfully, an error otherwise. + */ + IMPORT_C TInt GetPowerSaveMode( + TWlanPowerSave& aPowerSaveMode ); + + /** + * Add a list of SSIDs to the given IAP ID. + * + * The list of SSIDs is matched against the scan results during IAP availability + * check and the corresponding IAP marked as available if a match is found. + * + * @since S60 v5.0.1 + * @param aIapId IAP ID the list is attached to. + * @param aSsidList List of SSIDs. Any previous list attached will be overwritten. + * @return KErrNone if the list was successfully added, an error code otherwise. + */ + IMPORT_C TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ); + + /** + * Remove any list of SSIDs attached to the given IAP ID. + * + * @since S60 v5.0.1 + * @param aIapId IAP ID the list is attached to. + * @return KErrNone if the list was successfully removed, an error code otherwise. + */ + IMPORT_C TInt RemoveIapSsidList( + TUint aIapId ); + + /** + * Set the power save mode. + * + * @since S60 v5.0.1 + * @param aMode Power save mode to be set. + * @return KErrNone if the mode was set successfully, an error otherwise. + */ + IMPORT_C TInt SetPowerSaveMode( + TWlanPowerSaveMode aMode ); + + /** + * Notify the server about PSM server mode change. + * + * @since S60 v5.2 + * @param aMode new PSM server mode. + * @return KErrNone if the mode was set successfully, an error otherwise. + */ + IMPORT_C TInt NotifyChangedPsmSrvMode( + TInt aMode ); + + /** + * Get the current traffic status for access classes. + * + * @since S60 v5.0.1 + * @param aArray Traffic status for access classes. + * @return KErrNone if information is available, an error otherwise. + */ + IMPORT_C TInt GetAcTrafficStatus( + TWlmAcTrafficStatusArray& aArray ); + + /** + * Initiate a roam to the given BSSID. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aBssid BSSID to roam to. If set to FF:FF:FF:FF:FF:FF address, + * search for a better BSS is initiated. + */ + IMPORT_C void DirectedRoam( + TRequestStatus& aStatus, + const TMacAddress& aBssid ); + + /** + * Cancel an outstanding directed roam request. + */ + IMPORT_C void CancelDirectedRoam(); + + protected: // Methods + + /** + * Start the server during Connect() if the server is not loaded. + * @return error code + */ + TInt StartServer(); + + private: // Members + + /** Notification service. Exists only if its activated. */ + CWLMNotify* iNotify; + + /** Class for handling scan requests. */ + CWlmScanRequest* iScanRequest; + + /** Parameters for traffic stream create request. */ + TWlmTsCreateRequest* iTsCreateRequest; + + /** Buffer for storing override settings. */ + TPckgBuf iOverridePckg; + + /** Buffer for storing BSSID to roam to. */ + TPckgBuf iRoamBssidPckg; + }; + +#endif // RWLMSERVER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscan.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,382 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class implementing WLAN background scan logic +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANBGSCAN_H +#define WLANBGSCAN_H + +#include "awsinterface.h" +#include "awsenginebase.h" +#include "wlanscanproviderinterface.h" +#include "wlantimerservices.h" +#include "wlanbgscanawscomms.h" + +/** + * WLAN Background Scan + * This class implements WLAN Background Scan logic. + * + * @since S60 S60 v5.2 + */ +NONSHARABLE_CLASS( CWlanBgScan ) : + public MWlanBgScanProvider, + public MWlanTimerServiceCallback, + public MWlanBgScanCommandListener + { + +public: + + /** + * States for WLAN Background Scan. + */ + enum TWlanBgScanState + { + EBgScanOff = 0, + EBgScanOn, + EBgScanAuto, + EBgScanAutoAws + }; + + /** + * States for Auto period. + */ + enum TWlanBgScanAutoPeriod + { + EAutoPeriodNone = 0, + EAutoPeriodNight, + EAutoPeriodDay + }; + + /** + * Describes relation of time to time range. + */ + enum TRelation + { + ESmaller, + EInsideRange, + EGreater + }; + + /** + * Two-phased constructor. + */ + static CWlanBgScan* NewL( MWlanScanResultProvider& aProvider, CWlanTimerServices& aTimerServices ); + + /** + * Destructor. + */ + virtual ~CWlanBgScan(); + + /** + * From MWlanBgScanProvider. + * Called when Scan has been completed. + * + * \msc + * ScanResultProvider,CWlanBgScan; + * --- [label="Scan is done"]; + * ScanResultProvider=>CWlanBgScan [label="ScanComplete()"]; + * ScanResultProvider<=CWlanBgScan [label="Scan()"]; + * --- [label="New scan request is placed to queue or"]; + * --- [label="existing request's scan time is updated"]; + * ScanResultProvider>>CWlanBgScan [label="return"]; + * ScanResultProvider<CWlanBgScan [label="NotConnected()"]; + * ScanResultProvider<=CWlanBgScan [label="Scan( aMaxDelay=0 )"]; + * ScanResultProvider>>CWlanBgScan [label="return"]; + * ScanResultProvider< AWS communications object. + */ + CWlanBgScanAwsComms* iAwsComms; + + /** + * Current background scan state. + */ + TWlanBgScanState iBgScanState; + + /** + * Current Auto period. + */ + TWlanBgScanAutoPeriod iAutoPeriod; + + /** + * Reference to WLAN Timer services. + */ + CWlanTimerServices& iTimerServices; + + /** + * Id of the timer service request regarding + * background scan interval change. + */ + TUint iIntervalChangeRequestId; + + /** + * Background scan peak start time. + */ + TUint iBgScanPeakStartTime; + + /** + * Background scan peak end time. + */ + TUint iBgScanPeakEndTime; + + /** + * Peak time interval. + */ + TUint iBgScanIntervalPeak; + + /** + * Off-peak time interval. + */ + TUint iBgScanIntervalOffPeak; + + }; + +#endif // WLANBGSCAN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscanawscomms.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscanawscomms.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class implementing WLAN BgScan AWS communications +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef WLANBGSCANAWSCOMMS_H +#define WLANBGSCANAWSCOMMS_H + +#include "awsinterface.h" +#include "awsenginebase.h" +#include "wlantimerservices.h" +#include "wlanbgscancommandlistener.h" +#include "wlanbgscancommand.h" + +// forward declarations +class CWlanBgScan; + +/** + * WLAN Background Scan AWS communications + * This class implements WLAN Background Scan AWS communications. + * + * @since S60 S60 v5.2 + */ +NONSHARABLE_CLASS( CWlanBgScanAwsComms ) : + public CActive, + public MAwsBgScanProvider, + public MWlanBgScanCommandListener + { + +public: + + /** + * AWS commands. + */ + enum TAwsCommand + { + EStart = 0, + EStop, + ESetPowerSaveMode, + EAwsCommandMax //not a real command + }; + + /** + * AWS message. + */ + struct TAwsMessage + { + TAwsCommand iCmd; + TInt iParameter; + }; + + /** + * Two-phased constructor. + */ + static CWlanBgScanAwsComms* NewL( CWlanBgScan& aBgScan ); + + /** + * Destructor. + */ + virtual ~CWlanBgScanAwsComms(); + + /** + * From MWlanBgScanCommandListener. + * DoSetInterval. + * This method is called by the command queue when + * interval change request is processed. + * @param aNewInterval new interval to be taken into use + */ + void DoSetInterval( TUint32 aNewInterval ); + + /** + * From MAwsBgScanProvider. + * Set new background scan interval. + * + * @since S60 v5.2 + * @param aNewInterval new interval to be taken into use + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + */ + void SetInterval( TUint32 aNewInterval, TRequestStatus& aStatus ); + + /** + * Send or queue a message to be sent to AWS. + * + * @param aMessage Message to be sent + * @since S60 v5.2 + */ + void SendOrQueueAwsCommand( TAwsMessage& aMessage ); + + /** + * Whether AWS is present in system. + * + * @since S60 v5.2 + * @return ETrue if present, EFalse if not + */ + TBool IsAwsPresent(); + +private: // From CActive + + /** + * Handles an active object's request completion event. + */ + void RunL(); + + /** + * Cancels asynchronous request. + */ + void DoCancel(); + + /** + * Handles a leave occurring in RunL(). + * @param aError Error that caused RunL to leave. + */ + TInt RunError( TInt aError ); + +private: + + /** + * Constructor. + */ + CWlanBgScanAwsComms( CWlanBgScan& aBgScan ); + + /** + * Default Constructor (no implementation). + */ + CWlanBgScanAwsComms(); + + /** + * Two-phased constructor. + */ + void ConstructL(); + + /** + * Clean-up ECOM array + * + * @since S60 v5.2 + * @param aArray ECOM objec array + */ + static void CleanupEComArray(TAny* aArray); + + /** + * Start AWS in it's own thread. + */ + void StartAwsThreadL(); + + /** + * Main function for AWS thread. + * + * @param aThisPtr Pointer to CWlanBgScan instance. + * @return Symbian specific error code. + */ + static TInt AwsThreadEntryPoint( TAny* aThisPtr ); + + /** + * Instantiate AWS ECOM Plugin. + */ + void InstantiateAwsPluginL(); + + /** + * Send message to AWS. + * + * @param aMessage Message to be sent + * @since S60 v5.2 + */ + void SendAwsCommand( TAwsMessage& aMessage ); + +private: // data + + /** + * Reference to BgScan component. + */ + CWlanBgScan& iBgScan; + + /** + * Reference to Adaptive WLAN Scanning component. + */ + CAwsEngineBase* iAws; + + /** + * Reference to AWS ECOM plugin implementation info. + */ + CImplementationInformation* iAwsImplInfo; + + /** + * Command Handler. + */ + CWlanBgScanCommand* iCommandHandler; + + /** + * Version of AWS. + */ + TUint iAwsVersion; + + /** + * Command queue for commands to be sent to AWS. + */ + RArray iAwsMsgQueue; + + /** + * Currently pending command that has been sent to AWS. + */ + TAwsCommand iPendingCommand; + + /** + * If AWS instantiation was successful. + */ + TBool iAwsOk; + + }; + +#endif // WLANBGSCANAWSCOMMS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscancommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscancommand.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements command queue for BgScan. +* +*/ + +/* +* %version: 2 % +*/ + + +#ifndef WLANBGSCANCOMMAND_H +#define WLANBGSCANCOMMAND_H + +#include +#include +#include +#include + +// forward declarations +class MWlanBgScanCommandListener; + +/** + * CWlanBgScanCommand class + * + * @since S60 v5.2 + */ + +NONSHARABLE_CLASS( CWlanBgScanCommand ) : + public CActive + { + +public: + + /** + * WLAN BgScan Commands. + */ + enum TWlanBgScanCommand + { + ESetInterval = 0, + ECommandMax // Last command, not used + }; + + /** + * Static constructor. + * @param aObserver Object that is commanded based on received commands. + */ + static CWlanBgScanCommand* NewL( MWlanBgScanCommandListener& aListener ); + + /** + * Destructor. + */ + ~CWlanBgScanCommand(); + + /** + * Command Queue. + * Queues command for waiting to be executed. The method completes + * AWS's AO, which RunL method will then be called in AWS thread + * context. + * @param aCommand Command to be queued. + * @param aParameter Parameter for the command to be queued. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + */ + void CommandQueue( TWlanBgScanCommand aCommand, TUint32 aParameter, TRequestStatus& aStatus ); + +private: // CWlanBgScanCommand private definitions + + /** + * WLAN BgScan Message. + * Message format used in BgScan message queue. + */ + struct TWlanBgScanMsg + { + TWlanBgScanCommand iCommand; + TUint32 iParameter; + TRequestStatus* iReportStatusPtr; + RThread iClientThread; + }; + +private: // CWlanBgScanCommand private methods + + /** + * C++ constructor. + * @param aListener Object that is commanded based on received commands. + */ + CWlanBgScanCommand( MWlanBgScanCommandListener& aListener ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Process Commands. + * Processes all the commands from BgScan message queue. This method is + * called when BgScan is indicated that there are messages in the queue. + * The method is called from RunL. + */ + void ProcessCommands(); + +private: // From CActive + + /** + * Handles an active object's request completion event. + */ + void RunL(); + + /** + * Cancels asynchronous request. + */ + void DoCancel(); + + /** + * Handles a leave occurring in RunL(). + * @param aError Error that caused RunL to leave. + */ + TInt RunError( TInt aError ); + +private: // CAwsWlanScanMonitor private data + + /** + * BgScan Command Listener. + * Component to which commands are passed for processing. + */ + MWlanBgScanCommandListener& iListener; + + /** + * Message Queue. + * Message queue for commands coming from WLAN Engine. + */ + RMsgQueue iMsgQueue; + +}; + +#endif // WLANBGSCANCOMMAND_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscancommandlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanbgscancommandlistener.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MWlanBgScanCommandListener class declaration. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef M_WLANBGSCANCOMMANDLISTENER_H +#define M_WLANBGSCANCOMMANDLISTENER_H + +#include + +/** + * MWlanBgScanCommandListener class. + * + * Command queue uses this interface to deliver the received + * commands to listener. The listener has to derive from this + * class and implement the defined methods. + * + * @since S60 v5.2 + */ + +NONSHARABLE_CLASS( MWlanBgScanCommandListener ) + { +public: + + /** + * DoSetInterval. + * This method is called by the command queue when + * SetInterval request is processed. + * + * @since S60 v5.2 + * @param aNewInterval new interval to be taken into use + */ + virtual void DoSetInterval( TUint32 aNewInterval ) = 0; + }; + +#endif // M_WLANBGSCANCOMMANDLISTENER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlancbwaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlancbwaiter.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements an active object with callback functionality. +* +*/ + + +#ifndef WLANCBWAITER_H +#define WLANCBWAITER_H + +#include + +/** + * This class implements an active object with callback functionality. + * + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CWlanCbWaiter ) : public CActive + { + +public: + + /** + * Factory for creating an instance of CWlanTestWaiter. + * + * @param aCallback Callback to call when active object completes. + * @return NULL if unable create an instance, a pointer to the instance otherwise. + */ + static CWlanCbWaiter* NewL( + const TCallBack& aCallback ); + + /** + * Destructor. + */ + virtual ~CWlanCbWaiter(); + + /** + * Issue an asynchronous request. + * + * @since S60 v3.2 + */ + void IssueRequest(); + + /** + * Return the status of the request. + * + * @return Reference to status of the request. + */ + TRequestStatus& RequestStatus(); + +// from base class CActive + + /** + * From CActive. + * Called by the active object framework when the request has been completed. + */ + void RunL(); + + /** + * From CActive. + * Called by the framework if RunL leaves. + * + * @param aError The error code RunL leaved with. + * @return KErrNone if leave was handled, one of the system-wide error codes otherwise. + */ + TInt RunError( + TInt aError ); + + /** + * From CActive. + * Called by the framework when Cancel() has been called. + */ + void DoCancel(); + +private: + + /** + * Constructor. + * + * @param aCallback Callback to call when active object completes. + */ + CWlanCbWaiter( + const TCallBack& aCallback ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // data + + /** Function to call once request has been completed. */ + TCallBack iCallback; + + }; + +#endif // WLANCBWAITER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlancontrolimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlancontrolimpl.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The class implementing MWlanControlInterface. +* +*/ + + +#ifndef WLANCONTROLIMPL_H +#define WLANCONTROLIMPL_H + +#include "rwlmserver.h" +#include "wlancontrolclient.h" + +/** + * Implementation for MWlanControlInterface interface. + * + * @lib wlancontrolimpl.dll + * @since S60 v3.2 + */ +class CWlanControlImpl : public CWlanControlClient + { + +public: + + /** + * Static constructor. + */ + static CWlanControlImpl* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanControlImpl(); + +// from base class CWlanControlClient + + /** + * From CWlanControlImpl. + * Get packet statistics of the current connection. + * + * @since S60 v3.2 + * @param aStatistics Packet statistics of the current connection. + * @return KErrNone if statistics were read successfully, an error otherwise. + */ + virtual TInt GetPacketStatistics( + TWlanPacketStatistics& aStatistics ); + + /** + * From CWlanControlImpl. + * Clear packet statistics of the current connection. + * + * @since S60 v3.2 + */ + virtual void ClearPacketStatistics(); + + /** + * From CWlanControlImpl. + * Get the current U-APSD settings. + * + * @since S60 v3.2 + * @param aSettings Current U-APSD settings. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + virtual TInt GetUapsdSettings( + TWlanUapsdSettings& aSettings ); + + /** + * From CWlanControlImpl. + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param aSettings Current U-APSD settings to be set. + * @return KErrNone if settings were set successfully, an error otherwise. + */ + virtual TInt SetUapsdSettings( + const TWlanUapsdSettings& aSettings ); + + /** + * Get the current power save settings. + * + * @since S60 v3.2 + * @param aSettings power save settings. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + virtual TInt GetPowerSaveSettings( + TWlanPowerSaveSettings& aSettings ); + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param aSettings Current power save settings to be set. + * @return KErrNone if settings were set successfully, an error otherwise. + */ + virtual TInt SetPowerSaveSettings( + const TWlanPowerSaveSettings& aSettings ); + + /** + * Get information about the current AP. + * + * @since S60 v3.2 + * @param aInfo Information about the current AP. + * @return KErrNone if information is available, an error otherwise. + */ + virtual TInt GetAccessPointInfo( + TWlanAccessPointInfo& aInfo ); + + /** + * Get roam metrics of the current connection. + * + * @since S60 v3.2 + * @param aRoamMetrics Roam metrics of the current connection. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + virtual TInt GetRoamMetrics( + TWlanRoamMetrics& aRoamMetrics ); + + /** + * Get a list of BSSIDs on the rogue list. + * + * @since S60 v3.2 + * @param aRogueList List of BSSIDs on the rogue list. + * @return KErrNone if list were read successfully, an error otherwise. + */ + virtual TInt GetRogueList( + CArrayFixSeg& aRogueList ); + + /** + * Get the current regulatory domain. + * + * @since S60 v3.2 + * @param aRegion current region. + * @return KErrNone if value was read successfully, an error otherwise. + */ + virtual TInt GetRegulatoryDomain( + TWlanRegion& aRegion ); + + /** + * Get the current power save mode. + * + * @since S60 v3.2 + * @param aPowerSaveMode current power save mode. + * @return KErrNone if value was read successfully, an error otherwise. + */ + virtual TInt GetPowerSaveMode( + TWlanPowerSave& aPowerSaveMode ); + + /** + * Set the power save mode. + * + * @note This method is meant for overriding the dynamic power save mode selection + * for testing purposes. Overriding the power save mode may have an adverse + * effect on throughput and/or power consumption. Dynamic selection can be + * re-enabled by setting the mode to EWlanPowerSaveModeAutomatic. + * + * @since S60 v5.0.1 + * @param aMode Power save mode to be set. + * @return KErrNone if the mode was set successfully, an error otherwise. + */ + virtual TInt SetPowerSaveMode( + TWlanPowerSaveMode aMode ); + +private: + + /** + * C++ default constructor. + */ + CWlanControlImpl(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + +private: // data + + /** + * Handle to WLAN engine. + */ + RWLMServer iServer; + + }; + +#endif // WLANCONTROLIMPL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanconversionutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanconversionutil.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,628 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles type conversion between adaptation and core layers +* +*/ + +/* +* %version: 32 % +*/ + +#ifndef WLANCONVERSIONUTIL_H +#define WLANCONVERSIONUTIL_H + +#include // Used in SIAPSettings. +#include // Used in SLanSettings. +#include +#include +#include "FrameXferBlock.h" +#include "wlmclientserver.h" +#include "core_types.h" +#include "core_type_list.h" +#include "wlandevicesettings.h" +#include "umac_types.h" +#include "wlanpowersaveinterface.h" +#include "wlanhwinit.h" + +/** +* Utility class for making type conversion between Symbian and "Wlan Core" types +* @lib wlmserversrv.lib +* @since Series 60 3.0 +*/ +class TWlanConversionUtil + { + public: // New functions + + /** + * ConvertSSID + * @since Series 60 3.0 + * @param aCoreSSID (OUT) + * @param aSSID (IN) + */ + static void ConvertSSID( + core_ssid_s& aCoreSSID, + const TSSID& aSSID ); + + /** + * ConvertSSID + * @since Series 60 3.0 + * @param aCoreSSID (OUT) + * @param aSSID (IN) + */ + static void ConvertSSID( + core_ssid_s& aCoreSSID, + const TDesC& aSSID ); + + /** + * ConvertSSID + * @since Series 60 3.0 + * @param aCoreSSID (OUT) + * @param aSSID (IN) + */ + static void ConvertSSID( + core_ssid_s& aCoreSSID, + const TDesC8& aSSID ); + + /** + * ConvertSSID + * @since Series 60 3.0 + * @param aCoreSSID + * @ + */ + static void ConvertSSID( + TSSID& aAmSSID, + const core_ssid_s& aCoreSSID ); + + /** + * ConvertScanRate + * @since Series 60 3.0 + * @param aCoreScanRate + * @return TRate + */ + static TRate ConvertScanRate( int_t aCoreScanRate ); + + /** + * ConvertSecurityMode + * @since Series 60 3.0 + * @param aCoreMode + * @return TWlanSecurity + */ + static TWlanSecurity ConvertSecurityMode( + const core_connection_security_mode_e& aCoreMode ); + + /** + * ConvertEncryptionMode + * @since Series 60 3.0 + * @param aCoreEncryptionMode + * @return TWEPStatus + */ + static TEncryptionStatus ConvertEncryptionMode( + const core_encryption_mode_e& aCoreEncryptionMode ); + + /** + * ConvertConnectionState + * @since Series 60 3.0 + * @param aCoreState + * @return TWlanConnectionState + */ + static TWlanConnectionState ConvertConnectionState( + const core_connection_state_e& aCoreState ); + + /** + * ConvertScanMode + * @since Series 60 3.0 + * @param aAmScanMode + * @return core_scan_mode_e + */ + static core_scan_mode_e ConvertScanMode( + const TScanMode& aAmScanMode ); + + /** + * ConvertScanMode + * @since Series 60 3.0 + * @param aCoreScanMode + * @return TScanMode + */ + static TScanMode ConvertScanMode( + const core_scan_mode_e& aCoreScanMode ); + + /** + * ConvertConvertCipherKeyType + * @since Series 60 3.0 + * @param aCoreCipherKeyType + * @return TWlanCipherSuite + */ + static TWlanCipherSuite ConvertCipherKeyType( + const core_cipher_key_type_e& aCoreCipherKeyType ); + + /** + * ConvertNotificationType + * @since Series 60 3.0 + * @param aCoreNotificationType + * @return TWlmNotify + */ + static TWlmNotify ConvertNotificationType( + const core_notification_e& aCoreNotificationType ); + + /** + * ConvertConnectStatus + * @since Series 60 3.0 + * @param aCoreConnectStatus The core connect status being converted. + * @param security_mode Security mode of the IAP. + * @return error code either Symbian generic or WLAN specific + */ + static TInt ConvertConnectStatus( + const core_connect_status_e& aCoreConnectStatus, + core_security_mode_e security_mode ); + + /** + * ConvertRegion + * @since Series 60 3.0 + * @param aAmRegion + * @return core_wlan_region_e + */ + static core_wlan_region_e ConvertRegion( const TWlanRegion& aAmRegion ); + + /** + * ConvertRegion + * @since Series 60 5.0 + * @param aCoreRegion + * @return TWlanRegion + */ + static TWlanRegion ConvertRegion( const core_wlan_region_e& aCoreRegion ); + + /** + * ConvertMacAddress + * Function assumes both mac address types have the same length + * @since Series 60 3.0 + * @param aAmMacAddress (OUT) + * @param aCoreMacAddress (IN) + */ + static void ConvertMacAddress( + TMacAddress& aAmMacAddress, + const core_mac_address_s& aCoreMacAddress ); + + /** + * ConvertMacAddress + * Function assumes both mac address types have the same length + * @since Series 60 3.0 + * @param aCoreMacAddress (OUT) + * @param aAmMacAddress (IN) + */ + static void ConvertMacAddress( + core_mac_address_s& aCoreMacAddress, + const TMacAddress& aAmMacAddress ); + + /** + * ConvertMacAddress + * Function assumes both mac address types have the same length + * @since Series 60 3.0 + * @param aCoreMacAddress (OUT) + * @param aAmMacAddress (IN) + */ + static void ConvertMacAddress( + core_mac_address_s& aCoreMacAddress, + const TMacAddr& aAmMacAddress ); + + /** + * ConvertMacAddress + * Function assumes both mac address types have the same length + * @since Series 60 3.0 + * @param aCoreMacAddress (OUT) + * @param aAmMacAddress (IN) + */ + static void ConvertMacAddress( + TMacAddress& aCoreMacAddress, + const TMacAddr& aAmMacAddress ); + + /** + * ConvertPowerMode + * @since Series 60 3.0 + * @param aCorePowerMode (IN) + * @return TPowerMode + */ + static TPowerMode TWlanConversionUtil::ConvertPowerMode( + const core_power_mode_e& aCorePowerMode ); + + /** + * ConvertWakeUpInterval + * @since Series 60 3.0 + * @param aAmWakeUpMode (OUT) + * @param aAmWakeUpInterval (OUT) + * @param aCoreWakeUpMode (OUT) + * @param aCoreWakeUpInterval (IN) + */ + static void TWlanConversionUtil::ConvertWakeUpInterval( + TWlanWakeUpInterval& aAmWakeUpMode, + TUint8& aAmWakeUpInterval, + const core_power_save_wakeup_mode_e& aCoreWakeUpMode, + const u8_t& aCoreWakeUpInterval ); + + /** + * ConvertIndication + * @since Series 60 3.0 + * @param aAmIndication + * @return core_am_indication_e + */ + static core_am_indication_e ConvertIndication( + const TIndication& aAmIndication ); + + /** + * ConvertDeviceSettings + * @since Series 60 3.0 + * @param aCoreSettings (OUT) + * @param aAmSettings (IN) + */ + static void ConvertDeviceSettings( + core_device_settings_s& aCoreSettings, + const CWlanDeviceSettings::SWlanDeviceSettings& aAmSettings ); + + /** + * ConvertIapSettings + * @since Series 60 3.0 + * @param aCoreSettings (OUT) + * @param aAmSettings (IN) + * @param aDhcpInUse (IN) + * @param aOverrideSettings (IN) + */ + static void ConvertIapSettings( + core_iap_data_s& aCoreSettings, + const SWLANSettings& aAmSettings, + const TBool aDhcpInUse, + const TWLMOverrideSettings& aOverrideSettings ); + + /** + * ConvertIapSettings + * @since Series 60 3.2 + * @param aCoreSettings (OUT) + * @param aAmSettings (IN) + */ + static void ConvertIapSettings( + core_iap_data_s& aCoreSettings, + const TWlanLimitedIapData& aAmSettings ); + + /** + * ConvertErrorCode + * @since Series 60 3.0 + * @param aError + * @return Corresponding Adaptation module error code. + */ + static TInt ConvertErrorCode( const core_error_e aError ); + + /** + * ConvertErrorCode + * @since Series 60 3.0 + * @param aError + * @return Corresponding Core error code. + */ + static core_error_e ConvertErrorCode( const TInt aError ); + + /** + * Convert mW to dBm. + * @since Series 60 3.0 + * @param aValue mW value to convert. + * @return Corresponding value in dBm. + * @note If the method is unable to perform conversion, + * it will return 0dBm as the conversion result. + */ + static u32_t ConvertMilliwattsToDecibel( const TUint32 aValue ); + + /** + * Convert dBm to mW. + * @since Series 60 3.0 + * @param aValue dBm value to convert. + * @return Corresponding value in mW. + * @note If the method is unable to perform conversion, + * it will return 1mW as the conversion result. + */ + static TUint32 ConvertDecibelToMilliWatts( const u32_t aValue ); + + /** + * Convert RSS class + * @since Series 60 3.0 + * @param aCoreRssClass. + * @return Corresponding Adaptation module value. + */ + static TWlanRCPLevel ConvertRcpClass( const core_rcp_class_e aValue ); + + /** + * Convert scan channels + * @since Series 60 3.0 + * @param aAmChannels (OUT) + * @param aCoreChannels (IN) + */ + static void ConvertScanChannels( + SChannels& aAmChannels, + const core_scan_channels_s& aCoreChannels ); + + /** + * Convert scan channels + * @since Series 60 3.0 + * @param aCoreChannels (OUT) + * @param aAmChannels (IN) + */ + static void ConvertScanChannels( + core_scan_channels_s& aCoreChannels, + RArray& aAmChannels ); + + /** + * Convert frame type + * @since Series 60 3.1 + * @param core frame type + * @return adaptation frame type + */ + static TDataBuffer::TFrameType ConvertFrameType( + core_frame_type_e aFrameType ); + + /** + * Convert frame type + * @since Series 60 3.1 + * @param adaptation frame type + * @return core frame type + */ + static core_frame_type_e ConvertFrameType( + TDataBuffer::TFrameType aFrameType ); + + /** + * Convert packet statistics. + * + * @since Series 60 3.2 + * @param aAmStatistics (OUT) + * @param aCoreStatistics (IN) + */ + static void ConvertPacketStatistics( + TWlanPacketStatistics& aAmStatistics, + const core_packet_statistics_s& aCoreStatistics ); + + /** + * Convert U-APSD settings. + * + * @since Series 60 3.2 + * @param aCoreSettings (OUT) + * @param aAmSettings (IN) + */ + static void ConvertUapsdSettings( + core_uapsd_settings_s& aCoreSettings, + const TWlanUapsdSettings& aAmSettings ); + + /** + * Convert U-APSD settings. + * + * @since Series 60 3.2 + * @param aAmSettings (OUT) + * @param aCoreSettings (IN) + */ + static void ConvertUapsdSettings( + TWlanUapsdSettings& aAmSettings, + const core_uapsd_settings_s& aCoreSettings ); + + /** + * Convert TX rate policies. + * + * @since Series 60 3.2 + * @param aAmPolicies (OUT) + * @param aAmMcsPolicies (OUT) + * @param aAmAutoRatePolicies (OUT) + * @param aCorePolicies (IN) + */ + static void ConvertTxRatePolicies( + TTxRatePolicy& aAmPolicies, + THtMcsPolicy& aAmMcsPolicies, + TTxAutoRatePolicy& aAmAutoRatePolicies, + const core_tx_rate_policies_s& aCorePolicies ); + + /** + * Convert TX rate policy mappings. + * + * @since Series 60 3.2 + * @param aAmMappings (OUT) + * @param aCoreMappings (IN) + */ + static void ConvertTxRatePolicyMappings( + TQueue2RateClass& aAmMappings, + const core_tx_rate_policy_mappings_s& aCoreMappings ); + + /** + * Convert TX rate policy initial rates. + * + * @since Series 60 3.2 + * @param aInitialRates (OUT) + * @param aCorePolicies (IN) + */ + static void ConvertTxRatePolicyInitialRates( + TInitialMaxTxRate4RateClass& aInitialRates, + const core_tx_rate_policies_s& aCorePolicies ); + + /** + * Convert power save settings. + * + * @since Series 60 3.2 + * @param aCoreSettings (OUT) + * @param aAmSettings (IN) + */ + static void ConvertPowerSaveSettings( + core_power_save_settings_s& aCoreSettings, + const TWlanPowerSaveSettings& aAmSettings ); + + /** + * Convert power save settings. + * + * @since Series 60 3.2 + * @param aAmSettings (OUT) + * @param aCoreSettings (IN) + */ + static void ConvertPowerSaveSettings( + TWlanPowerSaveSettings& aAmSettings, + const core_power_save_settings_s& aCoreSettings ); + + /** + * Convert U-APSD maximum service period length + * @since Series 60 3.2 + * @param aServicePeriodLength (IN) + * @return Corresponding Adaptation module maximum service period length + */ + static TMaxServicePeriodLength ConvertUapsdMaxServicePeriod( + core_max_service_period_length_e aServicePeriodLength ); + + /** + * Convert traffic stream status. + * @since Series 60 3.2 + * @param aStatus (IN) + * @return Corresponding Adaptation module traffic stream status. + */ + static TWlanTrafficStreamStatus ConvertTrafficStreamStatus( + core_traffic_stream_status_e aStatus ); + + /** + * Convert access point information. + * @since Series 60 3.2 + * @param aAmInfo (OUT) + * @param aCoreInfo (IN) + */ + static void ConvertApInformation( + TWlanAccessPointInfo& aAmInfo, + const core_ap_information_s& aCoreInfo ); + + /** + * Convert roam metrics of the current connection. + * @since Series 60 3.2 + * @param aAmRoamMetrics (OUT) + * @param aCoreRoamMetrics (IN) + */ + static void ConvertRoamMetrics( + TWlanRoamMetrics& aAmRoamMetrics, + const core_roam_metrics_s& aCoreRoamMetrics ); + + /** + * Convert list of BSSIDs on the rogue list. + * @since Series 60 3.2 + * @param aAmRogueList (OUT) + * @param aCoreRogueList (IN) + */ + static void ConvertRogueList( + TWlmRogueList& aAmRogueList, + core_type_list_c& aCoreRogueList ); + + /** + * Convert tx queue id. + * @since Series 60 3.2 + * @param queue_id (IN) + * @return Corresponding Adaptation module tx queue id. + */ + static TQueueId ConvertTxQueueId( + core_access_class_e queue_id ); + + /** + * Convert a Protected Setup credential attribute. + * @since S60 3.2 + * @param aAmAttribute (OUT) + * @param aCoreAttribute (IN) + */ + static void ConvertProtectedSetupCredentialAttribute( + TWlanProtectedSetupCredentialAttribute& aAmAttribute, + const core_iap_data_s& aCoreAttribute ); + + /** + * Convert a Protected Setup status code to a WLAN error code. + * @since Series 60 3.2 + * @param aCoreStatus The core Protected Setup status being converted. + * @return WLAN specific error code. + */ + static TInt ConvertProtectedSetupStatus( + core_protected_setup_status_e aCoreStatus ); + + /** + * Convert SNAP header. + * @since Series 60 3.2 + * @param aAmHeader (OUT) + * @param aCoreHeader (IN) + */ + static void ConvertSnapHeader( + TSnapHeader& aAmHeader, + const core_snap_header_s& aCoreHeader ); + + /** + * Convert power save mode. + * + * @since Series 60 5.0.1 + * @param aCoreMode (OUT) + * @param aAmMode (IN) + */ + static void ConvertPowerSaveMode( + core_power_save_mode_s& aCoreMode, + TWlanPowerSaveMode aAmMode ); + + /** + * Convert feature flags. + * + * @since S60 v5.1 + * @param aFeatures + * @return Corresponding core features. + */ + static u32_t ConvertFeatureFlags( + TUint aFeatures ); + + /** + * Convert access class. + * + * @param aAccessClass (IN) + * @return Corresponding Adaptation module access class. + */ + static TWlmAccessClass ConvertAccessClass( + core_access_class_e aAccessClass ); + + /** + * Convert traffic mode. + * + * @param aAccessClass (IN) + * @return Corresponding Adaptation module traffic mode. + */ + static TWlmAcTrafficMode ConvertTrafficMode( + core_access_class_traffic_mode_e aMode ); + + /** + * Convert traffic status. + * + * @param aAccessClass (IN) + * @return Corresponding Adaptation module traffic status + */ + static TWlmAcTrafficStatus ConvertTrafficStatus( + core_access_class_traffic_status_e aStatus ); + + /** + * Convert traffic stream parameters. + * + * @param aCoreTid (OUT) + * @param aCoreUserPriority (OUT) + * @param coreParams (OUT) + * @param aAmParams (IN) + */ + static void ConvertTrafficStreamParameters( + u8_t& aCoreTid, + u8_t& aCoreUserPriority, + core_traffic_stream_params_s& aCoreParams, + const TWlanTrafficStreamParameters& aAmParams ); + + /** + * Convert TX rate enumeration to corresponding rate as bits per second. + * + * @since aRate (IN) + * @return Corresponding rate as bits per second. + */ + static u32_t ConvertTxRate( + TWlanRate aRate ); + + }; + +#endif // WLANCONVERSIONUTIL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlandevicesettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlandevicesettings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,322 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to read and write WLAN device specific settings. +* +*/ + +/* +* %version: 19 % +*/ + +#ifndef WLANDEVICESETTINGS_H +#define WLANDEVICESETTINGS_H + +#include +#include "umacoidmsg.h" + +const TUint KMaxBssidStrLength = 12; // BSS ID = MAC address +const TUint KMaxSsidStrLength = 64; // SSID is 32 bytes -> 64 characters. +const TUint KMaxWepStrLength = 50; + +// Default values for some settings +const TUint32 KWlanDefaultBeacon = 100; // 100 kusec +const TUint32 KWlanDefaultBackgroundScanInterval = 0; // No background scan +const TUint32 KWlanDefaultTxPowerLevel = 100; // 100mW +const TUint32 KWlanDefaultRcpiTrigger = 70; // 70 dB +const TUint32 KWlanDefaultSimultaneousBtUsageAllowed = 0; // 0=Enabled 1=Not enabled +const TUint32 KWlanDefaultScanExpirationTimer = 10; // 10 seconds +const TUint32 KWlanDefaultUnloadDriverTimer = 5; // 5 seconds +const TUint32 KWlanDefaultRoamTimer = 7000000; // 7 seconds +const TUint32 KWlanDefaultRcpiDifference = 12; // 12 dB +const TUint32 KWlanDefaultConnRegainTimer = 10000000; // 10 seconds. +const TUint32 KWlanDefaultMaxTriesToFindNw = 5; // 5 times +const TUint32 KWlanDefaultDelayBetweenFindNw = 1500000; // 1,5 seconds +const TUint32 KWlanDefaultowerMode = 0; // 0 == enabled +const TUint32 KWlanDefaultLongRetryLimit = 4; +const TUint32 KWlanDefaultRTSThreshold = 2347; +const TUint32 KWlanDefaultShortRetryLimit = 7; +const TUint32 KWlanDefaultMinChanneltime = 7; +const TUint32 KWlanDefaultMaxChanneltime = 30; +const TUint32 KWlanDefaultMaxTransmitMSDULifetime = 512; +const TUint32 KWlanDefaultMinPassiveChannelTime = 110; +const TUint32 KWlanDefaultMaxPassiveChannelTime = 110; +const TUint32 KWlanDefaultMaxApFailureCount = 5; +const TUint32 KWlanDefaultMaxApAuthFailureCount = 1; +const TUint32 KWlanDefaultLongBeaconFindCount = 3; +const TUint32 KWlanDefaultQosNullFrameInterval = 20000; // 20 ms +const TUint32 KWlanDefaultQosNullFrameTimeout = 1000000; // 1 second +const TUint32 KWlanDefaultKeepAliveInterval = 200000000; // 200 seconds +const TUint32 KWlanDefaultScanStopRcpiThreshold = 80; +const TUint32 KWlanDefaultMinRcpiForIapAvailability = 50; +const TUint32 KWlanDefaultQoSNullFrameEntryTimeout = 300000; // 300 ms +const TUint32 KWlanDefaultMaxApDeauthenticationCount = 5; +const TUint32 KWlanDefaultApDeauthenticationTimeout = 2000000; // 2 seconds +const TUint32 KWlanDefaultRegion = 0; // not available +const TInt32 KWlanDefaultRegionTimestamp = 0; // not available +const TUint32 KWlanDefaultMaxDtimSkipInterval = 0; // wake on every DTIM +const TUint32 KWlanDefaultPsActiveToLightTimeout = 100000; // 100ms +const TUint32 KWlanDefaultPsActiveToLightThreshold = 1; // 1 frame +const TUint32 KWlanDefaultPsLightToActiveTimeout = 300000; // 300ms +const TUint32 KWlanDefaultPsLightToActiveThreshold = 4; // 4 frames +const TUint32 KWlanDefaultPsLightToDeepTimeout = 1000000; // 1 second +const TUint32 KWlanDefaultPsLightToDeepThreshold = 1; // 1 frame +const TUint32 KWlanDefaultPsUapsdRxFrameLengthThreshold = 400; // 400 bytes +const TUint32 KWlanDefaultRcpiRoamMinInterval = 4000000; // 4 seconds +const TUint32 KWlanDefaultRcpiRoamMaxInterval = 60000000; // 1 minute +const TUint32 KWlanDefaultRcpiRoamAttemptsPerInterval = 2; +const TUint32 KWlanDefaultRcpiRoamNextIntervalFactor = 2; +const TUint32 KWlanDefaultRcpiRoamNextIntervalAddition = 0; +const TUint32 KWlanDefaultScanListExpirationTime = 120000000; // 2 minutes +const TUint32 KWlanDefaultQoSNullFrameEntryTxCount = 5; +const TUint32 KWlanDefaultSpRcpiTarget = 65; +const TUint32 KWlanDefaultSpTimeTarget = 900000; // 900 ms +const TUint32 KWlanDefaultSpMinIndicationInterval = 3000000; // 3 seconds +const TUint32 KWlanDefaultBssLostRoamMinInterval = 1000000; // 1 second +const TUint32 KWlanDefaultBssLostRoamMaxInterval = 1500000; // 1,5 seconds +const TUint32 KWlanDefaultBssLostRoamAttemptsPerInterval = 2; +const TUint32 KWlanDefaultBssLostRoamNextIntervalFactor = 1; +const TUint32 KWlanDefaultBssLostRoamNextIntervalAddition = 500000; // 500 ms +const TUint32 KWlanDefaultBssLostRoamMaxTriesToFindNw = 5; +const TUint32 KWlanDefaultTrafficStreamCreationTimeout = 1000000; // 1 minute +const TUint32 KWlanDefaultBeaconLostThreshold = 15; +const TUint32 KWlanDefaultBtBeaconLostThreshold = 20; +const TUint32 KWlanDefaultTxFailThreshold = 4; +const TUint32 KWlanDefaultBtTxFailThreshold = 4; +const TUint32 KWlanDefaultPowerSaveDelay = 7; // 7 seconds +const TUint32 KWlanDefaultRegionExpirationTime = 18000; // 5 hours +const TUint32 KWlanDefaultRrmMinMeasurementInterval = 45000000; // 45 seconds +const TUint32 KWlanDefaultPsmServerMode = 0; // PSM server is in normal mode +const TUint32 KWlanDefaultBgScanPeakPeriodStart = 600; // Peak starts at 06:00 o'clock +const TUint32 KWlanDefaultBgScanPeakPeriodEnd = 100; // Peak ends at 01:00 o'clock +const TUint32 KWlanDefaultBgScanIntervalPeakPeriod = 600; // Background scan interval for peak hours is 600 s +const TUint32 KWlanDefaultBgScanIntervalOffPeakPeriod = 1200; // Background scan interval for off-peak hours is 1200 s + +// The value of backgroundScanInterval to deny periodic scanning +const TUint KScanIntervalNever = 0; + +class CCommsDatabase; +class CCommsDbTableView; + +/** +* Interface to read and write WLAN device specific settings. +* The data is stored in CommsDB. +* @since Series 60 3.0 +* @lib wlandevicesettings.lib +*/ +NONSHARABLE_CLASS( CWlanDeviceSettings ) : public CBase + { +public: + + struct SWlanDeviceSettings + { + TUint32 beacon; ///< In ad hoc beacon interval in Kusec. + TUint32 longRetry; ///< How many times packets bigger than 'rts' are been resent. + TUint32 rts; ///< Min. size of a packet that CTS/RTS handshake is been used. + TUint32 shortRetry; ///< How many times packets smaller than 'rts' are been resent. + TUint32 backgroundScanInterval; ///< Is WLAN indication icon been showed in UI. + TUint32 txPowerLevel; ///< Transmission power level in use. In mWs. + TRate scanRate; ///< Data rate used in probe request. + TUint32 rcpiTrigger; ///< Default value for RSSI trigger. + TUint32 minActiveChannelTime; ///< Min time to listen channel in active scanning. + TUint32 maxActiveChannelTime; ///< Max time to listen channel in active scanning. + TUint32 maxTxMSDULifeTime; ///< Max time to send one (fragmented) packet. + TBool useDefaultSettings; ///< If ETrue default values are being used, EFalse use the user defined values. + TUint32 scanExpirationTimer; ///< Time after a new scan is done if required. Otherwise the last scan result is returned. + TUint32 unloadDriverTimer; ///< Time to wait before unload WLAN drivers if no WLAN connection. + TUint32 roamTimer; ///< Time of how often the roaming conditions is been checked (in microseconds). + TUint32 rcpiDifference; ///< Difference of current and the best connections. + TUint32 connRegainTimer; ///< Time to wait connection regain before start roaming sequence (in microseconds). + TUint32 maxTriesToFindNw; ///< How many times a nw is being tried to scan before give up. + TUint32 delayBetweenFindNw; ///< Delay (in microseconds) how long is been waited between tries to find nw. + TUint32 powerMode; ///< Status of WLAN power mode (enabled/disabled) + TBool allowRadioMeasurements; ///< Are radio measurements allowed + TUint32 minPassiveChannelTime; ///< Min time to listen channel in passive scanning. + TUint32 maxPassiveChannelTime; ///< Max time to listen channel in passive scanning. + TUint32 maxApFailureCount; ///< Maximum amount of association failures allowed before blacklisting. + TUint32 maxApAuthFailureCount; ///< Maximum amount of authentication failures allowed before blacklisting. + TUint32 longBeaconFindCount; ///< Maximum number of tries for scanning APs with long beacon intervals. + TUint32 qosNullFrameInterval; ///< Defines how often a QoS NULL data frame is sent. + TUint32 qosNullFrameTimeout; ///< Defines how soon after the last Voice AC packet QoS NULL data frame sending is stopped. + TUint32 keepAliveInterval; ///< Defines how often NULL data frames are sent when nothing is being transmitted (in microseconds). + TUint32 scanStopRcpiThreshold; ///< Defines the RCPI threshold for stopping a direct scan in a BSS lost roam. + TUint32 minRcpiForIapAvailability; ///< Defines minimum RCPI required before an IAP can be marked as available. + TUint32 qosNullFrameEntryTimeout; ///< If the time between two voice packets is less than this value, QoS NULL data frame sending is started (in microseconds). + TUint32 maxApDeauthenticationCount; ///< After a successful roam an AP can deauthenticate the terminal this many times before it's blacklisted. + TUint32 apDeauthenticationTimeout; ///< Deauthentications that happen within time defined by this value after a successful roam are calculated towards AP's deauthentication count (in microseconds). + TBool showBrokenPowerSaveNote; ///< Is WLAN Broken Power Save Note shown on UI. + TUint32 maxDtimSkipInterval; ///< Maximum amount of microseconds to sleep when waking up on DTIMs. + TUint32 psActiveToLightTimeout; ///< Timeout for Active->Light transition. + TUint32 psActiveToLightThreshold; ///< Frame count threshold for Active->Light transition. + TUint32 psLightToActiveTimeout; ///< Timeout for Light->Active transition. + TUint32 psLightToActiveThreshold; ///< Frame count threshold for Light->Active transition. + TUint32 psLightToDeepTimeout; ///< Timeout for Light->Deep transition. + TUint32 psLightToDeepThreshold; ///< Frame count threshold for Light->Deep transition. + TUint32 psUapsdRxThreshold; ///< Rx frame lenght threshold in U-APSD for Best Effort. + TUint32 rcpiRoamMinInterval; ///< The minimum delay between RCPI roam checks (in microseconds). + TUint32 rcpiRoamMaxInterval; ///< The maximum delay between RCPI roam checks (in microseconds). + TUint32 rcpiRoamAttemptsPerInterval; ///< Defines how many times an RCPI roam check interval value is used until the next interval value is calculated. + TUint32 rcpiRoamNextIntervalFactor; ///< The factor the current interval value is multiplied by to get the next interval value. + TUint32 rcpiRoamNextIntervalAddition; ///< The value that is added to the interval value that has been multiplied by rcpiRoamNextIntervalFactor. + TUint32 scanListExpirationTime; ///< Defines how long beacons/probe responses are stored in the internal scan list (in microseconds). + TUint32 qosNullFrameEntryTxCount; ///< Defines how many Voice AC packets must be sent during a certain period before QoS NULL data frame sending is started. + TUint32 spRcpiTarget; ///< The signal predictor algorithm target RCPI value for roam indication. + TUint32 spTimeTarget; ///< The signal predictor algorithm target time for roam indication (in microseconds). + TUint32 spMinIndicationInterval; ///< The minimum time interval for consecutive roam indications from the signal predictor algorithm (in microseconds). + TUint32 bssLostRoamMinInterval; ///< The minimum delay between BSS lost roam attempts (in microseconds). + TUint32 bssLostRoamMaxInterval; ///< The maximum delay between BSS lost roam attempts (in microseconds). + TUint32 bssLostRoamAttemptsPerInterval; ///< Defines how many times a BSS lost roam interval value is used until the next interval value is calculated. + TUint32 bssLostRoamNextIntervalFactor; ///< The factor the current interval value is multiplied by to get the next interval value. + TUint32 bssLostRoamNextIntervalAddition; ///< The value that is added to the interval value that has been multiplied by bssLostRoamNextIntervalFactor. + TUint32 bssLostRoamMaxTriesToFindNw; ///< Defines how many attempts are made to find a suitable AP before giving up during BSS lost. + TUint32 trafficStreamCreationTimeout; ///< Defines how many microseconds to wait for traffic stream request response. + TUint32 beaconLostThreshold; ///< The number of lost consecutive beacons after which beacon lost event is indicated. + TUint32 btBeaconLostThreshold; ///< The number of lost consecutive beacons after which beacon lost event is indicated during an active Bluetooth connection. + TUint32 txFailThreshold; ///< The number of lost consecutive packets after which TX failure event is indicated. + TUint32 btTxFailThreshold; ///< The number of lost consecutive packets after which TX failure event is indicated during an active Bluetooth connection. + TUint32 powerSaveDelay; ///< The number of seconds after which power save is enabled during the initial association. + TUint32 regionExpirationTime; ///< The amount of seconds region information is valid. + TUint32 rrmMinMeasurementInterval; ///< Minimum interval for accepting subsequent RRM Beacon Requests (in microseconds). + TUint32 psmServerMode; ///< PSM server mode (normal, power save, partial). + TUint32 bgScanPeakPeriodStart; ///< The time WLAN background scanning peak period starts. + TUint32 bgScanPeakPeriodEnd; ///< The time WLAN background scanning peak period ends. + TUint32 bgScanIntervalPeak; ///< WLAN background scan interval for peak period. + TUint32 bgScanIntervalOffPeak; ///< WLAN background scan interval for off-peak period. + TBool automaticTrafficStreamMgmt; ///< Whether admission control traffic stream management is done automatically. + TUint32 region; ///< Last known WLAN region that is valid for 5 hours. This value is selected based on the information received from the APs or from cellular network (MCC). + TInt32 regionTimestamp; ///< Timestamp for storing the latest WLAN region (region) to CenRep (minutes from 0AD nominal Gregorian). + }; + + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + IMPORT_C static CWlanDeviceSettings* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CWlanDeviceSettings(); + + // New methods + + /** + * Read WLAN device settings from the database. + * The read values is dependent of the useDefaultSettings -value. + * If it is ETrue in user defineable table the default settings are + * been returned, it is EFalse user defined values are returned. + * @param aSettings Current WLAN device settings. + * Leaves with general error code. + */ + IMPORT_C void ReadL( SWlanDeviceSettings& aSettings ); + + /** + * Read WLAN device settings from the database. + * @param aGetDefaultSettings ETrue return default settings, + * EFalse return user defined values. + * @param aSettings Current WLAN device settings. + * Leaves with general error code. + */ + IMPORT_C void ReadL( TBool aGetDefaultSettings, SWlanDeviceSettings& aSettings ); + + /** + * Save user defineable WLAN device settings to the database. + * @param aSettings New WLAN device settings. + * Leaves with general error code. + */ + IMPORT_C void WriteL( const SWlanDeviceSettings& aSettings ); + + /** + * Save user defineable WLAN device setting to the Central Repository. + * @param aKey Id of the WLAN Central Repository key. + * @param aValue Value to be written to the WLAN Central Repository key. + * Leaves with general error code. + */ + IMPORT_C void WriteCenRepKeyL( const TUint32 aKey, const TInt aValue ) const; + + /** + * Returns the default WLAN device settings. + * + * @param aSettings Default WLAN device settings + */ + IMPORT_C static void GetDefaultSettings( SWlanDeviceSettings& aSettings ); + + // Methods from base classes + + protected: // Methods + + // New Methods + + // Methods from base classes + + private: //Methods + + /** + * C++ default constructor. + */ + CWlanDeviceSettings(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Check is WLAN device settings table correct in CommsDB. + */ + void CheckWlanDeviceSettingsTableL(); + + /** + * Insert a new table to WLAN device settings and initialise it. + * @param aTableType 0 for default settings, 1 for user settings. + */ + void NewRecordL( TUint32 aTableType ); + + /** + * Open database table. + */ + void OpenTableL(); + + /** + * Read data from CenRep + * @param aSettings will contain the settings on completion + */ + TInt ReadPrivateData( SWlanDeviceSettings& aSettings ); + + /** + * Write data to CenRep + * @param aSettings contains the settings to write + */ + TInt WritePrivateData( const SWlanDeviceSettings& aSettings ); + +#ifdef _DEBUG + void LogSettings( const SWlanDeviceSettings& aSettings ) const; +#endif // _DEBUG + + private: // Data + // Comms database + CCommsDatabase* iDb; + + //Default WLAN device settings table from Comms database + CCommsDbTableView* iDefTable; + + // User defined WLAN device settings table from Comms database + CCommsDbTableView* iUsrTable; + }; + +#endif // WLANDEVICESETTINGS_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlandevicesettingsprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlandevicesettingsprivatecrkeys.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CenRep keys +* +*/ + + +#ifndef WLANDEVICESETTINGSPRIVATECRKEYS_H +#define WLANDEVICESETTINGSPRIVATECRKEYS_H + +#include "wlandevicesettingsinternalcrkeys.h" +/** +* Base for user defined values. +* Keys defined below are for default values. If using user defined settings, +* this base value has to be added to the key. +* (e.g. KWlanBeacon => default value of beacon setting, +* KWlanBeacon+KWlanUserSettingsbase => user defined beacon value is read) +*/ +const TUint32 KWlanUserSettingsbase = 0x00000100; + +/** +* KWlanDeviceSettingsVersion +* Defines the settings version. +*/ +const TUint32 KWlanDeviceSettingsVersion = 0x00000001; + +#endif // WLANDEVICESETTINGSPRIVATECRKEYS_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlangenericplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlangenericplugin.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for instantiating Generic WLAN Plugins +* +*/ + + +#ifndef WLANGENERICPLUGIN_H_ +#define WLANGENERICPLUGIN_H_ + +#include +#include // TUid +#include + +NONSHARABLE_CLASS( CGenericWlanPlugin ): public CBase + { +public: + + /** + * Maximum size of threads heap. + */ + static const TInt KMaxHeapSize = 0x10000; + + /** + * Information structure of plugin. + */ + struct TPluginArrayEntry + { + TUid iUid; + CActiveScheduler * iActiveScheduler; + }; + + /** + * Constructor. + */ + CGenericWlanPlugin(); + + /** + * Destructor. + */ + ~CGenericWlanPlugin(); + + /** + * Start all plugins having Generic WLAN Plugin interface UID. + */ + void StartPlugins(); + + /** + * Stop all started plugins. + */ + void StopPlugins(); + +private: + + /** + * Main function for thread. + * + * Create cleanup stack for thread. + * + * @param aPluginArrayEntryPtr Pointer to plugin information. + * @return Symbian specific error code. + */ + static TInt GenericWlanPluginThreadMain( TAny* aPluginArrayEntryPtr ); + + /** + * Load ECom plugin. + * + * Create active scheduler for thread and load ECom plugin which + * implementation UID is aPluginArrayEntryPtr->iUid. + * + * @param aPluginArrayEntryPtr Pointer to plugin information. + */ + static void LoadGenericWlanPluginL( TPluginArrayEntry * aPluginArrayEntryPtr ); + +private: // Data + /** + * UID and Active Scheduler for each thread. + */ + RArray iPluginArray; + }; + +#endif // WLANGENERICPLUGIN_H_ + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtcommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtcommandhandler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,457 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles sending management commands to drivers. +* +*/ + +/* +* %version: 30 % +*/ + +#ifndef WLANMGMTCOMMANDHANDLER_H +#define WLANMGMTCOMMANDHANDLER_H + +#include "RWlanLogicalChannel.h" +#include "umacoidmsg.h" +#include "core_types.h" + +const SChannels KWlanChannels802p11bgAll = { + 0x01, + { 0xFF, 0x1F }, + { 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 + } }; + +/** + * Callback interface + */ +class MWlanMgmtCommandCallback + { + public: + + virtual void OnRequestComplete( TInt status ) = 0; + }; + +/** + * CWlanMgmtCommandHandler transfers commands from WlanEngine to + * LDD (Logical Device Driver). + * CWlanMgmtCommandHandler implements FW (Firmware) dependent functions. + * @since S60 v.3.0 + * @lib wlmserversrv.lib + */ +NONSHARABLE_CLASS( CWlanMgmtCommandHandler ) : + public CActive + { +public: // Constructors and destructor + + /** + * Static constructor. + * @param aIndPtr Interface to send indications. + * @return Pointer to created object. + */ + static CWlanMgmtCommandHandler* NewL( + RWlanLogicalChannel& aChannel, + MWlanMgmtCommandCallback& aClient ); + + /** + * Destructor. + */ + virtual ~CWlanMgmtCommandHandler(); + + /** + * Start an own IBSS network if there doesn't already exist + * a network that has the same name. + * @param aSSID Name of the network. + * @param aBeaconInterval Beacon period in TUs (kusec). + * @param aChannel Used channel (1-11). + * Has to be leagal at the current region. + * @param aEncryptionStatus Used encryption level. + */ + void StartIBSS( + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus ); + + /** + * Scan all available networks. WLAN driver decides is + * background scan or foreground scan used. + * @param aMode Passive or active. + * @param aSSID Network that APs are scanned. Can be broadcast + * SSID. + * @param aScanRate Rate that is used in active scanning. + * @param aStatus (IN/OUT)Request status. Based on active object + * framework. + * @param aChannels Defines the channels to scan. + * @param aMinChannelTime Minimum time to listen for beacons/probe responses on a channel. + * @param aMaxChannelTime Maximum time to listen for beacons/probe responses on a channel. + * @param aIsSplitScan Whether the scan should be performed as a split-scan. + */ + void Scan( + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + const SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aIsSplitScan ); + + /** + * Request an ongoing scan to be stopped. + */ + void StopScan(); + + /** + * Disconnect STA from current network. + */ + void Disconnect(); + + /** + * Set WLAN power saving mode in infrastructure networks. + * @param aMode The power save mode to be used. + * @param aDisableDynamicPs Disable dynamic power save management. + * @param aWakeUpModeLight Wake-up mode in Light PS mode. + * @param aListenIntervalLight Wake-up interval in Light PS mode. + * @param aWakeUpModeDeep Wake-up mode in Deep PS mode. + * @param aListenIntervalDeep Wake-up interval in Deep PS mode. + */ + void SetPowerMode( + TPowerMode aMode, + TBool aDisableDynamicPs, + TWlanWakeUpInterval aWakeUpModeLight, + TUint8 aListenIntervalLight, + TWlanWakeUpInterval aWakeUpModeDeep, + TUint8 aListenIntervalDeep ); + + /** + * Set level for RCPI trigger. + * @param aRCPITrigger RCPI level. + */ + void SetRCPITriggerLevel( TUint32 aRCPITrigger ); + + /** + * Set transmission power level. This has to be + * leagal at the current region. + * @param aLevel Transmission power level in dBm. + */ + void SetTxPowerLevel( TUint32 aLevel ); + + /** + * Initialise WLAN. + * @param aRTSThreshold Limit for packet size when to use RTS/CTS + * protocol. + * @param aMaxTxMSDULifetime Max. time to (re-)send whole MSDU packet. + * (In TUs.) + * @param aQoSNullFrameEntryTimeout Defines the time period in microseconds which is used + * to evaluate whether QoS NULL data frame sending should be started. + * @param aQosNullFrameEntryTxCount Defines how many Voice AC packets must be sent during the time + * period defined in aQoSNullFrameEntryTimeout before QoS NULL + * data frame sending is started. + * @param aQoSNullFrameInterval Defines how often a QoS NULL data frame is sent. + * @param aQoSNullFrameExitTimeout Defines how soon after the last Voice AC packet + * QoS NULL data frame sending is stopped. + * @param aKeepAliveInterval Defines how often NULL data frames are sent + * if there are no other frames to send. + * @param aSpRcpiTarget Defines the signal predictor algorithm "target" RCPI value for roam indication. + * @param aSpTimeTarget Defines the signal predictor algorithm "target" time for roam indication + * (in microseconds). + * @param aSpMinIndicationInterval Defines the minimum time interval for consecutive roam + * indications from the signal predictor algorithm (in microseconds). + */ + void Configure( + TUint16 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aQoSNullFrameEntryTimeout, + TUint32 aQosNullFrameEntryTxCount, + TUint32 aQoSNullFrameInterval, + TUint32 aQoSNullFrameExitTimeout, + TUint32 aKeepAliveInterval, + TUint32 aSpRcpiTarget, + TUint32 aSpTimeTarget, + TUint32 aSpMinIndicationInterval ); + + /** + * GetLastRCPI + * @param aRCPI (OUT) Current RCPI. + */ + void GetLastRCPI( TUint32& aRCPI ); + + /** + * ConfigureMulticastGroup + * @param aJoinGroup is set true_t if adding a multicast address + * otherwise the address will be removed. + * @param aMulticastAddr contains the MAC address to add/remove + */ + void ConfigureMulticastGroup( + TBool aJoinGroup, + const TMacAddress& aMulticastAddr ); + + /** + * Set the parameters related to BSS lost indication. + * @param aBssLostCount The number of consecutive beacons that can be lost + * before BSS lost is indicated. + * @param aFailedTxCount The number of consecutive transmissions that can fail + * before BSS lost is indicated. + */ + void SetBssLostParameters( + TUint32 aBssLostCount, + TUint8 aFailedTxCount ); + + /** + * Set the parameters related to tx rate adaptation algorithm. + * @param aMinStepUpCheckpoint Minimum and initial rate increase checkpoint in units of frames. + * @param aMaxStepUpCheckpoint Maximum rate increase checkpoint in units of frames. + * @param aStepUpCheckpointFactor Rate increase checkpoint is multiplied with this + * value if sending of a probe frame fails. + * @param aStepDownCheckpoint After this many frames the need to decrease the rate is checked. + * @param aMinStepUpThreshold Minimum and initial rate increase threshold percentage. + * @param aMaxStepUpThreshold Maximum rate increase threshold percentage value. + * @param aStepUpThresholdIncrement Rate increase threshold is incremented by this + * value if sending of a probe frame fails. + * @param aStepDownThreshold Rate decrease threshold percentage. + * @param aDisableProbeHandling If EFalse, the rate adaptation algorithm handles the first frame + * transmitted after a rate increase in a special way. + */ + void SetTxRateAdaptationParameters( + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ); + + /** + * Set the parameters related to power mode management. + * @param aActiveToLightTimeout Timeout for Active->Light transition. + * @param aActiveToLightThreshold Frame count threshold for Active->Light transition. + * @param aLightToActiveTimeout Timeout for Light->Active transition. + * @param aLightToActiveThreshold Frame count threshold for Light->Active transition. + * @param aLightToDeepTimeout Timeout for Light->Deep transition. + * @param aLightToDeepThreshold Frame count threshold for Light->Deep transition. + * @param aUapsdRxFrameLengthThreshold Rx frame lenght threshold in U-APSD for Best Effort. + */ + void SetPowerModeMgmtParameters( + TUint32 aActiveToLightTimeout, + TUint16 aActiveToLightThreshold, + TUint32 aLightToActiveTimeout, + TUint16 aLightToActiveThreshold, + TUint32 aLightToDeepTimeout, + TUint16 aLightToDeepThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * Set the parameters related to power mode management. + * @param aRatePolicies TX rate policies to set. + * @param aMcsPolicies MCS policies to set. + * @param aMappings Mappings between Access Classes and TX rate policies. + * @param aInitialRates Initial rates for the policies. + * @param aAutoRatePolicies TX auto rate policies to set. + */ + void SetTxRatePolicies( + const TTxRatePolicy& aRatePolicies, + const THtMcsPolicy& aMcsPolicies, + const TQueue2RateClass& aMappings, + const TInitialMaxTxRate4RateClass& aInitialRates, + const TTxAutoRatePolicy& aAutoRatePolicies ); + + /** + * Get packet statistics for the current connection. + * @param aStatistics Packet statistics for the current connection. + */ + void GetPacketStatistics( + TStatisticsResponse& aStatistics ); + + /** + * Set the U-APSD settings. + * @param aMaxServicePeriodLength The maximum number of frames to send during a service period. + * @param aUapsdEnabledForVoice Whether U-APSD is trigger and delivery-enabled for Voice. + * @param aUapsdEnabledForVideo Whether U-APSD is trigger and delivery-enabled for Video. + * @param aUapsdEnabledForBestEffort Whether U-APSD is trigger and delivery-enabled for BestEffort. + * @param aUapsdEnabledForBackground Whether U-APSD is trigger and delivery-enabled for Background. + */ + void SetUapsdSettings( + TMaxServicePeriodLength aMaxServicePeriodLength, + TBool aUapsdEnabledForVoice, + TBool aUapsdEnabledForVideo, + TBool aUapsdEnabledForBestEffort, + TBool aUapsdEnabledForBackground ); + + /** + * Set the RCPI trigger level. + * @param aTriggerLevel The RCPI trigger level. + */ + void SetRcpiTriggerLevel( + TUint8 aTriggerLevel ); + + /** + * Set the power save settings. + * @param aStayInUapsdPsModeForVoice Whether the terminal stays in U-APSD power save when using Voice. + * @param aStayInUapsdPsModeForVideo Whether the terminal stays in U-APSD power save when using Video. + * @param aStayInUapsdPsModeForBestEffort Whether the terminal stays in U-APSD power save when using BestEffort. + * @param aStayInUapsdPsModeForBackground Whether the terminal stays in U-APSD power save when using Background. + * @param aStayInLegacyPsModeForVoice Whether the terminal stays in legacy power save when using Voice. + * @param aStayInLegacyPsModeForVideo Whether the terminal stays in legacy power save when using Video. + * @param aStayInLegacyPsModeForBestEffort Whether the terminal stays in legacy power save when using BestEffort. + * @param aStayInLegacyPsModeForBackground Whether the terminal stays in legacy power save when using Background. + */ + void SetPowerSaveSettings( + TBool aStayInUapsdPsModeForVoice, + TBool aStayInUapsdPsModeForVideo, + TBool aStayInUapsdPsModeForBestEffort, + TBool aStayInUapsdPsModeForBackground, + TBool aStayInLegacyPsModeForVoice, + TBool aStayInLegacyPsModeForVideo, + TBool aStayInLegacyPsModeForBestEffort, + TBool aStayInLegacyPsModeForBackground ); + + /** + * Set parameters of a Tx queue. + * @param aQueueId Queue to be configured. + * @param aMediumTime Medium time to be used. + * @param aMaxTxMSDULifetime Maximum Transmit MSDU Lifetime to be used. + */ + void SetTxQueueParameters( + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ); + + /** + * Set block ACK usage per traffic stream. + * @param aTxUsage Bitmap of TIDs where TX block ACK is allowed. + * @param aRxUsage Bitmap of TIDs where RX block ACK is allowed. + */ + void SetBlockAckUsage( + TUint8 aTxUsage, + TUint8 aRxUsage ); + + /** + * Set the SNAP header of frames to receive. + * @param aHeader SNAP header of frames to receive.. + */ + void SetSnapHeaderFilter( + TSnapHeader aHeader ); + + /** + * Disable user data (802.1x: block data during + * authentication). + */ + void DisableUserData(); + + /** + * Enable user data (802.1x: pass data through after + * succesfull authentication). Default value is to + * enable user data. + */ + void EnableUserData(); + + /** + * Add a cipher key. + * @param aCipherSuite The cipher suite of the key. + * @param aKeyIndex Index of the key. + * @param aLength Length of the cipher key. + * @param aData Cipher key. + * @param aMacAddr Defines the MAC address the key is used for. + * @param aUseAsDefault in case of wep, whether the key is used as default cipher key + */ + void AddCipherKey( + TWlanCipherSuite aCipherSuite, + TUint8 aKeyIndex, + TUint32 aLength, + const TUint8* aData, + const TMacAddress& aMacAddr, + TBool aUseAsDefault ); + + /** + * Connect (authenticate and associate) to a BSS. + * @param aSSID Name of the network. + * @param aBSSID BSSID of the access point. + * @param aAuthAlgorithm Authentication algorithm number. + * @param aEncryptionStatus Used encryption level. + * @param aPairwiseKeyType Pairwise cipher key type to be used. + * @param aIsInfra The BSS type. + * @param aIeDataLength The IE data lenght. + * @param aIeData The IE data. + * @param aScanFrameLength Length of beacon/probe response frame. + * @param aScanFrame Pointer to beacon/probe response frame. + * @param aIsPairwiseKeyInvalidated Whether the pairwise key should be invalidated. + * @param aIsGroupKeyInvalidated Whether the group key should be invalidated + * @param aIsRadioMeasurementSupported Whether the radio measurement is supported + */ + void Connect( + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithm, + TEncryptionStatus aEncryptionStatus, + TWlanCipherSuite aPairwiseKeyType, + TBool aIsInfra, + TUint32 aIeDataLength, + const TUint8* aIeData, + TUint32 aScanFrameLength, + const TUint8* aScanFrame, + TBool aIsPairwiseKeyInvalidated, + TBool aIsGroupKeyInvalidated, + TBool aIsRadioMeasurementSupported ); + +protected: // From CActive + + /** + * DoCancel + */ + void DoCancel(); + + /** + * RunL + */ + void RunL(); + +private: // Construction methods + + /** + * C++ default constructor. + * @param aIndPtr Interface to send indications. + */ + CWlanMgmtCommandHandler( + RWlanLogicalChannel& aChannel, + MWlanMgmtCommandCallback& aClient ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // Members + + /** + * Callback interface to complete the requested commands + */ + MWlanMgmtCommandCallback& iClient; + + /** + * Interface to access LDD + */ + RWlanLogicalChannel& iChannel; + + /** + * Package buffer for output parameter(s). + */ + TPtr8 iBuffer; + + }; + +#endif // WLANMGMTCOMMANDHANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtframehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtframehandler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object to send and receive management packets (EAP packets). +* +*/ + + +#ifndef WLANMGMTFRAMEHANDLER_H +#define WLANMGMTFRAMEHANDLER_H + +#include +#include "RWlanLogicalChannel.h" +#include "FrameXferBlock.h" +#include "am_platform_libraries.h" + +class RWlanLogicalChannel; +class MWlanMgmtPacket; + +/** + * Callback interface + */ +class MWlanMgmtFrameCallback + { + public: + virtual void OnFrameReceive( + const TDataBuffer::TFrameType aFrameType, + const TUint aLength, + const TUint8* const aData, + TUint8 aRcpi ) = 0; + }; + +/** + * Management packet handler. + * Active object that waits for management packets from + * driver side. + * @since S60 v3.0 + * @lib wlmserversrv.lib + */ +NONSHARABLE_CLASS( CWlanMgmtFrameHandler ) : public CActive + { +public: // Constructors and destructor + + /** + * C++ default constructor. + * @param aServiceProvider Interface to drivers. + * @param aClient Interfce to client. + */ + CWlanMgmtFrameHandler( + RWlanLogicalChannel& aServiceProvider, + MWlanMgmtFrameCallback& aClient ); + + /** + * Static constructor. + * @param aServiceProvider Interface to drivers. + * @param aClient Interfce to client. + */ + static CWlanMgmtFrameHandler* NewL( + RWlanLogicalChannel& aServiceProvider, + MWlanMgmtFrameCallback& aClient); + + /** + * Destructor. + */ + virtual ~CWlanMgmtFrameHandler(); + +public: // New functions + + /** + * Activate the handler + * Handler starts to listen for received management frames + * @since S60 v.3.1 + * @return error code + */ + TInt Start(); + + /** + * Deactivate the handler + * Handler stops to listen for received management frames + * @since S60 v.3.1 + */ + void Stop(); + + /** + * Send management packet. + * @param aFrameType The type of the frame to send. + * @param aLength The length of sent data. + * @param aData The sent data. + * @param aUserPriority The user priority of the frame. + * @param aDestination Destination MAC address. + * @param aSendUnencrypted Whether the frame must be sent unencrypted. + * @return error code + */ + TInt SendFrame( + const TDataBuffer::TFrameType aFrameType, + const TUint aLength, + const TUint8* const aData, + TUint8 aUserPriority, + const TMacAddress& aDestination, + TBool aSendUnencrypted ); + +public: // Functions from base classes + + /** + * From CActive Is executed when synchronous request is ready. + */ + void RunL(); + + /** + * From CActive Cancel synchronous request. + */ + void DoCancel(); + +private: // Functions + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Request a synchronous call for management packets. + */ + void IssueRequest(); + +private: // Data + + /** + * Interface to receive packets. + */ + RWlanLogicalChannel& iServiceProvider; + /** + * Interface to forward packets. + */ + MWlanMgmtFrameCallback& iClient; + /** + * Data transfer buffer. Not owned by this pointer. + */ + RFrameXferBlock* iDataBlock; + }; + +#endif // WLANMGMTFRAMEHANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtimpl.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,819 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom interface implementation definition +* +*/ + +/* +* %version: 20 % +*/ + +#ifndef WLANMGMTIMPL_H +#define WLANMGMTIMPL_H + +#include "rwlmserver.h" +#include "genscanlist.h" +#include "wlanmgmtclient.h" +#include "wlanscaninfoimpl.h" + +const TInt32 KRssMin = 0; +const TInt32 KRssMax = 100; +const TInt32 KRssHysteresisMin = 0; +const TInt32 KRssHysteresisMax = 100; + +class CWlanScanRequest; +class CWlanAvailableIapsRequest; +class CProtectedSetupRequest; + +/** + * Implementation for MWlanMgmtInterface interface. + * + * This class uses services from RWLMServer class to implement + * most of the required functionality. + * + * @lib wlanmgmtimpl.dll + * @since Series 60 3.0 + */ +class CWlanMgmtImpl : public CWlanMgmtClient, public MWLMNotify + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + static CWlanMgmtImpl* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanMgmtImpl(); + + // New methods + + /** + * Used to indicate completion of asynchronous scan request. + * + * @param aStatus Status of the request. + */ + void ScanComplete( + TInt aStatus ); + + /** + * Used to indicate completion of asynchronous GetAvailableIaps() request. + * + * @param aStatus Status of the request. + */ + void AvailableIapsComplete( + TInt aStatus ); + + // Methods from base classes + + /** + * (From MWlanMgmtInterface) Activate the notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * + * @param aCallback The class that implements the callback interface. + */ + virtual void ActivateNotificationsL( + MWlanMgmtNotifications& aCallback ); + + /** + * (From MWlanMgmtInterface) Cancel the notification service. + */ + virtual void CancelNotifications(); + + /** + * (From MWlanMgmtInterface) Perform a broadcast scan and return the detected WLAN networks. + * + * @param aResults Results of the scan. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetScanResults( + CWlanScanInfo& aResults ); + + /** + * (From MWlanMgmtInterface) Perform a broadcast scan and return the detected WLAN networks. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + virtual void GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * (From MWlanMgmtInterface) Get the BSSID of the BSS currently connected to. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aBssid BSSID of the currently connected BSS. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionBssid( + TWlanBssid& aBssid ); + + /** + * (From MWlanMgmtInterface) Get the SSID of the WLAN network currently connected to. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aSsid SSID of the currently connected network. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionSsid( + TWlanSsid& aSsid ); + + /** + * (From MWlanMgmtInterface) Get the current Received Signal Strength Indicator (RSSI). + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aSignalQuality Current RSSI. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionSignalQuality( + TInt32& aSignalQuality ); + + /** + * (From MWlanMgmtInterface) Get the mode of the WLAN connection. + * + * @param aMode The current mode of the connection. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionMode( + TWlanConnectionMode& aMode ); + + /** + * (From MWlanMgmtInterface) Get the currently used security mode of the WLAN connection. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aMode The security mode of the connection. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + * @deprecated This method is offered for backward compatibility reasons, + * GetExtendedConnectionSecurityMode() should be used instead. + */ + virtual TInt GetConnectionSecurityMode( + TWlanConnectionSecurityMode& aMode ); + + /** + * (From MWlanMgmtInterface) Get the available WLAN IAPs. + * + * @param aAvailableIaps Array of IAP IDs available. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetAvailableIaps( + RArray& aAvailableIaps ); + + /** + * (From MWlanMgmtInterface) Get the available WLAN IAPs. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aAvailableIaps Array of IAP IDs available. + */ + virtual void GetAvailableIaps( + TRequestStatus& aStatus, + RArray& aAvailableIaps ); + + /** + * (From MWlanMgmtInterface) + * Get the available WLAN IAPs. + * + * @param aCacheLifetime Defines how many seconds old cached results the client + * is willing to accept. The valid is range is from 0 to + * 60 seconds. The value of -1 means the system default will + * be used. The aCacheLifetime parameter has a meaning only + * when the aMaxDelay parameter is zero. + * Value will be changed to the actual value used by the + * system. + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the availability results. The valid range is from 0 to 1200 + * seconds. + * Value will be changed to the actual value used by the system. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aAvailableIaps Array of IAP IDs available. + */ + virtual void GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus& aStatus, + RArray& aAvailableIaps ); + + /** + * (From MWlanMgmtInterface) Notify the server about changed WLAN settings. + */ + virtual void NotifyChangedSettings(); + + /** + * (From MWlanMgmtInterface) + * Adds a bssid to the blacklist + * + * @param aBssid The BSSID of the accesspoint. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt AddBssidToBlacklist( + const TWlanBssid& aBssid ); + + /** + * Updates the RSS notification class boundaries. + * + * @param aRssLevelBoundary Specifies the RSS level when a signal level notification + * should be given. This boundary is used when signal level + * is getting worse (see next parameter). + * @param aHysteresis Specifies the difference between RSS notification trigger levels + * of declining and improving signal quality, i.e. since aRssLevelBoundary + * specifies the level boundary for declining signal, the same boundary + * for improving signal is ( aRssLevelBoundary - aHysteresis ). + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt UpdateRssNotificationBoundary( + const TInt32 aRssLevelBoundary, + const TInt32 aHysteresis ); + + /** + * (From MWlanMgmtInterface) + * Perform a direct scan for an SSID and return the detected WLAN networks. + * If the SSID has zero length, a broadcast scan will be done. + * + * @param aSsid name of the WLAN network + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + virtual void GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * (From MWlanMgmtInterface) + * Perform a direct scan for an SSID and return the detected WLAN networks. + * If the SSID has zero length, a broadcast scan will be done. + * + * @param aCacheLifetime Defines how many seconds old cached results the client + * is willing to accept. The valid is range is from 0 to + * 60 seconds. The value of -1 means the system default will + * be used. The aCacheLifetime parameter has a meaning only + * when the aMaxDelay parameter is zero. + * Value will be changed to the actual value used by the + * system. + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the scan results. The valid range is from 0 to 1200 seconds. + * Value will be changed to the actual value used by the system. + * @param aSsid Name of the WLAN network. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + virtual void GetScanResults( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ); + + /** + * (From MWlanMgmtInterface) + * Start Protected Setup. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aId Service ID of network which user has selected to be configured. + * @param aCredentials Results of a successful Protected Setup operation. + */ + virtual void RunProtectedSetup( + TRequestStatus& aStatus, + TUint32 aId, + CArrayFixSeg& aCredentials ); + + /** + * (From MWlanMgmtInterface) + * Cancel an outstanding Protected Setup operation. + */ + virtual void CancelProtectedSetup(); + + /** + * (From MWlanMgmtInterface) + * Cancel an outstanding scan request. + */ + virtual void CancelGetScanResults(); + + /** + * (From MWlanMgmtInterface) + * Cancel an outstanding IAP availability request. + */ + virtual void CancelGetAvailableIaps(); + + /** + * (From MWlanMgmtInterface) + * Add a list of SSIDs to the given IAP ID. + * + * The list of SSIDs is matched against the scan results during IAP availability + * check and the corresponding IAP marked as available if a match is found. + * + * @param aIapId IAP ID the list is attached to. + * @param aSsidList List of SSIDs. Any previous list attached will be overwritten. + * @return KErrNone if the list was successfully added, an error code otherwise. + */ + virtual TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ); + + /** + * (From MWlanMgmtInterface) + * Remove any list of SSIDs attached to the given IAP ID. + * + * @param aIapId IAP ID the list is attached to. + * @return KErrNone if the list was successfully removed, an error code otherwise. + */ + virtual TInt RemoveIapSsidList( + TUint aIapId ); + + /** + * (From MWlanMgmtInterface) + * Get the currently used security mode of the WLAN connection. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aMode The security mode of the connection. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetExtendedConnectionSecurityMode( + TWlanConnectionExtentedSecurityMode& aMode ); + + /** + * Activate the extended notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * + * @param aCallback The class that implements the callback interface. + * @param aCallbackInterfaceVersion The callback interface version implemented by + * the client. + */ + virtual void ActivateExtendedNotificationsL( + MWlanMgmtNotifications& aCallback, + TUint aCallbackInterfaceVersion ); + + /** + * Create a virtual traffic stream. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aStreamParameters Traffic stream parameters to use. + * @param aStreamId Contains the ID assigned to this traffic stream + * on successful completion. + * @param aStreamStatus Contains the status of the traffic stream + * on successful completion. + */ + virtual void CreateTrafficStream( + TRequestStatus& aStatus, + const TWlanTrafficStreamParameters& aStreamParameters, + TUint& aStreamId, + TWlanTrafficStreamStatus& aStreamStatus ); + + /** + * Cancel an outstanding traffic stream creation request. + */ + virtual void CancelCreateTrafficStream(); + + /** + * Delete a virtual traffic stream. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aStreamId ID of the traffic stream to delete. + */ + virtual void DeleteTrafficStream( + TRequestStatus& aStatus, + TUint aStreamId ); + + /** + * Cancel an outstanding traffic stream deletion request. + */ + virtual void CancelDeleteTrafficStream(); + + /** + * Initiate a roam to the given BSSID. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aBssid BSSID to roam to. If set to FF:FF:FF:FF:FF:FF address, + * search for a better BSS is initiated. + */ + virtual void DirectedRoam( + TRequestStatus& aStatus, + const TWlanBssid& aBssid ); + + /** + * Cancel an outstanding directed roam request. + */ + virtual void CancelDirectedRoam(); + + /** + * Used to indicate completion of asynchronous Protected Setup request. + * @param aStatus Status of the request. + */ + void ProtectedSetupComplete( + TInt aStatus ); + + protected: // Methods + + /** + * (From MWLMNotify) Connection status has changed. + * + * @aParam aNewState specifies the new state + */ + virtual void ConnectionStateChanged( + TWlanConnectionState aNewState ); + + /** + * (From MWLMNotify) BSSID has changed (i.e. AP handover) + * + * @aParam aNewBSSID specifies the new BSSID (access point name). + */ + virtual void BSSIDChanged( + TDesC8& aNewBSSID ); + + /** + * (From MWLMNotify) Connection has lost. + */ + virtual void BSSLost(); + + /** + * (From MWLMNotify) Connection has regained. + */ + virtual void BSSRegained(); + + /** + * (From MWLMNotify) New networks have been detected during scan. + */ + virtual void NewNetworksDetected(); + + /** + * (From MWLMNotify) One or more networks have been lost since + * the last scan. + */ + virtual void OldNetworksLost(); + + /** + * (From MWLMNotify) The used transmit power has been changed. + * + * @param aPower The transmit power in mW. + */ + virtual void TransmitPowerChanged( + TUint aPower ); + + /** + * (From MWLMNotify) Received signal strength has changed to another strength class. + * + * @param specifies the rss class (normal/weak) + * @param aRcpValue specifies the actual rss value + */ + virtual void RcpChanged( + TWlanRCPLevel aRcpLevel, + TUint aRcpValue ); + + /** + * (From MWLMNotify) The status of a virtual traffic stream has changed. + * + * @param aStreamId ID of the traffic stream. + * @param aStreamStatus Status of the traffic stream. + */ + virtual void TrafficStreamStatusChanged( + TUint aStreamId, + TWlanTrafficStreamStatus aStreamStatus ); + + private: // Methods + + /** + * C++ default constructor. + */ + CWlanMgmtImpl(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + // Interface to RWLMServer + RWLMServer iServer; + + // Active Object for handling asynchronous scan requests + CWlanScanRequest* iScanRequest; + + // Status of the client active object for scan. Not owned by this class. + TRequestStatus* iPendingScanStatus; + + // Active Object for handling asynchronous GetAvailableIaps requests + CWlanAvailableIapsRequest* iAvailableIapsRequest; + + // Status of the client active object for GetAvailableIaps(). Not owned by this class. + TRequestStatus* iPendingAvailableIapsStatus; + + // Client notification callback. Not owned by this class. + MWlanMgmtNotifications* iClientNotification; + + // Active Object for handling asynchronous Protected Setup requests + CProtectedSetupRequest* iProtectedSetupRequest; + + // Status of the client active object for Protected Setup. Not owned by this class. + TRequestStatus* iPendingProtectedSetupStatus; + + // How old cached results (in seconds) the client is willing to accept. Not used + // in GetAvailableIaps and GetScanResults which have aCacheLifetime and aMaxDelay + // parameters. + TInt iCacheLifetime; + + // Maximum time (in seconds) the client is willing to wait for the scan results. Not + // used in GetAvailableIaps and GetScanResults which have aCacheLifetime and aMaxDelay + // parameters. + TUint iMaxDelay; + + }; + +/** +* Class for handling asynchronous scan requests. +*/ +class CWlanScanRequest : public CActive + { + public: // Methods + + // Constructors and destructor + + /** + * C++ default constructor. + * @param aCallback Callback interface to CWlanMgmtImpl. + * @param aServer Interface to RWLMServer. + * @param aScanInfo The scan results are stored here. + * @param aSsid name of the network + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + */ + CWlanScanRequest( + CWlanMgmtImpl& aCallback, + RWLMServer& aServer, + CWlanScanInfoImpl& aScanInfo, + const TWlanSsid& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay ); + + /** + * Destructor. + */ + virtual ~CWlanScanRequest(); + + // New methods + + /** + * Issues a new request and indicates the active scheduler + * of an outstanding request. + */ + void IssueRequest(); + + protected: // Methods + + // Methods from base classes + + /** + * (From CActive) Called when the request has been completed. + */ + virtual void RunL(); + + /** + * (From CActive) Called by the framework if RunL leaves. + * @param aError The error code RunL leaved with. + * @return One of the system-wide error codes. + */ + virtual TInt RunError( + TInt aError ); + + /** + * (From CActive) Called by the framework as part of AO's Cancel(). + */ + virtual void DoCancel(); + + private: // Data + + // Callback interface to CWlanMgmtImpl + CWlanMgmtImpl& iCallback; + + // Interface to RWLMServer + RWLMServer& iServer; + + // Handle to the scan list. + CWlanScanInfoImpl& iScanInfo; + + // SSID to scan for. + TWlanSsid iSsid; + + // How old cached results (in seconds) the client is willing to accept + TInt& iCacheLifetime; + + // Maximum time (in seconds) the client is willing to wait for the scan results. + TUint& iMaxDelay; + + }; + +/** +* Class for handling asynchronous GetAvailableIaps() requests. +*/ +class CWlanAvailableIapsRequest : public CActive + { + public: // Methods + + // Constructors and destructor + + /** + * C++ default constructor. + * @param aCallback Callback interface to CWlanMgmtImpl. + * @param aServer Interface to RWLMServer. + * @param aAvailableIaps Available IAPs are stored here. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time the client is willing to wait for the scan results. + */ + CWlanAvailableIapsRequest( + CWlanMgmtImpl& aCallback, + RWLMServer& aServer, + RArray& aAvailableIaps, + TInt& aCacheLifetime, + TUint& aMaxDelay ); + + /** + * Destructor. + */ + virtual ~CWlanAvailableIapsRequest(); + + // New methods + + /** + * Issues a new request and indicates the active scheduler + * of an outstanding request. + */ + void IssueRequest(); + + protected: // Methods + + // Methods from base classes + + /** + * (From CActive) Called when the request has been completed. + */ + virtual void RunL(); + + /** + * (From CActive) Called by the framework if RunL leaves. + * @param aError The error code RunL leaved with. + * @return One of the system-wide error codes. + */ + virtual TInt RunError( + TInt aError ); + + /** + * (From CActive) Called by the framework as part of AO's Cancel(). + */ + virtual void DoCancel(); + + private: // Data + + // Callback interface to CWlanMgmtImpl + CWlanMgmtImpl& iCallback; + + // Interface to RWLMServer + RWLMServer& iServer; + + // Handle to client storage for available IAPs + RArray& iPendingAvailableIaps; + + // Storage for available IAPs + TWlmAvailableIaps iAvailableIaps; + + // The package buffer needed for the asynchronous request + TPckg iAvailableIapsBuf; + + // The package buffer needed for the asynchronous request + TPckg iCacheLifetimeBuf; + + // The package buffer needed for the asynchronous request + TPckg iMaxDelayBuf; + + }; + + +/** +* Class for handling asynchronous Protected Setup requests. +*/ +class CProtectedSetupRequest : public CActive + { + public: // Methods + + // Constructors and destructor + + /** + * C++ default constructor. + * @param aCallback Callback interface to CWlanMgmtImpl. + * @param aServer Interface to RWLMServer. + * @param aId Service ID of network which user has selected to be configured. + * @param aCredentials Results of a successful Protected Setup operation. + */ + CProtectedSetupRequest( + CWlanMgmtImpl& aCallback, + RWLMServer& aServer, + TUint32 aId, + CArrayFixSeg& aCredentials ); + + /** + * Destructor. + */ + virtual ~CProtectedSetupRequest(); + + // New methods + + /** + * Issues a new request and indicates the active scheduler + * of an outstanding request. + */ + void IssueRequest(); + + protected: // Methods + + // Methods from base classes + + /** + * (From CActive) Called when the request has been completed. + */ + virtual void RunL(); + + /** + * (From CActive) Called by the framework if RunL leaves. + * @param aError The error code RunL leaved with. + * @return One of the system-wide error codes. + */ + virtual TInt RunError( + TInt aError ); + + /** + * (From CActive) Called by the framework as part of AO's Cancel(). + */ + virtual void DoCancel(); + + private: // Data + + // Callback interface to CWlanMgmtImpl + CWlanMgmtImpl& iCallback; + + // Interface to RWLMServer + RWLMServer& iServer; + + // Service ID of network which user has selected to be configured. + TUint32 iServiceId; + + // Results of a successful Protected Setup operation. + CArrayFixSeg& iCredentials; + + // Storage for received credentials. + TWlmProtectedSetupCredentials iCredentialsStorage; + + // The package buffer needed for the asynchronous request. + TPckg iCredentialsBuf; + }; + +#endif // WLANMGMTIMPL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtpacket.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanmgmtpacket.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Callback interface to pass management packets. +* +*/ + + +#ifndef WLANMGMTPACKET_H +#define WLANMGMTPACKET_H + +// CLASS DECLARATION + +/** +* Interface to forward received management packets. +*/ +class MWlanMgmtPacket + { + public: + /** + * Inform about new received management packet. + * @param aLength Length of the data. + * @param aData The data. + * @return General Symbian error code. + */ + virtual TInt ReceivePacket( const TUint aLength, const TUint8* const aData )=0; + }; + +#endif // WLANMGMTPACKET_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlannotificationhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlannotificationhandler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class to receive asynchronous notifications from WLAN drivers. +* +*/ + + +#ifndef WLANNOTIFICATIONHANDLER_H +#define WLANNOTIFICATIONHANDLER_H + +#include + +#include "umac_types.h" +#include "am_platform_libraries.h" + +class RWlanLogicalChannel; + +/** + * Callback interface + */ +class MWlanNotificationCallback + { + public: + virtual void OnNotify(const TIndication& aIndication) = 0; + }; + +/** + * Active Object that receives notifications from driver side + * @since S60 v.3.0 + * @lib wlmserversrv.lib + */ +NONSHARABLE_CLASS( CWlanNotificationHandler ) : public CActive + { +public: // Constructors and destructor + + static CWlanNotificationHandler* NewL( + RWlanLogicalChannel& aChannel, + MWlanNotificationCallback& aClient ); + + /** + * C++ default constructor. + * @param aService Interface to request notifirations. + * @param aClient Interface to forward notifications. + */ + CWlanNotificationHandler( + RWlanLogicalChannel& aChannel, + MWlanNotificationCallback& aClient ); + + /** + * Destructor. + */ + virtual ~CWlanNotificationHandler(); + +public: // New methods + + /** + * Activate the handler + * Handler starts to listen for notifications + * @since S60 v.3.1 + * @return error code + */ + TInt Start(); + + /** + * Deactivate the handler + * Handler stops to listen for received management frames + * @since S60 v.3.1 + */ + void Stop(); + +public: // Methods from base classes + + /** + * From CActive + * Cancel waiting. + */ + void DoCancel(); + + /** + * From CActive + * Receive an event.. + */ + void RunL(); + +protected: + + /** + * ConstructL + */ + void ConstructL(); + + /** + * Wait for an event + */ + void IssueRequest(); + +private: // data + + /** + * Provider of the asynchronous service + */ + RWlanLogicalChannel& iChannel; + + /** + * Reference to the client + */ + MWlanNotificationCallback& iClient; + + /** + * The indication message to be sent to the client + */ + TIndication iIndication; + + }; + +#endif // WLANNOTIFICATIONHANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscaninfoimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscaninfoimpl.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: scan info +* +*/ + + +#ifndef WLANSCANINFOIMPL_H +#define WLANSCANINFOIMPL_H + +// INCLUDES +#include "rwlmserver.h" +#include "genscaninfo.h" +#include "genscanlist.h" +#include "wlanscaninfo.h" + +class ScanInfo; + +// CLASS DECLARATION +/** +* Implementation for MWlanScanInfoBase and MWlanScanInfoIteratorBase interfaces. +* +* This class uses services from ScanInfo and ScanList classes to implement +* most of the required functionality. +* @lib wlanmgmtimpl.dll +* @since S60 3.0 +*/ +class CWlanScanInfoImpl : public CWlanScanInfo + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + static CWlanScanInfoImpl* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanScanInfoImpl(); + + // New methods + + /** + * Return the reference to the internal scan list. + * @return Internal scan list. + */ + ScanList& GetInternalList(); + + /** + * Update the internal variables after the internal + * scan list has been updated. + * @return KErrNone if results updated successfully, an error code otherwise. + */ + TInt UpdateResults(); + + // Methods from base classes + + /** + * (From MWlanScanInfoIteratorBase) Return the size of the scan info. + * The size includes Status Info, MAC header and Frame Body. + * @return The size of the scan info in bytes. + */ + virtual TUint16 Size() const; + + /** + * (From MWlanScanInfoIteratorBase) Find the data of the first access point. + * @return Pointer at the beginning of the first access point stored + * in the scan list. NULL if not any. + */ + virtual const TWlanScanInfoFrame* First(); + + /** + * (From MWlanScanInfoIteratorBase) Find the data of the next access point. + * @return Pointer at the beginning of the next access point stored + * in the scan list. NULL if not any. + */ + virtual const TWlanScanInfoFrame* Next(); + + /** + * (From MWlanScanInfoIteratorBase) Find the data of the current access point. + * @return Pointer at the beginning of the current access point stored + * in the scan list. NULL if not any. + */ + virtual const TWlanScanInfoFrame* Current() const; + + /** + * (From MWlanScanInfoIteratorBase) Find is there any more unhandled access points. + * @return EFalse if there is access points in the list left, + * ETrue if not. + */ + virtual TBool IsDone() const; + + /** + * (From MWlanScanInfoBase) Return RX level of the BSS. + * @return RX level. + */ + virtual TUint8 RXLevel() const; + + /** + * (From MWlanScanInfoBase) Return BSSID of the BSS. + * @param aBssid ID of the access point or IBSS network. + * @return Pointer to the beginning of the BSSID. Length is always 6 bytes. + */ + virtual void Bssid( TWlanBssid& aBssid ) const; + + /** + * (From MWlanScanInfoBase) Get beacon interval of the BSS. + * @return the beacon interval. + */ + virtual TUint16 BeaconInterval() const; + + /** + * (From MWlanScanInfoBase) Get capability of the BSS (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + virtual TUint16 Capability() const; + + /** + * (From MWlanScanInfoBase) Get security mode of the BSS. + * @return security mode. + * @deprecated This method is offered for backward compatibility reasons, + * ExtendedSecurityMode() should be used instead. + */ + virtual TWlanConnectionSecurityMode SecurityMode() const; + + /** + * (From MWlanScanInfoBase) Return requested information element. + * @param aIE Id of the requested IE data. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt InformationElement( TUint8 aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * (From MWlanScanInfoBase) Return WPA information element. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt WpaIE( TUint8& aLength, + const TUint8** aData ); + + /** + * (From MWlanScanInfoBase) Return the first information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt FirstIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * (From MWlanScanInfoBase) Return next information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt NextIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ); + + /** + * Find whether Wi-Fi Protected Setup is supported. + * @return ETrue if AP supports Wi-Fi Protected Setup, + * EFalse if not. + */ + virtual TBool IsProtectedSetupSupported(); + + /** + * Get security mode of the BSS. + * @return security mode. + */ + virtual TWlanConnectionExtentedSecurityMode ExtendedSecurityMode() const; + + private: // Methods + + /** + * C++ default constructor. + */ + CWlanScanInfoImpl(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Convert internal error code to Symbian error code. + * @param aCode Internal error code. + * @return Symbian error code. + */ + TInt ConvertErrorCode( TInt aCode ) const; + + private: // Data + + /** Scan results */ + ScanList iScanList; + + /** Wrapper class for parsing */ + ScanInfo* iScanInfo; + }; + +#endif // WLANSCANINFOIMPL_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanproviderinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanproviderinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This abstract class defines WLAN scan provider interface. +* +*/ + +/* +* %version: 4 % +*/ + + +#ifndef WLANSCANPROVIDERINTERFACE_H +#define WLANSCANPROVIDERINTERFACE_H + +/** + * @brief Interface definition for WLAN Scan Result Provider API. + * + * This class defines the methods used for issuing and cancelling Scan requests. + * + * @since S60 v5.2 + */ +class MWlanScanResultProvider + { + +public: + + /** + * Issue scan request. + * + * @since S60 v5.2 + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the availability results. The valid range is from 0 to 1200 + * seconds. + */ + virtual void Scan( const TUint& aMaxDelay ) = 0; + + /** + * Cancel pending scan request. + * + * @since S60 v5.2 + */ + virtual void CancelScan() = 0; + + }; + + + +/** + * @brief Interface definition for WLAN Background Scan Provider API. + * + * This class defines the methods WLAN engine uses to communicate with + * WLAN Background Scan provider. + * + * @since S60 v5.2 + */ +class MWlanBgScanProvider + { + +public: + + struct TWlanBgScanSettings + { + TUint32 backgroundScanInterval; + TUint psmServerMode; + TUint bgScanPeakStartTime; + TUint bgScanPeakEndTime; + TUint32 bgScanIntervalPeak; + TUint32 bgScanIntervalOffPeak; + + TWlanBgScanSettings() : + backgroundScanInterval( 0 ), + psmServerMode( 0 ), + bgScanPeakStartTime( 0), + bgScanPeakEndTime( 0 ), + bgScanIntervalPeak( 0 ), + bgScanIntervalOffPeak( 0 ) + { } + + TWlanBgScanSettings( TUint32 aBackgroundScanInterval, + TUint aPsmServerMode, + TUint aBgScanPeakStartTime, + TUint aBgScanPeakEndTime, + TUint32 aBgScanIntervalPeak, + TUint32 aBgScanIntervalOffPeak ) : + backgroundScanInterval( aBackgroundScanInterval ), + psmServerMode( aPsmServerMode ), + bgScanPeakStartTime( aBgScanPeakStartTime), + bgScanPeakEndTime( aBgScanPeakEndTime ), + bgScanIntervalPeak( aBgScanIntervalPeak ), + bgScanIntervalOffPeak( aBgScanIntervalOffPeak ) + { } + + }; + + /** + * Called when Scan is complete. + * + * @since S60 v5.2 + */ + virtual void ScanComplete() = 0; + + /** + * Issued when WLAN is disconnected. + * + * @since S60 v5.2 + */ + virtual void NotConnected() = 0; + + /** + * Whether background scan is enabled. + * + * @since S60 v5.2 + * @return True if background scan is enabled, + * False otherwise. + */ + virtual TBool IsBgScanEnabled() = 0; + + /** + * Notification about changed settings. + * + * @since S60 v5.2 + * + * @param aSettings new settings to be taken into use + */ + virtual void NotifyChangedSettings( TWlanBgScanSettings& aSettings ) = 0; + + }; + + +#endif // WLANSCANPROVIDERINTERFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Cache for scan results +* +*/ + + +#ifndef WLANSCANRESULTCACHE_H +#define WLANSCANRESULTCACHE_H + +#include +#include "genscanlist.h" +#include "wlmclientserver.h" +#include "genscaninfo.h" +#include "core_type_list.h" + +/** +* Structure for storing information about an available network. +*/ +struct TWlanAvailableNetwork + { + TBuf8 ssid; + EConnectionMode networkType; + WlanSecurityMode securityMode; + }; + +/** + * CWlanScanResultCache + * The class caches latest scan results for a specific time period. + * Also caches the latest list of available IAPs (IAP list has no expiry time) + * @lib wlmserversrv.lib + * @since Series 60 3.1 + */ +NONSHARABLE_CLASS( CWlanScanResultCache ) : public CBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CWlanScanResultCache* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanScanResultCache(); + + /** + * UpdateScanList updates the cached list of scan results + * @param aScanList contains the new scan results + * @return errorcode + */ + void UpdateScanList( + ScanList* aScanList ); + + /** + * Returns the latest scanresults if they are fresh enough + * @param aCacheLifetime how old results (in seconds) are considered valid. + * @return pointer to ScanList or NULL if they are not available + * or they are too old + */ + ScanList* GetScanList( + TUint aCacheLifetime ); + + /** + * Updates the list of available networks (IAPs and SSIDs) + * @param aIapIdList List of available IAPs. + * @param aNetworkList List of available networks. + * @param aNewIapsAvailable is set to ETrue on completion if + * new networks or IAPs were detected since the last update. + * @param aOldIapsLost is set to ETrue on completion if + * networks or IAPs have been lost since the last update. + */ + void UpdateAvailableNetworksList( + core_type_list_c& aIapIdList, + RArray& aNetworkList, + TBool& aNewIapsAvailable, + TBool& aOldIapsLost ); + + /** + * Returns the latest list of available IAPs if they are fresh enough. + * + * @param aIapList Latest list of WLAN IAPs from commsdat. + * @param aCacheLifetime how old results (in seconds) are considered valid. + * @return Pointer to list of available IAPs or NULL if they are not available + * or they are too old. + */ + RArray* AvailableIaps( + RArray& aIapList, + TUint aCacheLifetime ); + + /** + * Returns the latest list of WLAN IAPs from commsdat. + * + * @param aIapList List of WLAN IAPs. + * @return KErrNone if successful, an error code otherwise. + */ + TInt GetIapDataList( + RArray& aIapList ); + + /** + * Return the cached list of WLAN IAPs. + * + * @return The cached list of WLAN IAPs. + */ + const RArray& CachedIapDataList() const; + + /** + * Mark currently cached IAP availability results as invalid. + */ + void InvalidateAvailabilityCache(); + +private: // Functions + + /** + * C++ default constructor. + */ + CWlanScanResultCache(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Method for determining whether two networks are equal. + * @param aFirst First network. + * @param aSecond Second network. + * @return Result of comparison. + */ + static TBool IsNetworkEqual( + const TWlanAvailableNetwork& aFirst, + const TWlanAvailableNetwork& aSecond ); + + /** + * Check whether the given IAP list is equal with the given IAP data list. + * + * @param aIapList IAP list to compare. + * @param aIapDataList IAP data list to compare against. + * @return ETrue is the lists are equal, EFalse otherwise. + */ + TBool IsIapListEqual( + const RArray& aFirst, + const RArray& aSecond ); + + /** + * Update the list of IAPs from the given IAP data list. + * + * @param aIapDataList IAP data list to update from. + */ + void UpdateIapList( + const RArray& aIapDataList ); + +private: // Data + + /** Latest ScanList */ + ScanList* iScanList; + + /** Scanlist timestamp */ + TTime iScanListTimeStamp; + + /** IapList timestamp */ + TTime iIapListTimeStamp; + + /** Latest list of IAPs. */ + RArray iIapList; + + /** Latest list of available IAPs */ + RArray iAvailableIapList; + + /** Latest list of available networks */ + RArray iAvailableNetworkList; + + }; + +#endif // WLANSCANRESULTCACHE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanssidlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanssidlist.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class implementing storage for an SSID list. +* +*/ + + +#ifndef WLANSSIDLIST_H +#define WLANSSIDLIST_H + +#include +#include +#include +#include + +/** + * This class implements storage for an SSID list. + * + * @since S60 v5.1 + */ +NONSHARABLE_CLASS( CWlanSsidList ) : public CBase + { + +public: + + /** + * Two-phased constructor. + * + * @param aGranularity Granularity to use when allocating memory. + */ + static CWlanSsidList* NewL( + TUint aGranularity ); + + /** + * Destructor. + */ + virtual ~CWlanSsidList(); + + /** + * Add an SSID to the list. + * + * @since S60 v5.1 + * @param aSsid SSID to add. + * @return KErrNone on success, an error code otherwise. + */ + TInt AddSsid( + const TWlanSsid& aSsid ); + + /** + * Check whether the given SSID is in the list. + * + * @since S60 v5.1 + * @param aSsid SSID to search for. + * @return ETrue if SSID in the list, EFalse otherwise. + */ + TBool IsInList( + const TWlanSsid& aSsid ) const; + + /** + * Return the amount SSIDs in the list. + * + * @return The amount SSIDs in the list. + */ + TUint Count() const; + + /** + * Write the contents of the SSID list to the given stream. + * + * @since S60 v5.1 + * @param aStream Stream to write to. + */ + void ExternalizeL( + RWriteStream& aStream ) const; + + /** + * Read the contents of the SSID list from the given stream. + * + * @since S60 v5.1 + * @param aStream Stream to read from. + */ + void InternalizeL( + RReadStream& aStream ); + +private: + + /** + * Constructor. + * + * @param aGranularity Granularity to use when allocating memory. + */ + CWlanSsidList( + TUint aGranularity ); + + /** + * 2nd state constructor. + */ + void ConstructL(); + + /** + * Determine the linear order of the two SSIDs. + * + * @param aLeft First SSID to compare. + * @param aRight Second SSID to compare. + * @return Zero if SSIDs are equal, negative if the first one is less, + * posive if the first one is greater. + */ + static TInt LinearOrder( + const TWlanSsid& aLeft, + const TWlanSsid& aRight ); + +private: // data + + /** + * List of SSIDs. + */ + RArray iSsidList; + + /** + * Function used to determine the order of two SSIDs. + */ + TLinearOrder iLinearOrder; + + }; + +#endif // WLANSSIDLIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanssidlistdb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanssidlistdb.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class implementing a file-based storage for SSID lists. +* +*/ + + +#ifndef WLANSSIDLISTDB_H +#define WLANSSIDLISTDB_H + +#include +#include +#include +#include "wlanssidlist.h" + +/** + * This class implements a file-based storage for SSID lists. + * + * @since S60 v5.1 + */ +NONSHARABLE_CLASS( CWlanSsidListDb ) : public CBase + { + +public: + + /** + * This class stores information about SSID list mappings. + */ + class TWlanSsidListMapEntry + { + public: + + /** + * Constructor. + */ + TWlanSsidListMapEntry( + TUint aIap ) : iIap( aIap ), iStreamId( KNullStreamIdValue ) { } + + public: // data + + /** + * IAP ID this list is attached to. + * */ + TUint iIap; + + /** + * Stream ID for file storage. + */ + TStreamId iStreamId; + + }; + + /** + * Two-phased constructor. + */ + static CWlanSsidListDb* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanSsidListDb(); + + /** + * Store the given SSID list to disk. + * + * @since S60 v5.1 + * @param aIap IAP ID the list is attached to. + * @param aSsidList SSID list to store. + */ + void WriteListL( + TUint aIap, + const CWlanSsidList& aSsidList ); + + /** + * Read a SSID list from disk. + * + * @since S60 v5.1 + * @param aIap IAP ID the list is attached to. + * @param aSsidList SSID list to store contents into. + */ + void ReadListL( + TUint aIap, + CWlanSsidList& aSsidList ); + + /** + * Delete an SSID list from disk. + * + * @since S60 v5.1 + * @param aIap IAP ID the list is attached to. + */ + void DeleteListL( + TUint aIap ); + + /** + * Check whether an IAP has an SSID list attached. + * + * @since S60 v5.1 + * @param aIap IAP ID the list is attached to. + * @return ETrue if an list exists, EFalse otherwise. + */ + TBool IsListAttached( + TUint aIap ); + +private: + + /** + * Constructor. + */ + CWlanSsidListDb(); + + /** + * 2nd state constructor. + */ + void ConstructL(); + +private: // data + + /** + * List of SSID list mapping entries. + */ + RArray iSsidListMap; + + }; + +#endif // WLANSSIDLISTDB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlansystemtimehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlansystemtimehandler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object to get notification of system time change. +* +*/ + + +#ifndef WLANSYSTEMTIMEHANDLER_H +#define WLANSYSTEMTIMEHANDLER_H + +#include +#include + + +/** + * Callback interface + */ +class MWlanSystemTimeCallback + { + public: + + /** + * User has changed the time and therefore WLAN region cache is not valid anymore. + */ + virtual void OnSystemTimeChange() = 0; + + /** + * WLAN region cache needs to be always cleared after defined time. + */ + virtual void OnCacheClearTimerExpiration() = 0; + }; + +/** + * System time change handler. + * Active object that waits for system time change + * notification from Symbian side. + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CWlanSystemTimeHandler ) : public CActive + { +public: // Constructors and destructor + + /** + * Static constructor. + * @param aClient Interfce to client. + */ + static CWlanSystemTimeHandler* NewL( + MWlanSystemTimeCallback& aClient); + + /** + * Destructor. + */ + virtual ~CWlanSystemTimeHandler(); + +public: // New functions + + /** + * Start the timer + * Handler starts to wait for system time change notifications + * @since S60 v.5.0 + * @return error code + */ + TInt StartTimer(); + + /** + * Stop the timer + * Handler stops to wait for system time change notifications + * @since S60 v.5.0 + * @return error code + */ + void StopTimer(); + + +public: // Functions from base classes + + /** + * From CActive Is executed when synchronous request is ready. + */ + void RunL(); + + /** + * From CActive Cancel synchronous request. + */ + void DoCancel(); + +private: // Functions + + /** + * C++ default constructor. + * @param aClient Interfce to client. + */ + CWlanSystemTimeHandler( + MWlanSystemTimeCallback& aClient ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // Data + + /** + * Asynchronous timer used to receive notification for system time change. + */ + RTimer iTimer; + + /** + * Interface to forward packets. + */ + MWlanSystemTimeCallback& iClient; + + }; + +/** + * Region cache clearing handler. + * Active object that ensures that region cache is cleared after defined time. + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CWlanPeriodicCacheClearingHandler ) : public CActive + { +public: // Constructors and destructor + + /** + * Static constructor. + * @param aClient Interfce to client. + */ + static CWlanPeriodicCacheClearingHandler* NewL( + MWlanSystemTimeCallback& aClient); + + /** + * Destructor. + */ + virtual ~CWlanPeriodicCacheClearingHandler(); + +public: // New functions + + /** + * Start the timer + * Handler starts to wait for region cache clearing timer expiration. + * @since S60 v.5.0 + * @return error code + */ + TInt StartTimer(); + + /** + * Stop the timer + * Handler stops to wait for region cache clearing timer expiration. + * @since S60 v.5.0 + * @return error code + */ + void StopTimer(); + + +public: // Functions from base classes + + /** + * From CActive Is executed when synchronous request is ready. + */ + void RunL(); + + /** + * From CActive Cancel synchronous request. + */ + void DoCancel(); + +private: // Functions + + /** + * C++ default constructor. + * @param aClient Interfce to client. + */ + CWlanPeriodicCacheClearingHandler( + MWlanSystemTimeCallback& aClient ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // Data + + /** + * Asynchronous timer used to ensure that WLAN region cache is cleared after + * defined time. + */ + RTimer iClearTimer; + + /** + * The amount of times that iClearTimer needs to be started before the + * whole region cache expiration time has exceeded. + */ + TInt iClearTimerCounter; + + /** + * Interface to forward the information that timer has expired. + */ + MWlanSystemTimeCallback& iClient; + + }; + +#endif // WLANSYSTEMTIMEHANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlantimerservices.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlantimerservices.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,255 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements timer service with callback functionality. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANTIMERSERVICES_H +#define WLANTIMERSERVICES_H + +#include +#include +#include + + +/** + * Callback interface + */ +class MWlanTimerServiceCallback + { + public: + + /** + * Timeout has occurred. + */ + virtual void OnTimeout() = 0; + + }; + +class CTimeoutRequestEntry : public CBase + { +public: + CTimeoutRequestEntry::CTimeoutRequestEntry( + TTime& aAt, + MWlanTimerServiceCallback& aCb, + TUint aRequestId, + TBool aDoSeveralRounds ) : + iCb( aCb ), + iAt( aAt ), + iRequestId( aRequestId ), + iDoSeveralRounds( aDoSeveralRounds ) + {} + void Timeout() + { + iCb.OnTimeout(); + } + const TTime& At() const + { + return iAt; + } + TTime& GetAt() + { + return iAt; + } + const TUint RequestId() const + { + return iRequestId; + } + TBool& GetDoSeveralRounds() + { + return iDoSeveralRounds; + } + +private: + MWlanTimerServiceCallback& iCb; + TTime iAt; + TUint iRequestId; + TBool iDoSeveralRounds; + }; + +/** + * Class providing timer services. + * + * @since S60 v5.2 + */ +NONSHARABLE_CLASS( CWlanTimerServices ) : public CActive + { +public: // Constructors and destructor + + /** + * Static constructor. + */ + static CWlanTimerServices* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanTimerServices(); + +public: // New functions + + /** + * Start the timer + * + * @since S60 v5.2 + * @param aRequestId reference to request id + * @param aAt reference to time when timeout should occur + * @param aCb reference to callback object + * @return error code + */ + TInt StartTimer( TUint& aRequestId, TTime& aAt, MWlanTimerServiceCallback& aCb ); + + /** + * Stop the timer + * + * @since S60 v5.2 + * @param aRequestId Id of timer to stop + */ + void StopTimer( const TUint& aRequestId ); + + /** + * Handles timer timeout. + * + * @since S60 v5.2 + */ + void HandleTimeout(); + +public: // Functions from base classes + + /** + * From CActive Is executed when synchronous request is ready. + */ + void RunL(); + + /** + * From CActive Cancel synchronous request. + */ + void DoCancel(); + +private: // Functions + + /** + * C++ default constructor. + */ + CWlanTimerServices(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Compare timeouts of two timeout request entries. + * + * @since S60 v5.2 + * + * @param aFirst first entry. + * @param aSecond second entry. + * @return 0 if entries have same timeout value, + * 1 if first entry has bigger timeout value, + * -1 if second entry has bigger timeout value + */ + static TInt CompareTimeouts( const CTimeoutRequestEntry& aFirst, + const CTimeoutRequestEntry& aSecond ); + + /** + * Calculates a microsecond interval to be used in timer. + * + * @since S60 v5.2 + * + * @param aInterval interval will be written to here. + * @param aAt time when timeout should occur. If more than a day apart from current time, + * day will be set to current day. + * @param aDoSeveralRounds here will be written whether several timer rounds are needed. + * @return KErrArgument if aAt happens in past, + * KErrNone otherwise + */ + TInt CalculateInterval( TTimeIntervalMicroSeconds32& aInterval, + TTime& aAt, + TBool& aDoSeveralRounds ) const; + + /** + * Returns request id of the first request. + * + * @since S60 v5.2 + * + * @return id of the first request + */ + TInt RequestIdOfFirstEntry(); + + /** + * Removes a request from the request map. + * + * @since S60 v5.2 + * + * @param aRequestId request to be removed. + */ + void RemoveRequest( const TUint& aRequestId ); + + /** + * Get interval for next request. + * Times out requests which happen in past and only + * returns interval for next request happening in future. + * + * @since S60 v5.2 + * + * @return interval for the next request + */ + TTimeIntervalMicroSeconds32 GetIntervalForNextRequest(); + + /** + * Is time in future. + * + * @since S60 v5.2 + * + * @return ETrue if time is in the future, + * EFalse otherwise + */ + TBool IsTimeInFuture( const TTime& aAt ) const; + + /** + * Activates timer + * + * @since S60 v5.2 + * + * @param aInterval interval for timer + */ + void ActivateTimer( const TTimeIntervalMicroSeconds32& aInterval ); + +private: // Data + + /** + * The timer. + */ + RTimer iTimer; + + /** + * All timeout requests. + */ + RArray iRequests; + + /** + * Unique identifier for requests. + */ + TUint iRequestId; + + }; + + + +#endif // WLANTIMERSERVICES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanversion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanversion.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: specifies the version of the wlanengine interface towards drivers +* +*/ + + +#ifndef WLANVERSION_H +#define WLANVERSION_H + +/// Current WLAN Interface version for LDD + + +const TInt KWlanDriverMajorVersion = 1; +const TInt KWlanDriverMinorVersion = 0; +const TInt KWlanDriverBuildVersion = 0; + + +#endif // WLANVERSION_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmclientserver.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,541 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data structures for client server communication in WLMServer. +* +*/ + +/* +* %version: 40 % +*/ + +#ifndef WLMCLIENTSERVER_H +#define WLMCLIENTSERVER_H + +#include "umacoidmsg.h" +#include +#include +#include + +_LIT(KWLMServerExe, "Z:\\system\\libs\\WLMSERVEREXE"); +_LIT(KWLMServerSemaphore, "WLMServerSemaphore"); +_LIT(KWLMDataServerName, "WlanServer"); + +/** Version number */ +const TUint KWLMServMajorVersionNumber = 1; +/** Release number */ +const TUint KWLMServMinorVersionNumber = 0; +/** Build number */ +const TUint KWLMServBuildVersionNumber = 1; + +const TUint KMaxWepKeyStrLength = 32; // WEP max 128 bits -> 16 bytes -> 32 chars +const TUint KMaxDBFieldLength = 50; +const TUint KMaxNotificationLength = 128; // Max data length for notification data. + +/** + * The maximum number of available IAPs returned. + */ +const TUint KWlmMaxAvailableIaps = 64; + +/** + * The maximum number of association failures before the AP is blacklisted. + */ +const TUint KWlmMaxApFailureCount = 5; + +/** + * The maximum number of Protected Setup credentials. + */ +const TUint KWlmProtectedSetupMaxCount = 8; + +/** + * The maximum number of BSSIDs in the rogue list. + */ +const TUint KWlmRogueListMaxCount = 10; + +/** + * The maximum size of the scan list is 50kB. + */ +const TUint KWlmScanListMaxSize = 51200; + +// DATA TYPES + +/** +* Data values for connection states. +*/ +enum TWlanConnectionState + { + /** Connection is not active. No data flow. */ + EWlanStateNotConnected, + /** Connection to access point is active. */ + EWlanStateInfrastructure, + /** Searching access point. No data flow. */ + EWlanStateSearchingAP, + /** AdHoc network is active. */ + EWlanStateIBSS, + /** HW/SW/PC testing mode active. Testing only. */ + EWlanStateSecureInfra, + /** Unknown state. */ + EConnectionStateUnknown + }; + +/** +* Data values for security modes. +*/ +enum TWlanSecurity + { + EWlanSecurityOpen, + EWlanSecurityWepOpen, + EWlanSecurityWepShared, + EWlanSecurity802d1x, + EWlanSecurityWpa, + EWlanSecurityWpaPsk, + EWlanSecurityWpa2, + EWlanSecurityWpa2Psk, + EWlanSecurityWapi, + EWlanSecurityWapiPsk, + }; + +/** +* Data values for system modes. +*/ +enum TWlanSystemMode + { + EWlanSystemNormal, + EWlanSystemFlight, + EWlanSystemDisabled, + EWlanSystemStartupInProgress + }; + +/** +* Data values for RSS classes. +* These has to be in synch with TWlanRssClass and +* core_rss_level +*/ +enum TWlanRCPLevel + { + EWlanRcpNormal, + EWlanRcpWeak + }; + +/** +* Commands from client to server. +*/ +enum TWLMCommands + { + /** Ask server to send notifications to this session. */ + EOrderNotifications, + /** Cancel server to stop sending notifications to this session. */ + ECancelNotifications, + /** Get results of last access point scan. */ + EGetScanResults, + /** Cancel an outstanding scan request. */ + ECancelGetScanResults, + /** Join to a access point / ad hoc network by Profile id. */ + EJoinByProfileId, + /** Cancel an outstanding join request. */ + ECancelJoin, + /** Start an ad hoc nw / join to an ad hoc nw. */ + EStartIBSS, + /** Reset connection. */ + EReset, + /** Get available WLAN IAPs. */ + EGetAvailableIaps, + /** Cancel an outstanding IAP availability request. */ + ECancelGetAvailableIaps, + /** Get current state of the connection. */ + EGetCurrentState, + /** Get current signal strength, 0 if no connection. */ + EGetCurrentRSSI, + /** Get the MAC address of AP/STA that is being connected to. */ + EGetMacAddress, + /** Get the name of the current network. */ + EGetNetworkName, + /** Get the current security mode. */ + EGetSecurityMode, + /** Get the current system mode. */ + EGetSystemMode, + /** Notify the server about changed settings. */ + ENotifyChangedSettings, + /** Add BSSID to roguelist (blacklist) */ + EAddBssidToRoguelist, + /** Update RCP notification boundaries */ + EUpdateRcpNotificationBoundaries, + /** Configure multicast address */ + EConfigureMulticastGroup, + /** Get packet statistics of the current connection. */ + EGetPacketStatistics, + /** Clear packet statistics of the current connection. */ + EClearPacketStatistics, + /** Get the current U-APSD settings. */ + EGetUapsdSettings, + /** Set the U-APSD settings. */ + ESetUapsdSettings, + /** Get the current power save settings. */ + EGetPowerSaveSettings, + /** Set the power save settings. */ + ESetPowerSaveSettings, + /** Run Protected setup */ + ERunProtectedSetup, + /** Cancel Protected setup */ + ECancelProtectedSetup, + /** Request creation of a traffic stream. */ + ECreateTrafficStream, + /** Cancel a pending traffic stream creation request. */ + ECancelCreateTrafficStream, + /** Request deletion of a traffic stream. */ + EDeleteTrafficStream, + /** Cancel a pending traffic stream deletion request. */ + ECancelDeleteTrafficStream, + /** Get information about the current AP. */ + EGetAccessPointInfo, + /** Get roam metrics of the current connection. */ + EGetRoamMetrics, + /** Get a list of BSSIDs on the rogue list. */ + EGetRogueList, + /** Get the current regulatory domain. */ + EGetRegulatoryDomain, + /** Get the current power save mode. */ + EGetPowerSaveMode, + /** Add a list of SSIDs to an IAP. */ + EAddIapSsidList, + /** Remove any list of SSIDs attached to an IAP. */ + ERemoveIapSsidList, + /** Set the power save mode. */ + ESetPowerSaveMode, + /** Notify the server about changed PSM server mode. */ + ENotifyChangedPsmSrvMode, + /** Get the current traffic status for access classes. */ + EGetAcTrafficStatus, + /** Initiate a roam to the given BSSID. */ + EDirectedRoam, + /** Cancel a pending directed roam request. */ + ECancelDirectedRoam + }; + +/** +* Nofications from server to client. +*/ +enum TWlmNotify + { + EWlmNotifyNone = 0x0000, + EWlmNotifyConnectionStateChanged = 0x0001, + EWlmNotifyBssidChanged = 0x0002, + EWlmNotifyBssLost = 0x0004, + EWlmNotifyBssRegained = 0x0008, + EWlmNotifyNewNetworksDetected = 0x0010, + EWlmNotifyOldNetworksLost = 0x0020, + EWlmNotifyTransmitPowerChanged = 0x0040, + EWlmNotifyNotificationsCancelled = 0x0080, + EWlmNotifyRcpChanged = 0x0100, + EWlmNotifyTrafficStreamStatusChanged = 0x0200, + EWlmNotifyAccessPointInfoChanged = 0x0400, + EWlmNotifyRcpiRoamAttemptStarted = 0x0800, + EWlmNotifyRcpiRoamAttemptCompleted = 0x1000, + EWlmNotifyBrokenPowerSaveTestFailed = 0x2000, + EWlmNotifyAcTrafficModeChanged = 0x4000, + EWlmNotifyAcTrafficStatusChanged = 0x8000 + }; + +/** + * Default notifications for callback API v1. + */ +const TUint32 KWlmDefaultNotificationsV1 = + EWlmNotifyConnectionStateChanged | + EWlmNotifyBssidChanged | + EWlmNotifyBssLost | + EWlmNotifyBssRegained | + EWlmNotifyNewNetworksDetected | + EWlmNotifyOldNetworksLost | + EWlmNotifyTransmitPowerChanged | + EWlmNotifyNotificationsCancelled | + EWlmNotifyRcpChanged; + +/** + * Default notifications for callback API v2. + */ +const TUint32 KWlmDefaultNotificationsV2 = + KWlmDefaultNotificationsV1 | + EWlmNotifyTrafficStreamStatusChanged; + +/** +* Notifications' data. +*/ +struct TWlmNotifyData + { + TBuf8 data; + }; + +/** +* Bit mask for overrided settings. +*/ +enum TOverrideSettingsMask + { + EOverrideNoneMask = 0x00000000, + EOverrideSsidMask = 0x00000001, + EOverrideBssidMask = 0x00000002, + EOverrideWepMask = 0x00000004, + EOverrideWpaPskMask = 0x00000008, + EOverrideWpaMask = 0x00000010, /** Use WPA handshake, if bit defined. */ + EOverrideIbssMask = 0x00000020 /** Use IBSS mode, if bit defined. */ + }; + +/** + * The possible statuses of a traffic stream. + */ +enum TWlmTrafficStreamStatus + { + /** + * The traffic stream has been successfully created. + */ + EWlmTrafficStreamStatusActive, + /** + * The traffic stream has either been deleted by the network or + * the new AP after roaming no longer requires admission control. + */ + EWlmTrafficStreamStatusNotActive, + /** + * The current AP has rejected our request to create a traffic + * stream. Stream creation must not be retried until we have + * roamed to a new AP. + */ + EWlmTrafficStreamStatusRejected + }; + +/** + * The possible statuses of a PSM mode. + */ +enum TWlanPsmMode + { + /** + * Normal PSM power save mode. + */ + EWlmPsmModeNormal = 0, + /** + * Full PSM power save mode. + */ + EWlmPsmModePowerSave, + /** + * Partial PSM power save mode. + */ + EWlmPsmPartialMode + }; + +/** + * The possible access classes. + */ +enum TWlmAccessClass + { + EWlmAccessClassBestEffort = 0, + EWlmAccessClassBackground = 1, + EWlmAccessClassVideo = 2, + EWlmAccessClassVoice = 3, + EWlmAccessClassMax = 4 + }; + +/** + * Definitions for possible traffic modes for an access class. + */ +enum TWlmAcTrafficMode + { + /** Automatic traffic stream creation is allowed. */ + EWlmAcTrafficModeAutomatic, + /** Automatic traffic stream creation is NOT allowed. */ + EWlmAcTrafficModeManual + }; + +/** + * Definitions for possible traffic statuses for an access class. + */ +enum TWlmAcTrafficStatus + { + /** + * Traffic for this access class has been admitted. + */ + EWlmAcTrafficStatusAdmitted, + /** + * Traffic for this access class has NOT been admitted, + * traffic needs to be downgraded to a lower access class. + */ + EWlmAcTrafficStatusNotAdmitted + }; + +typedef TFixedArray TWlmAcTrafficStatusArray; + +/** +* Data structure for join overrides. +*/ +struct TWLMOverrideSettings + { + /** See TOverrideSettingsMask */ + TUint32 settingsMask; + /** Override SSID. Used in easy connection. */ + TSSID ssid; + /** Override BSSID. Used in test cases only. */ + TMacAddress bssid; + /** Override WEP key. Used in easy connection. */ + TWep wep; + /** Override WPA Pre-Shared Key. Used in easy connection. */ + TWpaPsk wpaPsk; + }; + +/** +* Data structure sending TMacAddress as a TPckg. +*/ +struct TMacPckg + { + TMacAddress data; + }; + +/** +* Data structure for storing available IAP IDs. +*/ +struct TWlmAvailableIaps + { + /** The number of IAPs available. */ + TUint32 count; + + /** The available IAP IDs. */ + TFixedArray iaps; + }; + +/** + * Structure for storing traffic stream parameters. + */ +struct TWlmTrafficStreamParams + { + /** + * Whether the traffic pattern is periodic or aperiodic. + */ + TBool isPeriodicTraffic; + /** + * The current value of Nominal MSDU Size. + */ + TUint16 nomimalMsduSize; + /** + * The current value of Maximum MSDU Size. + */ + TUint16 maximumMsduSize; + /** + * The current value of Minimum Service Interval. + */ + TUint32 minimumServiceInterval; + /** + * The current value of Maximum Service Interval. + */ + TUint32 maximumServiceInterval; + /** + * The current value of Inactivity Interval. + */ + TUint32 inactivityInterval; + /** + * The current value of Suspension Interval. + */ + TUint32 suspensionInterval; + /** + * The current value of Service Start Time. + */ + TUint32 serviceStartTime; + /** + * The current value of Minimum Data Rate. + */ + TUint32 minimumDataRate; + /** + * The current value of Mean Data Rate. + */ + TUint32 meanDataRate; + /** + * The current value of Peak Data Rate. + */ + TUint32 peakDataRate; + /** + * The current value of Maximum Burst Size. + */ + TUint32 maximumBurstSize; + /** + * The current value of Delay Bound + */ + TUint32 delayBound; + /** + * The current value of Minimum PHY Rate. + */ + TUint32 minimumPhyRate; + /** + * The current value of Bandwidth Allowance. + */ + TUint16 surplusBandwithAllowance; + /** + * The current value of Medium Time. + */ + TUint16 mediumTime; + }; + + +/** + * Data structure for storing available Protected setup credentials. + */ +struct TWlmProtectedSetupCredentials + { + /** The number of IAPs available. */ + TUint32 count; + + /** The available IAP IDs. */ + TFixedArray credentials; + }; + +/** + * Data structure for storing a list of BSSIDs on the rogue list. + */ +struct TWlmRogueList + { + /** The number of BSSIDs on the rogue list. */ + TUint32 count; + + /** BSSID list. */ + TFixedArray list; + }; + + +/** + * Structure for storing limited information about an IAP. + */ +struct TWlanLimitedIapData + { + TUint iapId; + TUint serviceId; + TBuf8 ssid; + TBuf8 usedSsid; + EConnectionMode networkType; + EWlanSecurityMode securityMode; + TBool isPskEnabled; + TBool isHidden; + }; + +/** + * Data structure for storing dynamic scan list parameters. + */ +struct TDynamicScanList + { + TUint32 count; + TUint32 size; + }; + +/** + * Data structure for storing scan scheduling parameters. + */ +struct TScanScheduling + { + TInt cacheLifetime; + TUint maxDelay; + }; + +#endif // WLMCLIENTSERVER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmdriverif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmdriverif.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,608 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Driver interface +* +*/ + + +#ifndef WLMDRIVERIF_H +#define WLMDRIVERIF_H + +#include "802dot11.h" +#include "RWlanLogicalChannel.h" + +#include "abs_core_driverif.h" // Derived +#include "wlannotificationhandler.h" // Derived +#include "wlanmgmtframehandler.h" // Derived +#include "wlanmgmtcommandhandler.h" // Derived +#include "wlanmgmtpacket.h" + +class abs_core_driverif_callback_c; +class CWlanHwInit; + +/** +* CWlmDriverIf +* +* @lib wlmserversrv.lib +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS( CWlmDriverIf ) : + public CBase, + public abs_core_driverif_c, + public MWlanNotificationCallback, + public MWlanMgmtFrameCallback, + public MWlanMgmtCommandCallback + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CWlmDriverIf* NewL(); + + /** + * Destructor. + */ + ~CWlmDriverIf(); + +public: // Functions from base classes + + // + // Functions from abs_core_driverif_c + // + + /** + * Initialisation between core server - driverIf + * + * @since S60 v3.1 + * @param core_callback delivers callback interface to driverIf + */ + void init( + abs_core_driverif_callback_c* core_callback ); + + /** + * Start an IBSS network. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param ssid Name of the network. + * @param beacon_interval Beacon interval in TUs. + * @param channel Used channel (1 - 11). + * @param encrypt_level Used encryption level. + */ + void start_ibss( + u32_t request_id, + const core_ssid_s& ssid, + u32_t beacon_interval, + u32_t channel, + core_encryption_mode_e encrypt_level ); + + /** + * Request available networks with the given SSID. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param scan_mode Defines whether active or passive scan is performed. + * @param scan_ssid Name of the network to scan for. + * @param scan_rate Scan rate in units of 500kbit/second. + * @param scan_channels Channels to scan. + * @param scan_min_ch_time Minimum time to listen for beacons/probe responses on a channel. + * @param scan_max_ch_time Maximum time to listen for beacons/probe responses on a channel. + * @param is_split_scan Whether the scan should be performed as a split-scan. + * @note If the length of the SSID is zero, a broadcast scan is performed. + */ + void scan( + u32_t request_id, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + int_t scan_rate, + const core_scan_channels_s& scan_channels, + u32_t scan_min_ch_time, + u32_t scan_max_ch_time, + bool_t is_split_scan ); + + /** + * Request an ongoing scan to be stopped. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void stop_scan( + u32_t request_id ); + + /** + * Connect (authenticate and associate) to a BSS. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param status The status code from the connection attempt is stored here. + * @param ssid Name of the network. + * @param bssid BSSID of the access point. + * @param auth_algorithm Authentication algorithm number. + * @param encryption_level Used encryption level. + * @param pairwise_key_type Pairwise cipher key type to be used. + * @param is_infra Whether the network is an IBSS or an infra network. + * @param ie_data_length Length of IE data. + * @param ie_data IE data. + * @param scan_frame_length Length of beacon/probe response frame from the BSS. + * @param scan_frame Pointer to beacon/probe response frame from the BSS. + * @param is_pairwise_key_invalidated Whether the pairwise key should be invalidated. + * @param is_group_key_invalidated Whether the group key should be invalidated + * @param is_radio_measurement_supported Whether the radio measurement is supported + */ + void connect( + u32_t request_id, + core_management_status_e& status, + const core_ssid_s& ssid, + const core_mac_address_s& bssid, + u16_t auth_algorithm, + core_encryption_mode_e encryption_level, + core_cipher_key_type_e pairwise_key_type, + bool_t is_infra, + u32_t ie_data_length, + const u8_t* ie_data, + u32_t scan_frame_length, + const u8_t* scan_frame, + bool_t is_pairwise_key_invalidated, + bool_t is_group_key_invalidated, + bool_t is_radio_measurement_supported ); + + /** + * Disconnect from the current network. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void disconnect( + u32_t request_id ); + + /** + * Set WLAN power mode. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param mode Power save mode to use. + */ + void set_power_mode( + u32_t request_id, + const core_power_mode_s& mode ); + + /** + * Set transmission power level. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param tx_level Transmission power level in dBm. + */ + void set_tx_power_level( + u32_t request_id, + u32_t tx_level ); + + /** + * Add a cipher key. + * + * @since S60 v3.1 + * @param cipher_suite The cipher suite of the key. + * @param key_index Index of the key. + * @param key_length Length of the cipher key. + * @param key_data Cipher key data. + * @param mac Defines the MAC address the key is used for. + * @param use_as_default in case of wep, whether the key is used as default cipher key + */ + void add_cipher_key( + core_cipher_key_type_e cipher_suite, + u8_t key_index, + u16_t key_length, + const u8_t* key_data, + const core_mac_address_s& mac, + bool_t use_as_default ); + + /** + * Get the current RCPI value. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param rcpi The current RCPI value. + */ + void get_current_rcpi( + u32_t request_id, + u32_t& rcpi ); + + /** + * Delivers multicast MAC address to drivers. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param join_group is set true_t if adding a multicast address + * otherwise the address will be removed. + * @param multicast_addr contains the MAC address to add/remove + */ + void configure_multicast_group( + u32_t request_id, + bool_t join_group, + const core_mac_address_s& multicast_addr ); + + /** + * Set the parameters related to BSS lost indication. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param parameters Parameters to set. + */ + void set_bss_lost_parameters( + u32_t request_id, + const core_bss_lost_parameters_s& parameters ); + + /** + * Set the parameters related to tx rate adaptation algorithm. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param parameters Parameters to set. + */ + void set_tx_rate_adaptation_parameters( + u32_t request_id, + const core_tx_rate_adaptation_parameters_s& parameters ); + + /** + * Set the parameters related to power mode management. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param parameters Parameters to set. + */ + void set_power_mode_mgmt_parameters( + u32_t request_id, + const core_power_mode_mgmt_parameters_s& parameters ); + + /** + * Set the parameters related to TX rate policies. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param policies TX rate policies to set. + * @param mappings Mappings between Access Classes and TX rate policies. + */ + void set_tx_rate_policies( + u32_t request_id, + const core_tx_rate_policies_s& policies, + const core_tx_rate_policy_mappings_s& mappings ); + + /** + * Get packet statistics for the currently active connection. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param statistics Packet statistics for the currently active connection. + */ + void get_packet_statistics( + u32_t request_id, + core_packet_statistics_by_access_category_s& statistics ); + + /** + * Set the RCPI trigger level. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param rcpi_trigger The RCPI trigger level. + */ + void set_rcpi_trigger_level( + u32_t request_id, + u8_t rcpi_trigger ); + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param settings Current U-APSD settings to be set. + */ + void set_uapsd_settings( + u32_t request_id, + const core_uapsd_settings_s& settings ); + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param settings Current power save settings to be set. + */ + void set_power_save_settings( + u32_t request_id, + const core_power_save_settings_s& settings ); + + /** + * Set the parameters of a tx queue. + * + * @since S60 v3.2 + * @param request_id Identification of the corresponding request. + * @param queue_id Queue to be configured. + * @param medium_time Medium time to be used. + * @param max_tx_msdu_lifetime Maximum Transmit MSDU Lifetime to be used. + */ + void set_tx_queue_parameters( + u32_t request_id, + core_access_class_e queue_id, + u16_t medium_time, + u32_t max_tx_msdu_lifetime ); + + /** + * Allow sending of user data. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void enable_user_data( + u32_t request_id ); + + /** + * Prevent sending of user data. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void disable_user_data( + u32_t request_id ); + + /** + * Unload the drivers and power down the WLAN hardware. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + */ + void unload_drivers( + u32_t request_id ); + + /** + * Load the drivers and power up the WLAN hardware. + * + * @since S60 v3.1 + * @param request_id An unique identification for the request. + * @param rts_threshold Determines the maximum packet size that can be sent without RTS/CTS protocol. + * @param max_tx_msdu_lifetime Maximum time to (re-)send the whole MSDU packet in TUs. + * @param qos_null_frame_entry_timeout Defines the time period in microseconds which is used + * to evaluate whether QoS NULL data frame sending should be started. + * @param qos_null_frame_entry_tx_count Defines how many Voice AC packets must be sent during the time + * period defined in qos_null_frame_entry_timeout before QoS NULL + * data frame sending is started. + * @param qos_null_frame_interval Defines how often a QoS NULL data frame is sent. + * @param qos_null_frame_exit_timeout Defines how soon after the last Voice AC packet QoS NULL data + * frame sending is stopped. + * @param keep_alive_interval Defines how often NULL data frames are sent if there are no other frames + * to send. + * @param sp_rcpi_target Defines the signal predictor algorithm "target" RCPI value for roam indication. + * @param sp_time_target Defines the signal predictor algorithm "target" time for roam indication + * (in microseconds). + * @param sp_min_indication_interval Defines the minimum time interval for consecutive roam + * indications from the signal predictor algorithm (in microseconds). + */ + void load_drivers( + u32_t request_id, + uint_t rts_threshold, + u32_t max_tx_msdu_lifetime, + u32_t qos_null_frame_entry_timeout, + u32_t qos_null_frame_entry_tx_count, + u32_t qos_null_frame_interval, + u32_t qos_null_frame_exit_timeout, + u32_t keep_alive_interval, + u32_t sp_rcpi_target, + u32_t sp_time_target, + u32_t sp_min_indication_interval ); + + /** + * Send a frame. + * + * @since S60 v3.1 + * @param frame_type The type of the frame to send. + * @param frame_length The length of the frame. + * @param frame_data Pointer to the frame data. + * @param frame_priority User priority to use for sending the frame. + * @param destination Destination MAC address. + * @param send_unencrypted Whether the frame must be sent unencrypted. + */ + void send_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + u8_t frame_priority, + const core_mac_address_s& destination, + bool_t send_unencrypted ); + + /** + * Cancel a pending asynchronous request. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + */ + void cancel_request( + u32_t request_id ); + + /** + * Set the ARP filter. + * + * @since S60 v5.0 + * @param request_id Identification of the corresponding request. + * @param filter Current ARP filter to be set. + */ + void set_arp_filter( + u32_t request_id, + const core_arp_filter_s& filter ); + + /** + * Set block ACK usage per traffic stream. + * + * @since S60 v5.1 + * @param request_id Identification of the corresponding request. + * @param usage Block ACK usage information. + */ + void set_block_ack_usage( + u32_t request_id, + const core_block_ack_usage_s& usage ); + + /** + * Set the SNAP header of frames to receive. + * + * @since S60 v5.1 + * @param request_id Identification of the corresponding request. + * @param header SNAP header of frames to receive. + */ + void set_snap_header_filter( + u32_t request_id, + const core_snap_header_s& header ); + + // + // Functions for handler callbacks + // + /** + * From MWlanNotificationCallback + * Notification event received from driver side + * + * @since S60 v3.1 + * @param indication + */ + void OnNotify( const TIndication& aIndication ); + + /** + * From MWlanMgmtFrameCallback + * Management frame received from driver side + * + * @since S60 v3.1 + * @param aFrameType specifies the frame type + * @param aLength of the frame data + * @param aData contains the frame + * @param aRcpi RCPI value of the frame. + */ + void OnFrameReceive( + const TDataBuffer::TFrameType aFrameType, + const TUint aLength, + const TUint8* const aData, + TUint8 aRcpi ); + + /** + * From MWlanMgmtCommandCallback + * Management command completion callback received from driver side + * + * @since S60 v3.1 + * @param command completion status + */ + void OnRequestComplete( TInt status ); + + /** + * GetMacAddress is called by CWlmServer during startup + * @param aMac contains the MAC address on completion + * @return error code + */ + TInt GetMacAddress( TMacAddress& aMac ); + + /** + * Notify the core server about an adaptation event. + * @param aIndication Adaptation event. + */ + void Notify( core_am_indication_e aIndication ); + +private: + + /** + * C++ default constructor. + */ + CWlmDriverIf(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Async callback function + * @param aThisPtr Pointer to the event data. + * @return error code + */ + static TInt AsynchCallbackFunction( TAny* aThisPtr ); + + /** + * UnloadDrivers + * @since S60 v3.1 + */ + void UnloadDrivers(); + + /** + * SetRequestId sets the new requestId to iPendingRequestId + * if no prior requests pending. + * @since S60 v3.1 + * @param aRequestId specifies the request id + * @return error code + */ + TInt SetRequestId( TUint32 aRequestId ); + +private: // Data + + /** + * Callback interface to core server. Not owned by this pointer. + */ + abs_core_driverif_callback_c* iCoreServer; + /** + * Pending command's requestId + */ + TUint32 iPendingRequestId; + + /** + * Handler for notifications + */ + CWlanNotificationHandler* iNotificationHandler; + /** + * Handler for management commands + */ + CWlanMgmtCommandHandler* iManagementCommandHandler; + /** + * Handler for received management frames + */ + CWlanMgmtFrameHandler* iManagementFrameHandler; + + /** + * Asynchronous callback + */ + CAsyncCallBack* iAsynchCallback; + /** + * Error status that will be returned in case asynch callback is called + */ + core_error_e iErrorStatus; + + /** + * Handle to hardware specific client that reads initialization + * data from CMT side + */ + CWlanHwInit* iHwInit; + + /** + * Interface to access LDD + */ + RWlanLogicalChannel iChannel; + /** + * TRUE if PDD loaded + */ + TBool iIsPDDLoaded; + /** + * TRUE if LDD loaded + */ + TBool iIsLDDLoaded; + + /** + * If defined, association response status is stored here. + * Not owned by this pointer. + */ + core_management_status_e* iManagementStatus; + }; + +#endif // WLMDRIVERIF_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmnotification.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmnotification.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: notification class +* +*/ + + +#ifndef WLMNOTIFICATION_H +#define WLMNOTIFICATION_H + +// INCLUDES +#include "wlmsession.h" +#include "am_platform_libraries.h" + +class CWlmSession; + +/** +* Base class for all notification types. +* +* Basically this only determines the interface how Server is forwarding +* notifications to Sessions or WAL. +* +* @lib wlmserversrv.lib +* @since Series 60 3.0 +*/ +class CNotificationBase : public CBase + { + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~CNotificationBase() {}; + + // New methods + + public: // New functions + + /** + * AddNotification + * @since Series 60 3.0 + * @param aNotification identifier + * @param aData content of the notification + */ + virtual void AddNotification( + TUint aNotification, + TDes8& aData ) = 0; + }; + +/** +* Forwards notifications to a session. +* +* @lib wlmserversrv.dll +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS( CSessionNotification ) : public CNotificationBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aSession Handle to the session. + * @param aNotificationMask Notifications enabled for the session. + * @return Pointer to the created instance, NULL if unable to create an instance. + */ + static CSessionNotification* NewL( + CWlmSession& aSession, + TUint32 aNotificationMask ); + + /** + * Destructor. + */ + virtual ~CSessionNotification(); + + public: // Functions from base classes + + /** + * AddNotification + * @since Series 60 3.0 + * @param aNotification identifier + * @param aData content of the notification + */ + void AddNotification( + TUint aNotification, + TDes8& aData ); + + private: // Methods + + /** + * C++ default constructor. + * + * @param aSession Handle to the session. + * @param aNotificationMask Notifications enabled for the session. + */ + CSessionNotification( + CWlmSession& aSession, + TUint32 aNotificationMask ); + + private: // Data + + /** Interface to session to forward notifications. */ + CWlmSession& iSession; + + /** Bitmask of active notifications. */ + TUint32 iNotificationMask; + }; + +#endif // WLMNOTIFICATION_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmnotify.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmnotify.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Notification service for clients +* +*/ + +/* +* %version: 13 % +*/ + +#ifndef WLMNOTIFY_H +#define WLMNOTIFY_H + +#include "wlmclientserver.h" +#include "wlancontrolinterface.h" + +class RWLMServer; + +/** + * MWLMNotify specifies a callback interface for notification services. + * These virtual methods should be implemented by the client if it + * needs any notifications. + * @lib wlmserver.lib + * @since 3.0 + */ +class MWLMNotify + { + public: + /** + * Connection status has changed. + * + * @aParam aNewState specifies the new state + */ + virtual void ConnectionStateChanged( + TWlanConnectionState /*aNewState*/ ){}; + + /** + * BSSID has changed (i.e. AP handover). + * + * @aParam aNewBSSID specifies the new BSSID (access point name). + */ + virtual void BSSIDChanged( + TDesC8& /*aNewBSSID*/ ){}; + + /** + * Connection has lost. + */ + virtual void BSSLost(){}; + + /** + * Connection has regained. + */ + virtual void BSSRegained(){}; + + /** + * New networks have been detected during scan. + */ + virtual void NewNetworksDetected(){}; + + /** + * One or more networks have been lost since the last scan. + */ + virtual void OldNetworksLost(){}; + + /** + * The used transmit power has been changed. + * + * @param aPower The transmit power in mW. + */ + virtual void TransmitPowerChanged( + TUint /*aPower*/ ){}; + + /** + * Received signal strength has changed to another strength class. + * + * @param aRcpLevel specifies the rss class (normal/weak) + * @param aRcpValue specifies the actual rcp value + */ + virtual void RcpChanged( + TWlanRCPLevel /*aRcpLevel*/, + TUint /*aRcpValue*/ ){}; + + /** + * Information about the current access point after a connect/roam. + * + * @param aInfo Information about the current access point. + */ + virtual void AccessPointInfoChanged( + const TWlanAccessPointInfo& /* aInfo */ ){}; + + /** + * The status of a virtual traffic stream has changed. + * + * @param aStreamId ID of the traffic stream. + * @param aStreamStatus Status of the traffic stream. + */ + virtual void TrafficStreamStatusChanged( + TUint /* aStreamId */, + TWlanTrafficStreamStatus /* aStreamStatus */ ) {}; + + /** + * The traffic mode of an access class has changed. + * + * @param aAccessClass Access class. + * @param aMode Traffic mode of the access class. + */ + virtual void AccessClassTrafficModeChanged( + TWlmAccessClass /* aAccessClass */, + TWlmAcTrafficMode /* aMode */ ){}; + + /** + * The traffic status of an access class has changed. + * + * @param aAccessClass Access class. + * @param aStatus Traffic status of the access class. + */ + virtual void AccessClassTrafficStatusChanged( + TWlmAccessClass /* aAccessClass */, + TWlmAcTrafficStatus /* aStatus */ ){}; + + }; + +/** +* CWLMNotify offers the notification service. +* Active object that waits notifications from server. +* @lib wlmserver.lib +* @since 3.0 +*/ +NONSHARABLE_CLASS( CWLMNotify ) : public CActive + { + public: // Methods + + // Constructors and destructor + + /** + * Destructor. + */ + virtual ~CWLMNotify(); + + /** + * Create and activate notification service. + * @note This activates the notification service already. + * @param aCallback Callback interface to forward notifications to + * user process. + * @param aServer Interface to send requests to server. + * @param aNotificationMask Bitmask of notifications to activate. + * @return Pointer to a new constructed CWLMNotify object. + */ + static CWLMNotify* NewL( + MWLMNotify& aCallback, + RWLMServer& aServer, + TUint32 aNotificationMask ); + + /** + * Change the callback interface + * and activate notifications + * @param aCallback New callback interface. + * @param aNotificationMask Bitmask of notifications to activate. + */ + void Activate( + MWLMNotify& aCallback, + TUint32 aNotificationMask ); + + /** + * Sets the requests cancelled flag so that no new notification requests + * are done once current notification is complete. + */ + void SetCancelled(); + + protected: // from CActive + /** + * (From CActive) Receive notification. + */ + void RunL(); + + /** + * (From CActive) This is called by Cancel() of CActive framework. + */ + void DoCancel(); + + private: + /** + * Constructor. + * @param aCallback Callback interface to forward notifications to + * application. + * @param aServer Interface to send requests to server. + * @param aNotificationMask Bitmask of notifications to activate. + */ + CWLMNotify( + MWLMNotify& aCallback, + RWLMServer& aServer, + TUint32 aNotificationMask ); + + /** + * Second phase construction. + */ + void ConstructL(); + + /** + * Notification query loop. + */ + void WaitForNotifications(); + + private: // Members. + /** + * Callback interface to the client. Not owned by this class. + */ + MWLMNotify* iCallback; + /** + * Interface to send messages to the server + */ + RWLMServer& iServer; + /** + * Data package for return data + */ + TPckgBuf iDataPckg; + /** + * Cancel has been requested + */ + TBool iCancelRequested; + /** + * Bitmask of active notifications. + */ + TUint32 iNotificationMask; + }; + +#endif // WLMNOTIFY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatform.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains the class for handling platform-specific functionality. +* +*/ + + +#ifndef WLMPLATFORM_H +#define WLMPLATFORM_H + +#include "wlmclientserver.h" +#include "wlandevicesettings.h" +#include "wlmsystemnotify.h" +#include "wlansystemtimehandler.h" +#include "am_platform_libraries.h" + +class CWlmPlatformData; + +/** + * Possible values for scan types. + */ +enum TWLMScanType + { + EWLMScanNotAllowed, + EWLMScanForcedPassive, + EWLMScanForcedActive, + EWLMScanAsRequested + }; + +/** +* Callback interface used by the platform-specific functionality. +* These callbacks are implemented by the engine. +* @lib wlmplatform.dll +* @since Series 60 3.0 +*/ +class MWlmPlatformCallback + { + public: // Methods + + /** + * Get the current connection state. + * @return Current driver state. + */ + virtual TWlanConnectionState GetCurrentState() = 0; + + /** + * Send an indication to request data pipe disconnection. + * + * Calls ReleaseComplete() directly if data pipe isn't + * connected. + */ + virtual void ReleaseRequest() = 0; + + /** + * Enable WLAN after it has been disabled by a + * system mode change. + */ + virtual void EnableWlan() = 0; + + /** + * BT connection has been established. + */ + virtual void BtConnectionEstablished() = 0; + + /** + * BT connection has been disconnected. + */ + virtual void BtConnectionDisabled() = 0; + + /** + * System startup has been completed. + */ + virtual void StartupComplete() = 0; + + /** + * Emergency call was done during startup and now it has completed. + * @param aStartupCompleted Is the startup already completed + */ + virtual void EmergencyCallComplete( TBool aStartupCompleted ) = 0; + + /** + * User has changed the time and therefore WLAN region cache information + * is not valid anymore. + */ + virtual void SystemTimeChanged() = 0; + + /** + * WLAN region cache is always cleared after defined time. + */ + virtual void ClearRegionCache() = 0; + + }; + +/** +* Class for handling platform specific functionality. +* @lib wlmplatform.dll +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS( CWlmPlatform ) : public CBase, public MWlmSystemNotify, public MWlanSystemTimeCallback + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @param aCallback Reference to the platform callback object. + * @return Pointer to created object. + */ + IMPORT_C static CWlmPlatform* NewL( + MWlmPlatformCallback& aCallback ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CWlmPlatform(); + + // Methods from base classes + + /** + * Do all initilizations that could not + * be done in construction phase because they require callbacks. + */ + IMPORT_C void Initialize(); + + /** + * Get the type of scan allowed. + * @return Type of scan allowed. + */ + IMPORT_C TWLMScanType GetScanType(); + + /** + * Check whether WLAN is disabled. + * @return Whether WLAN is disabled. + */ + IMPORT_C TBool IsWlanDisabled(); + + /** + * Get the current system mode. + * @return Current system mode. + */ + IMPORT_C TWlanSystemMode GetCurrentSystemMode(); + + /** + * Set the status of WLAN icon on cover display. + * @param aStatus The WLAN icon status. + * @return A Symbian error code. + */ + IMPORT_C TInt SetIconState( TWlmIconStatus aStatus ); + + /** + * Returns MCC of the current operator. + * @param aCountryCode MCC. + */ + IMPORT_C void GetCurrentOperatorMccL( TUint& aCountryCode ); + + /** + * Publishes the MAC address to other applications. + * @param aMacAddr The MAC address. + * @return A Symbian error code. + */ + IMPORT_C TInt PublishMacAddress( TMacAddress& aMacAddr ); + + /** + * Start timer to get indication when user has changed the time. + */ + IMPORT_C void InitializeSystemTimeHandler(); + + protected: // Methods + + // Methods from base classes + + /** + * (From MWlmSystemNotify) System Mode has changed. + * @param aOldMode Old System Mode. + * @param aNewMode New System Mode. + */ + void SystemModeChanged( + TWlanSystemMode aOldMode, + TWlanSystemMode aNewMode ); + + /** + * (From MWlmSystemNotify) Emergency call has started, WLAN is forced to be enabled. + */ + void EmergencyCallEstablished(); + + /** + * (From MWlmSystemNotify) Emergency call has ended, WLAN is not forced to be enabled anymore. + * @param aNewMode New System Mode + */ + void EmergencyCallCompleted( TWlanSystemMode aNewMode ); + + /** + * (From MWlmSystemNotify) BT connection has been established. + */ + void BtConnectionEstablished(); + + /** + * (From MWlmSystemNotify) BT connection has been disconnected. + */ + void BtConnectionDisabled(); + + /** + * (From MWlanSystemTimeCallback) + * User has changed the time and therefore cached WLAN region is not valid anymore. + */ + void OnSystemTimeChange(); + + /** + * (From MWlanSystemTimeCallback) + * WLAN region cache is forced to be cleared after defined time. + */ + void OnCacheClearTimerExpiration(); + + private: //Methods + + /** + * C++ default constructor. + * @param aCallback Pointer the platform callback object. + */ + CWlmPlatform( MWlmPlatformCallback& aCallback ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + /** Interface for callbacks to common functionality. */ + MWlmPlatformCallback& iCallback; + + /** Current states of various system mode settings. */ + TWlanSystemMode iCurrentSystemMode; + + /** Interface to PubSub/CenRep. */ + CWlmPlatformData* iPlatformData; + + /** + * Information whether WLAN connection existed before emergency call was made. + * If WLAN connection did not exist before emergency call and WLAN connection was + * established in Offline mode for the emergency call, then after the emergency call + * the WLAN connection must be released. */ + TBool iWlanConnectedBeforeEmergencyCall; + + /** Interface to monitor system time changes. */ + CWlanSystemTimeHandler* iSystemTimeHandler; + + /** Interface to monitor when region cache needs to be cleared. */ + CWlanPeriodicCacheClearingHandler* iPeriodicCacheClearingHandler; + + }; + +#endif // WLMPLATFORM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformdata.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface class to CenRep and PubSub +* +*/ + + +#ifndef WLMPLATFORMDATA_H +#define WLMPLATFORMDATA_H + +#include +#include "802dot11.h" +#include "wlmsystemnotify.h" +#include "wlmplatformsubscriber.h" + +/** +* Interface class to PubSub and CenRep. +*/ +NONSHARABLE_CLASS( CWlmPlatformData ) : + public CBase, + public MWlmPlatformResponder + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @param aCallback Callback for notifications.. + * @return Pointer to create object. + */ + static CWlmPlatformData* NewL( MWlmSystemNotify& aCallback ); + + /** + * Destructor. + */ + virtual ~CWlmPlatformData(); + + // Methods from base classses + + /** + * Sets the status of WLAN icon on cover display. + * @param aStatus The WLAN icon status. + * @return A Symbian error code. + */ + virtual TInt SetIconState( + TWlmIconStatus aStatus ); + + /** + * Publishes the MAC address to other applications. + * @param aMacAddr The MAC address. + * @return A Symbian error code. + */ + virtual TInt PublishMacAddress( + TMacAddress& aMacAddr ); + + /** + * Returns MCC of the current operator. + * @param aCountryCode MCC. + */ + virtual void GetCurrentOperatorMccL( + TUint& aCountryCode ); + + /** + * Forces the system to re-read all system statuses and + * indicate all changed statuses via notification callbacks. + */ + virtual void UpdateSystemStatuses(); + + /** + * From MWlmPlatformResponder The subscribed property has changed. + * @since Series 60 3.0 + * @param aCategory Category of the changed property. + * @param aKey Key of the changed property. + */ + virtual void HandlePropertyChangedL( + const TUid& aCategory, + const TUint aKey ); + + private: // Methods + + /** + * C++ default constructor. + * @param aCallback Callback for notifications.. + */ + CWlmPlatformData( MWlmSystemNotify& aCallback ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + /** Subscriber for watching KPSGlobalSystemState via P&S. */ + CWlmPlatformSubscriber* iPropertySystemState; + + /** Subscriber for watching KPropertyKeyBluetoothGetPHYCount via P&S. */ + CWlmPlatformSubscriber* iBtConnections; + + /** Subscriber for watching KCTSYEmergencyCallInfo via P&S. */ + CWlmPlatformSubscriber* iEmergencyCall; + + /** Handle to KPropertyWlanMacAddress property via P&S. */ + RProperty iPsMacAddress; + + /** Handle to KPropertyWlanIndicator property via P&S. */ + RProperty iPsIndicator; + + /** Callback for notifications. */ + MWlmSystemNotify& iCallback; + + /** Stores the current System Mode */ + TWlanSystemMode iSystemMode; + + /** Stores the number of BT connections. */ + TUint iBtConnectionCount; + + /** The currently shown icon */ + TWlmIconStatus iCurrentIcon; + + /** Whether system startup has been completed. */ + TBool iIsStartupComplete; + + /** Whether system is in offline. */ + TBool iIsInOffline; + + /** Whether Emergency Call is active. */ + TBool iIsEmergencyCall; + + }; + +#endif // WLMPLATFORMDATA_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformsubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformsubscriber.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for requesting notifications to Publish & Subscribe +* properties. +* +*/ + + +#ifndef WLMPLATFORMSUBSCRIBER_H +#define WLMPLATFORMSUBSCRIBER_H + +#include +#include + +enum TWlmSubscribeType + { + EWlmSubscribeTypeCenRep, + EWlmSubscribeTypePubSub, + }; + +class CRepository; + +/** +* Callback interface to client +*/ +class MWlmPlatformResponder + { + public: // New functions + + /** + * From The subscribed property has changed. + * @since Series 60 3.0 + * @param aCategory Category of the changed property. + * @param aKey Key of the changed property. + */ + virtual void HandlePropertyChangedL( const TUid& aCategory, const TUint aKey ) = 0; + }; + +// CLASS DECLARATION +/** +* Class for requesting notifications about changed PubSub/CenRep properties/keys. +* @lib wlmplatform.dll +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS( CWlmPlatformSubscriber ) : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @since Series 60 3.0 + * @param aType specifies whether observed key is in CenRep or PubSub + * @param aCallback specifies the callback object + * @param aCategory specifies the key's category (PubSub) + * or repository file (CenRep) + * @param aKey specifies the key to be watched + */ + static CWlmPlatformSubscriber* NewL( + TWlmSubscribeType aType, + MWlmPlatformResponder& aCallback, + const TUid& aCategory, + const TUint aKey ); + + /** + * Destructor. + */ + virtual ~CWlmPlatformSubscriber(); + + public: // New functions + + /** + * IssueRequest subscribes to changes of a property + * @since Series 60 3.0 + */ + void IssueRequest(); + + /** + * Get requests the value of the property under subscription + * (callback only tells the client that the value has changed) + * @since Series 60 3.0 + */ + TInt Get( TInt& aValue ); + + protected: // Functions from base classes + + /** + * From CActive + */ + virtual void DoCancel(); + + /** + * From CActive + */ + virtual TInt RunError( TInt aError ); + + /** + * From CActive + */ + virtual void RunL(); + + private: + + /** + * C++ default constructor. + */ + CWlmPlatformSubscriber( + TWlmSubscribeType aType, + MWlmPlatformResponder& aCallback, + const TUid& aCategory, + const TUint aKey ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + /** Type of the property to watch (PubSub or CenRep). */ + TWlmSubscribeType iType; + + /** Callback to call when the property changes. */ + MWlmPlatformResponder &iCallback; + + /** The category/repository to watch. */ + const TUid iCategory; + + /** The key to watch. */ + const TUint iKey; + + /** The property to watch in PubSub. */ + RProperty iProperty; + + /** The handle to CenRep. */ + CRepository* iCenRep; + }; + +#endif // WLMPLATFORMSUBSCRIBER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmscanrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmscanrequest.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active Object for asynchronous scan request. +* +*/ + + +#ifndef WLMSCANREQUEST_H +#define WLMSCANREQUEST_H + +#include "rwlmserver.h" + +/** + * Active Object for asynchronous scan request. + * + * This class implements an Active Object that is used for handling + * an asynchronous scan request. + * + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CWlmScanRequest ) : public CActive + { + +public: + + /** + * Factory method for creating CWlmScanRequest instance. + * + * @param aClient Handle to client-side interface to WLAN engine. + * @return Pointer to the created instance, NULL if none. + */ + static CWlmScanRequest* NewL( + RWLMServer& aClient ); + + /** + * Destructor. + */ + virtual ~CWlmScanRequest(); + + /** + * Issue a scan request. + * + * @since S60 v5.0 + * @param aScanList ScanList used for storing the results. + * @param aSsid SSID used for scanning. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + * @param aStatus Request status of the client that will be completed + * when scan has been completed. NULL if synchronous request. + * @return KErrNone if an asynchronous request, otherwise the completion + * status of the request. + */ + TInt IssueRequest( + ScanList& aScanList, + const TDesC8& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus* aStatus ); + + /** + * Return the request status of the client. + * + * @since S60 v5.0 + * @return Request status of the client, NULL if none. + */ + TRequestStatus* ClientStatus(); + +// from base class CActive + + /** + * From CActive. + * Called when the request has been completed. + * + * @since S60 v5.0 + */ + void RunL(); + + /** + * From CActive. + * Called by the framework if RunL leaves. + * + * @since S60 v5.0 + * @param aError The error code RunL leaved with. + * @return KErrNone if leave was handled, an error code otherwise. + */ + TInt RunError( + TInt aError ); + + /** + * From CActive. + * Called by the framework as part of AO's Cancel(). + * + * @since S60 v5.0 + */ + void DoCancel(); + +private: + + /** + * Constructor + * + * @param aClient Handle to client-side interface to WLAN engine. + */ + CWlmScanRequest( + RWLMServer& aClient ); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + /** + * Updates the scan list contents after a successful scan. + * + * @return KErrNone if success, an error code otherwise. + */ + TInt UpdateResults(); + +private: // data + + /** + * Handle to client-side interface. + */ + RWLMServer& iClient; + + /** + * Scan list used for storing the results. Not owned by this pointer. + */ + ScanList* iScanList; + + /** + * Descriptor for scan list. + */ + TPtr8 iScanListPtr; + + /** + * SSID user for scanning. + */ + TPckgBuf iSsidBuf; + + /** + * Buffer for storing scan list count and scan list size. + */ + TPckgBuf iDynamicScanListBuf; + + /** + * Pointer to cache lifetime parameter. Not owned by this pointer. + */ + TInt* iCacheLifetime; + + /** + * Pointer to max delay parameter. Not owned by this pointer. + */ + TUint* iMaxDelay; + + /** + * Buffer for storing scan scheduling parameters + */ + TPckgBuf iScanSchedulingBuf; + + /** + * Request status of the client. Not owned by this pointer. + */ + TRequestStatus* iClientStatus; + + }; + +#endif // WLMSCANREQUEST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1360 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Main server +* +*/ + +/* +* %version: 49 % +*/ + +#ifndef WLMSERVER_H +#define WLMSERVER_H + +#include // Used in SIAPSettings. + +#include "abs_core_server_callback.h" +#include "abs_core_server.h" +#include "abs_wlan_eapol_callback.h" +#include "wlanscanproviderinterface.h" +#include "core_server.h" +#include "wlmnotification.h" +#include "wlandevicesettings.h" +#include "wlanscanresultcache.h" +#include "wlmplatform.h" +#include "umac_types.h" // TIndication +#include "wlanconversionutil.h" +#include "wlancontrolinterface.h" +#include "wlaneapolinterface.h" +#include "wlaneapolclient.h" +#include "wlangenericplugin.h" +#include "wlantimerservices.h" +#include "wlancbwaiter.h" + +class CWlmDriverIf; +class CWlanSsidListDb; + +/** + * Command Ids to be used un the asynchronous core service requests + * External commands coming from clients get request id that is > KWlanExtCmdBase + * Values 0-KWlanExtCmdBase are reserved for internal usage. + */ +const TUint32 KWlanIntCmdNull = 0; +const TUint32 KWlanIntCmdBackgroundScan = 1; +const TUint32 KWlanIntCmdEnableWlan = 2; +const TUint32 KWlanIntCmdDisableWlan = 3; +const TUint32 KWlanIntCmdSetPowerSave = 4; +const TUint32 KWlanExtCmdBase = 100; + +/** Timer interval value for disabling background scan. */ +const TInt KBackgroundScanIntervalNever = 0; + +/** UID for WLAN Power Save Test Notifier */ +const TUid KUidWlanPowerSaveTestNote = { 0x101F6D4F }; + +/** +* The server for WLAN services. Counterpart of RWLMServer. +* +* @lib wlmserversrv.lib +* @since Series 60 3.0 +*/ +NONSHARABLE_CLASS( CWlmServer ) : + public CServer2, + public abs_core_server_callback_c, + public MWlmPlatformCallback, + public MWlanEapolCallbackInterface, + public MWlanScanResultProvider + { + public: // Constructors and destructor + + /** + * map entry is used for queuing service requests + */ + struct SRequestMapEntry + { + u32_t iRequestId; + TUint iSessionId; + RMessagePtr2 iMessage; + TWLMCommands iFunction; + TAny* iParam0; + TAny* iParam1; + TAny* iParam2; + TAny* iParam3; + TTime* iTime; + + SRequestMapEntry() : + iRequestId( 0 ), + iSessionId( 0 ), + iMessage(), + iParam0( NULL ), + iParam1( NULL ), + iParam2( NULL ), + iParam3( NULL ), + iTime( NULL ) + { } + }; + + /** + * Bit definitions for WLAN features. + */ + enum TWlanFeature + { + /** Initialisation value. */ + EWlanFeatureNone = 0x00000000, + /** Whether WAPI is enabled. */ + EWlanFeatureWapi = 0x00000001, + /** Whether power save test is enabled. */ + EWlanFeaturePowerSaveTest = 0x00000002, + /** Whether 802.11k is enabled. */ + EWlanFeature802dot11k = 0x00000004 + }; + + /** + * Two-phased constructor. + */ + IMPORT_C static CWlmServer* NewL(); + + /** + * Destructor. + */ + virtual ~CWlmServer(); + + public: // New functions + + /** + * Initialises the server thread. + * + * The compilation macro is to ease to run the server as a + * thread and as a own process. + * + * @since Series 60 3.0 + * @return Standard Symbian error. + */ + IMPORT_C static TInt StartServerThread(); + + /** + * Get the type of scan allowed. + * @return Type of scan allowed. + */ + inline TWLMScanType GetScanType(); + + /** + * SetIconState sets the status of WLAN icon on cover display. + * @param aStatus The WLAN icon status. + * @return Symbian error code. + */ + inline TInt SetIconState( TWlmIconStatus aStatus ); + + /** + * Find out the IAP to join to. + * @param aLanServiceId ID of the WLAN IAP settings to been joined. + * @param aWlanSettings (OUT) The WLAN IAP settings. + * @param aSecondaryList (OUT) List of secondary SSIDs. + */ + void GetIapSettingsL( + const TUint32 aLanServiceId, + SWLANSettings& aWlanSettings, + RArray& aSecondaryList ); + + /** + * Update the availability information. + * @param aAvailability Availability information for the + * Connection Monitor server. + * @param aNetNetworksDetected Whether new networks have been detected. + * @param aOldNetworksLost Whether one or more old networks have been lost. + */ + inline void UpdateAvailability( + TBool aAvailability, + TBool aNewNetworksDetected = EFalse, + TBool aOldNetworksLost = EFalse ); + + /** + * Callback function to receive notification about closed + * Broken Power Save Note dialog. + * @param aThisPtr Pointer to the server instance. + * @return error code + */ + static TInt HandleBrokenPowerSaveNoteClosed( + TAny *aThisPtr ); + + /** + * Notify changed PSM server mode + * + * @since Series 60 5.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void NotifyChangedPsmSrvMode( + TUint aSessionId, + const RMessage2& aMessage ); + + public: // Functions from base classes + + /** + * From abs_core_server_callback_c Send a notification. + * @param notification The notification to send. + * @param data_length Optional data length. + * @param data Pointer to optional data. + */ + virtual void notify( + core_notification_e notification, + int_t data_length, + const u8_t* data ); + + /** + * From abs_core_server_callback_c + * Notify about country information received from APs. + * @param request_id Identification of the corresponding request. + * @param found_region WLAN region information obtained from the AP's country information. + * @param inconsistent_info Information whether different APs gave inconsistent country information. + */ + virtual void store_ap_country_info( + u32_t request_id, + const core_wlan_region_e& found_region, + bool_t inconsistent_info ); + + /** + * From abs_core_server_callback_c + * Get the current regulatory domain. + * @param request_id Identification of the corresponding request. + * @return Current regulatory domain. + * @param mcc_known Is the current mobile country code available + */ + virtual void get_regulatory_domain( + u32_t request_id, + core_wlan_region_e& region, + bool_t& mcc_known ); + + /** + * From abs_core_server_callback_c + * An asynchronous request from the adaptation layer has been completed. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + * @param status Completion status of the request. + */ + virtual void request_complete( + u32_t request_id, + core_error_e status ); + + /** + * From abs_core_server_callback_c + * Cancel a pending asynchronous request. + * + * @since S60 v3.1 + * @param request_id Identification of the corresponding request. + */ + virtual void cancel_request( + u32_t request_id ); + + /** + * From abs_core_server_callback_c + * Initialize interface to EAPOL. + * + * @since S60 v3.2 + * @param mode Operating mode to use. + * @param partner Pointer to partner instance. + * @return Status value of operation. + */ + virtual u32_t load_eapol( + core_eapol_operating_mode_e mode, + abs_wlan_eapol_callback_c* const partner ); + + /** + * From abs_core_server_callback_c + * Shutdown EAPOL. + * + * @since S60 v3.2 + * @return Status value of operation. + */ + virtual u32_t shutdown(); + + /** + * From abs_core_server_callback_c + * Configure EAPOL. + * + * @since S60 v3.2 + * @param header_offset Offset of EAP-header in packet_send. + * @param MTU Maximum transfer unit (MTU). + * @param trailer_length Length of trailer needed by lower levels.. + * @return Status value of operation. + */ + virtual u32_t configure( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ); + + /** + * From abs_core_server_callback_c + * Send data to EAPOL. + * + * @since S60 v3.2 + * @param data Pointer to data to be send. + * @param length Length of data to be send. + * @return Status value of operation. + */ + virtual u32_t process_data( + const void * const data, + const u32_t length ); + + /** + * From CServer2 + * @since Series 60 3.0 + * @param aVersion not used + * @param aMessage not used + * @return session object + */ + virtual CSession2* NewSessionL( + const TVersion& aVersion, + const RMessage2& aMessage ) const; + + /** + * @since Series 60 3.0 + * @param ?arg1 ?description + * @return ?description + */ + virtual void NotifyAdd( + CNotificationBase& aNotification ); + + /** + * @since Series 60 3.0 + * @param ?arg1 ?description + * @return ?description + */ + virtual void NotifyRemove( + CNotificationBase& aNotification ); + + /** + * Connect + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void Connect( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel an outstanding connect request. + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void CancelConnect( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * GetCurrentBSSID + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetCurrentBSSID( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * GetCurrentRCPI + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetCurrentRCPI( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetCurrentSSID( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * GetCurrentSecurityMode + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetCurrentSecurityMode( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * GetCurrentSystemMode + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetCurrentSystemMode( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Asks for connection state + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetConnectionState( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Performs scan + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void GetScanResult( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel an outstanding scan request. + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void CancelGetScanResult( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Determines which IAPs are currently available + * @since Series 60 3.1 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetAvailableIaps( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel an outstanding IAP availability request. + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void CancelGetAvailableIaps( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void ReleaseComplete( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * @since Series 60 3.0 + * @param ?arg1 ?description + * @return ?description + */ + virtual TUint NotifySessionCreated(); + + /** + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + */ + virtual void NotifySessionClosed( TUint aSessionId ); + + /** + * NotifyChangedSettings + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void NotifyChangedSettings( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * AddBssidToRoguelist + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void AddBssidToRoguelist( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * UpdateRcpNotificationBoundary + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void UpdateRcpNotificationBoundary( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * ConfigureMulticastGroup + * @since Series 60 3.0 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void ConfigureMulticastGroup( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get packet statistics of the current connection. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetPacketStatistics( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Clear packet statistics of the current connection. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void ClearPacketStatistics( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get the current U-APSD settings. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetUapsdSettings( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void SetUapsdSettings( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get the current power save settings. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetPowerSaveSettings( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void SetPowerSaveSettings( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Request creation of a traffic stream. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void CreateTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel a pending traffic stream creation request. + * + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void CancelCreateTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Request deletion of a traffic stream. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void DeleteTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel a pending traffic stream deletion request. + * + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void CancelDeleteTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get information about the current AP. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetAccessPointInfo( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get roam metrics of the current connection. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetRoamMetrics( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get a list of BSSIDs on the rogue list. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetRogueList( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get the current regulatory domain. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetRegulatoryDomain( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get the current power save mode. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetPowerSaveMode( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Run Protected Setup + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void RunProtectedSetup( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel Protected Setup + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + virtual void CancelProtectedSetup( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Add a list of SSIDs to an IAP. + * + * @since Series 60 5.0.1 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void AddIapSsidListL( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Remove any list of SSIDs attached to an IAP. + * + * @since Series 60 5.0.1 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void RemoveIapSsidListL( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Set the power save mode. + * + * @since Series 60 5.0.1 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void SetPowerSaveMode( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Get the current traffic status for access classes. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void GetAcTrafficStatus( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Initiate roam to the given BSSID. + * + * @since S60 v3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void DirectedRoam( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * Cancel a pending directed roam request. + * + * @since Series 60 3.2 + * @param aSessionId ID identifying the session. + * @param aMessage containing the service request + */ + void CancelDirectedRoam( + TUint aSessionId, + const RMessage2& aMessage ); + + /** + * From MWlmPlatformCallback + * Send an indication to request data pipe disconnection. + * + * Calls ReleaseComplete() directly if data pipe isn't + * connected. + */ + inline void ReleaseRequest(); + + /** + * From MWlmPlatformCallback + * GetCurrentState requests the current connection state. + * @since Series 60 3.0 + * @return connection state + */ + virtual TWlanConnectionState GetCurrentState(); + + /** + * From MWlmPlatformCallback + * Enable WLAN functionality again + * (after it has been disabled by a system mode change) + * @since Series 60 3.0 + */ + inline void EnableWlan(); + + /** + * From MWlmPlatformCallback + * BT connection has been established. + */ + void BtConnectionEstablished(); + + /** + * From MWlmPlatformCallback + * BT connection has been disconnected. + */ + void BtConnectionDisabled(); + + /** + * From MWlmPlatformCallback + * System startup has been completed. + */ + void StartupComplete(); + + /** + * From MWlmPlatformCallback + * Emergency call was done during startup and now it has completed. + * @param aStartupCompleted Is the startup already completed + */ + void EmergencyCallComplete( TBool aStartupCompleted ); + + /** + * From MWlmPlatformCallback + * User has changed the time and therefore cached WLAN region is not + * valid anymore. + */ + void SystemTimeChanged(); + + /** + * From MWlmPlatformCallback + * WLAN region cache is always cleared after defined time. + */ + void ClearRegionCache(); + + /** + * From MWlanEapolCallbackInterface + * Callback interface to partner. + * + * @since S60 v3.2 + * @param aData Pointer to the data to be sent. + * @param aLength Length of the data to be sent. + * @return Return value is specified in interface specification. + */ + TInt SendData( + const void * const aData, + const TInt aLength ); + + /** + * From MWlanScanResultProvider + * Issue scan request. + * + * @since S60 v5.2 + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the availability results. The valid range is from 0 to 1200 + * seconds. + */ + void Scan( const TUint& aMaxDelay ); + + /** + * From MWlanScanResultProvider + * Cancel pending scan request. + * + * @since S60 v5.2 + */ + void CancelScan(); + + private: + + /** + * Read WLAN specific settings from Commdb. + * @param settings Settings are stored here. + */ + void GetWlanSettingsL( + CWlanDeviceSettings::SWlanDeviceSettings& aSettings ); + + /** + * Take the cached WLAN region into use if it is still valid. + * @param region Cached WLAN region from CenRep. + * @param timestamp Timestamp for the cached WLAN region in CenRep. + */ + void SetCachedRegion( + TUint32 region, + TInt32 timestamp); + + /** + * C++ default constructor. + */ + CWlmServer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Method called by the framework when a pending core + * request needs to be completed. + * + * @param aThisPtr Pointer to the server instance. + * @return error code + */ + static TInt HandleCoreAsynchCb( TAny* aThisPtr ); + + /** + * Method called by the scan scheduling timer when it expires. + * @param aThisPtr Pointer to the server instance. + * @return error code + */ + static TInt ScanSchedulingTimerExpired( TAny* aThisPtr ); + + /** + * Handles the conversion of IAP data list. + * @param aCoreIapDataList Converted IAP data list. + * @param aCoreIapSsidList Converted secondary SSID list. + * @param aAmIapDataList IAP data list to be converted. + * @return KErrNone if success, an error otherwise. + */ + TInt GetIapDataList( + core_type_list_c& aCoreIapDataList, + core_type_list_c& aCoreIapSsidList, + const RArray& aAmIapDataList ); + + /** + * Handles reading of lanservice table data related to service id. + * @param aLanServiceId specifying the lan service + * @param aLanSettings contains the results on completion + * @return error code + */ + TInt GetLanSettings( + TUint32 aLanServiceId, + SLanSettings& aLanSettings ); + + /** + * Update WLAN settings from commsdat and CenRep. + * + * @return KErrNone if success, an error code otherwise. + */ + TInt UpdateWlanSettings(); + + /** + * Updates the background scan timing. + * @param aNewInterval specifies the new background scan interval in seconds + * 0 means background scan is off + * @param aNextExpiration specifies when the background scan should be performed next time. + */ + void UpdateBackgroundScan( + TUint32 aNewInterval, + TUint32 aNextExpiration ); + + /** + * Updates the scan scheduling timer. + * @param aScanTime specifies when the scan should be started. + * @param aTriggeringRequestId the id of that request which updates the timer. + */ + void UpdateScanSchedulingTimer( + TTime aScantime, + TUint aTriggeringRequestId ); + + /** + * Finds the closest scan starting time from the pending scan requests in iPendingScanRequestMap. + * @param aTriggeringRequestIndex index of the scan request that should be handled next. + * @return if closest time was found. + */ + TBool FindNextTimedScanSchedulingRequest( + TUint& aTriggeringRequestIndex ); + + /** + * Notify the server that a background scan has been done. + */ + void NotifyBackgroundScanDone( + ScanList* aScanList, + core_type_list_c* aIapIdList ); + + /** + * Check if this request can be completed. + * @param aCheckedMapEntry pointer to the request to be checked + * @param aCompletedMapEntry pointer to the request that was completed + * @return whether the request can be completed by core. + */ + TBool CanRequestBeCompleted( + const SRequestMapEntry& aCheckedMapEntry, + const SRequestMapEntry& aCompletedMapEntry ) const; + + /** + * Handles completion routines of an internal request + * @param aIndex index to the request that should be completed. + * @param aStatus status of the completed operation. + * @param aCompletedWasTriggering value ETrue means that + * completed request is the same as the request which + * triggered the core operation + */ + void CompleteInternalRequest( + TUint32 aIndex, + core_error_e aStatus, + TBool aCompletedWasTriggering = ETrue ); + + /** + * Handles completion routines of an external request + * @param aIndex index to the request that should be completed. + * @param aStatus status of the completed operation. + * @param aTriggerRequest pointer to the request that triggered core operation + * value NULL means that completed request is the same as the request which triggered + * the core operation + */ + void CompleteExternalRequest( + TUint32 aIndex, + core_error_e aStatus, + SRequestMapEntry* aTriggerRequest = NULL ); + + /** + * Compare two available network entries. + * + * @param aFirst First entry to compare. + * @param aSecond Second entry to compare. + * @return ETrue if equal, EFalse otherwise. + */ + static TBool IsAvailableNetworkEqual( + const TWlanAvailableNetwork& aFirst, + const TWlanAvailableNetwork& aSecond ); + + /** + * Get list of networks in the scan results. + * + * @param aScanList Scan results to be parsed. + * @param aNetworkList List of networks is stored here. + * @return Symbian error code. + */ + TInt GetNetworkList( + const ScanList& aScanList, + RArray& aNetworkList ); + + /** + * Send availability notification updates and update the icon + * if necessary. + * + * @param aNewNetworksDetected Whether new networks/IAPs have been detected. + * @param aOldNetworksLost Whether old networks/IAPs have been lost. + * @param aAnyNetworksDetected Whether any networks have been detected. + */ + void UpdateAvailabilityInfo( + TBool aNewNetworksDetected, + TBool aOldNetworksLost, + TBool aAnyNetworksDetected ); + + /** + * Cancel a pending request. + * + * @param aSessionId ID of the session. + * @param aCommand Command to cancel. + */ + void CancelExternalRequest( + TUint aSessionId, + TWLMCommands aCommand ); + + /** + * Check the given scan scheduling parameters and if the values are out of range + * set new values. If aCacheLifetime value is -1, read the value from device settings. + * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. + * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. + */ + void CheckScanSchedulingParameters( + TInt& aCacheLifetime, + TUint& aMaxDelay ); + + /** + * Adds a background scan request to the scan scheduling queue. + * @param aScanStartInterval when the background scan request should be handled. + * @return was the request successfully made. + */ + TInt BackgroundScanRequest( + TUint aScanStartInterval ); + + /** + * Check whether the phone is currently roaming. + * + * @return ETrue if the phone is currently roaming, EFalse otherwise. + */ + inline TBool IsRoaming() const; + + /** + * Check whether the given session is active. + * + * @param aEntry Session to be checked. + * @return ETrue if session is active, EFalse if it has been closed. + */ + inline TBool IsSessionActive( + const SRequestMapEntry& aEntry ) const; + + /** + * Calculate when the scanning should be started (= current moment in time + aDelay). + * @param aDelay Number of seconds to add to current moment in time. + * @return Calculated time. + */ + inline TTime CalculateScanStartTime( + const TInt aDelay ) const; + + /** + * Find the index of the entry that is related to aRequestId, returns count of entries + * in table if entry is not found. + * @param aRequestId request id that is searched + * @return TUint index to the iRequestMap entry that is related to given parameter + */ + inline TUint FindRequestIndex( + const TInt aRequestId ) const; + + /** + * Check if the given request is pending scan request and part of scan scheduling + * @param aIndex index to iRequestMap + * @return TBool Whether request is a pending scan request + */ + inline TBool IsPendingScanRequest( + const TInt aIndex ) const; + + /** + * Check if the given request is pending timed scan request and part of scan scheduling + * @param aIndex index to iRequestMap + * @return TBool Whether request is a pending scan request + */ + inline TBool IsPendingTimedScanRequest( + const TInt aIndex ) const; + + /** + * Check if the given request is first pending scan request and part of scan scheduling + * @param aMapEntry entry in iRequestMap + * @return TBool Whether request is a pending scan request + */ + TBool IsOnlyTimedScanRequestInRequestMap( + const SRequestMapEntry& aMapEntry ) const; + + /** + * Check if there are any SSID lists defined and update availability + * results as needed. + * + * @param aMapEntry entry in iRequestMap + */ + void HandleSsidListAvailabilityL( + const SRequestMapEntry& aMapEntry ); + + /** + * Store a key value to WLAN Central Repository. + * + * @param aKey Id of the WLAN Central Repository key. + * @param aValue Value to be written to the WLAN Central Repository key. + */ + void StoreWlanCenRepKeyValueL( const TUint32 aKey, const TInt aValue ) const; + + /** + * Get a current IAP ID from Db. + * + * @param aLanServiceId Specifies the table row in wlansettings. + * @param aCoreIapData Specifies the IAP data structure to be + * filled (i.e. IAP ID field to be filled for the structure). + */ + TInt GetCurrentIapId( + const TUint aLanServiceId, + core_iap_data_s& aCoreIapData ); + + private: // Data + + /** + * Pointer to core server + */ + abs_core_server_c* iCoreServer; + + /** + * Pointer to lower adaptation + * NOTE: This should be just passed on to core server, + * and let it handle communication towards this. + * (i.e. upper and lower adaptation layers should not interact directly) + */ + CWlmDriverIf* iDriverIf; + + /** + * Bitmap of supported WLAN features. + */ + TUint iSupportedFeatures; + + /** + * Timer creating periodic expirations. + * Used for starting scheduled scans + */ + CPeriodic* iScanSchedulingTimer; + + /** + * Cache for scanresults etc. + */ + CWlanScanResultCache* iCache; + + /** + * Cache lifetime for scan results. This value is read from device settings. + */ + TUint iConfiguredCacheLifetime; + + /** + * Handle to platform client that observes and updates system statuses + */ + CWlmPlatform* iPlatform; + + /** + * List of clients who have subscribed notifications + */ + RArray iNotificationArray; + + /** + * Adaptation caches the connection state + */ + TWlanConnectionState iConnectionState; + + /** + * The previous connection state. + */ + TWlanConnectionState iPrevConnectionState; + + /** + * Whether the phone is currently roaming. + */ + TBool iIsRoaming; + + /** + * Adaptation caches the RCPI value. + */ + TUint iPrevRcpiValue; + + /** + * Current regulatory domain + */ + TWlanRegion iRegion; + + /** + * Time of the last domain query + */ + TTime iTimeofDomainQuery; + + /** + * Number of open client sessions + */ + TUint iClientSessionCount; + + /** + * RequestMap is an array containing pending service requests + */ + RArray iRequestMap; + + /** + * requestId counter ensures that consecutive service requests get + * a unique identifier. + */ + TUint32 iRequestIdCounter; + + /** + * iSessionIdCounter is running counter for assigning an unique ID number + * for new a session. + */ + TUint32 iSessionIdCounter; + + /** + * Asynchronous callback for completing core server requests. + */ + CAsyncCallBack* iCoreAsynchCb; + + /** + * Request ID of the pending core server request. + */ + TUint iCoreAsynchCbId; + + /** + * Status of the pending core server request. + */ + core_error_e iCoreAsynchCbStatus; + + /** + * Whether system startup has been completed. + */ + TBool iIsStartupComplete; + + /** + * EAPOL implementation instantiated via ECom plugin interface. + */ + CWlanEapolClient* iEapolClient; + + /** + * EAPOL callback handler in core. + */ + abs_wlan_eapol_callback_c* iEapolHandler; + + /** + * Time when the scan scheduling timer is set to expire. + */ + TTime iScanSchedulingTimerExpiration; + + /** + * Request id to that request in the iRequestMap which has set the scan scheduling timer. + */ + TUint iRequestTriggeringScanning; + + /** + * This flag is set when scan request is sent to Core and reset when Core has completed the request. + * Scan request can be either GetScanResults, GetAvailableIaps or BackgroundScan + */ + TBool iCoreHandlingScanRequest; + + /** + * Power save mode requested from power save plugin. (Automatic/Light/Deep/None) + */ + TWlanPowerSave iPowerSaveMode; + + /** + * Power save enabled selected by user. (True/False) + */ + TBool iPowerSaveEnabled; + + /** + * Handler for Generic WLAN Plugins. + */ + CGenericWlanPlugin iGenericWlanPlugin; + + /** + * Storage for SSID lists. + */ + CWlanSsidListDb* iSsidListDb; + + /** + * Whether to show Broken Power Save Note. + */ + TBool iShowBrokenPowerSaveNote; + + /** + * Active object handling the Broken Power Save Notifier. + */ + CWlanCbWaiter* iBrokenPowerSaveNotifierWaiter; + + /** + * Notifier for displaying Broken Power Save Note dialog. + */ + RNotifier iBrokenPowerSaveNotifier; + + /** + * Reply from Broken Power Save Notifier. + */ + TPckgBuf iBrokenPowerSaveNotifierReply; + + /** + * Background scan provider. + */ + MWlanBgScanProvider* iBgScanProvider; + + /** + * Settings for background scan provider. + */ + MWlanBgScanProvider::TWlanBgScanSettings iBgScanProviderSettings; + + /** + * Timer services. + */ + CWlanTimerServices* iTimerServices; + + }; + + +#include "wlmserver.inl" + +#endif // WLMSERVER_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmserver.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods of CWlmServer +* +*/ + + +#include "am_debug.h" + +// --------------------------------------------------------- +// CWLMServer::GetScanType +// --------------------------------------------------------- +// +inline TWLMScanType CWlmServer::GetScanType() + { + DEBUG( "CWlmServer::GetScanType()" ); + return iPlatform->GetScanType(); + } + +// --------------------------------------------------------- +// CWLMServer::SetIconState +// --------------------------------------------------------- +// +inline TInt CWlmServer::SetIconState( TWlmIconStatus aStatus ) + { + DEBUG1( "CWlmServer::SetIconState( %u )", aStatus ); + return iPlatform->SetIconState( aStatus ); + } + +// --------------------------------------------------------- +// CWLMServer::UpdateAvailability +// --------------------------------------------------------- +// +inline void CWlmServer::UpdateAvailability( + TBool /*aAvailability*/, + TBool aNewNetworksDetected, + TBool aOldNetworksLost ) + { + TBuf8<1> tmp; + if( aNewNetworksDetected ) + { + // Notify subscribees + for( TInt i = 0; i < iNotificationArray.Count(); i++ ) + { + iNotificationArray[i]->AddNotification( EWlmNotifyNewNetworksDetected, tmp ); + } + } + if( aOldNetworksLost ) + { + // Notify subscribees + for( TInt i = 0; i < iNotificationArray.Count(); i++ ) + { + iNotificationArray[i]->AddNotification( EWlmNotifyOldNetworksLost, tmp ); + } + } + } + +// --------------------------------------------------------- +// CWlmServer::ReleaseRequest +// --------------------------------------------------------- +// +inline void CWlmServer::ReleaseRequest() + { + DEBUG( "CWlmServer::ReleaseRequest()" ); + if( GetCurrentState() != EWlanStateNotConnected ) + { + // create data for state change notification + TBuf8<1> state; + state.SetLength( 1 ); + state[0] = static_cast( EWlanStateNotConnected ); + + // create notification for all observing clients + for ( TInt i = 0; i < iNotificationArray.Count(); i++ ) + { + iNotificationArray[i]->AddNotification( EWlmNotifyConnectionStateChanged, state ); + } + } + else // state == not connected + { + if( iPlatform->IsWlanDisabled() ) + { + // KWlanIntCmdNull means not expecting completion for this request + iCoreServer->disable_wlan( KWlanIntCmdNull ); + } + } + } + +// --------------------------------------------------------- +// CWlmServer::EnableWlan +// --------------------------------------------------------- +// +inline void CWlmServer::EnableWlan() + { + // KWlanIntCmdNull means not expecting completion for this request + iCoreServer->enable_wlan( KWlanIntCmdNull ); + } + +// --------------------------------------------------------- +// CWlmServer::IsRoaming +// --------------------------------------------------------- +// +inline TBool CWlmServer::IsRoaming() const + { + return iIsRoaming; + } + +// --------------------------------------------------------- +// CWlmServer::IsSessionActive +// --------------------------------------------------------- +// +inline TBool CWlmServer::IsSessionActive( + const SRequestMapEntry& aEntry ) const + { + return ( aEntry.iSessionId != 0); + } + +// --------------------------------------------------------- +// CWlmServer::CalculateScanStartTime +// --------------------------------------------------------- +// +inline TTime CWlmServer::CalculateScanStartTime( + const TInt aDelay ) const + { + TTime scanTime; + scanTime.UniversalTime(); + TTimeIntervalSeconds delay( aDelay ); + scanTime += delay; + + return scanTime; + } + +// --------------------------------------------------------- +// CWlmServer::FindRequestIndex +// --------------------------------------------------------- +// +inline TUint CWlmServer::FindRequestIndex( + const TInt aRequestId ) const + { + TInt i(0); + for( i=0; i < iRequestMap.Count(); i++ ) + { + if( iRequestMap[i].iRequestId == aRequestId ) + { + return i; + } + } + return i; + } + +// --------------------------------------------------------- +// CWlmServer::IsPendingTimedScanRequest +// --------------------------------------------------------- +// +inline TBool CWlmServer::IsPendingTimedScanRequest( + const TInt aIndex ) const + { + return ( iRequestMap[aIndex].iTime != NULL ) && IsPendingScanRequest( aIndex ); + } + +// --------------------------------------------------------- +// CWlmServer::IsPendingScanRequest +// --------------------------------------------------------- +// +inline TBool CWlmServer::IsPendingScanRequest( + const TInt aIndex ) const + { + if( iRequestMap[aIndex].iRequestId == KWlanIntCmdBackgroundScan ) + { + return ETrue; + } + else if( iRequestMap[aIndex].iRequestId >= KWlanExtCmdBase && + iRequestMap[aIndex].iFunction == EGetAvailableIaps ) + { + return ETrue; + } + else if( iRequestMap[aIndex].iRequestId >= KWlanExtCmdBase && + iRequestMap[aIndex].iFunction == EGetScanResults ) + { + return ETrue; + } + else + { + return EFalse; + } + + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsession.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Session class is required by the Client/Server architecture +* +*/ + + +#ifndef WLMSESSION_H +#define WLMSESSION_H + +#include +#include "wlmclientserver.h" + +class CWlmServer; +class CSessionNotification; + +/** + * Server side counterpart for client's RWlmServer class. + * Each client connection has its own session in server. + * + * @lib wlmserversrv.lib + * @since Series 60 3.0 + */ +NONSHARABLE_CLASS(CWlmSession) : public CSession2 + { + + struct TNotification + { + TInt id; + TBuf8 data; + }; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CWlmSession* NewL( + CWlmServer& aServer ); + + /** + * Destructor. + */ + virtual ~CWlmSession(); + + public: // New functions + + /** + * AddNotification + * @since Series 60 3.0 + * @param ?arg1 ?description + */ + void AddNotification( + TInt aNotification, + const TDesC8& aData ); + + public: // Functions from base classes + + /** + * From CSession2 + * ServiceL is called by client/server infrastructure, + * and it takes care of one service request + * @since Series 60 3.0 + * @param aMessage containing the service request + */ + virtual void ServiceL( + const RMessage2& aMessage ); + + private: + + /** + * C++ default constructor. + */ + CWlmSession( + CWlmServer& aServer ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * ?member_description. + * @since Series 60 3.0 + * @param ?arg1 ?description + * @return ?description + */ + void HandleNotification(); + + /** + * ?member_description. + * @since Series 60 3.0 + * @param ?arg1 ?description + * @return ?description + */ + void HandleOrderNotifications( + const RMessage2& aMessage ); + + /** + * ?member_description. + * @since Series 60 3.0 + * @param ?arg1 ?description + * @return ?description + */ + void HandleCancelNotifications( + const RMessage2& aMessage ); + + private: // Data + + /** ID of the session. */ + TUint iId; + + /** Handle to the WLAN server. */ + CWlmServer& iWlmServer; + + /** List of pending (not sent) notifications. */ + RArray iPendingNotifications; + + /** The request from the client pending for a notification. */ + RMessagePtr2 iPendingNotificationRequest; + + /** Is there a pending request from the client. */ + TBool iIsNotificationRequestPending; + + /** Handle to remove notification. */ + CSessionNotification* iNotificationHandle; + }; + +#endif // WLMSESSION_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsystemnotify.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmsystemnotify.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition for the system data notification service callback interface. +* +*/ + + +#ifndef WLMSYSTEMNOTIFY_H +#define WLMSYSTEMNOTIFY_H + +#include "wlmclientserver.h" + +enum TWlmIconStatus + { + EWlmIconStatusNotAvailable, + EWlmIconStatusAvailable, + EWlmIconStatusConnected, + EWlmIconStatusConnectedSecure + }; + +/** +* Callback interface for system data notification services. +* +* These virtual methods should be implemented by the client if it +* needs any notifications. +* @lib +* @since Series 60 3.0 +*/ +class MWlmSystemNotify + { + public: + + /** + * System Mode has changed. + */ + virtual void SystemModeChanged( + TWlanSystemMode /* aOldMode */, + TWlanSystemMode /* aNewMode */ ) = 0; + + /** + * Emergency call has started, WLAN is forced to be enabled. + */ + virtual void EmergencyCallEstablished() = 0; + + /** + * Emergency call has ended, WLAN is not forced to be enabled anymore. + */ + virtual void EmergencyCallCompleted( TWlanSystemMode /* aNewMode */ ) = 0; + + /** + * BT connection has been established. + */ + virtual void BtConnectionEstablished() = 0; + + /** + * BT connection has been disconnected. + */ + virtual void BtConnectionDisabled() = 0; + }; + +#endif // WLMSYSTEMNOTIFY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmtimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmtimer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: generic Symbian timer +* +*/ + + +#ifndef WLMTIMER_H +#define WLMTIMER_H + +// INCLUDES +#include +#include "abs_core_timer.h" + +class core_callback_c; + +// CLASS DECLARATION +/** +* This class implements a generic Symbian timer. +* +* Timers are instantiated using the the timer factory. +* @see core_timer_factory_c::create_timer +*/ +NONSHARABLE_CLASS( am_symbian_timer_c ) : + public CTimer, + public abs_core_timer_c + { + public: // Constructors and destructor + + /** + * C++ default constructor. + * @param callback Callback to call when the timer expires. + */ + am_symbian_timer_c( + core_callback_c* callback ); + + /** + * Destructor. + */ + virtual ~am_symbian_timer_c(); + + public: // Functions from base classes + + /** + * From abs_core_timer_c Start the timer. + * @param delay Expiracy time in micro seconds. + */ + void start( + unsigned long int delay ); + + /** + * From abs_core_timer_c Stop the timer. + */ + void stop(); + + /** + * From abs_core_timer_c Check whether the timer is active. + * @ return True if the timer is active, false otherwise. + */ + bool_t is_active() const; + + protected: // Functions from base classes + + /** + * From CTimer Action of timer expiration. + */ + void RunL(); + + private: + + // Prohibit copy constructor if not deriving from CBase. + am_symbian_timer_c( + const am_symbian_timer_c& ); + // Prohibit assigment operator if not deriving from CBase. + am_symbian_timer_c& operator=( + const am_symbian_timer_c& ); + + private: // Data + + /** Callback to call when the timer expires. */ + core_callback_c* callback_m; + }; + +#endif // WLMTIMER_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmtsparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmtsparams.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Default parameter sets for traffic streams. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef WLMTSPARAMS_H +#define WLMTSPARAMS_H + +#include "core_types.h" + +/** + * Constant definitions. + */ +const u32_t KWlmTsParamUnspecified = 0; +const u32_t KWlmTsParamDisabled = 0xFFFFFFFF; +const u32_t KWlmTsParamBitNominalSizeFixed = 0x8000; + +/** + * The default traffic stream parameter sets per access class. + */ +const core_traffic_stream_params_s KWlmDefaultTsParams[] = + { + // EWlmAccessClassBestEffort + { + false_t, // Periodic traffic + core_traffic_stream_direction_bidirectional,// Traffic stream direction + KWlmTsParamUnspecified, // Nominal MSDU size (bytes) + 1500, // Maximum MSDU size (bytes) + KWlmTsParamUnspecified, // Minimum service interval (microseconds) + KWlmTsParamUnspecified, // Maximum service interval (microseconds) + KWlmTsParamUnspecified, // Inactivity interval (microseconds) + KWlmTsParamDisabled, // Suspension interval (microseconds) + KWlmTsParamUnspecified, // Service start time (microseconds) + 60000, // Minimum data rate (bps) + 60000, // Average data rate (bps) + 60000, // Maximum data rate (bps) + KWlmTsParamUnspecified, // Maximum burst size (bytes) + KWlmTsParamUnspecified, // Maximum transport delay (microseconds) + 6000000, // Minimum WLAN data rate (bps) + core_tx_rate_6mbit, // Nominal WLAN data rate (bps) + 8192, // SBA ratio + true_t, // Re-creation of traffic streams + 0, // ignored + 0, // ignored + 0 // ignored + }, + + // EWlmAccessClassBackground + { + false_t, // Traffic pattern + core_traffic_stream_direction_bidirectional,// Traffic stream direction + KWlmTsParamUnspecified, // Nominal MSDU size (bytes) + 1500, // Maximum MSDU size (bytes) + KWlmTsParamUnspecified, // Minimum service interval (microseconds) + KWlmTsParamUnspecified, // Maximum service interval (microseconds) + KWlmTsParamUnspecified, // Inactivity interval (microseconds) + KWlmTsParamDisabled, // Suspension interval (microseconds) + KWlmTsParamUnspecified, // Service start time (microseconds) + 60000, // Minimum data rate (bps) + 60000, // Average data rate (bps) + 60000, // Maximum data rate (bps) + KWlmTsParamUnspecified, // Maximum burst size (bytes) + KWlmTsParamUnspecified, // Maximum transport delay (microseconds) + 6000000, // Minimum WLAN data rate (bps) + core_tx_rate_6mbit, // Nominal WLAN data rate (bps) + 8192, // SBA ratio + true_t, // Re-creation of traffic streams + 0, // ignored + 0, // ignored + 0 // ignored + }, + + // EWlmAccessClassVideo + { + false_t, // Traffic pattern + core_traffic_stream_direction_bidirectional,// Traffic stream direction + 150, // Nominal MSDU size (bytes) + 1500, // Maximum MSDU size (bytes) + KWlmTsParamUnspecified, // Minimum service interval (microseconds) + KWlmTsParamUnspecified, // Maximum service interval (microseconds) + KWlmTsParamUnspecified, // Inactivity interval (microseconds) + KWlmTsParamDisabled, // Suspension interval (microseconds) + KWlmTsParamUnspecified, // Service start time (microseconds) + 160, // Minimum data rate (bps) + 160, // Average data rate (bps) + 160, // Maximum data rate (bps) + KWlmTsParamUnspecified, // Maximum burst size (bytes) + KWlmTsParamUnspecified, // Maximum transport delay (microseconds) + 6000000, // Minimum WLAN data rate (bps) + core_tx_rate_6mbit, // Nominal WLAN data rate (bps) + 8192, // SBA ratio + true_t, // Re-creation of traffic streams + 0, // ignored + 0, // ignored + 0 // ignored + }, + + // EWlmAccessClassVoice + { + true_t, // Traffic pattern + core_traffic_stream_direction_bidirectional,// Traffic stream direction + 208 | KWlmTsParamBitNominalSizeFixed, // Nominal MSDU size (bytes) + 208, // Maximum MSDU size (bytes) + 20000, // Minimum service interval (microseconds) + 20000, // Maximum service interval (microseconds) + 10000000, // Inactivity interval (microseconds) + KWlmTsParamDisabled, // Suspension interval (microseconds) + KWlmTsParamUnspecified, // Service start time (microseconds) + 83200, // Minimum data rate (bps) + 83200, // Average data rate (bps) + 83200, // Maximum data rate (bps) + KWlmTsParamUnspecified, // Maximum burst size (bytes) + KWlmTsParamUnspecified, // Maximum transport delay (microseconds) + 6000000, // Minimum WLAN data rate (bps) + core_tx_rate_6mbit, // Nominal WLAN data rate (bps) + 8193, // SBA ratio + true_t, // Re-creation of traffic streams + 0, // ignored + 0, // ignored + 0 // ignored + } + }; + +#endif // WLMTSPARAMS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/rom/wlaneng.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/rom/wlaneng.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains infromation about binary files and binary file locations +* +*/ + + +#ifndef __WLANENG_IBY__ +#define __WLANENG_IBY__ +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\wlandevicesettings.dll SHARED_LIB_DIR\wlandevicesettings.dll +file=ABI_DIR\BUILD_DIR\wlmplatform.dll SHARED_LIB_DIR\wlmplatform.dll +file=ABI_DIR\BUILD_DIR\wlmserver.dll SHARED_LIB_DIR\wlmserver.dll +file=ABI_DIR\BUILD_DIR\wlmserverexe.exe SHARED_LIB_DIR\wlmserverexe.exe + +#ifdef FF_WLAN_EXTENSIONS + file=ABI_DIR\BUILD_DIR\wlmserversrv_wpx.dll SHARED_LIB_DIR\wlmserversrv.dll +#else + file=ABI_DIR\BUILD_DIR\wlmserversrv.dll SHARED_LIB_DIR\wlmserversrv.dll +#endif + +ECOM_PLUGIN( wlanmgmtimpl.dll,101f8efd.rsc ) +ECOM_PLUGIN( wlancontrolimpl.dll,10282e0d.rsc ) + +// backup registration file +data=ZPRIVATE\101f8ec5\backup_registration.xml private\101f8ec5\backup_registration.xml + +#endif // __PROTOCOL_WLAN +#endif // __WLANENG_IBY__ + +// End of File + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/101f8efd.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/101f8efd.rss Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom resources for the WlanMgmtImpl +* +*/ + + +#include + +// --------------------------------------------------------- +// +// +// ECOM resource definitions for WlanMgmtImpl plugin +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x101f8efd; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x101f8efe; + implementations = + { + // Info for WlanMgmtImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x101f8eff; + version_no = 1; + display_name = "WlanMgmtImpl"; + default_data = ""; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x101f8f00; + implementations = + { + // Info for WlanScanInfoImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x101f8f01; + version_no = 1; + display_name = "WlanScanInfoImpl"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/1020738f.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/1020738f.rss Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom resources for the WlmPlatform +* +*/ + + +#include + +// --------------------------------------------------------- +// +// +// ECOM resource definitions for WlanPowersaveImpl plugin +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x1020738f; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x10207390; + implementations = + { + // Info for WlanPowerSaveImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x10207391; + version_no = 1; + display_name = "WlanPowerSaveImpl"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/10282e0d.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/10282e0d.rss Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project wlancontrolimpl. +* +*/ + + +#include + +// --------------------------------------------------------- +// +// +// ECOM resource definitions for WlanControlImpl plugin +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x10282e0d; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x10282e0e; + implementations = + { + // Info for WlanControlImpl + IMPLEMENTATION_INFO + { + implementation_uid = 0x10282e0f; + version_no = 1; + display_name = "WlanControlImpl"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/rwlmserver.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,932 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of interface for WLAN services. +* +*/ + +/* +* %version: 27 % +*/ + +#include +#include "wlandevicesettings.h" +#include "rwlmserver.h" +#include "wlmscanrequest.h" +#include "am_debug.h" + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::ActivateNotifiesL( + MWLMNotify& aCallback, + TUint32 aNotificationMask ) + { + DEBUG( "RWLMServer::ActivateNotifiesL()" ); + if( iNotify != NULL ) + { + iNotify->Activate( aCallback, aNotificationMask ); + } + else + { + iNotify = CWLMNotify::NewL( aCallback, *this, aNotificationMask ); + } + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelNotifies() + { + DEBUG( "RWLMServer::CancelNotifies()" ); + if( iNotify == NULL ) + { + return; + } + if( iNotify->IsActive() ) + { + // Notifications activated, request is pending + iNotify->Cancel(); + } + else + { + // Notifications activated, currently executing a notification + //(i.e. in RunL of iNotify) + iNotify->SetCancelled(); + } + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +void RWLMServer::CancelRequest() + { + DEBUG( "RWLMServer::CancelRequest()" ); + + // Check is notify service activated. + if( iNotify != NULL ) + { + // Send synchronous request to the data server + DEBUG( "RWLMServer::CancelRequest() Cancelling..." ); + SendReceive( ECancelNotifications, TIpcArgs() ); + DEBUG( "Done!" ); + } + else + { + DEBUG( "RWLMServer::CancelRequest() Notification service was not started." ); + } + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::Close() + { + DEBUG( "RWLMServer::Close()" ); + delete iNotify; + iNotify = NULL; + delete iScanRequest; + iScanRequest = NULL; + delete iTsCreateRequest; + iTsCreateRequest = NULL; + RHandleBase::Close(); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::Connect() + { + DEBUG( "RWLMServer::Connect()" ); + + // Check that server is running + TInt err = StartServer(); + if( err != KErrNone ) + { + DEBUG1( "RWLMServer::Connect() - unable to start server (%d)", + err ); + + return err; + } + + // Create a new session + err = CreateSession( KWLMDataServerName, Version() ); + if( err != KErrNone ) + { + DEBUG1( "RWLMServer::Connect() - unable to create a session (%d)", + err ); + + return err; + } + + iNotify = NULL; + iScanRequest = NULL; + iTsCreateRequest = NULL; + TRAP( err, iScanRequest = CWlmScanRequest::NewL( *this ) ); + if ( err != KErrNone ) + { + DEBUG1( "RWLMServer::Connect() - unable to create CWlmScanRequest (%d)", + err ); + RHandleBase::Close(); + + return err; + } + + return KErrNone; + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetBSSID( TMacAddress& aBssid ) + { + DEBUG( "RWLMServer::GetBSSID()" ); + + TMacPckg mac; + mac.data = KZeroMacAddr; + TPckg inPckg( mac ); + TIpcArgs params( &inPckg ); + + TInt ret = SendReceive( EGetMacAddress, params ); + if( ret == KErrNone ) + { + Mem::Copy( &aBssid, &mac.data, sizeof( aBssid ) ); + } + return ret; + } + + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetNetworkName( TDes& aNwName ) + { + DEBUG( "RWLMServer::GetNetworkName()" ); + + // Get SSID from the server. + TSSID ssid = { 0 }; + TPckg inPckg( ssid ); + TIpcArgs params( &inPckg ); + + TInt ret = SendReceive( EGetNetworkName, params ); + if( ret == KErrNone ) + { + // Convert it to text. + TBuf8 buf; + buf.Format( _L8( "%s" ), ssid.ssid ); + buf.SetLength( + ssid.ssidLength < static_cast( aNwName.MaxLength() ) ? + ssid.ssidLength : + aNwName.MaxLength() ); + aNwName.Copy( buf ); + } + return ret; + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TWlanConnectionState RWLMServer::GetConnectionState() + { + DEBUG( "RWLMServer::GetConnectionState()" ); + + // Call the server + TWlanConnectionState connectionState( EWlanStateNotConnected ); + TPckg outPckg( connectionState ); + TIpcArgs params( &outPckg ); + + TInt ret = SendReceive( EGetCurrentState, params ); + if( ret != KErrNone ) + { + return EConnectionStateUnknown; + } + else + { + return connectionState; + } + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetConnectionRCPI( TInt32& aRCPI ) + { + DEBUG( "RWLMServer::GetConnectionRCPI()" ); + + TPckg inPckg( aRCPI ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetCurrentRSSI, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetSecurityMode( TWlanSecurity& aMode ) + { + DEBUG( "RWLMServer::GetSecurityMode()" ); + + TPckg inPckg( aMode ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetSecurityMode, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetSystemMode( TWlanSystemMode& aMode ) + { + DEBUG( "RWLMServer::GetSystemMode()" ); + + TPckg inPckg( aMode ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetSystemMode, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetScanResults( + ScanList& aResults, + const TDesC8& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay ) + { + DEBUG( "RWLMServer::GetScanResults( aResults, aSsid, aCacheLifetime, aMaxDelay )" ); + + return iScanRequest->IssueRequest( + aResults, + aSsid, + aCacheLifetime, + aMaxDelay, + NULL ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::GetScanResults( + ScanList& aResults, + const TDesC8& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus& aStatus ) + { + DEBUG2( "RWLMServer::GetScanResults( aResults, aSsid, aCacheLifetime(%d), aMaxDelay(%u), aStatus )", + aCacheLifetime, aMaxDelay ); + + iScanRequest->IssueRequest( + aResults, + aSsid, + aCacheLifetime, + aMaxDelay, + &aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelGetScanResults() + { + DEBUG( "RWLMServer::CancelGetScanResults()" ); + + if ( iScanRequest->IsActive() ) + { + iScanRequest->Cancel(); + + // Complete the pending client request. + TRequestStatus* status = iScanRequest->ClientStatus(); + User::RequestComplete( status, KErrCancel ); + } + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::Join( + TRequestStatus& aStatus, + const TUint32 aId, + TWLMOverrideSettings* aOverrides ) + { + DEBUG( "RWLMServer::Join()" ); + + // Use the override settings if necessary + if( aOverrides ) + { + iOverridePckg = *aOverrides; + } + else + { + // override settings not used + + TWLMOverrideSettings overrides; + overrides.settingsMask = EOverrideNoneMask; + iOverridePckg = overrides; + } + + aStatus = KRequestPending; + TIpcArgs params( reinterpret_cast( aId ), &iOverridePckg ); + + // Send the command + SendReceive( EJoinByProfileId, params, aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelJoin() + { + DEBUG( "RWLMServer::CancelJoin()" ); + + // Send the command + SendReceive( ECancelJoin ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::Release() + { + DEBUG( "RWLMServer::Release()" ); + return SendReceive( EReset, TIpcArgs() ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetAvailableIaps( + TWlmAvailableIaps& aAvailableIaps, + TInt& aCacheLifetime, + TUint& aMaxDelay ) + { + DEBUG2( "RWLMServer::GetAvailableIaps( aAvailableIaps, aCacheLifetime(%d), aMaxDelay(%u) )", + aCacheLifetime, aMaxDelay ); + + TRequestStatus status; + TPckg inPckg( aAvailableIaps ); + TPckg inPckg2( aCacheLifetime ); + TPckg inPckg3( aMaxDelay ); + GetAvailableIaps( inPckg, inPckg2, inPckg3, status ); + User::WaitForRequest( status ); + DEBUG1( "RWLMServer::GetAvailableIaps() - Server returned status %d", status.Int() ); + + return status.Int(); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::GetAvailableIaps( + TDes8& aAvailableIaps, + TDes8& aCacheLifetime, + TDes8& aMaxDelay, + TRequestStatus& aStatus ) + { + DEBUG( "RWLMServer::GetAvailableIaps( aAvailableIaps, aCacheLifetime, aMaxDelay, aStatus )" ); + + aStatus = KRequestPending; + TIpcArgs params( &aAvailableIaps, &aCacheLifetime, &aMaxDelay ); + SendReceive( EGetAvailableIaps, params, aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelGetAvailableIaps() + { + DEBUG( "RWLMServer::CancelGetAvailableIaps()" ); + + // Send the command + SendReceive( ECancelGetAvailableIaps ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::NotifyChangedSettings() + { + DEBUG( "RWLMServer::NotifyChangedSettings()" ); + SendReceive( ENotifyChangedSettings, TIpcArgs() ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::AddBssidToRoguelist( const TMacAddress& aBssid ) + { + DEBUG( "RWLMServer::AddBssidToRoguelist()" ); + + TMacPckg mac; + Mem::Copy( &mac.data, &aBssid, sizeof( aBssid ) ); + TPckg inPckg( mac ); + TIpcArgs params( &inPckg ); + return SendReceive( EAddBssidToRoguelist, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::UpdateRcpNotificationBoundary( + const TInt32 aRcpLevelBoundary, + const TInt32 aHysteresis ) + { + DEBUG2( "RWLMServer::UpdateRcpNotificationBoundary(): %d, %d", aRcpLevelBoundary, aHysteresis ); + TIpcArgs params( aRcpLevelBoundary, aHysteresis ); + return SendReceive( EUpdateRcpNotificationBoundaries, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::ConfigureMulticast( + TUint aCommand, + const TMacAddress& aMulticastAddress ) + { + DEBUG1( "RWLMServer::ConfigureMulticast(): %d", aCommand ); + DEBUG_BUFFER( KMacAddressLength, aMulticastAddress.iMacAddress ); + + TMacPckg mac; + Mem::Copy( &mac.data, &aMulticastAddress, sizeof( aMulticastAddress ) ); + TPckg inPckg( mac ); + TIpcArgs params( &inPckg, aCommand ); + return SendReceive( EConfigureMulticastGroup, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetPacketStatistics( + TWlanPacketStatistics& aStatistics ) + { + DEBUG( "RWLMServer::GetPacketStatistics()" ); + + TPckg inPckg( aStatistics ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetPacketStatistics, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::ClearPacketStatistics() + { + DEBUG( "RWLMServer::ClearPacketStatistics()" ); + + SendReceive( EClearPacketStatistics, TIpcArgs() ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetUapsdSettings( + TWlanUapsdSettings& aSettings ) + { + DEBUG( "RWLMServer::GetUapsdSettings()" ); + + TPckg inPckg( aSettings ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetUapsdSettings, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::SetUapsdSettings( + const TWlanUapsdSettings& aSettings ) + { + DEBUG( "RWLMServer::SetUapsdSettings()" ); + + TPckg inPckg( aSettings ); + TIpcArgs params( &inPckg ); + return SendReceive( ESetUapsdSettings, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetPowerSaveSettings( + TWlanPowerSaveSettings& aSettings ) + { + DEBUG( "RWLMServer::GetPowerSaveSettings()" ); + + TPckg inPckg( aSettings ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetPowerSaveSettings, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::SetPowerSaveSettings( + const TWlanPowerSaveSettings& aSettings ) + { + DEBUG( "RWLMServer::SetPowerSaveSettings()" ); + + TPckg inPckg( aSettings ); + TIpcArgs params( &inPckg ); + return SendReceive( ESetPowerSaveSettings, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::RunProtectedSetup( + TRequestStatus& aStatus, + TUint32 aId, + TDes8& aCredentials ) + { + DEBUG( "RWLMServer::RunProtectedSetup(TRequestStatus)" ); + + aStatus = KRequestPending; + TIpcArgs params( aId, &aCredentials ); + + // Send the command + SendReceive( ERunProtectedSetup, params, aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelProtectedSetup() + { + DEBUG( "RWLMServer::CancelProtectedSetup()" ); + + // Send the command + SendReceive( ECancelProtectedSetup ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CreateTrafficStream( + TRequestStatus& aStatus, + const TWlanTrafficStreamParameters& aStreamParameters, + TBool aIsAutomaticStream, + TUint& aStreamId, + TWlanTrafficStreamStatus& aStreamStatus ) + { + DEBUG( "RWLMServer::CreateTrafficStream()" ); + + delete iTsCreateRequest; + iTsCreateRequest = NULL; + + iTsCreateRequest = new TWlmTsCreateRequest( + aStreamParameters, + aStreamId, + aStreamStatus ); + if( !iTsCreateRequest ) + { + DEBUG( "RWLMServer::CreateTrafficStream() - unable to allocate TWlmTsCreateRequest" ); + + TRequestStatus* status = &aStatus; + User::RequestComplete( status, KErrNoMemory ); + + return; + } + + TIpcArgs params( + &iTsCreateRequest->iTsParameterPckg, + reinterpret_cast( aIsAutomaticStream ), + &iTsCreateRequest->iTsIdPckg, + &iTsCreateRequest->iTsStatusPckg ); + + // Send the command + SendReceive( ECreateTrafficStream, params, aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelCreateTrafficStream() + { + DEBUG( "RWLMServer::CancelCreateTrafficStream()" ); + + // Send the command + SendReceive( ECancelCreateTrafficStream ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::DeleteTrafficStream( + TRequestStatus& aStatus, + TUint aStreamId ) + { + DEBUG( "RWLMServer::DeleteTrafficStream()" ); + + TIpcArgs params( + reinterpret_cast( aStreamId ) ); + + // Send the command + SendReceive( EDeleteTrafficStream, params, aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelDeleteTrafficStream() + { + DEBUG( "RWLMServer::CancelDeleteTrafficStream()" ); + + // Send the command + SendReceive( ECancelDeleteTrafficStream ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetAccessPointInfo( + TWlanAccessPointInfo& aInfo ) + { + DEBUG( "RWLMServer::GetAccessPointInfo()" ); + + TPckg inPckg( aInfo ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetAccessPointInfo, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetRoamMetrics( + TWlanRoamMetrics& aRoamMetrics ) + { + DEBUG( "RWLMServer::GetRoamMetrics()" ); + + TPckg inPckg( aRoamMetrics ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetRoamMetrics, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetRogueList( + CArrayFixSeg& aRogueList ) + { + DEBUG( "RWLMServer::GetRogueList()" ); + + aRogueList.Reset(); + TWlmRogueList rogueListStorage; + TPckg rogueListBuf( rogueListStorage ); + + TIpcArgs params( &rogueListBuf ); + TInt ret = SendReceive( EGetRogueList, params ); + + for ( TUint idx( 0 ); idx < rogueListStorage.count; ++idx ) + { + TRAP_IGNORE( aRogueList.AppendL( + rogueListStorage.list[idx] ) ) + } + return ret; + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetRegulatoryDomain( + TWlanRegion& aRegion ) + { + DEBUG( "RWLMServer::GetRegulatoryDomain()" ); + + TPckg inPckg( aRegion ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetRegulatoryDomain, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetPowerSaveMode( + TWlanPowerSave& aPowerSaveMode ) + { + DEBUG( "RWLMServer::GetPowerSaveMode()" ); + + TPckg inPckg( aPowerSaveMode ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetPowerSaveMode, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) + { + DEBUG( "RWLMServer::AddIapSsidList()" ); + + TUint size( + aSsidList.Count() * aSsidList.Length() ); + TIpcArgs params( + reinterpret_cast( aIapId ), + aSsidList.Count(), + NULL ); + + if( size ) + { + TPtr8 ssidListPtr( + reinterpret_cast( + const_cast( aSsidList.Back( 0 ) ) ), size, size ); + params.Set( 2, &ssidListPtr ); + } + + // Send the command + return SendReceive( EAddIapSsidList, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::RemoveIapSsidList( + TUint aIapId ) + { + DEBUG( "RWLMServer::RemoveIapSsidList()" ); + + TIpcArgs params( + reinterpret_cast( aIapId ) ); + + // Send the command + return SendReceive( ERemoveIapSsidList, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::SetPowerSaveMode( + TWlanPowerSaveMode aMode ) + { + DEBUG( "RWLMServer::SetPowerSaveMode()" ); + + TIpcArgs params( + reinterpret_cast( aMode ) ); + + // Send the command + return SendReceive( ESetPowerSaveMode, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::NotifyChangedPsmSrvMode( + TInt aMode ) + { + DEBUG( "RWLMServer::NotifyChangedPsmSrvMode()" ); + + TIpcArgs params( + reinterpret_cast( aMode ) ); + + // Send the command + return SendReceive( ENotifyChangedPsmSrvMode, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C TInt RWLMServer::GetAcTrafficStatus( + TWlmAcTrafficStatusArray& aArray ) + { + DEBUG( "RWLMServer::GetAcTrafficStatus()" ); + + TPckg inPckg( aArray ); + TIpcArgs params( &inPckg ); + return SendReceive( EGetAcTrafficStatus, params ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::DirectedRoam( + TRequestStatus& aStatus, + const TMacAddress& aBssid ) + { + DEBUG( "RWLMServer::DirectedRoam()" ); + + iRoamBssidPckg = aBssid; + TIpcArgs params( + &iRoamBssidPckg ); + + // Send the command + SendReceive( EDirectedRoam, params, aStatus ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +EXPORT_C void RWLMServer::CancelDirectedRoam() + { + DEBUG( "RWLMServer::CancelDirectedRoam()" ); + + // Send the command + SendReceive( ECancelDirectedRoam ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +TInt RWLMServer::StartServer() + { + DEBUG( "RWLMServer::StartServer()" ); + + RProcess server; + RSemaphore globStartSignal; + TFindServer findWlanServer( KWLMDataServerName ); + TFullName name; + + // Does the server already exist? + if ( findWlanServer.Next( name ) == KErrNone ) + { + DEBUG( "RWLMServer::StartServer() Server does exist!" ); + return KErrNone; + } + + DEBUG( "RWLMServer::StartServer() Server is not loaded -- load it." ); + + // Create semaphore to allow server to signal when it starts + TInt err = globStartSignal.CreateGlobal( KWLMServerSemaphore, 0 ); + if ( err != KErrNone ) + { + DEBUG( "RWLMServer::StartServer() semafore is in use..." ); + // If semaphore already exists, open it and wait + err = globStartSignal.OpenGlobal( KWLMServerSemaphore,EOwnerProcess ); + if ( err == KErrNone ) + { + DEBUG( "Waiting release of the semafore..." ); + globStartSignal.Wait(); + return KErrNone; + } + else + { + DEBUG( "RWLMServer::StartServer() Opening semafore failed." ); + return err; + } + } + + DEBUG( "RWLMServer::StartServer() Creating server process." ); + + // Create the server process + TBufC<1> cmdline; + + err = server.Create( KWLMServerExe, cmdline, EOwnerThread ); + if ( err == KErrNone ) + { + DEBUG( "RWLMServer::StartServer() set priority..." ); + server.SetPriority( EPriorityHigh ); + } + else + { + DEBUG1( "RWLMServer::StartServer() Server creation failed (%d).", err ); + return err; + } + + // Resume server process + server.Resume(); + server.Close(); + + // Wait for server process to initialise + globStartSignal.Wait(); + + // Delete semaphore + globStartSignal.Close(); + + // Ensure that server is really there + DEBUG( "RWLMServer::StartServer() Ensure that server is really there..." ); + findWlanServer.Find( KWLMDataServerName ); + TInt r = findWlanServer.Next( name ); + DEBUG1( "RWLMServer::StartServer() server search returns %d", r ); + return r; + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +TVersion RWLMServer::Version() const + { + DEBUG( "RWLMServer::Version()" ); + return( TVersion( + KWLMServMajorVersionNumber, + KWLMServMinorVersionNumber, + KWLMServBuildVersionNumber ) ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// +void RWLMServer::WaitForNotification( + TRequestStatus& aReturnValue, + TDes8& aReturnData, + TUint32 aNotificationMask ) + { + DEBUG( "RWLMServer::WaitForNotification()" ); + TIpcArgs params( &aReturnData, reinterpret_cast( aNotificationMask ) ); + SendReceive( EOrderNotifications, params, aReturnValue ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscan.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,854 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements WLAN background scan logic. +* +*/ + +/* +* %version: 12 % +*/ + +#include +#include + +#include "wlanscanproviderinterface.h" +#include "awsinterface.h" +#include "awsenginebase.h" +#include "wlancbwaiter.h" +#include "wlanbgscanawscomms.h" +#include "wlanbgscan.h" +#include "wlandevicesettings.h" // default values in case invalid data is passed in NotifyChangedSettings +#include "am_debug.h" + +/** + * One day to be added to TTime. + */ +const TInt KAddOneDay = 1; + +/** + * Get hours from CenRep variable. + */ +const TInt KGetHours = 100; + +/** + * Zero seconds. + */ +const TInt KZeroSeconds = 0; + +/** + * Last minute of a day. + */ +const TInt KWlanBgScanTwentyThreeFiftyNineOclock = 2359; + +/** + * Maximun interval for background scan. + */ +const TInt KWlanBgScanMaxInterval = 1800; + +#ifdef _DEBUG +/** + * Formatting of date time debug string. + */ +_LIT( KWlanBgScanDateTimeFormat, "%F %*E %*N %D %H:%T:%S" ); + +/** + * Maximun length for date time debug string. + */ +const TInt KWlanBgScanMaxDateTimeStrLen = 50; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWlanBgScan::CWlanBgScan +// --------------------------------------------------------------------------- +// +CWlanBgScan::CWlanBgScan( MWlanScanResultProvider& aProvider, CWlanTimerServices& aTimerServices ) : + iProvider ( aProvider ), + iCurrentBgScanInterval( 0 ), + iAwsComms( NULL ), + iBgScanState( EBgScanOff ), + iAutoPeriod( EAutoPeriodNone ), + iTimerServices( aTimerServices ), + iIntervalChangeRequestId( 0 ), + iBgScanPeakStartTime( 0 ), + iBgScanPeakEndTime( 0 ), + iBgScanIntervalPeak( 0 ), + iBgScanIntervalOffPeak( 0 ) + { + DEBUG( "CWlanBgScan::CWlanBgScan()" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::ConstructL +// --------------------------------------------------------------------------- +// +void CWlanBgScan::ConstructL() + { + DEBUG( "CWlanBgScan::ConstructL()" ); + + // create AWS comms interface + TRAPD( err, iAwsComms = CWlanBgScanAwsComms::NewL( *this ) ); + if( err != KErrNone ) + { + if( iAwsComms ) + { + delete iAwsComms; + iAwsComms = NULL; + } + DEBUG1( "CWlanBgScan::ConstructL() - AWS comms creation failed with code %i", err ); + } + else + { + DEBUG( "CWlanBgScan::ConstructL() - AWS comms creation successful" ); + } + + DEBUG( "CWlanBgScan::ConstructL() - done" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::NewL +// --------------------------------------------------------------------------- +// +CWlanBgScan* CWlanBgScan::NewL( MWlanScanResultProvider& aProvider, CWlanTimerServices& aTimerServices ) + { + DEBUG( "CWlanBgScan::NewL()" ); + CWlanBgScan* self = new ( ELeave ) CWlanBgScan( aProvider, aTimerServices ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::~CWlanBgScan +// --------------------------------------------------------------------------- +// +CWlanBgScan::~CWlanBgScan() + { + DEBUG( "CWlanBgScan::CWlanBgScan()" ); + } + +// --------------------------------------------------------------------------- +// From class MWlanBgScanProvider. +// CWlanBgScan::ScanComplete +// --------------------------------------------------------------------------- +// +void CWlanBgScan::ScanComplete() + { + DEBUG1( "CWlanBgScan::ScanComplete() - current interval %us", GetInterval() ); + + if ( GetInterval() != KWlanBgScanIntervalNever ) + { + DEBUG1( "CWlanBgScan::ScanComplete() - issue a new request with %us as expiry", GetInterval() ); + iProvider.Scan( GetInterval() ); + } + } + +// --------------------------------------------------------------------------- +// From class MWlanBgScanProvider. +// CWlanBgScan::IntervalChanged +// --------------------------------------------------------------------------- +// +void CWlanBgScan::IntervalChanged( TUint32 aNewInterval ) + { + DEBUG1( "CWlanBgScan::IntervalChanged() - aNewInterval %u", aNewInterval ); + + NextState( aNewInterval ); + + DEBUG2( "CWlanBgScan::IntervalChanged() - current interval %u, current state %u", + GetInterval(), + iBgScanState ); + } + +// --------------------------------------------------------------------------- +// From class MWlanBgScanProvider. +// CWlanBgScan::NotConnected +// --------------------------------------------------------------------------- +// +void CWlanBgScan::NotConnected() + { + DEBUG1( "CWlanBgScan::NotConnected() - current interval %us", GetInterval() ); + + if ( GetInterval() != KWlanBgScanIntervalNever ) + { + DEBUG( "CWlanBgScan::NotConnected() - issue a new request with immediate expiry" ); + iProvider.Scan( KWlanBgScanMaxDelayExpireImmediately ); + } + } + +// --------------------------------------------------------------------------- +// From class MWlanBgScanProvider. +// CWlanBgScan::IsBgScanEnabled +// --------------------------------------------------------------------------- +// +TBool CWlanBgScan::IsBgScanEnabled() + { + // If ( interval != never ) -> Return True + // Otherwise -> return False + DEBUG1( "CWlanBgScan::IsBgScanEnabled() - returning %u", + ( GetInterval() != KWlanBgScanIntervalNever ) ? 1 : 0 ); + + return ( GetInterval() != KWlanBgScanIntervalNever ); + } + +// --------------------------------------------------------------------------- +// From class MWlanBgScanProvider. +// CWlanBgScan::NotifyChangedSettings +// --------------------------------------------------------------------------- +// +void CWlanBgScan::NotifyChangedSettings( MWlanBgScanProvider::TWlanBgScanSettings& aSettings ) + { + DEBUG6( "CWlanBgScan::NotifyChangedSettings( interval: %u, psm srv mode: %u, peak start: %04u, peak end: %04u, peak: %u, off-peak: %u )", + aSettings.backgroundScanInterval, + aSettings.psmServerMode, + aSettings.bgScanPeakStartTime, + aSettings.bgScanPeakEndTime, + aSettings.bgScanIntervalPeak, + aSettings.bgScanIntervalOffPeak); + + MWlanBgScanProvider::TWlanBgScanSettings settingsToUse; + CheckSettings( settingsToUse, aSettings ); + + iBgScanPeakStartTime = settingsToUse.bgScanPeakStartTime; + iBgScanPeakEndTime = settingsToUse.bgScanPeakEndTime; + iBgScanIntervalPeak = settingsToUse.bgScanIntervalPeak; + iBgScanIntervalOffPeak = settingsToUse.bgScanIntervalOffPeak; + + IntervalChanged( settingsToUse.backgroundScanInterval ); + + if( IsAwsPresent() ) + { + CWlanBgScanAwsComms::TAwsMessage msg = { CWlanBgScanAwsComms::ESetPowerSaveMode, aSettings.psmServerMode }; + iAwsComms->SendOrQueueAwsCommand( msg ); + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::CheckSettings +// --------------------------------------------------------------------------- +// +void CWlanBgScan::CheckSettings( + MWlanBgScanProvider::TWlanBgScanSettings& aSettingsToUse, // [OUT] + const MWlanBgScanProvider::TWlanBgScanSettings& aProposedSettings ) const // [IN] + { + aSettingsToUse = aProposedSettings; + + if( aSettingsToUse.bgScanPeakStartTime > KWlanBgScanTwentyThreeFiftyNineOclock || + aSettingsToUse.bgScanPeakEndTime > KWlanBgScanTwentyThreeFiftyNineOclock ) + { + DEBUG2( "CWlanBgScan::CheckSettings() - peak start or end invalid, using default values (start %u, end %u)", + KWlanDefaultBgScanPeakPeriodStart, + KWlanDefaultBgScanPeakPeriodEnd ); + aSettingsToUse.bgScanPeakStartTime = KWlanDefaultBgScanPeakPeriodStart; + aSettingsToUse.bgScanPeakEndTime = KWlanDefaultBgScanPeakPeriodEnd; + } + if( aSettingsToUse.bgScanIntervalPeak > KWlanBgScanMaxInterval ) + { + DEBUG1( "CWlanBgScan::CheckSettings() - peak interval invalid, using default value %u", + KWlanDefaultBgScanIntervalPeakPeriod ); + aSettingsToUse.bgScanIntervalPeak = KWlanDefaultBgScanIntervalPeakPeriod; + } + if( aSettingsToUse.bgScanIntervalOffPeak > KWlanBgScanMaxInterval ) + { + DEBUG1( "CWlanBgScan::CheckSettings() - off-peak interval invalid, using default value %u", + KWlanDefaultBgScanIntervalOffPeakPeriod ); + aSettingsToUse.bgScanIntervalOffPeak = KWlanDefaultBgScanIntervalOffPeakPeriod; + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::GetInterval +// --------------------------------------------------------------------------- +// +TUint32 CWlanBgScan::GetInterval() + { + return iCurrentBgScanInterval; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::SetInterval +// --------------------------------------------------------------------------- +// +void CWlanBgScan::SetInterval( TUint32 aInterval ) + { + iCurrentBgScanInterval = aInterval; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::IsIntervalChangeNeeded +// --------------------------------------------------------------------------- +// +TBool CWlanBgScan::IsIntervalChangeNeeded() + { + TBool ret( ETrue ); + + // no need to change interval if both peak and off-peak intervals are the same + if( iBgScanPeakStartTime == iBgScanPeakEndTime ) + { + ret = EFalse; + } + + DEBUG1( "CWlanBgScan::IsIntervalChangeNeeded() - returning %d", ret ); + + return ret; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::ScheduleAutoIntervalChange +// --------------------------------------------------------------------------- +// +void CWlanBgScan::ScheduleAutoIntervalChange() + { + DEBUG( "CWlanBgScan::ScheduleAutoIntervalChange()" ); + + iTimerServices.StopTimer( iIntervalChangeRequestId ); + + if( IsIntervalChangeNeeded() ) + { + TTime intervalChangeAt = AutoIntervalChangeAt(); + + if( KErrNone != iTimerServices.StartTimer( iIntervalChangeRequestId, intervalChangeAt, *this ) ) + { + DEBUG( "CWlanBgScan::ScheduleAutoIntervalChange() - error: requesting timeout failed, peak <-> off-peak interval will not be changed" ); + } + } + else + { + DEBUG( "CWlanBgScan::ScheduleAutoIntervalChange() - peak <-> off-peak interval change not needed" ); + } + + DEBUG( "CWlanBgScan::ScheduleAutoIntervalChange() - returning" ); + + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::AutoIntervalChangeAt +// --------------------------------------------------------------------------- +// +TTime CWlanBgScan::AutoIntervalChangeAt() + { + TTime currentTime; + currentTime.HomeTime(); + TDateTime change_time( currentTime.DateTime() ); + + switch( TimeRelationToRange( currentTime, iBgScanPeakStartTime, iBgScanPeakEndTime ) ) + { + case ESmaller: + { + change_time.SetHour( iBgScanPeakStartTime / KGetHours ); + change_time.SetMinute( iBgScanPeakStartTime % KGetHours ); + change_time.SetSecond( KZeroSeconds ); + currentTime = change_time; + break; + } + case EInsideRange: + { + change_time.SetHour( iBgScanPeakEndTime / KGetHours ); + change_time.SetMinute( iBgScanPeakEndTime % KGetHours ); + change_time.SetSecond( KZeroSeconds ); + currentTime = change_time; + if( iBgScanPeakStartTime > iBgScanPeakEndTime ) + { + DEBUG( "CWlanBgScan::AutoIntervalChangeAt() - peak end happens tomorrow" ); + currentTime += TTimeIntervalDays( KAddOneDay ); + } + else + { + DEBUG( "CWlanBgScan::AutoIntervalChangeAt() - peak end happens today" ); + } + break; + } + case EGreater: + { + change_time.SetHour( iBgScanPeakStartTime / KGetHours ); + change_time.SetMinute( iBgScanPeakStartTime % KGetHours ); + change_time.SetSecond( KZeroSeconds ); + currentTime = change_time; + currentTime += TTimeIntervalDays( KAddOneDay ); + break; + } + } + +#ifdef _DEBUG + change_time = currentTime.DateTime(); + TBuf dbgString; + TRAP_IGNORE( currentTime.FormatL( dbgString, KWlanBgScanDateTimeFormat ) ); + DEBUG1( "CWlanBgScan::AutoIntervalChangeAt() - interval change to occur: %S", &dbgString ); +#endif + + return currentTime; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::TimeRelationToRange +// --------------------------------------------------------------------------- +// +CWlanBgScan::TRelation CWlanBgScan::TimeRelationToRange( const TTime& aTime, TUint aRangeStart, TUint aRangeEnd ) const + { +#ifdef _DEBUG + TBuf dbgString; + TRAP_IGNORE( aTime.FormatL( dbgString, KWlanBgScanDateTimeFormat ) ); + DEBUG1( "CWlanBgScan::TimeRelationToRange() - time: %S", &dbgString ); +#endif + + TTime time( aTime ); + + TDateTime start_time( aTime.DateTime() ); + start_time.SetHour( aRangeStart / KGetHours ); + start_time.SetMinute( aRangeStart % KGetHours ); + start_time.SetSecond( KZeroSeconds ); + + if( aRangeStart > aRangeEnd ) + { + DEBUG( "CWlanBgScan::TimeRelationToRange() - end time of range must to be tomorrow" ); + if( time.DayNoInMonth() == ( time.DaysInMonth() - 1 ) ) + { + DEBUG( "CWlanBgScan::TimeRelationToRange() - last day of the month, move to next month" ); + time += TTimeIntervalMonths( 1 ); + DEBUG( "CWlanBgScan::TimeRelationToRange() - move to first day of the month" ); + TDateTime new_time( time.DateTime() ); + new_time.SetDay( 0 ); + + time = TTime( new_time ); + } + else + { + DEBUG( "CWlanBgScan::TimeRelationToRange() - add one day to end time" ); + time += TTimeIntervalDays( KAddOneDay ); + } + } + + TDateTime end_time( time.DateTime() ); + end_time.SetHour( aRangeEnd / KGetHours ); + end_time.SetMinute( aRangeEnd % KGetHours ); + end_time.SetSecond( KZeroSeconds ); + +#ifdef _DEBUG + TBuf rngStart, rngEnd; + TRAP_IGNORE( TTime( start_time ).FormatL( rngStart, KWlanBgScanDateTimeFormat ) ); + TRAP_IGNORE( TTime( end_time ).FormatL( rngEnd, KWlanBgScanDateTimeFormat ) ); + DEBUG2( "CWlanBgScan::TimeRelationToRange() - range: %S - %S", &rngStart, &rngEnd ); +#endif + + CWlanBgScan::TRelation relation( ESmaller ); + if( aTime < TTime( start_time ) ) + { + DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: ESmaller" ); + relation = ESmaller; + } + else if( aTime >= TTime( start_time ) && aTime < TTime( end_time ) ) + { + DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" ); + relation = EInsideRange; + } + else + { + DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" ); + relation = EGreater; + } + + return relation; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::CurrentAutoInterval +// --------------------------------------------------------------------------- +// +TUint32 CWlanBgScan::CurrentAutoInterval() + { + TUint32 interval( 0 ); + TTime currentTime; + currentTime.HomeTime(); + + if( TimeRelationToRange( currentTime, iBgScanPeakStartTime, iBgScanPeakEndTime ) == CWlanBgScan::EInsideRange ) + { + interval = iBgScanIntervalPeak; + } + else + { + interval = iBgScanIntervalOffPeak; + } + + DEBUG1( "CWlanBgScan::CurrentAutoInterval() - current interval: %u", interval ); + + return interval; + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::NextState +// --------------------------------------------------------------------------- +// +void CWlanBgScan::NextState( TUint32 aNewBgScanSetting ) + { + DEBUG1( "CWlanBgScan::NextState() - aNewBgScanSetting %u", aNewBgScanSetting ); + + switch ( iBgScanState ) + { + case EBgScanOff: + { + InStateOff( iBgScanState, aNewBgScanSetting ); + break; + } + case EBgScanOn: + { + InStateOn( iBgScanState, aNewBgScanSetting ); + break; + } + case EBgScanAuto: + { + InStateAuto( iBgScanState, aNewBgScanSetting ); + break; + } + case EBgScanAutoAws: + { + InStateAutoAws( iBgScanState, aNewBgScanSetting ); + break; + } + default: + { + ASSERT( 0 ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::InStateOff +// --------------------------------------------------------------------------- +// +void CWlanBgScan::InStateOff( TWlanBgScanState& aState, TUint32 aNewBgScanSetting ) + { + switch( aNewBgScanSetting ) + { + case KWlanBgScanIntervalNever: + { + DEBUG( "CWlanBgScan::InStateOff() - no change in the interval" ); + aState = EBgScanOff; + break; + } + case KWlanBgScanIntervalAutomatic: + { + if ( IsAwsPresent() ) + { + DEBUG( "CWlanBgScan::InStateOff() - state change Off to AutoAws" ); + + aState = EBgScanAutoAws; + DEBUG( "CWlanBgScan::InStateOff() - calling SendOrQueueAwsCommand()" ); + CWlanBgScanAwsComms::TAwsMessage msg = { CWlanBgScanAwsComms::EStart, 0 }; + iAwsComms->SendOrQueueAwsCommand( msg ); + DEBUG( "CWlanBgScan::InStateOff() - SendOrQueueAwsCommand() returned" ); + } + else + { + DEBUG( "CWlanBgScan::InStateOff() - state change Off to Auto" ); + DEBUG( "CWlanBgScan::InStateOff() - * determine next interval change time and request callback" ); + ScheduleAutoIntervalChange(); + SetInterval( CurrentAutoInterval() ); + if( GetInterval() != KWlanBgScanIntervalNever ) + { + DEBUG( "CWlanBgScan::InStateOff() - * cause immediate background scan" ); + NotConnected(); + } + else + { + DEBUG( "CWlanBgScan::InStateOff() - Auto interval zero, background scanning is off" ); + } + aState = EBgScanAuto; + } + break; + } + default: + { + DEBUG1( "CWlanBgScan::InStateOff() - state change Off to On (interval: %u)", aNewBgScanSetting ); + SetInterval( aNewBgScanSetting ); + // cause immediate background scan + NotConnected(); + aState = EBgScanOn; + } + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::InStateOn +// --------------------------------------------------------------------------- +// +void CWlanBgScan::InStateOn( TWlanBgScanState& aState, TUint32 aNewBgScanSetting ) + { + switch( aNewBgScanSetting ) + { + case KWlanBgScanIntervalNever: + { + DEBUG( "CWlanBgScan::InStateOn() - state change On to Off" ); + SetInterval( KWlanBgScanIntervalNever ); + iProvider.CancelScan(); + aState = EBgScanOff; + break; + } + case KWlanBgScanIntervalAutomatic: + { + DEBUG( "CWlanBgScan::InStateOn() - state change On to Auto" ); + SetInterval( KWlanBgScanIntervalNever ); + iProvider.CancelScan(); + if ( IsAwsPresent() ) + { + aState = EBgScanAutoAws; + DEBUG( "CWlanBgScan::InStateOn() - calling SendOrQueueAwsCommand()" ); + CWlanBgScanAwsComms::TAwsMessage msg = { CWlanBgScanAwsComms::EStart, 0 }; + iAwsComms->SendOrQueueAwsCommand( msg ); + DEBUG( "CWlanBgScan::InStateOn() - SendOrQueueAwsCommand() returned" ); + } + else + { + DEBUG( "CWlanBgScan::InStateOn() - * determine next interval change time and request callback" ); + ScheduleAutoIntervalChange(); + SetInterval( CurrentAutoInterval() ); + if( GetInterval() != KWlanBgScanIntervalNever ) + { + DEBUG( "CWlanBgScan::InStateOn() - * cause immediate background scan" ); + NotConnected(); + } + else + { + DEBUG( "CWlanBgScan::InStateOn() - Auto interval zero, background scanning is off" ); + } + aState = EBgScanAuto; + } + break; + } + default: + { + DEBUG( "CWlanBgScan::InStateOn() - state change On to On" ); + if ( GetInterval() == aNewBgScanSetting ) + { + DEBUG( "CWlanBgScan::InStateOn() - no change in the interval" ); + } + else if ( GetInterval() > aNewBgScanSetting ) + { + DEBUG( "CWlanBgScan::InStateOn() - current interval greater than the new interval" ); + DEBUG( "CWlanBgScan::InStateOn() - * cancel scan and cause immediate background scan" ); + iProvider.CancelScan(); + SetInterval( aNewBgScanSetting ); + NotConnected(); + } + else + { + DEBUG( "CWlanBgScan::InStateOn() - current interval smaller than the new interval" ); + DEBUG( "CWlanBgScan::InStateOn() - * cancel scan and issue new with interval as expiry" ); + iProvider.CancelScan(); + SetInterval( aNewBgScanSetting ); + ScanComplete(); + } + aState = EBgScanOn; + } + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::InStateAuto +// --------------------------------------------------------------------------- +// +void CWlanBgScan::InStateAuto( TWlanBgScanState& aState, TUint32 aNewBgScanSetting ) + { + switch( aNewBgScanSetting ) + { + case KWlanBgScanIntervalNever: + { + DEBUG( "CWlanBgScan::InStateAuto() - state change Auto to Off" ); + SetInterval( KWlanBgScanIntervalNever ); + iTimerServices.StopTimer( iIntervalChangeRequestId ); + iIntervalChangeRequestId = 0; + iProvider.CancelScan(); + aState = EBgScanOff; + break; + } + case KWlanBgScanIntervalAutomatic: + { + DEBUG( "CWlanBgScan::InStateAuto() - state still Auto" ); + + ScheduleAutoIntervalChange(); + + TUint32 currentInterval = GetInterval(); + + TUint32 autoInterval = CurrentAutoInterval(); + + if ( autoInterval == KWlanBgScanIntervalNever ) + { + DEBUG( "CWlanBgScan::InStateAuto() - Auto interval zero, background scanning is off" ); + DEBUG( "CWlanBgScan::InStateAuto() - * cancel scan" ); + iProvider.CancelScan(); + SetInterval( autoInterval ); + } + else if ( currentInterval == autoInterval ) + { + DEBUG( "CWlanBgScan::InStateAuto() - no change in the Auto interval" ); + } + else if ( currentInterval > autoInterval ) + { + DEBUG( "CWlanBgScan::InStateAuto() - current Auto interval greater than the new Auto interval" ); + DEBUG( "CWlanBgScan::InStateAuto() - * cancel scan and issue new with immediate expiry" ); + iProvider.CancelScan(); + SetInterval( autoInterval ); + NotConnected(); + } + else + { + DEBUG( "CWlanBgScan::InStateAuto() - current Auto interval smaller than the new Auto interval" ); + DEBUG( "CWlanBgScan::InStateAuto() - * cancel scan and issue new with interval expiry" ); + iProvider.CancelScan(); + SetInterval( autoInterval ); + ScanComplete(); + } + + aState = EBgScanAuto; + break; + } + default: + { + DEBUG( "CWlanBgScan::InStateAuto() - state change Auto to On" ); + SetInterval( aNewBgScanSetting ); + iTimerServices.StopTimer( iIntervalChangeRequestId ); + iIntervalChangeRequestId = 0; + // need to issue new scan request as it is possible that currently there is + // no scan requested + iProvider.CancelScan(); + NotConnected(); + aState = EBgScanOn; + } + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::InStateAutoAws +// --------------------------------------------------------------------------- +// +void CWlanBgScan::InStateAutoAws( TWlanBgScanState& aState, TUint32 aNewBgScanSetting ) + { + switch( aNewBgScanSetting ) + { + case KWlanBgScanIntervalNever: + { + DEBUG( "CWlanBgScan::InStateAutoAws() - state change Auto to Off" ); + SetInterval( KWlanBgScanIntervalNever ); + aState = EBgScanOff; + DEBUG( "CWlanBgScan::InStateAutoAws() - calling SendOrQueueAwsCommand()" ); + CWlanBgScanAwsComms::TAwsMessage msg = { CWlanBgScanAwsComms::EStop, 0 }; + iAwsComms->SendOrQueueAwsCommand( msg ); + DEBUG( "CWlanBgScan::InStateAutoAws() - SendOrQueueAwsCommand() returned" ); + iProvider.CancelScan(); + break; + } + case KWlanBgScanIntervalAutomatic: + { + DEBUG( "CWlanBgScan::InStateAutoAws() - no change in the interval" ); + aState = EBgScanAutoAws; + break; + } + default: + { + DEBUG( "CWlanBgScan::InStateAutoAws() - state change Auto to On" ); + SetInterval( aNewBgScanSetting ); + aState = EBgScanOn; + // need to issue new scan request as it is possible that currently there is + // no scan requested + DEBUG( "CWlanBgScan::InStateAutoAws() - calling SendAwsCommand()" ); + CWlanBgScanAwsComms::TAwsMessage msg = { CWlanBgScanAwsComms::EStop, 0 }; + iAwsComms->SendOrQueueAwsCommand( msg ); + DEBUG( "CWlanBgScan::InStateAutoAws() - SendAwsCommand() returned" ); + iProvider.CancelScan(); + NotConnected(); + } + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::Timeout +// --------------------------------------------------------------------------- +// +void CWlanBgScan::OnTimeout() + { + DEBUG( "CWlanBgScan::OnTimeout()" ); + + // by design, OnTimeout should only happen + // in Auto state + ASSERT( iBgScanState == EBgScanAuto ); + + NextState( KWlanBgScanIntervalAutomatic ); + + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::DoSetInterval +// --------------------------------------------------------------------------- +// +void CWlanBgScan::DoSetInterval( TUint32 aNewInterval ) + { + DEBUG1( "CWlanBgScan::DoSetInterval( aNewInterval: %u )", aNewInterval ); + + if( iBgScanState != EBgScanAutoAws ) + { + DEBUG( "CWlanBgScan::DoSetInterval() - state not AutoAws, ignoring request" ); + return; + } + + TUint32 currentInterval( GetInterval() ); + + if ( ( currentInterval == 0 ) && ( aNewInterval != 0 ) ) + { + DEBUG( "CWlanBgScan::DoSetInterval() - current interval is zero and new interval is non-zero" ); + DEBUG( "CWlanBgScan::DoSetInterval() - cancel scan and issue new with immediate expiry" ); + iProvider.CancelScan(); + SetInterval( aNewInterval ); + NotConnected(); + } + else if ( currentInterval == aNewInterval ) + { + DEBUG( "CWlanBgScan::DoSetInterval() - no change in the interval" ); + } + else if ( currentInterval > aNewInterval ) + { + // if current interval greater than new interval -> cancel scan and + // issue new with immediate expiry + DEBUG( "CWlanBgScan::DoSetInterval() - current interval greater than the new interval" ); + DEBUG( "CWlanBgScan::DoSetInterval() - cancel scan and issue new with immediate expiry" ); + iProvider.CancelScan(); + SetInterval( aNewInterval ); + NotConnected(); + } + else + { + DEBUG( "CWlanBgScan::DoSetInterval() - current interval smaller than the new interval" ); + DEBUG( "CWlanBgScan::DoSetInterval() - take new interval into use after currently pending scan is completed" ); + SetInterval( aNewInterval ); + } + + } + +// --------------------------------------------------------------------------- +// CWlanBgScan::IsAwsPresent +// -------------------------------------------------------------------------- +// +TBool CWlanBgScan::IsAwsPresent() + { + TBool ret( ETrue ); + + if( iAwsComms == NULL || !iAwsComms->IsAwsPresent() ) + { + ret = EFalse; + } + + DEBUG1( "CWlanBgScan::IsAwsPresent() - returning %i", ret ); + + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscanawscomms.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscanawscomms.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,433 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements BgScan AWS communication. +* +*/ + +/* +* %version: 2 % +*/ + +#include +#include + +#include "awsinterface.h" +#include "awsenginebase.h" +#include "wlanbgscancommandlistener.h" +#include "wlanbgscancommand.h" +#include "wlanbgscanawscomms.h" +#include "wlanbgscan.h" +#include "am_debug.h" + +/** + * Maximum heap size for AWS thread. + */ +const TInt KMaxHeapSize = 0x10000; + +/** + * BgScan version communicated to AWS. + */ +const TUint KBgScanVersion = 1; + +/** + * Index of the first item in an array. + */ +const TInt KFirstItemIndex = 0; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::CWlanBgScanAwsComms +// --------------------------------------------------------------------------- +// +CWlanBgScanAwsComms::CWlanBgScanAwsComms( CWlanBgScan& aBgScan ) : + CActive( CActive::EPriorityStandard ), + iBgScan( aBgScan ), + iAws( NULL ), + iAwsImplInfo( NULL ), + iCommandHandler( NULL ), + iAwsVersion( 0 ), + iPendingCommand( EAwsCommandMax ), + iAwsOk( EFalse ) + { + DEBUG( "CWlanBgScanAwsComms::CWlanBgScanAwsComms()" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::ConstructL +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::ConstructL() + { + DEBUG( "CWlanBgScanAwsComms::ConstructL()" ); + + // create handler for incoming messages from AWS + iCommandHandler = CWlanBgScanCommand::NewL( *this ); + + CActiveScheduler::Add( this ); + + // leaves if no AWS present in system + StartAwsThreadL(); + + DEBUG( "CWlanBgScanAwsComms::ConstructL() - done" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::NewL +// --------------------------------------------------------------------------- +// +CWlanBgScanAwsComms* CWlanBgScanAwsComms::NewL( CWlanBgScan& aBgScan ) + { + DEBUG( "CWlanBgScanAwsComms::NewL()" ); + CWlanBgScanAwsComms* self = new ( ELeave ) CWlanBgScanAwsComms( aBgScan ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::~CWlanBgScanAwsComms() +// --------------------------------------------------------------------------- +// +CWlanBgScanAwsComms::~CWlanBgScanAwsComms() + { + DEBUG( "CWlanBgScanAwsComms::~CWlanBgScanAwsComms()" ); + + delete iAws; + iAws = NULL; + + delete iAwsImplInfo; + iAwsImplInfo = NULL; + + delete iCommandHandler; + iCommandHandler = NULL; + + iAwsMsgQueue.Close(); + Cancel(); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::CleanupEComArray +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::CleanupEComArray(TAny* aArray) + { + DEBUG( "CWlanBgScanAwsComms::CleanupEComArray()" ); + + ASSERT( aArray ); + + RImplInfoPtrArray *implInfoArray = static_cast ( aArray ); + implInfoArray->ResetAndDestroy(); + implInfoArray->Close(); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::StartAwsThreadL +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::StartAwsThreadL() + { + DEBUG( "CWlanBgScanAwsComms::StartAwsThreadL()" ); + + RImplInfoPtrArray awsImplArray; + TCleanupItem awsImplArrayCleanup( CleanupEComArray, &awsImplArray ); + CleanupStack::PushL( awsImplArrayCleanup ); + + CAwsEngineBase::ListImplementationsL( awsImplArray ); + + if( awsImplArray.Count() == 0 ) + { + DEBUG( "CWlanBgScanAwsComms::StartAwsThreadL() - no AWS implementation found" ); + User::Leave( KErrNotFound ); + } + + // first found AWS implementation will be taken into use + iAwsImplInfo = static_cast( awsImplArray[KFirstItemIndex] ); + awsImplArray.Remove( KFirstItemIndex ); + + CleanupStack::PopAndDestroy( &awsImplArray ); //this causes a call to CleanupEComArray + + DEBUG( "CWlanBgScanAwsComms::StartAwsThreadL() - creating AWS thread" ); + RThread thread; + TInt err = thread.Create( iAwsImplInfo->DisplayName(), + AwsThreadEntryPoint, + KDefaultStackSize, + KMinHeapSize, + KMaxHeapSize, + reinterpret_cast( this ) ); + if( err != KErrNone) + { + DEBUG1( "CWlanBgScanAwsComms::StartAwsThreadL() - error: thread creation failed with error %i", err ); + delete iAwsImplInfo; + iAwsImplInfo = NULL; + User::Leave( err ); + } + + DEBUG( "CWlanBgScanAwsComms::StartAwsThreadL() - Resuming AWS thread" ); + thread.Resume(); + thread.Close(); + + DEBUG( "CWlanBgScanAwsComms::StartAwsThreadL() - done" ); + } + +// ----------------------------------------------------------------------------- +// CWlanBgScanAwsComms::AwsThreadEntryPoint +// +// This method is executing in the context of the AWS thread. +// ----------------------------------------------------------------------------- +// +TInt CWlanBgScanAwsComms::AwsThreadEntryPoint( TAny* aThisPtr ) + { + DEBUG("CWlanBgScanAwsComms::AwsThreadEntryPoint()"); + + CWlanBgScanAwsComms* self = static_cast( aThisPtr ); + + // create cleanup stack + CTrapCleanup* cleanup = CTrapCleanup::New(); + if ( cleanup == NULL ) + { + DEBUG("CWlanBgScanAwsComms::AwsThreadEntryPoint() - error: Cleanup stack creation failed"); + User::Exit( KErrNoMemory ); + } + + __UHEAP_MARK; + + TRAPD( err, self->InstantiateAwsPluginL() ); + if ( err != KErrNone ) + { + DEBUG1("CWlanBgScanAwsComms::AwsThreadEntryPoint() - AWS instantiation leaved with code %i", err); + } + + __UHEAP_MARKEND; + + delete cleanup; + cleanup = NULL; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlanBgScanAwsComms::InstantiateAwsPluginL +// +// This method is executing in the context of the AWS thread. +// ----------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::InstantiateAwsPluginL() + { + DEBUG("CWlanBgScanAwsComms::InstantiateAwsPluginL()"); + + ASSERT( iAwsImplInfo ); + + CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); + CleanupStack::PushL( scheduler ); + CActiveScheduler::Install( scheduler ); + + DEBUG( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - trying to instantiate AWS implementation:" ); + DEBUG1( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - ImplementationUid: 0x%08X", iAwsImplInfo->ImplementationUid().iUid ); +#ifdef _DEBUG + TBuf8 buf8; + buf8.Copy( iAwsImplInfo->DisplayName() ); +#endif + DEBUG1S("CWlanBgScanAwsComms::InstantiateAwsPluginL() - DisplayName: ", buf8.Length(), buf8.Ptr() ); + DEBUG1( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - Version: %i", iAwsImplInfo->Version() ); + DEBUG1S("CWlanBgScanAwsComms::InstantiateAwsPluginL() - DataType: ", iAwsImplInfo->DataType().Length(), iAwsImplInfo->DataType().Ptr() ); + DEBUG1S("CWlanBgScanAwsComms::InstantiateAwsPluginL() - OpaqueData: ", iAwsImplInfo->OpaqueData().Length(), iAwsImplInfo->OpaqueData().Ptr() ); + DEBUG1( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - RomOnly: %i", iAwsImplInfo->RomOnly() ); + DEBUG1( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - RomBased: %i", iAwsImplInfo->RomBased() ); + DEBUG1( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - VendorId: 0x%08X", iAwsImplInfo->VendorId().iId ); + + CAwsEngineBase::TAwsEngineConstructionParameters params = { this, KBgScanVersion, iAwsVersion }; + iAws = CAwsEngineBase::NewL( iAwsImplInfo->ImplementationUid().iUid, ¶ms ); + + DEBUG1( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - AWS instantiated OK, iAwsVersion %u", iAwsVersion ); + iAwsOk = ETrue; + + __e32_memory_barrier(); + DEBUG( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - data members synchronized" ); + + DEBUG( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - starting active scheduler - AWS is now in control of this thread" ); + CActiveScheduler::Start(); + + // Thread execution will stay in CActiveScheduler::Start() until active scheduler is stopped + DEBUG("CWlanBgScanAwsComms::InstantiateAwsPluginL() - active scheduler stopped" ); + + // clean up + delete iAws; + iAws = NULL; + CleanupStack::PopAndDestroy( scheduler ); + + DEBUG( "CWlanBgScanAwsComms::InstantiateAwsPluginL() - exiting..." ); + User::Exit( KErrNone ); + } + +// --------------------------------------------------------------------------- +// From class MAwsBgScanProvider. +// CWlanBgScanAwsComms::SetInterval +// +// This method is executing in the context of the AWS thread. +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::SetInterval( TUint32 aNewInterval, TRequestStatus& aStatus ) + { + DEBUG1( "CWlanBgScanAwsComms::SetInterval() - new interval %u", aNewInterval ); + + iCommandHandler->CommandQueue( CWlanBgScanCommand::ESetInterval, aNewInterval, aStatus ); + + DEBUG( "CWlanBgScanAwsComms::SetInterval() - returning" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::SendOrQueueAwsCommand +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::SendOrQueueAwsCommand( TAwsMessage& aMessage ) + { + DEBUG1( "CWlanBgScanAwsComms::SendOrQueueAwsCommand( command %u )", aMessage.iCmd ); + + // if a request is pending, queue the new command + if( iStatus.Int() == KRequestPending ) + { + DEBUG( "CWlanBgScanAwsComms::SendOrQueueAwsCommand() - request pending -> queue new command" ); + + // store command to queue + TInt err = iAwsMsgQueue.Append( aMessage ); + if( KErrNone == err ) + { + DEBUG( "CWlanBgScanAwsComms::SendOrQueueAwsCommand() - command queued successfully" ); + } + else + { + DEBUG( "CWlanBgScanAwsComms::SendOrQueueAwsCommand() - command queueing failed" ); + } + return; + } + + SendAwsCommand( aMessage ); + + DEBUG( "CWlanBgScanAwsComms::SendOrQueueAwsCommand() - done" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::SendAwsCommand +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::SendAwsCommand( TAwsMessage& aMessage ) + { + DEBUG1( "CWlanBgScanAwsComms::SendAwsCommand( command %u )", aMessage.iCmd ); + + if( !iAws ) + { + DEBUG( "CWlanBgScanAwsComms::SendAwsCommand() - error: no AWS present!" ); + ASSERT( 0 ); + return; + } + + DEBUG( "CWlanBgScanAwsComms::SendAwsCommand() - sending command" ); + + switch( aMessage.iCmd ) + { + case EStart: + { + iPendingCommand = EStart; + iAws->Start( iStatus ); + SetActive(); + DEBUG( "CWlanBgScanAwsComms::SendAwsCommand() - EStart command sent" ); + break; + } + case EStop: + { + iPendingCommand = EStop; + iAws->Stop( iStatus ); + SetActive(); + DEBUG( "CWlanBgScanAwsComms::SendAwsCommand() - EStop command sent" ); + break; + } + case ESetPowerSaveMode: + { + iPendingCommand = ESetPowerSaveMode; + iAws->SetPowerSaveMode( static_cast( aMessage.iParameter ), iStatus ); + SetActive(); + DEBUG( "CWlanBgScanAwsComms::SendAwsCommand() - ESetPowerSaveMode command sent" ); + break; + } + default: + { + iPendingCommand = EAwsCommandMax; + DEBUG1( "CWlanBgScanAwsComms::SendAwsCommand() - unknown command %u", aMessage.iCmd ); + ASSERT( 0 ); + } + } + DEBUG( "CWlanBgScanAwsComms::SendAwsCommand() - done" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::RunL +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::RunL() + { + DEBUG2( "CWlanBgScanAwsComms::RunL() - command: %u, completion status: %d", iPendingCommand, iStatus.Int() ); + + TAwsMessage cmd = { EAwsCommandMax, NULL }; + + // if there are more commands, send the next one + if( iAwsMsgQueue.Count() ) + { + cmd = static_cast ( iAwsMsgQueue[KFirstItemIndex] ); + iAwsMsgQueue.Remove( KFirstItemIndex ); + + SendAwsCommand( cmd ); + } + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::DoCancel +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::DoCancel() + { + DEBUG( "CWlanBgScanAwsComms::DoCancel()" ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::RunError +// --------------------------------------------------------------------------- +// +TInt CWlanBgScanAwsComms::RunError( TInt aError ) + { + DEBUG1( "CWlanBgScanAwsComms::RunError( %d )", aError ); + return aError; + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::DoSetInterval +// --------------------------------------------------------------------------- +// +void CWlanBgScanAwsComms::DoSetInterval( TUint32 aNewInterval ) + { + DEBUG1( "CWlanBgScanAwsComms::DoSetInterval( aNewInterval: %u )", aNewInterval ); + + iBgScan.DoSetInterval( aNewInterval ); + } + +// --------------------------------------------------------------------------- +// CWlanBgScanAwsComms::IsAwsPresent +// --------------------------------------------------------------------------- +// +TBool CWlanBgScanAwsComms::IsAwsPresent() + { + DEBUG1( "CWlanBgScanAwsComms::IsAwsPresent() - returning %d", iAwsOk ); + + return iAwsOk; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscancommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscancommand.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,303 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements command queue for BgScan. +* +*/ + +/* +* %version: 4 % +*/ + +#include +#include "wlanbgscancommand.h" +#include "wlanbgscancommandlistener.h" +#include "am_debug.h" + +// Number of message slots in BgScan message queue, which is used for +// passing commands from AWS to BgScan +const TInt KNumberOfSlots( 5 ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ constructor. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +CWlanBgScanCommand::CWlanBgScanCommand( MWlanBgScanCommandListener& aListener ) : + CActive( CActive::EPriorityStandard ), + iListener( aListener ) + { + DEBUG( "CWlanBgScanCommand::CWlanBgScanCommand()" ); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +void CWlanBgScanCommand::ConstructL() + { + DEBUG( "CWlanBgScanCommand::ConstructL()" ); + CActiveScheduler::Add( this ); + + // create message queue for passing messages from AWS to BgScan + TInt err = iMsgQueue.CreateLocal( KNumberOfSlots ); + + if( err != KErrNone ) + { + DEBUG1( "CWlanBgScanCommand::ConstructL() - message queue creation failed, err: %d", + err ); + User::Leave( err ); + } + + // subscribe notification about when new messages land on the queue + iMsgQueue.NotifyDataAvailable( iStatus ); + + SetActive(); + + DEBUG( "CWlanBgScanCommand::ConstructL() - returning" ); + } + +// --------------------------------------------------------------------------- +// Static constructor. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +CWlanBgScanCommand* CWlanBgScanCommand::NewL( + MWlanBgScanCommandListener& aListener ) + { + DEBUG( "CWlanBgScanCommand::NewL()" ); + CWlanBgScanCommand* self = new ( ELeave ) CWlanBgScanCommand( aListener ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +CWlanBgScanCommand::~CWlanBgScanCommand() + { + DEBUG( "CWlanBgScanCommand::~CWlanBgScanCommand()" ); + Cancel(); + } + +// --------------------------------------------------------------------------- +// Do Cancel. +// Cancels any pending command and completes client's request on that part. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +void CWlanBgScanCommand::DoCancel() + { + DEBUG( "CWlanBgScanCommand::DoCancel()" ); + + TWlanBgScanMsg msg; + + // Retrieve messages from message queue as long as there are any + // and cancel them + while( iMsgQueue.Receive( msg ) == KErrNone ) + { + // Complete client's request with KErrCancel + msg.iClientThread.RequestComplete( msg.iReportStatusPtr, KErrCancel ); + + // Destroy the handle to the client thread + msg.iClientThread.Close(); + } + + DEBUG( "CWlanBgScanCommand::DoCancel() - cancelling data available notification" ); + iMsgQueue.CancelDataAvailable(); + DEBUG( "CWlanBgScanCommand::DoCancel() - done" ); + } + +// --------------------------------------------------------------------------- +// Command Queue. +// This method completes BgScan command AO thereby signalling WLAN Engine +// thread that it is eligible for runnning i.e. the command itself is processed +// in WLAN Engine thread context. +// +// Runs in: AWS thread context. +// --------------------------------------------------------------------------- +// +void CWlanBgScanCommand::CommandQueue( + TWlanBgScanCommand aCommand, // IN: Command to be processed + TUint32 aParameter, // IN: Command parameter + TRequestStatus& aReportStatus ) // IN: Client's request status that needs + // to be completed when the command + // has been processed. + { + DEBUG( "CWlanBgScanCommand::CommandQueue()" ); + + TRequestStatus* statusPtr = &aReportStatus; + TWlanBgScanMsg msg; + + // Set client's (BgScan) request status to request pending + *statusPtr = KRequestPending; + + // NOTE! About which class has to be used when completing + // the request statuses of both WLAN thread and AWS thread. + // RThread class is always used for completing statuses in other + // threads and User class for completing statuses in running thread. + // Using incorrect class's RequestComplete method changes the status + // of the active object BUT it does not increment the thread's + // semaphore and hence the thread does not go to "ready to + // be run" state. Consequently, the active object would be + // run only when some other trigger causes the thread's + // semaphore to be incremented and hence making thread + // eligible to be run. + + // Get handle to client thread (AWS thread) so that + // the handle can be later used for completing the client's + // request status + TThreadId id = RThread().Id(); + TInt err = msg.iClientThread.Open( id ); + if( err != KErrNone ) + { + DEBUG( "CWlanBgScanCommand::CommandQueue() - Opening client thread handle failed" ); + // Complete request with error code + // Note! User class is used for completing the status here + // as we are completing the active object in the same thread + // (WLAN Engine thread) that is running this method. + User::RequestComplete( statusPtr, KErrBadHandle ); + return; + } + + // Store command so that it will be processed when RunL is called. + msg.iCommand = aCommand; + // Store parameter so that it will be processed when RunL is called. + msg.iParameter = aParameter; + // Store handle to report status which is completed when command + // has been processed (i.e. RunL called) + msg.iReportStatusPtr = statusPtr; + + // Put message to message queue, so that the command + // itself will be processed in WLAN Engine thread context + err = iMsgQueue.Send( msg ); + if( err != KErrNone ) // Sending failed + { + // Complete request with error code + DEBUG( "CWlanBgScanCommand::CommandQueue() - command sending failed due to BgScan message queue full" ); + msg.iClientThread.Close(); + User::RequestComplete( statusPtr, KErrServerBusy ); + } + + DEBUG( "CWlanBgScanCommand::CommandQueue() - command sent to BgScan message queue" ); + + } + +// --------------------------------------------------------------------------- +// RunL. +// Executes the command that was requested with CommandQueue method. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +void CWlanBgScanCommand::RunL() + { + DEBUG( "CWlanBgScanCommand::RunL()" ); + ProcessCommands(); + } + +// --------------------------------------------------------------------------- +// Process Commands. +// Reads commands (sent by AWS) from BgScan message queue and +// processes them. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +void CWlanBgScanCommand::ProcessCommands() + { + DEBUG( "CWlanBgScanCommand::ProcessCommands()" ); + + TWlanBgScanMsg msg; + + // retrieve a message from queue and process it + TInt rx_err = iMsgQueue.Receive( msg ); + + switch( rx_err ) + { + case KErrNone: + { + TInt err( KErrNone ); + + switch( msg.iCommand ) + { + case ESetInterval: + DEBUG( "CWlanBgScanCommand::ProcessCommands() - calling DoSetInterval" ); + iListener.DoSetInterval( msg.iParameter ); + DEBUG( "CWlanBgScanCommand::ProcessCommands() - DoSetInterval returned" ); + break; + default: // Unknown command + DEBUG1( "CWlanBgScanCommand::ProcessCommands() - unknown command (%d)", msg.iCommand ); + err = KErrNotSupported; + break; + } + + // complete client's request + msg.iClientThread.RequestComplete( msg.iReportStatusPtr, err ); + + // destroy the handle to the client thread + msg.iClientThread.Close(); + + break; + } + case KErrUnderflow: + { + DEBUG( "CWlanBgScanCommand::ProcessCommands() - signalled for pending message but queue was empty"); + iMsgQueue.CancelDataAvailable(); + DEBUG( "CWlanBgScanCommand::ProcessCommands() - DataAvailable notification cancelled"); + break; + } + default: + { + DEBUG1( "CWlanBgScanCommand::ProcessCommands() - unrecognised error code %d", rx_err ); + iMsgQueue.CancelDataAvailable(); + DEBUG( "CWlanBgScanCommand::ProcessCommands() - DataAvailable notification cancelled"); + ASSERT( 0 ); + break; + } + } + + // Subscribe notification about when new messages land on the queue + iMsgQueue.NotifyDataAvailable( iStatus ); + + SetActive(); + DEBUG( "CWlanBgScanCommand::ProcessCommands() - done"); + } + +// --------------------------------------------------------------------------- +// Error in RunL. +// +// Runs in: WLAN Engine thread context. +// --------------------------------------------------------------------------- +// +TInt CWlanBgScanCommand::RunError( TInt aError ) + { + if( KErrNone != aError ) + { + DEBUG1( "CWlanBgScanCommand::RunError() - RunError %d", aError ); + } + + return KErrNone; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlancbwaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlancbwaiter.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements an active object with callback functionality. +* +*/ + + +#include "wlancbwaiter.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanCbWaiter::CWlanCbWaiter( + const TCallBack& aCallback ) : + CActive( CActive::EPriorityStandard ), + iCallback( aCallback ) + { + DEBUG( "CWlanCbWaiter::CWlanCbWaiter()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanCbWaiter::ConstructL() + { + DEBUG( "CWlanCbWaiter::ConstructL()" ); + CActiveScheduler::Add( this ); + DEBUG( "CWlanCbWaiter::ConstructL() - done" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanCbWaiter* CWlanCbWaiter::NewL( + const TCallBack& aCallback ) + { + DEBUG( "CWlanCbWaiter::NewL()" ); + CWlanCbWaiter* self = new (ELeave) CWlanCbWaiter( aCallback ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanCbWaiter::~CWlanCbWaiter() + { + DEBUG( "CWlanCbWaiter::~CWlanCbWaiter()" ); + Cancel(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanCbWaiter::IssueRequest() + { + DEBUG( "CWlanCbWaiter::IssueRequest()" ); + SetActive(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TRequestStatus& CWlanCbWaiter::RequestStatus() + { + DEBUG1( "CWlanCbWaiter::RequestStatus() - iStatus = %d", iStatus.Int() ); + return iStatus; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanCbWaiter::RunL() + { + DEBUG1( "CWlanCbWaiter::RunL() - iStatus = %d", iStatus.Int() ); + + iCallback.CallBack(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanCbWaiter::RunError( + TInt /* aError */ ) + { + DEBUG( "CWlanCbWaiter::RunError()" ); + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanCbWaiter::DoCancel() + { + DEBUG( "CWlanCbWaiter::DoCancel()" ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlancontrolimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlancontrolimpl.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The class implementing MWlanControlInterface. +* +*/ + + +#include +#include +#include "gendebug.h" +#include "wlancontrolimpl.h" + +/** + * Pairs ECom implementation UIDs with a pointer to the instantiation + * method for that implementation. Required for all ECom implementation + * collections. + */ +//lint --e{611} +const TImplementationProxy ImplementationTable[] = + { + {{0x10282e0f}, reinterpret_cast(CWlanControlImpl::NewL)} + }; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanControlImpl* CWlanControlImpl::NewL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::NewL()" ) ) ); + + CWlanControlImpl* self = new (ELeave) CWlanControlImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanControlImpl::~CWlanControlImpl() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::~CWlanControlImpl()" ) ) ); + + iServer.Close(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetPacketStatistics( + TWlanPacketStatistics& aStatistics ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetPacketStatistics()" ) ) ); + + return iServer.GetPacketStatistics( aStatistics ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanControlImpl::ClearPacketStatistics() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::ClearPacketStatistics()" ) ) ); + + iServer.ClearPacketStatistics(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetUapsdSettings( + TWlanUapsdSettings& aSettings ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetUapsdSettings()" ) ) ); + + return iServer.GetUapsdSettings( aSettings ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::SetUapsdSettings( + const TWlanUapsdSettings& aSettings ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::SetUapsdSettings()" ) ) ); + + return iServer.SetUapsdSettings( aSettings ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetPowerSaveSettings( + TWlanPowerSaveSettings& aSettings ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetPowerSaveSettings()" ) ) ); + + return iServer.GetPowerSaveSettings( aSettings ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::SetPowerSaveSettings( + const TWlanPowerSaveSettings& aSettings ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::SetPowerSaveSettings()" ) ) ); + + return iServer.SetPowerSaveSettings( aSettings ); + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetAccessPointInfo( + TWlanAccessPointInfo& aInfo ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetAccessPointInfo()" ) ) ); + + return iServer.GetAccessPointInfo( aInfo ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetRoamMetrics( + TWlanRoamMetrics& aRoamMetrics ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetRoamMetrics()" ) ) ); + + return iServer.GetRoamMetrics( aRoamMetrics ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetRogueList( + CArrayFixSeg& aRogueList ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetRogueList()" ) ) ); + + return iServer.GetRogueList( aRogueList ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetRegulatoryDomain( + TWlanRegion& aRegion ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetRegulatoryDomain()" ) ) ); + + return iServer.GetRegulatoryDomain( aRegion ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::GetPowerSaveMode( + TWlanPowerSave& aPowerSaveMode ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::GetPowerSaveMode()" ) ) ); + + return iServer.GetPowerSaveMode( aPowerSaveMode ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanControlImpl::SetPowerSaveMode( + TWlanPowerSaveMode aMode ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::SetPowerSaveMode()" ) ) ); + + return iServer.SetPowerSaveMode( aMode ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanControlImpl::CWlanControlImpl() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::CWlanControlImpl()" ) ) ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanControlImpl::ConstructL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanControlImpl::ConstructL()" ) ) ); + + User::LeaveIfError( iServer.Connect() ); + } + +// ======== GLOBAL FUNCTIONS ======== + +// --------------------------------------------------------- +// Returns an instance of the proxy table. +// Returns: KErrNone +// --------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable) / sizeof( TImplementationProxy ); + return ImplementationTable; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanconversionutil.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2027 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles type conversion between adaptation and core layers +* +*/ + +/* +* %version: 82 % +*/ + +#include +#include + +#include "wlanconversionutil.h" +#include "wlmserver.h" +#include "wlmtsparams.h" +#include "am_debug.h" + +/** + * Mappings from user priority to access class. + */ +const TWlmAccessClass KWlmUserPriorityToAccessClass[] = + { + EWlmAccessClassBestEffort, + EWlmAccessClassBackground, + EWlmAccessClassBackground, + EWlmAccessClassBestEffort, + EWlmAccessClassVideo, + EWlmAccessClassVideo, + EWlmAccessClassVoice, + EWlmAccessClassVoice + }; + +// Compile time assert. Used to make sure that some core constants are matching with Symbian constants. +#define COMPILE_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] //lint --e{58,92,751,761,30,452,545} +// 58 = Error -- Bad type +// 92 = Negative array dimension or bit field length (-1) +// 751 = local typedef '__C_ASSERT__' not referenced +// 761 = Redundant typedef '__C_ASSERT__' previously declared at line x +// 30 = Expected an integer constant, obtained an expression that could not be evaluated +// 452 = typedef Symbol '__C_ASSERT__' redeclared (size) conflicts with line x +// 545 = Suspicious use of & + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertSSID() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertSSID( + core_ssid_s& aCoreSSID, + const TSSID& aSSID ) + { + Mem::Copy( aCoreSSID.ssid, aSSID.ssid, aSSID.ssidLength ); + aCoreSSID.length = aSSID.ssidLength; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertSSID() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertSSID( + core_ssid_s& aCoreSSID, + const TDesC& aSSID ) + { + TBuf8 ssidBuf; + ssidBuf.Copy( aSSID ); + + Mem::Copy( aCoreSSID.ssid, ssidBuf.Ptr(), ssidBuf.Length() ); + aCoreSSID.length = ssidBuf.Length(); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertSSID() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertSSID( + core_ssid_s& aCoreSSID, + const TDesC8& aSSID ) + { + Mem::Copy( aCoreSSID.ssid, aSSID.Ptr(), aSSID.Length() ); + aCoreSSID.length = aSSID.Length(); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertSSID() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertSSID( + TSSID& aAmSSID, + const core_ssid_s& aCoreSSID ) + { + Mem::Copy( aAmSSID.ssid, aCoreSSID.ssid, aCoreSSID.length ); + aAmSSID.ssidLength = aCoreSSID.length; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertScanRate() +// --------------------------------------------------------- +// +TRate TWlanConversionUtil::ConvertScanRate( int_t aCoreScanRate ) + { + return static_cast( aCoreScanRate ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertSecurityMode() +// --------------------------------------------------------- +// +TWlanSecurity TWlanConversionUtil::ConvertSecurityMode( + const core_connection_security_mode_e& aCoreMode ) + { + switch( aCoreMode ) + { + case core_connection_security_mode_open: + return EWlanSecurityOpen; + case core_connection_security_mode_wep_open: + return EWlanSecurityWepOpen; + case core_connection_security_mode_wep_shared: + return EWlanSecurityWepShared; + case core_connection_security_mode_802d1x: + return EWlanSecurity802d1x; + case core_connection_security_mode_wpa: + return EWlanSecurityWpa; + case core_connection_security_mode_wpa_psk: + return EWlanSecurityWpaPsk; + case core_connection_security_mode_wpa2: + return EWlanSecurityWpa2; + case core_connection_security_mode_wpa2_psk: + return EWlanSecurityWpa2Psk; + case core_connection_security_mode_wapi: + return EWlanSecurityWapi; + case core_connection_security_mode_wapi_psk: + return EWlanSecurityWapiPsk; + default: + return EWlanSecurityOpen; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertEncryptionMode() +// --------------------------------------------------------- +// +TEncryptionStatus TWlanConversionUtil::ConvertEncryptionMode( + const core_encryption_mode_e& aCoreEncryptionMode ) + { + switch( aCoreEncryptionMode ) + { + case core_encryption_mode_disabled: + return EEncryptionDisabled; + case core_encryption_mode_wep: + return EEncryptionWep; + case core_encryption_mode_802dot1x: + return EEncryption802dot1x; + case core_encryption_mode_wep_mixed_cell: + return EEncryptionWepMixed; + case core_encryption_mode_802dot1x_mixed_cell: + return EEncryption802dot1xMixed; + case core_encryption_mode_wpi: + return EEncryptionWAPI; + default: // instead of case core_encryption_mode_wpa: + return EEncryptionWpa; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertConnectionState() +// --------------------------------------------------------- +// +TWlanConnectionState TWlanConversionUtil::ConvertConnectionState( + const core_connection_state_e& aCoreState ) + { + switch( aCoreState ) + { + case core_connection_state_notconnected: + return EWlanStateNotConnected; + case core_connection_state_infrastructure: + return EWlanStateInfrastructure; + case core_connection_state_searching: + return EWlanStateSearchingAP; + case core_connection_state_ibss: // fall through on purpose + case core_connection_state_secureibss: + return EWlanStateIBSS; + case core_connection_state_secureinfra: + return EWlanStateSecureInfra; + default: + return EConnectionStateUnknown; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertScanMode() +// --------------------------------------------------------- +// +core_scan_mode_e TWlanConversionUtil::ConvertScanMode( + const TScanMode& aAmScanMode ) + { + switch( aAmScanMode ) + { + case EActiveScan: + return core_scan_mode_active; + case EPassiveScan: + return core_scan_mode_passive; + default: + return core_scan_mode_passive; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertScanMode() +// --------------------------------------------------------- +// +TScanMode TWlanConversionUtil::ConvertScanMode( + const core_scan_mode_e& aCoreScanMode ) + { + switch( aCoreScanMode ) + { + case core_scan_mode_active: + return EActiveScan; + case core_scan_mode_passive: + return EPassiveScan; + default: + return EPassiveScan; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertConvertCipherKeyType() +// --------------------------------------------------------- +// +TWlanCipherSuite TWlanConversionUtil::ConvertCipherKeyType( + const core_cipher_key_type_e& aCoreCipherKeyType ) + { + switch( aCoreCipherKeyType ) + { + case core_cipher_key_type_none: + return EWlanCipherSuiteNone; + case core_cipher_key_type_tkip: + return EWlanCipherSuiteTkip; + case core_cipher_key_type_ccmp: + return EWlanCipherSuiteCcmp; + case core_cipher_key_type_wpi: + return EWlanCipherSuiteWapi; + default: + return EWlanCipherSuiteWep; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertNotificationType() +// --------------------------------------------------------- +// +TWlmNotify TWlanConversionUtil::ConvertNotificationType( + const core_notification_e& aCoreNotificationType ) + { + switch( aCoreNotificationType ) + { + case core_notification_connection_state_changed: + return EWlmNotifyConnectionStateChanged; + case core_notification_bssid_changed: + return EWlmNotifyBssidChanged; + case core_notification_bss_lost: + return EWlmNotifyBssLost; + case core_notification_bss_regained: + return EWlmNotifyBssRegained; + case core_notification_tx_power_level_changed: + return EWlmNotifyTransmitPowerChanged; + case core_notification_rcp_changed: + return EWlmNotifyRcpChanged; + case core_notification_ts_status_changed: + return EWlmNotifyTrafficStreamStatusChanged; + case core_notification_ap_info_changed: + return EWlmNotifyAccessPointInfoChanged; + case core_notification_rcpi_roam_attempt_started: + return EWlmNotifyRcpiRoamAttemptStarted; + case core_notification_rcpi_roam_attempt_completed: + return EWlmNotifyRcpiRoamAttemptCompleted; + case core_notification_broken_power_save_test_failed: + return EWlmNotifyBrokenPowerSaveTestFailed; + case core_notification_ac_traffic_mode_changed: + return EWlmNotifyAcTrafficModeChanged; + case core_notification_ac_traffic_status_changed: + return EWlmNotifyAcTrafficStatusChanged; + default: // this should never happen + return EWlmNotifyNone; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertConnectStatus() +// --------------------------------------------------------- +// +TInt TWlanConversionUtil::ConvertConnectStatus( + const core_connect_status_e& aCoreConnectStatus, + core_security_mode_e security_mode ) + { + switch( aCoreConnectStatus ) + { + case core_connect_ok: + return KErrNone; + case core_connect_network_not_found: + case core_connect_mode_infra_required_but_ibss_found: + case core_connect_mode_ibss_required_but_infra_found: + case core_connect_ap_full: + case core_connect_ap_not_whitelisted: + case core_connect_ap_permanently_blacklisted: + case core_connect_ap_temporarily_blacklisted: + case core_connect_ap_outside_defined_region: + case core_connect_iap_open_but_ap_requires_encryption: + case core_connect_iap_wep_but_ap_has_no_privacy: + case core_connect_iap_wpa_but_ap_has_no_privacy: + case core_connect_eapol_auth_start_timeout: + case core_connect_wep_open_authentication_unsupported: + case core_connect_wep_shared_authentication_unsupported: + return KErrWlanNetworkNotFound; + case core_connect_iap_wep_but_ap_has_wpa_ie: + return KErrWlanWpaAuthRequired; + case core_connect_wpa_ap_has_no_valid_ciphers: + case core_connect_wpa_ie_required_but_ap_has_none: + { + if ( security_mode == core_security_mode_wpa2only ) + { + return KErrWlanWpa2OnlyModeNotSupported; + } + + return KErrWlanNetworkNotFound; + } + case core_connect_wep_open_echo_test_failed: + return KErrWlanIllegalEncryptionKeys; + case core_connect_wep_shared_authentication_failed: + return KErrWlanSharedKeyAuthFailed; + case core_connect_wpa_psk_required_but_ap_has_no_support: + return KErrWlanEapModeRequired; + case core_connect_wpa_eap_required_but_ap_has_no_support: + return KErrWlanPskModeRequired; + case core_connect_wpa_eap_failure: + return KErrWlanWpaAuthFailed; + case core_connect_wpa_psk_failure: + return KErrWlanIllegalWpaPskKey; + case core_connect_802_1x_failure: + case core_connect_802_1x_authentication_algorithm_not_supported: + return KErrWlan802dot1xAuthFailed; + case core_connect_wpa_authentication_canceled_by_user: + case core_connect_802_1x_authentication_canceled_by_user: + return KErrCancel; + case core_connect_eap_gtc_failure: + return KErrWlanEapGtcFailed; + case core_connect_eap_tls_failure: + return KErrWlanEapTlsFailed; + case core_connect_eap_tls_server_certificate_expired: + case core_connect_eap_ttls_server_certificate_expired: + case core_connect_eap_peap_server_certificate_expired: + return KErrWlanServerCertificateExpired; + case core_connect_eap_tls_server_certificate_unknown: + case core_connect_eap_ttls_server_certificate_unknown: + case core_connect_eap_peap_server_certificate_unknown: + return KErrWlanCerficateVerifyFailed; + case core_connect_eap_tls_user_certificate_expired: + case core_connect_eap_ttls_user_certificate_expired: + case core_connect_eap_peap_user_certificate_expired: + return KErrWlanUserCertificateExpired; + case core_connect_eap_tls_user_certificate_unknown: + case core_connect_eap_ttls_user_certificate_unknown: + case core_connect_eap_peap_user_certificate_unknown: + return KErrWlanNoUserCertificate; + case core_connect_eap_tls_illegal_cipher_suite: + case core_connect_eap_ttls_illegal_cipher_suite: + case core_connect_eap_peap_illegal_cipher_suite: + return KErrWlanNoCipherSuite; + case core_connect_eap_tls_user_rejected: + case core_connect_eap_ttls_user_rejected: + case core_connect_eap_peap_user_rejected: + return KErrWlanUserRejected; + case core_connect_eap_leap_failure: + return KErrWlanLeapFailed; + case core_connect_eap_sim_failure: + return KErrWlanEapSimFailed; + case core_connect_eap_sim_identity_query_failed: + case core_connect_eap_aka_identity_query_failed: + return KErrWlanSimNotInstalled; + case core_connect_eap_sim_user_has_not_subscribed_to_the_requested_service: + case core_connect_eap_aka_user_has_not_subscribed_to_the_requested_service: + return KErrWlanNotSubscribed; + case core_connect_eap_sim_users_calls_are_barred: + case core_connect_eap_aka_users_calls_are_barred: + return KErrWlanAccessBarred; + case core_connect_eap_ttls_failure: + return KErrWlanEapTtlsFailed; + case core_connect_eap_aka_failure: + return KErrWlanEapAkaFailed; + case core_connect_eap_peap_failure: + return KErrWlanEapPeapFailed; + case core_connect_eap_mschapv2_failure: + return KErrWlanEapMsChapv2; + case core_connect_eap_mschapv2_restricted_logon_hours: + return KErrWlanRestrictedLogonHours; + case core_connect_eap_mschapv2_account_disabled: + return KErrWlanAccountDisabled; + case core_connect_eap_mschapv2_no_dialin_permission: + return KErrWlanNoDialinPermissions; + case core_connect_eap_mschapv2_password_expired: + return KErrWlanPasswordExpired; + case core_connect_eap_fast_tunnel_compromise_error: + return KErrWlanEapFastTunnelCompromiseError; + case core_connect_eap_fast_unexpected_tlv_exhanged: + return KErrWlanEapFastUnexpextedTlvExhanged; + case core_connect_eap_fast_no_pac_nor_certs_to_authenticate_with_provision_disabled: + return KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled; + case core_connect_eap_fast_no_matching_pac_for_aid: + return KErrWlanEapFastNoMatchingPacForAid; + case core_connect_eap_fast_authentication_failed: + return KErrWlanEapFastAuthFailed; + case core_connect_eap_fast_pac_store_corrupted: + return KErrWlanEapFastPacStoreCorrupted; + case core_connect_wapi_ie_required_but_ap_has_none: + case core_connect_wapi_certificate_required_but_ap_has_no_support: + case core_connect_wapi_psk_required_but_ap_has_no_support: + case core_connect_wapi_ap_has_no_valid_ciphers: + return KErrWlanNetworkNotFound; + case core_connect_wapi_psk_failure: + return KErrWlanInternalError; + case core_connect_wapi_certificate_failure: + return KErrWlanInternalError; + default: + return KErrUnknown; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertRegion() +// --------------------------------------------------------- +// +core_wlan_region_e TWlanConversionUtil::ConvertRegion( + const TWlanRegion& aAmRegion ) + { + switch( aAmRegion ) + { + case EETSI: + return core_wlan_region_etsi; + default: + return core_wlan_region_fcc; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertRegion() +// --------------------------------------------------------- +// +TWlanRegion TWlanConversionUtil::ConvertRegion( + const core_wlan_region_e& aCoreRegion ) + { + switch( aCoreRegion ) + { + case core_wlan_region_etsi: + return EETSI; + default: + return EFCC; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertMacAddress() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertMacAddress( + TMacAddress& aAmMacAddress, + const core_mac_address_s& aCoreMacAddress ) + { + // Function assumes both mac address types have the same length + Mem::Copy( + aAmMacAddress.iMacAddress, + aCoreMacAddress.addr, + MAC_ADDR_LEN ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertMacAddress() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertMacAddress( + core_mac_address_s& aCoreAddress, + const TMacAddress& aAmMacAddress ) + { + // Function assumes both mac address types have the same length + Mem::Copy( + aCoreAddress.addr, + aAmMacAddress.iMacAddress, + MAC_ADDR_LEN ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertMacAddress() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertMacAddress( + core_mac_address_s& aCoreAddress, + const TMacAddr& aAmMacAddress ) + { + // Function assumes both mac address types have the same length + Mem::Copy( + aCoreAddress.addr, + aAmMacAddress.iMacAddress, + MAC_ADDR_LEN ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertMacAddress() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertMacAddress( + TMacAddress& aCoreAddress, + const TMacAddr& aAmMacAddress ) + { + // Function assumes both mac address types have the same length + Mem::Copy( + aCoreAddress.iMacAddress, + aAmMacAddress.iMacAddress, + MAC_ADDR_LEN ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertPowerMode() +// --------------------------------------------------------- +// +TPowerMode TWlanConversionUtil::ConvertPowerMode( + const core_power_mode_e& aCorePowerMode ) + { + switch( aCorePowerMode ) + { + case core_power_mode_cam: + return EPowerModeCam; + default: + return EPowerModePs; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertWakeUpInterval() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertWakeUpInterval( + TWlanWakeUpInterval& aAmWakeUpMode, + TUint8& aAmWakeUpInterval, + const core_power_save_wakeup_mode_e& aCoreWakeUpMode, + const u8_t& aCoreWakeUpInterval ) + { + switch( aCoreWakeUpMode ) + { + case core_power_save_wakeup_mode_dtim: + { + if( aCoreWakeUpInterval == 1 ) + { + aAmWakeUpMode = EWakeUpIntervalAllDtims; + aAmWakeUpInterval = 0; + } + else + { + aAmWakeUpMode = EWakeUpIntervalEveryNthDtim; + aAmWakeUpInterval = aCoreWakeUpInterval; + } + break; + } + default: + { + if( aCoreWakeUpInterval == 1 ) + { + aAmWakeUpMode = EWakeUpIntervalAllBeacons; + aAmWakeUpInterval = 0; + } + else + { + aAmWakeUpMode = EWakeUpIntervalEveryNthBeacon; + aAmWakeUpInterval = aCoreWakeUpInterval; + } + break; + } + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertIndication() +// --------------------------------------------------------- +// +core_am_indication_e TWlanConversionUtil::ConvertIndication( + const TIndication& aAmIndication ) + { + switch( aAmIndication ) + { + case EMediaDisconnect: + return core_am_indication_wlan_media_disconnect; + case EOsPowerStandby: + return core_am_indication_os_power_standby; + case EHWFailed: + return core_am_indication_wlan_hw_failed; + case EConsecutiveBeaconsLost: + return core_am_indication_wlan_beacon_lost; + case EConsecutiveTxFailures: + return core_am_indication_wlan_tx_fail; + case EConsecutivePwrModeSetFailures: + return core_am_indication_wlan_power_mode_failure; + case EBSSRegained: + return core_am_indication_wlan_bss_regained; + case EWepDecryptFailure: + return core_am_indication_wlan_wep_decrypt_failure; + case EPairwiseKeyMicFailure: + return core_am_indication_wlan_pairwise_key_mic_failure; + case EGroupKeyMicFailure: + return core_am_indication_wlan_group_key_mic_failure; + case ERcpiTrigger: + return core_am_indication_wlan_rcpi_trigger; + case EScanCompleted: + return core_am_indication_wlan_scan_complete; + case ESignalLossPrediction: + return core_am_indication_wlan_signal_loss_prediction; + case EApTestOpportunity: + return core_am_indication_wlan_power_save_test_trigger; + case EVoiceCallOn: + return core_am_indication_voice_call_on; + case EVoiceCallOff: + return core_am_indication_voice_call_off; + case EPsModeError: + return core_am_indication_wlan_ap_ps_mode_error; + default: + return core_am_indication_wlan_hw_failed; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertDeviceSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertDeviceSettings( + core_device_settings_s& aCoreSettings, + const CWlanDeviceSettings::SWlanDeviceSettings& aAmSettings ) + { + aCoreSettings.beacon = static_cast( aAmSettings.beacon ); + aCoreSettings.long_retry = static_cast( aAmSettings.longRetry ); + aCoreSettings.short_retry = static_cast( aAmSettings.shortRetry ); + aCoreSettings.rts = static_cast( aAmSettings.rts ); + aCoreSettings.tx_power_level = TWlanConversionUtil::ConvertMilliwattsToDecibel( aAmSettings.txPowerLevel ); + aCoreSettings.scan_rate = static_cast( aAmSettings.scanRate ); // TRate -> u32_t + aCoreSettings.rcpi_trigger = static_cast( aAmSettings.rcpiTrigger ); + aCoreSettings.active_scan_min_ch_time = static_cast( aAmSettings.minActiveChannelTime ); + aCoreSettings.active_scan_max_ch_time = static_cast( aAmSettings.maxActiveChannelTime ); + aCoreSettings.passive_scan_min_ch_time = static_cast( aAmSettings.minPassiveChannelTime ); + aCoreSettings.passive_scan_max_ch_time = static_cast( aAmSettings.maxPassiveChannelTime ); + aCoreSettings.max_tx_msdu_life_time = static_cast( aAmSettings.maxTxMSDULifeTime ); + aCoreSettings.unload_driver_timer = static_cast( aAmSettings.unloadDriverTimer ); + aCoreSettings.roam_timer = static_cast( aAmSettings.roamTimer ); + aCoreSettings.rcpi_difference = static_cast( aAmSettings.rcpiDifference ); + aCoreSettings.max_tries_to_find_nw = static_cast( aAmSettings.maxTriesToFindNw ); + aCoreSettings.delay_between_find_nw = static_cast( aAmSettings.delayBetweenFindNw ); + aCoreSettings.power_save_enabled = static_cast( aAmSettings.powerMode ); + aCoreSettings.allow_radio_measurements = static_cast( aAmSettings.allowRadioMeasurements ); + aCoreSettings.max_ap_association_failure_count = static_cast( aAmSettings.maxApFailureCount ); + aCoreSettings.max_ap_authentication_failure_count = static_cast( aAmSettings.maxApAuthFailureCount ); + aCoreSettings.long_beacon_find_count = static_cast( aAmSettings.longBeaconFindCount ); + aCoreSettings.qos_null_frame_interval = static_cast( aAmSettings.qosNullFrameInterval ); + aCoreSettings.qos_null_frame_exit_timeout = static_cast( aAmSettings.qosNullFrameTimeout ); + aCoreSettings.qos_null_frame_entry_timeout = static_cast( aAmSettings.qosNullFrameEntryTimeout ); + aCoreSettings.qos_null_frame_entry_tx_count = static_cast( aAmSettings.qosNullFrameEntryTxCount ); + aCoreSettings.keep_alive_interval = static_cast( aAmSettings.keepAliveInterval ); + aCoreSettings.scan_stop_rcpi_threshold = static_cast( aAmSettings.scanStopRcpiThreshold ); + aCoreSettings.iap_availability_rcpi_threshold = static_cast( aAmSettings.minRcpiForIapAvailability ); + aCoreSettings.max_ap_deauthentication_count = static_cast( aAmSettings.maxApDeauthenticationCount ); + aCoreSettings.ap_deauthentication_timeout = static_cast( aAmSettings.apDeauthenticationTimeout ); + aCoreSettings.sp_rcpi_target = static_cast( aAmSettings.spRcpiTarget ); + aCoreSettings.sp_time_target = static_cast( aAmSettings.spTimeTarget ); + aCoreSettings.sp_min_indication_interval = static_cast( aAmSettings.spMinIndicationInterval ); + aCoreSettings.scan_list_expiration_time = static_cast( aAmSettings.scanListExpirationTime ); + aCoreSettings.rcpi_roam_min_interval = static_cast( aAmSettings.rcpiRoamMinInterval ); + aCoreSettings.rcpi_roam_max_interval = static_cast( aAmSettings.rcpiRoamMaxInterval ); + aCoreSettings.rcpi_roam_attempts_per_interval = static_cast( aAmSettings.rcpiRoamAttemptsPerInterval ); + aCoreSettings.rcpi_roam_next_interval_factor = static_cast( aAmSettings.rcpiRoamNextIntervalFactor ); + aCoreSettings.rcpi_roam_next_interval_addition = static_cast( aAmSettings.rcpiRoamNextIntervalAddition ); + aCoreSettings.bss_lost_roam_min_interval = static_cast( aAmSettings.bssLostRoamMinInterval ); + aCoreSettings.bss_lost_roam_max_interval = static_cast( aAmSettings.bssLostRoamMaxInterval ); + aCoreSettings.bss_lost_roam_attempts_per_interval = static_cast( aAmSettings.bssLostRoamAttemptsPerInterval ); + aCoreSettings.bss_lost_roam_next_interval_factor = static_cast( aAmSettings.bssLostRoamNextIntervalFactor ); + aCoreSettings.bss_lost_roam_next_interval_addition = static_cast( aAmSettings.bssLostRoamNextIntervalAddition ); + aCoreSettings.bss_lost_roam_max_tries_to_find_nw = static_cast( aAmSettings.bssLostRoamMaxTriesToFindNw ); + aCoreSettings.max_dtim_skip_interval = static_cast( aAmSettings.maxDtimSkipInterval ); + aCoreSettings.ps_active_to_light_timeout = static_cast( aAmSettings.psActiveToLightTimeout ); + aCoreSettings.ps_active_to_light_threshold = static_cast( aAmSettings.psActiveToLightThreshold ); + aCoreSettings.ps_light_to_active_timeout = static_cast( aAmSettings.psLightToActiveTimeout ); + aCoreSettings.ps_light_to_active_threshold = static_cast( aAmSettings.psLightToActiveThreshold ); + aCoreSettings.ps_light_to_deep_timeout = static_cast( aAmSettings.psLightToDeepTimeout ); + aCoreSettings.ps_light_to_deep_threshold = static_cast( aAmSettings.psLightToDeepThreshold ); + aCoreSettings.ps_uapsd_rx_frame_length = static_cast( aAmSettings.psUapsdRxThreshold ); + aCoreSettings.rrm_min_measurement_interval = static_cast( aAmSettings.rrmMinMeasurementInterval ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertIapSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertIapSettings( + core_iap_data_s& aCoreSettings, + const SWLANSettings& aAmSettings, + const TBool aDhcpInUse, + const TWLMOverrideSettings& aOverrideSettings ) + { + Mem::FillZ( &aCoreSettings, sizeof( aCoreSettings ) ); + + aCoreSettings.id = aAmSettings.ServiceID; // LanService table row-id + + // Handle + // Connection mode + if ( aAmSettings.ConnectionMode == Adhoc || + aOverrideSettings.settingsMask & EOverrideIbssMask ) + { + aCoreSettings.op_mode = core_operating_mode_ibss; + } + else + { + aCoreSettings.op_mode = core_operating_mode_infrastructure; + } + + // Handle + // SSID + if( aOverrideSettings.settingsMask & EOverrideSsidMask ) + { + Mem::Copy( + aCoreSettings.ssid.ssid, + aOverrideSettings.ssid.ssid, + aOverrideSettings.ssid.ssidLength ); + aCoreSettings.ssid.length = aOverrideSettings.ssid.ssidLength; + } + else + { + TBuf8 buf8; + buf8.Copy( aAmSettings.SSID ); + Mem::Copy( + aCoreSettings.ssid.ssid, + buf8.Ptr(), + aAmSettings.SSID.Length() ); + aCoreSettings.ssid.length = aAmSettings.SSID.Length(); + } + + // Handle + // ScanSSID / is_hidden + if( aAmSettings.ScanSSID ) + { + aCoreSettings.is_hidden = true_t; + } + else + { + aCoreSettings.is_hidden = false_t; + } + + // Handle + // Security mode + switch( aAmSettings.SecurityMode ) + { + case AllowUnsecure: + aCoreSettings.security_mode = core_security_mode_allow_unsecure; + break; + case Wep: + aCoreSettings.security_mode = core_security_mode_wep; + break; + case Wlan8021x: + aCoreSettings.security_mode = core_security_mode_802dot1x; + break; + case Wpa: + aCoreSettings.security_mode = core_security_mode_wpa; + break; + case Wpa2Only: + aCoreSettings.security_mode = core_security_mode_wpa2only; + break; + case Wapi: + aCoreSettings.security_mode = core_security_mode_wapi; + break; + default: + aCoreSettings.security_mode = core_security_mode_allow_unsecure; + } + + // Handle + // WEP Keys + if( aOverrideSettings.settingsMask & EOverrideWepMask ) + { + aCoreSettings.wep_key1.key_index = aOverrideSettings.wep.KeyIndex; + aCoreSettings.wep_key1.key_length = aOverrideSettings.wep.KeyLength; + Mem::Copy( + aCoreSettings.wep_key1.key_data, + aOverrideSettings.wep.KeyMaterial, + MAX_WEP_KEY_LENGTH ); + aCoreSettings.default_wep_key = aOverrideSettings.wep.KeyIndex; + aCoreSettings.security_mode = core_security_mode_wep; + + aCoreSettings.wep_key2.key_length = 0; + aCoreSettings.wep_key3.key_length = 0; + aCoreSettings.wep_key4.key_length = 0; + } + else + { + aCoreSettings.wep_key1.key_index = aAmSettings.WepKey1.KeyIndex; + aCoreSettings.wep_key1.key_length = aAmSettings.WepKey1.KeyLength; + Mem::Copy( + aCoreSettings.wep_key1.key_data, + aAmSettings.WepKey1.KeyMaterial, + MAX_WEP_KEY_LENGTH ); + + aCoreSettings.wep_key2.key_index = aAmSettings.WepKey2.KeyIndex; + aCoreSettings.wep_key2.key_length = aAmSettings.WepKey2.KeyLength; + Mem::Copy( + aCoreSettings.wep_key2.key_data, + aAmSettings.WepKey2.KeyMaterial, + MAX_WEP_KEY_LENGTH ); + + aCoreSettings.wep_key3.key_index = aAmSettings.WepKey3.KeyIndex; + aCoreSettings.wep_key3.key_length = aAmSettings.WepKey3.KeyLength; + Mem::Copy( + aCoreSettings.wep_key3.key_data, + aAmSettings.WepKey3.KeyMaterial, + MAX_WEP_KEY_LENGTH ); + + aCoreSettings.wep_key4.key_index = aAmSettings.WepKey4.KeyIndex; + aCoreSettings.wep_key4.key_length = aAmSettings.WepKey4.KeyLength; + Mem::Copy( + aCoreSettings.wep_key4.key_data, + aAmSettings.WepKey4.KeyMaterial, + MAX_WEP_KEY_LENGTH ); + + aCoreSettings.default_wep_key = aAmSettings.WepIndex; + } + + // Handle + // Authentication mode + switch( aAmSettings.AuthenticationMode ) + { + case EWepAuthModeShared: + aCoreSettings.authentication_mode = core_authentication_mode_shared; + break; + case EWepAuthModeOpen: + /** Falls through on purpose. */ + default: + aCoreSettings.authentication_mode = core_authentication_mode_open; + break; + } + + // Handle + // Preshared key + aCoreSettings.wpa_preshared_key_in_use = aAmSettings.EnableWpaPsk; + if ( aAmSettings.EnableWpaPsk ) + { + Mem::Copy( + aCoreSettings.wpa_preshared_key.key_data, + aAmSettings.WPAPreSharedKey.Ptr(), + aAmSettings.WPAKeyLength ); + aCoreSettings.wpa_preshared_key.key_length = aAmSettings.WPAKeyLength; + } + + // Handle + // EOverrideWpaPskMask + if ( aOverrideSettings.settingsMask & EOverrideWpaPskMask ) + { + Mem::Copy( + aCoreSettings.wpa_preshared_key.key_data, + aOverrideSettings.wpaPsk.KeyMaterial, + aOverrideSettings.wpaPsk.KeyLength ); + aCoreSettings.wpa_preshared_key.key_length = aOverrideSettings.wpaPsk.KeyLength; + aCoreSettings.security_mode = core_security_mode_wpa; + aCoreSettings.wpa_preshared_key_in_use = true_t; + aCoreSettings.is_wpa_overriden = true_t; + } + + // Handle + // EOverrideWpaMask + if ( aOverrideSettings.settingsMask & EOverrideWpaMask ) + { + aCoreSettings.wpa_preshared_key.key_length = 0; + aCoreSettings.security_mode = core_security_mode_wpa; + aCoreSettings.wpa_preshared_key_in_use = false_t; + aCoreSettings.is_wpa_overriden = true_t; + } + + // Handle + // ChannelId (Adhoc feature) + aCoreSettings.used_adhoc_channel = aAmSettings.ChannelID; + + // Handle DHCP vs static IP + aCoreSettings.is_dynamic_ip_addr = aDhcpInUse; + + // Roaming is always allowed. + aCoreSettings.is_roaming_allowed = true_t; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertIapSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertIapSettings( + core_iap_data_s& aCoreSettings, + const TWlanLimitedIapData& aAmSettings ) + { + Mem::FillZ( &aCoreSettings, sizeof( aCoreSettings ) ); + + aCoreSettings.id = aAmSettings.iapId; + + // Handle + // Connection mode + if ( aAmSettings.networkType == Adhoc ) + { + aCoreSettings.op_mode = core_operating_mode_ibss; + } + else + { + aCoreSettings.op_mode = core_operating_mode_infrastructure; + } + + // Handle + // SSID + ConvertSSID( aCoreSettings.ssid, aAmSettings.ssid ); + + // Handle + // ScanSSID / is_hidden + if( aAmSettings.isHidden ) + { + aCoreSettings.is_hidden = true_t; + } + else + { + aCoreSettings.is_hidden = false_t; + } + + // Handle + // Security mode + switch( aAmSettings.securityMode ) + { + case AllowUnsecure: + aCoreSettings.security_mode = core_security_mode_allow_unsecure; + break; + case Wep: + aCoreSettings.security_mode = core_security_mode_wep; + break; + case Wlan8021x: + aCoreSettings.security_mode = core_security_mode_802dot1x; + break; + case Wpa: + aCoreSettings.security_mode = core_security_mode_wpa; + break; + case Wpa2Only: + aCoreSettings.security_mode = core_security_mode_wpa2only; + break; + case Wapi: + aCoreSettings.security_mode = core_security_mode_wapi; + break; + default: + aCoreSettings.security_mode = core_security_mode_allow_unsecure; + } + + // Handle + // Preshared key + aCoreSettings.wpa_preshared_key_in_use = aAmSettings.isPskEnabled; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertErrorCode() +// --------------------------------------------------------- +// +TInt TWlanConversionUtil::ConvertErrorCode( const core_error_e aError ) + { + switch ( aError ) + { + case core_error_ok: + return KErrNone; + case core_error_not_found: + return KErrNotFound; + case core_error_no_memory: + return KErrNoMemory; + case core_error_illegal_argument: + return KErrArgument; + case core_error_not_supported: + return KErrNotSupported; + case core_error_in_use: + return KErrInUse; + case core_error_timeout: + return KErrTimedOut; + case core_error_connection_already_active: + return KErrWlanConnAlreadyActive; + case core_error_wlan_disabled: + return KErrNotReady; + case core_error_cancel: + return KErrCancel; + case core_error_already_exists: + return KErrAlreadyExists; + case core_error_illegal_rate: + case core_error_failed: + case core_error_drivers_not_loaded: + case core_error_in_power_save: + case core_error_challenge_failure: + case core_error_not_connected: + case core_error_general: + default: + return KErrGeneral; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertErrorCode() +// --------------------------------------------------------- +// +core_error_e TWlanConversionUtil::ConvertErrorCode( const TInt aError ) + { + switch ( aError ) + { + case KErrNone: + return core_error_ok; + case KErrNotFound: + return core_error_not_found; + case KErrNoMemory: + return core_error_no_memory; + case KErrNotSupported: + return core_error_not_supported; + case KErrArgument: + return core_error_illegal_argument; + case KErrInUse: + return core_error_in_use; + case KErrTimedOut: + return core_error_timeout; + case KErrCancel: + return core_error_cancel; + case KErrAlreadyExists: + return core_error_already_exists; + default: + return core_error_general; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertMilliwattsToDecibel() +// --------------------------------------------------------- +// +u32_t TWlanConversionUtil::ConvertMilliwattsToDecibel( + const TUint32 aValue ) + { + TReal realResult( 0 ); + TInt32 intResult( 0 ); + TUint32 retValue( 0 ); + + DEBUG1( "TWlanConversionUtil::ConvertMilliwattsToDecibel() - aValue = %u", + aValue ); + + if ( ( Math::Log( realResult, aValue ) == KErrNone ) && + ( Math::Int( intResult, realResult * 10 ) == KErrNone ) ) + { + if ( intResult ) + { + retValue = intResult; + } + } + + DEBUG1( "TWlanConversionUtil::ConvertMilliwattsToDecibel() - retValue = %u", + retValue ); + return static_cast( retValue ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertDecibelToMilliWatts() +// --------------------------------------------------------- +// +TUint32 TWlanConversionUtil::ConvertDecibelToMilliWatts( + const u32_t aValue ) + { + TReal realResult( 0 ); + TReal realRound( 0 ); + const TReal realValue( 10 ); + const TReal realPower( static_cast( aValue ) ); + TInt32 intResult( 0 ); + TInt32 intDecimalPlaces( 0 ); + TUint32 retValue( 1 ); + + DEBUG1( "TWlanConversionUtil::ConvertDecibelToMilliWatts() - aValue = %u", + aValue ); + + if ( ( Math::Pow( realResult, realValue, realPower / 10 ) == KErrNone ) && + ( Math::Round( realRound, realResult, intDecimalPlaces ) == KErrNone ) && + ( Math::Int( intResult, realRound ) == KErrNone ) ) + { + if ( intResult ) + { + retValue = intResult; + } + } + + DEBUG1( "TWlanConversionUtil::ConvertDecibelToMilliWatts() - retValue = %u", + retValue ); + return retValue; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertRcpClass() +// --------------------------------------------------------- +// +TWlanRCPLevel TWlanConversionUtil::ConvertRcpClass( + const core_rcp_class_e aValue ) + { + switch( aValue ) + { + case core_rcp_weak: + return EWlanRcpWeak; + default: + return EWlanRcpNormal; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertScanChannels() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertScanChannels( + SChannels& aAmChannels, + const core_scan_channels_s& aCoreChannels ) + { + aAmChannels.iBand = aCoreChannels.band; + Mem::Copy( + &aAmChannels.iChannels2dot4GHz[0], + &aCoreChannels.channels2dot4ghz[0], + sizeof( aCoreChannels.channels2dot4ghz ) ); + Mem::Copy( + &aAmChannels.iChannels4dot9GHz[0], + &aCoreChannels.channels4dot9ghz[0], + sizeof( aCoreChannels.channels4dot9ghz ) ); + Mem::Copy( + &aAmChannels.iChannels5GHz[0], + &aCoreChannels.channels5ghz[0], + sizeof( aCoreChannels.channels5ghz ) ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertScanChannels() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertScanChannels( + core_scan_channels_s& aCoreChannels, + RArray& aAmChannels ) + { + aCoreChannels.band = SCAN_BAND_2DOT4GHZ; + u16_t channels( 0 ); + + for ( TInt idx( 0 ); idx < aAmChannels.Count(); ++idx ) + { + channels |= static_cast( 1 << ( aAmChannels[idx] - 1 ) ); + } + + Mem::Copy( + &aCoreChannels.channels2dot4ghz[0], + reinterpret_cast( &channels ), + sizeof( channels ) ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertFrameType() +// --------------------------------------------------------- +// +core_frame_type_e TWlanConversionUtil::ConvertFrameType( + TDataBuffer::TFrameType aFrameType ) + { + switch( aFrameType ) + { + case TDataBuffer::KEthernetFrame: + { + return core_frame_type_ethernet; + } + case TDataBuffer::KDot11Frame: + { + return core_frame_type_dot11; + } + case TDataBuffer::KEthernetTestFrame: + { + return core_frame_type_test; + } + default: + return core_frame_type_snap; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertFrameType() +// --------------------------------------------------------- +// +TDataBuffer::TFrameType TWlanConversionUtil::ConvertFrameType( + core_frame_type_e aFrameType ) + { + switch( aFrameType ) + { + case core_frame_type_ethernet: + { + return TDataBuffer::KEthernetFrame; + } + case core_frame_type_dot11: + { + return TDataBuffer::KDot11Frame; + } + case core_frame_type_test: + { + return TDataBuffer::KEthernetTestFrame; + } + default: + return TDataBuffer::KSnapFrame; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertPacketStatistics() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertPacketStatistics( + TWlanPacketStatistics& aAmStatistics, + const core_packet_statistics_s& aCoreStatistics ) + { + aAmStatistics.txFrames = aCoreStatistics.tx_frames; + aAmStatistics.rxFrames = aCoreStatistics.rx_frames; + aAmStatistics.txMulticastFrames = aCoreStatistics.tx_multicast_frames; + aAmStatistics.rxMulticastFrames = aCoreStatistics.rx_multicast_frames; + aAmStatistics.fcsErrors = aCoreStatistics.fcs_errors; + aAmStatistics.txRetries = aCoreStatistics.tx_retries; + aAmStatistics.txErrors = aCoreStatistics.tx_errors; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertUapsdSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertUapsdSettings( + core_uapsd_settings_s& aCoreSettings, + const TWlanUapsdSettings& aAmSettings ) + { + switch( aAmSettings.maxServicePeriodLength ) + { + case EWlanMaxServicePeriodLengthTwo: + aCoreSettings.max_service_period = core_max_service_period_length_two; + break; + case EWlanMaxServicePeriodLengthFour: + aCoreSettings.max_service_period = core_max_service_period_length_four; + break; + case EWlanMaxServicePeriodLengthSix: + aCoreSettings.max_service_period = core_max_service_period_length_six; + break; + case EWlanMaxServicePeriodLengthAll: + /** Falls through on purpose. */ + default: + aCoreSettings.max_service_period = core_max_service_period_length_all; + break; + } + + aCoreSettings.uapsd_enabled_for_voice = aAmSettings.uapsdForVoice; + aCoreSettings.uapsd_enabled_for_video = aAmSettings.uapsdForVideo; + aCoreSettings.uapsd_enabled_for_best_effort = aAmSettings.uapsdForBestEffort; + aCoreSettings.uapsd_enabled_for_background = aAmSettings.uapsdForBackground; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertUapsdSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertUapsdSettings( + TWlanUapsdSettings& aAmSettings, + const core_uapsd_settings_s& aCoreSettings ) + { + switch( aCoreSettings.max_service_period ) + { + case core_max_service_period_length_two: + aAmSettings.maxServicePeriodLength = EWlanMaxServicePeriodLengthTwo; + break; + case core_max_service_period_length_four: + aAmSettings.maxServicePeriodLength = EWlanMaxServicePeriodLengthFour; + break; + case core_max_service_period_length_six: + aAmSettings.maxServicePeriodLength = EWlanMaxServicePeriodLengthSix; + break; + case core_max_service_period_length_all: + /** Falls through on purpose. */ + default: + aAmSettings.maxServicePeriodLength = EWlanMaxServicePeriodLengthAll; + break; + } + + aAmSettings.uapsdForVoice = aCoreSettings.uapsd_enabled_for_voice; + aAmSettings.uapsdForVideo = aCoreSettings.uapsd_enabled_for_video; + aAmSettings.uapsdForBestEffort = aCoreSettings.uapsd_enabled_for_best_effort; + aAmSettings.uapsdForBackground = aCoreSettings.uapsd_enabled_for_background; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTxRatePolicies() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertTxRatePolicies( + TTxRatePolicy& aAmPolicies, + THtMcsPolicy& aAmMcsPolicies, + TTxAutoRatePolicy& aAmAutoRatePolicies, + const core_tx_rate_policies_s& aCorePolicies ) + { + aAmPolicies.numOfPolicyObjects = aCorePolicies.policy_count; + for ( TUint idx( 0 ); idx < aCorePolicies.policy_count; ++idx ) + { + aAmPolicies.txRateClass[idx].txPolicy54 = aCorePolicies.policy[idx].tx_policy_54; + aAmPolicies.txRateClass[idx].txPolicy48 = aCorePolicies.policy[idx].tx_policy_48; + aAmPolicies.txRateClass[idx].txPolicy36 = aCorePolicies.policy[idx].tx_policy_36; + aAmPolicies.txRateClass[idx].txPolicy33 = aCorePolicies.policy[idx].tx_policy_33; + aAmPolicies.txRateClass[idx].txPolicy24 = aCorePolicies.policy[idx].tx_policy_24; + aAmPolicies.txRateClass[idx].txPolicy22 = aCorePolicies.policy[idx].tx_policy_22; + aAmPolicies.txRateClass[idx].txPolicy18 = aCorePolicies.policy[idx].tx_policy_18; + aAmPolicies.txRateClass[idx].txPolicy12 = aCorePolicies.policy[idx].tx_policy_12; + aAmPolicies.txRateClass[idx].txPolicy11 = aCorePolicies.policy[idx].tx_policy_11; + aAmPolicies.txRateClass[idx].txPolicy9 = aCorePolicies.policy[idx].tx_policy_9; + aAmPolicies.txRateClass[idx].txPolicy6 = aCorePolicies.policy[idx].tx_policy_6; + aAmPolicies.txRateClass[idx].txPolicy5_5 = aCorePolicies.policy[idx].tx_policy_5p5; + aAmPolicies.txRateClass[idx].txPolicy2 = aCorePolicies.policy[idx].tx_policy_2; + aAmPolicies.txRateClass[idx].txPolicy1 = aCorePolicies.policy[idx].tx_policy_1; + aAmPolicies.txRateClass[idx].shortRetryLimit = aCorePolicies.policy[idx].short_retry_limit; + aAmPolicies.txRateClass[idx].longRetryLimit = aCorePolicies.policy[idx].long_retry_limit; + aAmPolicies.txRateClass[idx].flags = aCorePolicies.policy[idx].flags; + aAmAutoRatePolicies[idx] = aCorePolicies.policy[idx].tx_auto_rate_policy; + Mem::Copy( + &aAmMcsPolicies[idx][0], + &aCorePolicies.policy[idx].mcs_set[0], + sizeof( THtMcsSet ) ); + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTxRatePolicyMappings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertTxRatePolicyMappings( + TQueue2RateClass& aAmMappings, + const core_tx_rate_policy_mappings_s& aCoreMappings ) + { + aAmMappings[ELegacy] = aCoreMappings.policy_for_background; + aAmMappings[EBackGround] = aCoreMappings.policy_for_background; + aAmMappings[EVideo] = aCoreMappings.policy_for_video; + aAmMappings[EVoice] = aCoreMappings.policy_for_voice; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTxRatePolicyInitialRates() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertTxRatePolicyInitialRates( + TInitialMaxTxRate4RateClass& aInitialRates, + const core_tx_rate_policies_s& aCorePolicies ) + { + Mem::FillZ( + &aInitialRates[0], + KMaxNbrOfRateClasses ); + + for ( TUint idx( 0 ); idx < aCorePolicies.policy_count; ++idx ) + { + aInitialRates[idx] = aCorePolicies.policy[idx].initial_tx_rate; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertPowerSaveSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertPowerSaveSettings( + core_power_save_settings_s& aCoreSettings, + const TWlanPowerSaveSettings& aAmSettings ) + { + aCoreSettings.stay_in_uapsd_power_save_for_voice = aAmSettings.stayInUapsdPsModeForVoice; + aCoreSettings.stay_in_uapsd_power_save_for_video = aAmSettings.stayInUapsdPsModeForVideo; + aCoreSettings.stay_in_uapsd_power_save_for_best_effort = aAmSettings.stayInUapsdPsModeForBestEffort; + aCoreSettings.stay_in_uapsd_power_save_for_background = aAmSettings.stayInUapsdPsModeForBackground; + + aCoreSettings.stay_in_legacy_power_save_for_voice = aAmSettings.stayInLegacyPsModeForVoice; + aCoreSettings.stay_in_legacy_power_save_for_video = aAmSettings.stayInLegacyPsModeForVideo; + aCoreSettings.stay_in_legacy_power_save_for_best_effort = aAmSettings.stayInLegacyPsModeForBestEffort; + aCoreSettings.stay_in_legacy_power_save_for_background = aAmSettings.stayInLegacyPsModeForBackground; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertPowerSaveSettings() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertPowerSaveSettings( + TWlanPowerSaveSettings& aAmSettings, + const core_power_save_settings_s& aCoreSettings ) + { + aAmSettings.stayInUapsdPsModeForVoice = aCoreSettings.stay_in_uapsd_power_save_for_voice; + aAmSettings.stayInUapsdPsModeForVideo = aCoreSettings.stay_in_uapsd_power_save_for_video; + aAmSettings.stayInUapsdPsModeForBestEffort = aCoreSettings.stay_in_uapsd_power_save_for_best_effort; + aAmSettings.stayInUapsdPsModeForBackground = aCoreSettings.stay_in_uapsd_power_save_for_background; + + aAmSettings.stayInLegacyPsModeForVoice = aCoreSettings.stay_in_legacy_power_save_for_voice; + aAmSettings.stayInLegacyPsModeForVideo = aCoreSettings.stay_in_legacy_power_save_for_video; + aAmSettings.stayInLegacyPsModeForBestEffort = aCoreSettings.stay_in_legacy_power_save_for_best_effort; + aAmSettings.stayInLegacyPsModeForBackground = aCoreSettings.stay_in_legacy_power_save_for_background; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertUapsdMaxServicePeriod() +// --------------------------------------------------------- +// +TMaxServicePeriodLength TWlanConversionUtil::ConvertUapsdMaxServicePeriod( + core_max_service_period_length_e aServicePeriodLength ) + { + switch( aServicePeriodLength ) + { + case core_max_service_period_length_two: + return EMaxServicePeriodLengthTwo; + case core_max_service_period_length_four: + return EMaxServicePeriodLengthFour; + case core_max_service_period_length_six: + return EMaxServicePeriodLengthSix; + case core_max_service_period_length_all: + /** Falls through on purpose. */ + default: + return EMaxServicePeriodLengthAll; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTrafficStreamStatus() +// --------------------------------------------------------- +// +TWlanTrafficStreamStatus TWlanConversionUtil::ConvertTrafficStreamStatus( + core_traffic_stream_status_e aStatus ) + { + switch( aStatus ) + { + case core_traffic_stream_status_active: + return EWlanTrafficStreamStatusActive; + case core_traffic_stream_status_inactive_not_required: + return EWlanTrafficStreamStatusInactiveNotRequired; + case core_traffic_stream_status_inactive_deleted_by_ap: + return EWlanTrafficStreamStatusInactiveDeletedByAp; + case core_traffic_stream_status_inactive_no_bandwidth: + return EWlanTrafficStreamStatusInactiveNoBandwidth; + case core_traffic_stream_status_inactive_invalid_parameters: + return EWlanTrafficStreamStatusInactiveInvalidParameters; + case core_traffic_stream_status_inactive_other: + /** Falls through on purpose. */ + default: + return EWlanTrafficStreamStatusInactiveOther; + } + } + +/* Compile time assertions are used to make sure that rate bits are same in core and in Symbian. */ +COMPILE_ASSERT( TWlanRateNone == core_tx_rate_none ); +COMPILE_ASSERT( TWlanRate1mbit == core_tx_rate_1mbit ); +COMPILE_ASSERT( TWlanRate2mbit == core_tx_rate_2mbit ); +COMPILE_ASSERT( TWlanRate5p5mbit == core_tx_rate_5p5mbit); +COMPILE_ASSERT( TWlanRate6mbit == core_tx_rate_6mbit ); +COMPILE_ASSERT( TWlanRate9mbit == core_tx_rate_9mbit ); +COMPILE_ASSERT( TWlanRate11mbit == core_tx_rate_11mbit ); +COMPILE_ASSERT( TWlanRate12mbit == core_tx_rate_12mbit ); +COMPILE_ASSERT( TWlanRate18mbit == core_tx_rate_18mbit ); +COMPILE_ASSERT( TWlanRate22mbit == core_tx_rate_22mbit ); +COMPILE_ASSERT( TWlanRate24mbit == core_tx_rate_24mbit ); +COMPILE_ASSERT( TWlanRate33mbit == core_tx_rate_33mbit ); +COMPILE_ASSERT( TWlanRate36mbit == core_tx_rate_36mbit ); +COMPILE_ASSERT( TWlanRate48mbit == core_tx_rate_48mbit ); +COMPILE_ASSERT( TWlanRate54mbit == core_tx_rate_54mbit ); + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertApInformation() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertApInformation( + TWlanAccessPointInfo& aAmInfo, + const core_ap_information_s& aCoreInfo ) + { + aAmInfo.ssid.Copy( aCoreInfo.ssid.ssid, Min(aCoreInfo.ssid.length, KWlanMaxSsidLength ) ); + aAmInfo.bssid.Copy( aCoreInfo.bssid.addr, KWlanMaxBssidLength ); + aAmInfo.capabilities = aCoreInfo.capabilities; + aAmInfo.channel = aCoreInfo.channel; + + // RCPI -> RSSI CONVERSION + // Note: conversion may round the result by 0.5 units + aAmInfo.rssi = ( 110 - ( aCoreInfo.rcpi / 2 ) ); + aAmInfo.basicRates = aCoreInfo.basic_rates; + aAmInfo.supportedRates = aCoreInfo.supported_rates; + + switch ( aCoreInfo.security_mode ) + { + case core_connection_security_mode_open: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeOpen; + break; + case core_connection_security_mode_wep_open: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWepOpen; + break; + case core_connection_security_mode_wep_shared: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWepShared; + break; + case core_connection_security_mode_802d1x: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityMode802d1x; + break; + case core_connection_security_mode_wpa: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWpa; + break; + case core_connection_security_mode_wpa2: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWpa2; + break; + case core_connection_security_mode_wpa_psk: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWpaPsk; + break; + case core_connection_security_mode_wpa2_psk: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWpa2Psk; + break; + case core_connection_security_mode_wapi: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWapi; + break; + case core_connection_security_mode_wapi_psk: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeWapiPsk; + break; + default: + aAmInfo.securityMode = EWlanConnectionExtentedSecurityModeOpen; + break; + } + + aAmInfo.isAcRequiredForVoice = aCoreInfo.is_ac_required_for_voice; + aAmInfo.isAcRequiredForVideo = aCoreInfo.is_ac_required_for_video; + aAmInfo.isAcRequiredForBestEffort = aCoreInfo.is_ac_required_for_best_effort; + aAmInfo.isAcRequiredForBackground = aCoreInfo.is_ac_required_for_background; + aAmInfo.isWpx = aCoreInfo.is_wpx; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertRoamMetrics() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertRoamMetrics( + TWlanRoamMetrics& aAmRoamMetrics, + const core_roam_metrics_s& aCoreRoamMetrics ) + { + aAmRoamMetrics.connectionAttemptTotalCount = aCoreRoamMetrics.connection_attempt_total_count; + aAmRoamMetrics.unsuccesfullConnectionAttemptCount = aCoreRoamMetrics.unsuccesfull_connection_attempt_count; + aAmRoamMetrics.roamingCounter = aCoreRoamMetrics.roaming_counter; + aAmRoamMetrics.coverageLossCount = aCoreRoamMetrics.coverage_loss_count; + aAmRoamMetrics.lastRoamTotalDuration = aCoreRoamMetrics.last_roam_total_duration; + aAmRoamMetrics.lastRoamDataPathBrokenDuration = aCoreRoamMetrics.last_roam_data_path_broken_duration; + + switch ( aCoreRoamMetrics.last_roam_reason ) + { + case core_roam_reason_none: + case core_roam_reason_initial_connect: + case core_roam_reason_signal_strength: + case core_roam_reason_signal_loss_prediction: + case core_roam_reason_directed_roam: + aAmRoamMetrics.lastRoamReason = EWlanRoamReasonLowRssi; + break; + case core_roam_reason_failed_reauthentication: + case core_roam_reason_media_disconnect: + case core_roam_reason_bss_lost: + aAmRoamMetrics.lastRoamReason = EWlanRoamReasonApLost; + break; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertRogueList() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertRogueList( + TWlmRogueList& aAmRogueList, + core_type_list_c& aCoreRogueList ) + { + aAmRogueList.count = 0; + core_type_list_iterator_c iter( aCoreRogueList ); + iter.first(); + while ( iter.current() && aAmRogueList.count < KWlmRogueListMaxCount ) + { + TWlanBssid bssid; + bssid.Copy( iter.current()->addr, KWlanMaxBssidLength ); + aAmRogueList.list[aAmRogueList.count] = bssid; + + ++aAmRogueList.count; + iter.next(); + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTxQueueId() +// --------------------------------------------------------- +// +TQueueId TWlanConversionUtil::ConvertTxQueueId( + core_access_class_e queue_id ) + { + switch ( queue_id ) + { + case core_access_class_voice: + return EVoice; + case core_access_class_video: + return EVideo; + case core_access_class_background: + return EBackGround; + case core_access_class_best_effort: + /** Falls through on purpose. */ + default: + return ELegacy; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertProtectedSetupCredentialAttribute() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertProtectedSetupCredentialAttribute( + TWlanProtectedSetupCredentialAttribute& aAmAttribute, + const core_iap_data_s& aCoreAttribute ) + { + // Handle operating mode. + if ( aCoreAttribute.op_mode == core_operating_mode_ibss ) + { + aAmAttribute.iOperatingMode = EWlanOperatingModeAdhoc; + } + else + { + aAmAttribute.iOperatingMode = EWlanOperatingModeInfrastructure; + } + + // Handle authentication mode + if ( aCoreAttribute.authentication_mode == core_authentication_mode_shared ) + { + aAmAttribute.iAuthenticationMode = EWlanAuthenticationModeShared; + } + else + { + aAmAttribute.iAuthenticationMode = EWlanAuthenticationModeOpen; + } + + // Handle security mode. + switch( aCoreAttribute.security_mode ) + { + case core_security_mode_wep: + aAmAttribute.iSecurityMode = EWlanIapSecurityModeWep; + break; + case core_security_mode_802dot1x: + aAmAttribute.iSecurityMode = EWlanIapSecurityMode802d1x; + break; + case core_security_mode_wpa: + aAmAttribute.iSecurityMode = EWlanIapSecurityModeWpa; + break; + case core_security_mode_wpa2only: + aAmAttribute.iSecurityMode = EWlanIapSecurityModeWpa2Only; + break; + case core_security_mode_allow_unsecure: + /** Falls through on purpose. */ + default: + aAmAttribute.iSecurityMode = EWlanIapSecurityModeAllowUnsecure; + break; + } + + // Handle SSID + aAmAttribute.iSsid.Copy( + &aCoreAttribute.ssid.ssid[0], + aCoreAttribute.ssid.length ); + + // Handle WEP keys + aAmAttribute.iWepDefaultKey = static_cast( + aCoreAttribute.default_wep_key ); + + aAmAttribute.iWepKey1.Copy( + &aCoreAttribute.wep_key1.key_data[0], + aCoreAttribute.wep_key1.key_length ); + + aAmAttribute.iWepKey2.Copy( + &aCoreAttribute.wep_key2.key_data[0], + aCoreAttribute.wep_key2.key_length ); + + aAmAttribute.iWepKey3.Copy( + &aCoreAttribute.wep_key3.key_data[0], + aCoreAttribute.wep_key3.key_length ); + + aAmAttribute.iWepKey4.Copy( + &aCoreAttribute.wep_key4.key_data[0], + aCoreAttribute.wep_key4.key_length ); + + // Handle WPA preshared key + aAmAttribute.iWpaPreSharedKey.Copy( + &aCoreAttribute.wpa_preshared_key.key_data[0], + aCoreAttribute.wpa_preshared_key.key_length ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertProtectedSetupStatus() +// --------------------------------------------------------- +// +TInt TWlanConversionUtil::ConvertProtectedSetupStatus( + core_protected_setup_status_e aCoreStatus ) + { + switch( aCoreStatus ) + { + case core_protected_setup_status_ok: + return KErrNone; + case core_protected_setup_status_session_overlap: // fall through on purpose + case core_protected_setup_status_multiple_PBC_sessions_detected: + return KErrWlanProtectedSetupMultiplePBCSessionsDetected; + case core_protected_setup_status_walktime_expired: // fall through on purpose + case core_protected_setup_status_registration_session_timeout: + return KErrWlanProtectedSetupRegistrationSessionTimeout; + case core_protected_setup_status_network_auth_failure: + return KErrWlanProtectedSetupNetworkAuthFailure; + case core_protected_setup_status_network_assoc_failure: + return KErrWlanProtectedSetupNetworkAssociationFailure; + case core_protected_setup_status_OOB_interface_read_error: + return KErrWlanProtectedSetupOOBInterfaceReadError; + case core_protected_setup_status_decryption_CRC_failure: + return KErrWlanProtectedSetupDecryptionCRCFailure; + case core_protected_setup_status_RF_band_2_4_ghz_not_supported: + return KErrWlanProtectedSetup2_4ChannelNotSupported; + case core_protected_setup_status_RF_band_5_0_ghz_not_supported: + return KErrWlanProtectedSetup5_0ChannelNotSupported; + case core_protected_setup_status_signal_too_weak: + return KErrWlanSignalTooWeak; + case core_protected_setup_status_no_DHCP_response: + return KErrWlanProtectedSetupNoDHCPResponse; + case core_protected_setup_status_failed_DHCP_configure: + return KErrWlanProtectedSetupFailedDHCPConfig; + case core_protected_setup_status_ip_address_conflict: + return KErrWlanProtectedSetupIPAddressConflict; + case core_protected_setup_status_could_not_connect_to_registrar: + return KErrWlanProtectedSetupCouldNotConnectToRegistrar; + case core_protected_setup_status_rogue_activity_suspected: + return KErrWlanProtectedSetupRogueActivitySuspected; + case core_protected_setup_status_device_busy: + return KErrWlanProtectedSetupDeviceBusy; + case core_protected_setup_status_setup_locked: + return KErrWlanProtectedSetupSetupLocked; + case core_protected_setup_status_message_timeout: + return KErrWlanProtectedSetupMessageTimeout; + case core_protected_setup_status_device_password_authentication_failure: + return KErrWlanProtectedSetupDevicePasswordAuthFailure; + case core_protected_setup_status_pin_code_authentication_not_supported: + return KErrWlanProtectedSetupPINMethodNotSupported; + case core_protected_setup_status_push_button_authentication_not_supported: + return KErrWlanProtectedSetupPBMethodNotSupported; + default: + return KErrGeneral; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertSnapHeader() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertSnapHeader( + TSnapHeader& aAmHeader, + const core_snap_header_s& aCoreHeader ) + { + aAmHeader.iDSAP = aCoreHeader.dsap; + aAmHeader.iSSAP = aCoreHeader.ssap; + aAmHeader.iControl = aCoreHeader.control; + Mem::Copy( + &aAmHeader.iOUI[0], + &aCoreHeader.oui[0], + KOuiLength ); + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertPowerSaveMode() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertPowerSaveMode( + core_power_save_mode_s& aCoreMode, + TWlanPowerSaveMode aAmMode ) + { + switch( aAmMode ) + { + case EWlanPowerSaveModeNone: + aCoreMode = CORE_POWER_SAVE_MODE_NONE; + break; + case EWlanPowerSaveModeBeacon: + aCoreMode = CORE_POWER_SAVE_MODE_EVERY_BEACON; + break; + case EWlanPowerSaveModeDtim: + aCoreMode = CORE_POWER_SAVE_MODE_EVERY_DTIM; + break; + case EWlanPowerSaveModeDtimSkipping: + aCoreMode = CORE_POWER_SAVE_MODE_DTIM_SKIPPING; + break; + case EWlanPowerSaveModeAutomatic: + /** Falls through purpose. */ + default: + aCoreMode = CORE_POWER_SAVE_MODE_AUTOMATIC; + break; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertFeatureFlags() +// --------------------------------------------------------- +// +u32_t TWlanConversionUtil::ConvertFeatureFlags( + TUint aFeatures ) + { + u32_t coreFeatures( core_feature_none ); + if( aFeatures & CWlmServer::EWlanFeaturePowerSaveTest ) + { + coreFeatures |= core_feature_power_save_test; + } + if( aFeatures & CWlmServer::EWlanFeature802dot11k ) + { + coreFeatures |= core_feature_802dot11k; + } + + return coreFeatures; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertAccessClass() +// --------------------------------------------------------- +// +TWlmAccessClass TWlanConversionUtil::ConvertAccessClass( + core_access_class_e aAccessClass ) + { + switch( aAccessClass ) + { + case core_access_class_voice: + return EWlmAccessClassVoice; + case core_access_class_video: + return EWlmAccessClassVideo; + case core_access_class_background: + return EWlmAccessClassBackground; + case core_access_class_best_effort: + /** Falls through on purpose. */ + default: + return EWlmAccessClassBestEffort; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTrafficMode() +// --------------------------------------------------------- +// +TWlmAcTrafficMode TWlanConversionUtil::ConvertTrafficMode( + core_access_class_traffic_mode_e aMode ) + { + if( aMode == core_access_class_traffic_mode_automatic ) + { + return EWlmAcTrafficModeAutomatic; + } + + return EWlmAcTrafficModeManual; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTrafficStatus() +// --------------------------------------------------------- +// +TWlmAcTrafficStatus TWlanConversionUtil::ConvertTrafficStatus( + core_access_class_traffic_status_e aStatus ) + { + if( aStatus == core_access_class_traffic_status_admitted ) + { + return EWlmAcTrafficStatusAdmitted; + } + + return EWlmAcTrafficStatusNotAdmitted; + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTrafficStreamParameters() +// --------------------------------------------------------- +// +void TWlanConversionUtil::ConvertTrafficStreamParameters( + u8_t& aCoreTid, + u8_t& aCoreUserPriority, + core_traffic_stream_params_s& aCoreParams, + const TWlanTrafficStreamParameters& aAmParams ) + { + aCoreUserPriority = + aAmParams.iUserPriority; + aCoreParams = + KWlmDefaultTsParams[KWlmUserPriorityToAccessClass[aCoreUserPriority]]; + + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterId ) + { + aCoreTid = aAmParams.iId; + } + else + { + aCoreTid = TRAFFIC_STREAM_TID_NONE; + } + + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterType ) + { + if( aAmParams.iType == EWlanTrafficStreamTrafficTypePeriodic ) + { + aCoreParams.is_periodic_traffic = true_t; + } + else + { + aCoreParams.is_periodic_traffic = false_t; + } + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterDirection ) + { + if( aAmParams.iDirection == EWlanTrafficStreamDirectionUplink ) + { + aCoreParams.direction = core_traffic_stream_direction_uplink; + } + else if( aAmParams.iDirection == EWlanTrafficStreamDirectionDownlink ) + { + aCoreParams.direction = core_traffic_stream_direction_downlink; + } + else + { + aCoreParams.direction = core_traffic_stream_direction_bidirectional; + } + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterNominalMsduSize ) + { + aCoreParams.nominal_msdu_size = aAmParams.iNominalMsduSize; + if( aAmParams.iIsMsduSizeFixed ) + { + aCoreParams.nominal_msdu_size |= KWlmTsParamBitNominalSizeFixed; + } + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMaximumMsduSize ) + { + aCoreParams.maximum_msdu_size = aAmParams.iMaximumMsduSize; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMinimumServiceInterval ) + { + aCoreParams.minimum_service_interval = aAmParams.iMinimumServiceInterval; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMaximumServiceInterval ) + { + aCoreParams.maximum_service_interval = aAmParams.iMaximumServiceInterval; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterInactivityInterval ) + { + aCoreParams.inactivity_interval = aAmParams.iInactivityInterval; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterSuspensionInterval ) + { + aCoreParams.suspension_interval = aAmParams.iSuspensionInterval; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterServiceStartTime ) + { + aCoreParams.service_start_time = aAmParams.iServiceStartTime; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMinimumDataRate ) + { + aCoreParams.minimum_data_rate = aAmParams.iMinimumDataRate; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMeanDataRate ) + { + aCoreParams.mean_data_rate = aAmParams.iMeanDataRate; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterPeakDataRate ) + { + aCoreParams.peak_data_rate = aAmParams.iPeakDataRate; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMaximumBurstSize ) + { + aCoreParams.maximum_burst_size = aAmParams.iMaximumBurstSize; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterDelayBound ) + { + aCoreParams.delay_bound = aAmParams.iDelayBound; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterMinimumPhyRate ) + { + aCoreParams.minimum_phy_rate = ConvertTxRate( aAmParams.iMinimumPhyRate ); + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterNominalPhyRate ) + { + aCoreParams.nominal_phy_rate = + static_cast( aAmParams.iNominalPhyRate ); + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterSba ) + { + aCoreParams.surplus_bandwidth_allowance = aAmParams.iSba; + } + if( aAmParams.iParameterBitmap & TWlanTrafficStreamParameters::EWlanParameterIsRetryAllowed ) + { + aCoreParams.is_retry_allowed = aAmParams.iIsAutomaticRetryAllowed; + } + } + +// --------------------------------------------------------- +// TWlanConversionUtil::ConvertTxRate() +// --------------------------------------------------------- +// +u32_t TWlanConversionUtil::ConvertTxRate( + TWlanRate aRate ) + { + switch( aRate ) + { + case TWlanRate54mbit: + return 54000000; + case TWlanRate48mbit: + return 48000000; + case TWlanRate36mbit: + return 36000000; + case TWlanRate33mbit: + return 33000000; + case TWlanRate24mbit: + return 24000000; + case TWlanRate22mbit: + return 22000000; + case TWlanRate18mbit: + return 18000000; + case TWlanRate12mbit: + return 12000000; + case TWlanRate11mbit: + return 11000000; + case TWlanRate9mbit: + return 9000000; + case TWlanRate6mbit: + return 6000000; + case TWlanRate5p5mbit: + return 5500000; + case TWlanRate2mbit: + return 2000000; + case TWlanRate1mbit: + return 1000000; + case TWlanRateNone: + /** Falls through on purpose. */ + default: + return 0; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlandevicesettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlandevicesettings.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1710 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to read and write WLAN device specific settings. +* +*/ + +/* +* %version: 17 % +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "am_debug.h" +#include "wlandevicesettings.h" +#include "wlandevicesettingsprivatecrkeys.h" + +// CONSTANTS +// Ids for Wlan settings type. +const TUint32 KWlanDefaultSettings = 0; +const TUint32 KWlanUserSettings = 1; +const TUint32 KMaxCommsDbWriteAttempts = 10; +const TUint32 KRetryIntervalUsIfCommsDbLocked = 100000; + +// Table name +_LIT( KWlanDeviceSettings, "WLANDeviceTable" ); +_LIT( KTableVersion, "Version"); +_LIT( KWlanDeviceSettingsType, "WlanDeviceSettingsType" ); +_LIT( KBgScanInterval, "WlanBgScanInterval" ); +_LIT( KUseDefaultSettings, "WlanUseDefaultSettings" ); +_LIT( KWlanLongRetry, "WlanLongRetry" ); +_LIT( KWlanRTSThreshold, "WlanRTS" ); +_LIT( KWlanShortRetry, "WlanShortRetry" ); +_LIT( KWlanTxPowerLevel, "WlanTxPowerLevel" ); +_LIT( KWlanAllowRadioMeasurements, "AllowRadioMeasurements" ); +_LIT( KWlanPowerMode, "WlanPowerMode" ); + +// Increase version every time the content of the table changes! +const TUint32 KWlanDeviceSettingsTableVersion = 9; + +// LOCAL FUNCTION PROTOTYPES + +// ==================== LOCAL FUNCTIONS ==================== + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanDeviceSettings::CWlanDeviceSettings +// NOTE! This class is derived from CBase, so, it is +// initialised with zero. The initialisation of its +// attributes is unnecessary. +// --------------------------------------------------------- +// +CWlanDeviceSettings::CWlanDeviceSettings() + { + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::ConstructL +// --------------------------------------------------------- +// +void CWlanDeviceSettings::ConstructL() + { + DEBUG( "CWlanDeviceSettings::ConstructL()" ); + // Open the CommsDB. + iDb = CCommsDatabase::NewL(); + + // Check that the version of WlanDeviceSettings is correct. + TRAPD( err, CheckWlanDeviceSettingsTableL() ); + + if ( err != KErrNone ) + { + // Okay, the version is not correct or the table is not found. + DEBUG( "ERROR: SETTINGS NOT OK!!" ); + delete iDb; + iDb = NULL; + User::Leave( err ); + } + + // Open the WLAN device settings table. + OpenTableL(); + DEBUG( "CWlanDeviceSettings::ConstructL() Tables opened ok." ); + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::NewL +// --------------------------------------------------------- +// +EXPORT_C CWlanDeviceSettings* CWlanDeviceSettings::NewL() + { + DEBUG( "CWlanDeviceSettings::NewL()" ); + + CWlanDeviceSettings* self = new (ELeave) CWlanDeviceSettings; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::~CWlanDeviceSettings +// --------------------------------------------------------- +// +EXPORT_C CWlanDeviceSettings::~CWlanDeviceSettings() + { + DEBUG( "CWlanDeviceSettings::~CWlanDeviceSettings()" ); + delete iDefTable; + delete iUsrTable; + delete iDb; + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::GetDefaultSettings +// --------------------------------------------------------- +// +EXPORT_C void CWlanDeviceSettings::GetDefaultSettings( + SWlanDeviceSettings& aSettings ) + { + DEBUG( "CWlanDeviceSettings::GetDefaultSettings()" ); + + aSettings.beacon = KWlanDefaultBeacon; + aSettings.longRetry = KWlanDefaultLongRetryLimit; + aSettings.rts = KWlanDefaultRTSThreshold; + aSettings.shortRetry = KWlanDefaultShortRetryLimit; + aSettings.backgroundScanInterval = KWlanDefaultBackgroundScanInterval; + aSettings.txPowerLevel = KWlanDefaultTxPowerLevel; + aSettings.scanRate = E1Mbps; + aSettings.rcpiTrigger = KWlanDefaultRcpiTrigger; + aSettings.minActiveChannelTime = KWlanDefaultMinChanneltime; + aSettings.maxActiveChannelTime = KWlanDefaultMaxChanneltime; + aSettings.maxTxMSDULifeTime = KWlanDefaultMaxTransmitMSDULifetime; + aSettings.useDefaultSettings = ETrue; + aSettings.scanExpirationTimer = KWlanDefaultScanExpirationTimer; + aSettings.unloadDriverTimer = KWlanDefaultUnloadDriverTimer; + aSettings.roamTimer = KWlanDefaultRoamTimer; + aSettings.rcpiDifference = KWlanDefaultRcpiDifference; + aSettings.connRegainTimer = KWlanDefaultConnRegainTimer; + aSettings.maxTriesToFindNw = KWlanDefaultMaxTriesToFindNw; + aSettings.delayBetweenFindNw = KWlanDefaultDelayBetweenFindNw; + aSettings.powerMode = KWlanDefaultowerMode; + aSettings.allowRadioMeasurements = ETrue; + aSettings.minPassiveChannelTime = KWlanDefaultMinPassiveChannelTime; + aSettings.maxPassiveChannelTime = KWlanDefaultMaxPassiveChannelTime; + aSettings.maxApFailureCount = KWlanDefaultMaxApFailureCount; + aSettings.maxApAuthFailureCount = KWlanDefaultMaxApAuthFailureCount; + aSettings.longBeaconFindCount = KWlanDefaultLongBeaconFindCount; + aSettings.qosNullFrameInterval = KWlanDefaultQosNullFrameInterval; + aSettings.qosNullFrameTimeout = KWlanDefaultQosNullFrameTimeout; + aSettings.keepAliveInterval = KWlanDefaultKeepAliveInterval; + aSettings.scanStopRcpiThreshold = KWlanDefaultScanStopRcpiThreshold; + aSettings.minRcpiForIapAvailability = KWlanDefaultMinRcpiForIapAvailability; + aSettings.qosNullFrameEntryTimeout = KWlanDefaultQoSNullFrameEntryTimeout; + aSettings.maxApDeauthenticationCount = KWlanDefaultMaxApDeauthenticationCount; + aSettings.apDeauthenticationTimeout = KWlanDefaultApDeauthenticationTimeout; + aSettings.showBrokenPowerSaveNote = ETrue; + aSettings.maxDtimSkipInterval = KWlanDefaultMaxDtimSkipInterval; + aSettings.psActiveToLightTimeout = KWlanDefaultPsActiveToLightTimeout; + aSettings.psActiveToLightThreshold = KWlanDefaultPsActiveToLightThreshold; + aSettings.psLightToActiveTimeout = KWlanDefaultPsLightToActiveTimeout; + aSettings.psLightToActiveThreshold = KWlanDefaultPsLightToActiveThreshold; + aSettings.psLightToDeepTimeout = KWlanDefaultPsLightToDeepTimeout; + aSettings.psLightToDeepThreshold = KWlanDefaultPsLightToDeepThreshold; + aSettings.psUapsdRxThreshold = KWlanDefaultPsUapsdRxFrameLengthThreshold; + aSettings.rcpiRoamMinInterval = KWlanDefaultRcpiRoamMinInterval; + aSettings.rcpiRoamMaxInterval = KWlanDefaultRcpiRoamMaxInterval; + aSettings.rcpiRoamAttemptsPerInterval = KWlanDefaultRcpiRoamAttemptsPerInterval; + aSettings.rcpiRoamNextIntervalFactor = KWlanDefaultRcpiRoamNextIntervalFactor; + aSettings.rcpiRoamNextIntervalAddition = KWlanDefaultRcpiRoamNextIntervalAddition; + aSettings.scanListExpirationTime = KWlanDefaultScanListExpirationTime; + aSettings.qosNullFrameEntryTxCount = KWlanDefaultQoSNullFrameEntryTxCount; + aSettings.spRcpiTarget = KWlanDefaultSpRcpiTarget; + aSettings.spTimeTarget = KWlanDefaultSpTimeTarget; + aSettings.spMinIndicationInterval = KWlanDefaultSpMinIndicationInterval; + aSettings.bssLostRoamMinInterval = KWlanDefaultBssLostRoamMinInterval; + aSettings.bssLostRoamMaxInterval = KWlanDefaultBssLostRoamMaxInterval; + aSettings.bssLostRoamAttemptsPerInterval = KWlanDefaultBssLostRoamAttemptsPerInterval; + aSettings.bssLostRoamNextIntervalFactor = KWlanDefaultBssLostRoamNextIntervalFactor; + aSettings.bssLostRoamNextIntervalAddition = KWlanDefaultBssLostRoamNextIntervalAddition; + aSettings.bssLostRoamMaxTriesToFindNw = KWlanDefaultBssLostRoamMaxTriesToFindNw; + aSettings.trafficStreamCreationTimeout = KWlanDefaultTrafficStreamCreationTimeout; + aSettings.beaconLostThreshold = KWlanDefaultBeaconLostThreshold; + aSettings.btBeaconLostThreshold = KWlanDefaultBtBeaconLostThreshold; + aSettings.txFailThreshold = KWlanDefaultTxFailThreshold; + aSettings.btTxFailThreshold = KWlanDefaultBtTxFailThreshold; + aSettings.powerSaveDelay = KWlanDefaultPowerSaveDelay; + aSettings.regionExpirationTime = KWlanDefaultRegionExpirationTime; + aSettings.rrmMinMeasurementInterval = KWlanDefaultRrmMinMeasurementInterval; + aSettings.psmServerMode = KWlanDefaultPsmServerMode; + aSettings.bgScanPeakPeriodStart = KWlanDefaultBgScanPeakPeriodStart; + aSettings.bgScanPeakPeriodEnd = KWlanDefaultBgScanPeakPeriodEnd; + aSettings.bgScanIntervalPeak = KWlanDefaultBgScanIntervalPeakPeriod; + aSettings.bgScanIntervalOffPeak = KWlanDefaultBgScanIntervalOffPeakPeriod; + aSettings.automaticTrafficStreamMgmt = ETrue; + aSettings.region = KWlanDefaultRegion; + aSettings.regionTimestamp = KWlanDefaultRegionTimestamp; + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::ReadL +// Read data from CommDB and copies it to the parameter. +// --------------------------------------------------------- +// +EXPORT_C void CWlanDeviceSettings::ReadL( SWlanDeviceSettings& aSettings ) + { + DEBUG( "CWlanDeviceSettings::ReadL()" ); + + ReadL( EFalse, aSettings ); + if ( aSettings.useDefaultSettings ) + { + ReadL( ETrue, aSettings ); + } + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::ReadL +// Read data from CommDB and copies it to the parameter. +// --------------------------------------------------------- +// +EXPORT_C void CWlanDeviceSettings::ReadL( + TBool aGetDefaultSettings, + SWlanDeviceSettings& aSettings ) + { + DEBUG1( "CWlanDeviceSettings::ReadL() - GetDefaultSettings == %u", + aGetDefaultSettings ); + + // Initialize to hard coded default values + GetDefaultSettings( aSettings ); + + // Read private settings from CenRep + ReadPrivateData( aSettings ); + + DEBUG( "CWlanDeviceSettings::ReadL() - private data read!" ); + + // Start reading CommsDat + // Both tables has to been found + User::LeaveIfNull( iDefTable ); + User::LeaveIfNull( iUsrTable ); + + CCommsDbTableView* table; + if ( aGetDefaultSettings ) + { + table = iDefTable; + } + else + { + table = iUsrTable; + } + + // Read (and convert enumerated) data. + // NOTE! backgroundScanInterval is + // always read from user table because they are not part of + // advanced settings. + // + iUsrTable->ReadUintL( KBgScanInterval, aSettings.backgroundScanInterval ); + table->ReadBoolL( KUseDefaultSettings, aSettings.useDefaultSettings ); + table->ReadUintL( KWlanLongRetry, aSettings.longRetry ); + table->ReadUintL( KWlanShortRetry, aSettings.shortRetry ); + table->ReadUintL( KWlanRTSThreshold, aSettings.rts ); + table->ReadUintL( KWlanTxPowerLevel, aSettings.txPowerLevel ); + table->ReadBoolL( KWlanAllowRadioMeasurements, aSettings.allowRadioMeasurements ); + table->ReadUintL( KWlanPowerMode, aSettings.powerMode ); + DEBUG( "CWlanDeviceSettings::ReadL() - done" ); + +#ifdef _DEBUG +// LogSettings( aSettings ); +#endif // _DEBUG + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::WriteL +// Save data to CommDB. +// --------------------------------------------------------- +// +EXPORT_C void CWlanDeviceSettings::WriteL( + const SWlanDeviceSettings& aSettings) + { + DEBUG( "CWlanDeviceSettings::WriteL()" ); + + // Write private settings to CenRep + WritePrivateData( aSettings ); + + // Write CommsDat settings + User::LeaveIfNull( iUsrTable ); + User::LeaveIfError( iUsrTable->UpdateRecord() ); // Begin changes. + + iUsrTable->WriteUintL( KBgScanInterval, aSettings.backgroundScanInterval ); + iUsrTable->WriteBoolL( KUseDefaultSettings, aSettings.useDefaultSettings ); + iUsrTable->WriteUintL( KWlanLongRetry, aSettings.longRetry ); + iUsrTable->WriteUintL( KWlanShortRetry, aSettings.shortRetry ); + iUsrTable->WriteUintL( KWlanRTSThreshold, aSettings.rts ); + iUsrTable->WriteUintL( KWlanTxPowerLevel, aSettings.txPowerLevel ); + iUsrTable->WriteBoolL( KWlanAllowRadioMeasurements, aSettings.allowRadioMeasurements ); + iUsrTable->WriteUintL( KWlanPowerMode, aSettings.powerMode ); + + TInt err = iUsrTable->PutRecordChanges(); // End and save changes. + + if( err == KErrLocked ) + { + for( TInt retryCount = 1; retryCount <= KMaxCommsDbWriteAttempts; retryCount++ ) + { + DEBUG2( "CWlanDeviceSettings::WriteL() - CommsDb locked, waiting for %u us before retrying, retryCount: %u", + KRetryIntervalUsIfCommsDbLocked, + retryCount ); + User::After( TTimeIntervalMicroSeconds32( KRetryIntervalUsIfCommsDbLocked ) ); + err = iUsrTable->PutRecordChanges(); + if( err != KErrLocked ) + { + break; + } + } + } + + User::LeaveIfError( err ); + + DEBUG( "CWlanDeviceSettings::WriteL() - done" ); + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::ReadPrivateData +// --------------------------------------------------------- +// +TInt CWlanDeviceSettings::ReadPrivateData( SWlanDeviceSettings& aSettings ) + { + DEBUG( "CWlanDeviceSettings::ReadPrivateData()" ); + + TInt err = KErrNone; + CRepository* repository = NULL; + TRAP( err, repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ) ); + if( err != KErrNone ) + { + DEBUG1( "CWlanDeviceSettings::ReadPrivateData() - Could not access repository (%d), using hardcoded values", err ); + return err; + } + // No need to use CleanupStack because no possibility to leave + + // Read KWlanBeacon + TInt temp = 0; + err = repository->Get( KWlanBeacon, temp ); + if( err == KErrNone ) + { + aSettings.beacon = temp; + } + + // Read KWlanScanRate + err = repository->Get( KWlanScanRate, temp ); + if( err == KErrNone ) + { + aSettings.scanRate = static_cast( temp ); + } + + // Read KWlanRcpiTrigger + err = repository->Get( KWlanRcpiTrigger, temp ); + if( err == KErrNone ) + { + aSettings.rcpiTrigger = temp; + } + + // Read KWlanMinActiveChannelTime + err = repository->Get( KWlanMinActiveChannelTime, temp ); + if( err == KErrNone ) + { + aSettings.minActiveChannelTime = temp; + } + + // Read KWlanMaxActiveChannelTime + err = repository->Get( KWlanMaxActiveChannelTime, temp ); + if( err == KErrNone ) + { + aSettings.maxActiveChannelTime = temp; + } + + // Read KWlanMaxTxMSDULifeTime + err = repository->Get( KWlanMaxTxMSDULifeTime, temp ); + if( err == KErrNone ) + { + aSettings.maxTxMSDULifeTime = temp; + } + + // Read KWlanScanExpirationTimer + err = repository->Get( KWlanScanExpirationTimer, temp ); + if( err == KErrNone ) + { + aSettings.scanExpirationTimer = temp; + } + + // Read KWlanUnloadDriverTimer + err = repository->Get( KWlanUnloadDriverTimer, temp ); + if( err == KErrNone ) + { + aSettings.unloadDriverTimer = temp; + } + + // Read KWlanRoamTimer + err = repository->Get( KWlanRoamTimer, temp ); + if( err == KErrNone ) + { + aSettings.roamTimer = temp; + } + + // Read KWlanRcpiDifference + err = repository->Get( KWlanRcpiDifference, temp ); + if( err == KErrNone ) + { + aSettings.rcpiDifference = temp; + } + + // Read KWlanConnRegainTimer + err = repository->Get( KWlanConnRegainTimer, temp ); + if( err == KErrNone ) + { + aSettings.connRegainTimer = temp; + } + + // Read KWlanMaxTriesToFindNw + err = repository->Get( KWlanMaxTriesToFindNw, temp ); + if( err == KErrNone ) + { + aSettings.maxTriesToFindNw = temp; + } + + // Read KWlanDelayBetweenFindNw + err = repository->Get( KWlanDelayBetweenFindNw, temp ); + if( err == KErrNone ) + { + aSettings.delayBetweenFindNw = temp; + } + + // Read KWlanMinPassiveChannelTime + err = repository->Get( KWlanMinPassiveChannelTime, temp ); + if( err == KErrNone ) + { + aSettings.minPassiveChannelTime = temp; + } + + // Read KWlanMaxPassiveChannelTime + err = repository->Get( KWlanMaxPassiveChannelTime, temp ); + if( err == KErrNone ) + { + aSettings.maxPassiveChannelTime = temp; + } + + // Read KWlanMaxApFailureCount + err = repository->Get( KWlanMaxApFailureCount, temp ); + if( err == KErrNone ) + { + aSettings.maxApFailureCount = temp; + } + + // Read KWlanLongBeaconFindCount + err = repository->Get( KWlanLongBeaconFindCount, temp ); + if( err == KErrNone ) + { + aSettings.longBeaconFindCount = temp; + } + + // Read KWlanQosNullFrameInterval + err = repository->Get( KWlanQosNullFrameInterval, temp ); + if( err == KErrNone ) + { + aSettings.qosNullFrameInterval = temp; + } + + // Read KWlanQosNullFrameTimeout + err = repository->Get( KWlanQosNullFrameTimeout, temp ); + if( err == KErrNone ) + { + aSettings.qosNullFrameTimeout = temp; + } + + // Read KWlanKeepAliveInterval + err = repository->Get( KWlanKeepAliveInterval, temp ); + if( err == KErrNone ) + { + aSettings.keepAliveInterval = temp; + } + + // Read KWlanScanStopRcpiThreshold + err = repository->Get( KWlanScanStopRcpiThreshold, temp ); + if( err == KErrNone ) + { + aSettings.scanStopRcpiThreshold = temp; + } + + // Read KWlanMinRcpiForIapAvailability + err = repository->Get( KWlanMinRcpiForIapAvailability, temp ); + if( err == KErrNone ) + { + aSettings.minRcpiForIapAvailability = temp; + } + + // Read KWlanQoSNullFrameEntryTimeout + err = repository->Get( KWlanQoSNullFrameEntryTimeout, temp ); + if( err == KErrNone ) + { + aSettings.qosNullFrameEntryTimeout = temp; + } + + // Read KWlanMaxApDeauthenticationCount + err = repository->Get( KWlanMaxApDeauthenticationCount, temp ); + if( err == KErrNone ) + { + aSettings.maxApDeauthenticationCount = temp; + } + + // Read KWlanApDeauthenticationTimeout + err = repository->Get( KWlanApDeauthenticationTimeout, temp ); + if( err == KErrNone ) + { + aSettings.apDeauthenticationTimeout = temp; + } + + // Read KWlanShowBrokenPowerSaveNote + err = repository->Get( KWlanShowBrokenPowerSaveNote, temp ); + if( err == KErrNone ) + { + aSettings.showBrokenPowerSaveNote = static_cast( temp ); + } + + // Read KWlanMaxDtimSkipInterval + err = repository->Get( KWlanMaxDtimSkipInterval, temp ); + if( err == KErrNone ) + { + aSettings.maxDtimSkipInterval = temp; + } + + // Read KWlanPsActiveToLightTimeout + err = repository->Get( KWlanPsActiveToLightTimeout, temp ); + if( err == KErrNone ) + { + aSettings.psActiveToLightTimeout = temp; + } + + // Read KWlanPsActiveToLightThreshold + err = repository->Get( KWlanPsActiveToLightThreshold, temp ); + if( err == KErrNone ) + { + aSettings.psActiveToLightThreshold = temp; + } + + // Read KWlanPsLightToActiveTimeout + err = repository->Get( KWlanPsLightToActiveTimeout, temp ); + if( err == KErrNone ) + { + aSettings.psLightToActiveTimeout = temp; + } + + // Read KWlanPsLightToActiveThreshold + err = repository->Get( KWlanPsLightToActiveThreshold, temp ); + if( err == KErrNone ) + { + aSettings.psLightToActiveThreshold = temp; + } + + // Read KWlanPsLightToDeepTimeout + err = repository->Get( KWlanPsLightToDeepTimeout, temp ); + if( err == KErrNone ) + { + aSettings.psLightToDeepTimeout = temp; + } + + // Read KWlanPsLightToDeepThreshold + err = repository->Get( KWlanPsLightToDeepThreshold, temp ); + if( err == KErrNone ) + { + aSettings.psLightToDeepThreshold = temp; + } + + // Read KWlanPsUapsdRxFrameLengthThreshold + err = repository->Get( KWlanPsUapsdRxFrameLengthThreshold, temp ); + if( err == KErrNone ) + { + aSettings.psUapsdRxThreshold = temp; + } + + // Read KWlanRcpiRoamMinInterval + err = repository->Get( KWlanRcpiRoamMinInterval, temp ); + if( err == KErrNone ) + { + aSettings.rcpiRoamMinInterval = temp; + } + + // Read KWlanRcpiRoamMaxInterval + err = repository->Get( KWlanRcpiRoamMaxInterval, temp ); + if( err == KErrNone ) + { + aSettings.rcpiRoamMaxInterval = temp; + } + + // Read KWlanRcpiRoamAttemptsPerInterval + err = repository->Get( KWlanRcpiRoamAttemptsPerInterval, temp ); + if( err == KErrNone ) + { + aSettings.rcpiRoamAttemptsPerInterval = temp; + } + + // Read KWlanRcpiRoamNextIntervalFactor + err = repository->Get( KWlanRcpiRoamNextIntervalFactor, temp ); + if( err == KErrNone ) + { + aSettings.rcpiRoamNextIntervalFactor = temp; + } + + // Read KWlanRcpiRoamNextIntervalAddition + err = repository->Get( KWlanRcpiRoamNextIntervalAddition, temp ); + if( err == KErrNone ) + { + aSettings.rcpiRoamNextIntervalAddition = temp; + } + + // Read KWlanScanListExpirationTime + err = repository->Get( KWlanScanListExpirationTime, temp ); + if( err == KErrNone ) + { + aSettings.scanListExpirationTime = temp; + } + + // Read KWlanQoSNullFrameEntryTxCount + err = repository->Get( KWlanQoSNullFrameEntryTxCount, temp ); + if( err == KErrNone ) + { + aSettings.qosNullFrameEntryTxCount = temp; + } + + // Read KWlanSpRcpiTarget + err = repository->Get( KWlanSpRcpiTarget, temp ); + if( err == KErrNone ) + { + aSettings.spRcpiTarget = temp; + } + + // Read KWlanSpTimeTarget + err = repository->Get( KWlanSpTimeTarget, temp ); + if( err == KErrNone ) + { + aSettings.spTimeTarget = temp; + } + + // Read KWlanSpMinIndicationInterval + err = repository->Get( KWlanSpMinIndicationInterval, temp ); + if( err == KErrNone ) + { + aSettings.spMinIndicationInterval = temp; + } + + // Read KWlanBssLostRoamMinInterval + err = repository->Get( KWlanBssLostRoamMinInterval, temp ); + if( err == KErrNone ) + { + aSettings.bssLostRoamMinInterval = temp; + } + + // Read KWlanBssLostRoamMaxInterval + err = repository->Get( KWlanBssLostRoamMaxInterval, temp ); + if( err == KErrNone ) + { + aSettings.bssLostRoamMaxInterval = temp; + } + + // Read KWlanBssLostRoamAttemptsPerInterval + err = repository->Get( KWlanBssLostRoamAttemptsPerInterval, temp ); + if( err == KErrNone ) + { + aSettings.bssLostRoamAttemptsPerInterval = temp; + } + + // Read KWlanBssLostRoamNextIntervalFactor + err = repository->Get( KWlanBssLostRoamNextIntervalFactor, temp ); + if( err == KErrNone ) + { + aSettings.bssLostRoamNextIntervalFactor = temp; + } + + // Read KWlanBssLostRoamNextIntervalAddition + err = repository->Get( KWlanBssLostRoamNextIntervalAddition, temp ); + if( err == KErrNone ) + { + aSettings.bssLostRoamNextIntervalAddition = temp; + } + + // Read KWlanBssLostRoamMaxTriesToFindNw + err = repository->Get( KWlanBssLostRoamMaxTriesToFindNw, temp ); + if( err == KErrNone ) + { + aSettings.bssLostRoamMaxTriesToFindNw = temp; + } + + // Read KWlanTrafficStreamCreationTimeout + err = repository->Get( KWlanTrafficStreamCreationTimeout, temp ); + if( err == KErrNone ) + { + aSettings.trafficStreamCreationTimeout = temp; + } + + // Read KWlanBeaconLostThreshold + err = repository->Get( KWlanBeaconLostThreshold, temp ); + if( err == KErrNone ) + { + aSettings.beaconLostThreshold = temp; + } + + // Read KWlanBtBeaconLostThreshold + err = repository->Get( KWlanBtBeaconLostThreshold, temp ); + if( err == KErrNone ) + { + aSettings.btBeaconLostThreshold = temp; + } + + // Read KWlanTxFailThreshold + err = repository->Get( KWlanTxFailThreshold, temp ); + if( err == KErrNone ) + { + aSettings.txFailThreshold = temp; + } + + // Read KWlanBtTxFailThreshold + err = repository->Get( KWlanBtTxFailThreshold, temp ); + if( err == KErrNone ) + { + aSettings.btTxFailThreshold = temp; + } + + // Read KWlanPowerSaveDelay + err = repository->Get( KWlanPowerSaveDelay, temp ); + if( err == KErrNone ) + { + aSettings.powerSaveDelay = temp; + } + + // Read KWlanRegionExpirationTime + err = repository->Get( KWlanRegionExpirationTime, temp ); + if( err == KErrNone ) + { + aSettings.regionExpirationTime = temp; + } + + // Read KWlanRrmMinMeasurementInterval + err = repository->Get( KWlanRrmMinMeasurementInterval, temp ); + if( err == KErrNone ) + { + aSettings.rrmMinMeasurementInterval = temp; + } + + // Read KWlanPsmSrvMode + err = repository->Get( KWlanPsmSrvMode, temp ); + if( err == KErrNone ) + { + aSettings.psmServerMode = temp; + } + + // Read KWlanBgScanPeakPeriodStart + err = repository->Get( KWlanBgScanPeakPeriodStart, temp ); + if( err == KErrNone ) + { + aSettings.bgScanPeakPeriodStart = temp; + } + + // Read KWlanBgScanPeakPeriodEnd + err = repository->Get( KWlanBgScanPeakPeriodEnd, temp ); + if( err == KErrNone ) + { + aSettings.bgScanPeakPeriodEnd = temp; + } + + // Read KWlanBgScanIntervalPeakPeriod + err = repository->Get( KWlanBgScanIntervalPeakPeriod, temp ); + if( err == KErrNone ) + { + aSettings.bgScanIntervalPeak = temp; + } + + // Read KWlanBgScanIntervalOffPeakPeriod + err = repository->Get( KWlanBgScanIntervalOffPeakPeriod, temp ); + if( err == KErrNone ) + { + aSettings.bgScanIntervalOffPeak = temp; + } + + // Read KWlanAutomaticTrafficStreamMgmt + err = repository->Get( KWlanAutomaticTrafficStreamMgmt, temp ); + if( err == KErrNone ) + { + aSettings.automaticTrafficStreamMgmt = static_cast( temp ); + } + + // Read KWlanRegion + err = repository->Get( KWlanRegion, temp ); + if( err == KErrNone ) + { + aSettings.region = temp; + } + + // Read KWlanRegionTimestamp + err = repository->Get( KWlanRegionTimestamp, temp ); + if( err == KErrNone ) + { + aSettings.regionTimestamp = temp; + } + + // Cleanup + delete repository; + DEBUG( "CWlanDeviceSettings::ReadPrivateData() - done" ); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::WriteCenRepKeyL +// --------------------------------------------------------- +// +EXPORT_C void CWlanDeviceSettings::WriteCenRepKeyL( const TUint32 aKey, const TInt aValue ) const + { + DEBUG2( "CWlanDeviceSettings::WriteCenRepKeyL( aKey: 0x%X, aValue: %d )", aKey, aValue ); + + CRepository* repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ); + + TInt err = repository->Set( aKey, aValue ); + if( err != KErrNone ) + { + DEBUG2( "CWlanDeviceSettings::WriteCenRepKeyL() - Could not set value %d to key 0x%X", aValue, aKey ); + } + + // Cleanup + delete repository; + + User::LeaveIfError( err ); + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::WritePrivateData +// --------------------------------------------------------- +// +TInt CWlanDeviceSettings::WritePrivateData( const SWlanDeviceSettings& aSettings ) + { + DEBUG( "CWlanDeviceSettings::WritePrivateData()" ); + + TInt err = KErrNone; + CRepository* repository = NULL; + TRAP( err, repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ) ); + if( err != KErrNone ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - Could not access repository (%d), not saving", err ); + return err; + } + // No need to use CleanupStack because no possibility to leave + + // Write KWlanBeacon + err = repository->Set( + KWlanBeacon, + static_cast( aSettings.beacon ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBeacon ); + } + + // Write KWlanScanRate + err = repository->Set( + KWlanScanRate, + static_cast( aSettings.scanRate ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanScanRate ); + } + + // Write KWlanRcpiTrigger + err = repository->Set( + KWlanRcpiTrigger, + static_cast( aSettings.rcpiTrigger ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiTrigger ); + } + + // Write KWlanMinActiveChannelTime + err = repository->Set( + KWlanMinActiveChannelTime, + static_cast( aSettings.minActiveChannelTime ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMinActiveChannelTime ); + } + + // Write KWlanMaxActiveChannelTime + err = repository->Set( + KWlanMaxActiveChannelTime, + static_cast( aSettings.maxActiveChannelTime ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxActiveChannelTime ); + } + + // Write KWlanMaxTxMSDULifeTime + err = repository->Set( + KWlanMaxTxMSDULifeTime, + static_cast( aSettings.maxTxMSDULifeTime ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxTxMSDULifeTime ); + } + + // Write KWlanScanExpirationTimer + err = repository->Set( + KWlanScanExpirationTimer, + static_cast( aSettings.scanExpirationTimer ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanScanExpirationTimer ); + } + + // Write KWlanUnloadDriverTimer + err = repository->Set( + KWlanUnloadDriverTimer, + static_cast( aSettings.unloadDriverTimer ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanUnloadDriverTimer ); + } + + // Write KWlanRoamTimer + err = repository->Set( + KWlanRoamTimer, + static_cast( aSettings.roamTimer ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRoamTimer ); + } + + // Write KWlanRcpiDifference + err = repository->Set( + KWlanRcpiDifference, + static_cast( aSettings.rcpiDifference ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiDifference ); + } + + // Write KWlanConnRegainTimer + err = repository->Set( + KWlanConnRegainTimer, + static_cast( aSettings.connRegainTimer ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanConnRegainTimer ); + } + + // Write KWlanMaxTriesToFindNw + err = repository->Set( + KWlanMaxTriesToFindNw, + static_cast( aSettings.maxTriesToFindNw ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxTriesToFindNw ); + } + + // Write KWlanDelayBetweenFindNw + err = repository->Set( + KWlanDelayBetweenFindNw, + static_cast( aSettings.delayBetweenFindNw ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanDelayBetweenFindNw ); + } + + // Write KWlanMinPassiveChannelTime + err = repository->Set( + KWlanMinPassiveChannelTime, + static_cast( aSettings.minPassiveChannelTime ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMinPassiveChannelTime ); + } + + // Write KWlanMaxPassiveChannelTime + err = repository->Set( + KWlanMaxPassiveChannelTime, + static_cast( aSettings.maxPassiveChannelTime ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxPassiveChannelTime ); + } + + // Write KWlanMaxApFailureCount + err = repository->Set( + KWlanMaxApFailureCount, + static_cast( aSettings.maxApFailureCount ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxApFailureCount ); + } + + // Write KWlanLongBeaconFindCount + err = repository->Set( + KWlanLongBeaconFindCount, + static_cast( aSettings.longBeaconFindCount ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanLongBeaconFindCount ); + } + + // Write KWlanQosNullFrameInterval + err = repository->Set( + KWlanQosNullFrameInterval, + static_cast( aSettings.qosNullFrameInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanQosNullFrameInterval ); + } + + // Write KWlanQosNullFrameTimeout + err = repository->Set( + KWlanQosNullFrameTimeout, + static_cast( aSettings.qosNullFrameTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanQosNullFrameTimeout ); + } + + // Write KWlanKeepAliveInterval + err = repository->Set( + KWlanKeepAliveInterval, + static_cast( aSettings.keepAliveInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanKeepAliveInterval ); + } + + // Write KWlanScanStopRcpiThreshold + err = repository->Set( + KWlanScanStopRcpiThreshold, + static_cast( aSettings.scanStopRcpiThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanScanStopRcpiThreshold ); + } + + // Write KWlanMinRcpiForIapAvailability + err = repository->Set( + KWlanMinRcpiForIapAvailability, + static_cast( aSettings.minRcpiForIapAvailability ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMinRcpiForIapAvailability ); + } + + // Write KWlanQoSNullFrameEntryTimeout + err = repository->Set( + KWlanQoSNullFrameEntryTimeout, + static_cast( aSettings.qosNullFrameEntryTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanQoSNullFrameEntryTimeout ); + } + + // Write KWlanMaxApDeauthenticationCount + err = repository->Set( + KWlanMaxApDeauthenticationCount, + static_cast( aSettings.maxApDeauthenticationCount ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxApDeauthenticationCount ); + } + + // Write KWlanApDeauthenticationTimeout + err = repository->Set( + KWlanApDeauthenticationTimeout, + static_cast( aSettings.apDeauthenticationTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanApDeauthenticationTimeout ); + } + + // Write KWlanShowBrokenPowerSaveNote + err = repository->Set( + KWlanShowBrokenPowerSaveNote, + static_cast( aSettings.showBrokenPowerSaveNote ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanShowBrokenPowerSaveNote ); + } + + // Write KWlanMaxDtimSkipInterval + err = repository->Set( + KWlanMaxDtimSkipInterval, + static_cast( aSettings.maxDtimSkipInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanMaxDtimSkipInterval ); + } + + // Write KWlanPsActiveToLightTimeout + err = repository->Set( + KWlanPsActiveToLightTimeout, + static_cast( aSettings.psActiveToLightTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsActiveToLightTimeout ); + } + + // Write KWlanPsActiveToLightThreshold + err = repository->Set( + KWlanPsActiveToLightThreshold, + static_cast( aSettings.psActiveToLightThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsActiveToLightThreshold ); + } + + // Write KWlanPsLightToActiveTimeout + err = repository->Set( + KWlanPsLightToActiveTimeout, + static_cast( aSettings.psLightToActiveTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsLightToActiveTimeout ); + } + + // Write KWlanPsLightToActiveThreshold + err = repository->Set( + KWlanPsLightToActiveThreshold, + static_cast( aSettings.psLightToActiveThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsLightToActiveThreshold ); + } + + // Write KWlanPsLightToDeepTimeout + err = repository->Set( + KWlanPsLightToDeepTimeout, + static_cast( aSettings.psLightToDeepTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsLightToDeepTimeout ); + } + + // Write KWlanPsLightToDeepThreshold + err = repository->Set( + KWlanPsLightToDeepThreshold, + static_cast( aSettings.psLightToDeepThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsLightToDeepThreshold ); + } + + // Write KWlanPsUapsdRxFrameLengthThreshold + err = repository->Set( + KWlanPsUapsdRxFrameLengthThreshold, + static_cast( aSettings.psUapsdRxThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsUapsdRxFrameLengthThreshold ); + } + + // Write KWlanRcpiRoamMinInterval + err = repository->Set( + KWlanRcpiRoamMinInterval, + static_cast( aSettings.rcpiRoamMinInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiRoamMinInterval ); + } + + // Write KWlanRcpiRoamMaxInterval + err = repository->Set( + KWlanRcpiRoamMaxInterval, + static_cast( aSettings.rcpiRoamMaxInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiRoamMaxInterval ); + } + + // Write KWlanRcpiRoamAttemptsPerInterval + err = repository->Set( + KWlanRcpiRoamAttemptsPerInterval, + static_cast( aSettings.rcpiRoamAttemptsPerInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiRoamAttemptsPerInterval ); + } + + // Write KWlanRcpiRoamNextIntervalFactor + err = repository->Set( + KWlanRcpiRoamNextIntervalFactor, + static_cast( aSettings.rcpiRoamNextIntervalFactor ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiRoamNextIntervalFactor ); + } + + // Write KWlanRcpiRoamNextIntervalAddition + err = repository->Set( + KWlanRcpiRoamNextIntervalAddition, + static_cast( aSettings.rcpiRoamNextIntervalAddition ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRcpiRoamNextIntervalAddition ); + } + + // Write KWlanScanListExpirationTime + err = repository->Set( + KWlanScanListExpirationTime, + static_cast( aSettings.scanListExpirationTime ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanScanListExpirationTime ); + } + + // Write KWlanQoSNullFrameEntryTxCount + err = repository->Set( + KWlanQoSNullFrameEntryTxCount, + static_cast( aSettings.qosNullFrameEntryTxCount ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanQoSNullFrameEntryTxCount ); + } + + // Write KWlanSpRcpiTarget + err = repository->Set( + KWlanSpRcpiTarget, + static_cast( aSettings.spRcpiTarget ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanSpRcpiTarget ); + } + + // Write KWlanSpTimeTarget + err = repository->Set( + KWlanSpTimeTarget, + static_cast( aSettings.spTimeTarget ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanSpTimeTarget ); + } + + // Write KWlanSpMinIndicationInterval + err = repository->Set( + KWlanSpMinIndicationInterval, + static_cast( aSettings.spMinIndicationInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanSpMinIndicationInterval ); + } + + // Write KWlanBssLostRoamMinInterval + err = repository->Set( + KWlanBssLostRoamMinInterval, + static_cast( aSettings.bssLostRoamMinInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBssLostRoamMinInterval ); + } + + // Write KWlanBssLostRoamMaxInterval + err = repository->Set( + KWlanBssLostRoamMaxInterval, + static_cast( aSettings.bssLostRoamMaxInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBssLostRoamMaxInterval ); + } + + // Write KWlanBssLostRoamAttemptsPerInterval + err = repository->Set( + KWlanBssLostRoamAttemptsPerInterval, + static_cast( aSettings.bssLostRoamAttemptsPerInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBssLostRoamAttemptsPerInterval ); + } + + // Write KWlanBssLostRoamNextIntervalFactor + err = repository->Set( + KWlanBssLostRoamNextIntervalFactor, + static_cast( aSettings.bssLostRoamNextIntervalFactor ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBssLostRoamNextIntervalFactor ); + } + + // Write KWlanBssLostRoamNextIntervalAddition + err = repository->Set( + KWlanBssLostRoamNextIntervalAddition, + static_cast( aSettings.bssLostRoamNextIntervalAddition ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBssLostRoamNextIntervalAddition ); + } + + // Write KWlanBssLostRoamMaxTriesToFindNw + err = repository->Set( + KWlanBssLostRoamMaxTriesToFindNw, + static_cast( aSettings.bssLostRoamMaxTriesToFindNw ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBssLostRoamMaxTriesToFindNw ); + } + + // Write KWlanTrafficStreamCreationTimeout + err = repository->Set( + KWlanTrafficStreamCreationTimeout, + static_cast( aSettings.trafficStreamCreationTimeout ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanTrafficStreamCreationTimeout ); + } + + // Write KWlanBeaconLostThreshold + err = repository->Set( + KWlanBeaconLostThreshold, + static_cast( aSettings.beaconLostThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBeaconLostThreshold ); + } + + // Write KWlanBtBeaconLostThreshold + err = repository->Set( + KWlanBtBeaconLostThreshold, + static_cast( aSettings.btBeaconLostThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBtBeaconLostThreshold ); + } + + // Write KWlanTxFailThreshold + err = repository->Set( + KWlanTxFailThreshold, + static_cast( aSettings.txFailThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanTxFailThreshold ); + } + + // Write KWlanBtTxFailThreshold + err = repository->Set( + KWlanBtTxFailThreshold, + static_cast( aSettings.btTxFailThreshold ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBtTxFailThreshold ); + } + + // Write KWlanPowerSaveDelay + err = repository->Set( + KWlanPowerSaveDelay, + static_cast( aSettings.powerSaveDelay ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPowerSaveDelay ); + } + + // Write KWlanRrmMinMeasurementInterval + err = repository->Set( + KWlanRrmMinMeasurementInterval, + static_cast( aSettings.rrmMinMeasurementInterval ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRrmMinMeasurementInterval ); + } + + // Write KWlanPsmSrvMode + err = repository->Set( + KWlanPsmSrvMode, + static_cast( aSettings.psmServerMode ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanPsmSrvMode ); + } + + // Write KWlanBgScanPeakPeriodStart + err = repository->Set( + KWlanBgScanPeakPeriodStart, + static_cast( aSettings.bgScanPeakPeriodStart ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBgScanPeakPeriodStart ); + } + + // Write KWlanBgScanPeakPeriodEnd + err = repository->Set( + KWlanBgScanPeakPeriodEnd, + static_cast( aSettings.bgScanPeakPeriodEnd ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBgScanPeakPeriodEnd ); + } + + // Write KWlanBgScanIntervalPeakPeriod + err = repository->Set( + KWlanBgScanIntervalPeakPeriod, + static_cast( aSettings.bgScanIntervalPeak ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBgScanIntervalPeakPeriod ); + } + + // Write KWlanBgScanIntervalOffPeakPeriod + err = repository->Set( + KWlanBgScanIntervalOffPeakPeriod, + static_cast( aSettings.bgScanIntervalOffPeak ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanBgScanIntervalOffPeakPeriod ); + } + + // Write KWlanAutomaticTrafficStreamMgmt + err = repository->Set( + KWlanAutomaticTrafficStreamMgmt, + static_cast( aSettings.automaticTrafficStreamMgmt ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanAutomaticTrafficStreamMgmt ); + } + + // Write KWlanRegion + err = repository->Set( + KWlanRegion, + static_cast( aSettings.region ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRegion ); + } + + // Write KWlanRegionTimestamp + err = repository->Set( + KWlanRegionTimestamp, + static_cast( aSettings.regionTimestamp ) ); + if( err ) + { + DEBUG1( "CWlanDeviceSettings::WritePrivateData() - could not set key 0x%X", KWlanRegionTimestamp ); + } + + // Cleanup + delete repository; + + DEBUG( "CWlanDeviceSettings::WritePrivateData() - done" ); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::CheckWlanDeviceSettingsTableL +// --------------------------------------------------------- +// +void CWlanDeviceSettings::CheckWlanDeviceSettingsTableL() + { + DEBUG( "CWlanDeviceSettings::CheckWlanDeviceSettingsTableL()" ); + + User::LeaveIfNull( iDb ); + + CCommsDbTableView* view; + + // Open view to table where version field matches the current value + view = iDb->OpenViewMatchingUintLC( + KWlanDeviceSettings(), + KTableVersion, + KWlanDeviceSettingsTableVersion ); + + // Check if there's at least one row in the view + User::LeaveIfError( view->GotoFirstRecord() ); + + CleanupStack::PopAndDestroy(view); + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::OpenTableL +// --------------------------------------------------------- +// +void CWlanDeviceSettings::OpenTableL() + { + DEBUG( "CWlanDeviceSettings::OpenTableL()" ); + + User::LeaveIfNull( iDb ); + + // Open default settings. + iDefTable = iDb->OpenViewMatchingUintLC( KWlanDeviceSettings, + KWlanDeviceSettingsType, + KWlanDefaultSettings ); + + CleanupStack::Pop(iDefTable); + + if ( iDefTable->GotoFirstRecord() != KErrNone ) + { + NewRecordL( KWlanDefaultSettings ); + User::LeaveIfError( iDefTable->GotoFirstRecord() ); + } + + // Open user settings. + iUsrTable = iDb->OpenViewMatchingUintLC( KWlanDeviceSettings, + KWlanDeviceSettingsType, + KWlanUserSettings ); + + CleanupStack::Pop(iUsrTable); + + if ( iUsrTable->GotoFirstRecord() != KErrNone ) + { + NewRecordL( KWlanUserSettings ); + User::LeaveIfError( iUsrTable->GotoFirstRecord() ); + } + } + +// --------------------------------------------------------- +// CWlanDeviceSettings::NewRecordL +// --------------------------------------------------------- +// +void CWlanDeviceSettings::NewRecordL( TUint32 aTableType ) + { + DEBUG1( "CWlanDeviceSettings::NewRecordL() Type=%d", aTableType ); + + CCommsDbTableView* table; + if ( aTableType == KWlanDefaultSettings ) + { + table = iDefTable; + } + else + { + table = iUsrTable; + } + + TUint32 id; + User::LeaveIfError( table->InsertRecord( id ) ); + + SWlanDeviceSettings settings; + GetDefaultSettings( settings ); + + table->WriteUintL( KWlanDeviceSettingsType, aTableType ); + table->WriteUintL( KTableVersion, KWlanDeviceSettingsTableVersion ); + table->WriteUintL( KBgScanInterval, settings.backgroundScanInterval ); + table->WriteBoolL( KUseDefaultSettings, settings.useDefaultSettings ); + table->WriteUintL( KWlanLongRetry, settings.longRetry ); + table->WriteUintL( KWlanShortRetry, settings.shortRetry ); + table->WriteUintL( KWlanRTSThreshold, settings.rts ); + table->WriteUintL( KWlanTxPowerLevel, settings.txPowerLevel ); + table->WriteBoolL( KWlanAllowRadioMeasurements, settings.allowRadioMeasurements ); + table->WriteUintL( KWlanPowerMode, settings.powerMode ); + + User::LeaveIfError( table->PutRecordChanges() ); + } + +#ifdef _DEBUG +// --------------------------------------------------------- +// CWlanDeviceSettings::LogSettings +// --------------------------------------------------------- +// +void CWlanDeviceSettings::LogSettings( const SWlanDeviceSettings& aSettings ) const + { + DEBUG1( "CWlanDeviceSettings::LogSettings() - beacon == %u", + aSettings.beacon ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - longRetry == %u", + aSettings.longRetry ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rts == %u", + aSettings.rts ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - shortRetry == %u", + aSettings.shortRetry ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - backgroundScanInterval == %u", + aSettings.backgroundScanInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - txPowerLevel == %u", + aSettings.txPowerLevel ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - scanRate == %u", + static_cast( aSettings.scanRate ) ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rpciTrigger == %u", + aSettings.rcpiTrigger ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - minActiveChannelTime == %u", + aSettings.minActiveChannelTime ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxActiveChannelTime == %u", + aSettings.maxActiveChannelTime ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxTxMSDULifeTime == %u", + aSettings.maxTxMSDULifeTime ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - useDefaultSettings == %u", + aSettings.useDefaultSettings ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - scanExpirationTimer == %u", + aSettings.scanExpirationTimer ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - unloadDriverTimer == %u", + aSettings.unloadDriverTimer ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - roamTimer == %u", + aSettings.roamTimer ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rcpiDifference == %u", + aSettings.rcpiDifference ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - connRegainTimer == %u", + aSettings.connRegainTimer ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxTriesToFindNw == %u", + aSettings.maxTriesToFindNw ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - delayBetweenFindNw == %u", + aSettings.delayBetweenFindNw ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - wlanPowerMode == %u", + aSettings.powerMode ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - allowRadioMeasurements == %u", + aSettings.allowRadioMeasurements ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - minPassiveChannelTime == %u", + aSettings.minPassiveChannelTime ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxPassiveChannelTime == %u", + aSettings.maxPassiveChannelTime ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxApFailureCount == %u", + aSettings.maxApFailureCount ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxApAuthFailureCount == %u", + aSettings.maxApAuthFailureCount ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - longBeaconFindCount == %u", + aSettings.longBeaconFindCount ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - qosNullFrameInterval == %u", + aSettings.qosNullFrameInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - qosNullFrameTimeout == %u", + aSettings.qosNullFrameTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - keepAliveInterval == %u", + aSettings.keepAliveInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - scanStopRcpiThreshold == %u", + aSettings.scanStopRcpiThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - minRcpiForIapAvailability == %u", + aSettings.minRcpiForIapAvailability ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - qosNullFrameEntryTimeout == %u", + aSettings.qosNullFrameEntryTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxApDeauthenticationCount == %u", + aSettings.maxApDeauthenticationCount ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - apDeauthenticationTimeout == %u", + aSettings.apDeauthenticationTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - showBrokenPowerSaveNote == %u", + static_cast( aSettings.showBrokenPowerSaveNote ) ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - maxDtimSkipInterval == %u", + aSettings.maxDtimSkipInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psActiveToLightTimeout == %u", + aSettings.psActiveToLightTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psActiveToLightThreshold == %u", + aSettings.psActiveToLightThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psLightToActiveTimeout == %u", + aSettings.psLightToActiveTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psLightToActiveThreshold == %u", + aSettings.psLightToActiveThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psLightToDeepTimeout == %u", + aSettings.psLightToDeepTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psLightToDeepThreshold == %u", + aSettings.psLightToDeepThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psUapsdRxThreshold == %u", + aSettings.psUapsdRxThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rcpiRoamMinInterval == %u", + aSettings.rcpiRoamMinInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rcpiRoamMaxInterval == %u", + aSettings.rcpiRoamMaxInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rcpiRoamAttemptsPerInterval == %u", + aSettings.rcpiRoamAttemptsPerInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rcpiRoamNextIntervalFactor == %u", + aSettings.rcpiRoamNextIntervalFactor ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rcpiRoamNextIntervalAddition == %u", + aSettings.rcpiRoamNextIntervalAddition ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - scanListExpirationTime == %u", + aSettings.scanListExpirationTime ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - qosNullFrameEntryTxCount == %u", + aSettings.qosNullFrameEntryTxCount ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - spRcpiTarget == %u", + aSettings.spRcpiTarget ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - spTimeTarget == %u", + aSettings.spTimeTarget ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - spMinIndicationInterval == %u", + aSettings.spMinIndicationInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bssLostRoamMinInterval == %u", + aSettings.bssLostRoamMinInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bssLostRoamMaxInterval == %u", + aSettings.bssLostRoamMaxInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bssLostRoamAttemptsPerInterval == %u", + aSettings.bssLostRoamAttemptsPerInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bssLostRoamNextIntervalFactor == %u", + aSettings.bssLostRoamNextIntervalFactor ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bssLostRoamNextIntervalAddition == %u", + aSettings.bssLostRoamNextIntervalAddition ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bssLostRoamMaxTriesToFindNw == %u", + aSettings.bssLostRoamMaxTriesToFindNw ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - trafficStreamCreationTimeout == %u", + aSettings.trafficStreamCreationTimeout ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - beaconLostThreshold == %u", + aSettings.beaconLostThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - btBeaconLostThreshold == %u", + aSettings.btBeaconLostThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - txFailThreshold == %u", + aSettings.txFailThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - btTxFailThreshold == %u", + aSettings.btTxFailThreshold ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - powerSaveDelay == %u", + aSettings.powerSaveDelay ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - rrmMinMeasurementInterval == %u", + aSettings.rrmMinMeasurementInterval ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - psmServerMode == %d", + aSettings.psmServerMode ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bgScanPeakPeriodStart == %d", + aSettings.bgScanPeakPeriodStart ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bgScanPeakPeriodEnd == %d", + aSettings.bgScanPeakPeriodEnd ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bgScanIntervalPeak == %d", + aSettings.bgScanIntervalPeak ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - bgScanIntervalOffPeak == %d", + aSettings.bgScanIntervalOffPeak ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - automaticTrafficStreamMgmt == %u", + static_cast( aSettings.automaticTrafficStreamMgmt ) ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - region == %u", + aSettings.region ); + DEBUG1( "CWlanDeviceSettings::LogSettings() - regionTimestamp == %d", + aSettings.regionTimestamp ); + } +#endif // _DEBUG + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlangenericplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlangenericplugin.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for instantiating Generic WLAN Plugins +* +*/ + + +#include +#include "wlangenericplugin.h" +#include "am_debug.h" + + +// ----------------------------------------------------------------------------- +// CGenericWlanPlugin::CGenericWlanPlugin +// +// ----------------------------------------------------------------------------- +// +CGenericWlanPlugin::CGenericWlanPlugin() + { + DEBUG("CGenericWlanPlugin::CGenericWlanPlugin"); + iPluginArray.Reset(); + } + +// ----------------------------------------------------------------------------- +// CGenericWlanPlugin::~CGenericWlanPlugin +// +// ----------------------------------------------------------------------------- +// +CGenericWlanPlugin::~CGenericWlanPlugin() + { + DEBUG("CGenericWlanPlugin::~CGenericWlanPlugin"); + StopPlugins(); + iPluginArray.Close(); + } + +// ----------------------------------------------------------------------------- +// CGenericWlanPlugin::StopPlugins +// +// ----------------------------------------------------------------------------- +// +void CGenericWlanPlugin::StopPlugins() + { + DEBUG("CGenericWlanPlugin::StopPlugins"); + for (TInt i = 0; i < iPluginArray.Count(); ++i) + { + if ( iPluginArray[i].iActiveScheduler ) + { + DEBUG3("CGenericWlanPlugin::StopPlugins - iPluginArray[%d] = UID: 0x%08X, ActiveScheduler 0x%08X", + i, + iPluginArray[i].iUid, + iPluginArray[i].iActiveScheduler ); + iPluginArray[i].iActiveScheduler->Halt( KErrNone ); + } + } + iPluginArray.Reset(); + } + +// ----------------------------------------------------------------------------- +// CGenericWlanPlugin::StartPlugins +// +// ----------------------------------------------------------------------------- +// +void CGenericWlanPlugin::StartPlugins() + { + DEBUG("CGenericWlanPlugin::StartPlugins"); + + // List implementations + RImplInfoPtrArray implInfoArray; + + TRAPD( listImplementationsError, CGenericWlanPluginClient::ListImplementationsL( implInfoArray ) ); + if ( listImplementationsError ) + { + DEBUG1("CGenericWlanPlugin::StartPlugins - CGenericWlanPluginClient::ListImplementationsL() failed with error %i", listImplementationsError ); + implInfoArray.ResetAndDestroy(); + return; + } + + // Get number of implementations + const TInt pluginCount( implInfoArray.Count() ); + + // Loop implementation info and create instances + for (TInt i = 0; i < pluginCount; i++) + { + // Get next implementation info + CImplementationInformation* info = static_cast(implInfoArray[i] ); + +#ifdef _DEBUG + // Trace information about plugin + DEBUG1( "CGenericWlanPlugin::StartPlugins - Generic WLAN Plugin # %i", i ); + DEBUG1( "CGenericWlanPlugin::StartPlugins - ImplementationUid 0x%08X", info->ImplementationUid().iUid ); + TBuf8 buf8; + buf8.Copy( info->DisplayName() ); + DEBUG1S("CGenericWlanPlugin::StartPlugins - DisplayName ", buf8.Length(), buf8.Ptr() ); + DEBUG1( "CGenericWlanPlugin::StartPlugins - Version %i", info->Version() ); + DEBUG1S("CGenericWlanPlugin::StartPlugins - DataType ", info->DataType().Length(), info->DataType().Ptr() ); + DEBUG1S("CGenericWlanPlugin::StartPlugins - OpaqueData ", info->OpaqueData().Length(), info->OpaqueData().Ptr() ); + DEBUG1( "CGenericWlanPlugin::StartPlugins - RomOnly %i", info->RomOnly() ); + DEBUG1( "CGenericWlanPlugin::StartPlugins - RomBased %i", info->RomBased() ); + DEBUG1( "CGenericWlanPlugin::StartPlugins - VendorId 0x%08X", info->VendorId().iId ); +#endif + CGenericWlanPlugin::TPluginArrayEntry entry; + entry.iUid = info->ImplementationUid(); + // Active scheduler will be updated when thread is started and Active Scheduler is created. + entry.iActiveScheduler = NULL; + iPluginArray.Append( entry ); + + RThread thread; + TInt err = thread.Create( info->DisplayName(), GenericWlanPluginThreadMain, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, + reinterpret_cast( &iPluginArray[ iPluginArray.Count()-1 ] ) /*EOwnerProcess / EOwnerThread*/ ); + if (err != KErrNone) + { + DEBUG1("CGenericWlanPlugin::StartPlugins - thread.Create() failed with error %i", err ); + implInfoArray.ResetAndDestroy(); + return; + } + else + { + thread.Resume(); + } + thread.Close(); + } + + // Reset and destroy implementations infos + implInfoArray.ResetAndDestroy(); + + DEBUG1("CGenericWlanPlugin::StartPlugins - Started plugin count %i", pluginCount ); + } + +// ----------------------------------------------------------------------------- +// CGenericWlanPlugin::GenericWlanPluginThreadMain +// +// ----------------------------------------------------------------------------- +// +TInt CGenericWlanPlugin::GenericWlanPluginThreadMain( TAny* aPluginArrayEntryPtr ) + { + DEBUG("CGenericWlanPlugin::GenericWlanPluginThreadMain()"); + + // Create cleanup stack + CTrapCleanup* cleanup = CTrapCleanup::New(); + if ( !cleanup ) + { + DEBUG("CGenericWlanPlugin::GenericWlanPluginThreadMain() - CTrapCleanup::New() failed. Stopping thread."); + User::Exit( KErrNoMemory ); + } + + __UHEAP_MARK; + + TRAPD(createError, LoadGenericWlanPluginL( reinterpret_cast( aPluginArrayEntryPtr ) ) ); + if ( createError ) + { + return createError; + } + + __UHEAP_MARKEND; + + delete cleanup; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CGenericWlanPlugin::LoadGenericWlanPluginL +// +// ----------------------------------------------------------------------------- +// +void CGenericWlanPlugin::LoadGenericWlanPluginL( TPluginArrayEntry * aPluginArrayEntryPtr ) + { + CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + + aPluginArrayEntryPtr->iActiveScheduler = scheduler; + + // Initialize WLAN plugin + CGenericWlanPluginClient* wlanPluginClient( NULL ); + DEBUG1( "Instantiating CGenericWlanPluginClient(UID 0x%08X)", aPluginArrayEntryPtr->iUid ); + TRAPD( ret, wlanPluginClient = CGenericWlanPluginClient::NewL( aPluginArrayEntryPtr->iUid ) ); + // Create new instance of the plugin + if( ret == KErrNone ) + { + DEBUG1("CGenericWlanPlugin::LoadGenericWlanPluginL() - wlanPluginClient instance 0x%08X", wlanPluginClient); + /* + * This thread will run in CActiveScheduler::Start() until CActiveScheduler is stopped. + */ + DEBUG("CGenericWlanPlugin::LoadGenericWlanPluginL() - Starting CActiveScheduler"); + CActiveScheduler::Start(); + + DEBUG("CGenericWlanPlugin::LoadGenericWlanPluginL() - deleting wlanPluginClient"); + delete wlanPluginClient; + } + else + { + DEBUG1( "CGenericWlanPlugin::LoadGenericWlanPluginL - CGenericWlanPluginClient::NewL leaved with %d, let's ignore it.", ret ); + } + + // Delete active scheduler + CleanupStack::PopAndDestroy(scheduler); + + DEBUG("CGenericWlanPlugin::LoadGenericWlanPluginL() - exit"); + User::Exit( KErrNone ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtcommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtcommandhandler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1055 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles sending management commands to drivers. +* +*/ + +/* +* %version: 37 % +*/ + +// INCLUDES +#include +#include +#include +#include "wlanmgmtcommandhandler.h" +#include "am_debug.h" + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// os_memcpy +// (Declared in 802dot11.h) +// ----------------------------------------------------------------------------- +// +TAny* os_memcpy( + TAny* aDest, + const TAny* aSrc, + TUint32 aLengthinBytes ) + { + Mem::Copy( aDest, aSrc, aLengthinBytes ); + return aDest; + } + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanMgmtCommandHandler::CWlanMgmtCommandHandler( + RWlanLogicalChannel& aChannel, + MWlanMgmtCommandCallback& aClient ): + CActive( CActive::EPriorityStandard ), + iClient( aClient ), + iChannel( aChannel ), + iBuffer( NULL, 0, 0 ) + { + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::NewL +// --------------------------------------------------------- +// +CWlanMgmtCommandHandler* CWlanMgmtCommandHandler::NewL( + RWlanLogicalChannel& aChannel, + MWlanMgmtCommandCallback& aClient ) + { + DEBUG( "CWlanMgmtCommandHandler::NewL()" ); + CWlanMgmtCommandHandler* self = + new(ELeave) CWlanMgmtCommandHandler( aChannel, aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::ConstructL +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::ConstructL() + { + DEBUG( "CWlanMgmtFrameHandler::ConstructL()" ); + + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::~CWlanMgmtCommandHandler +// --------------------------------------------------------- +// +CWlanMgmtCommandHandler::~CWlanMgmtCommandHandler() + { + DEBUG( "CWlanMgmtCommandHandler::~CWlanMgmtCommandHandler()" ); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::StartIBSS +// Start a IBSS network. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::StartIBSS( + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus ) + { + DEBUG( "CWlanMgmtCommandHandler::StartIBSS()" ); + + // First, start the adhoc network synchronously + TStartIBSSMsg msg; + msg.hdr.oid_id = E802_11_START_IBSS; + msg.SSID = aSSID; + msg.beaconInterval = aBeaconInterval; + msg.ATIM = 0; // DEPRECATED, NOT USED ANY MORE + msg.channel = aChannel; + msg.encryptionStatus = aEncryptionStatus; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + SetActive(); + return; + } + + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::Scan +// Receive information about surrounding WLAN networks. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::Scan( + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + const SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aIsSplitScan ) + { + DEBUG( "CWlanMgmtCommandHandler::Scan()" ); + + TScanMsg msg; + msg.hdr.oid_id = E802_11_SCAN; + msg.mode = aMode; + msg.SSID = aSSID; + msg.scanRate = aScanRate; + msg.channels = aChannels; + DEBUG1( "CWlanMgmtCommandHandler::Scan() - aMinChannelTime %u", + aMinChannelTime ); + DEBUG1( "CWlanMgmtCommandHandler::Scan() - aMaxChannelTime %u", + aMaxChannelTime ); + DEBUG1( "CWlanMgmtCommandHandler::Scan() - aIsSplitScan %u", + aIsSplitScan ); + msg.minChannelTime = aMinChannelTime; + msg.maxChannelTime = aMaxChannelTime; + msg.splitScan = aIsSplitScan; + TPckg buf( msg ); + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + SetActive(); + return; + } + + SetActive(); + } + + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::StopScan +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::StopScan() + { + DEBUG( "CWlanMgmtCommandHandler::StopScan()" ); + + TStopScanMsg msg; + msg.hdr.oid_id = E802_11_STOP_SCAN; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::Disconnect +// Disconnect from the WLAN. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::Disconnect() + { + DEBUG( "CWlanMgmtCommandHandler::Disconnect()" ); + + TDisconnectMsg msg; + msg.hdr.oid_id = E802_11_DISCONNECT; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetPowerMode +// Adjust current WLAN power mode. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetPowerMode( + TPowerMode aMode, + TBool aDisableDynamicPs, + TWlanWakeUpInterval aWakeUpModeLight, + TUint8 aListenIntervalLight, + TWlanWakeUpInterval aWakeUpModeDeep, + TUint8 aListenIntervalDeep ) + { + DEBUG( "CWlanMgmtCommandHandler::SetPowerMode()" ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerMode() - aMode = %u ", + aMode ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerMode() - aDisableDynamicPs = %u ", + aDisableDynamicPs ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerMode() - aWakeUpModeLight = %u ", + aWakeUpModeLight ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerMode() - aListenIntervalLight = %u ", + aListenIntervalLight ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerMode() - aWakeUpModeDeep = %u ", + aWakeUpModeDeep ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerMode() - aListenIntervalDeep = %u ", + aListenIntervalDeep ); + + TSetPowerModeMsg msg; + msg.hdr.oid_id = E802_11_SET_POWER_MODE; + msg.powerMode = aMode; + msg.disableDynamicPowerModeManagement = aDisableDynamicPs; + msg.wakeupModeInLightPs = aWakeUpModeLight; + msg.listenIntervalInLightPs = aListenIntervalLight; + msg.wakeupModeInDeepPs = aWakeUpModeDeep; + msg.listenIntervalInDeepPs = aListenIntervalDeep; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetRCPITriggerLevel +// Set RSSI trigger. +// When signal level of the current connection goes below +// this trigger an event is sent by WLAN drivers. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetRCPITriggerLevel( TUint32 aRCPITrigger ) + { + DEBUG( "CWlanMgmtCommandHandler::SetRCPITriggerLevel()" ); + + TSetRcpiTriggerLevelMsg msg; + msg.hdr.oid_id = E802_11_SET_RCPI_TRIGGER_LEVEL; + msg.RcpiTrigger = aRCPITrigger; + + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetTxPowerLevel +// Set WLAN TX power level. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetTxPowerLevel( TUint32 aLevel ) + { + DEBUG( "CWlanMgmtCommandHandler::SetTxPowerLevel()" ); + + TSetTxPowerLevelMsg msg; + msg.hdr.oid_id = E802_11_SET_TX_POWER_LEVEL; + msg.level = aLevel; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::Configure +// Configure WLAN chip. +// This has to been done before the WLAN even scans. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::Configure( + TUint16 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aQoSNullFrameEntryTimeout, + TUint32 aQosNullFrameEntryTxCount, + TUint32 aQoSNullFrameInterval, + TUint32 aQoSNullFrameExitTimeout, + TUint32 aKeepAliveInterval, + TUint32 aSpRcpiTarget, + TUint32 aSpTimeTarget, + TUint32 aSpMinIndicationInterval ) + { + DEBUG( "CWlanMgmtCommandHandler::Configure()" ); + + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aRTSThreshold = %u", + aRTSThreshold ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aMaxTxMSDULifetime = %u", + aMaxTxMSDULifetime ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aQoSNullFrameEntryTimeout = %u", + aQoSNullFrameEntryTimeout ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aQosNullFrameEntryTxCount = %u", + aQosNullFrameEntryTxCount ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aQoSNullFrameInterval = %u", + aQoSNullFrameInterval ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aQoSNullFrameExitTimeout = %u", + aQoSNullFrameExitTimeout ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aKeepAliveInterval = %u", + aKeepAliveInterval ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aSpRcpiTarget = %u", + aSpRcpiTarget ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aSpTimeTarget = %u", + aSpTimeTarget ); + DEBUG1( "CWlanMgmtCommandHandler::Configure() - aSpMinIndicationInterval = %u", + aSpMinIndicationInterval ); + + TConfigureMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE; + msg.RTSThreshold = aRTSThreshold; + msg.maxTxMSDULifetime = aMaxTxMSDULifetime; + msg.voiceCallEntryTimeout = aQoSNullFrameEntryTimeout; + msg.voiceCallEntryTxThreshold = aQosNullFrameEntryTxCount; + msg.voiceNullTimeout = aQoSNullFrameInterval; + msg.noVoiceTimeout = aQoSNullFrameExitTimeout; + msg.keepAliveTimeout = aKeepAliveInterval; + msg.spRcpiIndicationLevel = aSpRcpiTarget; + msg.spTimeToCountPrediction = aSpTimeTarget; + msg.spMinIndicationInterval = aSpMinIndicationInterval; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::GetLastRCPI +// Get the signal quality of the last received packet. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::GetLastRCPI( TUint32& aRCPI ) + { + DEBUG( "CWlanMgmtCommandHandler::GetLastRCPI()" ); + + TGetLastRcpiMsg msg; + msg.hdr.oid_id = E802_11_GET_LAST_RCPI; + TPckg outbuf( msg ); + TPckg inbuf( aRCPI ); + iBuffer.Set( inbuf ); + + TInt err = iChannel.ManagementCommand( outbuf, &iBuffer, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::ConfigureMulticastGroup +// Get the signal quality of the last received packet. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::ConfigureMulticastGroup( + TBool aJoinGroup, + const TMacAddress& aMulticastAddr ) + { + DEBUG( "CWlanMgmtCommandHandler::ConfigureMulticastGroup()" ); + + TInt err = KErrNone; + if( aJoinGroup ) + { + TAddMulticastAddrMsg msg; + msg.hdr.oid_id = E802_11_ADD_MULTICAST_ADDR; + msg.macAddress = aMulticastAddr; + TPckg outbuf( msg ); + err = iChannel.ManagementCommand( outbuf, NULL, &iStatus ); + } + else + { + TRemoveMulticastAddrMsg msg; + msg.hdr.oid_id = E802_11_REMOVE_MULTICAST_ADDR; + msg.macAddress = aMulticastAddr; + msg.removeAll = EFalse; + TPckg outbuf( msg ); + err = iChannel.ManagementCommand( outbuf, NULL, &iStatus ); + } + + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetBssLostParameters +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetBssLostParameters( + TUint32 aBssLostCount, + TUint8 aFailedTxCount ) + { + DEBUG( "CWlanMgmtCommandHandler::SetBssLostParameters()" ); + + TConfigureBssLostMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_BSS_LOST; + msg.beaconLostCount = aBssLostCount; + msg.failedTxPacketCount = aFailedTxCount; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetTxRateAdaptationParameters +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetTxRateAdaptationParameters( + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ) + { + DEBUG( "CWlanMgmtCommandHandler::SetTxRateAdaptationParameters()" ); + + TSetTxRateAdaptationParamsMsg msg; + msg.hdr.oid_id = E802_11_SET_TX_RATE_ADAPT_PARAMS; + msg.minStepUpCheckpoint = aMinStepUpCheckpoint; + msg.maxStepUpCheckpoint = aMaxStepUpCheckpoint; + msg.stepUpCheckpointFactor = aStepUpCheckpointFactor; + msg.stepDownCheckpoint = aStepDownCheckpoint; + msg.minStepUpThreshold = aMinStepUpThreshold; + msg.maxStepUpThreshold = aMaxStepUpThreshold; + msg.stepUpThresholdIncrement = aStepUpThresholdIncrement; + msg.stepDownThreshold = aStepDownThreshold; + msg.disableProbeHandling = aDisableProbeHandling; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetPowerModeMgmtParameters +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetPowerModeMgmtParameters( + TUint32 aActiveToLightTimeout, + TUint16 aActiveToLightThreshold, + TUint32 aLightToActiveTimeout, + TUint16 aLightToActiveThreshold, + TUint32 aLightToDeepTimeout, + TUint16 aLightToDeepThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) + { + DEBUG( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters()" ); + + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aActiveToLightTimeout = %u", + aActiveToLightTimeout ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aActiveToLightThreshold = %u", + aActiveToLightThreshold ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aLightToActiveTimeout = %u", + aLightToActiveTimeout ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aLightToActiveThreshold = %u", + aLightToActiveThreshold ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aLightToDeepTimeout = %u", + aLightToDeepTimeout ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aLightToDeepThreshold = %u", + aLightToDeepThreshold ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerModeMgmtParameters() - aUapsdRxFrameLengthThreshold = %u", + aUapsdRxFrameLengthThreshold ); + + TSetPowerModeMgmtParamsMsg msg; + msg.hdr.oid_id = E802_11_SET_POWER_MODE_MGMT_PARAMS; + msg.toLightPsTimeout = aActiveToLightTimeout; + msg.toLightPsFrameThreshold = aActiveToLightThreshold; + msg.toActiveTimeout = aLightToActiveTimeout; + msg.toActiveFrameThreshold = aLightToActiveThreshold; + msg.toDeepPsTimeout = aLightToDeepTimeout; + msg.toDeepPsFrameThreshold = aLightToDeepThreshold; + msg.uapsdRxFrameLengthThreshold = aUapsdRxFrameLengthThreshold; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetTxRatePolicies +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetTxRatePolicies( + const TTxRatePolicy& aRatePolicies, + const THtMcsPolicy& aMcsPolicies, + const TQueue2RateClass& aMappings, + const TInitialMaxTxRate4RateClass& aInitialRates, + const TTxAutoRatePolicy& aAutoRatePolicies ) + { + DEBUG( "CWlanMgmtCommandHandler::SetTxRatePolicies()" ); + + TConfigureTxRatePoliciesMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_TX_RATE_POLICIES; + msg.ratePolicy = aRatePolicies; + Mem::Copy( + &msg.htMcsPolicy[0][0], + &aMcsPolicies[0][0], + sizeof( msg.htMcsPolicy ) ); + Mem::Copy( + &msg.queue2RateClass[0], + &aMappings[0], + sizeof( msg.queue2RateClass ) ); + Mem::Copy( + &msg.initialMaxTxRate4RateClass[0], + &aInitialRates[0], + sizeof( msg.initialMaxTxRate4RateClass ) ); + Mem::Copy( + &msg.autoRatePolicy[0], + &aAutoRatePolicies[0], + sizeof( msg.autoRatePolicy ) ); + TPckg buf( msg ); + +#ifdef _DEBUG + DEBUG( "----------------------------------------------" ); + for ( TUint idx( 0 ); idx < msg.ratePolicy.numOfPolicyObjects; ++idx ) + { + DEBUG1( "TX rate policy ID %u", idx ); + DEBUG1( "TX rate policy for 54 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy54 ); + DEBUG1( "TX rate policy for 48 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy48 ); + DEBUG1( "TX rate policy for 36 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy36 ); + DEBUG1( "TX rate policy for 33 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy33 ); + DEBUG1( "TX rate policy for 24 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy24 ); + DEBUG1( "TX rate policy for 22 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy22 ); + DEBUG1( "TX rate policy for 18 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy18 ); + DEBUG1( "TX rate policy for 12 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy12 ); + DEBUG1( "TX rate policy for 11 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy11 ); + DEBUG1( "TX rate policy for 9 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy9 ); + DEBUG1( "TX rate policy for 6 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy6 ); + DEBUG1( "TX rate policy for 5.5 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy5_5 ); + DEBUG1( "TX rate policy for 2 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy2 ); + DEBUG1( "TX rate policy for 1 Mbit/s: %u", msg.ratePolicy.txRateClass[idx].txPolicy1 ); + DEBUG1( "TX rate policy shortRetryLimit: %u", msg.ratePolicy.txRateClass[idx].shortRetryLimit ); + DEBUG1( "TX rate policy longRetryLimit: %u", msg.ratePolicy.txRateClass[idx].longRetryLimit ); + DEBUG1( "TX rate policy flags: 0x%08X", msg.ratePolicy.txRateClass[idx].flags ); + DEBUG1( "TX rate policy initial rate: 0x%08X", msg.initialMaxTxRate4RateClass[idx] ); + DEBUG1( "TX auto rate policy rate mask: 0x%08X", msg.autoRatePolicy[idx] ); + DEBUG( " " ); + } + + DEBUG1( "Access Class ELegacy points to policy ID %u", msg.queue2RateClass[ELegacy] ); + DEBUG1( "Access Class EBackGround points to policy ID %u", msg.queue2RateClass[EBackGround] ); + DEBUG1( "Access Class EVideo points to policy ID %u", msg.queue2RateClass[EVideo] ); + DEBUG1( "Access Class EVoice points to policy ID %u", msg.queue2RateClass[EVoice] ); + DEBUG( "----------------------------------------------" ); +#endif // _DEBUG + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::GetPacketStatistics +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::GetPacketStatistics( + TStatisticsResponse& aStatistics ) + { + DEBUG( "CWlanMgmtCommandHandler::GetPacketStatistics()" ); + + TGetFrameStatisticsMsg msg; + msg.hdr.oid_id = E802_11_GET_FRAME_STATISTICS; + TPckg outbuf( msg ); + TPckg inbuf( aStatistics ); + iBuffer.Set( inbuf ); + + TInt err = iChannel.ManagementCommand( outbuf, &iBuffer, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetUapsdSettings +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetUapsdSettings( + TMaxServicePeriodLength aMaxServicePeriodLength, + TBool aUapsdEnabledForVoice, + TBool aUapsdEnabledForVideo, + TBool aUapsdEnabledForBestEffort, + TBool aUapsdEnabledForBackground ) + { + DEBUG( "CWlanMgmtCommandHandler::SetUapsdSettings()" ); + + TConfigureUapsdMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_UAPSD; + msg.maxServicePeriodLength = aMaxServicePeriodLength; + msg.uapsdForVoice = aUapsdEnabledForVoice; + msg.uapsdForVideo = aUapsdEnabledForVideo; + msg.uapsdForBestEffort = aUapsdEnabledForBestEffort; + msg.uapsdForBackground = aUapsdEnabledForBackground; + TPckg buf( msg ); + +#ifdef _DEBUG + DEBUG1( "CWlanMgmtCommandHandler::SetUapsdSettings() - maxServicePeriodLength: 0x%02X", + msg.maxServicePeriodLength ); + DEBUG1( "CWlanMgmtCommandHandler::SetUapsdSettings() - uapsdForVoice: %u", + msg.uapsdForVoice ); + DEBUG1( "CWlanMgmtCommandHandler::SetUapsdSettings() - uapsdForVideo: %u", + msg.uapsdForVideo ); + DEBUG1( "CWlanMgmtCommandHandler::SetUapsdSettings() - uapsdForBestEffort: %u", + msg.uapsdForBestEffort ); + DEBUG1( "CWlanMgmtCommandHandler::SetUapsdSettings() - uapsdForBackground: %u", + msg.uapsdForBackground ); +#endif // _DEBUG + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetPowerSaveSettings +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetPowerSaveSettings( + TBool aStayInUapsdPsModeForVoice, + TBool aStayInUapsdPsModeForVideo, + TBool aStayInUapsdPsModeForBestEffort, + TBool aStayInUapsdPsModeForBackground, + TBool aStayInLegacyPsModeForVoice, + TBool aStayInLegacyPsModeForVideo, + TBool aStayInLegacyPsModeForBestEffort, + TBool aStayInLegacyPsModeForBackground ) + { + DEBUG( "CWlanMgmtCommandHandler::SetPowerSaveSettings()" ); + + TConfigurePwrModeMgmtTrafficOverrideMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_PWR_MODE_MGMT_TRAFFIC_OVERRIDE; + msg.stayInPsDespiteUapsdVoiceTraffic = aStayInUapsdPsModeForVoice; + msg.stayInPsDespiteUapsdVideoTraffic = aStayInUapsdPsModeForVideo; + msg.stayInPsDespiteUapsdBestEffortTraffic = aStayInUapsdPsModeForBestEffort; + msg.stayInPsDespiteUapsdBackgroundTraffic = aStayInUapsdPsModeForBackground; + msg.stayInPsDespiteLegacyVoiceTraffic = aStayInLegacyPsModeForVoice; + msg.stayInPsDespiteLegacyVideoTraffic = aStayInLegacyPsModeForVideo; + msg.stayInPsDespiteLegacyBestEffortTraffic = aStayInLegacyPsModeForBestEffort; + msg.stayInPsDespiteLegacyBackgroundTraffic = aStayInLegacyPsModeForBackground; + TPckg buf( msg ); + +#ifdef _DEBUG + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteUapsdVoiceTraffic: %u", + msg.stayInPsDespiteUapsdVoiceTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteUapsdVideoTraffic: %u", + msg.stayInPsDespiteUapsdVideoTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteUapsdBestEffortTraffic: %u", + msg.stayInPsDespiteUapsdBestEffortTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteUapsdBackgroundTraffic: %u", + msg.stayInPsDespiteUapsdBackgroundTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteLegacyVoiceTraffic: %u", + msg.stayInPsDespiteLegacyVoiceTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteLegacyVideoTraffic: %u", + msg.stayInPsDespiteLegacyVideoTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteLegacyBestEffortTraffic: %u", + msg.stayInPsDespiteLegacyBestEffortTraffic ); + DEBUG1( "CWlanMgmtCommandHandler::SetPowerSaveSettings() - stayInPsDespiteLegacyBackgroundTraffic: %u", + msg.stayInPsDespiteLegacyBackgroundTraffic ); +#endif // _DEBUG + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetTxQueueParameters +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetTxQueueParameters( + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ) + { + DEBUG( "CWlanMgmtCommandHandler::SetTxQueueParameters()" ); + + TConfigureTxQueueMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_TX_QUEUE; + msg.queueId = aQueueId; + msg.mediumTime = aMediumTime; + msg.maxTxMSDULifetime = aMaxTxMSDULifetime; + TPckg buf( msg ); + +#ifdef _DEBUG + DEBUG1( "CWlanMgmtCommandHandler::SetTxQueueParameters() - queueId: %u", + msg.queueId ); + DEBUG1( "CWlanMgmtCommandHandler::SetTxQueueParameters() - mediumTime: %u", + msg.mediumTime ); + DEBUG1( "CWlanMgmtCommandHandler::SetTxQueueParameters() - maxTxMSDULifetime: %u", + msg.maxTxMSDULifetime ); +#endif // _DEBUG + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetBlockAckUsage +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetBlockAckUsage( + TUint8 aTxUsage, + TUint8 aRxUsage ) + { + DEBUG( "CWlanMgmtCommandHandler::SetBlockAckUsage()" ); + + TConfigureHtBlockAckMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_HT_BLOCK_ACK; + msg.iTxBlockAckUsage = aTxUsage; + msg.iRxBlockAckUsage = aRxUsage; + TPckg buf( msg ); + + DEBUG1( "CWlanMgmtCommandHandler::SetRcpiTriggerLevel() - aTxUsage is 0x%02X", + aTxUsage ); + DEBUG1( "CWlanMgmtCommandHandler::SetRcpiTriggerLevel() - aRxUsage is 0x%02X", + aRxUsage ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetSnapHeaderFilter +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetSnapHeaderFilter( + TSnapHeader aHeader ) + { + DEBUG( "CWlanMgmtCommandHandler::SetSnapHeaderFilter()" ); + + TConfigureProprietarySnapHdrMsg msg; + msg.hdr.oid_id = E802_11_CONFIGURE_PROPRIETARY_SNAP_HDR; + msg.snapHdr = aHeader; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::SetRcpiTriggerLevel +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::SetRcpiTriggerLevel( + TUint8 aTriggerLevel ) + { + DEBUG( "CWlanMgmtCommandHandler::SetRcpiTriggerLevel()" ); + + TSetRcpiTriggerLevelMsg msg; + msg.hdr.oid_id = E802_11_SET_RCPI_TRIGGER_LEVEL; + msg.RcpiTrigger = aTriggerLevel; + TPckg buf( msg ); + + DEBUG1( "CWlanMgmtCommandHandler::SetRcpiTriggerLevel() - aTriggerLevel is %u", + aTriggerLevel ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::DisableUserData +// Block user data. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::DisableUserData() + { + DEBUG( "CWlanMgmtCommandHandler::DisableUserData()" ); + + TDisableUserDataMsg msg; + msg.hdr.oid_id = E802_11_DISABLE_USER_DATA; + + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::EnableUserData +// Pass user data through. +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::EnableUserData() + { + DEBUG( "CWlanMgmtCommandHandler::EnableUserData()" ); + + TEnableUserDataMsg msg; + msg.hdr.oid_id = E802_11_ENABLE_USER_DATA; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::AddCipherKey +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::AddCipherKey( + TWlanCipherSuite aCipherSuite, + TUint8 aKeyIndex, + TUint32 aLength, + const TUint8* aData, + const TMacAddress& aMacAddr, + TBool aUseAsDefault ) + { + DEBUG( "CWlanMgmtCommandHandler::AddCipherKey()" ); + + DEBUG1( "CWlanMgmtCommandHandler::AddCipherKey() - aCipherSuite = %u", + aCipherSuite ); + DEBUG1( "CWlanMgmtCommandHandler::AddCipherKey() - aKeyIndex = %u", + aKeyIndex ); + DEBUG1( "CWlanMgmtCommandHandler::AddCipherKey() - aUseAsDefault = %u", + aUseAsDefault ); + DEBUG6( "CWlanMgmtCommandHandler::AddCipherKey() - aMacAddr = %02X:%02X:%02X:%02X:%02X:%02X", + aMacAddr.iMacAddress[0], aMacAddr.iMacAddress[1], aMacAddr.iMacAddress[2], + aMacAddr.iMacAddress[3], aMacAddr.iMacAddress[4], aMacAddr.iMacAddress[5] ); + DEBUG1( "CWlanMgmtCommandHandler::AddCipherKey() - aLength = %u", + aLength ); + DEBUG_BUFFER( aLength, aData ); + + TAddCipherKeyMsg msg; + msg.hdr.oid_id = E802_11_ADD_CIPHER_KEY; + msg.cipherSuite = aCipherSuite; + Mem::Copy( msg.data, aData, aLength ); + msg.length = aLength; + msg.keyIndex = aKeyIndex; + msg.macAddress = aMacAddr; + msg.useAsDefaultKey = aUseAsDefault; + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL ); + if( err ) + { + DEBUG1("ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + } + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::Connect +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::Connect( + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithm, + TEncryptionStatus aEncryptionStatus, + TWlanCipherSuite aPairwiseKeyType, + TBool aIsInfra, + TUint32 aIeDataLength, + const TUint8* aIeData, + TUint32 aScanFrameLength, + const TUint8* aScanFrame, + TBool aIsPairwiseKeyInvalidated, + TBool aIsGroupKeyInvalidated, + TBool aIsRadioMeasurementSupported ) + { + DEBUG( "CWlanMgmtCommandHandler::Connect()" ); + + DEBUG1( "CWlanMgmtCommandHandler::Connect() - aPairwiseKeyType = %u", + aPairwiseKeyType ); + + TConnectMsg msg; + msg.hdr.oid_id = E802_11_CONNECT; + msg.SSID = aSSID; + msg.BSSID = aBSSID; + msg.authAlgorithmNbr = aAuthAlgorithm; + msg.encryptionStatus = aEncryptionStatus; + msg.pairwiseCipher = aPairwiseKeyType; + msg.isInfra = aIsInfra; + msg.scanResponseFrameBodyLength = aScanFrameLength; + msg.scanResponseFrameBody = const_cast( aScanFrame ); + msg.ieDataLength = aIeDataLength; + msg.ieData = const_cast( aIeData ); + msg.invalidatePairwiseKey = aIsPairwiseKeyInvalidated; + msg.invalidateGroupKey = aIsGroupKeyInvalidated; + msg.radioMeasurement = aIsRadioMeasurementSupported; + + TPckg buf( msg ); + + TInt err = iChannel.ManagementCommand( buf, NULL, &iStatus ); + if( err ) + { + DEBUG1( "ERROR calling RWlanLogicalChannel::ManagementCommand(): %d", err ); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::DoCancel +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::DoCancel() + { + DEBUG( "CWlanMgmtCommandHandler::DoCancel()" ); + // RWlanLogicalChannel does not have cancel for ManagementCommand() + } + +// --------------------------------------------------------- +// CWlanMgmtCommandHandler::RunL +// --------------------------------------------------------- +// +void CWlanMgmtCommandHandler::RunL() + { + DEBUG1( "CWlanMgmtCommandHandler::RunL, status == %d", iStatus.Int() ); + iClient.OnRequestComplete( iStatus.Int() ); + } + +// End of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtframehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtframehandler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object to send and receive management packets (EAP packets). +* +*/ + + +// INCLUDE FILES +#include +#include "wlanmgmtframehandler.h" +#include "am_debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanMgmtFrameHandler::CWlanMgmtFrameHandler( + RWlanLogicalChannel& aServiceProvider, + MWlanMgmtFrameCallback& aClient ) : + CActive( CActive::EPriorityHigh ), + iServiceProvider( aServiceProvider ), + iClient( aClient ), + iDataBlock( NULL ) + { + DEBUG( "CWlanMgmtFrameHandler::CWlanMgmtFrameHandler()" ); + } + +// Static constructor. +CWlanMgmtFrameHandler* CWlanMgmtFrameHandler::NewL( + RWlanLogicalChannel& aServiceProvider, + MWlanMgmtFrameCallback& aClient) + { + DEBUG( "CWlanMgmtFrameHandler::NewL()" ); + CWlanMgmtFrameHandler* self = + new (ELeave) CWlanMgmtFrameHandler( aServiceProvider, aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Symbian 2nd phase constructor can leave. +void CWlanMgmtFrameHandler::ConstructL() + { + DEBUG( "CWlanMgmtFrameHandler::ConstructL()" ); + + CActiveScheduler::Add( this ); + } + +// Destructor +CWlanMgmtFrameHandler::~CWlanMgmtFrameHandler() + { + DEBUG( "CWlanMgmtFrameHandler::~CWlanMgmtFrameHandler()" ); + + Cancel(); + TInt ret = KErrNone; + if( iServiceProvider.Handle() != KNullHandle ) + { + ret = iServiceProvider.ReleaseBuffers(); + } + if( ret != KErrNone ) + { + DEBUG1( "ReleaseBuffers failed, reason=%d", ret ); + } + iDataBlock = NULL; + } + +// --------------------------------------------------------- +// CWlanMgmtFrameHandler::DoCancel +// Release synchronise call. Is called by CActive::Cancel() +// --------------------------------------------------------- +// +void CWlanMgmtFrameHandler::DoCancel() + { + DEBUG( "CWlanMgmtFrameHandler::DoCancel()" ); + iServiceProvider.CancelRxRequests(); + } + +// --------------------------------------------------------- +// CWlanMgmtFrameHandler::IssueRequest +// Request a synchronous call for management packets. +// --------------------------------------------------------- +// +void CWlanMgmtFrameHandler::IssueRequest() + { + DEBUG( "CWlanMgmtFrameHandler::IssueRequest()" ); + iServiceProvider.RequestFrame( iStatus ); + SetActive(); + } + +// --------------------------------------------------------- +// CWlanMgmtFrameHandler::Start +// --------------------------------------------------------- +// +TInt CWlanMgmtFrameHandler::Start() + { + DEBUG( "CWlanMgmtFrameHandler::Start()" ); + TInt ret = iServiceProvider.InitialiseBuffers( iDataBlock ); + if( ret != KErrNone || iDataBlock == NULL ) + { + return ret; + } + IssueRequest(); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtFrameHandler::Stop +// --------------------------------------------------------- +// +void CWlanMgmtFrameHandler::Stop() + { + DEBUG( "CWlanMgmtFrameHandler::Stop()" ); + Cancel(); + TInt ret = iServiceProvider.ReleaseBuffers(); + if( ret != KErrNone ) + { + DEBUG1( "ERROR: ReleaseBuffers failed with %d", ret ); + } + } + +// --------------------------------------------------------- +// CWlanMgmtFrameHandler::RunL +// Synchronise call has finished. Send data to client. +// --------------------------------------------------------- +// +void CWlanMgmtFrameHandler::RunL() + { + DEBUG( "CWlanMgmtFrameHandler::RunL()" ); + + // Send all received packets to the client. + if ( iDataBlock == NULL ) + { + DEBUG( "CWlanMgmtFrameHandler::RunL() iDataBlock=NULL" ); + } + else + { + DEBUG( "CWlanMgmtFrameHandler::RunL() iDataBlock is not NULL" ); + TDataBuffer* buffer = NULL; + while( iDataBlock->GetNextRxDataBuffer( buffer ) ) + { + DEBUG1( "EAPOL packet received, length=%d", + buffer->GetLength() ); + + iClient.OnFrameReceive( + buffer->FrameType(), + buffer->GetLength(), + buffer->GetBuffer(), + buffer->Rcpi() ); + } + } + // Wait for next packets. + IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtFrameHandler::SendFrame +// Send a management data frame. +// --------------------------------------------------------- +// +TInt CWlanMgmtFrameHandler::SendFrame( + const TDataBuffer::TFrameType aFrameType, + const TUint aLength, + const TUint8* const aData, + TUint8 aUserPriority, + const TMacAddress& aDestination, + TBool aSendUnencrypted ) + { + DEBUG( "CWlanMgmtFrameHandler::SendFrame()" ); + + // Check is iDataBlock ok. + __ASSERT_ALWAYS( + iDataBlock != NULL, + User::Panic( + _L( "CWlanMgmtFrameHandler::SendFrame() - iDataBlock = NULL" ), + KErrBadHandle)); + + // Make sure that TX buffer is empty. + iDataBlock->ClearTxDataBuffer(); + iDataBlock->AppendTxDataBuffer( + aData, + aLength, + aFrameType, + aUserPriority, + aSendUnencrypted, + &aDestination ); + + // Make the call synchronous. + TRequestStatus status; + DEBUG7( "CWlanMgmtFrameHandler::SendFrame() - sending packet to %02X:%02X:%02X:%02X:%02X:%02X with priority %u", + aDestination.iMacAddress[0], aDestination.iMacAddress[1], aDestination.iMacAddress[2], + aDestination.iMacAddress[3], aDestination.iMacAddress[4], aDestination.iMacAddress[5], + aUserPriority ); + iServiceProvider.WriteFrame( status ); + User::WaitForRequest( status ); + + DEBUG1( "CWlanMgmtFrameHandler::SendFrame() - packet sent with status = %d", + status.Int() ); + + return status.Int(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanmgmtimpl.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1391 @@ +/* +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of wlan management API +* +*/ + +/* +* %version: 29 % +*/ + +// INCLUDE FILES +#include +#include +#include "gendebug.h" +#include "wlanmgmtimpl.h" +#include "wlanscaninfoimpl.h" + +// LOCAL CONSTANTS +/** +* Pairs ECom implementation UIDs with a pointer to the instantiation +* method for that implementation. Required for all ECom implementation +* collections. +*/ +//lint --e{611} +const TImplementationProxy ImplementationTable[] = + { + {{0x101f8eff}, reinterpret_cast( CWlanMgmtImpl::NewL )}, + {{0x101f8f01}, reinterpret_cast( CWlanScanInfoImpl::NewL )} + }; + +/** The default values for scan scheduling parameters. */ +const TInt KWlanMgmtDefaultCacheLifetime = -1; +const TUint KWlanMgmtDefaultMaxDelay = 0; + +/** + * A mapping table between WLAN Management callback API versions + * and internal notifications. + */ +const TUint KWlanMgmtCallbackInterfaceMap[KWlanCallbackInterfaceVersion] = + { KWlmDefaultNotificationsV1, + KWlmDefaultNotificationsV2 }; + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanMgmtImpl::CWlanMgmtImpl() : + iScanRequest( NULL ), + iPendingScanStatus( NULL ), + iAvailableIapsRequest( NULL ), + iPendingAvailableIapsStatus( NULL ), + iClientNotification( NULL ), + iProtectedSetupRequest( NULL ), + iPendingProtectedSetupStatus( NULL ), + iCacheLifetime( 0 ), + iMaxDelay( 0 ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::CWlanMgmtImpl()" ) ) ); + } + +// Symbian 2nd phase constructor can leave. +void CWlanMgmtImpl::ConstructL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ConstructL()" ) ) ); + + User::LeaveIfError( iServer.Connect() ); + } + +// Static constructor. +CWlanMgmtImpl* CWlanMgmtImpl::NewL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::NewL()" ) ) ); + + CWlanMgmtImpl* self = new (ELeave) CWlanMgmtImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CWlanMgmtImpl::~CWlanMgmtImpl() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::~CWlanMgmtImpl()" ) ) ); + + CancelGetAvailableIaps(); + CancelGetScanResults(); + CancelProtectedSetup(); + iServer.Close(); + delete iScanRequest; + delete iAvailableIapsRequest; + delete iProtectedSetupRequest; + iPendingScanStatus = NULL; + iPendingAvailableIapsStatus = NULL; + iClientNotification = NULL; + iPendingProtectedSetupStatus = NULL; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::ActivateNotificationsL +// --------------------------------------------------------- +// +void CWlanMgmtImpl::ActivateNotificationsL( + MWlanMgmtNotifications& aCallback ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ActivateNotificationsL()" ) ) ); + iClientNotification = &aCallback; + iServer.ActivateNotifiesL( *this, KWlmDefaultNotificationsV1 ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelNotifications +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelNotifications() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::CancelNotifications()" ) ) ); + iServer.CancelNotifies(); + iClientNotification = NULL; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtImpl::GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetScanResults()" ) ) ); + + aStatus = KRequestPending; + iPendingScanStatus = &aStatus; + + // Because CWlanScanInfo has been initialized through ECom + // interface, the object is actually CWlanScanInfoImpl. + CWlanScanInfoImpl* impl = reinterpret_cast(&aResults); + + TWlanSsid tmp; + iCacheLifetime = KWlanMgmtDefaultCacheLifetime; + iMaxDelay = KWlanMgmtDefaultMaxDelay; + + iScanRequest = new CWlanScanRequest( *this, iServer, *impl, tmp, iCacheLifetime, iMaxDelay ); + if ( !iScanRequest ) + { + User::RequestComplete( iPendingScanStatus, KErrNoMemory ); + iPendingScanStatus = NULL; + return; + } + + iScanRequest->IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtImpl::GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetScanResults() (directed scan)" ) ) ); + + aStatus = KRequestPending; + iPendingScanStatus = &aStatus; + + iCacheLifetime = KWlanMgmtDefaultCacheLifetime; + iMaxDelay = KWlanMgmtDefaultMaxDelay; + + // Because CWlanScanInfo has been initialized through ECom + // interface, the object is actually CWlanScanInfoImpl. + CWlanScanInfoImpl* impl = reinterpret_cast(&aResults); + + iScanRequest = new CWlanScanRequest( *this, iServer, *impl, aSsid, iCacheLifetime, iMaxDelay ); + if ( !iScanRequest ) + { + User::RequestComplete( iPendingScanStatus, KErrNoMemory ); + iPendingScanStatus = NULL; + return; + } + + iScanRequest->IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetScanResults +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetScanResults( + CWlanScanInfo& aResults ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetScanResults() (2)" ) ) ); + + // Because CWlanScanInfo has been initialized through ECom + // interface, the object is actually CWlanScanInfoImpl. + CWlanScanInfoImpl* impl = reinterpret_cast(&aResults); + + TWlanSsid tmp; + iCacheLifetime = KWlanMgmtDefaultCacheLifetime; + iMaxDelay = KWlanMgmtDefaultMaxDelay; + + TInt ret = iServer.GetScanResults( impl->GetInternalList(), tmp, iCacheLifetime, iMaxDelay ); + if ( ret != KErrNone ) + { + TraceDump( INFO_LEVEL, ( _L( "GetScanResults() returned with %d" ), ret ) ); + return ret; + } + + return impl->UpdateResults(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtImpl::GetScanResults( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetScanResults() (scan scheduling)" ) ) ); + + aStatus = KRequestPending; + iPendingScanStatus = &aStatus; + + // Because CWlanScanInfo has been initialized through ECom + // interface, the object is actually CWlanScanInfoImpl. + CWlanScanInfoImpl* impl = reinterpret_cast(&aResults); + + iScanRequest = new CWlanScanRequest( *this, iServer, *impl, aSsid, aCacheLifetime, aMaxDelay ); + if ( !iScanRequest ) + { + User::RequestComplete( iPendingScanStatus, KErrNoMemory ); + iPendingScanStatus = NULL; + return; + } + + iScanRequest->IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetConnectionBssid +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetConnectionBssid( + TWlanBssid& aBssid ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetConnectionBssid()" ) ) ); + + TMacAddress bssid; + TInt ret = iServer.GetBSSID( bssid ); + if ( ret != KErrNone ) + { + return ret; + } + + aBssid.Copy( &bssid.iMacAddress[0], KMacAddressLength ); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetConnectionSsid +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetConnectionSsid( + TWlanSsid& aSsid ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetConnectionSsid()" ) ) ); + + TBuf16 ssid; + TInt ret = iServer.GetNetworkName( ssid ); + if ( ret != KErrNone ) + { + return ret; + } + + aSsid.Copy( ssid ); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetConnectionSignalQuality +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetConnectionSignalQuality( + TInt32& aSignalQuality ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetConnectionSignalQuality()" ) ) ); + + TInt32 rcpi = 0; + iServer.GetConnectionRCPI( rcpi ); + // RCPI -> RSSI CONVERSION + // Note: conversion may round the result by 0.5 units + aSignalQuality = ( 110 - ( rcpi / 2 ) ); + TraceDump( INFO_LEVEL, ( _L( " - (RCP, RSS) == (%u, %u)"), rcpi, aSignalQuality ) ); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetConnectionState +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetConnectionMode( + TWlanConnectionMode& aMode ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetConnectionMode()" ) ) ); + + TWlanConnectionState state = iServer.GetConnectionState(); + switch ( state ) + { + case EWlanStateInfrastructure: + aMode = EWlanConnectionModeInfrastructure; + break; + case EWlanStateSearchingAP: + aMode = EWlanConnectionModeSearching; + break; + case EWlanStateIBSS: + aMode = EWlanConnectionModeAdhoc; + break; + case EWlanStateSecureInfra: + aMode = EWlanConnectionModeSecureInfra; + break; + default: + aMode = EWlanConnectionModeNotConnected; + break; + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetConnectionSecurityMode +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetConnectionSecurityMode( + TWlanConnectionSecurityMode& aMode ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetConnectionSecurityMode()" ) ) ); + + TWlanSecurity mode( EWlanSecurityOpen ); + TInt ret = iServer.GetSecurityMode( mode ); + if ( ret != KErrNone ) + { + return ret; + } + + switch ( mode ) + { + case EWlanSecurityWepOpen: // Fallthrough on purpose + case EWlanSecurityWepShared: + aMode = EWlanConnectionSecurityWep; + break; + case EWlanSecurity802d1x: // Fallthrough on purpose + case EWlanSecurityWapi: // Fallthrough on purpose + case EWlanSecurityWapiPsk: + aMode = EWlanConnectionSecurity802d1x; + break; + case EWlanSecurityWpa: // Fallthrough on purpose + case EWlanSecurityWpa2: + aMode = EWlanConnectionSecurityWpa; + break; + case EWlanSecurityWpaPsk: // Fallthrough on purpose + case EWlanSecurityWpa2Psk: + aMode = EWlanConnectionSecurityWpaPsk; + break; + default: + aMode = EWlanConnectionSecurityOpen; + break; + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetAvailableIaps +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetAvailableIaps( + RArray& aAvailableIaps ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetAvailableIaps()" ) ) ); + + TWlmAvailableIaps iaps; + aAvailableIaps.Reset(); + + iCacheLifetime = KWlanMgmtDefaultCacheLifetime; + iMaxDelay = KWlanMgmtDefaultMaxDelay; + + TInt ret = iServer.GetAvailableIaps( iaps, iCacheLifetime, iMaxDelay ); + if ( ret != KErrNone ) + { + return ret; + } + for ( TUint idx( 0 ); idx < iaps.count; ++idx ) + { + aAvailableIaps.Append( iaps.iaps[idx] ); + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtImpl::GetAvailableIaps( + TRequestStatus& aStatus, + RArray& aAvailableIaps ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetAvailableIaps() (async)" ) ) ); + + aAvailableIaps.Reset(); + + aStatus = KRequestPending; + iPendingAvailableIapsStatus = &aStatus; + + iCacheLifetime = KWlanMgmtDefaultCacheLifetime; + iMaxDelay = KWlanMgmtDefaultMaxDelay; + + iAvailableIapsRequest = new CWlanAvailableIapsRequest( *this, iServer, aAvailableIaps, iCacheLifetime, iMaxDelay ); + if ( !iAvailableIapsRequest ) + { + User::RequestComplete( iPendingAvailableIapsStatus, KErrNoMemory ); + iPendingAvailableIapsStatus = NULL; + return; + } + iAvailableIapsRequest->IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtImpl::GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus& aStatus, + RArray& aAvailableIaps ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetAvailableIaps() (async)" ) ) ); + + aAvailableIaps.Reset(); + + aStatus = KRequestPending; + iPendingAvailableIapsStatus = &aStatus; + + iAvailableIapsRequest = new CWlanAvailableIapsRequest( *this, iServer, aAvailableIaps, aCacheLifetime, aMaxDelay ); + if ( !iAvailableIapsRequest ) + { + User::RequestComplete( iPendingAvailableIapsStatus, KErrNoMemory ); + iPendingAvailableIapsStatus = NULL; + return; + } + iAvailableIapsRequest->IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::NotifyChangedSettings +// --------------------------------------------------------- +// +void CWlanMgmtImpl::NotifyChangedSettings() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::NotifyChangedSettings()" ) ) ); + + iServer.NotifyChangedSettings(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::AddBssidToBlacklist +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::AddBssidToBlacklist( + const TWlanBssid& aBssid ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::AddBssidToBlacklist()" ) ) ); + TMacAddress bssid; + Mem::Copy( &bssid.iMacAddress[0], aBssid.Ptr(), sizeof( TMacAddress ) ); + return iServer.AddBssidToRoguelist( bssid ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::UpdateRssNotificationBoundary +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::UpdateRssNotificationBoundary( + const TInt32 aRssLevelBoundary, + const TInt32 aHysteresis ) + { + // Do some basic checks: + if( aRssLevelBoundary <= KRssMin || aRssLevelBoundary > KRssMax ) + { + return KErrArgument; + } + if( aHysteresis <= KRssHysteresisMin || aHysteresis > KRssHysteresisMax) + { + return KErrArgument; + } + + // RSSI -> RCPI Conversion + TInt32 rcpLevelBoundary = ( 110 - aRssLevelBoundary ) * 2; + // Hysteresis Conversion + TInt32 hysteresis = ( ( 110 - ( aRssLevelBoundary - aHysteresis ) ) * 2 ) - rcpLevelBoundary; + + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::UpdateRssNotificationBoundary()" ) ) ); + TraceDump( INFO_LEVEL, ( _L( "RSS(%d, %d) -> RCP(%d, %d)" ), + aRssLevelBoundary, aHysteresis, + rcpLevelBoundary, hysteresis ) ); + + return iServer.UpdateRcpNotificationBoundary( rcpLevelBoundary, hysteresis ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::RunProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtImpl::RunProtectedSetup( + TRequestStatus& aStatus, + TUint32 aId, + CArrayFixSeg& aCredentials ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::RunProtectedSetup()" ) ) ); + + aCredentials.Reset(); + + aStatus = KRequestPending; + iPendingProtectedSetupStatus = &aStatus; + + iProtectedSetupRequest = new CProtectedSetupRequest( *this, iServer, aId, aCredentials ); + if ( !iProtectedSetupRequest ) + { + User::RequestComplete( iPendingProtectedSetupStatus, KErrNoMemory ); + iPendingProtectedSetupStatus = NULL; + return; + } + + iProtectedSetupRequest->IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelProtectedSetup() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::CancelProtectedSetup()" ) ) ); + + if( iProtectedSetupRequest && + iProtectedSetupRequest->IsActive() ) + { + iProtectedSetupRequest->Cancel(); + + User::RequestComplete( iPendingProtectedSetupStatus, KErrCancel ); + } + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelGetScanResults +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelGetScanResults() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::CancelGetScanResults()" ) ) ); + + if( iScanRequest && + iScanRequest->IsActive() ) + { + iScanRequest->Cancel(); + + User::RequestComplete( iPendingScanStatus, KErrCancel ); + } + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelGetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelGetAvailableIaps() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::CancelGetAvailableIaps()" ) ) ); + + if( iAvailableIapsRequest && + iAvailableIapsRequest->IsActive() ) + { + iAvailableIapsRequest->Cancel(); + + User::RequestComplete( iPendingAvailableIapsStatus, KErrCancel ); + } + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::AddIapSsidList +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::AddIapSsidList()" ) ) ); + + return iServer.AddIapSsidList( aIapId, aSsidList ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::RemoveIapSsidList +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::RemoveIapSsidList( + TUint aIapId ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::RemoveIapSsidList()" ) ) ); + + return iServer.RemoveIapSsidList( aIapId ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::GetExtendedConnectionSecurityMode +// --------------------------------------------------------- +// +TInt CWlanMgmtImpl::GetExtendedConnectionSecurityMode( + TWlanConnectionExtentedSecurityMode& aMode ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::GetExtendedConnectionSecurityMode()" ) ) ); + + TWlanSecurity mode( EWlanSecurityOpen ); + TInt ret = iServer.GetSecurityMode( mode ); + if ( ret != KErrNone ) + { + return ret; + } + + switch ( mode ) + { + case EWlanSecurityWepOpen: + aMode = EWlanConnectionExtentedSecurityModeWepOpen; + break; + case EWlanSecurityWepShared: + aMode = EWlanConnectionExtentedSecurityModeWepShared; + break; + case EWlanSecurity802d1x: + aMode = EWlanConnectionExtentedSecurityMode802d1x; + break; + case EWlanSecurityWpa: + aMode = EWlanConnectionExtentedSecurityModeWpa; + break; + case EWlanSecurityWpa2: + aMode = EWlanConnectionExtentedSecurityModeWpa2; + break; + case EWlanSecurityWpaPsk: + aMode = EWlanConnectionExtentedSecurityModeWpaPsk; + break; + case EWlanSecurityWpa2Psk: + aMode = EWlanConnectionExtentedSecurityModeWpa2Psk; + break; + case EWlanSecurityWapi: + aMode = EWlanConnectionExtentedSecurityModeWapi; + break; + case EWlanSecurityWapiPsk: + aMode = EWlanConnectionExtentedSecurityModeWapiPsk; + break; + default: + aMode = EWlanConnectionExtentedSecurityModeOpen; + break; + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::ActivateExtendedNotificationsL +// --------------------------------------------------------- +// +void CWlanMgmtImpl::ActivateExtendedNotificationsL( + MWlanMgmtNotifications& aCallback, + TUint aCallbackInterfaceVersion = KWlanCallbackInterfaceVersion ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ActivateExtendedNotificationsL()" ) ) ); + iClientNotification = &aCallback; + + if( !aCallbackInterfaceVersion || + aCallbackInterfaceVersion > KWlanCallbackInterfaceVersion ) + { + aCallbackInterfaceVersion = KWlanCallbackInterfaceVersion; + } + + iServer.ActivateNotifiesL( + *this, + KWlanMgmtCallbackInterfaceMap[aCallbackInterfaceVersion-1] ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::ActivateExtendedNotificationsL +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CreateTrafficStream( + TRequestStatus& aStatus, + const TWlanTrafficStreamParameters& aStreamParameters, + TUint& aStreamId, + TWlanTrafficStreamStatus& aStreamStatus ) + { + iServer.CreateTrafficStream( + aStatus, + aStreamParameters, + EFalse, + aStreamId, + aStreamStatus ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelCreateTrafficStream +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelCreateTrafficStream() + { + iServer.CancelCreateTrafficStream(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::DeleteTrafficStream +// --------------------------------------------------------- +// +void CWlanMgmtImpl::DeleteTrafficStream( + TRequestStatus& aStatus, + TUint aStreamId ) + { + iServer.DeleteTrafficStream( + aStatus, + aStreamId ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelDeleteTrafficStream +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelDeleteTrafficStream() + { + iServer.CancelDeleteTrafficStream(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::DirectedRoam +// --------------------------------------------------------- +// +void CWlanMgmtImpl::DirectedRoam( + TRequestStatus& aStatus, + const TWlanBssid& aBssid ) + { + TMacAddress bssid; + Mem::Copy( &bssid.iMacAddress[0], aBssid.Ptr(), sizeof( TMacAddress ) ); + iServer.DirectedRoam( + aStatus, + bssid ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::CancelDirectedRoam +// --------------------------------------------------------- +// +void CWlanMgmtImpl::CancelDirectedRoam() + { + iServer.CancelDirectedRoam(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::ProtectedSetupComplete +// --------------------------------------------------------- +// +void CWlanMgmtImpl::ProtectedSetupComplete( + TInt aStatus ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ProtectedSetupComplete()" ) ) ); + User::RequestComplete( iPendingProtectedSetupStatus, aStatus ); + delete iProtectedSetupRequest; + iProtectedSetupRequest = NULL; + iPendingProtectedSetupStatus = NULL; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::ScanComplete +// --------------------------------------------------------- +// +void CWlanMgmtImpl::ScanComplete( + TInt aStatus ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ScanComplete()" ) ) ); + User::RequestComplete( iPendingScanStatus, aStatus ); + delete iScanRequest; + iScanRequest = NULL; + iPendingScanStatus = NULL; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::AvailableIapsComplete +// --------------------------------------------------------- +// +void CWlanMgmtImpl::AvailableIapsComplete( + TInt aStatus ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::AvailableIapsComplete()" ) ) ); + User::RequestComplete( iPendingAvailableIapsStatus, aStatus ); + delete iAvailableIapsRequest; + iAvailableIapsRequest = NULL; + iPendingAvailableIapsStatus = NULL; + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::ConnectionStateChanged +// --------------------------------------------------------- +// +void CWlanMgmtImpl::ConnectionStateChanged( + TWlanConnectionState aNewState ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::ConnectionStateChanged()" ) ) ); + + TWlanConnectionMode mode( EWlanConnectionModeNotConnected ); + + switch ( aNewState ) + { + case EWlanStateInfrastructure: + mode = EWlanConnectionModeInfrastructure; + break; + case EWlanStateSearchingAP: + mode = EWlanConnectionModeSearching; + break; + case EWlanStateIBSS: + mode = EWlanConnectionModeAdhoc; + break; + case EWlanStateSecureInfra: + mode = EWlanConnectionModeSecureInfra; + break; + default: + break; + } + + iClientNotification->ConnectionStateChanged( mode ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::BSSIDChanged +// --------------------------------------------------------- +// +void CWlanMgmtImpl::BSSIDChanged( + TDesC8& aNewBSSID ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::BSSIDChanged()" ) ) ); + + TWlanBssid bssid; + bssid.Copy( aNewBSSID ); + iClientNotification->BssidChanged( bssid ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::BSSLost +// --------------------------------------------------------- +// +void CWlanMgmtImpl::BSSLost() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::BSSLost()" ) ) ); + + iClientNotification->BssLost(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::BSSRegained +// --------------------------------------------------------- +// +void CWlanMgmtImpl::BSSRegained() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::BSSRegained()" ) ) ); + + iClientNotification->BssRegained(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::NewNetworksDetected +// --------------------------------------------------------- +// +void CWlanMgmtImpl::NewNetworksDetected() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::NewNetworksDetected()" ) ) ); + + iClientNotification->NewNetworksDetected(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::OldNetworksLost +// --------------------------------------------------------- +// +void CWlanMgmtImpl::OldNetworksLost() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::OldNetworksLost()" ) ) ); + + iClientNotification->OldNetworksLost(); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::TransmitPowerChanged +// --------------------------------------------------------- +// +void CWlanMgmtImpl::TransmitPowerChanged( + TUint aPower ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::TransmitPowerChanged()" ) ) ); + + iClientNotification->TransmitPowerChanged( aPower ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::RssChanged +// --------------------------------------------------------- +// +void CWlanMgmtImpl::RcpChanged( + TWlanRCPLevel aRcpLevel, + TUint aRcpValue ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanMgmtImpl::RcpChanged: %u, %u"), aRcpLevel, aRcpValue ) ); + + // Convert TWlanRCPLevel -> TWlanRssClass + // (These types must be kept in synch) + TWlanRssClass rssClass = EWlanRssClassNormal; + switch( aRcpLevel ) + { + case EWlanRcpNormal: + rssClass = EWlanRssClassNormal; + break; + case EWlanRcpWeak: + rssClass = EWlanRssClassWeak; + break; + } + + // Convert RCPI -> RSSI... + // Note: conversion may round the result by 0.5 units + TUint rssValue = 110 - ( aRcpValue / 2 ); + + TraceDump( INFO_LEVEL, ( _L( " - Converted RSS values: %u, %u"), rssClass, rssValue ) ); + + iClientNotification->RssChanged( rssClass, rssValue ); + } + +// --------------------------------------------------------- +// CWlanMgmtImpl::TrafficStreamStatusChanged +// --------------------------------------------------------- +// +void CWlanMgmtImpl::TrafficStreamStatusChanged( + TUint aStreamId, + TWlanTrafficStreamStatus aStreamStatus ) + { + iClientNotification->TrafficStreamStatusChanged( + aStreamId, aStreamStatus ); + } + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanScanRequest::CWlanScanRequest( + CWlanMgmtImpl& aCallback, + RWLMServer& aServer, + CWlanScanInfoImpl& aScanInfo , + const TWlanSsid& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay ) : + CActive( CActive::EPriorityStandard ), + iCallback( aCallback ), + iServer( aServer ), + iScanInfo( aScanInfo ), + iSsid( aSsid ), + iCacheLifetime( aCacheLifetime ), + iMaxDelay( aMaxDelay ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanRequest::CWlanScanRequest()" ) ) ); + CActiveScheduler::Add( this ); + } + +// Destructor +CWlanScanRequest::~CWlanScanRequest() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanRequest::~CWlanScanRequest()" ) ) ); + Cancel(); + } + +// --------------------------------------------------------- +// CWlanScanRequest::IssueRequest +// --------------------------------------------------------- +// +void CWlanScanRequest::IssueRequest() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanRequest::IssueRequest()" ) ) ); + iServer.GetScanResults( iScanInfo.GetInternalList(), iSsid, iCacheLifetime, iMaxDelay, iStatus ); + SetActive(); + } + +// --------------------------------------------------------- +// CWlanScanRequest::RunL +// --------------------------------------------------------- +// +void CWlanScanRequest::RunL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanRequest::RunL()" ) ) ); + TInt ret = iStatus.Int(); + if ( ret == KErrNone ) + { + ret = iScanInfo.UpdateResults(); + } + + iCallback.ScanComplete( ret ); + } + +// --------------------------------------------------------- +// CWlanScanRequest::RunError +// --------------------------------------------------------- +// +TInt CWlanScanRequest::RunError( + TInt /* aError */ ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanRequest::RunError()" ) ) ); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanScanRequest::DoCancel +// --------------------------------------------------------- +// +void CWlanScanRequest::DoCancel() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanRequest::DoCancel()" ) ) ); + + iServer.CancelGetScanResults(); + } + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanAvailableIapsRequest::CWlanAvailableIapsRequest( + CWlanMgmtImpl& aCallback, + RWLMServer& aServer, + RArray& aAvailableIaps, + TInt& aCacheLifetime, + TUint& aMaxDelay ) : + CActive( CActive::EPriorityStandard ), + iCallback( aCallback ), + iServer( aServer ), + iPendingAvailableIaps( aAvailableIaps ), + iAvailableIapsBuf( iAvailableIaps ), + iCacheLifetimeBuf( aCacheLifetime ), + iMaxDelayBuf( aMaxDelay ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) ); + CActiveScheduler::Add( this ); + } + +// Destructor +CWlanAvailableIapsRequest::~CWlanAvailableIapsRequest() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::CWlanAvailableIapsRequest()" ) ) ); + Cancel(); + } + +// --------------------------------------------------------- +// CWlanAvailableIapsRequest::IssueRequest +// --------------------------------------------------------- +// +void CWlanAvailableIapsRequest::IssueRequest() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::IssueRequest()" ) ) ); + iServer.GetAvailableIaps( iAvailableIapsBuf, iCacheLifetimeBuf, iMaxDelayBuf, iStatus ); + SetActive(); + } + +// --------------------------------------------------------- +// CWlanAvailableIapsRequest::RunL +// --------------------------------------------------------- +// +void CWlanAvailableIapsRequest::RunL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::RunL()" ) ) ); + for ( TUint idx( 0 ); idx < iAvailableIaps.count; ++idx ) + { + iPendingAvailableIaps.Append( iAvailableIaps.iaps[idx] ); + } + iCallback.AvailableIapsComplete( iStatus.Int() ); + } + +// --------------------------------------------------------- +// CWlanAvailableIapsRequest::RunError +// --------------------------------------------------------- +// +TInt CWlanAvailableIapsRequest::RunError( + TInt /* aError */ ) + { + TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::RunError()" ) ) ); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanAvailableIapsRequest::DoCancel +// --------------------------------------------------------- +// +void CWlanAvailableIapsRequest::DoCancel() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanAvailableIapsRequest::DoCancel()" ) ) ); + + iServer.CancelGetAvailableIaps(); + } + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CProtectedSetupRequest::CProtectedSetupRequest( + CWlanMgmtImpl& aCallback, + RWLMServer& aServer, + TUint32 aId, + CArrayFixSeg& aCredentials ) : + CActive( CActive::EPriorityStandard ), + iCallback( aCallback ), + iServer( aServer ), + iServiceId( aId ), + iCredentials ( aCredentials ), + iCredentialsBuf( iCredentialsStorage ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::CProtectedSetupRequest()" ) ) ); + CActiveScheduler::Add( this ); + } + +// Destructor +CProtectedSetupRequest::~CProtectedSetupRequest() + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::~CProtectedSetupRequest()" ) ) ); + + Cancel(); + } + +// --------------------------------------------------------- +// CProtectedSetupRequest::IssueRequest +// --------------------------------------------------------- +// +void CProtectedSetupRequest::IssueRequest() + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::IssueRequest()" ) ) ); + iServer.RunProtectedSetup( iStatus, iServiceId, iCredentialsBuf ); + SetActive(); + } + +// --------------------------------------------------------- +// CProtectedSetupRequest::RunL +// --------------------------------------------------------- +// +void CProtectedSetupRequest::RunL() + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL()" ) ) ); + + for ( TUint idx( 0 ); idx < iCredentialsStorage.count; ++idx ) + { + TRAP_IGNORE( iCredentials.AppendL( + iCredentialsStorage.credentials[idx] ) ) + } + +#ifdef _DEBUG + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials.Count() is %u" ), + iCredentials.Count() ) ); + for ( TInt idx( 0 ); idx < iCredentials.Count(); ++idx ) + { + if ( iCredentials[idx].iOperatingMode == EWlanOperatingModeAdhoc ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iOperatingMode = EWlanOperatingModeAdhoc" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iOperatingMode == EWlanOperatingModeInfrastructure ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iOperatingMode = EWlanOperatingModeInfrastructure" ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iOperatingMode = unknown" ), + idx + 1 ) ); + } + + if ( iCredentials[idx].iAuthenticationMode == EWlanAuthenticationModeOpen ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iAuthenticationMode = EWlanAuthenticationModeOpen" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iAuthenticationMode == EWlanAuthenticationModeShared ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iAuthenticationMode = EWlanAuthenticationModeShared" ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iAuthenticationMode = unknown" ), + idx + 1 ) ); + } + + if ( iCredentials[idx].iSecurityMode == EWlanIapSecurityModeAllowUnsecure ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSecurityMode = EWlanIapSecurityModeAllowUnsecure" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iSecurityMode == EWlanIapSecurityModeWep ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSecurityMode = EWlanIapSecurityModeWep" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iSecurityMode == EWlanIapSecurityMode802d1x ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSecurityMode = EWlanIapSecurityMode802d1x" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iSecurityMode == EWlanIapSecurityModeWpa ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSecurityMode = EWlanIapSecurityModeWpa" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iSecurityMode == EWlanIapSecurityModeWpa2Only ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSecurityMode = EWlanIapSecurityModeWpa2Only" ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSecurityMode = unknown" ), + idx + 1 ) ); + } + + TBuf ssid; + ssid.Copy( iCredentials[idx].iSsid ); + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iSsid = %S" ), + idx + 1, &ssid ) ); + + TBuf wepKey; + + wepKey.Zero(); + for ( TInt length( 0 ); length < iCredentials[idx].iWepKey1.Length(); ++length ) + { + wepKey.AppendFormat( _L( "%02X" ), iCredentials[idx].iWepKey1[length] ); + } + if ( !iCredentials[idx].iWepKey1.Length() ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey1 = " ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey1 = 0x%S" ), + idx + 1, &wepKey ) ); + } + + wepKey.Zero(); + for ( TInt length( 0 ); length < iCredentials[idx].iWepKey2.Length(); ++length ) + { + wepKey.AppendFormat( _L( "%02X" ), iCredentials[idx].iWepKey2[length] ); + } + if ( !iCredentials[idx].iWepKey2.Length() ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey2 = " ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey2 = 0x%S" ), + idx + 1, &wepKey ) ); + } + + wepKey.Zero(); + for ( TInt length( 0 ); length < iCredentials[idx].iWepKey3.Length(); ++length ) + { + wepKey.AppendFormat( _L( "%02X" ), iCredentials[idx].iWepKey3[length] ); + } + if ( !iCredentials[idx].iWepKey3.Length() ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey3 = " ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey3 = 0x%S" ), + idx + 1, &wepKey ) ); + } + + wepKey.Zero(); + for ( TInt length( 0 ); length < iCredentials[idx].iWepKey4.Length(); ++length ) + { + wepKey.AppendFormat( _L( "%02X" ), iCredentials[idx].iWepKey4[length] ); + } + if ( !iCredentials[idx].iWepKey4.Length() ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey4 = " ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepKey4 = 0x%S" ), + idx + 1, &wepKey ) ); + } + + if ( iCredentials[idx].iWepDefaultKey == EWlanDefaultWepKey1 ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepDefaultKey = EWlanDefaultWepKey1" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iWepDefaultKey == EWlanDefaultWepKey2 ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepDefaultKey = EWlanDefaultWepKey2" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iWepDefaultKey == EWlanDefaultWepKey3 ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepDefaultKey = EWlanDefaultWepKey3" ), + idx + 1 ) ); + } + else if ( iCredentials[idx].iWepDefaultKey == EWlanDefaultWepKey4 ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepDefaultKey = EWlanDefaultWepKey4" ), + idx + 1 ) ); + } + else + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWepDefaultKey = unknown" ), + idx + 1 ) ); + } + + TBuf presharedKey; + presharedKey.Copy( iCredentials[idx].iWpaPreSharedKey ); + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunL() - iCredentials[%u].iWpaPreSharedKey = %S" ), + idx + 1, &presharedKey ) ); + } +#endif // _DEBUG + + iCallback.ProtectedSetupComplete( iStatus.Int() ); + } + +// --------------------------------------------------------- +// CProtectedSetupRequest::RunError +// --------------------------------------------------------- +// +TInt CProtectedSetupRequest::RunError( + TInt /* aError */ ) + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::RunError()" ) ) ); + + return KErrNone; + } + +// --------------------------------------------------------- +// CProtectedSetupRequest::DoCancel +// --------------------------------------------------------- +// +void CProtectedSetupRequest::DoCancel() + { + TraceDump( INFO_LEVEL, ( _L( "CProtectedSetupRequest::DoCancel()" ) ) ); + + iServer.CancelProtectedSetup(); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// --------------------------------------------------------- +// Returns an instance of the proxy table. +// Returns: KErrNone +// --------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlannotificationhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlannotificationhandler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class to receive asynchronous notifications from WLAN drivers +* +*/ + + +// INCLUDE FILES +#include +#include +#include "wlannotificationhandler.h" +#include "RWlanLogicalChannel.h" +#include "am_debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanNotificationHandler::CWlanNotificationHandler( + RWlanLogicalChannel& aChannel, + MWlanNotificationCallback& aClient ): + CActive( CActive::EPriorityStandard ), + iChannel( aChannel ), + iClient( aClient ) + { + DEBUG( "CWlanNotificationHandler::CWlanNotificationHandler()" ); + }; + +// Destructor +CWlanNotificationHandler::~CWlanNotificationHandler() + { + DEBUG( "CWlanNotificationHandler::~CWlanNotificationHandler()" ); + Cancel(); + }; + +// --------------------------------------------------------- +// CWlanNotificationHandler::NewL +// --------------------------------------------------------- +// +CWlanNotificationHandler* CWlanNotificationHandler::NewL( + RWlanLogicalChannel& aChannel, + MWlanNotificationCallback& aClient ) + { + DEBUG( "CWlanNotificationHandler::NewL()" ); + CWlanNotificationHandler* self = new(ELeave) CWlanNotificationHandler( aChannel, aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWlanNotificationHandler::ConstructL +// --------------------------------------------------------- +// +void CWlanNotificationHandler::ConstructL() + { + DEBUG( "CWlanNotificationHandler::ConstructL()" ); + + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CWlanNotificationHandler::DoCancel +// Cancel is called by the framework when Cancel() is called. +// Pending indication is cancelled from the device driver. +// --------------------------------------------------------- +// +void CWlanNotificationHandler::DoCancel() + { + DEBUG( "CWlanNotificationHandler::DoCancel() " ); + iChannel.CancelRequestSignal(); + } + +// --------------------------------------------------------- +// CWlanNotificationHandler::RunL +// This is called when active object has received an +// indication. +// --------------------------------------------------------- +// +void CWlanNotificationHandler::RunL() + { + DEBUG( "CWlanNotificationHandler::RunL()" ); + iClient.OnNotify( iIndication ); + IssueRequest(); + } + +// --------------------------------------------------------- +// CWlanNotificationHandler::Start +// --------------------------------------------------------- +// +TInt CWlanNotificationHandler::Start() + { + DEBUG( "CWlanNotificationHandler::Start()" ); + IssueRequest(); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanNotificationHandler::Stop +// --------------------------------------------------------- +// +void CWlanNotificationHandler::Stop() + { + DEBUG( "CWlanNotificationHandler::Stop()" ); + Cancel(); + } + +// --------------------------------------------------------- +// CWlanNotificationHandler::IssueRequest +// Registers pending indication buffer to the device driver. +// --------------------------------------------------------- +// +void CWlanNotificationHandler::IssueRequest() + { + DEBUG( "CWlanNotificationHandler::IssueRequest()" ); + iChannel.RequestSignal( iStatus, iIndication ); + SetActive(); + } + +// End of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscaninfoimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscaninfoimpl.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Scan info +* +*/ + + +// INCLUDE FILES +#include +#include "gendebug.h" +#include "genscaninfo.h" +#include "wlanscaninfoimpl.h" + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanScanInfoImpl::CWlanScanInfoImpl() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanInfoImpl::CWlanScanInfoImpl()" ) ) ); + } + +// Symbian 2nd phase constructor can leave. +void CWlanScanInfoImpl::ConstructL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanInfoImpl::ConstructL()" ) ) ); + + iScanInfo = new(ELeave) ScanInfo( iScanList ); + } + +// Static constructor. +CWlanScanInfoImpl* CWlanScanInfoImpl::NewL() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanInfoImpl::NewL()" ) ) ); + + CWlanScanInfoImpl* self = new (ELeave) CWlanScanInfoImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CWlanScanInfoImpl::~CWlanScanInfoImpl() + { + TraceDump( INFO_LEVEL, ( _L( "CWlanScanInfoImpl::~CWlanScanInfoImpl()" ) ) ); + delete iScanInfo; + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::Size +// --------------------------------------------------------- +// +TUint16 CWlanScanInfoImpl::Size() const + { + return iScanInfo->Size(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::First +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfoImpl::First() + { + return iScanInfo->First(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::Next +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfoImpl::Next() + { + return iScanInfo->Next(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::Current +// --------------------------------------------------------- +// +const TWlanScanInfoFrame* CWlanScanInfoImpl::Current() const + { + return iScanInfo->Current(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::IsDone +// --------------------------------------------------------- +// +TBool CWlanScanInfoImpl::IsDone() const + { + return iScanInfo->IsDone(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::RXLevel +// --------------------------------------------------------- +// +TUint8 CWlanScanInfoImpl::RXLevel() const + { + TUint8 rssiValue = 110 - ( iScanInfo->RXLevel() / 2 ); + TraceDump( INFO_LEVEL, ( _L( "CWlanScanInfoImpl::RXLevel(): (RCP, RSS) == (%u, %u )" ), iScanInfo->RXLevel(), rssiValue ) ); + return rssiValue; + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::Bssid +// --------------------------------------------------------- +// +void CWlanScanInfoImpl::Bssid( TWlanBssid& aBssid ) const + { + TMacAddress bssid={0}; + iScanInfo->BSSID( bssid.iMacAddress ); + aBssid.Copy( &bssid.iMacAddress[0], KMacAddressLength ); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::BeaconInterval +// --------------------------------------------------------- +// +TUint16 CWlanScanInfoImpl::BeaconInterval() const + { + return iScanInfo->BeaconInterval(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::Capability +// --------------------------------------------------------- +// +TUint16 CWlanScanInfoImpl::Capability() const + { + return iScanInfo->Capability(); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::SecurityMode +// Status : Draft +// --------------------------------------------------------- +// +TWlanConnectionSecurityMode CWlanScanInfoImpl::SecurityMode() const + { + TWlanConnectionSecurityMode securityMode; + switch( iScanInfo->SecurityMode() ) + { + case WlanSecurityModeWep: + securityMode = EWlanConnectionSecurityWep; + break; + case WlanSecurityMode802_1x: // Fallthrough on purpose + case WlanSecurityModeWapi: // Fallthrough on purpose + case WlanSecurityModeWapiPsk: + securityMode = EWlanConnectionSecurity802d1x; + break; + case WlanSecurityModeWpaEap: // Fallthrough on purpose + case WlanSecurityModeWpa2Eap: + securityMode = EWlanConnectionSecurityWpa; + break; + case WlanSecurityModeWpaPsk: // Fallthrough on purpose + case WlanSecurityModeWpa2Psk: + securityMode = EWlanConnectionSecurityWpaPsk; + break; + default: + securityMode = EWlanConnectionSecurityOpen; + break; + } + return securityMode; + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::InformationElement +// --------------------------------------------------------- +// +TInt CWlanScanInfoImpl::InformationElement( TUint8 aIE, + TUint8& aLength, + const TUint8** aData ) + { + return ConvertErrorCode( iScanInfo->InformationElement( aIE, aLength, aData ) ); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::WpaIE +// --------------------------------------------------------- +// +TInt CWlanScanInfoImpl::WpaIE( TUint8& aLength, + const TUint8** aData ) + { + return ConvertErrorCode( iScanInfo->WpaIE( aLength, aData ) ); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::FirstIE +// --------------------------------------------------------- +// +TInt CWlanScanInfoImpl::FirstIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) + { + return ConvertErrorCode( iScanInfo->FirstIE( aIE, aLength, aData ) ); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::NextIE +// --------------------------------------------------------- +// +TInt CWlanScanInfoImpl::NextIE( TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) + { + return ConvertErrorCode( iScanInfo->NextIE( aIE, aLength, aData ) ); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::GetInternalList +// --------------------------------------------------------- +// +ScanList& CWlanScanInfoImpl::GetInternalList() + { + return iScanList; + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::UpdateResults +// --------------------------------------------------------- +// +TInt CWlanScanInfoImpl::UpdateResults() + { + ScanInfo* info = new ScanInfo( iScanList ); + if ( !info ) + { + return KErrNoMemory; + } + + delete iScanInfo; + iScanInfo = info; + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::IsProtectedSetupSupported +// --------------------------------------------------------- +// +TBool CWlanScanInfoImpl::IsProtectedSetupSupported() + { + return (iScanInfo->IsProtectedSetupSupported() ? ETrue : EFalse); + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::ExtendedSecurityMode +// --------------------------------------------------------- +// +TWlanConnectionExtentedSecurityMode CWlanScanInfoImpl::ExtendedSecurityMode() const + { + TWlanConnectionExtentedSecurityMode securityMode; + switch( iScanInfo->SecurityMode() ) + { + case WlanSecurityModeWep: + /** + * It's impossible to determine whether the AP requires open or shared + * authentication based on scan results, assume open. + */ + securityMode = EWlanConnectionExtentedSecurityModeWepOpen; + break; + case WlanSecurityMode802_1x: + securityMode = EWlanConnectionExtentedSecurityMode802d1x; + break; + case WlanSecurityModeWpaEap: + securityMode = EWlanConnectionExtentedSecurityModeWpa; + break; + case WlanSecurityModeWpa2Eap: + securityMode = EWlanConnectionExtentedSecurityModeWpa2; + break; + case WlanSecurityModeWpaPsk: + securityMode = EWlanConnectionExtentedSecurityModeWpaPsk; + break; + case WlanSecurityModeWpa2Psk: + securityMode = EWlanConnectionExtentedSecurityModeWpa2Psk; + break; + case WlanSecurityModeWapi: + securityMode = EWlanConnectionExtentedSecurityModeWapi; + break; + case WlanSecurityModeWapiPsk: + securityMode = EWlanConnectionExtentedSecurityModeWapiPsk; + break; + default: + securityMode = EWlanConnectionExtentedSecurityModeOpen; + break; + } + return securityMode; + } + +// --------------------------------------------------------- +// CWlanScanInfoImpl::ConvertErrorCode +// --------------------------------------------------------- +// +TInt CWlanScanInfoImpl::ConvertErrorCode( TInt aCode ) const + { + TInt errorCode( KErrGeneral ); + + switch( aCode ) + { + case WlanScanError_Ok: + { + errorCode = KErrNone; + break; + } + case WlanScanError_IeNotFound: + { + errorCode = KErrNotFound; + break; + } + } + return errorCode; + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanscanresultcache.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,505 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Factory class for timers +* +*/ + + +#include "wlanscanresultcache.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::NewL +// ----------------------------------------------------------------------------- +// +CWlanScanResultCache* CWlanScanResultCache::NewL() + { + DEBUG( "CWlanScanResultCache::NewL()" ); + CWlanScanResultCache* self = new(ELeave)CWlanScanResultCache(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::ConstructL +// ----------------------------------------------------------------------------- +// +void CWlanScanResultCache::ConstructL() + { + DEBUG( "CWlanScanResultCache::ConstructL()" ); + + iScanList = new(ELeave) ScanList(); + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::CWlanScanResultCache +// ----------------------------------------------------------------------------- +// +CWlanScanResultCache::CWlanScanResultCache() : + iScanList( NULL ), + iScanListTimeStamp( 0 ), + iIapListTimeStamp( 0 ) + { + DEBUG( "CWlanScanResultCache::CWlanScanResultCache()" ); + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::~CWlanScanResultCache +// ----------------------------------------------------------------------------- +// +CWlanScanResultCache::~CWlanScanResultCache() + { + DEBUG( "CWlanScanResultCache::~CWlanScanResultCache()" ); + + delete iScanList; + iIapList.Close(); + iAvailableIapList.Close(); + iAvailableNetworkList.Close(); + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::UpdateScanList +// ----------------------------------------------------------------------------- +// +void CWlanScanResultCache::UpdateScanList( + ScanList* aScanList ) + { + DEBUG( "CWlanScanResultCache::UpdateScanList()" ); + + delete iScanList; + iScanList = aScanList; // take ownership + iScanListTimeStamp.HomeTime(); + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::GetScanList +// ----------------------------------------------------------------------------- +// +ScanList* CWlanScanResultCache::GetScanList( + TUint aCacheLifetime ) + { + DEBUG( "CWlanScanResultCache::GetScanList()" ); + + TTime currentTime(0); + currentTime.HomeTime(); + TTimeIntervalSeconds difference(0); + + TInt overflow = currentTime.SecondsFrom( iScanListTimeStamp, difference ); + if( difference.Int() > aCacheLifetime || difference.Int() < 0 || overflow ) + { + DEBUG2( "CWlanScanResultCache::GetScanList() - results are too old, difference is %d, overflow is %d", + difference.Int(), overflow ); + return NULL; + } + else + { + DEBUG1( "CWlanScanResultCache::GetScanList() - old results are still valid, difference is %u", + difference.Int() ); + return iScanList; + } + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::UpdateAvailableNetworksList +// ----------------------------------------------------------------------------- +// +void CWlanScanResultCache::UpdateAvailableNetworksList( + core_type_list_c& aIapIdList, + RArray& aNetworkList, + TBool& aNewIapsAvailable, + TBool& aOldIapsLost ) + { + DEBUG( "CWlanScanResultCache::UpdateAvailableNetworksList()" ); + + DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u IAP(s) available", + aIapIdList.count() ); + DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u IAP(s) previously available", + iAvailableIapList.Count() ); + DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u networks(s) available", + aNetworkList.Count() ); + DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - %u networks(s) previously available", + iAvailableNetworkList.Count() ); + + const TInt oldIapCount( iAvailableIapList.Count() ); + const TInt newNetworkCount( aNetworkList.Count() ); + const TInt oldNetworkCount( iAvailableNetworkList.Count() ); + aNewIapsAvailable = EFalse; + aOldIapsLost = EFalse; + TIdentityRelation isEqual( CWlanScanResultCache::IsNetworkEqual ); + + // Iterate through previously available IAPs to find lost IAPs. + TInt idx( 0 ); + //while( idx < oldIapCount && !aOldIapsLost ) + while( idx < oldIapCount ) + { + const TUint32* newId = aIapIdList.first(); + + while( newId ) + { + if( *newId == iAvailableIapList[idx] ) + { + break; + } + + newId = aIapIdList.next(); + } + + if( !newId ) + { + DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - old IAP %u has been lost", + iAvailableIapList[idx] ); + aOldIapsLost = ETrue; + } + + ++idx; + } + + // Iterate through available IAPs to find new IAPs. + const TUint32* newId = aIapIdList.first(); + //while( newId && !aNewIapsAvailable ) + while( newId ) + { + if ( iAvailableIapList.Find( *newId ) == KErrNotFound ) + { + DEBUG1( "CWlanScanResultCache::UpdateAvailableNetworksList() - new IAP %u has been detected", + *newId ); + aNewIapsAvailable = ETrue; + } + + newId = aIapIdList.next(); + } + + // Iterate through previously available networks to find lost networks. + idx = 0; + //while ( idx < oldNetworkCount && !aOldIapsLost ) + while ( idx < oldNetworkCount ) + { + if ( aNetworkList.Find( iAvailableNetworkList[idx], isEqual ) == KErrNotFound ) + { + DEBUG1S( "CWlanScanResultCache::UpdateAvailableNetworksList() - old network has been lost, SSID ", + iAvailableNetworkList[idx].ssid.Length(), iAvailableNetworkList[idx].ssid.Ptr() ); + aOldIapsLost = ETrue; + } + ++idx; + } + + // Iterate through available networks to find new networks. + idx = 0; + //while( idx < newNetworkCount && !aNewIapsAvailable ) + while( idx < newNetworkCount ) + { + if ( iAvailableNetworkList.Find( aNetworkList[idx], isEqual ) == KErrNotFound ) + { + DEBUG1S( "CWlanScanResultCache::UpdateAvailableNetworksList() - new network has been detected, SSID ", + aNetworkList[idx].ssid.Length(), aNetworkList[idx].ssid.Ptr() ); + aNewIapsAvailable = ETrue; + } + ++idx; + } + + // Update the list + iAvailableIapList.Reset(); + iAvailableNetworkList.Reset(); + iIapListTimeStamp.HomeTime(); + + newId = aIapIdList.first(); + while( newId ) + { + iAvailableIapList.Append( *newId ); + newId = aIapIdList.next(); + } + + idx = 0; + while( idx < newNetworkCount ) + { + iAvailableNetworkList.Append( aNetworkList[idx] ); + ++idx; + } + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::AvailableIaps +// ----------------------------------------------------------------------------- +// +RArray* CWlanScanResultCache::AvailableIaps( + RArray& aIapList, + TUint aCacheLifetime ) + { + DEBUG( "CWlanScanResultCache::AvailableIaps()" ); + + /** + * Take a copy of the previous IAP list since GetIapDataList() will overwrite + * the member variable. + */ + RArray iapList; + for( TInt idx( 0 ); idx < iIapList.Count(); ++idx ) + { + iapList.Append( iIapList[idx] ); + } + + TInt ret = GetIapDataList( aIapList ); + if ( ret != KErrNone ) + { + DEBUG( "CWlanScanResultCache::AvailableIaps() - unable to read list of IAPs, assuming no cache" ); + iapList.Close(); + + return NULL; + } + + TTime currentTime(0); + currentTime.HomeTime(); + TTimeIntervalSeconds difference(0); + + TInt overflow = currentTime.SecondsFrom( iIapListTimeStamp, difference ); + if( difference.Int() > aCacheLifetime || difference.Int() < 0 || overflow ) + { + DEBUG2( "CWlanScanResultCache::AvailableIaps() - results are too old, difference is %d, overflow is %d", + difference.Int(), overflow ); + iapList.Close(); + + return NULL; + } + + /** + * Check whether the list of IAPs has change since last GetIapDataList(). + */ + if ( !IsIapListEqual( aIapList, iapList ) ) + { + DEBUG( "CWlanScanResultCache::AvailableIaps() - cache time is still valid but IAPs have changed" ); + iapList.Close(); + + return NULL; + } + + DEBUG1( "CWlanScanResultCache::AvailableIaps() - old results are still valid, difference is %u", + difference.Int() ); + iapList.Close(); + + return &iAvailableIapList; + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::GetIapDataList +// ----------------------------------------------------------------------------- +// +TInt CWlanScanResultCache::GetIapDataList( + RArray& aIapList ) + { + DEBUG( "CWlanScanResultCache::GetIapDataList()" ); + + aIapList.Reset(); + + /** + * Read all WLAN IAPs from commsdat. + */ + CWLanSettings wlanSettings; + TInt ret = wlanSettings.Connect(); + if ( ret != KErrNone ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - CWLanSettings::Connect() failed (%d)", + ret ); + + return ret; + } + + RArray wlanIapIds; + TRAP( ret, wlanSettings.GetIAPWlanServicesL( wlanIapIds ) ); + if( ret != KErrNone ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - CWLanSettings::GetIAPWlanServicesL() failed (%d)", + ret ); + wlanIapIds.Close(); + wlanSettings.Disconnect(); + + return ret; + } + + /** + * Retrieve IAP data for each IAP id. + */ + DEBUG1( "CWlanScanResultCache::GetIapDataList() - reading %u WLAN IAPs", + wlanIapIds.Count() ); + + for( TInt i( 0 ); i < wlanIapIds.Count(); i++ ) + { + TWlanLimitedIapData iap; + iap.iapId = wlanIapIds[i].iIAPId; + iap.serviceId = wlanIapIds[i].iWLANRecordId; + + DEBUG1( "CWlanScanResultCache::GetIapDataList() - reading IAP %u", + wlanIapIds[i].iIAPId ); + + SWLANSettings iapData; + ret = wlanSettings.GetWlanSettings( + wlanIapIds[i].iWLANRecordId, + iapData ); + if( ret != KErrNone ) + { + DEBUG2( "CWlanScanResultCache::GetIapDataList() - reading of IAP %u failed (%d), ignoring", + wlanIapIds[i].iIAPId, ret ); + } + else if( iapData.SSID.Length() ) // filter out EasyWlan IAP + { + iap.ssid.Copy( iapData.SSID ); + iap.usedSsid.Copy( iapData.UsedSSID ); + iap.networkType = static_cast( iapData.ConnectionMode ); + iap.securityMode = static_cast( iapData.SecurityMode ); + iap.isPskEnabled = iapData.EnableWpaPsk; + iap.isHidden = iapData.ScanSSID; + + aIapList.Append( iap ); + } + } + + UpdateIapList( aIapList ); + wlanIapIds.Close(); + wlanSettings.Disconnect(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::IsNetworkEqual +// ----------------------------------------------------------------------------- +// +TBool CWlanScanResultCache::IsNetworkEqual( + const TWlanAvailableNetwork& aFirst, + const TWlanAvailableNetwork& aSecond ) + { + if ( aFirst.ssid != aSecond.ssid || + aFirst.networkType != aSecond.networkType || + aFirst.securityMode != aSecond.securityMode ) + { + return EFalse; + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::IsIapListEqual +// ----------------------------------------------------------------------------- +// +TBool CWlanScanResultCache::IsIapListEqual( + const RArray& aFirst, + const RArray& aSecond ) + { + /** + * If the amount of IAPs is different, it's an obvious fault. + */ + if ( aFirst.Count() != aSecond.Count() ) + { + DEBUG2( "CWlanScanResultCache::GetIapDataList() - false, amount of IAPs is different (%u vs %u)", + aFirst.Count(), aSecond.Count() ); + + return EFalse; + } + + /** + * Some of the settings might have changed. + */ + for( TInt i( 0 ); i < aFirst.Count(); ++i ) + { + TBool isFound( EFalse ); + for ( TInt j( 0 ); j < aSecond.Count() && !isFound; ++j ) + { + if ( aFirst[i].iapId == aSecond[j].iapId ) + { + isFound = ETrue; + if ( aFirst[i].ssid != aSecond[j].ssid ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - false, IAP %u has mismatching SSID", + aFirst[i].iapId ); + + return EFalse; + } + else if ( aFirst[i].networkType != aSecond[j].networkType ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - false, IAP %u has mismatching network mode", + aFirst[i].iapId ); + + return EFalse; + } + else if ( aFirst[i].securityMode != aSecond[j].securityMode || + aFirst[i].isPskEnabled != aSecond[j].isPskEnabled ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - false, IAP %u has mismatching security mode", + aFirst[i].iapId ); + + return EFalse; + } + else if ( aFirst[i].isHidden != aSecond[j].isHidden ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - false, IAP %u has mismatching hidden setting", + aFirst[i].iapId ); + + return EFalse; + } + } + } + if ( !isFound ) + { + DEBUG1( "CWlanScanResultCache::GetIapDataList() - false, IAP %u not found in previous list", + aFirst[i].iapId ); + + return EFalse; + } + } + + DEBUG( "CWlanScanResultCache::GetIapDataList() - true, IAP lists are equal" ); + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::UpdateIapList +// ----------------------------------------------------------------------------- +// +void CWlanScanResultCache::UpdateIapList( + const RArray& aIapDataList ) + { + iIapList.Reset(); + TUint32 arraySize( 0 ); + + for( TInt idx( 0 ); idx < aIapDataList.Count(); ++idx ) + { + arraySize += sizeof( aIapDataList[idx] ); + iIapList.Append( aIapDataList[idx] ); + } + + DEBUG1( "CWlanScanResultCache::UpdateIapList() - total size of IAP list is %u bytes", + arraySize ); + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::CachedIapDataList +// ----------------------------------------------------------------------------- +// +const RArray& CWlanScanResultCache::CachedIapDataList() const + { + return iIapList; + } + +// ----------------------------------------------------------------------------- +// CWlanScanResultCache::InvalidateAvailabilityCache +// ----------------------------------------------------------------------------- +// +void CWlanScanResultCache::InvalidateAvailabilityCache() + { + iIapListTimeStamp = 0; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanssidlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanssidlist.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class implementing storage for an SSID list. +* +*/ + + +#include "wlanssidlist.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanSsidList::CWlanSsidList( + TUint aGranularity ) : + iSsidList( aGranularity ), + iLinearOrder( &CWlanSsidList::LinearOrder ) + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidList::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanSsidList* CWlanSsidList::NewL( + TUint aGranularity ) + { + CWlanSsidList* self = new (ELeave)CWlanSsidList( aGranularity ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanSsidList::~CWlanSsidList() + { + iSsidList.Close(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanSsidList::AddSsid( + const TWlanSsid& aSsid ) + { + if( !aSsid.Length() ) + { + return KErrArgument; + } + + /** + * Silently ignore KErrAlreadyExists since the list may contain + * duplicate entries. + */ + TInt ret = iSsidList.InsertInOrder( + aSsid, + iLinearOrder ); + if( ret == KErrAlreadyExists ) + { + return KErrNone; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TBool CWlanSsidList::IsInList( + const TWlanSsid& aSsid ) const + { + return (iSsidList.FindInOrder( + aSsid, + iLinearOrder ) >= 0 ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TUint CWlanSsidList::Count() const + { + return iSsidList.Count(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidList::ExternalizeL( + RWriteStream& aStream) const + { + aStream.WriteInt32L( iSsidList.Count() ); + for( TInt idx( 0 ); idx < iSsidList.Count(); ++idx ) + { + aStream.WriteInt8L( + iSsidList[idx].Length() ); + aStream.WriteL( + iSsidList[idx] ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidList::InternalizeL( + RReadStream& aStream ) + { + TInt count( + aStream.ReadInt32L() ); + TWlanSsid ssid; + + for( TInt idx( 0 ); idx < count; ++idx ) + { + aStream.ReadL( + ssid, aStream.ReadInt8L() ); + iSsidList.Append( + ssid ); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlanSsidList::LinearOrder( + const TWlanSsid& aLeft, + const TWlanSsid& aRight ) + { +#if 0 + TBuf leftBuf; + TBuf rightBuf; + leftBuf.Copy( aLeft ); + rightBuf.Copy( aRight ); + DEBUG2( "LinearOrder() - aLeft: %S, aRight: %S", + &leftBuf, &rightBuf ); +#endif // 0 + + return aLeft.Compare( aRight ); + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanssidlistdb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanssidlistdb.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,295 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class implementing a file-based storage for SSID lists. +* +*/ + + +#include +#include +#include "wlanssidlistdb.h" + +/** + * Path to SSID list database on disk. + */ +_LIT( KWlanSSidListDbFile, "c:\\private\\101f8ec5\\ssidlist.db" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanSsidListDb::CWlanSsidListDb() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidListDb::ConstructL() + { + /** + * Open a session to the file server. + */ + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + /** + * Make sure the private directory exists. + */ + fs.MkDirAll( KWlanSSidListDbFile ); + + /** + * Create a permanent file store for SSID lists. + */ + CFileStore* store = CPermanentFileStore::ReplaceLC( + fs, + KWlanSSidListDbFile, + EFileWrite ); + store->SetTypeL(KPermanentFileStoreLayoutUid); + + /** + * Create the root stream. It's not really used for anything + * since the file store is reset at every boot. + */ + RStoreWriteStream stream; + TStreamId streamId = stream.CreateLC( *store ); + stream.CommitL(); + store->SetRootL( streamId ); + store->CommitL(); + + CleanupStack::PopAndDestroy(); // stream + CleanupStack::PopAndDestroy(); // file store + CleanupStack::PopAndDestroy( &fs ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanSsidListDb* CWlanSsidListDb::NewL() + { + CWlanSsidListDb* self = new (ELeave)CWlanSsidListDb(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlanSsidListDb::~CWlanSsidListDb() + { + iSsidListMap.Close(); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidListDb::WriteListL( + TUint aIap, + const CWlanSsidList& aSsidList ) + { + TWlanSsidListMapEntry listEntry( aIap ); + + /** + * Locate the mapping entry. + */ + TInt entryIdx( -1 ); + for( TInt idx( 0 ); entryIdx < 0 && idx < iSsidListMap.Count(); ++idx ) + { + if( iSsidListMap[idx].iIap == aIap ) + { + entryIdx = idx; + } + } + + /** + * Handle an empty SSID list. + */ + if( !aSsidList.Count() ) + { + if( entryIdx >= 0 ) + { + DeleteListL( aIap ); + } + + return; + } + + /** + * Open a session to the file server. + */ + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + /** + * Open the file store for writing. + */ + CFileStore* store = CPermanentFileStore::OpenLC( + fs, + KWlanSSidListDbFile, + EFileWrite ); + + /** + * Create a stream for writing the SSID list data. + */ + RStoreWriteStream stream; + if( entryIdx < 0 ) + { + listEntry.iStreamId = stream.CreateLC( *store ); + } + else + { + stream.ReplaceLC( *store, iSsidListMap[entryIdx].iStreamId ); + } + aSsidList.ExternalizeL( stream ); + stream.CommitL(); + store->CommitL(); + + if( entryIdx < 0 ) + { + /** + * Store the mapping into the internal list if a new entry. + */ + iSsidListMap.Append( listEntry ); + } + + CleanupStack::PopAndDestroy(); // stream + CleanupStack::PopAndDestroy(); // file store + CleanupStack::PopAndDestroy( &fs ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidListDb::ReadListL( + TUint aIap, + CWlanSsidList& aSsidList ) + { + /** + * Locate the mapping entry. + */ + TInt entryIdx( -1 ); + for( TInt idx( 0 ); entryIdx < 0 && idx < iSsidListMap.Count(); ++idx ) + { + if( iSsidListMap[idx].iIap == aIap ) + { + entryIdx = idx; + } + } + if( entryIdx < 0 ) + { + User::Leave( KErrNotFound ); + } + + /** + * Open a session to the file server. + */ + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + /** + * Open the file store for reading. + */ + CFileStore* store = CPermanentFileStore::OpenLC( + fs, + KWlanSSidListDbFile, + EFileRead ); + + /** + * Create a stream for writing the SSID list data. + */ + RStoreReadStream stream; + stream.OpenLC( + *store, + iSsidListMap[entryIdx].iStreamId ); + aSsidList.InternalizeL( stream ); + + CleanupStack::PopAndDestroy(); // stream + CleanupStack::PopAndDestroy(); // file store + CleanupStack::PopAndDestroy( &fs ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlanSsidListDb::DeleteListL( + TUint aIap ) + { + /** + * Locate the mapping entry. + */ + TInt entryIdx( -1 ); + for( TInt idx( 0 ); entryIdx < 0 && idx < iSsidListMap.Count(); ++idx ) + { + if( iSsidListMap[idx].iIap == aIap ) + { + entryIdx = idx; + } + } + if( entryIdx < 0 ) + { + User::Leave( KErrNotFound ); + } + + /** + * Open a session to the file server. + */ + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + /** + * Open the file store for writing. + */ + CFileStore* store = CPermanentFileStore::OpenLC( + fs, + KWlanSSidListDbFile, + EFileWrite ); + + /** + * Delete the stream. + */ + store->DeleteL( iSsidListMap[entryIdx].iStreamId ); + store->CommitL(); + + CleanupStack::PopAndDestroy(); // file store + CleanupStack::PopAndDestroy( &fs ); + + /** + * Remove the mapping entry from the internal list. + */ + iSsidListMap.Remove( entryIdx ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TBool CWlanSsidListDb::IsListAttached( + TUint aIap ) + { + for( TInt idx( 0 ); idx < iSsidListMap.Count(); ++idx ) + { + if( iSsidListMap[idx].iIap == aIap ) + { + return ETrue; + } + } + + return EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlansystemtimehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlansystemtimehandler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,316 @@ +/* +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object to get notification of system time change. +* +*/ + +/* +* %version: 3 % +*/ + +// INCLUDE FILES +#include +#include "wlansystemtimehandler.h" +#include "am_debug.h" + +/** + * Region cache should expire after 5 hours and therefore + * 30 min timer is set 10 times + */ +const TInt KRegionCacheClearingTimer = 1800*1000000; // 30 min +const TInt KRegionCacheClearingTimerCount = 10; +/** + * Two year timeout used to receive notification about system time change + */ +const TInt KWlanSystemTimeHandlerTimeoutTwoYears = 2; + +#ifdef _DEBUG +/** + * Formatting of date time debug string. + */ +_LIT( KWlanSystemTimeHandlerDateTimeFormat, "%F %*E %*N %Y %H:%T:%S" ); + +/** + * Maximun length for date time debug string. + */ +const TInt KWlanSystemTimeHandlerMaxDateTimeStrLen = 50; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanSystemTimeHandler::CWlanSystemTimeHandler( + MWlanSystemTimeCallback& aClient ) : + CActive( CActive::EPriorityStandard ), + iClient( aClient ) + { + DEBUG( "CWlanSystemTimeHandler::CWlanSystemTimeHandler()" ); + } + +// Static constructor. +CWlanSystemTimeHandler* CWlanSystemTimeHandler::NewL( + MWlanSystemTimeCallback& aClient) + { + DEBUG( "CWlanSystemTimeHandler::NewL()" ); + CWlanSystemTimeHandler* self = + new (ELeave) CWlanSystemTimeHandler( aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Symbian 2nd phase constructor can leave. +void CWlanSystemTimeHandler::ConstructL() + { + DEBUG( "CWlanSystemTimeHandler::ConstructL()" ); + + CActiveScheduler::Add( this ); + User::LeaveIfError( iTimer.CreateLocal() ); + } + +// Destructor +CWlanSystemTimeHandler::~CWlanSystemTimeHandler() + { + DEBUG( "CWlanSystemTimeHandler::~CWlanSystemTimeHandler()" ); + + Cancel(); + iTimer.Close(); + } + +// --------------------------------------------------------- +// CWlanSystemTimeHandler::DoCancel +// Release synchronise call. Is called by CActive::Cancel() +// --------------------------------------------------------- +// +void CWlanSystemTimeHandler::DoCancel() + { + DEBUG( "CWlanSystemTimeHandler::DoCancel()" ); + iTimer.Cancel(); + } + +// --------------------------------------------------------- +// CWlanSystemTimeHandler::StartTimer +// --------------------------------------------------------- +// +TInt CWlanSystemTimeHandler::StartTimer() + { + TTime timeout; + timeout.HomeTime(); + timeout += TTimeIntervalYears( KWlanSystemTimeHandlerTimeoutTwoYears ); + + /** + * Set timeout to two years from now, just to receive notification when + * system time changes. + */ + iTimer.At(iStatus, timeout ); + + SetActive(); + +#ifdef _DEBUG + TBuf timeoutAt; + TRAP_IGNORE( timeout.FormatL( timeoutAt, KWlanSystemTimeHandlerDateTimeFormat ) ); + DEBUG1( "CWlanSystemTimeHandler::Start() - system time change notification timer started, timeout at: %S", &timeoutAt ); +#endif + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanSystemTimeHandler::StopTimer +// --------------------------------------------------------- +// +void CWlanSystemTimeHandler::StopTimer() + { + DEBUG( "CWlanSystemTimeHandler::StopTimer()" ); + Cancel(); + } + +// --------------------------------------------------------- +// CWlanSystemTimeHandler::RunL +// --------------------------------------------------------- +// +void CWlanSystemTimeHandler::RunL() + { + DEBUG1( "CWlanSystemTimeHandler::RunL() - iStatus: %d", iStatus.Int() ); + + switch( iStatus.Int() ) + { + case KErrAbort: + { + DEBUG( "CWlanSystemTimeHandler::RunL() - system time changed, informing client" ); + /** + * RTimer is aborted when system time changes. + * + * Inform client that system time has now been changed. + */ + iClient.OnSystemTimeChange(); + } + case KErrNone: // flow through from KErrAbort on purpose + { + Cancel(); + + TTime newTimeout; + newTimeout.HomeTime(); + newTimeout += TTimeIntervalYears( KWlanSystemTimeHandlerTimeoutTwoYears ); + + /** + * Set new timeout to two years from now, just to receive notification when + * system time changes next time. + */ + iTimer.At( iStatus, newTimeout ); + + SetActive(); + +#ifdef _DEBUG + TBuf timeoutAt; + TRAP_IGNORE( newTimeout.FormatL( timeoutAt, KWlanSystemTimeHandlerDateTimeFormat ) ); + DEBUG1( "CWlanSystemTimeHandler::RunL() - system time change notification timer restarted, timeout at: %S", &timeoutAt ); +#endif + + break; + } + default: + { + DEBUG( "CWlanSystemTimeHandler::RunL() - ERROR: problem setting up system time change notifications, notifications are now disabled" ); + Cancel(); + } + } + } + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanPeriodicCacheClearingHandler::CWlanPeriodicCacheClearingHandler( + MWlanSystemTimeCallback& aClient ) : + CActive( CActive::EPriorityStandard ), + iClearTimerCounter( 0 ), + iClient( aClient ) + { + DEBUG( "CWlanPeriodicCacheClearingHandler::CWlanPeriodicCacheClearingHandler()" ); + } + +// Static constructor. +CWlanPeriodicCacheClearingHandler* CWlanPeriodicCacheClearingHandler::NewL( + MWlanSystemTimeCallback& aClient) + { + DEBUG( "CWlanPeriodicCacheClearingHandler::NewL()" ); + CWlanPeriodicCacheClearingHandler* self = + new (ELeave) CWlanPeriodicCacheClearingHandler( aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Symbian 2nd phase constructor can leave. +void CWlanPeriodicCacheClearingHandler::ConstructL() + { + DEBUG( "CWlanPeriodicCacheClearingHandler::ConstructL()" ); + + CActiveScheduler::Add( this ); + User::LeaveIfError( iClearTimer.CreateLocal() ); + } + +// Destructor +CWlanPeriodicCacheClearingHandler::~CWlanPeriodicCacheClearingHandler() + { + DEBUG( "CWlanPeriodicCacheClearingHandler::~CWlanPeriodicCacheClearingHandler()" ); + + Cancel(); + iClearTimer.Close(); + } + +// --------------------------------------------------------- +// CWlanPeriodicCacheClearingHandler::DoCancel +// Release synchronise call. Is called by CActive::Cancel() +// --------------------------------------------------------- +// +void CWlanPeriodicCacheClearingHandler::DoCancel() + { + DEBUG( "CWlanPeriodicCacheClearingHandler::DoCancel()" ); + iClearTimer.Cancel(); + } + +// --------------------------------------------------------- +// CWlanPeriodicCacheClearingHandler::StartTimer +// --------------------------------------------------------- +// +TInt CWlanPeriodicCacheClearingHandler::StartTimer() + { + DEBUG( "CWlanPeriodicCacheClearingHandler::StartTimer()" ); + + // Issue an Asynchronous Request + iClearTimer.After(iStatus, KRegionCacheClearingTimer); + + // set it to active once request is issued + SetActive(); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanPeriodicCacheClearingHandler::StopTimer +// --------------------------------------------------------- +// +void CWlanPeriodicCacheClearingHandler::StopTimer() + { + DEBUG( "CWlanPeriodicCacheClearingHandler::StopTimer()" ); + Cancel(); + iClearTimerCounter = 0; + } + +// --------------------------------------------------------- +// CWlanPeriodicCacheClearingHandler::RunL +// Timer has expired. +// --------------------------------------------------------- +// +void CWlanPeriodicCacheClearingHandler::RunL() + { + DEBUG( "CWlanPeriodicCacheClearingHandler::RunL()" ); + + // This is the case when system time is changed and + // hence will cause the timer to abort with KErrAbort. + + if( iStatus.Int() == KErrNone && + iClearTimerCounter < KRegionCacheClearingTimerCount-1) + { + iClearTimerCounter += 1; + + // Issue an Asynchronous Request + iClearTimer.After(iStatus, KRegionCacheClearingTimer); + + // set it to active once request is issued + SetActive(); + + } + else if ( iStatus.Int() == KErrNone && + iClearTimerCounter >= KRegionCacheClearingTimerCount-1 ) + { + /* Inform client that system time has been changed so that + * region information cache can be cleared. + */ + iClient.OnCacheClearTimerExpiration(); + iClearTimerCounter = 0; + } + else + { + DEBUG( "CWlanPeriodicCacheClearingHandler::RunL() - time expired" ); + } + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlantimerservices.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlantimerservices.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,480 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements timer service with callback functionality. +* +*/ + +/* +* %version: 2 % +*/ + +#include +#include +#include "wlantimerservices.h" +#include "am_debug.h" + +const TInt KMaxTimerTimeout = 0x7FFFFFFF; +const TInt KFirstItemIndex = 0; +const TInt KNoRequests = -1; +const TInt KEntriesAreEqual = 0; +const TInt KFirstEntryIsBigger = 1; +const TInt KFirstEntryIsSmaller = -1; + +#ifdef _DEBUG +/** + * Formatting of date time debug string. + */ +_LIT( KWlanTimerServicesDateTimeFormat, "%F %*E %*N %D %H:%T:%S" ); + +/** + * Maximun length for date time debug string. + */ +const TInt KWlanTimerServicesMaxDateTimeStrLen = 50; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlanTimerServices::CWlanTimerServices() : + CActive( CActive::EPriorityStandard ), + iRequestId( 0 ) + { + DEBUG( "CWlanTimerServices::CWlanTimerServices()" ); + } + +// Static constructor. +CWlanTimerServices* CWlanTimerServices::NewL() + { + DEBUG( "CWlanTimerServices::NewL()" ); + CWlanTimerServices* self = + new (ELeave) CWlanTimerServices(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Symbian 2nd phase constructor can leave. +void CWlanTimerServices::ConstructL() + { + DEBUG( "CWlanTimerServices::ConstructL()" ); + + CActiveScheduler::Add( this ); + User::LeaveIfError( iTimer.CreateLocal() ); + + DEBUG( "CWlanTimerServices::ConstructL() - done" ); + } + +// Destructor +CWlanTimerServices::~CWlanTimerServices() + { + DEBUG( "CWlanTimerServices::~CWlanTimerServices()" ); + + Cancel(); + iTimer.Close(); + iRequests.Close(); + } + +// --------------------------------------------------------- +// CWlanTimerServices::DoCancel +// Is called by CActive::Cancel() +// --------------------------------------------------------- +// +void CWlanTimerServices::DoCancel() + { + DEBUG( "CWlanTimerServices::DoCancel()" ); + iTimer.Cancel(); + } + +// --------------------------------------------------------- +// CWlanTimerServices::CompareTimeouts +// --------------------------------------------------------- +// +TInt CWlanTimerServices::CompareTimeouts( const CTimeoutRequestEntry& aFirst, + const CTimeoutRequestEntry& aSecond ) + { + DEBUG( "CWlanTimerServices::CompareTimeouts()" ); + + TInt ret( 0 ); + + if( aFirst.At() == aSecond.At() ) + { + ret = KEntriesAreEqual; + } + else if( aFirst.At() > aSecond.At() ) + { + ret = KFirstEntryIsBigger; + } + else + { + ret = KFirstEntryIsSmaller; + } + + DEBUG1( "CWlanTimerServices::CompareTimeouts() - returning %d", ret ); + return ret; + } + +// --------------------------------------------------------- +// CWlanTimerServices::CalculateInterval +// --------------------------------------------------------- +// +TInt CWlanTimerServices::CalculateInterval( TTimeIntervalMicroSeconds32& aInterval, TTime& aAt, TBool& aDoSeveralRounds ) const + { + TTime currentTime; + currentTime.HomeTime(); + +#ifdef _DEBUG + TBuf dbgString, timeoutDbgStr; + TRAP_IGNORE( aAt.FormatL( timeoutDbgStr, KWlanTimerServicesDateTimeFormat ) ); + DEBUG1( "CWlanTimerServices::CalculateInterval() - timeout: %S", &timeoutDbgStr ); + TRAP_IGNORE( currentTime.FormatL( dbgString, KWlanTimerServicesDateTimeFormat ) ); + DEBUG1( "CWlanTimerServices::CalculateInterval() - time now: %S", &dbgString ); +#endif + + if( aAt < currentTime ) + { + DEBUG( "CWlanTimerServices::CalculateInterval() - timeout happens in past, returning KErrArgument" ); + return KErrArgument; + } + + TTimeIntervalDays days( aAt.DaysFrom( currentTime ) ); + DEBUG1( "CWlanTimerServices::CalculateInterval() - difference %d day(s)", days.Int() ); + if( days.Int() != 0 ) + { + DEBUG( "CWlanTimerServices::CalculateInterval() - difference day or more, adjusting timeout to same day" ); + TDateTime timeout = aAt.DateTime(); + TDateTime now = currentTime.DateTime(); + timeout.SetYear( now.Year() ); + timeout.SetMonth( now.Month() ); + timeout.SetDay( now.Day() ); + aAt = TTime( timeout ); + if( aAt < currentTime ) + { + DEBUG1( "CWlanTimerServices::CalculateInterval() - timeout would happen in past, adding %d day(s) to it", days.Int() ); + aAt += days; + } + +#ifdef _DEBUG + TBuf newTimeoutDbgStr; + TRAP_IGNORE( aAt.FormatL( newTimeoutDbgStr, KWlanTimerServicesDateTimeFormat ) ); + DEBUG1( "CWlanTimerServices::CalculateInterval() - timeout: %S", &newTimeoutDbgStr ); +#endif + } + + TTimeIntervalMicroSeconds difference = aAt.MicroSecondsFrom( currentTime ); + + TTimeIntervalMicroSeconds32 newInterval_32bit( KMaxTimerTimeout ); + + TTimeIntervalMicroSeconds interval_64bit( newInterval_32bit.Int() ); + + if ( difference < interval_64bit ) + { + newInterval_32bit = static_cast( difference.Int64() ); + aDoSeveralRounds = EFalse; + } + else + { + DEBUG( "CWlanTimerServices::CalculateInterval() - requested timeout so big it requires several timer rounds" ); + aDoSeveralRounds = ETrue; + } + + aInterval = newInterval_32bit; + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanTimerServices::StartTimer +// --------------------------------------------------------- +// +TInt CWlanTimerServices::StartTimer( TUint& aRequestId, TTime& aAt, MWlanTimerServiceCallback& aCb ) + { + TTimeIntervalMicroSeconds32 newInterval( 0 ); + TBool doSeveralRounds( EFalse ); + + TInt err = CalculateInterval( newInterval, aAt, doSeveralRounds ); + + if( err != KErrNone ) + { + DEBUG1( "CWlanTimerServices::StartTimer() - CalculateInterval() returned %d", err ); + return err; + } + + CTimeoutRequestEntry entry( aAt, aCb, ++iRequestId, doSeveralRounds ); + + TInt requestIdOfOriginallyFirstEntry( RequestIdOfFirstEntry() ); + + TLinearOrder order( CWlanTimerServices::CompareTimeouts ); + err = iRequests.InsertInOrder( entry, order ); + + if( err != KErrNone ) + { + DEBUG1( "CWlanTimerServices::StartTimer() - InsertInOrder() returned %d", err ); + return err; + } + + DEBUG1( "CWlanTimerServices::StartTimer() - new entry added to queue, request id %d", entry.RequestId() ); + +#ifdef _DEBUG + for( TInt i = 0; i < iRequests.Count(); i++ ) + { + DEBUG3( "CWlanTimerServices::StartTimer() - entry[%d]: request id %u, located @ 0x%08X", + i, + iRequests[i].RequestId(), + &iRequests[i] ); + } +#endif + + if( requestIdOfOriginallyFirstEntry != iRequests[0].RequestId() ) + { + // first request has changed, restart timer + ActivateTimer( newInterval ); + } + + aRequestId = iRequestId; + + DEBUG( "CWlanTimerServices::StartTimer() - done" ); + return KErrNone; + } + +// --------------------------------------------------------- +// CWlanTimerServices::RequestIdOfFirstEntry +// --------------------------------------------------------- +// +TInt CWlanTimerServices::RequestIdOfFirstEntry() + { + TInt idOfFirstEntry = KNoRequests; + if( iRequests.Count() > 0 ) + { + idOfFirstEntry = iRequests[KFirstItemIndex].RequestId(); + } + DEBUG1( "CWlanTimerServices::RequestIdOfFirstEntry() - returning %d", idOfFirstEntry ); + return idOfFirstEntry; + } + +// --------------------------------------------------------- +// CWlanTimerServices::RemoveRequest +// --------------------------------------------------------- +// +void CWlanTimerServices::RemoveRequest( const TUint& aRequestId ) + { + DEBUG1( "CWlanTimerServices::RemoveRequest( aRequestId: %u )", aRequestId ); + + TInt numOfRequests( iRequests.Count() ); + DEBUG1( "CWlanTimerServices::RemoveRequest() - numOfRequests: %d", numOfRequests ); + + for( TInt index( 0 ); index < numOfRequests; index++ ) + { + DEBUG2( "CWlanTimerServices::RemoveRequest() - checking iRequests[%d].RequestId: %d", index, iRequests[index].RequestId() ); + if( iRequests[index].RequestId() == aRequestId ) + { + DEBUG1( "CWlanTimerServices::RemoveRequest() - matching request id found, removing index: %d", index ); + iRequests.Remove( index ); + break; + } + } + + DEBUG( "CWlanTimerServices::RemoveRequest() - done" ); + } + +// --------------------------------------------------------- +// CWlanTimerServices::StopTimer +// --------------------------------------------------------- +// +void CWlanTimerServices::StopTimer( const TUint& aRequestId ) + { + DEBUG1( "CWlanTimerServices::StopTimer( aRequestId: %u )", aRequestId ); + + TInt numOfRequests( iRequests.Count() ); + DEBUG1( "CWlanTimerServices::StopTimer() - numOfRequests: %d", numOfRequests ); + + TInt requestIdOfOriginallyFirstEntry( RequestIdOfFirstEntry() ); + + DEBUG( "CWlanTimerServices::StopTimer() - calling RemoveRequest()" ); + RemoveRequest( aRequestId ); + DEBUG( "CWlanTimerServices::StopTimer() - RemoveRequest() returned" ); + + if( iRequests.Count() > 0 ) + { + if( requestIdOfOriginallyFirstEntry != iRequests[0].RequestId() ) + { + DEBUG( "CWlanTimerServices::StopTimer() - first request changed, updating timer" ); + + TTimeIntervalMicroSeconds32 newInterval( GetIntervalForNextRequest() ); + + ActivateTimer( newInterval ); + } +#ifdef _DEBUG + else + { + DEBUG( "CWlanTimerServices::StopTimer() - first request hasn't changed" ); + } +#endif + } + else + { + DEBUG( "CWlanTimerServices::StopTimer() - request count is zero, cancelling timer" ); + Cancel(); + iTimer.Cancel(); + } + DEBUG( "CWlanTimerServices::StopTimer() - done" ); + } + +// --------------------------------------------------------- +// CWlanTimerServices::GetIntervalForNextRequest +// --------------------------------------------------------- +// +TTimeIntervalMicroSeconds32 CWlanTimerServices::GetIntervalForNextRequest() + { + DEBUG( "CWlanTimerServices::GetIntervalForNextRequest()" ); + + TTimeIntervalMicroSeconds32 interval( 0 ); + + while( iRequests.Count() > 0 && + KErrArgument == CalculateInterval( interval, + iRequests[KFirstItemIndex].GetAt(), + iRequests[KFirstItemIndex].GetDoSeveralRounds() )) + { + DEBUG1( "CWlanTimerServices::GetIntervalForNextRequest() - request %u happens in past, time out and remove it", iRequests[KFirstItemIndex].RequestId() ); + TUint requestToBeRemoved = iRequests[KFirstItemIndex].RequestId(); + iRequests[KFirstItemIndex].Timeout(); + RemoveRequest( requestToBeRemoved ); + } + + DEBUG( "CWlanTimerServices::GetIntervalForNextRequest() - done" ); + return interval; + } + +// --------------------------------------------------------- +// CWlanTimerServices::RunL +// Timer has expired. +// --------------------------------------------------------- +// +void CWlanTimerServices::RunL() + { + + DEBUG1( "CWlanTimerServices::RunL() - iStatus: %d", iStatus.Int() ); + switch( iStatus.Int() ) + { + case KErrCancel: + { + DEBUG( "CWlanTimerServices::RunL() - iStatus == KErrCancel -> timer cancelled" ); + break; + } + case KErrNone: + { + DEBUG( "CWlanTimerServices::RunL() - iStatus == KErrNone -> timeout occurred" ); + HandleTimeout(); + break; + } + default: + { + DEBUG( "CWlanTimerServices::RunL() - unexpected iStatus!" ); + ASSERT( 0 ); + } + } + DEBUG( "CWlanTimerServices::RunL() - done" ); + } + +// --------------------------------------------------------- +// CWlanTimerServices::HandleTimeout +// --------------------------------------------------------- +// +void CWlanTimerServices::HandleTimeout() + { + DEBUG( "CWlanTimerServices::HandleTimeout()" ); + + Cancel(); + iTimer.Cancel(); + + // if requests exist... + if( iRequests.Count() ) + { + // if there's no need to do several rounds... + if( !IsTimeInFuture( iRequests[KFirstItemIndex].At() ) ) + //if( iRequests[KFirstItemIndex].GetDoSeveralRounds() == EFalse ) + { + // store id of the request to be timed out + TUint requestIdToTimeout = iRequests[KFirstItemIndex].RequestId(); + DEBUG1( "CWlanTimerServices::HandleTimeout() - timeout request %u", requestIdToTimeout ); + iRequests[KFirstItemIndex].Timeout(); + DEBUG( "CWlanTimerServices::HandleTimeout() - make sure timed out request is removed" ); + RemoveRequest( requestIdToTimeout ); + } + + TTimeIntervalMicroSeconds32 newInterval( GetIntervalForNextRequest() ); + + ActivateTimer( newInterval ); + + } +#ifdef _DEBUG + else + { + DEBUG( "CWlanTimerServices::HandleTimeout() - no requests" ); + } +#endif + DEBUG( "CWlanTimerServices::HandleTimeout() - done" ); + } + +// --------------------------------------------------------- +// CWlanTimerServices::HandleTimeout +// --------------------------------------------------------- +// +TBool CWlanTimerServices::IsTimeInFuture( const TTime& aAt ) const + { + DEBUG( "CWlanTimerServices::IsTimeInFuture()" ); + + TBool ret( ETrue ); + + TTime currentTime; + currentTime.HomeTime(); + +#ifdef _DEBUG + TBuf dbgString, timeoutDbgStr; + TRAP_IGNORE( aAt.FormatL( timeoutDbgStr, KWlanTimerServicesDateTimeFormat ) ); + DEBUG1( "CWlanTimerServices::IsTimeInFuture() - time to check: %S", &timeoutDbgStr ); + TRAP_IGNORE( currentTime.FormatL( dbgString, KWlanTimerServicesDateTimeFormat ) ); + DEBUG1( "CWlanTimerServices::IsTimeInFuture() - time now: %S", &dbgString ); +#endif + + if( aAt <= currentTime ) + { + DEBUG( "CWlanTimerServices::IsTimeInFuture() - time is not in the future" ); + ret = EFalse; + } + + DEBUG1( "CWlanTimerServices::IsTimeInFuture() - returning %d", ret ); + return ret; + } + +// --------------------------------------------------------- +// CWlanTimerServices::ActivateTimer +// --------------------------------------------------------- +// +void CWlanTimerServices::ActivateTimer( const TTimeIntervalMicroSeconds32& aInterval ) + { + DEBUG( "CWlanTimerServices::ActivateTimer()" ); + + if( aInterval.Int() ) + { + Cancel(); + iTimer.Cancel(); + iTimer.After( iStatus, aInterval ); + SetActive(); + DEBUG( "CWlanTimerServices::ActivateTimer() - timer active" ); + } + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmdriverif.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmdriverif.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1084 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to drivers +* +*/ + + +#include +#include "wlanlddcommon.h" + +#include "am_debug.h" +#include "wlmdriverif.h" +#include "wlanmgmtcommandhandler.h" +#include "wlanmgmtframehandler.h" +#include "wlannotificationhandler.h" +#include "wlanconversionutil.h" +#include "abs_core_driverif_callback.h" + +#define PDD_FILE_NAME _L("wlanpdd") +#define PDD_NAME _L("wlan.phys") + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::CWlmDriverIf +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWlmDriverIf::CWlmDriverIf() : + iCoreServer( NULL ), + iPendingRequestId( 0 ), + iNotificationHandler( NULL ), + iManagementCommandHandler( NULL ), + iManagementFrameHandler( NULL ), + iAsynchCallback( NULL ), + iErrorStatus( core_error_ok ), + iHwInit( NULL ), + iIsPDDLoaded( EFalse ), + iIsLDDLoaded( EFalse ), + iManagementStatus( NULL ) + { + DEBUG( "CWlmDriverIf::CWlmDriverIf()" ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWlmDriverIf* CWlmDriverIf::NewL() + { + DEBUG( "CWlmDriverIf::NewL()" ); + CWlmDriverIf* self = new(ELeave) CWlmDriverIf(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::ConstructL() + { + DEBUG( "CWlmDriverIf::ConstructL()" ); + + // Instantiate handlers + iManagementCommandHandler = CWlanMgmtCommandHandler::NewL( iChannel, *this ); + iManagementFrameHandler = CWlanMgmtFrameHandler::NewL( iChannel, *this ); + iNotificationHandler = CWlanNotificationHandler::NewL( iChannel, *this ); + // Instantiate asynch callback provider + // (mainly for error situations) + TCallBack callback( AsynchCallbackFunction, this ); + iAsynchCallback = new(ELeave) CAsyncCallBack( + callback, CActive::EPriorityStandard ); + iHwInit = CWlanHwInit::NewL(); + } + +// Destructor +CWlmDriverIf::~CWlmDriverIf() + { + DEBUG( "CWlmDriverIf::~CWlmDriverIf()" ); + delete iAsynchCallback; + delete iHwInit; + delete iManagementCommandHandler; + delete iManagementFrameHandler; + delete iNotificationHandler; + iCoreServer = NULL; + iManagementStatus = NULL; + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::init +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::init( + abs_core_driverif_callback_c* core_callback ) + { + iCoreServer = core_callback; + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::load_drivers +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::load_drivers( + u32_t request_id, + uint_t rts_threshold, + u32_t max_tx_msdu_lifetime, + u32_t qos_null_frame_entry_timeout, + u32_t qos_null_frame_entry_tx_count, + u32_t qos_null_frame_interval, + u32_t qos_null_frame_exit_timeout, + u32_t keep_alive_interval, + u32_t sp_rcpi_target, + u32_t sp_time_target, + u32_t sp_min_indication_interval ) + { + DEBUG( "CWlmDriverIf::load_drivers()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + // Buffer for initialization data + const TUint8* pdaData = NULL; + TUint pdaDataLength( 0 ); + // Buffer for firmware data + const TUint8* fwData = NULL; + TUint fwDataLength( 0 ); + // Get the data from CMT + iHwInit->GetHwInitData( &pdaData, pdaDataLength, &fwData, fwDataLength ); + + // Load physical device + DEBUG( "- loading PDD" ); + TInt err = KErrNone; + err = User::LoadPhysicalDevice( PDD_FILE_NAME ); + if( ( err != KErrNone ) && ( err != KErrAlreadyExists ) ) + { + DEBUG1("ERROR: PDD loading failed with %d", err ); + UnloadDrivers(); + iErrorStatus = core_error_drivers_not_loaded; + iAsynchCallback->CallBack(); + return; + } + iIsPDDLoaded = ETrue; + + // Load logical device + DEBUG( "- loading LDD" ); + err = User::LoadLogicalDevice( LDD_FILE_NAME ); + if( ( err != KErrNone ) && ( err != KErrAlreadyExists ) ) + { + DEBUG1("ERROR: LDD loading failed with %d", err ); + UnloadDrivers(); + iErrorStatus = core_error_drivers_not_loaded; + iAsynchCallback->CallBack(); + return; + } + iIsLDDLoaded = ETrue; + + // Open logical channel + DEBUG( "- Open logical channel" ); + TOpenParam openParam; + openParam.iPda = const_cast( pdaData ); + openParam.iPdaLength = pdaDataLength; + openParam.iFirmWare = const_cast( fwData ); + openParam.iFirmWareLength = fwDataLength; + err = iChannel.Open( KUnitWlan, openParam ); + if( err ) + { + DEBUG1("ERROR: Opening channel failed with %d", err ); + UnloadDrivers(); + iErrorStatus = core_error_drivers_not_loaded; + iAsynchCallback->CallBack(); + return; + } + + // Activate handlers + DEBUG( "- Activate handlers" ); + if( iNotificationHandler->IsActive() || + iNotificationHandler->Start() ) + { + DEBUG("ERROR starting notification handler"); + UnloadDrivers(); + iErrorStatus = core_error_drivers_not_loaded; + iAsynchCallback->CallBack(); + return; + } + if( iManagementFrameHandler->IsActive() || + iManagementFrameHandler->Start() ) + { + DEBUG("ERROR starting management frame handler"); + UnloadDrivers(); + iErrorStatus = core_error_drivers_not_loaded; + iAsynchCallback->CallBack(); + return; + } + + // Configure drivers + iManagementCommandHandler->Configure( + static_cast( rts_threshold ), + max_tx_msdu_lifetime, + qos_null_frame_entry_timeout, + qos_null_frame_entry_tx_count, + qos_null_frame_interval, + qos_null_frame_exit_timeout, + keep_alive_interval, + sp_rcpi_target, + sp_time_target, + sp_min_indication_interval ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::unload_drivers +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::unload_drivers( u32_t request_id ) + { + DEBUG( "CWlmDriverIf::unload_drivers()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + // Unloading is actually asynchronous + UnloadDrivers(); + + // Order a callback + iErrorStatus = core_error_ok; + iAsynchCallback->CallBack(); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::UnloadDrivers +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::UnloadDrivers() + { + DEBUG( "CWlmDriverIf::UnloadDrivers()" ); + // Cancel notification and management frame observations + if( iNotificationHandler->IsActive() ) + { + DEBUG( "- cancelling iNotificationHandler" ); + iNotificationHandler->Stop(); + } + if( iManagementFrameHandler->IsActive() ) + { + DEBUG( "- cancelling iManagementFrameHandler" ); + iManagementFrameHandler->Stop(); + } + + TInt err( KErrNone ); + if( iIsLDDLoaded ) + { + DEBUG( "- closing logical channel" ); + iChannel.CloseChannel(); + err = User::FreeLogicalDevice( LDD_NAME ); + iIsLDDLoaded = EFalse; + if ( err != KErrNone ) + { + DEBUG1( "ERROR: FreeLogicalDevice() failed with %d", err ); + } + } + + if( iIsPDDLoaded ) + { + err = User::FreePhysicalDevice( PDD_NAME ); + iIsPDDLoaded = EFalse; + if ( err != KErrNone ) + { + DEBUG1( "ERROR: FreePhysicalDevice() failed with %d", err ); + } + } + DEBUG( "- UnloadDrivers DONE" ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::start_ibss +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::start_ibss( + u32_t request_id, + const core_ssid_s& ssid, + u32_t beacon_interval, + u32_t channel, + core_encryption_mode_e encrypt_level ) + { + DEBUG( "CWlmDriverIf::start_ibss()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + TSSID id; + TWlanConversionUtil::ConvertSSID( id, ssid ); + iManagementCommandHandler->StartIBSS( + id, + beacon_interval, + channel, + TWlanConversionUtil::ConvertEncryptionMode( encrypt_level ) ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::scan +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::scan( + u32_t request_id, + core_scan_mode_e scan_mode, + const core_ssid_s& scan_ssid, + int_t scan_rate, + const core_scan_channels_s& scan_channels, + u32_t scan_min_ch_time, + u32_t scan_max_ch_time, + bool_t is_split_scan ) + { + DEBUG( "CWlmDriverIf::scan()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + // Convert needed parameters + TSSID id; + TWlanConversionUtil::ConvertSSID( id, scan_ssid ); + TScanMode scanmode = TWlanConversionUtil::ConvertScanMode( scan_mode ); + TRate rate = TWlanConversionUtil::ConvertScanRate( scan_rate ); + SChannels channels; + TWlanConversionUtil::ConvertScanChannels( channels, scan_channels ); + + // Send command to commandhandler + iManagementCommandHandler->Scan( + scanmode, + id, + rate, + channels, + scan_min_ch_time, + scan_max_ch_time, + is_split_scan ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::stop_scan +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::stop_scan( + u32_t request_id ) + { + DEBUG( "CWlmDriverIf::stop_scan()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + // Send command to commandhandler + iManagementCommandHandler->StopScan(); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::disconnect +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::disconnect( u32_t request_id ) + { + DEBUG( "CWlmDriverIf::disconnect()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->Disconnect(); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_power_mode +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_power_mode( + u32_t request_id, + const core_power_mode_s& mode ) + { + DEBUG( "CWlmDriverIf::set_power_mode()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + TPowerMode amMode( EPowerModeCam ); + TWlanWakeUpInterval amWakeUpModeLight( EWakeUpIntervalAllBeacons ); + TUint8 amWakeUpIntervalLight( 0 ); + TWlanWakeUpInterval amWakeUpModeDeep( EWakeUpIntervalAllDtims ); + TUint8 amWakeUpIntervalDeep( 0 ); + + amMode = TWlanConversionUtil::ConvertPowerMode( + mode.mode ); + TWlanConversionUtil::ConvertWakeUpInterval( + amWakeUpModeLight, + amWakeUpIntervalLight, + mode.wakeup_mode_light, + mode.wakeup_interval_light ); + TWlanConversionUtil::ConvertWakeUpInterval( + amWakeUpModeDeep, + amWakeUpIntervalDeep, + mode.wakeup_mode_deep, + mode.wakeup_interval_deep ); + + iManagementCommandHandler->SetPowerMode( + amMode, + mode.disable_dynamic_ps, + amWakeUpModeLight, + amWakeUpIntervalLight, + amWakeUpModeDeep, + amWakeUpIntervalDeep ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_tx_power_level +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_tx_power_level( + u32_t request_id, + u32_t tx_level ) + { + DEBUG( "CWlmDriverIf::set_tx_power_level()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + // Send command to commandhandler + iManagementCommandHandler->SetTxPowerLevel( tx_level ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::add_cipher_key +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::add_cipher_key( + core_cipher_key_type_e cipher_suite, + u8_t key_index, + u16_t key_length, + const u8_t* key_data, + const core_mac_address_s& mac, + bool_t use_as_default ) + { + DEBUG( "CWlmDriverIf::add_cipher_key()" ); + + TMacAddress macAddr; + TWlanConversionUtil::ConvertMacAddress( macAddr, mac ); + + iManagementCommandHandler->AddCipherKey( + TWlanConversionUtil::ConvertCipherKeyType( cipher_suite ), + key_index, // no conversion needed + static_cast( key_length ), // u16_t -> TUint32 + key_data, // no conversion needed + macAddr, + use_as_default ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::get_current_rcpi +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::get_current_rcpi( + u32_t request_id, + u32_t& rcpi ) + { + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + DEBUG( "CWlmDriverIf::get_last_rcpi()" ); + iManagementCommandHandler->GetLastRCPI( + rcpi ); // no conversion needed + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::configure_multicast_group +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::configure_multicast_group( + u32_t request_id, + bool_t join_group, + const core_mac_address_s& multicast_addr ) + { + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + DEBUG( "CWlmDriverIf::configure_multicast_group()" ); + TMacAddress mac; + TWlanConversionUtil::ConvertMacAddress( mac, multicast_addr ); + iManagementCommandHandler->ConfigureMulticastGroup( + join_group, + mac ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_bss_lost_parameters +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_bss_lost_parameters( + u32_t request_id, + const core_bss_lost_parameters_s& parameters ) + { + DEBUG( "CWlmDriverIf::set_bss_lost_parameters()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetBssLostParameters( + parameters.beacon_lost_count, + parameters.failed_tx_packet_count ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_tx_rate_adaptation_parameters +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_tx_rate_adaptation_parameters( + u32_t request_id, + const core_tx_rate_adaptation_parameters_s& parameters ) + { + DEBUG( "CWlmDriverIf::set_tx_rate_adaptation_parameters()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetTxRateAdaptationParameters( + parameters.min_stepup_checkpoint, + parameters.max_stepup_checkpoint, + parameters.stepup_checkpoint_factor, + parameters.stepdown_checkpoint, + parameters.min_stepup_threshold, + parameters.max_stepup_threshold, + parameters.stepup_threshold_increment, + parameters.stepdown_threshold, + parameters.disable_probe_handling ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_power_mode_mgmt_parameters +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_power_mode_mgmt_parameters( + u32_t request_id, + const core_power_mode_mgmt_parameters_s& parameters ) + { + DEBUG( "CWlmDriverIf::set_power_mode_mgmt_parameters()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetPowerModeMgmtParameters( + parameters.active_to_light_timeout, + parameters.active_to_light_threshold, + parameters.light_to_active_timeout, + parameters.light_to_active_threshold, + parameters.light_to_deep_timeout, + parameters.light_to_deep_threshold, + parameters.uapsd_rx_frame_length_threshold ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_tx_rate_policies +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_tx_rate_policies( + u32_t request_id, + const core_tx_rate_policies_s& policies, + const core_tx_rate_policy_mappings_s& mappings ) + { + DEBUG( "CWlmDriverIf::set_tx_rate_policies()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + TTxRatePolicy amPolicies; + THtMcsPolicy amMcsPolicies; + TTxAutoRatePolicy amAutoRatePolicies; + TWlanConversionUtil::ConvertTxRatePolicies( amPolicies, amMcsPolicies, amAutoRatePolicies, policies ); + TQueue2RateClass amMappings; + TWlanConversionUtil::ConvertTxRatePolicyMappings( amMappings, mappings ); + TInitialMaxTxRate4RateClass amInitialRates; + TWlanConversionUtil::ConvertTxRatePolicyInitialRates( amInitialRates, policies ); + + iManagementCommandHandler->SetTxRatePolicies( + amPolicies, + amMcsPolicies, + amMappings, + amInitialRates, + amAutoRatePolicies ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::get_packet_statistics +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::get_packet_statistics( + u32_t request_id, + core_packet_statistics_by_access_category_s& statistics ) + { + DEBUG( "CWlmDriverIf::get_packet_statistics()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->GetPacketStatistics( + reinterpret_cast( statistics ) ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_uapsd_settings +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_uapsd_settings( + u32_t request_id, + const core_uapsd_settings_s& settings ) + { + DEBUG( "CWlmDriverIf::set_uapsd_settings()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetUapsdSettings( + TWlanConversionUtil::ConvertUapsdMaxServicePeriod( settings.max_service_period ), + settings.uapsd_enabled_for_voice, + settings.uapsd_enabled_for_video, + settings.uapsd_enabled_for_best_effort, + settings.uapsd_enabled_for_background ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_power_save_settings +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_power_save_settings( + u32_t request_id, + const core_power_save_settings_s& settings ) + { + DEBUG( "CWlmDriverIf::set_power_save_settings()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetPowerSaveSettings( + settings.stay_in_uapsd_power_save_for_voice, + settings.stay_in_uapsd_power_save_for_video, + settings.stay_in_uapsd_power_save_for_best_effort, + settings.stay_in_uapsd_power_save_for_background, + settings.stay_in_legacy_power_save_for_voice, + settings.stay_in_legacy_power_save_for_video, + settings.stay_in_legacy_power_save_for_best_effort, + settings.stay_in_legacy_power_save_for_background ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_tx_queue_parameters +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_tx_queue_parameters( + u32_t request_id, + core_access_class_e queue_id, + u16_t medium_time, + u32_t max_tx_msdu_lifetime ) + { + DEBUG( "CWlmDriverIf::set_tx_queue_parameters()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetTxQueueParameters( + TWlanConversionUtil::ConvertTxQueueId( queue_id ), + medium_time, + max_tx_msdu_lifetime ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_rcpi_trigger_level +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_rcpi_trigger_level( + u32_t request_id, + u8_t rcpi_trigger ) + { + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetRcpiTriggerLevel( rcpi_trigger ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::enable_user_data +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::enable_user_data( u32_t request_id ) + { + DEBUG( "CWlmDriverIf::enable_user_data()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->EnableUserData(); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::disable_user_data +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::disable_user_data( u32_t request_id ) + { + DEBUG( "CWlmDriverIf::disable_user_data()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->DisableUserData(); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::connect +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::connect( + u32_t request_id, + core_management_status_e& status, + const core_ssid_s& ssid, + const core_mac_address_s& bssid, + u16_t auth_algorithm, + core_encryption_mode_e encryption_level, + core_cipher_key_type_e pairwise_key_type, + bool_t is_infra, + u32_t ie_data_length, + const u8_t* ie_data, + u32_t scan_frame_length, + const u8_t* scan_frame, + bool_t is_pairwise_key_invalidated, + bool_t is_group_key_invalidated, + bool_t is_radio_measurement_supported ) + { +#ifdef _DEBUG + if( is_infra == true_t ) + { + DEBUG( "CWlmDriverIf::connect() - infrastructure" ); + } + else + { + DEBUG( "CWlmDriverIf::connect() - adhoc" ); + } +#endif // _DEBUG + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementStatus = &status; + + TSSID tmpSsid; + TWlanConversionUtil::ConvertSSID( tmpSsid, ssid ); + TMacAddress tmpBssid; + TWlanConversionUtil::ConvertMacAddress( tmpBssid, bssid ); + + iManagementCommandHandler->Connect( + tmpSsid, + tmpBssid, + auth_algorithm, + TWlanConversionUtil::ConvertEncryptionMode( encryption_level ), + TWlanConversionUtil::ConvertCipherKeyType( pairwise_key_type ), + is_infra, + ie_data_length, + ie_data, + scan_frame_length, + scan_frame, + is_pairwise_key_invalidated, + is_group_key_invalidated, + is_radio_measurement_supported ); + + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::cancel_request +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::cancel_request( + u32_t /* request_id */ ) + { + iManagementCommandHandler->Cancel(); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::send_frame +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::send_frame( + core_frame_type_e frame_type, + const u16_t frame_length, + const u8_t* const frame_data, + u8_t frame_priority, + const core_mac_address_s& destination, + bool_t send_encrypted ) + { + DEBUG( "CWlmDriverIf::send_frame()" ); + + TMacAddress macAddr; + TWlanConversionUtil::ConvertMacAddress( macAddr, destination ); + + iManagementFrameHandler->SendFrame( + TWlanConversionUtil::ConvertFrameType( frame_type ), + static_cast( frame_length ), + frame_data, + frame_priority, + macAddr, + send_encrypted ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_arp_filter +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_arp_filter( + u32_t /* request_id */, + const core_arp_filter_s& /* filter */ ) + { + // Not supported currently + ASSERT( false_t ); + return; + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_block_ack_usage +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_block_ack_usage( + u32_t request_id, + const core_block_ack_usage_s& usage ) + { + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + iManagementCommandHandler->SetBlockAckUsage( + usage.tx_usage, + usage.rx_usage ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::set_snap_header_filter +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::set_snap_header_filter( + u32_t request_id, + const core_snap_header_s& header ) + { + DEBUG( "CWlmDriverIf::set_snap_header_filter()" ); + + // Set request id and ensure no prior requests are pending + if( SetRequestId( request_id ) ) + { + ASSERT( false_t ); + return; + } + + TSnapHeader amHeader; + TWlanConversionUtil::ConvertSnapHeader( amHeader, header ); + + iManagementCommandHandler->SetSnapHeaderFilter( + amHeader ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::OnNotify +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::OnNotify( const TIndication& aIndication ) + { + DEBUG( "CWlmDriverIf::OnNotify" ); + iCoreServer->notify( TWlanConversionUtil::ConvertIndication( aIndication ) ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::OnFrameReceive +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::OnFrameReceive( + const TDataBuffer::TFrameType aFrameType, + const TUint aLength, + const TUint8* const aData, + TUint8 aRcpi ) + { + DEBUG( "CWlmDriverIf::ReceivePacket" ); + ASSERT( iCoreServer ); + iCoreServer->receive_frame( + TWlanConversionUtil::ConvertFrameType( aFrameType ), + static_cast( aLength ), + aData, + aRcpi ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::OnRequestComplete +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::OnRequestComplete( TInt status ) + { + DEBUG1( "CWlmDriverIf::OnRequestComplete (status == %d)", status ); + // Save pending reqId to a local stack variable, + // and reset the corresponding member variable in order to guarantee + // that driverIf is capable to accept new request + TUint32 tmp = iPendingRequestId; + iPendingRequestId = 0; + if ( iManagementStatus && + status > KErrNone ) + { + *iManagementStatus = static_cast( status ); + iManagementStatus = NULL; + } + + iCoreServer->request_complete( + tmp, + TWlanConversionUtil::ConvertErrorCode( status ) ); + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::AsynchCallbackFunction +// ----------------------------------------------------------------------------- +// +TInt CWlmDriverIf::AsynchCallbackFunction( TAny* aThisPtr ) + { + CWlmDriverIf* self = static_cast( aThisPtr ); + DEBUG2( "CWlmDriverIf::AsynchCallbackFunction (reqId == %d, status == %d)", + self->iPendingRequestId, + self->iErrorStatus ); + + // Save pending reqId/errorStatus to a local stack variable, + // and reset the corresponding member variables in order to guarantee + // that driverIf is capable to accept new request + TUint32 tmpReqId = self->iPendingRequestId; + self->iPendingRequestId = 0; + core_error_e tmpError = self->iErrorStatus; + self->iErrorStatus = core_error_ok; + + self->iCoreServer->request_complete( tmpReqId, tmpError ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::SetRequestId +// ----------------------------------------------------------------------------- +// +TInt CWlmDriverIf::SetRequestId( TUint32 aRequestId ) + { + // Save the request_id + if( iPendingRequestId != 0 ) + { + DEBUG("ERROR: command already pending"); + ASSERT( EFalse ); + iErrorStatus = core_error_drivers_not_loaded; + iAsynchCallback->CallBack(); + return KErrInUse; + } + else + { + iPendingRequestId = aRequestId; + iManagementStatus = NULL; + return KErrNone; + } + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::GetMacAddress +// ----------------------------------------------------------------------------- +// +TInt CWlmDriverIf::GetMacAddress( TMacAddress& aMac ) + { + TMacAddr tmp; + TInt ret = iHwInit->GetMacAddress( tmp ); + + TWlanConversionUtil::ConvertMacAddress( aMac, tmp ); + + return ret; + } + +// ----------------------------------------------------------------------------- +// CWlmDriverIf::Notify +// ----------------------------------------------------------------------------- +// +void CWlmDriverIf::Notify( core_am_indication_e aIndication ) + { + iCoreServer->notify( aIndication ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmnotification.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmnotification.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Notification from engine +* +*/ + + +#include "wlmnotification.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSessionNotification::CSessionNotification +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSessionNotification::CSessionNotification( + CWlmSession& aSession, + TUint32 aNotificationMask ) : + iSession( aSession ), + iNotificationMask( aNotificationMask ) + { + DEBUG( "CSessionNotification::CSessionNotification()" ); + } + +// ----------------------------------------------------------------------------- +// CSessionNotification::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSessionNotification* CSessionNotification::NewL( + CWlmSession& aSession, + TUint32 aNotificationMask ) + { + DEBUG( "CSessionNotification::NewL()" ); + CSessionNotification* self = + new( ELeave ) CSessionNotification( aSession, aNotificationMask ); + return self; + } + +// Destructor +CSessionNotification::~CSessionNotification() + { + DEBUG( "CSessionNotification::~CSessionNotification()" ); + } + +// ----------------------------------------------------------------------------- +// CSessionNotification::AddNotification +// ----------------------------------------------------------------------------- +// +void CSessionNotification::AddNotification( + TUint aNotification, + TDes8& aData ) + { + DEBUG( "CSessionNotification::AddNotification()" ); + + if( iNotificationMask & aNotification ) + { + iSession.AddNotification( aNotification, aData ); + } + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmnotify.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmnotify.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,281 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Notification class +* +*/ + +/* +* %version: 16 % +*/ + +#include "rwlmserver.h" +#include "am_debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWLMNotify::ConstructL +// --------------------------------------------------------- +// +void CWLMNotify::ConstructL() + { + DEBUG( "CWLMNotify::ConstructL()" ); + CActiveScheduler::Add( this ); + WaitForNotifications(); + } + +// --------------------------------------------------------- +// CWLMNotify::CWLMNotify +// --------------------------------------------------------- +// +CWLMNotify::CWLMNotify( + MWLMNotify& aCallback, + RWLMServer& aServer, + TUint32 aNotificationMask ): + CActive( CActive::EPriorityStandard ), + iCallback( &aCallback ), + iServer( aServer ), + iDataPckg(), + iCancelRequested( EFalse ), + iNotificationMask( aNotificationMask ) + { + DEBUG( "CWLMNotify::CWLMNotify()" ); + } + +// --------------------------------------------------------- +// CWLMNotify::~CWLMNotify +// --------------------------------------------------------- +// +CWLMNotify::~CWLMNotify() + { + DEBUG( "CWLMNotify::~CWLMNotify()" ); + Cancel(); + iCallback = NULL; + } + +// --------------------------------------------------------- +// CWLMNotify::DoCancel +// This is been called when active object should be +// cancelled. This is called by CActive::Cancel(). +// --------------------------------------------------------- +// +void CWLMNotify::DoCancel() + { + DEBUG( "CWLMNotify::DoCancel()" ); + iServer.CancelRequest(); + } + +// --------------------------------------------------------- +// CWLMNotify::NewL +// --------------------------------------------------------- +// +CWLMNotify* CWLMNotify::NewL( + MWLMNotify& aCallback, + RWLMServer& aServer, + TUint32 aNotificationMask ) + { + DEBUG( "CWLMNotify::NewL()" ); + CWLMNotify* self = new (ELeave) CWLMNotify( aCallback, aServer, aNotificationMask ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWLMNotify::RunL +// This is called when a response is received to a +// asynchronous message. This method dispatches +// notifications to client's interface. +// --------------------------------------------------------- +// +void CWLMNotify::RunL() + { + DEBUG1( "CWLMNotify::RunL() - status == %d", iStatus.Int() ); + + if( iStatus == KRequestPending ) + { + DEBUG( "CWLMNotify::RunL() - request still pending!" ); + return; + } + + if( iStatus == KErrServerTerminated ) + { + DEBUG( "CWLMNotify::RunL() - server terminated" ); + return; + } + + switch( iStatus.Int() ) + { + case EWlmNotifyConnectionStateChanged: + { + iCallback->ConnectionStateChanged( + static_cast( iDataPckg().data[0] )); + break; + } + case EWlmNotifyBssidChanged: + { + iCallback->BSSIDChanged( iDataPckg().data ); + break; + } + case EWlmNotifyBssLost: + { + iCallback->BSSLost(); + break; + } + case EWlmNotifyBssRegained: + { + iCallback->BSSRegained(); + break; + } + case EWlmNotifyNewNetworksDetected: + { + iCallback->NewNetworksDetected(); + break; + } + case EWlmNotifyOldNetworksLost: + { + iCallback->OldNetworksLost(); + break; + } + case EWlmNotifyTransmitPowerChanged: + { + TUint power( 0 ); + // safer to copy than cast: alignment might not be correct + Mem::Copy( &power, iDataPckg().data.Ptr(), sizeof( power ) ); + DEBUG1( "CWLMNotify::RunL() - transmit power changed to %u", power ); + iCallback->TransmitPowerChanged( power ); + break; + } + case EWlmNotifyNotificationsCancelled: + { + DEBUG( "CWLMNotify::RunL() - notifications cancelled" ); + return; // Do NOT call WaitForNotifications() + } + case EWlmNotifyRcpChanged: + { + TWlanRCPLevel rcpLevel = static_cast( iDataPckg().data[0] ); + TUint rcp = static_cast( iDataPckg().data[1] ); + DEBUG2( "CWLMNotify::RunL() - EWlmNotifyRcpChanged %d, %d", rcpLevel, rcp ); + iCallback->RcpChanged( rcpLevel, rcp ); + break; + } + case EWlmNotifyTrafficStreamStatusChanged: + { + TUint id( 0 ); + // safer to copy than cast: alignment might not be correct + Mem::Copy( &id, iDataPckg().data.Ptr(), sizeof( id ) ); + TWlanTrafficStreamStatus status = + static_cast( iDataPckg().data[4] ); + DEBUG2( "CWLMNotify::RunL() - status of traffic stream %u changed to %u", id, status ); + iCallback->TrafficStreamStatusChanged( id, status ); + break; + } + case EWlmNotifyAccessPointInfoChanged: + { + TWlanAccessPointInfo info; + Mem::Copy( &info, iDataPckg().data.Ptr(), sizeof( info ) ); + + DEBUG5( "CWLMNotify::RunL() - AP info changed (Voice = %u, Video = %u, BestEffort = %u, Background = %u, WPX = %u)", + info.isAcRequiredForVoice, + info.isAcRequiredForVideo, + info.isAcRequiredForBestEffort, + info.isAcRequiredForBackground, + info.isWpx ); + + iCallback->AccessPointInfoChanged( info ); + break; + } + case EWlmNotifyAcTrafficModeChanged: + { + TWlmAccessClass accessClass( + static_cast( iDataPckg().data[0] ) ); + TWlmAcTrafficMode mode( + static_cast( iDataPckg().data[1] ) ); + + DEBUG2( "CWLMNotify::RunL() - traffic mode of access class (%u) changed to %u", + accessClass, mode ); + + iCallback->AccessClassTrafficModeChanged( + accessClass, + mode ); + break; + } + case EWlmNotifyAcTrafficStatusChanged: + { + TWlmAccessClass accessClass( + static_cast( iDataPckg().data[0] ) ); + TWlmAcTrafficStatus status( + static_cast( iDataPckg().data[1] ) ); + + DEBUG2( "CWLMNotify::RunL() - traffic status of access class (%u) changed to %u", + accessClass, status ); + + iCallback->AccessClassTrafficStatusChanged( + accessClass, + status ); + break; + } + default: + DEBUG1( "CWLMNotify::RunL() - unknown notification: %d", iStatus.Int() ); + } + + // Make a new notification request if allowed + if( !iCancelRequested ) + { + WaitForNotifications(); + } + else + { + DEBUG("CWLMNotify::RunL() - cancellation has been requested -> cancelling request."); + iServer.CancelRequest(); + } + } + +// --------------------------------------------------------- +// CWLMNotify::WaitForNotifications +// The loop goes: WaitForNotifications->RunL-> +// WaitForNotifications->... +// --------------------------------------------------------- +// +void CWLMNotify::WaitForNotifications() + { + DEBUG( "CWLMNotify::WaitForNotifications()" ); + iServer.WaitForNotification( iStatus, iDataPckg, iNotificationMask ); + SetActive(); + } + +// --------------------------------------------------------- +// CWLMNotify::Activate +// --------------------------------------------------------- +// +void CWLMNotify::Activate( + MWLMNotify& aCallback, + TUint32 aNotificationMask ) + { + DEBUG( "CWLMNotify::Activate()" ); + iCallback = &aCallback; + iCancelRequested = EFalse; + iNotificationMask = aNotificationMask; + WaitForNotifications(); + } + +// --------------------------------------------------------- +// CWLMNotify::SetCancelled +// --------------------------------------------------------- +// +void CWLMNotify::SetCancelled() + { + iCancelRequested = ETrue; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatform.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,325 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Offers API to platform for the rest of the engine +* +*/ + + +#include +#include "wlmplatform.h" +#include "wlmplatformdata.h" +#include "am_debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlmPlatform::CWlmPlatform( MWlmPlatformCallback& aCallback ) : + iCallback( aCallback ), + iCurrentSystemMode( EWlanSystemStartupInProgress ), + iPlatformData( NULL ), + iWlanConnectedBeforeEmergencyCall( EFalse ), + iSystemTimeHandler( NULL ), + iPeriodicCacheClearingHandler( NULL ) + { + DEBUG( "CWlmPlatform::CWlmPlatform()" ); + } + +// Symbian 2nd phase constructor can leave. +void CWlmPlatform::ConstructL() + { + DEBUG( "CWlmPlatform::ConstructL()" ); + + iPlatformData = CWlmPlatformData::NewL( *this ); + iSystemTimeHandler = CWlanSystemTimeHandler::NewL( *this ); + iPeriodicCacheClearingHandler = CWlanPeriodicCacheClearingHandler::NewL ( *this ); + } + +// Static constructor. +EXPORT_C CWlmPlatform* CWlmPlatform::NewL( MWlmPlatformCallback& aCallback ) + { + DEBUG( "CWlmPlatform::NewL()" ); + + CWlmPlatform* self = new(ELeave) CWlmPlatform( aCallback ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +EXPORT_C CWlmPlatform::~CWlmPlatform() + { + DEBUG( "CWlmPlatform::~CWlmPlatform()" ); + + delete iPlatformData; + delete iSystemTimeHandler; + delete iPeriodicCacheClearingHandler; + } + +// --------------------------------------------------------- +// CWlmPlatform::Initialize +// --------------------------------------------------------- +// +EXPORT_C void CWlmPlatform::Initialize() + { + DEBUG( "CWlmPlatform::Initialize()" ); + + iPlatformData->UpdateSystemStatuses(); + } + +// --------------------------------------------------------- +// CWlmPlatform::GetScanType +// --------------------------------------------------------- +// +EXPORT_C TWLMScanType CWlmPlatform::GetScanType() + { + DEBUG( "CWlmPlatform::GetScanType()" ); + + // + // No scans if WLAN has been disabled or system is just + // starting up. + // + if( iCurrentSystemMode == EWlanSystemDisabled || + iCurrentSystemMode == EWlanSystemStartupInProgress ) + { + return EWLMScanNotAllowed; + } + + // + // Scans are passive in PDA/Flight profile until a connection + // has been made. + // + if( iCallback.GetCurrentState() == EWlanStateNotConnected && + iCurrentSystemMode == EWlanSystemFlight ) + { + return EWLMScanForcedPassive; + } + + return EWLMScanAsRequested; + } + +// --------------------------------------------------------- +// CWlmPlatform::IsWlanDisabled +// --------------------------------------------------------- +// +EXPORT_C TBool CWlmPlatform::IsWlanDisabled() + { + if( iCurrentSystemMode == EWlanSystemDisabled ) + { + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------- +// CWlmPlatform::GetCurrentSystemMode +// --------------------------------------------------------- +// +EXPORT_C TWlanSystemMode CWlmPlatform::GetCurrentSystemMode() + { + DEBUG( "CWlmPlatform::GetCurrentSystemMode()" ); + + return iCurrentSystemMode; + } + +// --------------------------------------------------------- +// CWlmPlatform::SetIconState +// --------------------------------------------------------- +// +EXPORT_C TInt CWlmPlatform::SetIconState( TWlmIconStatus aStatus ) + { + if ( aStatus != EWlmIconStatusConnected && + aStatus != EWlmIconStatusConnectedSecure ) + { + iWlanConnectedBeforeEmergencyCall = EFalse; + } + + return iPlatformData->SetIconState( aStatus ); + } + +// --------------------------------------------------------- +// CWlmPlatform::GetCurrentOperatorMccL +// --------------------------------------------------------- +// +EXPORT_C void CWlmPlatform::GetCurrentOperatorMccL( TUint& aCountryCode ) + { + iPlatformData->GetCurrentOperatorMccL( aCountryCode ); + } + +// --------------------------------------------------------- +// CWlmPlatform::PublishMacAddress +// --------------------------------------------------------- +// +EXPORT_C TInt CWlmPlatform::PublishMacAddress( TMacAddress& aMacAddr ) + { + return iPlatformData->PublishMacAddress( aMacAddr ); + } + +// --------------------------------------------------------- +// CWlmPlatform::InitializeSystemTimeHandler +// --------------------------------------------------------- +// +EXPORT_C void CWlmPlatform::InitializeSystemTimeHandler() + { + DEBUG( "CWlmPlatform::InitializeSystemTimeHandler()" ); + + iSystemTimeHandler->StopTimer(); + iPeriodicCacheClearingHandler->StopTimer(); + + iSystemTimeHandler->StartTimer(); + iPeriodicCacheClearingHandler->StartTimer(); + } + +// --------------------------------------------------------- +// CWlmPlatform::SystemModeChanged +// --------------------------------------------------------- +// +void CWlmPlatform::SystemModeChanged( + TWlanSystemMode aOldMode, + TWlanSystemMode aNewMode ) + { + DEBUG( "CWlmPlatform::SystemModeChanged()" ); + + if ( aOldMode != aNewMode ) + { + DEBUG2( "System Mode changed from %u to %u", aOldMode, aNewMode ); + iCurrentSystemMode = aNewMode; + + /** + * The "order" of System Modes is + * 1) GSM + * 2) Flight + * 3) Disabled + * 4) Starting + */ + if ( aOldMode < aNewMode ) + { + iCallback.ReleaseRequest(); + } + else if ( aOldMode == EWlanSystemDisabled ) + { + iCallback.EnableWlan(); + } + else if ( aOldMode == EWlanSystemStartupInProgress ) + { + iCallback.StartupComplete(); + } + } + } + +// --------------------------------------------------------- +// CWlmPlatform::EmergencyCallEstablished +// --------------------------------------------------------- +// +void CWlmPlatform::EmergencyCallEstablished() + { + DEBUG( "CWlmPlatform::EmergencyCallEstablished()" ); + + iCurrentSystemMode = EWlanSystemNormal; + iCallback.EnableWlan(); + + if ( iCallback.GetCurrentState() == EWlanStateInfrastructure || + iCallback.GetCurrentState() == EWlanStateIBSS || + iCallback.GetCurrentState() == EWlanStateSecureInfra ) + { + iWlanConnectedBeforeEmergencyCall = ETrue; + } + } + +// --------------------------------------------------------- +// CWlmPlatform::EmergencyCallCompleted +// --------------------------------------------------------- +// +void CWlmPlatform::EmergencyCallCompleted( TWlanSystemMode aNewMode ) + { + DEBUG( "CWlmPlatform::EmergencyCallCompleted()" ); + + TBool startupComplete; + iCurrentSystemMode = aNewMode; + if ( aNewMode == EWlanSystemNormal ) + { + startupComplete = ETrue; + iCallback.EmergencyCallComplete( startupComplete ); + } + else if ( aNewMode == EWlanSystemStartupInProgress) + { + /** + * Return back to the Startup in Progress mode + */ + startupComplete = EFalse; + iCallback.ReleaseRequest(); + iCallback.EmergencyCallComplete( startupComplete ); + } + else if ( aNewMode == EWlanSystemFlight ) + { + /* WLAN connection must be released if WLAN connection + * was established only for the emergency call + * (connection did not exist before the emergency call) + */ + if ( !iWlanConnectedBeforeEmergencyCall ) + { + iCallback.ReleaseRequest(); + } + startupComplete = ETrue; + iCallback.EmergencyCallComplete( startupComplete ); + } + else + { + iCallback.ReleaseRequest(); + } + iWlanConnectedBeforeEmergencyCall = EFalse; + } + + +// --------------------------------------------------------- +// CWlmPlatform::BtConnectionEstablished +// --------------------------------------------------------- +// +void CWlmPlatform::BtConnectionEstablished() + { + iCallback.BtConnectionEstablished(); + } + +// --------------------------------------------------------- +// CWlmPlatform::BtConnectionDisabled +// --------------------------------------------------------- +// +void CWlmPlatform::BtConnectionDisabled() + { + iCallback.BtConnectionDisabled(); + } + +// --------------------------------------------------------- +// CWlmPlatform::OnSystemTimeChange +// --------------------------------------------------------- +// +void CWlmPlatform::OnSystemTimeChange() + { + DEBUG( "CWlmPlatform::OnSystemTimeChange()" ); + + iCallback.SystemTimeChanged(); + } + +// --------------------------------------------------------- +// CWlmPlatform::OnCacheClearTimerExpiration +// --------------------------------------------------------- +// +void CWlmPlatform::OnCacheClearTimerExpiration() + { + DEBUG( "CWlmPlatform::OnCacheClearTimerExpiration()" ); + + iCallback.ClearRegionCache(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformdata.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,382 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface class to CenRep and PubSub +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include "wlaninternalpskeys.h" +#include "wlmplatformdata.h" +#include "am_debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CWlmPlatformData::CWlmPlatformData( MWlmSystemNotify& aCallback ) : + iBtConnections( NULL ), + iCallback( aCallback ), + iSystemMode( EWlanSystemStartupInProgress ), + iBtConnectionCount( 0 ), + iCurrentIcon( EWlmIconStatusNotAvailable ), + iIsStartupComplete( EFalse ), + iIsInOffline( EFalse ), + iIsEmergencyCall( EFalse ) + { + DEBUG( "CWlmPlatformData::CWlmPlatformData()" ); + } + +// Symbian 2nd phase constructor can leave. +void CWlmPlatformData::ConstructL() + { + DEBUG( "CWlmPlatformData::ConstructL()" ); + + // Allow everyone to read the P&S properties. + _LIT_SECURITY_POLICY_PASS(KWlmPSReadPolicy); //lint !e648 + // Require SID for writing the P&S properties. + _LIT_SECURITY_POLICY_S0(KWlmPSWritePolicy, KPSUidWlan.iUid); //lint !e648 + + // Create subscriber for system state + iPropertySystemState = CWlmPlatformSubscriber::NewL( + EWlmSubscribeTypePubSub, *this, + KPSUidStartup, KPSGlobalSystemState ); + iPropertySystemState->IssueRequest(); + + // Create subscriber for BT connections + iBtConnections = CWlmPlatformSubscriber::NewL( + EWlmSubscribeTypePubSub, *this, + KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetPHYCount ); + iBtConnections->IssueRequest(); + + // Create subscriber for Emergency Call Info. + iEmergencyCall = CWlmPlatformSubscriber::NewL( + EWlmSubscribeTypePubSub, *this, + KPSUidCtsyEmergencyCallInfo, KCTSYEmergencyCallInfo ); + iEmergencyCall->IssueRequest(); + + // Create PubSub property for publishing MAC address + TInt ret( KErrNone ); + ret = RProperty::Define( KPSWlanMacAddress, KPSWlanMacAddressType, + KWlmPSReadPolicy, KWlmPSWritePolicy, KPSWlanMacAddressLength ); + if ( ret != KErrAlreadyExists ) + { + User::LeaveIfError( ret ); + } + User::LeaveIfError( iPsMacAddress.Attach( KPSUidWlan, + KPSWlanMacAddress, EOwnerThread ) ); + + // Create PubSub property for publishing WLAN indicator information + ret = RProperty::Define( KPSWlanIndicator, KPSWlanIndicatorType, + KWlmPSReadPolicy, KWlmPSWritePolicy ); + if ( ret != KErrAlreadyExists ) + { + User::LeaveIfError( ret ); + } + User::LeaveIfError( iPsIndicator.Attach( KPSUidWlan, + KPSWlanIndicator, EOwnerThread ) ); + } + +// --------------------------------------------------------- +// CWlmPlatformData::NewL +// --------------------------------------------------------- +// +CWlmPlatformData* CWlmPlatformData::NewL( MWlmSystemNotify& aCallback ) + { + CWlmPlatformData* self = new (ELeave) CWlmPlatformData( aCallback ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CWlmPlatformData::~CWlmPlatformData +// --------------------------------------------------------- +// +CWlmPlatformData::~CWlmPlatformData() + { + DEBUG( "CWlmPlatformData::~CWlmPlatformData()" ); + + iPsIndicator.Close(); + RProperty::Delete( KPSUidWlan, KPSWlanIndicator ); + iPsMacAddress.Close(); + RProperty::Delete( KPSUidWlan, KPSWlanMacAddress ); + delete iPropertySystemState; + delete iBtConnections; + delete iEmergencyCall; + } + +// --------------------------------------------------------- +// CWlmPlatformData::SetIconState +// Status : Draft +// --------------------------------------------------------- +// +TInt CWlmPlatformData::SetIconState( TWlmIconStatus aStatus ) + { + DEBUG( "CWlmPlatformData::SetIconState()" ); + + TInt ret( KErrNone ); + if ( aStatus != iCurrentIcon ) + { + switch ( aStatus ) + { + case EWlmIconStatusNotAvailable: + DEBUG( "Setting icon to EPSWlanIndicatorNone" ); + ret = iPsIndicator.Set( EPSWlanIndicatorNone ); + break; + case EWlmIconStatusAvailable: + DEBUG( "Setting icon to EPSWlanIndicatorAvailable" ); + ret = iPsIndicator.Set( EPSWlanIndicatorAvailable ); + break; + case EWlmIconStatusConnected: + DEBUG( "Setting icon to EPSWlanIndicatorActive" ); + ret = iPsIndicator.Set( EPSWlanIndicatorActive ); + break; + case EWlmIconStatusConnectedSecure: + DEBUG( "Setting icon to EPSWlanIndicatorActiveSecure" ); + ret = iPsIndicator.Set( EPSWlanIndicatorActiveSecure ); + break; + default: + DEBUG( "CWlmPlatformData::SetIconState() - unsupported status" ); + ret = KErrNotSupported; + break; + } + iCurrentIcon = aStatus; + } + return ret; + } + +// --------------------------------------------------------- +// CWlmPlatformData::HandlePropertyChangedL +// Status : Draft +// --------------------------------------------------------- +// +void CWlmPlatformData::HandlePropertyChangedL( + const TUid& aCategory, + const TUint aKey ) + { + DEBUG( "CWlmPlatformData::HandlePropertyChangedL()" ); + DEBUG2( "CWlmPlatformData::HandlePropertyChangedL() - aCategory = %08x, aKey = %08x", + aCategory.iUid, aKey ); + + if ( aCategory == KPropertyUidBluetoothCategory && + aKey == KPropertyKeyBluetoothGetPHYCount ) + { + TInt value( 0 ); + iBtConnections->Get( value ); + + DEBUG2( "CWlmPlatformData::HandlePropertyChangedL() - BT count has changed from %u to %u", + iBtConnectionCount, value ); + + if ( !iBtConnectionCount && value ) + { + DEBUG( "CWlmPlatformData::HandlePropertyChangedL() - BT connection established" ); + iCallback.BtConnectionEstablished(); + } + else if ( iBtConnectionCount && !value ) + { + DEBUG( "CWlmPlatformData::HandlePropertyChangedL() - BT connection disconnected" ); + iCallback.BtConnectionDisabled(); + } + iBtConnectionCount = value; + } + else if ( aCategory == KPSUidStartup && + aKey == KPSGlobalSystemState ) + { + TInt value( 0 ); + iPropertySystemState->Get( value ); + + TWlanSystemMode enumValue( iSystemMode ); + + switch ( value ) + { + case ESwStateNormalRfOn: + enumValue = EWlanSystemNormal; + iIsStartupComplete = ETrue; + iIsInOffline = EFalse; + break; + case ESwStateNormalRfOff: + enumValue = EWlanSystemFlight; + iIsStartupComplete = ETrue; + iIsInOffline = ETrue; + break; + case ESwStateNormalBTSap: + enumValue = EWlanSystemNormal; + iIsStartupComplete = ETrue; + iIsInOffline = EFalse; + break; + } + + /** + * Do not change the SystemMode during emergency call, + * it will be updated after emergency call. + */ + if ( !iIsEmergencyCall && iSystemMode != enumValue ) + { + DEBUG2( "CWlmPlatformData::HandlePropertyChangedL() - system mode has changed from %u to %u", + iSystemMode, enumValue ); + + iCallback.SystemModeChanged( iSystemMode, enumValue ); + iSystemMode = enumValue; + } + } + else if( aCategory == KPSUidCtsyEmergencyCallInfo && + aKey == KCTSYEmergencyCallInfo ) + { + TInt value( 0 ); + iEmergencyCall->Get( value ); + + DEBUG1( "CWlmPlatformData::HandlePropertyChangedL() - KCTSYEmergencyCallInfo changed to %u", + value ); + + /** + * Emergency call has been established + */ + if( value && !iIsEmergencyCall) + { + iIsEmergencyCall = ETrue; + TWlanSystemMode enumValue( EWlanSystemNormal ); + iCallback.EmergencyCallEstablished(); + DEBUG2( "CWlmPlatformData::HandlePropertyChangedL() - system mode has been changed from %u to %u", + iSystemMode, enumValue ); + iSystemMode = enumValue; + } + /** + * Emergency call has ended + */ + else if (!value && iIsEmergencyCall ) + { + iIsEmergencyCall = EFalse; + /** + * Startup is not yet done + */ + if ( !iIsStartupComplete ) + { + iCallback.EmergencyCallCompleted ( EWlanSystemStartupInProgress ); + DEBUG2( "CWlmPlatformData::HandlePropertyChangedL() - system mode has been changed from %u to %u", + iSystemMode, EWlanSystemStartupInProgress ); + iSystemMode = EWlanSystemStartupInProgress; + } + else + { + TWlanSystemMode enumValue( EWlanSystemNormal ); + if ( iIsInOffline ) + { + enumValue = EWlanSystemFlight; + } + iCallback.EmergencyCallCompleted ( enumValue ); + DEBUG2( "CWlmPlatformData::HandlePropertyChangedL() - system mode has been changed from %u to %u", + iSystemMode, enumValue ); + iSystemMode = enumValue; + } + } + } + } + +// --------------------------------------------------------- +// CWlmPlatformData::GetCurrentOperatorMccL +// Status : Draft +// --------------------------------------------------------- +// +void CWlmPlatformData::GetCurrentOperatorMccL( TUint& aCountryCode ) + { + DEBUG( "CWlmPlatformData::GetCurrentOperatorMccL()" ); + + RTelServer server; + TInt error = server.Connect(); + DEBUG1( "Connect returned with %d", error ); + User::LeaveIfError( error ); + CleanupClosePushL( server ); + + error = server.LoadPhoneModule( KMmTsyModuleName ); + DEBUG1( "LoadPhoneModule returned with %d", error ); + User::LeaveIfError( error ); + + TInt numPhones( 0 ); + error = server.EnumeratePhones( numPhones ); + DEBUG1( "EnumeratePhones returned with %d", error ); + DEBUG1( "Number of phones enumerated = %d", numPhones ); + User::LeaveIfError( error ); + if ( !numPhones ) + { + User::Leave( KErrNotFound ); + } + + RTelServer::TPhoneInfo phoneInfo; + error = server.GetPhoneInfo( 0, phoneInfo ); + DEBUG1( "GetPhoneInfo returned with %d", error ); + User::LeaveIfError( error ); + + RMobilePhone phone; + error = phone.Open( server, phoneInfo.iName ); + DEBUG1( "Open returned with %d", error ); + User::LeaveIfError( error ); + CleanupClosePushL( phone ); + + TRequestStatus status; + RMobilePhone::TMobilePhoneNetworkInfoV1 network; + RMobilePhone::TMobilePhoneNetworkInfoV1Pckg networkPckg( network ); + RMobilePhone::TMobilePhoneLocationAreaV1 area; + phone.GetCurrentNetwork( status, networkPckg, area ); + User::WaitForRequest( status ); + DEBUG1( "GetCurrentNetwork returned with %d", status.Int() ); + User::LeaveIfError( status.Int() ); + + TLex lex( network.iCountryCode ); + User::LeaveIfError( lex.Val( aCountryCode ) ); + + CleanupStack::PopAndDestroy( &phone ); + CleanupStack::PopAndDestroy( &server ); + + DEBUG( "CWlmPlatformData::GetCurrentOperatorMccL() done" ); + } + +// --------------------------------------------------------- +// CWlmPlatformData::UpdateSystemStatuses +// Status : Draft +// --------------------------------------------------------- +// +void CWlmPlatformData::UpdateSystemStatuses() + { + DEBUG( "CWlmPlatformData::UpdateSystemStatuses()" ); + + TRAP_IGNORE( HandlePropertyChangedL( KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothGetPHYCount ) ); + TRAP_IGNORE( HandlePropertyChangedL( KPSUidStartup, + KPSGlobalSystemState ) ); + } + +// --------------------------------------------------------- +// CWlmPlatformData::PublishMacAddress +// Status : Draft +// --------------------------------------------------------- +// +TInt CWlmPlatformData::PublishMacAddress( TMacAddress& aMacAddr ) + { + DEBUG( "CWlmPlatformData::PublishMacAddress()" ); + + DEBUG( "BSSID:" ); + DEBUG_MAC( aMacAddr.iMacAddress ); + + TPtrC8 mac( aMacAddr.iMacAddress, KPSWlanMacAddressLength ); + return iPsMacAddress.Set( mac ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformsubscriber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmplatformsubscriber.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Observer class for platformwide events +* +*/ + + +#include +#include "wlmplatformsubscriber.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::CWlmPlatformSubscriber +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWlmPlatformSubscriber::CWlmPlatformSubscriber( + TWlmSubscribeType aType, + MWlmPlatformResponder& aCallback, + const TUid& aCategory, + const TUint aKey ) : + CActive( CActive::EPriorityStandard ), + iType( aType ), + iCallback( aCallback ), + iCategory( aCategory ), + iKey( aKey ), + iCenRep( NULL ) + { + DEBUG( "CWlmPlatformSubscriber::CWlmPlatformSubscriber()" ); + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWlmPlatformSubscriber::ConstructL() + { + DEBUG( "CWlmPlatformSubscriber::ConstructL()" ); + + CActiveScheduler::Add( this ); + + // In case PubSub, attach to a certain key + if ( iType == EWlmSubscribeTypePubSub ) + { + iProperty.Attach( iCategory, iKey ); + } + // In case CenRep, open connection to a certain repository + else if ( iType == EWlmSubscribeTypeCenRep ) + { + iCenRep = CRepository::NewL( iCategory ); + } + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWlmPlatformSubscriber* CWlmPlatformSubscriber::NewL( + TWlmSubscribeType aType, + MWlmPlatformResponder& aCallback, + const TUid& aCategory, + const TUint aKey ) + { + DEBUG( "CWlmPlatformSubscriber::NewL()" ); + + CWlmPlatformSubscriber* self = new( ELeave ) CWlmPlatformSubscriber( + aType, + aCallback, + aCategory, + aKey ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CWlmPlatformSubscriber::~CWlmPlatformSubscriber() + { + DEBUG( "CWlmPlatformSubscriber::~CWlmPlatformSubscriber()" ); + + Cancel(); + if ( iType == EWlmSubscribeTypePubSub ) + { + iProperty.Close(); + } + else if ( iType == EWlmSubscribeTypeCenRep ) + { + delete iCenRep; + } + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::IssueRequest +// ----------------------------------------------------------------------------- +// +void CWlmPlatformSubscriber::IssueRequest() + { + DEBUG( "CWlmPlatformSubscriber::IssueRequest()" ); + + if( !IsActive() ) + { + if ( iType == EWlmSubscribeTypePubSub ) + { + DEBUG( "CWlmPlatformSubscriber::IssueRequest() - requestType == PubSub" ); + iProperty.Subscribe( iStatus ); + } + else if ( iType == EWlmSubscribeTypeCenRep ) + { + DEBUG( "CWlmPlatformSubscriber::IssueRequest() - requestType == CenRep" ); + iCenRep->NotifyRequest( iKey, iStatus ); + } + SetActive(); + } + else + { + DEBUG("CWlmPlatformSubscriber::IssueRequest() - already active, ignoring"); + } + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::DoCancel +// ----------------------------------------------------------------------------- +// +void CWlmPlatformSubscriber::DoCancel() + { + DEBUG( "CWlmPlatformSubscriber::DoCancel()" ); + + if ( iType == EWlmSubscribeTypePubSub ) + { + iProperty.Cancel(); + } + else if ( iType == EWlmSubscribeTypeCenRep ) + { + iCenRep->NotifyCancel( iKey ); + } + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::RunError +// ----------------------------------------------------------------------------- +// +TInt CWlmPlatformSubscriber::RunError( + TInt aError ) + { + DEBUG( "CWlmPlatformSubscriber::RunError()" ); + + if ( aError != KErrNone ) + { + DEBUG1( "CWlmPlatformSubscriber::RunError() - aError = %d", aError ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::RunL +// ----------------------------------------------------------------------------- +// +void CWlmPlatformSubscriber::RunL() + { + DEBUG( "CWlmPlatformSubscriber::RunL()" ); + + DEBUG1( "CWlmPlatformSubscriber::RunL() - iStatus = %d", iStatus.Int() ); + iCallback.HandlePropertyChangedL( iCategory, iKey ); + IssueRequest(); + } + +// ----------------------------------------------------------------------------- +// CWlmPlatformSubscriber::Get +// ----------------------------------------------------------------------------- +// +TInt CWlmPlatformSubscriber::Get( TInt& aValue ) + { + DEBUG( "CWlmPlatformSubscriber::Get()" ); + + if ( iType == EWlmSubscribeTypePubSub ) + { + return iProperty.Get( aValue ); + } + else if ( iType == EWlmSubscribeTypeCenRep ) + { + return iCenRep->Get( iKey, aValue ); + } + + return KErrNotFound; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmscanrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmscanrequest.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active Object for asynchronous scan request. +* +*/ + + +#include "wlmscanrequest.h" +#include "am_debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlmScanRequest* CWlmScanRequest::NewL( + RWLMServer& aClient ) + { + DEBUG( "CWlmScanRequest::NewL()" ); + + CWlmScanRequest* self = new CWlmScanRequest( + aClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlmScanRequest::~CWlmScanRequest() + { + DEBUG( "CWlmScanRequest::~CWlmScanRequest()" ); + + iScanList = NULL; + iClientStatus = NULL; + iCacheLifetime = NULL; + iMaxDelay = NULL; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlmScanRequest::IssueRequest( + ScanList& aScanList, + const TDesC8& aSsid, + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus* aStatus ) + { + DEBUG( "CWlmScanRequest::IssueRequest()" ); + + iScanList = &aScanList; + iScanList->ClearAll(); + if ( !iScanList->SetCurrentMaxSize( KWlmScanListMaxSize ) ) + { + DEBUG( "CWlmScanRequest::IssueRequest() - unable to set scan list size" ); + + if ( !aStatus ) + { + return KErrNoMemory; + } + + User::RequestComplete( aStatus, KErrNoMemory ); + + return KErrNone; + } + + iScanListPtr.Set( iScanList->Data(), 0, KWlmScanListMaxSize ); + + iDynamicScanListBuf().count = 0; + iDynamicScanListBuf().size = 0; + + iSsidBuf().ssidLength = aSsid.Length(); + Mem::Copy( + &iSsidBuf().ssid[0], + aSsid.Ptr(), + aSsid.Length() ); + + iCacheLifetime = &aCacheLifetime; + iMaxDelay = &aMaxDelay; + + iScanSchedulingBuf().cacheLifetime = aCacheLifetime; + iScanSchedulingBuf().maxDelay = aMaxDelay; + + TIpcArgs params( &iScanListPtr, &iSsidBuf, &iDynamicScanListBuf, &iScanSchedulingBuf ); + + if ( !aStatus ) + { + TInt ret = iClient.SendReceive( EGetScanResults, params ); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmScanRequest::IssueRequest() - EGetScanResults failed (%d)", + ret ); + + return ret; + } + aCacheLifetime = iScanSchedulingBuf().cacheLifetime; + aMaxDelay = iScanSchedulingBuf().maxDelay; + + return UpdateResults(); + } + else + { + iClientStatus = aStatus; + *iClientStatus = KRequestPending; + iClient.SendReceive( EGetScanResults, params, iStatus ); + SetActive(); + } + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TRequestStatus* CWlmScanRequest::ClientStatus() + { + return iClientStatus; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlmScanRequest::RunL() + { + DEBUG( "CWlmScanRequest::RunL()" ); + + *iCacheLifetime = iScanSchedulingBuf().cacheLifetime; + *iMaxDelay = iScanSchedulingBuf().maxDelay; + + TInt ret = iStatus.Int(); + if ( ret == KErrNone ) + { + ret = UpdateResults(); + } + else + { + DEBUG1( "CWlmScanRequest::RunL() - EGetScanResults failed (%d)", + ret ); + } + + User::RequestComplete( iClientStatus, ret ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlmScanRequest::RunError( + TInt /* aError */ ) + { + // Ignore the error. + return KErrNone; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlmScanRequest::DoCancel() + { + DEBUG( "CWlmScanRequest::DoCancel()" ); + + *iCacheLifetime = iScanSchedulingBuf().cacheLifetime; + *iMaxDelay = iScanSchedulingBuf().maxDelay; + + // Send the command + iClient.SendReceive( ECancelGetScanResults ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +CWlmScanRequest::CWlmScanRequest( + RWLMServer& aClient ) : + CActive( CActive::EPriorityStandard ), + iClient( aClient ), + iScanList( NULL ), + iScanListPtr( NULL, 0 ), + iCacheLifetime( NULL ), + iMaxDelay( NULL ), + iClientStatus( NULL ) + { + DEBUG( "CWlmScanRequest::CWlmScanRequest()" ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CWlmScanRequest::ConstructL() + { + DEBUG( "CWlmScanRequest::ConstructL()" ); + + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CWlmScanRequest::UpdateResults() + { + DEBUG( "CWlmScanRequest::UpdateResults()" ); + + DEBUG1( "CWlmScanRequest::UpdateResults() - scan list count is %u", + iDynamicScanListBuf().count ); + DEBUG1( "CWlmScanRequest::UpdateResults() - scan list size is %u", + iDynamicScanListBuf().size ); + + iScanList->Update( iDynamicScanListBuf().count, iDynamicScanListBuf().size ); + iScanList->Compress(); + + return KErrNone; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserver.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,5177 @@ +/* +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server class of wlan engine +* +*/ + +/* +* %version: 96 % +*/ + +#include +#include +#include +#include +#include // for feature definitions + +#include "wlmserver.h" +#include "wlmdriverif.h" +#include "wlmsession.h" +#include "wlanconversionutil.h" +#include "core_server_factory.h" +#include "core_tools.h" +#include "core_type_list.h" +#include "wlaneapolclient.h" +#include "wlangenericplugin.h" +#include "wlanssidlistdb.h" +#include "wlandevicesettingsinternalcrkeys.h" +#include "wlanbgscan.h" +#include "wlantimerservices.h" +#include "am_debug.h" + +/** Panic codes for WlanEngine */ +const TInt KWlmPanicCleanupStackCreationFailed = 1; +const TInt KWlmPanicOpenSemaforeFailed = 2; +const TInt KWlmPanicCreationOfSchedulerFailed = 3; +/** Panic category of WlanEngine */ +_LIT( KWlmModuleName, "WLANSRV" ); + +/** Constants for sanity checks */ +const i32_t MAX_RCP_BOUNDARY = 255; +const i32_t MAX_HYSTERESIS = 255; +const u8_t MAX_USER_PRIORITY = 7; + +/** The number of hours after which the domain information expires. */ +const TInt KWlmDomainInfoExpire = 5; +/** Operator MCC codes for North America, Canada, Taiwan, Brazil, Argentina, Mexico and Colombia. */ +const TUint KWlmOperatorMccNATable[] = { 302, 310, 311, 312, 313, 314, 315, 316, 332, 466, 724, 722, 334, 732 }; +/** The amount of operator MCC codes for North America, Canada, Taiwan, Brazil, Argentina, Mexico and Colombia. */ +const TUint KWlmOperatorMccNATableLength = 14; + +/** AP country information codes for North America, Canada, Taiwan, Brazil, Argentina, Mexico and Colombia + are defined in core_types.h. */ + +/** Timestamp is stored in CenRep in minutes, constant for converterting this to microseconds */ +const TUint KWlmTimestampInCenrep = 60000000; + +/** WLAN region values in CenRep */ +const TInt KWlmRegionUnknown = 0; +const TInt KWlmRegionETSI = 1; +const TInt KWlmRegionFCC = 2; + +/** Valid range for cache lifetime in scan requests (in seconds). */ +const TInt KWlmMaxScanCacheLifetime = 60; +const TInt KWlmMinScanCacheLifetime = 0; +const TInt KWlmDefaultScanCacheLifetime = -1; + +/** Valid range for maximum scan delay in scan requests (in seconds). */ +const TUint KWlmMaxScanDelay = 1200; + +/** Infinite scan delay in GetAvailableIaps and GetScanResult. */ +const TUint KWlmInfiniteScanDelay = 0xFFFFFFFF; + +/** Granularity for WLAN SSID lists. */ +const TUint KWlanSsidListGranularity = 100; + +/** Bitmask of WLAN features enabled at compile-time. */ +const TUint KWlanStaticFeatures = + CWlmServer::EWlanFeaturePowerSaveTest | + CWlmServer::EWlanFeature802dot11k; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlmServer::CWlmServer +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWlmServer::CWlmServer() : + CServer2( CActive::EPriorityStandard ), + iCoreServer( NULL ), + iDriverIf( NULL ), + iSupportedFeatures( KWlanStaticFeatures ), + iScanSchedulingTimer( NULL ), + iCache( NULL ), + iConfiguredCacheLifetime( 0 ), + iPlatform( NULL ), + iConnectionState( EWlanStateNotConnected ), + iPrevConnectionState( EWlanStateNotConnected ), + iIsRoaming( EFalse ), + iPrevRcpiValue( 0 ), + iRegion( EFCC ), + iTimeofDomainQuery( 0 ), + iClientSessionCount( 0 ), + iRequestIdCounter( KWlanExtCmdBase ), + iSessionIdCounter( 0 ), + iCoreAsynchCb( NULL ), + iCoreAsynchCbId( 0 ), + iCoreAsynchCbStatus( core_error_ok ), + iIsStartupComplete( EFalse ), + iEapolClient( NULL ), + iEapolHandler( NULL ), + iScanSchedulingTimerExpiration( 0 ), + iRequestTriggeringScanning( 0 ), + iCoreHandlingScanRequest( EFalse ), + iPowerSaveMode( EWlanPowerSaveAutomatic ), + iPowerSaveEnabled( EFalse ), + iSsidListDb( NULL ), + iShowBrokenPowerSaveNote( ETrue ), + iBrokenPowerSaveNotifierWaiter( NULL ), + iBgScanProvider( NULL ), + iTimerServices( NULL ) + { + } + +// ----------------------------------------------------------------------------- +// CWlmServer::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWlmServer::ConstructL() + { + DEBUG( "CWlmServer::ConstructL()" ); + User::LeaveIfError( User::RenameThread( KWLMDataServerName ) ); + StartL( KWLMDataServerName ); + + // Consult FeatureManager whether startup is allowed + FeatureManager::InitializeLibL(); + if( !FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ) + { + DEBUG("ERROR: FeatureManager forbids starting of WlanServer"); + FeatureManager::UnInitializeLib(); + User::Leave( KErrNotSupported ); + } + + if( FeatureManager::FeatureSupported( KFeatureIdFfWlanWapi ) ) + { + iSupportedFeatures |= EWlanFeatureWapi; + } + + DEBUG1( "CWlmServer::ConstructL() - supported WLAN features: 0x%08X", + iSupportedFeatures ); + FeatureManager::UnInitializeLib(); + + // Create Driver Interface + iDriverIf = CWlmDriverIf::NewL(); + + // Get Mac Address + TMacAddress mac( KZeroMacAddr ); + iDriverIf->GetMacAddress( mac ); + + // Test its authenticity + // If failure -> not starting the server + const TMacAddress KDeadBeefMacAddr = {{ 0x00, 0xE0, 0xDE, 0xAD, 0xBE, 0xEF }}; + if( mac == KZeroMacAddr || mac == KDeadBeefMacAddr ) + { + DEBUG("ERROR: MAC Address not acceptable -> Forbidden to start WlanServer"); + User::Leave( KErrNotSupported ); + } + core_mac_address_s core_mac( ZERO_MAC_ADDR ); + TWlanConversionUtil::ConvertMacAddress( core_mac, mac ); + + // Get Device Settings + CWlanDeviceSettings::SWlanDeviceSettings deviceSettings; + GetWlanSettingsL( deviceSettings ); + SetCachedRegion(deviceSettings.region, deviceSettings.regionTimestamp); + core_device_settings_s coreSettings; // core needs the settings here + TWlanConversionUtil::ConvertDeviceSettings( coreSettings, deviceSettings ); + + // Create core server + User::LeaveIfNull( iCoreServer = core_server_factory_c::instance( + *this, + *iDriverIf, + coreSettings, + core_mac, + TWlanConversionUtil::ConvertFeatureFlags( iSupportedFeatures ) ) ); + iCoreServer->disable_wlan( KWlanIntCmdDisableWlan ); + + // Create scan timer + DEBUG( "CWlmServer::ConstructL() - create backgroundscan timer" ); + iScanSchedulingTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + + // Create scan cache + iCache = CWlanScanResultCache::NewL(); + iConfiguredCacheLifetime = deviceSettings.scanExpirationTimer; + + // Create a callback for asynchronous core requests + TCallBack callback( HandleCoreAsynchCb, this ); + iCoreAsynchCb = new (ELeave) CAsyncCallBack( + callback, CActive::EPriorityStandard ); + + // Create SSID list storage. + iSsidListDb = CWlanSsidListDb::NewL(); + + // Initialise Broken Power Save Note handling + TCallBack cb( HandleBrokenPowerSaveNoteClosed, this ); + iBrokenPowerSaveNotifierWaiter = CWlanCbWaiter::NewL( cb ); + + iTimerServices = CWlanTimerServices::NewL(); + + iBgScanProvider = CWlanBgScan::NewL( static_cast( *this ), *iTimerServices ); + + // Initialize Platform interface and publish mac address + iPlatform = CWlmPlatform::NewL( *this ); + iPlatform->Initialize(); + TInt err = iPlatform->PublishMacAddress( mac ); + if( err ) + { + DEBUG1( "ERROR publishing MAC address: %d", err ); + } + + iGenericWlanPlugin.StartPlugins(); + + DEBUG( "CWlmServer::ConstructL() - done" ); + } + +// ----------------------------------------------------------------------------- +// CWlmServer::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CWlmServer* CWlmServer::NewL() + { + CWlmServer* self = new( ELeave ) CWlmServer; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CWlmServer::~CWlmServer +// ----------------------------------------------------------------------------- +// +CWlmServer::~CWlmServer() + { + // Close all open sessions + CWlmSession* session = NULL; + iSessionIter.SetToFirst(); + while( (session = static_cast(iSessionIter++)) != NULL ) + { + delete session; + } + + iGenericWlanPlugin.StopPlugins(); + + delete iCoreServer; + delete iDriverIf; + iNotificationArray.Close(); + delete iCache; + delete iPlatform; + iRequestMap.Close(); + delete iCoreAsynchCb; + delete iScanSchedulingTimer; + delete iSsidListDb; + delete iBrokenPowerSaveNotifierWaiter; + iBrokenPowerSaveNotifier.Close(); + + if ( iEapolClient ) + { + delete iEapolClient; + iEapolClient = NULL; + } + iEapolHandler = NULL; + } + +// ----------------------------------------------------------------------------- +// CWlmServer::StartServerThread +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CWlmServer::StartServerThread() + { + DEBUG( "CWlmServer::StartServerThread()" ); + + __UHEAP_MARK; + + // Create cleanup stack + CTrapCleanup* cleanup = CTrapCleanup::New(); + __ASSERT_ALWAYS( + cleanup, + User::Panic( KWlmModuleName, KWlmPanicCleanupStackCreationFailed ) + ); + + // Open handle to semaphore + RSemaphore started; + TInt err = started.OpenGlobal( KWLMServerSemaphore, EOwnerProcess ); + __ASSERT_ALWAYS( + err == KErrNone, + User::Panic( KWlmModuleName, KWlmPanicOpenSemaforeFailed ) + ); + + // Create active scheduler + CWlmServer* server = NULL; + CActiveScheduler* scheduler = new CActiveScheduler(); + if ( scheduler ) + { + // Install scheduler + CActiveScheduler::Install( scheduler ); + + // Create server + TRAP( err, server = CWlmServer::NewL() ); + + if ( err != KErrNone ) + { + DEBUG1( "CWlmServer::NewL leaved with code %d", err ); + } + } + else + { + User::Panic( KWlmModuleName, KWlmPanicCreationOfSchedulerFailed ); + } + + // Signal calling process that we've started via semaphore + started.Signal(); + started.Close(); + + // Start the active Scheduler (if there are no errors) + if ( err == KErrNone ) + { + DEBUG( "CWlmServer Starting scheduler..." ); + CActiveScheduler::Start(); + } + + // Note that CActiveScheduler::Start() will not return until the scheduler + // is stopped in CWlmServer::SessionClosed(). This is because we don't + // belong to an active object, so there's no RunL() to be called. + + // Delete all objects + delete server; + delete CActiveScheduler::Current(); + delete cleanup; + + // Clean up Ecom framework + REComSession::FinalClose(); + + __UHEAP_MARKEND; + + return err; + } + +// --------------------------------------------------------- +// CWlmServer::GetWlanSettingsL +// --------------------------------------------------------- +// +void CWlmServer::GetWlanSettingsL( + CWlanDeviceSettings::SWlanDeviceSettings& aSettings ) + { + DEBUG( "CWlmServer::GetWlanSettingsL()" ); + CWlanDeviceSettings* db = CWlanDeviceSettings::NewL(); + CleanupStack::PushL( db ); + db->ReadL( aSettings ); + CleanupStack::PopAndDestroy( db ); + } + +// --------------------------------------------------------- +// CWlmServer::GetIapSettingsL +// --------------------------------------------------------- +// +void CWlmServer::GetIapSettingsL( + const TUint32 aLanServiceId, + SWLANSettings& aWlanSettings, + RArray& aSecondaryList ) + { + DEBUG( "CWlmServer::GetIapSettingsL()" ); + + CWLanSettings* wlanset = new(ELeave) CWLanSettings; + CleanupStack::PushL( wlanset ); + + User::LeaveIfError( wlanset->Connect() ); + User::LeaveIfError( + wlanset->GetWlanSettingsForService( aLanServiceId, aWlanSettings ) ); + User::LeaveIfError( + wlanset->GetSecondarySsidsForService( aWlanSettings.Id, aSecondaryList ) ); + + DEBUG3( "- connMode == %d, securityMode == %d, # of secondary SSIDs == %d", + aWlanSettings.ConnectionMode, + aWlanSettings.SecurityMode, + aSecondaryList.Count() ); + + wlanset->Disconnect(); + CleanupStack::PopAndDestroy( wlanset ); + } + +// --------------------------------------------------------- +// CWlmServer::NewSessionL +// --------------------------------------------------------- +// +CSession2* CWlmServer::NewSessionL( + const TVersion& /*aVersion*/, + const RMessage2& /*aMessage*/ ) const + { + DEBUG( "CWlmServer::NewSessionL()" ); + CWlmSession* session = + CWlmSession::NewL( + const_cast(*this) ); + return session; + } + +// --------------------------------------------------------- +// CWlmServer::NotifyAdd +// --------------------------------------------------------- +// +void CWlmServer::NotifyAdd( + CNotificationBase& aNotification ) + { + DEBUG( "CWlmServer::NotifyAdd()" ); + iNotificationArray.Insert( &aNotification, 0 ); + } + +// --------------------------------------------------------- +// CWlmServer::NotifyRemove +// --------------------------------------------------------- +// +void CWlmServer::NotifyRemove( + CNotificationBase& aNotification ) + { + DEBUG( "CWlmServer::NotifyRemove()" ); + TInt index = iNotificationArray.Find( &aNotification ); + iNotificationArray.Remove( index ); + } + +// --------------------------------------------------------- +// CWlmServer::Connect +// --------------------------------------------------------- +// +void CWlmServer::Connect( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::Connect()" ); + + // Get WlanSettings and secondarySSID list + // (lanServiceId specifies the table row in wlansettings) + SWLANSettings iapData; + RArray secondarySsidList; + TInt lanServiceId = aMessage.Int0(); + TRAPD( err, GetIapSettingsL( lanServiceId, iapData, secondarySsidList ) ) ; + if( err != KErrNone ) + { + DEBUG1( "CWlmServer::Connect() - GetIapSettingsL leaved with %d", + err ); + secondarySsidList.Close(); + aMessage.Complete( err ); + + return; + } + + DEBUG4( "CWlmServer::Connect() - SecurityMode: %u, WPAKeyLength: %u, EnableWpaPsk: %u, PresharedKeyFormat: %u", + iapData.SecurityMode, iapData.WPAKeyLength, iapData.EnableWpaPsk, iapData.PresharedKeyFormat ); + + // Check whether WAPI is supported + if( iapData.SecurityMode == Wapi && + !( iSupportedFeatures & EWlanFeatureWapi ) ) + { + DEBUG( "CWlmServer::Connect() - WAPI is not supported" ); + + secondarySsidList.Close(); + aMessage.Complete( KErrNotSupported ); + + return; + } + + // Get override setting from message parameter + TWLMOverrideSettings override = { 0 }; + TPckg inData( override ); + err = aMessage.Read( 1, inData ); + if( err ) + { + secondarySsidList.Close(); + aMessage.Complete( err ); + + return; + } + + // Type conversion + core_iap_data_s* coreIapData = new core_iap_data_s; + if( !coreIapData ) + { + secondarySsidList.Close(); + aMessage.Complete( KErrNoMemory ); + + return; + } + + // Find out whether IP address should be static or dhcp + CLanSettings lanSettingsClient; + err = lanSettingsClient.Connect(); + if( err ) + { + secondarySsidList.Close(); + delete coreIapData; + aMessage.Complete( err ); + + return; + } + SLanSettings lanSettings; + lanSettingsClient.GetLanSettings( lanServiceId, lanSettings ); + lanSettingsClient.Disconnect(); + + TWlanConversionUtil::ConvertIapSettings( + *coreIapData, + iapData, + lanSettings.AddrFromServer, + override ); + + // + // Handle secondary SSID list + // + core_type_list_c* coreSsidList = NULL; + + if( iapData.SSID.Length() && + ( iapData.UsedSSID.Length() || secondarySsidList.Count() ) ) + { + DEBUG( "CWlmServer::Connect() - secondary SSIDs defined" ); + + coreSsidList = new core_type_list_c(); + if( !coreSsidList ) + { + secondarySsidList.Close(); + delete coreIapData; + aMessage.Complete( KErrNoMemory ); + + return; + } + coreSsidList->clear(); + + core_ssid_entry_s* entry = new core_ssid_entry_s; + if ( !entry ) + { + secondarySsidList.Close(); + delete coreIapData; + delete coreSsidList; + aMessage.Complete( KErrNoMemory ); + + return; + } + + entry->id = coreIapData->id; + TWlanConversionUtil::ConvertSSID( entry->ssid, iapData.SSID ); + if( iapData.UsedSSID.Length() ) + { + TWlanConversionUtil::ConvertSSID( entry->used_ssid, iapData.UsedSSID ); + } + else + { + entry->used_ssid = entry->ssid; + } + coreSsidList->append( entry ); + + for( TInt idx( 0 ); idx < secondarySsidList.Count(); ++idx ) + { + entry = new core_ssid_entry_s; + if ( !entry ) + { + secondarySsidList.Close(); + delete coreIapData; + delete coreSsidList; + aMessage.Complete( KErrNoMemory ); + + return; + } + + TWlanConversionUtil::ConvertSSID( + entry->ssid, secondarySsidList[idx].ssid ); + if ( secondarySsidList[idx].usedSsid.Length() ) + { + TWlanConversionUtil::ConvertSSID( + entry->used_ssid, secondarySsidList[idx].usedSsid ); + } + else + { + TWlanConversionUtil::ConvertSSID( + entry->used_ssid, iapData.SSID ); + } + coreSsidList->append( entry ); + } + + DEBUG1( "CWlmServer::Connect() - secondary SSID count %u", + coreSsidList->count() ); + } + else + { + DEBUG( "CWlmServer::Connect() - no secondary SSIDs defined" ); + } + secondarySsidList.Close(); + + // Connection status + core_connect_status_e* connectionStatus = new core_connect_status_e; + if( !connectionStatus ) + { + secondarySsidList.Close(); + delete coreIapData; + delete coreSsidList; + aMessage.Complete( KErrNoMemory ); + return; + } + *connectionStatus = core_connect_undefined; + + TInt ret = GetCurrentIapId( + static_cast(lanServiceId), + *coreIapData ); + + if ( ret != KErrNone ) + { + secondarySsidList.Close(); + delete coreIapData; + delete coreSsidList; + aMessage.Complete( ret ); + return; + } + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EJoinByProfileId; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + mapEntry.iParam0 = coreIapData; + mapEntry.iParam1 = coreSsidList; + mapEntry.iParam2 = connectionStatus; + iRequestMap.Append( mapEntry ); + + iCoreServer->connect( + mapEntry.iRequestId, + *coreIapData, + *connectionStatus, + coreSsidList ); + } + +// --------------------------------------------------------- +// CWlmServer::CancelConnect +// --------------------------------------------------------- +// +void CWlmServer::CancelConnect( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::CancelConnect()" ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentBSSID +// --------------------------------------------------------- +// +void CWlmServer::GetCurrentBSSID( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetCurrentBSSID()" ); + + core_mac_address_s coreBssid( ZERO_MAC_ADDR ); + core_error_e ret = iCoreServer->get_current_bssid( coreBssid ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetCurrentBSSID() - get_current_bssid() failed with %u", + ret ); + } + + TMacPckg bssid; + TWlanConversionUtil::ConvertMacAddress( + bssid.data, + coreBssid ); + TPckg outPckg( bssid ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentRCPI +// --------------------------------------------------------- +// +void CWlmServer::GetCurrentRCPI( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetCurrentRCPI()" ); + + if ( IsRoaming() ) + { + DEBUG1( "CWlmServer::GetCurrentRCPI() - roam in progress, returning a cached value (%u)", + iPrevRcpiValue ); + + TPckg outPckg( iPrevRcpiValue ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( KErrNone ); + + return; + } + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EGetCurrentRSSI; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + TUint32* tmp = new TUint32; + if( tmp == NULL ) + { + aMessage.Complete( KErrNoMemory ); + return; + } + mapEntry.iParam0 = tmp; + iRequestMap.Append( mapEntry ); + + // pass request to core + iCoreServer->get_current_rcpi( + mapEntry.iRequestId, + *tmp ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentSSID +// --------------------------------------------------------- +// +void CWlmServer::GetCurrentSSID( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetCurrentSSID()" ); + + core_ssid_s coreSsid( BROADCAST_SSID ); + core_error_e ret = iCoreServer->get_current_ssid( coreSsid ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetCurrentSSID() - get_current_ssid() failed with %u", + ret ); + } + + TSSID ssid = { 0 }; + TWlanConversionUtil::ConvertSSID( + ssid, + coreSsid ); + TPckg outPckg( ssid ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentSecurityMode +// --------------------------------------------------------- +// +void CWlmServer::GetCurrentSecurityMode( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetCurrentSecurityMode()" ); + + core_connection_security_mode_e coreMode( core_connection_security_mode_open ); + core_error_e ret = iCoreServer->get_current_security_mode( coreMode ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetCurrentSecurityMode() - get_current_security_mode() failed with %u", + ret ); + } + + TWlanSecurity mode( + TWlanConversionUtil::ConvertSecurityMode( coreMode ) ); + TPckg outPckg( mode ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::AddBssidToRoguelist +// --------------------------------------------------------- +// +void CWlmServer::AddBssidToRoguelist( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::AddBssidToRoguelist()" ); + + TMacAddress bssid( KZeroMacAddr ); + TPckg inPckg( bssid ); + TInt err( aMessage.Read( 0, inPckg ) ); + if( err != KErrNone ) + { + aMessage.Complete( err ); + return; + } + + core_mac_address_s coreBssid( ZERO_MAC_ADDR ); + TWlanConversionUtil::ConvertMacAddress( + coreBssid, + bssid ); + + core_error_e ret = iCoreServer->add_bssid_to_rogue_list( coreBssid ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::AddBssidToRoguelist() - add_bssid_to_rogue_list() failed with %u", + ret ); + } + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::UpdateRcpNotificationBoundary +// --------------------------------------------------------- +// +void CWlmServer::UpdateRcpNotificationBoundary( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::UpdateRcpNotificationBoundary()" ); + + i32_t rcp_boundary = aMessage.Int0(); + i32_t hysteresis = aMessage.Int1(); + + if ( rcp_boundary < 0 || rcp_boundary > MAX_RCP_BOUNDARY || + hysteresis < 0 || hysteresis > MAX_HYSTERESIS ) + { + aMessage.Complete( KErrArgument ); + return; + } + + core_error_e ret = iCoreServer->set_rcp_level_notification_boundary( + rcp_boundary, + hysteresis ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::UpdateRcpNotificationBoundary() - set_rcp_level_notification_boundary() failed with %u", + ret ); + } + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::ConfigureMulticastGroup +// --------------------------------------------------------- +// +void CWlmServer::ConfigureMulticastGroup( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::ConfigureMulticastGroup()" ); + + bool_t join; + if( aMessage.Int1() == KSoIp6JoinGroup ) + { + join = true_t; + } + else + { + join = false_t; + } + + TMacAddress adaptMac( KZeroMacAddr ); + TPckg inPckg( adaptMac ); + TInt ret( aMessage.Read( 0, inPckg ) ); + if( ret != KErrNone ) + { + aMessage.Complete( ret ); + return; + } + + if( !IsGroupBitSet( adaptMac ) ) + { + aMessage.Complete( KErrArgument ); + return; + } + + if( iConnectionState == EWlanStateNotConnected ) + { + aMessage.Complete( KErrNotReady ); + return; + } + + core_mac_address_s core_mac; + TWlanConversionUtil::ConvertMacAddress( core_mac, adaptMac ); + + core_error_e err = iCoreServer->configure_multicast_group( + join, + core_mac ); + if ( err != core_error_ok ) + { + DEBUG1( "CWlmServer::ConfigureMulticastGroup() - configure_multicast_group() failed with %u", + err ); + } + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( err ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentSystemMode +// --------------------------------------------------------- +// +void CWlmServer::GetCurrentSystemMode( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetCurrentSystemMode()" ); + + TPckg outPckg( iPlatform->GetCurrentSystemMode() ); + TInt ret( aMessage.Write( 0, outPckg ) ); + aMessage.Complete( ret ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentState +// --------------------------------------------------------- +// +TWlanConnectionState CWlmServer::GetCurrentState() + { + DEBUG( "CWlmServer::GetCurrentState()" ); + + return iConnectionState; + } + +// --------------------------------------------------------- +// CWlmServer::GetConnectionState +// --------------------------------------------------------- +// +void CWlmServer::GetConnectionState( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetConnectionState()" ); + + /** + * Do not return EWlanStateSearchingAP to the clients. + */ + TWlanConnectionState state( iConnectionState ); + if ( iConnectionState == EWlanStateSearchingAP ) + { + state = iPrevConnectionState; + } + + TPckg outPckg( state ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::GetScanResult +// --------------------------------------------------------- +// +void CWlmServer::GetScanResult( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetScanResult()" ); + + // Read SSID argument + TSSID ssid = { 0 }; + TPckg inPckg( ssid ); + if( aMessage.Read( 1, inPckg ) != KErrNone ) + { + DEBUG( "CWlmServer::GetScanResult() - unable to read SSID parameter" ); + + aMessage.Complete( KErrArgument ); + + return; + } + + if( ssid.ssidLength > MAX_SSID_LEN ) + { + DEBUG1( "CWlmServer::GetScanResult() - invalid SSID length (%u)", + ssid.ssidLength ); + + aMessage.Complete( KErrArgument ); + + return; + } + + // Read cacheLifetime and maxDelay arguments + TScanScheduling scanScheduling = { KWlmDefaultScanCacheLifetime, 0 }; + TPckg scanSchedulingBuf( scanScheduling ); + if( aMessage.Read( 3, scanSchedulingBuf ) != KErrNone ) + { + DEBUG( "CWlmServer::GetScanResult() - unable to read lifetime/delay parameters" ); + + aMessage.Complete( KErrArgument ); + + return; + } + + // Check that parameters have valid ranges + CheckScanSchedulingParameters( + scanScheduling.cacheLifetime, + scanScheduling.maxDelay ); + + // Update the scan scheduling parameters to values that are going be used + aMessage.Write( 3, scanSchedulingBuf ); + + // Only check for valid cache if maxDelay is zero + if( scanScheduling.maxDelay == 0 ) + { + // If not direct scan, try getting cached results and settle for them + // if they exist + ScanList* cacheList = iCache->GetScanList( ( scanScheduling.cacheLifetime == 0 ? 1 : scanScheduling.cacheLifetime ) ); + if( !ssid.ssidLength && cacheList ) + { + // Just return cached results + + TDynamicScanList dynamicScanList; + dynamicScanList.count = cacheList->Count(); + dynamicScanList.size = cacheList->Size(); + + TPckg pckgDynamicScanList( dynamicScanList ); + TPtr8 ptrScanList( + cacheList->Data(), + cacheList->Size(), + cacheList->Size() ); + + DEBUG2( "CWlmServer::GetScanResult() - returning cached results, scan list count is %u, size is %u", + cacheList->Count(), cacheList->Size() ); + + aMessage.Write( 0, ptrScanList ); + aMessage.Write( 2, pckgDynamicScanList ); + aMessage.Complete( KErrNone ); + + return; + } + } + + // If direct scan, or cached results were too old, perform scan + core_ssid_s* coreSsid = new core_ssid_s; + if( !coreSsid ) + { + DEBUG( "CWlmServer::GetScanResult() - unable to instantiate core_ssid_s" ); + + aMessage.Complete( KErrNoMemory ); + + return; + } + + TWlanConversionUtil::ConvertSSID( + *coreSsid, + ssid ); + + ScanList* scanList = new ScanList( KWlmScanListMaxSize ); + if( !scanList ) + { + DEBUG( "CWlmServer::GetScanResult() - unable to instantiate ScanList" ); + + delete coreSsid; + aMessage.Complete( KErrNoMemory ); + + return; + } + + TTime* scanTime( NULL ); + if( scanScheduling.maxDelay != KWlmInfiniteScanDelay ) + { + scanTime = new TTime( + CalculateScanStartTime( scanScheduling.maxDelay ).Int64() ); + if( !scanTime ) + { + DEBUG( "CWlmServer::GetScanResult() - unable to instantiate TTime" ); + + delete coreSsid; + delete scanList; + aMessage.Complete( KErrNoMemory ); + + return; + } + } +#ifdef _DEBUG + else + { + DEBUG( "CWlmServer::GetScanResult() - Infinite maxDelay, request will not be triggering any scans" ); + } + + if( coreSsid->length ) + { + DEBUG1S( "CWlmServer::GetScanResult() - performing a direct scan with SSID: ", + coreSsid->length, &coreSsid->ssid[0] ); + } + else + { + DEBUG( "CWlmServer::GetScanResult() - performing a broadcast scan" ); + } +#endif // DEBUG + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EGetScanResults; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + mapEntry.iParam0 = scanList; + mapEntry.iParam1 = coreSsid; + mapEntry.iTime = scanTime; + iRequestMap.Append( mapEntry ); + + // Scan scheduling timer needs to be set again if this request needs the results earlier or + // if this is the only timed pending request + if( scanTime != NULL && ( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) ) + { + UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); + } + } + +// --------------------------------------------------------- +// CWlmServer::IsOnlyTimedScanRequestInRequestMap +// --------------------------------------------------------- +// +TBool CWlmServer::IsOnlyTimedScanRequestInRequestMap( + const SRequestMapEntry& aMapEntry ) const + { + DEBUG( "CWlmServer::IsOnlyTimedScanRequestInRequestMap()" ); + + // go through all the requests in the map + for(TInt index = 0; index < iRequestMap.Count(); index++) + { + // look for timed scan requests + if( IsPendingTimedScanRequest( index ) ) + { + // if the request ids don't match there are other scan requests + if( iRequestMap[index].iRequestId != aMapEntry.iRequestId ) + { + DEBUG( "CWlmServer::IsOnlyTimedScanRequestInRequestMap() - other timed scan requests found" ); + return EFalse; + } + } + } + + DEBUG( "CWlmServer::IsOnlyTimedScanRequestInRequestMap() - no other timed scan requests found" ); + + return ETrue; + } + +// --------------------------------------------------------- +// CWlmServer::CancelGetScanResult +// --------------------------------------------------------- +// +void CWlmServer::CancelGetScanResult( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::CancelGetScanResult()" ); + + CancelExternalRequest( + aSessionId, + EGetScanResults ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::GetAvailableIaps +// --------------------------------------------------------- +// +void CWlmServer::GetAvailableIaps( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetAvailableIaps()" ); + + // Read cacheLifetime and maxDelay arguments + TPckgBuf cacheLifetimePckg( KWlmDefaultScanCacheLifetime ); + TPckgBuf maxDelayPckg( 0 ); + if( aMessage.Read( 1, cacheLifetimePckg ) != KErrNone ) + { + DEBUG( "CWlmServer::GetAvailableIaps() - unable to read lifetime parameter" ); + + aMessage.Complete( KErrArgument ); + + return; + } + + if( aMessage.Read( 2, maxDelayPckg ) != KErrNone ) + { + DEBUG( "CWlmServer::GetAvailableIaps() - unable to read delay parameter" ); + + aMessage.Complete( KErrArgument ); + + return; + } + + // Check that parameters have valid ranges + CheckScanSchedulingParameters( + cacheLifetimePckg(), + maxDelayPckg() ); + + //Update the scan scheduling parameters to values that are going be used + aMessage.Write( 1, cacheLifetimePckg ); + aMessage.Write( 2, maxDelayPckg ); + + /** + * See if cached IAP availability information is available. + */ + RArray iapList; + RArray* list = iCache->AvailableIaps( + iapList, + ( cacheLifetimePckg() == 0 ? 1 : cacheLifetimePckg() ) ); + + // Only complete with valid cache if maxDelay is zero + if( list && maxDelayPckg() == 0 ) + { + + TWlmAvailableIaps tmp; + const TInt listCount( + Min( list->Count(), KWlmMaxAvailableIaps ) ); + + DEBUG1( "CWlmServer::GetAvailableIaps() - using cached IAP list, list contains %d IAP(s)", listCount ); + + TInt listIdx( 0 ); + + while( listIdx < listCount ) + { + tmp.iaps[ listIdx ] = (*list)[listIdx]; + ++listIdx; + } + tmp.count = listCount; + TPckg outPckg( tmp ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( KErrNone ); + iapList.Close(); + + return; + } + + /** + * If maxDelay is not infinite, background scanning isn't enabled + * and there are no WLAN IAPs defined, scanning isn't needed at all. + */ + if ( maxDelayPckg() != KWlmInfiniteScanDelay && + !iBgScanProvider->IsBgScanEnabled() && + !iapList.Count() ) + { + DEBUG( "CWlmServer::GetAvailableIaps() - no WLAN IAPs defined, skipping scanning" ); + + TWlmAvailableIaps tmp = { 0 }; + TPckg outPckg( tmp ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( KErrNone ); + iapList.Close(); + + return; + } + + // Create list for WLAN IAP data + core_type_list_c* iapDataList = new core_type_list_c; + if( iapDataList == NULL ) + { + DEBUG( "CWlmServer::GetAvailableIaps() - unable to instance core_iap_data_s list" ); + + aMessage.Complete( KErrNoMemory ); + iapList.Close(); + + return; + } + + // Create list for secondary SSID data + core_type_list_c* iapSsidList = new core_type_list_c; + if ( iapSsidList == NULL ) + { + DEBUG( "CWlmServer::GetAvailableIaps() - unable to instance core_ssid_entry_s list" ); + + aMessage.Complete( KErrNoMemory ); + delete iapDataList; + iapList.Close(); + + return; + } + + // Convert IAP data + TInt ret = GetIapDataList( + *iapDataList, + *iapSsidList, + iapList ); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::GetAvailableIaps() - unable to convert IAP data (%d)", + ret ); + + aMessage.Complete( ret ); + delete iapDataList; + delete iapSsidList; + iapList.Close(); + + return; + } + + iapList.Close(); + + // Create output list + core_type_list_c* iapIdList = new core_type_list_c; + if( iapIdList == NULL ) + { + aMessage.Complete( KErrNoMemory ); + delete iapDataList; + delete iapSsidList; + return; + } + + // Create ScanList + ScanList* scanList = new ScanList( KWlmScanListMaxSize ); + if( scanList == NULL ) + { + aMessage.Complete( KErrNoMemory ); + delete iapDataList; + delete iapSsidList; + delete iapIdList; + return; + } + + TTime* scanTime( NULL ); + if( maxDelayPckg() != KWlmInfiniteScanDelay ) + { + scanTime = new TTime( + CalculateScanStartTime( maxDelayPckg() ).Int64() ); + if( !scanTime ) + { + DEBUG( "CWlmServer::GetAvailableIaps() - unable to instantiate TTime" ); + + aMessage.Complete( KErrNoMemory ); + delete iapDataList; + delete iapSsidList; + delete iapIdList; + delete scanList; + + return; + } + } +#ifdef _DEBUG + else + { + DEBUG( "CWlmServer::GetAvailableIaps() - Infinite maxDelay, request will not be triggering any scans" ); + } +#endif + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EGetAvailableIaps; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + mapEntry.iParam0 = iapDataList; + mapEntry.iParam1 = iapIdList; + mapEntry.iParam2 = scanList; + mapEntry.iParam3 = iapSsidList; + mapEntry.iTime = scanTime; + iRequestMap.Append( mapEntry ); + + // Scan scheduling timer needs to be set again if this request needs the results earlier or + // if this is the only timed pending request + if( scanTime != NULL && ( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) ) + { + UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); + } + } + +// --------------------------------------------------------- +// CWlmServer::CancelGetAvailableIaps +// --------------------------------------------------------- +// +void CWlmServer::CancelGetAvailableIaps( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::CancelGetAvailableIaps()" ); + + CancelExternalRequest( + aSessionId, + EGetAvailableIaps ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::ReleaseComplete +// --------------------------------------------------------- +// +void CWlmServer::ReleaseComplete( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::ReleaseComplete()" ); + + // Data pipe should now be disconnected + // -> safe to disconnect the management pipe. + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EReset; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + iRequestMap.Append( mapEntry ); + + // pass request to core + if( iPlatform->IsWlanDisabled() ) + { + // Disable will release a possible connection + iCoreServer->disable_wlan( mapEntry.iRequestId ); + } + else + { + iCoreServer->release( mapEntry.iRequestId ); + } + } + +// --------------------------------------------------------- +// CWlmServer::NotifySessionCreated +// --------------------------------------------------------- +// +TUint CWlmServer::NotifySessionCreated() + { + DEBUG( "CWlmServer::NotifySessionCreated()" ); + ++iClientSessionCount; + + return ++iSessionIdCounter; + } + +// --------------------------------------------------------- +// CWlmServer::NotifySessionClosed +// --------------------------------------------------------- +// +void CWlmServer::NotifySessionClosed( + TUint aSessionId ) + { + DEBUG( "CWlmServer::NotifySessionClosed()" ); + for( TInt i( 0 ); i < iRequestMap.Count(); i++ ) + { + if( iRequestMap[i].iSessionId == aSessionId ) + { + DEBUG( "CWlmServer::NotifySessionClosed() - corresponding request found" ); + iRequestMap[i].iSessionId = 0; + } + } + + --iClientSessionCount; + } + +// --------------------------------------------------------- +// CWlmServer::NotifyChangedSettings +// --------------------------------------------------------- +// +void CWlmServer::NotifyChangedSettings( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::NotifyChangedSettings()" ); + + aMessage.Complete( + UpdateWlanSettings() ); + } + +// --------------------------------------------------------- +// CWlmServer::UpdateWlanSettings +// --------------------------------------------------------- +// +TInt CWlmServer::UpdateWlanSettings() + { + DEBUG( "CWlmServer::UpdateWlanSettings()" ); + + CWlanDeviceSettings::SWlanDeviceSettings settings = { 0 }; + TRAPD( err, GetWlanSettingsL( settings ) ); + if( err != KErrNone ) + { + DEBUG1( "CWlmServer::UpdateWlanSettings() - GetWlanSettingsL leaved with code %d", err ); + + return err; + } + + // Only if startup is complete, inform current settings to BgScan + if( iIsStartupComplete ) + { + DEBUG( "CWlmServer::UpdateWlanSettings() - notifying settings to BgScan provider" ); + iBgScanProviderSettings = MWlanBgScanProvider::TWlanBgScanSettings( settings.backgroundScanInterval, + settings.psmServerMode, + settings.bgScanPeakPeriodStart, + settings.bgScanPeakPeriodEnd, + settings.bgScanIntervalPeak, + settings.bgScanIntervalOffPeak ); + iBgScanProvider->NotifyChangedSettings( iBgScanProviderSettings ); + } + + // Keep cache lifetime for scan results up to date + iConfiguredCacheLifetime = settings.scanExpirationTimer; + + // Store power save enabled value + iPowerSaveEnabled = settings.powerMode; + + // Convert settings to core side struct + core_device_settings_s coreSettings; + TWlanConversionUtil::ConvertDeviceSettings( + coreSettings, + settings ); + + core_error_e ret = iCoreServer->update_device_settings( coreSettings ); + if( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::UpdateWlanSettings() - update_device_settings() failed with %u", + ret ); + + return TWlanConversionUtil::ConvertErrorCode( ret ); + } + + // Store show broken power save note value + iShowBrokenPowerSaveNote = settings.showBrokenPowerSaveNote; + + DEBUG( "CWlmServer::UpdateWlanSettings() - returning" ); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlmServer::UpdateScanSchedulingTimer +// --------------------------------------------------------- +// +void CWlmServer::UpdateScanSchedulingTimer( + TTime aScanTime, + TUint aTriggeringRequestId ) + { + DEBUG1( "CWlmServer::UpdateScanSchedulingTimer() - aTriggeringRequestId = %u ", aTriggeringRequestId ); + + if( iCoreHandlingScanRequest ) + { + // Core is currently handling scanning, do not set the timer + DEBUG( "CWlmServer::UpdateScanSchedulingTimer() - core is currently handling scanning, do not set the timer" ); + + return; + } + + TTime timeNow; + timeNow.UniversalTime(); + + TTimeIntervalMicroSeconds difference( aScanTime.MicroSecondsFrom( timeNow ) ); + if( difference.Int64() < 0 ) + { + difference = TTimeIntervalMicroSeconds( 0 ); + } + TTimeIntervalMicroSeconds32 differenceMicroseconds( + difference.Int64() ); + + iScanSchedulingTimer->Cancel(); + iScanSchedulingTimerExpiration = aScanTime; + iRequestTriggeringScanning = aTriggeringRequestId; + TCallBack callback( ScanSchedulingTimerExpired, this ); + + DEBUG1( "CWlmServer::UpdateScanSchedulingTimer() - scheduling the timer to %u second(s)", + differenceMicroseconds.Int() / SECONDS_FROM_MICROSECONDS ); + + TTimeIntervalMicroSeconds32 intervalMicroseconds( KWlmMaxScanDelay * SECONDS_FROM_MICROSECONDS ); + + iScanSchedulingTimer->Start( + differenceMicroseconds, + intervalMicroseconds, + callback ); + + } + +// --------------------------------------------------------- +// CWlmServer::FindNextTimedScanSchedulingRequest +// --------------------------------------------------------- +// +TBool CWlmServer::FindNextTimedScanSchedulingRequest( + TUint& aTriggeringRequestIndex ) + { + DEBUG( "CWlmServer::FindNextTimedScanSchedulingRequest()" ); + + TBool pendingScanRequestsFound( EFalse ); + TTime closestTime = TTime( 0 ); + aTriggeringRequestIndex = 0; + + for(TInt i=0; i < iRequestMap.Count(); i++) + { + if( IsPendingTimedScanRequest( i ) ) + { + TTime* checkedTime = reinterpret_cast( iRequestMap[i].iTime ); + if( pendingScanRequestsFound == EFalse || closestTime > *checkedTime ) + { + closestTime = *checkedTime; + aTriggeringRequestIndex = i; + pendingScanRequestsFound = ETrue; + } + } + } + + if( pendingScanRequestsFound == EFalse ) + { + // clear the scan scheduling related variables + iRequestTriggeringScanning = KWlanIntCmdNull; + iScanSchedulingTimerExpiration = TTime( 0 ); + } + else + { + DEBUG1( "CWlmServer::FindNextTimedScanSchedulingRequest() - RequestIndex %u ", aTriggeringRequestIndex ); + } + + return pendingScanRequestsFound; + } + +// --------------------------------------------------------- +// CWlmServer::NotifyBackgroundScanDone +// --------------------------------------------------------- +// +void CWlmServer::NotifyBackgroundScanDone( + ScanList* aScanList, + core_type_list_c* aIapIdList ) + { + DEBUG( "CWlmServer::NotifyBackgroundScanDone()" ); + ASSERT( aScanList != NULL ); + ASSERT( aIapIdList != NULL ); + + // Unload the drivers immediately to conserve power. + if( !iPlatform->IsWlanDisabled() && + iConnectionState == EWlanStateNotConnected ) + { + iCoreServer->unload_drivers(); + } + + RArray networkList; + GetNetworkList( *aScanList, networkList ); + + // Update Cached results + iCache->UpdateScanList( aScanList ); + TBool newIaps( EFalse ); + TBool lostIaps( EFalse ); + iCache->UpdateAvailableNetworksList( + *aIapIdList, + networkList, + newIaps, + lostIaps ); + + networkList.Close(); + + UpdateAvailabilityInfo( + newIaps, + lostIaps, + aScanList->Count() != 0 ); + } + +// --------------------------------------------------------- +// +// Methods implementing abs_core_server_callback_c interface +// +// --------------------------------------------------------- + +// --------------------------------------------------------- +// CWlmServer::notify +// --------------------------------------------------------- +// +void CWlmServer::notify( + core_notification_e notification, + int_t data_len, + const u8_t* data ) + { + DEBUG2( "CWlmServer::notify (notif == %d, data_len == %u)", notification, data_len ); + + // Convert notification type + TWlmNotify amNotification + = TWlanConversionUtil::ConvertNotificationType( notification ); + + // Convert notification parameter + TBuf8 buf; + if ( data_len ) + { + buf.Copy( data, data_len ); + + if ( amNotification == EWlmNotifyConnectionStateChanged ) + { + // 1st byte of notification data corresponds to connection state, + // which must also be converted. + // -> Data changes -> it must be copied + core_connection_state_e state + = static_cast( data[0] ); + buf[0] = static_cast( + TWlanConversionUtil::ConvertConnectionState( state ) ); + } + else if ( amNotification == EWlmNotifyTransmitPowerChanged ) + { + // Core uses dBm values internally, the value must be converted + // to mW. + const u32_t* value + = reinterpret_cast( &data[0] ); + TUint32 retValue + = TWlanConversionUtil::ConvertDecibelToMilliWatts( *value ); + buf.Copy( reinterpret_cast( &retValue ), sizeof ( retValue ) ); + } + else if( amNotification == EWlmNotifyRcpChanged ) + { + // Data contains: + // 1st byte == RCP Class + // 2nd byte == RCP value + // (value is conveyed over client/server IF as 1 byte value) + core_rcp_class_e rcpClass = static_cast( data[0] ); + buf[0] = static_cast( + TWlanConversionUtil::ConvertRcpClass( rcpClass ) ); + } + else if ( amNotification == EWlmNotifyTrafficStreamStatusChanged ) + { + /** + * The first four bytes of notification data is the stream ID, + * which can be passed unmodified. The fifth byte is the status + * of the stream, which needs to be converted. + */ + core_traffic_stream_status_e status + = static_cast( data[4] ); + buf[4] = static_cast( + TWlanConversionUtil::ConvertTrafficStreamStatus( status ) ); + } + else if( amNotification == EWlmNotifyAccessPointInfoChanged ) + { + /** + * The core data structure has to be converted to a corresponding + * adaptation type. + */ + const core_ap_information_s* info = + reinterpret_cast( &data[0] ); + + TWlanAccessPointInfo apInfo; + TWlanConversionUtil::ConvertApInformation( + apInfo, + *info ); + buf.Copy( + reinterpret_cast( &apInfo ), + sizeof ( apInfo ) ); + } + else if( amNotification == EWlmNotifyAcTrafficModeChanged ) + { + core_access_class_e accessClass + = static_cast( data[0] ); + core_access_class_traffic_mode_e trafficMode + = static_cast( data[1] ); + buf[0] = static_cast( + TWlanConversionUtil::ConvertAccessClass( accessClass ) ); + buf[1] = static_cast( + TWlanConversionUtil::ConvertTrafficMode( trafficMode ) ); + } + else if( amNotification == EWlmNotifyAcTrafficStatusChanged ) + { + core_access_class_e accessClass + = static_cast( data[0] ); + core_access_class_traffic_status_e trafficStatus + = static_cast( data[1] ); + buf[0] = static_cast( + TWlanConversionUtil::ConvertAccessClass( accessClass ) ); + buf[1] = static_cast( + TWlanConversionUtil::ConvertTrafficStatus( trafficStatus ) ); + } + } + + // Notify subscribees + for ( TInt i = 0; i < iNotificationArray.Count(); i++ ) + { + iNotificationArray[i]->AddNotification( amNotification, buf ); + } + + // Handle internal state changes / reactions + switch ( amNotification ) + { + case EWlmNotifyConnectionStateChanged: + { + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyConnectionStateChanged "); + // Cache the state to adaptation side member variable. + if ( iConnectionState != static_cast( buf[0] ) ) + { + iPrevConnectionState = iConnectionState; + } + iConnectionState = static_cast( buf[0] ); + + switch ( iConnectionState ) + { + case EWlanStateNotConnected: + DEBUG( "CWlmServer::notify() - STATE: EWlanStateNotConnected" ); + iIsRoaming = EFalse; + + // set icon to "not available" + SetIconState( EWlmIconStatusNotAvailable ); + + // if background scan is on, this call will cause a background scan + // when the background scan is completed, the icon is updated + iBgScanProvider->NotConnected(); + + if ( iBrokenPowerSaveNotifierWaiter->IsActive() ) + { + // cancelling the notifier will cause the iBrokenPowerSaveNotifierWaiter + // to be cancelled as well + iBrokenPowerSaveNotifier.CancelNotifier( KUidWlanPowerSaveTestNote ); + } + break; + case EWlanStateInfrastructure: + DEBUG( "CWlmServer::notify() - STATE: EWlanStateInfrastructure" ); + iIsRoaming = EFalse; + SetIconState( EWlmIconStatusConnected ); + break; + case EWlanStateSearchingAP: + DEBUG( "CWlmServer::notify() - STATE: EWlanStateSearchingAP" ); + iIsRoaming = ETrue; + break; + case EWlanStateIBSS: + DEBUG( "CWlmServer::notify() - STATE: EWlanStateIBSS" ); + iIsRoaming = EFalse; + // Core separates adhoc mode to secure(WEP) and non-secure. + // set icon according to this + if( static_cast( data[0] ) + == core_connection_state_secureibss ) + { + SetIconState( EWlmIconStatusConnectedSecure ); + } + else + { + SetIconState( EWlmIconStatusConnected ); + } + break; + case EWlanStateSecureInfra: + DEBUG( "CWlmServer::notify() - STATE: EWlanStateSecureInfra" ); + iIsRoaming = EFalse; + SetIconState( EWlmIconStatusConnectedSecure ); + break; + case EConnectionStateUnknown: + DEBUG( "CWlmServer::notify() - STATE: EConnectionStateUnknown" ); + break; + default: + break; + } + break; + } + case EWlmNotifyBssidChanged: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyBssidChanged" ); + break; + case EWlmNotifyBssLost: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyBssLost" ); + iIsRoaming = ETrue; + break; + case EWlmNotifyBssRegained: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyBssRegained" ); + break; + case EWlmNotifyRcpiRoamAttemptStarted: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyRcpiRoamAttemptStarted" ); + iIsRoaming = ETrue; + break; + case EWlmNotifyRcpiRoamAttemptCompleted: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyRcpiRoamAttemptCompleted" ); + iIsRoaming = EFalse; + break; + case EWlmNotifyAcTrafficModeChanged: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficModeChanged" ); + break; + case EWlmNotifyAcTrafficStatusChanged: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyAcTrafficStatusChanged" ); + break; + case EWlmNotifyBrokenPowerSaveTestFailed: + DEBUG( "CWlmServer::notify() - STATE: EWlmNotifyBrokenPowerSaveTestFailed" ); + + DEBUG1( "CWlmServer::notify() - iShowBrokenPowerSaveNote: %d", + static_cast( iShowBrokenPowerSaveNote ) ); + + if ( iShowBrokenPowerSaveNote ) + { + if ( !iBrokenPowerSaveNotifierWaiter->IsActive() ) + { + TInt err = iBrokenPowerSaveNotifier.Connect(); + DEBUG1( "CWlmServer::notify() - iNotifier.Connect() returned %d", err ); + if ( err == KErrNone ) + { + iBrokenPowerSaveNotifier.StartNotifierAndGetResponse( iBrokenPowerSaveNotifierWaiter->RequestStatus(), + KUidWlanPowerSaveTestNote, KNullDesC8(), iBrokenPowerSaveNotifierReply ); + + iBrokenPowerSaveNotifierWaiter->IssueRequest(); + } + } +#ifdef _DEBUG + else + { + DEBUG( "CWlmServer::notify() - Notifier already active on the screen" ); + } +#endif + } + break; + default: + break; + } + } + +// --------------------------------------------------------- +// CWlmServer::BrokenPowerSaveNoteClosed +// --------------------------------------------------------- +// +TInt CWlmServer::HandleBrokenPowerSaveNoteClosed( + TAny *aThisPtr ) + { + DEBUG( "CWlmServer::HandleBrokenPowerSaveNoteClosed()" ); + + CWlmServer* self = static_cast( aThisPtr ); + + ASSERT( self ); + ASSERT( self->iBrokenPowerSaveNotifierWaiter ); + + // close the notifier + self->iBrokenPowerSaveNotifier.Close(); + + // check the request's completion status + TInt err = self->iBrokenPowerSaveNotifierWaiter->RequestStatus().Int(); + switch ( err ) + { + case KErrNotFound: + { + DEBUG( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - Notifier not found, returning" ); + return err; + } + case KErrCancel: + { + DEBUG( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - Notifier cancelled, returning" ); + return err; + } + default: + { + // flow through + } + } + + self->iShowBrokenPowerSaveNote = self->iBrokenPowerSaveNotifierReply() ? EFalse : ETrue; + + // re-use err variable + TRAP( err, self->StoreWlanCenRepKeyValueL( KWlanShowBrokenPowerSaveNote, self->iShowBrokenPowerSaveNote ) ); + if ( err != KErrNone ) + { + DEBUG1( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - failed to update CenRep, error code %d", err ); + return err; + } + + DEBUG1( "CWlmServer::HandleBrokenPowerSaveNoteClosed() - iShowBrokenPowerSaveNote value (%d) stored to CenRep", + static_cast( self->iShowBrokenPowerSaveNote ) ); + + return err; + } + +// --------------------------------------------------------- +// CWlmServer::NotifyChangedPsmSrvMode +// --------------------------------------------------------- +// +void CWlmServer::NotifyChangedPsmSrvMode( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::NotifyChangedPsmSrvMode()" ); + + TInt mode( aMessage.Int0() ); + TInt err( KErrNone ); + + TRAP( err, StoreWlanCenRepKeyValueL( KWlanPsmSrvMode, mode ) ); + if ( err != KErrNone ) + { + DEBUG1( "CWlmServer::NotifyChangedPsmSrvMode() - failed to update CenRep, error code %d", err ); + } + + DEBUG1( "CWlmServer::NotifyChangedPsmSrvMode() - mode %i", + mode ); + + aMessage.Complete( err ); + + UpdateWlanSettings(); + + } + +// --------------------------------------------------------- +// CWlmServer::StoreWlanCenRepKeyValue +// --------------------------------------------------------- +// +void CWlmServer::StoreWlanCenRepKeyValueL( const TUint32 aKey, const TInt aValue ) const + { + DEBUG( "CWlmServer::StoreWlanCenRepKeyValueL()" ); + + CWlanDeviceSettings* db = CWlanDeviceSettings::NewL(); + CleanupStack::PushL( db ); + + // Write setting + db->WriteCenRepKeyL( aKey, aValue ); + + CleanupStack::PopAndDestroy( db ); + db = NULL; + + } + +// --------------------------------------------------------- +// CWlmServer::SetCachedRegion +// --------------------------------------------------------- +// +void CWlmServer::SetCachedRegion( + TUint32 region, + TInt32 timestamp ) + { + DEBUG( "CWlmServer::SetCachedRegion()" ); + + if ( region == 0 || timestamp == 0 ) + { + // cached results do not exist -> iRegion remains in its original value + return; + } + + TTime currentTime(0); + TTimeIntervalHours difference(0); + TInt64 timestampInt64; + + currentTime.UniversalTime(); + timestampInt64 = static_cast(timestamp) * KWlmTimestampInCenrep; // timestamp is in minutes in CenRep + + TTime timestampMicroseconds(timestampInt64); + + TInt overflow = currentTime.HoursFrom( timestampMicroseconds, difference ); + if ( Abs( difference.Int() ) >= KWlmDomainInfoExpire || overflow ) + { + DEBUG( "CWlmServer::SetCachedRegion() - cached results are too old, region information is not changed" ); + } + else if ( Abs( difference.Int()) < KWlmDomainInfoExpire ) + { + DEBUG( "CWlmServer::SetCachedRegion() - cached results are valid, they are taken into use" ); + if ( region == KWlmRegionETSI) + { + iRegion = EETSI; + DEBUG( "CWlmServer::SetCachedRegion() - Region is ETSI" ); + } + else + { + iRegion = EFCC; + DEBUG( "CWlmServer::SetCachedRegion() - Region is FCC" ); + } + iTimeofDomainQuery = timestampMicroseconds; + } + } + + +// --------------------------------------------------------- +// CWlmServer::store_ap_country_info +// --------------------------------------------------------- +// +void CWlmServer::store_ap_country_info( + u32_t request_id, + const core_wlan_region_e& found_region, + bool_t inconsistent_info ) + { + DEBUG( "CWlmServer::store_ap_country_info()" ); + + iRegion = TWlanConversionUtil::ConvertRegion( found_region ); + + // Write the WLAN region and timestamp to CenRep if the country information from APs was not inconsistent + if ( !inconsistent_info ) + { + iTimeofDomainQuery.UniversalTime(); + + TInt region( KWlmRegionFCC ); + if ( iRegion == EETSI ) + { + region = KWlmRegionETSI; + } + + TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, region )); + if ( ret == KErrNone ) + { + TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) )); + if ( ret == KErrNone ) + { + DEBUG1( "CWlmServer::regulatory_domain() - stored regulatory domain is 0x%02X ", iRegion ); + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region timestamp leaved with code %d,", ret ); + } + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region leaved with code %d,", ret ); + } + } + // If the APs country information was inconsistent then region is selected to be ETSI + else + { + iRegion = EETSI; + iTimeofDomainQuery.UniversalTime(); + + DEBUG1( "CWlmServer::store_ap_country_info() - regulatory domain is 0x%02X", iRegion ); + } + + + // Set timers to notice if system time is changed + iPlatform->InitializeSystemTimeHandler(); + + iCoreAsynchCbId = request_id; + iCoreAsynchCbStatus = core_error_ok; + iCoreAsynchCb->CallBack(); + + } + +// --------------------------------------------------------- +// CWlmServer::get_regulatory_domain +// --------------------------------------------------------- +// +void CWlmServer::get_regulatory_domain( + u32_t request_id, + core_wlan_region_e& region, +#ifndef __WINS__ + bool_t& mcc_known ) +#else + bool_t& /* mcc_known */ ) +#endif // __WINS__ + { + DEBUG( "CWlmServer::regulatory_domain()" ); + + ASSERT( !iCoreAsynchCbId ); + +#ifndef __WINS__ + TTime currentTime(0); + TTimeIntervalHours difference(0); + TUint mcc( 0 ); + + currentTime.UniversalTime(); + mcc_known = false_t; + + TInt overflow = currentTime.HoursFrom( iTimeofDomainQuery, difference ); + if ( Abs( difference.Int() ) >= KWlmDomainInfoExpire || overflow ) + { + DEBUG( "CWlmServer::regulatory_domain() - cache is not valid, querying MCC" ); + iRegion = EETSI; + + // Query the MCC of the currently used operator. + TRAPD( ret, iPlatform->GetCurrentOperatorMccL( mcc ) ); + if ( ret == KErrNone && + mcc ) + { + DEBUG1( "CWlmServer::regulatory_domain() - MCC is %u", mcc ); + + mcc_known = true_t; + iTimeofDomainQuery.UniversalTime(); + + for ( TUint i(0); i < KWlmOperatorMccNATableLength; i++ ) + { + if ( mcc == KWlmOperatorMccNATable[i] ) + { + DEBUG( "CWlmServer::regulatory_domain() - MCC matches a US MCC" ); + iRegion = EFCC; + break; + } + } + // Write the WLAN region and timestamp to CenRep + TInt wlanRegion( KWlmRegionFCC ); + if ( iRegion == EETSI ) + { + wlanRegion = KWlmRegionETSI; + } + + TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, wlanRegion )); + if ( ret == KErrNone ) + { + TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) )); + if ( ret == KErrNone ) + { + DEBUG1( "CWlmServer::regulatory_domain() - stored regulatory domain is 0x%02X ", iRegion ); + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - attempt to store timestamp leaved with code %d,", ret ); + } + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region leaved with code %d,", ret ); + } + + // Set timers to notice if system time is changed + iPlatform->InitializeSystemTimeHandler(); + + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - GetCurrentOperatorMccL leaved with code %d,", ret ); + iRegion = EFCC; + } + } + else if ( Abs( difference.Int()) < KWlmDomainInfoExpire ) + { + DEBUG( "CWlmServer::regulatory_domain() - cache valid, querying MCC" ); + + TWlanRegion currentRegion = EETSI; + + // Query the MCC of the currently used operator. + TRAPD( ret, iPlatform->GetCurrentOperatorMccL( mcc ) ); + if ( ret == KErrNone && + mcc ) + { + DEBUG1( "CWlmServer::regulatory_domain() - MCC is %u", mcc ); + + mcc_known = true_t; + iTimeofDomainQuery.UniversalTime(); + + for ( TUint i(0); i < KWlmOperatorMccNATableLength; i++ ) + { + if ( mcc == KWlmOperatorMccNATable[i] ) + { + DEBUG( "CWlmServer::regulatory_domain() - MCC matches a US MCC" ); + currentRegion = EFCC; + break; + } + } + + /* WLAN region is stored to CenRep only if it has changed, because otherwise + * this would cause CenRep to be written always when the drivers are loaded. + */ + if ( iRegion != currentRegion ) + { + iRegion = currentRegion; + + // Write the WLAN region and timestamp to CenRep + TInt wlanRegion( KWlmRegionFCC ); + if ( iRegion == EETSI ) + { + wlanRegion = KWlmRegionETSI; + } + + TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, wlanRegion )); + if ( ret == KErrNone ) + { + TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, ( iTimeofDomainQuery.Int64() / KWlmTimestampInCenrep ) )); + if ( ret == KErrNone ) + { + DEBUG1( "CWlmServer::regulatory_domain() - stored regulatory domain is 0x%02X ", iRegion ); + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region timestamp leaved with code %d,", ret ); + } + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - attempt to store region leaved with code %d,", ret ); + } + + // Set timers to notice if system time is changed + iPlatform->InitializeSystemTimeHandler(); + + } + else + { + iRegion = currentRegion; + } + + } + else + { + DEBUG1( "CWlmServer::regulatory_domain() - GetCurrentOperatorMccL leaved with code %d,", ret ); + mcc_known = true_t; + } + } + + DEBUG1( "CWlmServer::regulatory_domain() - regulatory domain is 0x%02X", iRegion ); + + region = TWlanConversionUtil::ConvertRegion( iRegion ); +#else // __WINS__ + region = core_wlan_region_fcc; +#endif // __WINS__ + + iCoreAsynchCbId = request_id; + iCoreAsynchCbStatus = core_error_ok; + iCoreAsynchCb->CallBack(); + } + +// --------------------------------------------------------- +// CWlmServer::request_complete +// --------------------------------------------------------- +// +void CWlmServer::request_complete( + u32_t request_id, + core_error_e status ) + { + DEBUG2( "CWlmServer::request_complete(%u, %d)", request_id, status ); + +#ifdef _DEBUG + TInt requestMapCount( iRequestMap.Count() ); + if( requestMapCount ) + { + DEBUG( "CWlmServer::request_complete() - current requests:" ); + for ( TInt idx( 0 ); idx < requestMapCount; ++idx ) + { + DEBUG2( "CWlmServer::request_complete() - ID %u, function %d", iRequestMap[idx].iRequestId, iRequestMap[idx].iFunction ); + } + } +#endif + + // Find correct request from the map + TInt idx = FindRequestIndex( request_id ); + + if( idx >= iRequestMap.Count() ) + { + DEBUG1("CWlmServer::request_complete() - completed request (ID %u) not in request map", + request_id ); + return; + } + + // create a copy of completed request's map entry + SRequestMapEntry completedMapEntry = iRequestMap[idx]; + + // If the operation was GetAvailableIaps, see if there are any SSID lists + // defined and update the availability results. + if( completedMapEntry.iFunction == EGetAvailableIaps ) + { + TRAP_IGNORE( HandleSsidListAvailabilityL( completedMapEntry ) ); + } + + // Complete first all the other possible request that can be completed using the same results + // and the actual triggering request is completed last + // Background scan request should be updated after all requests have been completed + TBool bgScanCompleted( request_id == KWlanIntCmdBackgroundScan ); + if( request_id == iRequestTriggeringScanning && + status != core_error_cancel ) + { + DEBUG( "CWlmServer::request_complete() - also additional requests can be completed" ); + + /* + * Request can be completed using other the results of another request if + * this method is related to scan scheduling and results of the triggering request can + * be used also to completed this request + * + * Following rules apply: + * - GetAvailableIaps results can be used to complete another GetAvailableIaps request, + * background scan request or GetScanResults request without given SSID (broadcast scan) + * - Background scan results can be used to complete GetAvailableIaps request or + * GetScanResults request without given SSID (broadcast scan) + * - GetScanResults request without given SSID (broadcast scan) results can be used to complete + * another GetScanResults request without given SSID (broadcast scan) + * - GetScanResults request with given SSID (direct scan) results can be used to complete + * another GetScanResults request with same given SSID (direct scan) + */ + + TInt i = 0; + while( i < iRequestMap.Count() ) + { + if( IsPendingScanRequest(i) && + iRequestMap[i].iRequestId != iRequestTriggeringScanning && + CanRequestBeCompleted( iRequestMap[i], completedMapEntry ) ) + { + DEBUG1( "CWlmServer::request_complete() - completing additional request (ID %u)", iRequestMap[i].iRequestId ); + + if( iRequestMap[i].iRequestId == KWlanIntCmdBackgroundScan ) + { + CompleteInternalRequest( i, status, EFalse ); + bgScanCompleted = ETrue; + } + else + { + CompleteExternalRequest( i, status, &completedMapEntry ); + if( IsSessionActive( iRequestMap[i] ) ) + { + iRequestMap[i].iMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( status ) ); + } + iRequestMap.Remove( i ); + } + } + else + { + ++i; + } + } + } + + // clear completedMapEntry as it is not needed anymore + completedMapEntry = SRequestMapEntry(); + + // complete the request which Core has actually handled + TInt triggerIndex = FindRequestIndex( request_id ); + + DEBUG1( "CWlmServer::request_complete() - completing triggering request (ID %u)", iRequestMap[triggerIndex].iRequestId ); + if( request_id < KWlanExtCmdBase ) + { + CompleteInternalRequest( triggerIndex, status ); + } + else if( iRequestMap[triggerIndex].iFunction == EJoinByProfileId ) + { + core_iap_data_s* coreIapData = + reinterpret_cast( iRequestMap[triggerIndex].iParam0 ); + core_type_list_c* coreSsidList = + reinterpret_cast*>( iRequestMap[triggerIndex].iParam1 ); + core_connect_status_e* connectionStatus = + reinterpret_cast( iRequestMap[triggerIndex].iParam2 ); + + if( status == core_error_ok && IsSessionActive( iRequestMap[triggerIndex] ) ) + { + DEBUG2("CONNECT COMPLETED WITH status == %u -> adapt == %d", + *connectionStatus, + TWlanConversionUtil::ConvertConnectStatus( + *connectionStatus, + coreIapData->security_mode ) ); + iRequestMap[triggerIndex].iMessage.Complete( + TWlanConversionUtil::ConvertConnectStatus( + *connectionStatus, + coreIapData->security_mode ) ); + } + else if ( IsSessionActive( iRequestMap[triggerIndex] ) ) + { + DEBUG2("CONNECT COMPLETED WITH error == %u -> adapt == %d", + status, + TWlanConversionUtil::ConvertErrorCode( status ) ); + iRequestMap[triggerIndex].iMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( status ) ); + } + else + { + DEBUG( "CWlmServer::request_complete() - session has already closed" ); + } + delete coreIapData; + delete coreSsidList; + delete connectionStatus; + iRequestMap.Remove( triggerIndex ); + } + else if ( iRequestMap[triggerIndex].iFunction == ERunProtectedSetup ) + { + core_iap_data_s* iapData = + reinterpret_cast( iRequestMap[triggerIndex].iParam0 ); + core_type_list_c* iapDataList = + reinterpret_cast*>( iRequestMap[triggerIndex].iParam1 ); + core_protected_setup_status_e* protectedSetupStatus = + reinterpret_cast( iRequestMap[triggerIndex].iParam2 ); + + // Convert the received credentials. + TWlmProtectedSetupCredentials tmp; + tmp.count = 0; + core_iap_data_s* iter = iapDataList->first(); + while ( iter && tmp.count < KWlmProtectedSetupMaxCount ) + { + TWlanConversionUtil::ConvertProtectedSetupCredentialAttribute( + tmp.credentials[tmp.count], + *iter ); + ++tmp.count; + iter = iapDataList->next(); + } + + DEBUG1( "CWlmServer::request_complete() - converted %u Protected Setup credential attributes", + tmp.count ); + + if( IsSessionActive( iRequestMap[triggerIndex] ) ) + { + TPckg outPckg( tmp ); + iRequestMap[triggerIndex].iMessage.Write( 1, outPckg ); + } + + if( status == core_error_ok && IsSessionActive( iRequestMap[triggerIndex] ) ) + { + DEBUG2("PROTECTED SETUP COMPLETED WITH status == %d -> adapt == %d", + *protectedSetupStatus, + TWlanConversionUtil::ConvertProtectedSetupStatus( *protectedSetupStatus ) ); + iRequestMap[triggerIndex].iMessage.Complete( + TWlanConversionUtil::ConvertProtectedSetupStatus( *protectedSetupStatus ) ); + } + else if ( IsSessionActive( iRequestMap[triggerIndex] ) ) + { + DEBUG2("PROTECTED SETUP COMPLETED WITH error == %d -> adapt == %d", + status, + TWlanConversionUtil::ConvertErrorCode( status ) ); + iRequestMap[triggerIndex].iMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( status ) ); + } + else + { + DEBUG( "CWlmServer::request_complete() - session has already closed" ); + } + + delete iapData; + delete iapDataList; + delete protectedSetupStatus; + iRequestMap.Remove( triggerIndex ); + } + else + { + CompleteExternalRequest( triggerIndex, status ); + if( IsSessionActive( iRequestMap[triggerIndex] ) ) + { + iRequestMap[triggerIndex].iMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( status ) ); + } + iRequestMap.Remove( triggerIndex ); + } + + // Background scan request needs to be updated only after all the other request have been completed + // otherwise the new request will be appended to the pending list too early + if( bgScanCompleted ) + { + iBgScanProvider->ScanComplete(); + } + + TUint indexNextScan; + if( request_id == iRequestTriggeringScanning ) + { + iCoreHandlingScanRequest = EFalse; + + if( FindNextTimedScanSchedulingRequest( indexNextScan ) ) + { + TTime* nextScanTime = reinterpret_cast( iRequestMap[indexNextScan].iTime ); + UpdateScanSchedulingTimer( *nextScanTime, iRequestMap[indexNextScan].iRequestId ); + } + } + +#ifdef _DEBUG + requestMapCount = iRequestMap.Count(); + if( requestMapCount ) + { + DEBUG( "CWlmServer::request_complete() - remaining requests:" ); + for ( TInt idx( 0 ); idx < requestMapCount; ++idx ) + { + DEBUG1( "CWlmServer::request_complete() - ID %u", iRequestMap[idx].iRequestId ); + DEBUG1( "CWlmServer::request_complete() - function %d", iRequestMap[idx].iFunction ); + } + } +#endif + + return; + + } + +// --------------------------------------------------------- +// CWlmServer::CanRequestBeCompleted +// --------------------------------------------------------- +// +TBool CWlmServer::CanRequestBeCompleted( + const SRequestMapEntry& aCheckedMapEntry, + const SRequestMapEntry& aCompletedMapEntry ) const + { + DEBUG2( "CWlmServer::CanRequestBeCompleted() - checked %u completed %u", + aCheckedMapEntry.iRequestId, aCompletedMapEntry.iRequestId ); + + if( aCheckedMapEntry.iRequestId == KWlanIntCmdBackgroundScan ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The request to be checked is background scan" ); + + if( iRequestTriggeringScanning == KWlanIntCmdBackgroundScan ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is background scan" ); + + return ETrue; + } + else if( aCompletedMapEntry.iRequestId >= KWlanExtCmdBase && + aCompletedMapEntry.iFunction == EGetAvailableIaps ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is GetAvailableIaps" ); + + return ETrue; + } + else + { + return EFalse; + } + } + else if( aCheckedMapEntry.iFunction == EGetAvailableIaps ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The request to be checked is GetAvailableIaps" ); + + if( iRequestTriggeringScanning == KWlanIntCmdBackgroundScan ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is background scan" ); + + return ETrue; + } + else if( aCompletedMapEntry.iRequestId >= KWlanExtCmdBase && + aCompletedMapEntry.iFunction == EGetAvailableIaps ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is GetAvailableIap" ); + + return ETrue; + } + else + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is not scan related" ); + + return EFalse; + } + } + else if( aCheckedMapEntry.iFunction == EGetScanResults ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The request to be checked is GetScanResults" ); + + core_ssid_s* triggeringSsid = reinterpret_cast( aCompletedMapEntry.iParam1 ); + core_ssid_s* checkedSsid = reinterpret_cast( aCheckedMapEntry.iParam1 ); + + if( checkedSsid->length == 0 && + aCompletedMapEntry.iRequestId == KWlanIntCmdBackgroundScan ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is background scan" ); + + return ETrue; + } + else if( aCompletedMapEntry.iRequestId >= KWlanExtCmdBase && + checkedSsid->length == 0 && + aCompletedMapEntry.iFunction == EGetAvailableIaps ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is GetAvailableIaps" ); + + return ETrue; + } + else if( aCompletedMapEntry.iRequestId >= KWlanExtCmdBase && + checkedSsid->length == 0 && + aCompletedMapEntry.iFunction == EGetScanResults && + triggeringSsid->length == 0 ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is GetScanResults (broadcast)" ); + + return ETrue; + } + else if( aCompletedMapEntry.iRequestId >= KWlanExtCmdBase && + checkedSsid->length != 0 && + aCompletedMapEntry.iFunction == EGetScanResults && + triggeringSsid->length != 0 && + *checkedSsid == *triggeringSsid ) + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is GetScanResults (direct) and both have same SSID" ); + + return ETrue; + } + else + { + DEBUG( "CWlmServer::CanRequestBeCompleted() - The triggering request is something else" ); + + return EFalse; + } + + } + return EFalse; + } + +// --------------------------------------------------------- +// CWlmServer::CompleteInternalRequest +// --------------------------------------------------------- +// +void CWlmServer::CompleteInternalRequest( + TUint32 aIndex, + core_error_e aStatus, + TBool aCompletedWasTriggering ) + { + DEBUG1( "CWlmServer::CompleteInternalRequest() - index (%d)", aIndex ); + + // Take the entry out from queue + SRequestMapEntry requestEntry = iRequestMap[ aIndex ]; + + iRequestMap.Remove( aIndex ); + + switch( requestEntry.iRequestId ) + { + case KWlanIntCmdBackgroundScan: + { + core_type_list_c* iapSsidList = + reinterpret_cast*>( requestEntry.iParam3 ); + delete iapSsidList; + iapSsidList = NULL; + + ScanList* scanList = + reinterpret_cast( requestEntry.iParam2 ); + core_type_list_c* idList = + reinterpret_cast*>( requestEntry.iParam1 ); + + core_type_list_c* iapDataList = + reinterpret_cast*>( requestEntry.iParam0 ); + delete iapDataList; + iapDataList = NULL; + + TTime* completedScanTime = reinterpret_cast( requestEntry.iTime ); + delete completedScanTime; + completedScanTime = NULL; + + if( aCompletedWasTriggering ) + { + DEBUG( "CWlmServer::CompleteInternalRequest() - this request was handled by core" ); + + if( aStatus == core_error_ok ) + { + NotifyBackgroundScanDone( scanList, idList ); + // cache takes the ownership of the scanList + scanList = NULL; + } + } + else + { + DEBUG( "CWlmServer::CompleteInternalRequest() - this request was not handled by core" ); + } + + delete scanList; + scanList = NULL; + delete idList; + idList = NULL; + + break; + } + case KWlanIntCmdNull: // Fall through on purpose + default: + break; + // not interested in rest of the internal request completions + } + } + +// --------------------------------------------------------- +// CWlmServer::CompleteExternalRequest +// --------------------------------------------------------- +// +void CWlmServer::CompleteExternalRequest( + TUint32 aIndex, + core_error_e aStatus, + SRequestMapEntry* aTriggerRequest ) + { + DEBUG1( "CWlmServer::CompleteExternalRequest() - index (%d)", aIndex ); + + // Take the entry out from queue + SRequestMapEntry requestEntry = iRequestMap[ aIndex ]; + + // Find out the request type + // in order to handle possible return parameters + switch( requestEntry.iFunction ) + { + case EGetScanResults: + { + ScanList* tmp( NULL ); + core_ssid_s* ssid = reinterpret_cast( requestEntry.iParam1 ); + TTime* completedScanTime = reinterpret_cast( requestEntry.iTime ); + ScanList* completedScanList = reinterpret_cast( requestEntry.iParam0 ); + + if( aTriggerRequest == NULL ) + { + DEBUG( "CWlmServer::CompleteExternalRequest() - GetScanResults request handled by core" ); + + tmp = reinterpret_cast( requestEntry.iParam0); + } + else + { + DEBUG( "CWlmServer::CompleteExternalRequest() - GetScanResults request not handled by core" ); + // Use the results of the triggering request to complete also this other request + // Check was the triggering request background scan or GetAvailableIaps or + // was it GetScanResults because the ScanList is stored to different parameter + if( aTriggerRequest->iRequestId >= KWlanExtCmdBase && aTriggerRequest->iFunction == EGetScanResults ) + { + tmp = reinterpret_cast( aTriggerRequest->iParam0 ); + } + else + { + tmp = reinterpret_cast( aTriggerRequest->iParam2 ); + } + } + + if( aStatus == core_error_ok ) + { + TDynamicScanList dynamicScanList; + dynamicScanList.count = tmp->Count(); + dynamicScanList.size = tmp->Size(); + + TPckgBuf pckgDynamicScanList( dynamicScanList ); + TPtr8 ptrScanList( + tmp->Data(), + tmp->Size(), + tmp->Size() ); + + DEBUG2( "CWlmServer::CompleteExternalRequest() - scan results count is %u, size is %u", + tmp->Count(), tmp->Size() ); + + if( requestEntry.iSessionId != 0 ) + { + requestEntry.iMessage.Write( 0, ptrScanList ); + requestEntry.iMessage.Write( 2, pckgDynamicScanList ); + } + + // Check whether to cache the results or not + if( ssid->length > 0 && aTriggerRequest == NULL ) + { + // direct scan results are not cached + DEBUG( "CWlmServer::CompleteExternalRequest() - direct scan; not caching scan results" ); + + delete tmp; + } + else if( aTriggerRequest == NULL ) + { + // not deleting scanList, because cache takes the ownership + DEBUG( "CWlmServer::CompleteExternalRequest() - caching scan results" ); + iCache->UpdateScanList( tmp ); + } + else + { + DEBUG( "CWlmServer::CompleteExternalRequest() - request not handled by core; not caching scan results" ); + + delete completedScanList; + } + } + else + { + // scan failed due to some reason: not caching anything + if( aTriggerRequest == NULL ) + { + delete tmp; + } + else + { + delete completedScanList; + } + } + + delete ssid; // ssid + delete completedScanTime; + break; + } + case EReset: + { + // no parameters to return + break; + } + case EGetAvailableIaps: + { + // Create pointers to parameters + core_type_list_c* iapSsidList; + ScanList* scanList; + core_type_list_c* coreIdList; + core_type_list_c* iapDataList; + + iapSsidList = reinterpret_cast*>( requestEntry.iParam3 ); + iapDataList = reinterpret_cast*>( requestEntry.iParam0 ); + + TTime* completedScanTime = reinterpret_cast( requestEntry.iTime ); + ScanList* completedScanList = reinterpret_cast( requestEntry.iParam2); + core_type_list_c* completedIdList = reinterpret_cast*>( requestEntry.iParam1 ); + + if( aTriggerRequest == NULL ) + { + DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request handled by core" ); + + scanList = reinterpret_cast( requestEntry.iParam2); + coreIdList = reinterpret_cast*>( requestEntry.iParam1 ); + } + else + { + DEBUG( "CWlmServer::CompleteExternalRequest() - GetAvailableIaps request not handled by core" ); + //Use the results of the triggering request to complete also this other request + scanList = reinterpret_cast( aTriggerRequest->iParam2); + coreIdList = reinterpret_cast*>( aTriggerRequest->iParam1 ); + } + + delete iapSsidList; + iapSsidList = NULL; + delete iapDataList; + iapDataList = NULL; + + if( aStatus == core_error_ok ) + { + RArray networkList; + GetNetworkList( *scanList, networkList ); + + // Update Cached results + TBool newIaps( EFalse ); + TBool lostIaps( EFalse ); + + if( aTriggerRequest == NULL ) + { + iCache->UpdateAvailableNetworksList( + *coreIdList, + networkList, + newIaps, + lostIaps ); + } + networkList.Close(); + + TWlmAvailableIaps tmp; + TUint32* pInt = coreIdList->first(); + TInt idx = 0; + while( pInt ) + { + DEBUG1( "CWlmServer::CompleteExternalRequest() - IAP %u is available", + *pInt ); + tmp.iaps[ idx ] = *pInt; + idx++; + pInt = coreIdList->next(); + } + + tmp.count = idx; + + if( requestEntry.iSessionId != 0 ) + { + TPckg outPckg( tmp ); + requestEntry.iMessage.Write( 0, outPckg ); + } + if( aTriggerRequest == NULL ) + { + DEBUG1("CWlmServer::CompleteExternalRequest() - delete iapIdList (%d)", coreIdList); + + delete coreIdList; + } + else + { + // If this completed request was not the triggering request then there is no need + // to cache anything. The triggering request results will be cached. + delete completedIdList; + delete completedScanList; + } + + // handle scan list + if( aTriggerRequest == NULL ) + { + iCache->UpdateScanList( scanList ); + // not deleting scanList, because cache takes the ownership + + UpdateAvailabilityInfo( + newIaps, + lostIaps, + scanList->Count() != 0 ); + } + } + else + { + // scan failed due to some reason: not caching anything + if( aTriggerRequest == NULL ) + { + delete coreIdList; + delete scanList; + } + else + { + // Delete only the lists of the completed request. Triggering request lists are + // deleted later on when that request is actually handled. + delete completedIdList; + delete completedScanList; + } + } + delete completedScanTime; + break; + } + case EGetCurrentRSSI: + { + TUint32 tmp + = *( reinterpret_cast + ( requestEntry.iParam0 ) ); + if( requestEntry.iSessionId != 0 ) + { + TPckg outPckg( tmp ); + requestEntry.iMessage.Write( 0, outPckg ); + } + iPrevRcpiValue = tmp; + delete reinterpret_cast( requestEntry.iParam0 ); + break; + } + case EGetSystemMode: + { + // not asynch request; never comes here + break; + } + case EConfigureMulticastGroup: + { + // no parameters to return + delete reinterpret_cast( requestEntry.iParam0 ); + break; + } + case EGetPacketStatistics: + { + core_packet_statistics_s* coreStatistics = + reinterpret_cast( requestEntry.iParam0 ); + if( requestEntry.iSessionId != 0 ) + { + TPckgBuf statisticPckg; + TWlanConversionUtil::ConvertPacketStatistics( + statisticPckg(), + *coreStatistics ); + requestEntry.iMessage.Write( 0, statisticPckg ); + } + delete coreStatistics; + break; + } + case ECreateTrafficStream: + { + u32_t* coreStreamId = + reinterpret_cast( requestEntry.iParam0 ); + core_traffic_stream_status_e* coreStreamStatus = + reinterpret_cast( requestEntry.iParam1 ); + if( requestEntry.iSessionId != 0 && + aStatus == core_error_ok ) + { + TPckgBuf streamIdPckg( + *coreStreamId ); + TPckgBuf streamStatusPckg( + TWlanConversionUtil::ConvertTrafficStreamStatus( *coreStreamStatus ) ); + requestEntry.iMessage.Write( 2, streamIdPckg ); + requestEntry.iMessage.Write( 3, streamStatusPckg ); + } + delete coreStreamId; + delete coreStreamStatus; + break; + } + case EDeleteTrafficStream: + { + // no parameters to return + break; + } + case EDirectedRoam: + { + // no parameters to return + break; + } + default: + { + DEBUG1( "CWlmServer::CompleteExternalRequest() - ERROR: unknown request type (%d)!", + requestEntry.iFunction ); + break; + } + } + } + +// --------------------------------------------------------- +// CWlmServer::IsAvailableNetworkEqual +// --------------------------------------------------------- +// +TBool CWlmServer::IsAvailableNetworkEqual( + const TWlanAvailableNetwork& aFirst, + const TWlanAvailableNetwork& aSecond ) + { + if( aFirst.ssid != aSecond.ssid ) + { + return EFalse; + } + + if( aFirst.networkType != aSecond.networkType ) + { + return EFalse; + } + + if( aFirst.securityMode != aSecond.securityMode ) + { + return EFalse; + } + + return ETrue; + } + +// --------------------------------------------------------- +// CWlmServer::GetNetworkList +// --------------------------------------------------------- +// +TInt CWlmServer::GetNetworkList( + const ScanList& aScanList, + RArray& aNetworkList ) + { + DEBUG( "CWlmServer::GetNetworkList()" ); + + ScanInfo info( aScanList ); + TIdentityRelation isEqual( IsAvailableNetworkEqual ); + for( info.First(); !info.IsDone(); info.Next() ) + { + TUint8 ieLength( 0 ); + const TUint8* ieData = NULL; + + if ( info.InformationElement( E802Dot11SsidIE, ieLength, &ieData ) == WlanScanError_Ok && + ieLength <= KMaxSSIDLength ) + { + TWlanAvailableNetwork network; + network.ssid.Copy( ieData, ieLength ); + network.securityMode = info.SecurityMode(); + if( info.OperatingMode() == WlanOperatingModeInfra ) + { + network.networkType = Infrastructure; + } + else + { + network.networkType = Adhoc; + } + + if ( aNetworkList.Find( network, isEqual ) == KErrNotFound ) + { + DEBUG1S( "CWlmServer::GetNetworkList() - appending SSID ", + ieLength, ieData ); + aNetworkList.Append( network ); + } + } + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlmServer::UpdateAvailabilityInfo +// --------------------------------------------------------- +// +void CWlmServer::UpdateAvailabilityInfo( + TBool aNewNetworksDetected, + TBool aOldNetworksLost, + TBool aAnyNetworksDetected ) + { + DEBUG1( "CWlmServer::UpdateAvailabilityInfo() - aNewNetworksDetected: %u", + aNewNetworksDetected ); + DEBUG1( "CWlmServer::UpdateAvailabilityInfo() - aOldNetworksLost: %u", + aOldNetworksLost ); + DEBUG1( "CWlmServer::UpdateAvailabilityInfo() - aAnyNetworksDetected: %u", + aAnyNetworksDetected ); + + /** + * Make sure background scan is on before giving any indications. + */ + if( !iBgScanProvider->IsBgScanEnabled() ) + { + DEBUG( "CWlmServer::UpdateAvailabilityInfo() - background scan is not enabled, not sending any indications" ); + return; + } + + /** + * Notify clients about new networks/IAPs if necessary. + */ + if( aNewNetworksDetected ) + { + TBuf8<1> tmp; + for( TInt i = 0; i < iNotificationArray.Count(); i++ ) + { + iNotificationArray[i]->AddNotification( EWlmNotifyNewNetworksDetected, tmp ); + } + } + + /** + * Notify clients about lost networks/IAPs if necessary. + */ + if( aOldNetworksLost ) + { + TBuf8<1> tmp; + for( TInt i = 0; i < iNotificationArray.Count(); i++ ) + { + iNotificationArray[i]->AddNotification( EWlmNotifyOldNetworksLost, tmp ); + } + } + + /** + * Set icon state if not connected. + */ + if( iConnectionState == EWlanStateNotConnected ) + { + if( aAnyNetworksDetected ) + { + SetIconState( EWlmIconStatusAvailable ); + } + else + { + SetIconState( EWlmIconStatusNotAvailable ); + } + } + } + +// --------------------------------------------------------- +// CWlmServer::CancelExternalRequest +// --------------------------------------------------------- +// +void CWlmServer::CancelExternalRequest( + TUint aSessionId, + TWLMCommands aCommand ) + { + DEBUG( "CWlmServer::CancelExternalRequest()" ); + DEBUG1( "CWlmServer::CancelExternalRequest() - aSessionId: %u", + aSessionId ); + DEBUG1( "CWlmServer::CancelExternalRequest() - aCommand: %u", + aCommand ); + +#ifdef _DEBUG + DEBUG( "CWlmServer::CancelExternalRequest()" ); + DEBUG( "CWlmServer::CancelExternalRequest() - iRequestMap:" ); + + for ( TInt idx( 0 ); idx < iRequestMap.Count(); ++idx ) + { + DEBUG1( "CWlmServer::CancelExternalRequest() - iRequestId %u", + iRequestMap[idx].iRequestId ); + DEBUG1( "CWlmServer::CancelExternalRequest() - iSessionId %u", + iRequestMap[idx].iSessionId ); + DEBUG1( "CWlmServer::CancelExternalRequest() - iFunction: %d", + iRequestMap[idx].iFunction ); + } +#endif // _DEBUG + + for( TInt i( 0 ); i < iRequestMap.Count(); i++ ) + { + if( iRequestMap[i].iSessionId == aSessionId && + iRequestMap[i].iFunction == aCommand ) + { + DEBUG( "CWlmServer::CancelExternalRequest() - corresponding request found, cancelling" ); + + if( iRequestMap[i].iRequestId == iRequestTriggeringScanning && + iCoreHandlingScanRequest ) + { + // Core is already handling this scan request + // request Core to cancel the handling + DEBUG( "CWlmServer::CancelExternalRequest() - Core is already handling this request, send cancel request" ); + + iCoreServer->cancel_request( + iRequestMap[i].iRequestId ); + } + else if( iRequestMap[i].iRequestId == iRequestTriggeringScanning ) + { + // Core is not handling currently this scan request + // Complete the cancelled request and timer is set again + DEBUG( "CWlmServer::CancelExternalRequest() - Core is not handling currently this request" ); + DEBUG( "CWlmServer::CancelExternalRequest() - Cancel timer, complete cancelled request and set timer" ); + + iScanSchedulingTimer->Cancel(); + request_complete( iRequestMap[i].iRequestId, core_error_cancel ); + } + else + { + if( iRequestMap[i].iFunction == EGetScanResults || + iRequestMap[i].iFunction == EGetAvailableIaps ) + { + // Core is not handling currently this scan request + // Remove the cancelled request + DEBUG( "CWlmServer::CancelExternalRequest() - Core is not handling currently this scan request" ); + DEBUG( "CWlmServer::CancelExternalRequest() - this request is not the scan scheduling triggering request" ); + DEBUG( "CWlmServer::CancelExternalRequest() - remove the cancelled request" ); + + CompleteExternalRequest( i, core_error_cancel ); + if( IsSessionActive( iRequestMap[i] ) ) + { + iRequestMap[i].iMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( core_error_cancel ) ); + } + + iRequestMap.Remove( i ); + } + else + { + // Cancelled request is not a scan scheduling related request + // make normal cancel handling and request Core to cancel the handling + DEBUG( "CWlmServer::CancelExternalRequest() - Cancelled request is not a scan scheduling related request" ); + + iCoreServer->cancel_request( + iRequestMap[i].iRequestId ); + } + } + return; + } + } + + DEBUG( "CWlmServer::CancelExternalRequest() - no pending request found, ignoring" ); + } + +// --------------------------------------------------------- +// CWlmServer::CheckScanSchedulingParameters +// --------------------------------------------------------- +// +void CWlmServer::CheckScanSchedulingParameters( + TInt& aCacheLifetime, + TUint& aMaxDelay ) + { + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - aCacheLifetime: %d", aCacheLifetime ); + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - aMaxDelay: %u", aMaxDelay); + + if( aMaxDelay == KWlmInfiniteScanDelay ) + { + DEBUG( "CWlmServer::CheckScanSchedulingParameters() - infinite aMaxDelay" ); + } + else if( aMaxDelay > KWlmMaxScanDelay ) + { + aMaxDelay = KWlmMaxScanDelay; + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - new aMaxDelay: %u", aMaxDelay ); + } + else + { + DEBUG( "CWlmServer::CheckScanSchedulingParameters() - no changes to aMaxDelay" ); + } + + // cacheLifetime parameter has meaning only when maxDelay is zero + if( aMaxDelay != 0 ) + { + aCacheLifetime = 0; + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - aMaxDelay non-zero -> new aCacheLifetime: %d", aCacheLifetime ); + } + else + { + if( aCacheLifetime > KWlmMaxScanCacheLifetime ) + { + aCacheLifetime = KWlmMaxScanCacheLifetime; + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - new aCacheLifetime: %d", aCacheLifetime ); + } + else if( aCacheLifetime == KWlmDefaultScanCacheLifetime ) + { + aCacheLifetime = iConfiguredCacheLifetime; + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - new aCacheLifetime: %d", aCacheLifetime ); + } + else if( aCacheLifetime < KWlmMinScanCacheLifetime ) + { + aCacheLifetime = KWlmMinScanCacheLifetime; + DEBUG1( "CWlmServer::CheckScanSchedulingParameters() - new aCacheLifetime: %d", aCacheLifetime ); + } + else + { + DEBUG( "CWlmServer::CheckScanSchedulingParameters() - no changes to aCacheLifetime" ); + } + } + } + +// --------------------------------------------------------- +// CWlmServer::cancel_request +// --------------------------------------------------------- +// +void CWlmServer::cancel_request( + u32_t /* request_id */ ) + { + DEBUG( "CWlmServer::cancel_request" ); + } + +// --------------------------------------------------------- +// CWlmServer::load_eapol +// --------------------------------------------------------- +// +u32_t CWlmServer::load_eapol( + core_eapol_operating_mode_e mode, + abs_wlan_eapol_callback_c* const partner ) + { + DEBUG( "CWlmServer::load_eapol" ); + + if ( iEapolClient ) + { + DEBUG( "CWlmServer::load_eapol - CWlanEapolClient already instantiated." ); + return wlan_eapol_if_error_ok; + } + + TInt implementationUid( KCWlanEapolClientUid ); + if( mode == core_eapol_operating_mode_wapi ) + { + implementationUid = KCWlanWapiClientUid; + } + + TRAPD( ret, iEapolClient = CWlanEapolClient::NewL( + implementationUid, this ) ); // "this" is instance providing SendData() + if( ret != KErrNone ) + { + DEBUG1( "ERROR: CWlanEapolClient::NewL leaved with %d.", ret ); + return wlan_eapol_if_error_allocation_error; + } + iEapolHandler = partner; + return wlan_eapol_if_error_ok; + } + +// --------------------------------------------------------- +// CWlmServer::shutdown +// --------------------------------------------------------- +// +u32_t CWlmServer::shutdown() + { + DEBUG( "CWlmServer::shutdown" ); + ASSERT( iEapolClient ); + + iEapolClient->Shutdown(); + delete iEapolClient; + iEapolClient = NULL; + + return wlan_eapol_if_error_ok; + } + +// --------------------------------------------------------- +// CWlmServer::configure +// --------------------------------------------------------- +// +u32_t CWlmServer::configure( + const u32_t header_offset, + const u32_t MTU, + const u32_t trailer_length ) + { + DEBUG( "CWlmServer::configure" ); + ASSERT( iEapolClient ); + return iEapolClient->Configure( header_offset, MTU, trailer_length ); + } + + +// --------------------------------------------------------- +// CWlmServer::process_data +// --------------------------------------------------------- +// +u32_t CWlmServer::process_data( + const void * const data, + const u32_t length ) + { + DEBUG( "CWlmServer::process_data" ); + ASSERT( iEapolClient ); + return iEapolClient->ProcessData( data, length ); + } + + +// --------------------------------------------------------- +// CWlmServer::HandleCoreAsynchCb +// --------------------------------------------------------- +// +TInt CWlmServer::HandleCoreAsynchCb( TAny* aThisPtr ) + { + CWlmServer* self = static_cast( aThisPtr ); + + /** + * This could be a problem if the core immediately sets + * another pending callback request. + */ + + self->iCoreServer->request_complete( + self->iCoreAsynchCbId, + self->iCoreAsynchCbStatus ); + + self->iCoreAsynchCbId = 0; + self->iCoreAsynchCbStatus = core_error_ok; + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlmServer::BackgroundScanRequest +// --------------------------------------------------------- +// +TInt CWlmServer::BackgroundScanRequest( + TUint aScanStartInterval ) + { + DEBUG1( "CWlmServer::BackgroundScanRequest() - aScanStartInterval %u", aScanStartInterval ); + + // Create list for WLAN IAP data + core_type_list_c* iapDataList = new core_type_list_c; + if( iapDataList == NULL ) + { + // Do nothing and hope that on next expiry there is enough memory + DEBUG( "CWlmServer::BackgroundScanRequest() - Out of memory" ); + return KErrNoMemory; + } + + // Create list for secondary SSID data + core_type_list_c* iapSsidList = new core_type_list_c; + if ( !iapSsidList ) + { + DEBUG( "CWlmServer::BackgroundScanRequest() - unable to instance core_ssid_entry_s list" ); + + delete iapDataList; + + return KErrNoMemory; + } + + // Read IAP data from CommDb + RArray iapList; + TInt ret = iCache->GetIapDataList( iapList ); + if( ret ) + { + DEBUG1( "CWlmServer::BackgroundScanRequest() - GetIapDataList failed (%d)", ret ); + + delete iapDataList; + delete iapSsidList; + iapList.Close(); + + return ret; + } + + // Convert IAP data + ret = GetIapDataList( + *iapDataList, + *iapSsidList, + iapList ); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::BackgroundScanRequest() - unable to convert IAP data (%d)", ret ); + + delete iapDataList; + delete iapSsidList; + iapList.Close(); + + return ret; + } + + iapList.Close(); + + // Create output list + core_type_list_c* iapIdList = new core_type_list_c; + if( iapIdList == NULL ) + { + DEBUG( "ERROR: Out of memory" ); + delete iapDataList; + delete iapSsidList; + return KErrNoMemory; + } + + // Create ScanList + ScanList* scanList = new ScanList( KWlmScanListMaxSize ); + if( scanList == NULL ) + { + DEBUG( "CWlmServer::BackgroundScanRequest() - Out of memory when instantiating ScanList" ); + delete iapDataList; + delete iapSsidList; + delete iapIdList; + return KErrNoMemory; + } + + TTime* scanTime = new TTime( + CalculateScanStartTime( aScanStartInterval ).Int64() ); + if( !scanTime ) + { + DEBUG( "CWlmServer::BackgroundScanRequest() - unable to instantiate TTime" ); + + delete iapDataList; + delete iapSsidList; + delete iapIdList; + delete scanList; + return KErrNoMemory; + } + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iRequestId = KWlanIntCmdBackgroundScan; + mapEntry.iParam0 = iapDataList; + mapEntry.iParam1 = iapIdList; + mapEntry.iParam2 = scanList; + mapEntry.iParam3 = iapSsidList; + mapEntry.iTime = scanTime; + iRequestMap.Append( mapEntry ); + + if( IsOnlyTimedScanRequestInRequestMap( mapEntry ) || *scanTime < iScanSchedulingTimerExpiration ) + { + // Scan scheduling timer needs to be set again because this request needs the results earlier + UpdateScanSchedulingTimer( *scanTime, mapEntry.iRequestId ); + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlmServer::ScanSchedulingTimerExpired +// --------------------------------------------------------- +// +TInt CWlmServer::ScanSchedulingTimerExpired( TAny* aThisPtr ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired()" ); + + CWlmServer* self = static_cast( aThisPtr ); + + TInt index = self->FindRequestIndex( self->iRequestTriggeringScanning ); + + if( index >= self->iRequestMap.Count() && self->iBgScanProvider->IsBgScanEnabled() ) + { + /** + * This is most probably caused by the periodic background scan. It can happen if background + * scan is enabled but something fails when background scan request is tried to be added to + * scan scheduling queue. + * + * Add background scan request to scan scheduling queue and it should be handled immediately. + * Check that there are no background scans pending in the queue. + */ + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - request is not in iRequestMap, but background scan enabled" ); + + self->BackgroundScanRequest( 0 ); + } + else if( index >= self->iRequestMap.Count() ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - request is not in the iRequestMap, do nothing" ); + return KErrNone; + } + + DEBUG1( "CWlmServer::ScanSchedulingTimerExpired() - iRequestId %u", self->iRequestMap[index].iRequestId ); + + TUint indexNextScan( 0 ); + // If roaming is ongoing, scanning is not started for GetScanResults. + if ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && + self->iRequestMap[index].iFunction == EGetScanResults && + self->IsRoaming() ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetScanResults, roam in progress, returning empty scan results" ); + + ScanList* completedScanList = reinterpret_cast( self->iRequestMap[index].iParam0 ); + core_ssid_s* completedSsid = reinterpret_cast( self->iRequestMap[index].iParam1 ); + TTime* completedScanTime = reinterpret_cast( self->iRequestMap[index].iTime ); + + // Only the triggering request is completed and then scan scheduling timer is set again + TPckgBuf pckgCount( 0 ); + TPckgBuf pckgSize( 0 ); + + TPckgBuf pckgDynamicScanList; + pckgDynamicScanList().count = 0; + pckgDynamicScanList().size = 0; + + if( self->IsSessionActive( self->iRequestMap[index] ) ) + { + self->iRequestMap[index].iMessage.Write( 2, pckgDynamicScanList ); + self->iRequestMap[index].iMessage.Complete( KErrNone ); + } + + delete completedScanList; + completedScanList = NULL; + delete completedSsid; + completedSsid = NULL; + delete completedScanTime; + completedScanTime = NULL; + + self->iRequestMap.Remove( index ); + + if( self->FindNextTimedScanSchedulingRequest( indexNextScan ) ) + { + TTime* nextScanTime = reinterpret_cast( self->iRequestMap[indexNextScan].iTime ); + self->UpdateScanSchedulingTimer( *nextScanTime, self->iRequestMap[indexNextScan].iRequestId ); + } + + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - message completed with empty scan results" ); + return KErrNone; + } + + // If roaming is ongoing, scanning is not started for GetAvailableIaps. + if ( self->iRequestMap[index].iRequestId >= KWlanExtCmdBase && + self->iRequestMap[index].iFunction == EGetAvailableIaps && + self->IsRoaming() ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - GetAvailableIaps, roam in progress, returning empty iap list" ); + + core_type_list_c* iapDataList = reinterpret_cast*>( self->iRequestMap[index].iParam0 ); + core_type_list_c* iapIdList = reinterpret_cast*>( self->iRequestMap[index].iParam1 ); + ScanList* scanList = reinterpret_cast( self->iRequestMap[index].iParam2 ); + core_type_list_c* iapSsidList = reinterpret_cast*>( self->iRequestMap[index].iParam3 ); + TTime* scanTime = reinterpret_cast( self->iRequestMap[index].iTime ); + + // Only the triggering request is completed and then scan scheduling timer is set again + if( self->IsSessionActive( self->iRequestMap[index] ) ) + { + TWlmAvailableIaps tmp = { 0 }; + TPckg outPckg( tmp ); + self->iRequestMap[index].iMessage.Write( 0, outPckg ); + self->iRequestMap[index].iMessage.Complete( KErrNone ); + } + + delete iapDataList; + iapDataList = NULL; + delete iapIdList; + iapIdList = NULL; + delete scanList; + scanList = NULL; + delete iapSsidList; + iapSsidList = NULL; + delete scanTime; + scanTime = NULL; + + self->iRequestMap.Remove( index ); + + if( self->FindNextTimedScanSchedulingRequest( indexNextScan ) ) + { + TTime* nextScanTime = reinterpret_cast( self->iRequestMap[indexNextScan].iTime ); + self->UpdateScanSchedulingTimer( *nextScanTime, self->iRequestMap[indexNextScan].iRequestId ); + } + + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - message completed with empty iap list" ); + return KErrNone; + } + + // If triggering request is background scan and WLAN connection exist, background scan is skipped + if( self->iRequestMap[index].iRequestId == KWlanIntCmdBackgroundScan && + self->iConnectionState != EWlanStateNotConnected ) + { + DEBUG("CWlmServer::ScanSchedulingTimerExpired() - active connection exists: skipping background scan"); + + // notify bg scan provider so it will issue a new CWlmServer::Scan() call, + // where the existing request map entry will be updated + self->iBgScanProvider->ScanComplete(); + + return KErrNone; + } + + // Scan mode is either passive or active + core_scan_mode_e mode = core_scan_mode_active; + TBool isActiveScanAllowed( ETrue ); + if( self->iPlatform->GetScanType() == EWLMScanForcedPassive ) + { + mode = core_scan_mode_passive; + isActiveScanAllowed = EFalse; + } + + if( self->iRequestMap[index].iRequestId == KWlanIntCmdBackgroundScan ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting background scan, cancel timer" ); + // pass request to core + core_type_list_c* iapDataList = reinterpret_cast*>( self->iRequestMap[index].iParam0 ); + core_type_list_c* iapSsidList = reinterpret_cast*>( self->iRequestMap[index].iParam3 ); + core_type_list_c* iapIdList = reinterpret_cast*>( self->iRequestMap[index].iParam1 ); + ScanList* scanList = reinterpret_cast( self->iRequestMap[index].iParam2 ); + + self->iCoreServer->get_available_iaps( + self->iRequestMap[index].iRequestId, + isActiveScanAllowed, + *iapDataList, + *iapIdList, + iapSsidList, + *scanList ); + + self->iScanSchedulingTimer->Cancel(); + } + else if( self->iRequestMap[index].iFunction == EGetScanResults ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting GetScanResults, cancel timer" ); + + // pass request to core + ScanList* tmp = reinterpret_cast( self->iRequestMap[index].iParam0); + core_ssid_s* ssid2 = reinterpret_cast( self->iRequestMap[index].iParam1 ); + + self->iCoreServer->get_scan_result( + self->iRequestMap[index].iRequestId, + mode, + *ssid2, + SCAN_CHANNELS_2DOT4GHZ_ETSI, + 0, + *tmp, + false_t ); + + self->iScanSchedulingTimer->Cancel(); + } + else if( self->iRequestMap[index].iFunction == EGetAvailableIaps ) + { + DEBUG( "CWlmServer::ScanSchedulingTimerExpired() - starting GetAvailableIaps, cancel timer" ); + + // pass request to core + core_type_list_c* iapDataList = reinterpret_cast*>( self->iRequestMap[index].iParam0 ); + core_type_list_c* iapSsidList = reinterpret_cast*>( self->iRequestMap[index].iParam3 ); + core_type_list_c* iapIdList = reinterpret_cast*>( self->iRequestMap[index].iParam1 ); + ScanList* scanList = reinterpret_cast( self->iRequestMap[index].iParam2 ); + + self->iCoreServer->get_available_iaps( + self->iRequestMap[index].iRequestId, + isActiveScanAllowed, + *iapDataList, + *iapIdList, + iapSsidList, + *scanList ); + + self->iScanSchedulingTimer->Cancel(); + } + self->iCoreHandlingScanRequest = ETrue; + return KErrNone; + } + +// --------------------------------------------------------- +// CWlmServer::GetIapDataList() +// --------------------------------------------------------- +// +TInt CWlmServer::GetIapDataList( + core_type_list_c& aCoreIapDataList, + core_type_list_c& aCoreIapSsidList, + const RArray& aAmIapDataList ) + { + DEBUG( "CWlmServer::GetIapDataList()" ); + DEBUG1( "CWlmServer::GetIapDataList() - converting %u entries", + aAmIapDataList.Count() ); + + /** + * Create a commsdat session for retrieving possible secondary SSIDs. + */ + CWLanSettings wlanSettings; + TInt ret = wlanSettings.Connect(); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::GetIapDataList() - CWLanSettings::Connect() failed (%d)", + ret ); + + return ret; + } + + // Loop given list of IAPs and create respective list of iap data + for( TInt idx( 0 ); idx < aAmIapDataList.Count(); idx++ ) + { + if( aAmIapDataList[idx].ssid.Length() ) // filter out EasyWlan IAP + { + DEBUG1( "CWlmServer::GetIapDataList() - converting IAP %u", + aAmIapDataList[idx].iapId ); + + core_iap_data_s* coreData = new core_iap_data_s; + if( !coreData ) + { + DEBUG( "CWlmServer::GetIapDataList() - unable to instantiate core_iap_data_s" ); + wlanSettings.Disconnect(); + + return KErrNoMemory; + } + + TWlanConversionUtil::ConvertIapSettings( + *coreData, + aAmIapDataList[idx] ); + + ret = aCoreIapDataList.append( coreData ); + if( ret ) + { + DEBUG1( "CWlmServer::GetIapDataList() - unable to append core_iap_data_s entry (%u)", + ret ); + wlanSettings.Disconnect(); + delete coreData; + + return ret; + } + + // Read possible secondary ssids + RArray secondarySsidList; + wlanSettings.GetSecondarySsidsForService( + aAmIapDataList[idx].serviceId, + secondarySsidList ); + + // Create secondary SSID list if needed + if( aAmIapDataList[idx].usedSsid.Length() || secondarySsidList.Count() ) + { + DEBUG1( "CWlmServer::GetIapDataList() - IAP %u has secondary SSIDs defined", + coreData->id ); + + core_ssid_entry_s* entry = new core_ssid_entry_s; + if ( !entry ) + { + DEBUG( "CWlmServer::GetIapDataList() - unable to instantiate core_ssid_entry_s" ); + + secondarySsidList.Close(); + wlanSettings.Disconnect(); + + return KErrNoMemory; + } + + entry->id = coreData->id; + entry->ssid = coreData->ssid; + if( aAmIapDataList[idx].usedSsid.Length() ) + { + TWlanConversionUtil::ConvertSSID( entry->used_ssid, aAmIapDataList[idx].usedSsid ); + } + else + { + entry->used_ssid = entry->ssid; + } + aCoreIapSsidList.append( entry ); + + for( TInt idx( 0 ); idx < secondarySsidList.Count(); ++idx ) + { + entry = new core_ssid_entry_s; + if ( !entry ) + { + DEBUG( "CWlmServer::GetIapDataList() - unable to instantiate core_ssid_entry_s" ); + + secondarySsidList.Close(); + wlanSettings.Disconnect(); + + return KErrNoMemory; + } + + entry->id = coreData->id; + TWlanConversionUtil::ConvertSSID( + entry->ssid, secondarySsidList[idx].ssid ); + if ( secondarySsidList[idx].usedSsid.Length() ) + { + TWlanConversionUtil::ConvertSSID( + entry->used_ssid, secondarySsidList[idx].usedSsid ); + } + else + { + entry->used_ssid = coreData->ssid; + } + aCoreIapSsidList.append( entry ); + } + } + + secondarySsidList.Close(); + } + } // for loop + + wlanSettings.Disconnect(); + + return KErrNone; + } + +// --------------------------------------------------------- +// CWlmServer::GetLanSettings() +// --------------------------------------------------------- +// +TInt CWlmServer::GetLanSettings( + TUint32 aLanServiceId, + SLanSettings& aLanSettings ) + { + DEBUG("CWlmServer::GetLanSettings()"); + + TInt ret = KErrNone; + CLanSettings* lanSettings = new CLanSettings; + if( lanSettings == NULL ) + { + DEBUG( "ERROR creating CLanSettings" ); + return KErrNoMemory; + } + + ret = lanSettings->Connect(); + if( ret != KErrNone ) + { + DEBUG1( "ERROR - Connect() failed with %d", ret ); + lanSettings->Disconnect(); + delete lanSettings; + return ret; + } + + ret = lanSettings->GetLanSettings( aLanServiceId, aLanSettings ); + if( ret != KErrNone ) + { + DEBUG1( "ERROR - GetLanSettings() failed with %d", ret ); + } + lanSettings->Disconnect(); + delete lanSettings; + return ret; + } + +// --------------------------------------------------------- +// CWlmServer::BtConnectionEstablished +// --------------------------------------------------------- +// +void CWlmServer::BtConnectionEstablished() + { + iDriverIf->Notify( core_am_indication_bt_connection_established ); + } + +// --------------------------------------------------------- +// CWlmServer::BtConnectionDisabled +// --------------------------------------------------------- +// +void CWlmServer::BtConnectionDisabled() + { + iDriverIf->Notify( core_am_indication_bt_connection_disconnected ); + } + +// --------------------------------------------------------- +// CWlmServer::SystemTimeChanged +// --------------------------------------------------------- +// +void CWlmServer::SystemTimeChanged() + { + DEBUG("CWlmServer::SystemTimeChanged()"); + + if ( iIsStartupComplete ) + { + // If the changed time is less than cached region timestamp, + // then cache is cleared. + TTime newTime; + newTime.UniversalTime(); + + if ( newTime.Int64() < iTimeofDomainQuery.Int64() ) + { + // Region cache expires when user has changed the time + TTime timestampClear(1); + iTimeofDomainQuery = timestampClear; + + TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, KWlmRegionUnknown )); + if ( ret == KErrNone ) + { + TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, iTimeofDomainQuery.Int64() )); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::SystemTimeChanged() - attempt to store region timestamp leaved with code %d,", ret ); + } + } + else + { + DEBUG1( "CWlmServer::SystemTimeChanged() - attempt to store region leaved with code %d,", ret ); + } + } + + DEBUG("CWlmServer::SystemTimeChanged() - inform timer services about system time change"); + iTimerServices->HandleTimeout(); + DEBUG("CWlmServer::SystemTimeChanged() - refreshing settings to BgScan provider"); + iBgScanProvider->NotifyChangedSettings( iBgScanProviderSettings ); + + // Pending scan requests should be handled because after the system time change all the + // timestamps are invalid. Change the scan start times to start immediately + + DEBUG("CWlmServer::SystemTimeChanged() - set all pending requests to expire immediately"); + + TInt i( 0 ); + for( i = 0; i < iRequestMap.Count(); i++ ) + { + if( IsPendingTimedScanRequest(i) ) + { + DEBUG1( "CWlmServer::SystemTimeChanged() - setting iTime to current time for request %i", + iRequestMap[i].iRequestId ); + + TTime* requestedScanTime = reinterpret_cast( iRequestMap[i].iTime ); + requestedScanTime->UniversalTime(); + } + } + if( !iCoreHandlingScanRequest ) + { + // Core is not handling any scan request so update the timer + DEBUG("CWlmServer::SystemTimeChanged() - Core is not currently handling any scan requests"); + DEBUG("CWlmServer::SystemTimeChanged() - Cancel timer and set it again to new value"); + + iScanSchedulingTimer->Cancel(); + TUint indexNextScan; + if( FindNextTimedScanSchedulingRequest( indexNextScan ) ) + { + TTime* nextScanTime = reinterpret_cast( iRequestMap[indexNextScan].iTime ); + UpdateScanSchedulingTimer( *nextScanTime, iRequestMap[indexNextScan].iRequestId ); + } + } + } + } + +// --------------------------------------------------------- +// CWlmServer::ClearRegionCache +// --------------------------------------------------------- +// +void CWlmServer::ClearRegionCache() + { + DEBUG("CWlmServer::ClearRegionCache()"); + + // Region cache expires when user has changed the time + TTime timestampClear(1); + iTimeofDomainQuery = timestampClear; + + TRAPD( ret, StoreWlanCenRepKeyValueL( KWlanRegion, KWlmRegionUnknown )); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::ClearRegionCache() - StoreWlanCenRepKeyValueL() leaved with code %d,", ret ); + } + TRAP( ret, StoreWlanCenRepKeyValueL( KWlanRegionTimestamp, iTimeofDomainQuery.Int64() )); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::ClearRegionCache() - StoreWlanCenRepKeyValueL() leaved with code %d,", ret ); + } + } + +// --------------------------------------------------------- +// CWlmServer::SendData +// --------------------------------------------------------- +// +TInt CWlmServer::SendData( + const void * const aData, + const TInt aLength ) + { + DEBUG2( "CWlmServer::SendData(data=0x%08X, length=%i)", aData, aLength ); + ASSERT( iEapolHandler ); + return iEapolHandler->send_data( aData, aLength ); + } + +// --------------------------------------------------------- +// CWlmServer::Scan +// --------------------------------------------------------- +// +void CWlmServer::Scan( + const TUint& aMaxDelay ) + { + DEBUG1( "CWlmServer::Scan() - aMaxDelay %u", aMaxDelay ); + + // - by design, this method is called only if background scan is enabled + ASSERT( iBgScanProvider->IsBgScanEnabled() ); + // - by design, this method is only called if iIsStartupComplete is true + ASSERT( iIsStartupComplete ); + // - by design, a background scan request can already be in the queue + // -> instead of creating a new request to the request map, modify the existing one + // - by design, background scan request might be issued even if we're connected + // - update scan scheduling timer if needed + + TInt index = FindRequestIndex( KWlanIntCmdBackgroundScan ); + + if( index >= iRequestMap.Count() ) + { + // there are no pending background scan requests + DEBUG( "CWlmServer::Scan() - there are NO pending background scan requests" ); + + BackgroundScanRequest( aMaxDelay ); + } + else + { + DEBUG1( "CWlmServer::Scan() - there is a pending background scan request, index (%d)", index); + + ASSERT( iRequestMap[index].iTime ); + + DEBUG( "CWlmServer::Scan() - cancel scan scheduling timer (might already be cancelled but it doesn't matter)" ); + iScanSchedulingTimer->Cancel(); + + if( !iCoreHandlingScanRequest ) + { + DEBUG( "CWlmServer::Scan() - core is not handling background scan request" ); + + DEBUG( "CWlmServer::Scan() - set new scan start time for existing background scan request" ); + *iRequestMap[index].iTime = CalculateScanStartTime( aMaxDelay ); + + DEBUG( "CWlmServer::Scan() - find the scan scheduling request which expires next" ); + TUint indexNextScan; + if( FindNextTimedScanSchedulingRequest( indexNextScan ) ) + { + UpdateScanSchedulingTimer( *iRequestMap[indexNextScan].iTime, + iRequestMap[indexNextScan].iRequestId ); + } +#ifdef _DEBUG + else + { + DEBUG( "CWlmServer::Scan() - no scan scheduling request found!!" ); + ASSERT( 0 ); + } +#endif + } + else + { + DEBUG( "CWlmServer::Scan() - core is currently handling some scan request" ); + + if( iRequestTriggeringScanning == iRequestMap[index].iRequestId ) + { + DEBUG( "CWlmServer::Scan() - core is handling background scanning currently" ); + DEBUG( "CWlmServer::Scan() - no need to update the existing background scan request" ); + } + else + { + DEBUG( "CWlmServer::Scan() - core is NOT handling background scanning currently" ); + DEBUG( "CWlmServer::Scan() - just update the time to the background scan request" ); + *iRequestMap[index].iTime = CalculateScanStartTime( aMaxDelay ); + } + } + } + + DEBUG( "CWlmServer::Scan() - returning" ); + } + +// --------------------------------------------------------- +// CWlmServer::CancelScan +// --------------------------------------------------------- +// +void CWlmServer::CancelScan() + { + DEBUG( "CWlmServer::CancelScan()" ); + + if( iConnectionState == EWlanStateNotConnected ) + { + SetIconState( EWlmIconStatusNotAvailable ); + } + + // look for the background scan request + TUint index = FindRequestIndex( KWlanIntCmdBackgroundScan ); + + if( index < iRequestMap.Count() ) + { + // pending background scan request found + if( !iCoreHandlingScanRequest ) + { + DEBUG( "CWlmServer::CancelScan() - core is not yet handling the next scan request" ); + + DEBUG( "CWlmServer::CancelScan() - cancel timer" ); + iScanSchedulingTimer->Cancel(); + + DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); + iRequestMap.Remove( index ); + + DEBUG( "CWlmServer::CancelScan() - find next possible timed scan scheduling request" ); + TUint indexNextScan; + if( FindNextTimedScanSchedulingRequest( indexNextScan ) ) + { + UpdateScanSchedulingTimer( *iRequestMap[indexNextScan].iTime, iRequestMap[indexNextScan].iRequestId ); + } +#ifdef _DEBUG + else + { + DEBUG( "CWlmServer::CancelScan() - no next timed scan scheduling request found" ); + } +#endif + } + else + { + // Core is currently handling scanning + DEBUG( "CWlmServer::CancelScan() - core is currently handling scanning" ); + + if( iRequestTriggeringScanning == iRequestMap[index].iRequestId ) + { + DEBUG( "CWlmServer::CancelScan() - core is handling background scanning currently" ); + DEBUG( "CWlmServer::CancelScan() - no need to remove background scan request" ); + } + else + { + DEBUG( "CWlmServer::CancelScan() - core is NOT handling background scanning currently" ); + DEBUG( "CWlmServer::CancelScan() - just remove the entry from the request map" ); + + DEBUG( "CWlmServer::CancelScan() - remove entry from request map" ); + iRequestMap.Remove( index ); + } + } + } + DEBUG( "CWlmServer::CancelScan() - returning" ); + } + +// --------------------------------------------------------- +// CWlmServer::GetPacketStatistics +// --------------------------------------------------------- +// +void CWlmServer::GetPacketStatistics( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetPacketStatistics()" ); + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EGetPacketStatistics; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + core_packet_statistics_s* tmp = new core_packet_statistics_s; + if( tmp == NULL ) + { + aMessage.Complete( KErrNoMemory ); + return; + } + mapEntry.iParam0 = tmp; + iRequestMap.Append( mapEntry ); + + // pass request to core + iCoreServer->get_packet_statistics( + mapEntry.iRequestId, + *tmp ); + } + +// --------------------------------------------------------- +// CWlmServer::ClearPacketStatistics +// --------------------------------------------------------- +// +void CWlmServer::ClearPacketStatistics( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::ClearPacketStatistics()" ); + + core_error_e ret = iCoreServer->clear_packet_statistics(); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::ClearPacketStatistics() - clear_packet_statistics() failed with %u", + ret ); + } + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetUapsdSettings +// --------------------------------------------------------- +// +void CWlmServer::GetUapsdSettings( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetUapsdSettings()" ); + + core_uapsd_settings_s coreSettings; + core_error_e ret = iCoreServer->get_uapsd_settings( coreSettings ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetUapsdSettings() - get_uapsd_settings() failed with %u", + ret ); + } + + TWlanUapsdSettings settings; + TWlanConversionUtil::ConvertUapsdSettings( + settings, + coreSettings ); + TPckg outPckg( settings ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::SetUapsdSettings +// --------------------------------------------------------- +// +void CWlmServer::SetUapsdSettings( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::SetUapsdSettings()" ); + + TWlanUapsdSettings settings = + { EWlanMaxServicePeriodLengthAll, ETrue, ETrue, ETrue, ETrue }; + TPckg inPckg( settings ); + TInt err( aMessage.Read( 0, inPckg ) ); + if( err != KErrNone ) + { + aMessage.Complete( err ); + return; + } + + core_uapsd_settings_s coreSettings; + TWlanConversionUtil::ConvertUapsdSettings( + coreSettings, + settings ); + + core_error_e ret = iCoreServer->set_uapsd_settings( coreSettings ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::SetUapsdSettings() - set_uapsd_settings() failed with %u", + ret ); + } + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetPowerSaveSettings +// --------------------------------------------------------- +// +void CWlmServer::GetPowerSaveSettings( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetPowerSaveSettings()" ); + + core_power_save_settings_s coreSettings; + core_error_e ret = iCoreServer->get_power_save_settings( coreSettings ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetPowerSaveSettings() - get_power_save_settings() failed with %u", + ret ); + } + + TWlanPowerSaveSettings settings; + TWlanConversionUtil::ConvertPowerSaveSettings( + settings, + coreSettings ); + TPckg outPckg( settings ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::SetPowerSaveSettings +// --------------------------------------------------------- +// +void CWlmServer::SetPowerSaveSettings( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::SetPowerSaveSettings()" ); + + TWlanPowerSaveSettings settings = + { ETrue, EFalse, EFalse, EFalse, EFalse, EFalse, EFalse, EFalse }; + TPckg inPckg( settings ); + TInt err( aMessage.Read( 0, inPckg ) ); + if( err != KErrNone ) + { + aMessage.Complete( err ); + return; + } + + core_power_save_settings_s coreSettings; + TWlanConversionUtil::ConvertPowerSaveSettings( + coreSettings, + settings ); + + core_error_e ret = iCoreServer->set_power_save_settings( coreSettings ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::SetPowerSaveSettings() - set_power_save_settings() failed with %u", + ret ); + } + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::RunProtectedSetup +// --------------------------------------------------------- +// +void CWlmServer::RunProtectedSetup( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::RunProtectedSetup()" ); + + // Get WlanSettings and secondarySSID list + // (lanServiceId specifies the table row in wlansettings) + SWLANSettings iapData; + RArray secondarySsidList; + TInt lanServiceId = aMessage.Int0(); + TRAPD( err, GetIapSettingsL( lanServiceId, iapData, secondarySsidList ) ) ; + if( err != KErrNone ) + { + DEBUG1( "CWlmServer::RunProtectedSetup() - GetIapSettingsL leaved with %d", + err ); + secondarySsidList.Close(); + aMessage.Complete( err ); + return; + } + secondarySsidList.Close(); + + // Type conversion + core_iap_data_s* coreIapData = new core_iap_data_s; + if( !coreIapData ) + { + aMessage.Complete( KErrNoMemory ); + return; + } + + TWLMOverrideSettings override = { 0 }; + TWlanConversionUtil::ConvertIapSettings( + *coreIapData, + iapData, + ETrue, // dhcp usage is not important here + override ); + + + // Create a list for the results. + core_type_list_c* iapDataList = new core_type_list_c; + if( iapDataList == NULL ) + { + DEBUG( "CWlmServer::RunProtectedSetup() - unable to create iapDataList" ); + delete coreIapData; + + aMessage.Complete( KErrNoMemory ); + return; + } + + // Protected Setup status + core_protected_setup_status_e* protectedSetupStatus = new core_protected_setup_status_e; + if( !protectedSetupStatus ) + { + delete coreIapData; + delete iapDataList; + + aMessage.Complete( KErrNoMemory ); + return; + } + *protectedSetupStatus = core_protected_setup_status_undefined; + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = ERunProtectedSetup; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + mapEntry.iParam0 = coreIapData; + mapEntry.iParam1 = iapDataList; + mapEntry.iParam2 = protectedSetupStatus; + iRequestMap.Append( mapEntry ); + + // pass request to core + iCoreServer->run_protected_setup( + mapEntry.iRequestId, *coreIapData, *iapDataList, *protectedSetupStatus ); + } + +// --------------------------------------------------------- +// CWlmServer::CancelProtectedSetup +// --------------------------------------------------------- +// +void CWlmServer::CancelProtectedSetup( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::CancelProtectedSetup()" ); + + CancelExternalRequest( + aSessionId, + ERunProtectedSetup ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::CreateTrafficStream +// --------------------------------------------------------- +// +void CWlmServer::CreateTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::CreateTrafficStream()" ); + + TPckgBuf paramsPckg( 0 ); + TInt ret( aMessage.Read( 0, paramsPckg ) ); + if( ret != KErrNone ) + { + aMessage.Complete( ret ); + return; + } + if( paramsPckg().iUserPriority > MAX_USER_PRIORITY ) + { + aMessage.Complete( KErrArgument ); + return; + } + + TBool isAutomatic = aMessage.Int1(); + + u32_t* coreStreamId = new u32_t; + core_traffic_stream_status_e* coreStreamStatus = new core_traffic_stream_status_e; + if( !coreStreamId || + !coreStreamStatus ) + { + delete coreStreamId; + delete coreStreamStatus; + + aMessage.Complete( KErrNoMemory ); + return; + } + + u8_t coreTid( TRAFFIC_STREAM_TID_NONE ); + u8_t coreUserPriority( 0 ); + core_traffic_stream_params_s coreParams = { 0 }; + TWlanConversionUtil::ConvertTrafficStreamParameters( + coreTid, + coreUserPriority, + coreParams, + paramsPckg() ); + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = ECreateTrafficStream; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + mapEntry.iParam0 = coreStreamId; + mapEntry.iParam1 = coreStreamStatus; + iRequestMap.Append( mapEntry ); + + // pass request to core + iCoreServer->create_traffic_stream( + mapEntry.iRequestId, + coreTid, + coreUserPriority, + isAutomatic, + coreParams, + *coreStreamId, + *coreStreamStatus ); + } + +// --------------------------------------------------------- +// CWlmServer::CancelCreateTrafficStream +// --------------------------------------------------------- +// +void CWlmServer::CancelCreateTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ) + { + CancelExternalRequest( + aSessionId, + ECreateTrafficStream ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::DeleteTrafficStream +// --------------------------------------------------------- +// +void CWlmServer::DeleteTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::DeleteTrafficStream()" ); + + u32_t streamId = aMessage.Int0(); + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EDeleteTrafficStream; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + iRequestMap.Append( mapEntry ); + + // pass request to core + iCoreServer->delete_traffic_stream( + mapEntry.iRequestId, + streamId ); + } + +// --------------------------------------------------------- +// CWlmServer::CancelDeleteTrafficStream +// --------------------------------------------------------- +// +void CWlmServer::CancelDeleteTrafficStream( + TUint aSessionId, + const RMessage2& aMessage ) + { + CancelExternalRequest( + aSessionId, + EDeleteTrafficStream ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::GetAccessPointInfo +// --------------------------------------------------------- +// +void CWlmServer::GetAccessPointInfo( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetAccessPointInfo()" ); + + core_ap_information_s coreInfo; + core_error_e ret = iCoreServer->get_current_ap_info( coreInfo ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetAccessPointInfo() - get_current_ap_info() failed with %u", + ret ); + } + + TWlanAccessPointInfo info; + TWlanConversionUtil::ConvertApInformation( + info, + coreInfo ); + TPckg outPckg( info ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetRoamMetrics +// --------------------------------------------------------- +// +void CWlmServer::GetRoamMetrics( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetRoamMetrics()" ); + + core_roam_metrics_s coreRoamMetrics; + iCoreServer->get_roam_metrics( coreRoamMetrics ); + + TWlanRoamMetrics roamMetrics; + TWlanConversionUtil::ConvertRoamMetrics( + roamMetrics, + coreRoamMetrics ); + + TPckg outPckg( roamMetrics ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( core_error_ok ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetRogueList +// --------------------------------------------------------- +// +void CWlmServer::GetRogueList( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetRogueList()" ); + + core_type_list_c coreRogueList; + core_error_e ret = iCoreServer->get_rogue_list( coreRogueList ); + if ( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetRogueList() - get_rogue_list() failed with %u", + ret ); + } + + TWlmRogueList rogueList; + TWlanConversionUtil::ConvertRogueList( + rogueList, + coreRogueList ); + + TPckg outPckg( rogueList ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetRegulatoryDomain +// --------------------------------------------------------- +// +void CWlmServer::GetRegulatoryDomain( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetRegulatoryDomain()" ); + + TPckg outPckg( iRegion ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( core_error_ok ) ); + } + +// --------------------------------------------------------- +// CWlmServer::GetPowerSaveMode +// --------------------------------------------------------- +// +void CWlmServer::GetPowerSaveMode( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetPowerSaveMode()" ); + + TWlanPowerSave powerSaveMode( iPowerSaveMode ); + if ( !iPowerSaveEnabled ) + { + powerSaveMode = EWlanPowerSaveNone; + } + + TPckg outPckg( powerSaveMode ); + aMessage.Write( 0, outPckg ); + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( core_error_ok ) ); + } + +// --------------------------------------------------------- +// CWlmServer::AddIapSsidListL +// --------------------------------------------------------- +// +void CWlmServer::AddIapSsidListL( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::AddIapSsidListL()" ); + + TUint iapId( + aMessage.Int0() ); + TUint ssidCount( + aMessage.Int1() ); + TInt ssidListSize( 0 ); + if( aMessage.Ptr2() ) + { + ssidListSize = aMessage.GetDesLengthL( 2 ); + } + + DEBUG3( "CWlmServer::AddIapSsidListL() - IAP ID: %u, SSID list count: %u, SSID list size: %u", + iapId, ssidCount, ssidListSize ); + + if( ssidCount && + ssidListSize ) + { + /** + * Make sure the IAP ID actually exists. + */ + RArray iapList; + iCache->GetIapDataList( iapList ); + TBool isMatch( EFalse ); + for( TInt idx( 0 ); idx < iapList.Count() && !isMatch; ++idx ) + { + if( iapList[idx].iapId == iapId ) + { + isMatch = ETrue; + } + } + iapList.Close(); + if( !isMatch ) + { + DEBUG1( "CWlmServer::AddIapSsidListL() - IAP ID %u not found", iapId ); + + User::Leave( KErrNotFound ); + } + + /** + * Read the SSID list from the client side to a temporary buffer. + */ + HBufC8* buffer = HBufC8::NewL( ssidListSize ); + CleanupStack::PushL( buffer ); + + TPtr8 bufferPtr( + buffer->Des() ); + aMessage.ReadL( 2, bufferPtr ); + + /** + * Copy the contents of the buffer to an CArrayFixFlat instance + * so that they can be iterated. + */ + CArrayFixFlat* ssidBuffer = + new CArrayFixFlat( ssidCount ); + if( !ssidBuffer ) + { + DEBUG( "CWlmServer::AddIapSsidListL() - unable to instantiate CArrayFixFlat" ); + + User::Leave( KErrNoMemory ); + } + CleanupStack::PushL( ssidBuffer ); + ssidBuffer->AppendL( + reinterpret_cast( buffer->Ptr() ), ssidCount ); + + CleanupStack::Pop( ssidBuffer ); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PushL( ssidBuffer ); + + /** + * Initialize an SSID list and store SSIDs into it. + */ + CWlanSsidList* ssidList = CWlanSsidList::NewL( ssidCount ); + CleanupStack::PushL( ssidList ); + + for( TInt idx( 0 ); idx < ssidBuffer->Count(); ++idx ) + { + if( ssidBuffer->At( idx ).Length() <= KWlanMaxSsidLength ) + { + TInt ret = ssidList->AddSsid( ssidBuffer->At( idx ) ); + if( ret != KErrNone ) + { + DEBUG1( "CWlmServer::AddIapSsidListL() - AddSsid failed with %d", + ret ); + } + + User::LeaveIfError( ret ); + } + } + + DEBUG2( "CWlmServer::AddIapSsidListL() - attaching a list of %u SSID(s) to IAP ID %u", + ssidList->Count(), iapId ); + + iSsidListDb->WriteListL( + iapId, + *ssidList ); + + CleanupStack::PopAndDestroy( ssidList ); + CleanupStack::PopAndDestroy( ssidBuffer ); + + DEBUG( "CWlmServer::AddIapSsidListL() - SSID list succesfully attached" ); + } + else + { + iSsidListDb->DeleteListL( + iapId ); + + DEBUG( "CWlmServer::AddIapSsidListL() - SSID list succesfully deleted" ); + } + + /** + * Invalidate cached IAP availability results since they might + * not be valid anymore. + */ + iCache->InvalidateAvailabilityCache(); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::RemoveIapSsidListL +// --------------------------------------------------------- +// +void CWlmServer::RemoveIapSsidListL( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::RemoveIapSsidListL()" ); + + TUint iapId = aMessage.Int0(); + + DEBUG1( "CWlmServer::RemoveIapSsidListL() - removing SSID list from IAP ID %u", + iapId ); + + iSsidListDb->DeleteListL( + iapId ); + + DEBUG( "CWlmServer::RemoveIapSsidListL() - SSID list succesfully removed" ); + + /** + * Invalidate cached IAP availability results since they might + * not be valid anymore. + */ + iCache->InvalidateAvailabilityCache(); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::SetPowerSaveMode +// --------------------------------------------------------- +// +void CWlmServer::SetPowerSaveMode( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::SetPowerSaveMode()" ); + + TWlanPowerSaveMode mode = static_cast( + aMessage.Int0() ); + + DEBUG1( "CWlmServer::SetPowerSaveMode() - mode %u", + mode ); + + core_power_save_mode_s coreMode; + TWlanConversionUtil::ConvertPowerSaveMode( + coreMode, + mode ); + + iCoreServer->set_power_save_mode( coreMode ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::GetAcTrafficStatus +// --------------------------------------------------------- +// +void CWlmServer::GetAcTrafficStatus( + TUint /* aSessionId */, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::GetAcTrafficStatus()" ); + + core_ac_traffic_information_s coreInfo; + core_error_e ret = iCoreServer->get_current_ac_traffic_info( coreInfo ); + if( ret != core_error_ok ) + { + DEBUG1( "CWlmServer::GetAcTrafficStatus() - get_current_ac_traffic_info() failed with %u", + ret ); + + aMessage.Complete( + TWlanConversionUtil::ConvertErrorCode( ret ) ); + } + + TWlmAcTrafficStatusArray info; + TPckg outPckg( info ); + info[EWlmAccessClassBestEffort] = TWlanConversionUtil::ConvertTrafficStatus( + coreInfo.status_for_best_effort ); + info[EWlmAccessClassBackground] = TWlanConversionUtil::ConvertTrafficStatus( + coreInfo.status_for_background ); + info[EWlmAccessClassVideo] = TWlanConversionUtil::ConvertTrafficStatus( + coreInfo.status_for_video ); + info[EWlmAccessClassVoice] = TWlanConversionUtil::ConvertTrafficStatus( + coreInfo.status_for_voice ); + + aMessage.Write( 0, outPckg ); + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::DirectedRoam +// --------------------------------------------------------- +// +void CWlmServer::DirectedRoam( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::DirectedRoam()" ); + + TPckgBuf bssidPckg; + TInt ret( aMessage.Read( 0, bssidPckg ) ); + if( ret != KErrNone ) + { + aMessage.Complete( ret ); + return; + } + + core_mac_address_s coreBssid( ZERO_MAC_ADDR ); + TWlanConversionUtil::ConvertMacAddress( + coreBssid, + bssidPckg() ); + + // create mapping + SRequestMapEntry mapEntry; + mapEntry.iMessage = aMessage; + mapEntry.iFunction = EDirectedRoam; + mapEntry.iRequestId = iRequestIdCounter++; + mapEntry.iSessionId = aSessionId; + iRequestMap.Append( mapEntry ); + + // pass request to core + iCoreServer->directed_roam( + mapEntry.iRequestId, + coreBssid ); + } + +// --------------------------------------------------------- +// CWlmServer::CancelDirectedRoam +// --------------------------------------------------------- +// +void CWlmServer::CancelDirectedRoam( + TUint aSessionId, + const RMessage2& aMessage ) + { + DEBUG( "CWlmServer::CancelDirectedRoam()" ); + + CancelExternalRequest( + aSessionId, + EDirectedRoam ); + + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmServer::StartupComplete +// --------------------------------------------------------- +// +void CWlmServer::StartupComplete() + { + iIsStartupComplete = ETrue; + + SetIconState( EWlmIconStatusNotAvailable ); + + iCoreServer->enable_wlan( KWlanIntCmdEnableWlan ); + + /** + * Read the CommsDat data again so that we can be sure + * that it is up to date after reboot. It can happen that + * when WLAN engine boots up commsdat is not up to date yet. + */ + UpdateWlanSettings(); + + iPlatform->InitializeSystemTimeHandler(); + } + + +// --------------------------------------------------------- +// CWlmServer::EmergencyCallComplete +// --------------------------------------------------------- +// +void CWlmServer::EmergencyCallComplete( TBool aStartupCompleted ) + { + if ( !aStartupCompleted ) + { + iCoreServer->disable_wlan( KWlanIntCmdDisableWlan ); + } + else + { + if ( iIsStartupComplete == EFalse ) + { + iIsStartupComplete = ETrue; + + UpdateWlanSettings(); + + iPlatform->InitializeSystemTimeHandler(); + } + } + } + +// --------------------------------------------------------- +// CWlmServer::HandleSsidListAvailabilityL +// --------------------------------------------------------- +// +void CWlmServer::HandleSsidListAvailabilityL( + const SRequestMapEntry& aMapEntry ) + { + DEBUG( "CWlmServer::HandleSsidListAvailabilityL()" ); + + ScanList* scanList = + reinterpret_cast( aMapEntry.iParam2 ); + core_type_list_c* iapIdList = + reinterpret_cast*>( aMapEntry.iParam1 ); + + /** + * Go through the IAP list and find IAPs that haven't been found + * during GetAvailableIaps and have an SSID list attached. + */ + RArray attachedIapList; + CleanupClosePushL( attachedIapList ); + const RArray& cachedIapList( + iCache->CachedIapDataList() ); + core_type_list_iterator_c iter( *iapIdList ); + for( TInt idx( 0 ); idx < cachedIapList.Count(); ++idx ) + { + TBool isFound( EFalse ); + for( u32_t* item = iter.first(); !isFound && item; item = iter.next() ) + { + if( *item == cachedIapList[idx].iapId ) + { + isFound = ETrue; + } + } + if( !isFound ) + { + DEBUG1( "CWlmServer::HandleSsidListAvailabilityL() - IAP ID %u isn't available", + cachedIapList[idx].iapId ); + if( iSsidListDb->IsListAttached( + cachedIapList[idx].iapId ) ) + { + DEBUG1( "CWlmServer::HandleSsidListAvailabilityL() - IAP %u has an SSID list attached", + cachedIapList[idx].iapId ); + attachedIapList.Append( cachedIapList[idx] ); + } + } + } + + if( !attachedIapList.Count() ) + { + DEBUG( "CWlmServer::HandleSsidListAvailabilityL() - no IAPs with an list attached, nothing to do" ); + + CleanupStack::PopAndDestroy( &attachedIapList ); + + return; + } + + /** + * Generate a list of SSIDs detected during the scan and go through + * the IAPs with lists attached again. + */ + RArray networkList; + CleanupClosePushL( networkList ); + GetNetworkList( *scanList, networkList ); + + for( TInt idx( 0 ); idx < attachedIapList.Count(); ++idx ) + { + DEBUG1( "CWlmServer::HandleSsidListAvailabilityL() - requesting SSID list for IAP %u", + attachedIapList[idx].iapId ); + + CWlanSsidList* ssidList = CWlanSsidList::NewL( KWlanSsidListGranularity ); + CleanupStack::PushL( ssidList ); + iSsidListDb->ReadListL( + attachedIapList[idx].iapId, + *ssidList ); + TBool isMatch( EFalse ); + for( TInt iidx( 0 ); !isMatch && iidx < networkList.Count(); ++iidx ) + { + if( attachedIapList[idx].networkType == networkList[iidx].networkType && + ssidList->IsInList( networkList[iidx].ssid ) ) + { + isMatch = ETrue; + } + } + + if( isMatch ) + { + DEBUG( "CWlmServer::HandleSsidListAvailabilityL() - matching SSID found" ); + + /** + * A match has been found, mark the IAP as available. + */ + u32_t* iapId = new (ELeave) u32_t( + attachedIapList[idx].iapId ); + iapIdList->append( + iapId ); + } + else + { + DEBUG( "CWlmServer::HandleSsidListAvailabilityL() - no matching SSIDs found for IAP" ); + } + + CleanupStack::PopAndDestroy( ssidList ); + } + + CleanupStack::PopAndDestroy( &networkList ); + CleanupStack::PopAndDestroy( &attachedIapList ); + + DEBUG( "CWlmServer::HandleSsidListAvailabilityL() - all done" ); + } + +// --------------------------------------------------------- +// CWlmServer::GetCurrentIapId +// --------------------------------------------------------- +// +TInt CWlmServer::GetCurrentIapId( + const TUint aLanServiceId, + core_iap_data_s& aCoreIapData ) + { + DEBUG( "CWlmServer::GetCurrentIapId()" ); + /** + * Read all WLAN IAPs from commsdat. + */ + CWLanSettings wlanSettings; + TInt ret = wlanSettings.Connect(); + if ( ret != KErrNone ) + { + DEBUG1( "CWlmServer::GetCurrentIapId - CWLanSettings::Connect() failed (%d)", + ret ); + + return ret; + } + + RArray wlanIapIds; + TRAP( ret, wlanSettings.GetIAPWlanServicesL( wlanIapIds ) ); + if( ret != KErrNone ) + { + DEBUG1( "CWlmServer::GetCurrentIapId - CWLanSettings::GetIAPWlanServicesL() failed (%d)", + ret ); + wlanIapIds.Close(); + wlanSettings.Disconnect(); + + return ret; + } + TInt IapsCount = wlanIapIds.Count(); + /** + * Get the matching IAP id. + */ + for ( TInt i = 0; i < IapsCount; i++ ) + { + if ( wlanIapIds[i].iWLANRecordId == aLanServiceId ) + { + aCoreIapData.iap_id = wlanIapIds[i].iIAPId; + i = IapsCount; + } + } + + wlanSettings.Disconnect(); + + DEBUG( "CWlmServer::GetCurrentIapId() - all done" ); + + return KErrNone; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserverexe.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmserverexe.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class that instantiates a process and starts executing +* wlan engine in it. +* +*/ + + +#include +#include "wlmserver.h" + +/*#if defined (__WINS__) +EXPORT_C TInt WinsMain() + { + return reinterpret_cast(&CWlmServer::StartServerThread); + } +#else*/ +GLDEF_C TInt E32Main() + { + RSemaphore globStartSignal; + globStartSignal.CreateGlobal(KWLMServerSemaphore,0); + return CWlmServer::StartServerThread(); + } +//#endif // __WINS__ + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmsession.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,378 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Session class is required by the client/server framework +* +*/ + +/* +* %version: 23 % +*/ + +// INCLUDE FILES +#include "wlmsession.h" +#include "genscanlist.h" +#include "wlmserver.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlmSession::CWlmSession +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWlmSession::CWlmSession( + CWlmServer& aServer ) : + iId( 0 ), + iWlmServer( aServer ), + iIsNotificationRequestPending( EFalse ), + iNotificationHandle( NULL ) + { + } + +// ----------------------------------------------------------------------------- +// CWlmSession::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWlmSession::ConstructL() + { + iPendingNotifications.Reset(); + iId = iWlmServer.NotifySessionCreated(); + } + +// ----------------------------------------------------------------------------- +// CWlmSession::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWlmSession* CWlmSession::NewL( + CWlmServer& aServer ) + { + CWlmSession* self = new( ELeave ) CWlmSession( aServer ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CWlmSession::~CWlmSession() + { + iPendingNotifications.Close(); + + if( iNotificationHandle ) + { + iWlmServer.NotifyRemove( *iNotificationHandle ); + delete iNotificationHandle; + } + iWlmServer.NotifySessionClosed( iId ); + } + +// --------------------------------------------------------- +// CWlmSession::ServiceL +// --------------------------------------------------------- +// +void CWlmSession::ServiceL( + const RMessage2& aMessage ) + { + DEBUG1( "CWlmSession: Function %d received", aMessage.Function() ); +#ifdef _DEBUG + TInt totalAllocated = 0; + TInt cellCount = User::AllocSize( totalAllocated ); + DEBUG2("WLMSERVER MEMORYINFO: mem allocated == %d, cellcount == %d", + totalAllocated, cellCount ); +#endif // _DEBUG + + TInt cmd = aMessage.Function(); + switch ( cmd ) + { + case EOrderNotifications: + HandleOrderNotifications( aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelNotifications: + HandleCancelNotifications( aMessage ); + break; + // -------------------------------------------------------------------- + case EGetScanResults: + iWlmServer.GetScanResult( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelGetScanResults: + iWlmServer.CancelGetScanResult( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EJoinByProfileId: + // Joining/creating network requires capabilities + aMessage.HasCapabilityL( ECapabilityNetworkServices ); + iWlmServer.Connect( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelJoin: + iWlmServer.CancelConnect( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EReset: + // Releasing network connections requires capabilities + aMessage.HasCapabilityL( ECapabilityNetworkServices ); + iWlmServer.ReleaseComplete( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetAvailableIaps: + iWlmServer.GetAvailableIaps( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelGetAvailableIaps: + iWlmServer.CancelGetAvailableIaps( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetCurrentState: + iWlmServer.GetConnectionState( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetCurrentRSSI: + iWlmServer.GetCurrentRCPI( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetMacAddress: + iWlmServer.GetCurrentBSSID( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetNetworkName: + iWlmServer.GetCurrentSSID( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetSecurityMode: + iWlmServer.GetCurrentSecurityMode( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetSystemMode: + iWlmServer.GetCurrentSystemMode( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ENotifyChangedSettings: + iWlmServer.NotifyChangedSettings( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EAddBssidToRoguelist: + iWlmServer.AddBssidToRoguelist( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EUpdateRcpNotificationBoundaries: + iWlmServer.UpdateRcpNotificationBoundary( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EConfigureMulticastGroup: + iWlmServer.ConfigureMulticastGroup( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetPacketStatistics: + iWlmServer.GetPacketStatistics( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EClearPacketStatistics: + iWlmServer.ClearPacketStatistics( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetUapsdSettings: + iWlmServer.GetUapsdSettings( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ESetUapsdSettings: + iWlmServer.SetUapsdSettings( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetPowerSaveSettings: + iWlmServer.GetPowerSaveSettings( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ESetPowerSaveSettings: + iWlmServer.SetPowerSaveSettings( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ERunProtectedSetup: + iWlmServer.RunProtectedSetup( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelProtectedSetup: + iWlmServer.CancelProtectedSetup( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECreateTrafficStream: + iWlmServer.CreateTrafficStream( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelCreateTrafficStream: + iWlmServer.CancelCreateTrafficStream( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EDeleteTrafficStream: + iWlmServer.DeleteTrafficStream( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelDeleteTrafficStream: + iWlmServer.CancelDeleteTrafficStream( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetAccessPointInfo: + iWlmServer.GetAccessPointInfo( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetRoamMetrics: + iWlmServer.GetRoamMetrics( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetRogueList: + iWlmServer.GetRogueList( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetRegulatoryDomain: + iWlmServer.GetRegulatoryDomain( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetPowerSaveMode: + iWlmServer.GetPowerSaveMode( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EAddIapSsidList: + iWlmServer.AddIapSsidListL( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ERemoveIapSsidList: + iWlmServer.RemoveIapSsidListL( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ESetPowerSaveMode: + iWlmServer.SetPowerSaveMode( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ENotifyChangedPsmSrvMode: + iWlmServer.NotifyChangedPsmSrvMode( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EGetAcTrafficStatus: + iWlmServer.GetAcTrafficStatus( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case EDirectedRoam: + iWlmServer.DirectedRoam( iId, aMessage ); + break; + // -------------------------------------------------------------------- + case ECancelDirectedRoam: + iWlmServer.CancelDirectedRoam( iId, aMessage ); + break; + // -------------------------------------------------------------------- + default: + aMessage.Complete( KErrNotSupported ); + } + } + +// --------------------------------------------------------- +// CWlmSession::HandleOrderNotifications +// --------------------------------------------------------- +// +void CWlmSession::HandleOrderNotifications( + const RMessage2& aMessage ) + { + iPendingNotificationRequest = aMessage; + iIsNotificationRequestPending = ETrue; + if( !iNotificationHandle ) // == NULL i.e. is not activated + { + TRAPD( err, iNotificationHandle = + CSessionNotification::NewL( *this, aMessage.Int1() ) ); + if ( err == KErrNone ) + { + iWlmServer.NotifyAdd( *iNotificationHandle ); + } + else + { + iIsNotificationRequestPending = EFalse; + aMessage.Complete( err ); + return; + } + } + HandleNotification(); // check is there any unsent notifications + } + +// --------------------------------------------------------- +// CWlmSession::HandleCancelNotifications +// --------------------------------------------------------- +// +void CWlmSession::HandleCancelNotifications( + const RMessage2& aMessage ) + { + if( iIsNotificationRequestPending ) + { + iPendingNotificationRequest.Complete( EWlmNotifyNotificationsCancelled ); + iIsNotificationRequestPending = EFalse; + iPendingNotifications.Reset(); + } + if( iNotificationHandle ) + { + iWlmServer.NotifyRemove( *iNotificationHandle ); + delete iNotificationHandle; + iNotificationHandle = NULL; + } + aMessage.Complete( KErrNone ); + } + +// --------------------------------------------------------- +// CWlmSession::AddNotification +// --------------------------------------------------------- +// +void CWlmSession::AddNotification( + TInt aNotification, + const TDesC8& aData ) + { + DEBUG( "CWlmSession::AddNotification" ); + + TNotification notif; + notif.id = aNotification; + notif.data = aData; + + iPendingNotifications.Append( notif ); + HandleNotification(); // check is there client waiting for notification + } + +// --------------------------------------------------------- +// CWlmSession::HandleNotification +// --------------------------------------------------------- +// +void CWlmSession::HandleNotification() + { + DEBUG( "CWlmSession::HandleNotification" ); + + // Check is there message to wait notification and + // notification that is not sent. + if ( iIsNotificationRequestPending && iPendingNotifications.Count() != 0 ) + { + DEBUG( "CWlmSession::HandleNotification - sending response..." ); + iIsNotificationRequestPending = EFalse; + + TPckgBuf pckg; + pckg().data = iPendingNotifications[0].data; + TInt ret( iPendingNotificationRequest.Write( 0, pckg ) ); + if ( ret != KErrNone ) + { + iPendingNotificationRequest.Complete( ret ); + return; + } + iPendingNotificationRequest.Complete( iPendingNotifications[0].id ); + iPendingNotifications.Remove( 0 ); + } + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmtimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmtimer.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: generic timer +* +*/ + + +#include "wlmtimer.h" +#include "am_debug.h" +#include "core_callback.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// am_symbian_timer_c::am_symbian_timer_c +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +am_symbian_timer_c::am_symbian_timer_c( + core_callback_c* callback ) : + CTimer( CTimer::EPriorityStandard ), + callback_m( callback ) + { + DEBUG( "am_symbian_timer_c::am_symbian_timer_c()" ); + // Not the best place for this but... + TRAPD( err, CTimer::ConstructL() ); + if ( err != KErrNone ) + { + DEBUG1( "am_symbian_timer_c::am_symbian_timer_c() - ConstructL leaved with %d", + err ); + } + } + +// Destructor +am_symbian_timer_c::~am_symbian_timer_c() + { + DEBUG( "am_symbian_timer_c::~am_symbian_timer_c()" ); + Cancel(); + + delete callback_m; + } + +// ----------------------------------------------------------------------------- +// am_symbian_timer_c::start +// ----------------------------------------------------------------------------- +// +void am_symbian_timer_c::start( + unsigned long int delay ) + { + DEBUG( "am_symbian_timer_c::start()" ); + After( delay ); + } + +// ----------------------------------------------------------------------------- +// am_symbian_timer_c::stop +// ----------------------------------------------------------------------------- +// +void am_symbian_timer_c::stop() + { + DEBUG( "am_symbian_timer_c::stop()" ); + Cancel(); + } + +// ----------------------------------------------------------------------------- +// am_symbian_timer_c::is_active +// ----------------------------------------------------------------------------- +// +bool_t am_symbian_timer_c::is_active() const + { + return IsActive(); + } + +// ----------------------------------------------------------------------------- +// am_symbian_timer_c::RunL +// ----------------------------------------------------------------------------- +// +void am_symbian_timer_c::RunL() + { + DEBUG( "am_symbian_timer_c::RunL()" ); + callback_m->func_m( callback_m->ptr_m ); + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmtimerfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmtimerfactory.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Factory class for timers +* +*/ + + +#include "core_timer_factory.h" +#include "wlmtimer.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// core_timer_factory_c::create_timer +// ----------------------------------------------------------------------------- +// +abs_core_timer_c* core_timer_factory_c::create_timer( + core_callback_c* callback ) + { + DEBUG( "core_timer_factory_c::create_timer()" ); + + am_symbian_timer_c* timer = new am_symbian_timer_c( callback ); + + if ( timer ) + { + CActiveScheduler::Add( timer ); + } + + return timer; + } + +// ----------------------------------------------------------------------------- +// core_timer_factory_c::destroy_timer +// ----------------------------------------------------------------------------- +// +void core_timer_factory_c::destroy_timer( + abs_core_timer_c* timer ) + { + DEBUG( "core_timer_factory_c::destroy_timer()" ); + + delete static_cast( timer ); + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmtools.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlmtools.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Small utilities implemented by the adaptation +* +*/ + + +#include +#include +#include "core_am_tools.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u64_t core_am_tools_c::timestamp() + { + TTime currentTime( 0 ); + currentTime.HomeTime(); + + return currentTime.Int64(); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +u32_t core_am_tools_c::random() + { + TTime currentTime( 0 ); + currentTime.HomeTime(); + + TInt64 seed = currentTime.Int64(); + return Math::Rand( seed ); + + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osa.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanOsa declaration +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANOSA_H +#define WLANOSA_H + +#include +#include +#include "wlanobject.h" + +struct WlanOsaImpl; + +/** + * concrete osa implementation + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class WlanOsa : + public MWlanOsa, + public MWlanOsaExt, + public WlanObject + { +public: + + /** + * dtor + * + * @since S60 v3.2 + */ + virtual ~WlanOsa(); + + /** + * ctor + * + * @since S60 v3.2 + */ + WlanOsa(); + + /** + * Initializes the object instance. + * Note! Needs to be executed successfully after object instance + * construction to be able to use the instance. + * + * @param aUseCachedMemory ETrue if cached interconnect memory shall be used + * EFalse otherwise + * @param aAllocationUnit allocation unit size for interconnect memory in + * bytes + * @param aDfcQueue Pointer to the DFC queue to use + * @return ETrue when successful + * EFalse otherwise + */ + TBool Initialize( + TBool aUseCachedMemory, + TInt aAllocationUnit, + void* aDfcQueue ); + +// from base class MWlanOsa + + /** + * From MWlanOsa. + * Memory allocation. Correct alignment guaranteed + * + * @since S60 v3.2 + * @param aOsaMemoryType memory type to be allocated + * @param aSize size of the buffer to be allocated in bytes. Must be + * positive otherwise the allocation fails + * @param aFlags bitmask to fine-tune behavior of the allocation + * bit 0 - set: zero stamp allocated memory + * @return begin of the allocated memory, NULL upon failure + */ + virtual void* Alloc( TOsaMemoryType aOsaMemoryType, + TInt aSize, + TUint aFlags ); + + /** + * From MWlanOsa. + * Releases memory allocated by the Alloc method + * + * @since S60 v3.2 + * @param aPtr begin of the buffer to be freed + */ + virtual void Free( void* aPtr ); + + /** + * From MWlanOsa. + * Creates DFC context object + * + * @since S60 v3.2 + * @return DFC context object, NULL upon failure + */ + virtual MWlanDfc* DfcCreate(); + + /** + * From MWlanOsa. + * Destroys DFC context object + * + * @since S60 v3.2 + * @param aWlanDfc DFC context object to be destroyed + */ + virtual void DfcDestroy( MWlanDfc* aWlanDfc ); + + /** + * From MWlanOsa. + * Creates timer context object + * + * @since S60 v3.2 + * @return timer context object, NULL upon failure + */ + virtual MWlanTimer* TimerCreate(); + + /** + * From MWlanOsa. + * Destroys timer context object + * + * @since S60 v3.2 + * @param aWlanTimer timer context object to be destroyed + */ + virtual void TimerDestroy( MWlanTimer* aWlanTimer ); + +// from base class MWlanOsaExt + + /** + * From MWlanOsaExt. + * Acquires the software system lock + * + * @since S60 v3.2 + */ + virtual void MutexAcquire(); + + /** + * From MWlanOsaExt. + * Releases the software system lock + * + * @since S60 v3.2 + */ + virtual void MutexRelease(); + +protected: + +private: + + // Prohibit copy constructor. + WlanOsa( const WlanOsa& ); + // Prohibit assigment operator. + WlanOsa& operator= ( const WlanOsa& ); + + inline WlanOsaImpl& Pimpl(); + +private: // data + + /** + * implementation + * Own. + */ + WlanOsaImpl* iPimpl; + + /** pointer to DFC queue. Not own */ + void* iDfcQueue; + }; + +#include "osa.inl" + +#endif // WLANOSA_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osa.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osa.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanOsa inline implementation +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanOsaImpl& WlanOsa::Pimpl() + { + return *iPimpl; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osa_includeme.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osa_includeme.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: 1st file to be included by every source file in the project +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef OSA_INCLUDEME_H +#define OSA_INCLUDEME_H + +#include "am_platform_libraries.h" +#include "gendebug.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void Trace( TInt aLevel, const TInt8* aFile, TInt aLine ) + { + TraceDump( aLevel, (reinterpret_cast(aFile)) ); + TraceDump( aLevel, (("Line: %d"), aLine)); + } + +// the one and only initial hw chunk size for DMA capable memory +const TInt KInitialHwChunkSize = 4 * 4096; // 16 KBits + +#endif // OSA_INCLUDEME_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osacarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osacarray.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: wrapper on top of C array with C++ STL interface +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANCARRAY_H +#define WLANCARRAY_H + +#include "algorithm.h" + +#include "osacarraypolicy.h" + +/** + * wrapper on top of C array with C++ STL interface + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +template +< + class T, + TInt the_size, + // check out osacarraypolicy.h 4 these + class CopyingPolicy = NoCopy +> +class Carray : protected CopyingPolicy, public DBase + { + + typedef Carray Self; + +public: + + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef TInt size_type; + + /** + * Constructor. + * + * @since S60 v3.2 + */ + Carray() {}; + + /** + * Constructor. Construct with inital data + * + * @since S60 v3.2 + * @param aP initial data + */ + explicit inline Carray( T* aP ) { copy( aP, aP + the_size, begin()); } + + /** + * returns iterator to begin of the sequence + * + * @since S60 v3.2 + * @return iterator to begin of the sequence + */ + inline iterator begin() { return v; } + + /** + * returns const iterator to begin of the sequence + * + * @since S60 v3.2 + * @return const iterator to begin of the sequence + */ + inline const_iterator begin() const { return v; } + + /** + * returns iterator to end of the sequence + * + * @since S60 v3.2 + * @return iterator to end of the sequence + */ + inline iterator end() { return v + the_size; } + + /** + * returns const iterator to end of the sequence + * + * @since S60 v3.2 + * @return const iterator to end of the sequence + */ + inline const_iterator end() const { return v + the_size; } + + /** + * returns size of the storage + * + * @since S60 v3.2 + * @return size of the storage + */ + inline size_type size() const { return the_size; } + + /** + * returns max size of the storage + * + * @since S60 v3.2 + * @return max size of the storage + */ + inline size_type max_size() const { return the_size; } + + /** + * non const [] operator access + * + * @since S60 v3.2 + * @return non const reference to element + */ + inline reference operator[](TInt i) { return v[i]; } + + /** + * const [] operator access + * + * @since S60 v3.2 + * @return const reference to element + */ + inline const_reference operator[](TInt i) const { return v[i]; } + + /** + * return non const reference to front of sequence + * + * @since S60 v3.2 + * @return non const reference to front of sequence + */ + inline reference front() { return v[0]; } + + /** + * return const reference to front of sequence + * + * @since S60 v3.2 + * @return const reference to front of sequence + */ + inline const_reference front() const { return v[0]; } + + /** + * return non const reference to back of sequence + * + * @since S60 v3.2 + * @return non const reference to back of sequence + */ + inline reference back() { return v[the_size-1]; } + + /** + * return const reference to back of sequence + * + * @since S60 v3.2 + * @return const reference to back of sequence + */ + inline const_reference back() const { return v[the_size-1]; } + + /** + * conversion to ordinary array + * + * @since S60 v3.2 + * @return const pointer to begin of the sequence + */ + inline const T* data() const { return v; } + + /** + * conversion to ordinary array + * + * @since S60 v3.2 + * @return non const pointer to begin of the sequence + */ + inline T* data() { return v; } + + /** + * assignment operator + * + * @since S60 v3.2 + */ + Self& operator=( const Self& ); + + /** + * copy constructor + * + * @since S60 v3.2 + */ + inline Carray( const Self& o ) + { + Copy( + const_cast(o.begin()), + const_cast(o.end()), + begin() ); + } + +private: + + T v[the_size]; +}; + +#include "osacarray.inl" + +#endif // WLANCARRAY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osacarray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osacarray.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Carray inline implementations +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// assignment operator +// ----------------------------------------------------------------------------- +// +template +inline Carray& +Carray::operator=( const Self& o ) + { + // use policy chosen at compile time + Copy( + const_cast(o.begin()), + const_cast(o.end()), + begin() ); + + return (*this); + } + +// ----------------------------------------------------------------------------- +// operator == +// ----------------------------------------------------------------------------- +// +template +inline TBool operator == ( + const Carray& x, + const Carray& y ) + { + return equal( x.begin(), x.end(), y.begin() ); + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osacarraypolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osacarraypolicy.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: compile time modifiable policies for Carray +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANCARRAYPOLICY_H +#define WLANCARRAYPOLICY_H + +// just what name states copying and assignment are not allowed +template +struct NoCopy {}; + +#endif // WLANCARRAYPOLICY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osachunk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osachunk.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanChunk declaration +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANCHUNK_H +#define WLANCHUNK_H + +#include "wlanobject.h" + +#include "osalist.h" +#include "osachunkbase.h" + +class RWlanHeap; + +/** + * Memory chunk allocation management object. + * + * Management of memory is based on buddy system, where righ hand side (rhs) + * and left hand side (lhs) memory links are coalesced (if they are free) to + * the current link to be freed. Allocation size is always alinged to + * allocation unit, which equals to the size of cache line. The pointer + * returned to the caller is also aligned to the allocation unit. + * + */ +class WlanChunk : + public DBase, public WlanObject, public MWlanOsaChunkBase + { +public: + + /** + * ctor + * NOTE: call IsValid() member from super class + * to validate object after ctor + * + * @since S60 v3.2 + * @param aStartOfBuf start of buffer + * @param aEndOfBuf 1 past end of buffer + * @param aAllocationUnit allocation unit size in bytes + */ + WlanChunk( TUint8* aStartOfBuf, TUint8* aEndOfBuf, TInt aAllocationUnit ); + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanChunk(); + +// from base class MWlanOsaChunkBase + + /** + * From MWlanOsaChunkBase. + * Memory allocation. Correct alignment guaranteed + * + * @since S60 v3.2 + * @param aSize size of the buffer to be allocated in bytes. + * Must be positive otherwise the allocation fails + * @param aZeroStamp zero stamp memory or not + * @return begin of the allocated memory, NULL upon failure + */ + virtual void* Alloc( TInt aSize, TBool aZeroStamp ); + + /** + * From MWlanOsaChunkBase. + * Releases memory allocated by the Alloc method + * + * @since S60 v3.2 + * @param aPtr begin of the buffer to be freed + */ + virtual void Free( void* aPtr ); + + /** + * From MWlanOsaChunkBase. + * Returns the maximum free link size + * + * @since S60 v3.2 + * @return maximum free link size + */ + virtual TInt MaxFreeLinkSize() const; + + /** + * From MWlanOsaChunkBase. + * Evaluates is chunk in use or not, + * meaning is memory allocated from there or not + * + * @since S60 v3.2 + * @return ETrue for unused chunk any other for used chunk + */ + virtual TBool IsInUse() const; + + /** + * From MWlanOsaChunkBase. + * Returns the size of the memory chunk meta header in bytes + * + * @since S60 v3.2 + * @return size of the memory chunk meta header + */ + virtual TInt HeaderSize() const; + + + // Prohibit copy constructor. + WlanChunk( const WlanChunk& ); + // Prohibit assigment operator. + WlanChunk& operator= ( const WlanChunk& ); + +private: // data + + RWlanHeap* iHeap; + + }; + +#endif // WLANCHUNK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osachunkbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osachunkbase.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: osachunkbase interface declaration +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef M_WLANOSACHUNKBASE_H +#define M_WLANOSACHUNKBASE_H + +/** + * osachunk interface declaration + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanOsaChunkBase + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanOsaChunkBase() {}; + + /** + * Memory allocation. + * Correct alignment guaranteed + * + * @since S60 v3.2 + * @param aSize size of the buffer to be allocated in bytes. + * Must be positive otherwise the allocation fails + * @param aZeroStamp zero stamp memory or not + * @return begin of the allocated memory, NULL upon failure + */ + virtual void* Alloc( TInt aSize, TBool aZeroStamp ) = 0; + + /** + * Releases memory allocated by the Alloc method + * + * @since S60 v3.2 + * @param aPtr begin of the buffer to be freed + */ + virtual void Free( void* aPtr ) = 0; + + /** + * Returns the maximum free link size + * + * @since S60 v3.2 + * @return maximum free link size + */ + virtual TInt MaxFreeLinkSize() const = 0; + + /** + * Evaluates is chunk in use or not, + * meaning is memory allocated from there or not + * + * @since S60 v3.2 + * @return ETrue for unused chunk any other for used chunk + */ + virtual TBool IsInUse() const = 0; + + /** + * Returns the size of the memory chunk meta header in bytes + * + * @since S60 v3.2 + * @return size of the memory chunk meta header + */ + virtual TInt HeaderSize() const = 0; + }; + +#endif // M_WLANOSACHUNKBASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osadfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osadfc.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanDfc declaration +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANDFC_H +#define WLANDFC_H + +#include +#include "wlanobject.h" + +class WlanOsa; +struct WlanDfcImpl; + +/** + * concrete DFC context object + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class WlanDfc : public MWlanDfc, public WlanObject + { + + friend class WlanDfcImpl; + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanDfc(); + + /** + * Constructor. + * + * @since S60 v3.2 + * @param aOsa wlanosa object + * @param aDfcQueue Pointer to the DFC queue to use + */ + explicit WlanDfc( + WlanOsa& aOsa, + void* aDfcQueue ); + +protected: + +// from base class MWlanDfc + + /** + * From MWlanDfc. + * Enqueue a dfc for execution. + * Either succeeds or has no effect. + * Calling this method for allready queued dfc has no effect + * + * @since S60 v3.2 + * @param aDfcClient client interface + * @param aCtx context passed back in client callback + */ + virtual void Enqueue( MWlanDfcClient& aDfcClient, TInt aCtx ); + + /** + * From MWlanDfc. + * Dequeue a queued dfc. + * Either succeeds or has no effect. + * Calling this method for non queued dfc has no effect + * + * @since S60 v3.2 + */ + virtual void Dequeue(); + +private: + + // Prohibit copy constructor. + WlanDfc( const WlanDfc& ); + // Prohibit assigment operator. + WlanDfc& operator= ( const WlanDfc& ); + + /** + * DFC execution entry + * + * @since S60 v3.2 + */ + void RealDfc(); + + /** + * Extracts implementation details + * + * @since S60 v3.2 + * @return implementation details + */ + inline WlanDfcImpl& Pimpl(); + +private: // data + + /** + * implementation + * Own. + */ + WlanDfcImpl* iPimpl; + }; + +#include "osadfc.inl" + +#endif // WLANDFC_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osadfc.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osadfc.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanDfc inline implementation +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanDfcImpl& WlanDfc::Pimpl() + { + return *iPimpl; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osahandle.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osahandle.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle declaration +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANHANDLE_H +#define WLANHANDLE_H + +#include "wlanobject.h" + +/** + * Just another handle in the handle body idiom + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +template +class Handle : public DBase, public WlanObject + { + typedef Handle Self; + + friend TBool operator== ( const Self& aLhs, const Self& aRhs); + +public: + + /** + * ctor + * NOTE: call IsValid() member from super class + * to validate object after ctor + * + * @since S60 v3.2 + * @param aElem data to be handled + */ + explicit inline Handle( T& aElem ); + + /** + * delete data to be handled if this is the last owner + * + * @since S60 v3.2 + */ + virtual ~Handle(); + + /** + * copy ctor (one more owner for the data) + * + * @since S60 v3.2 + * @param aElem me, myself and I + */ + inline Handle( const Self& aElem ); + + /** + * assignment operator (unshare old and share the new value) + * + * @since S60 v3.2 + * @param aElem me, myself and I + * @return me, myself and I + */ + inline Self& operator=( const Self& aElem ); + + /** + * operator -> + * + * @since S60 v3.2 + * @return representation + */ + inline T* operator->(); + + /** + * extract data that is handled + * + * @since S60 v3.2 + * @return data that is handled + */ + inline T* Data(); + + /** + * extract data that is handled + * + * @since S60 v3.2 + * @return data that is handled + */ + inline const T* Data() const; + + /** + * rebind handle to a new representation + * + * @since S60 v3.2 + * @param aElem data to be handled + * @return ETrue for success any other failure + */ + inline TBool Bind( T& aElem ); + +private: + + /** + * removes the reference to the representation + * + * @since S60 v3.2 + */ + inline void Dispose(); + +private: // data + + /** + * data to be handled + */ + T* iData; + + /** + * reference count for the data to be handled + */ + TInt* iRefCount; + }; + +template +inline TBool operator== ( const Handle& aLhs, const Handle& aRhs) + { + return ( *(aLhs.iData) == *(aRhs.iData) ); + } + +#include "osahandle.inl" + +#endif // WLANHANDLE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osahandle.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osahandle.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: inline implementation of Handle +* +*/ + +/* +* %version: 4 % +*/ + +#include "algorithm.h" // for operator != +#include // for assert + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline Handle::Handle( T& aElem ) + : iData( &aElem ), iRefCount( new TInt( 1 ) ) + { + TraceDump(INFO_LEVEL, (("[WLAN] Handle ctor +: 0x%08x"), this)); + TraceDump(INFO_LEVEL, (("[WLAN] data: 0x%08x"), iData)); + TraceDump(INFO_LEVEL, (("[WLAN] refcount: 0x%08x"), iRefCount)); + + if ( iRefCount ) + { + // allocation success + TraceDump(INFO_LEVEL, + (("[WLAN] reference count: %d"), *iRefCount)); + Validate(); + } + else + { + // allocation failure + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + InValidate(); + } + + TraceDump(INFO_LEVEL, (("[WLAN] Handle ctor -: 0x%08x"), this)); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline Handle::~Handle() + { + TraceDump(INFO_LEVEL, (("[WLAN] Handle dtor +: 0x%08x"), this)); + + Dispose(); + + TraceDump(INFO_LEVEL, (("[WLAN] Handle dtor -: 0x%08x"), this)); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline Handle::Handle( const Self& aElem ) + : iData( aElem.iData ), iRefCount( aElem.iRefCount ) + { + TraceDump(INFO_LEVEL, (("[WLAN] Handle copy ctor +: 0x%08x"), this)); + TraceDump(INFO_LEVEL, (("[WLAN] data: 0x%08x"), iData)); + TraceDump(INFO_LEVEL, (("[WLAN] refcount: 0x%08x"), iRefCount)); + + + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), + __LINE__, (iRefCount != NULL) ); + + ++(*iRefCount); + TraceDump(INFO_LEVEL, (("[WLAN] reference count: %d"), *iRefCount)); + + TraceDump(INFO_LEVEL, (("[WLAN] Handle copy ctor -: 0x%08x"), this)); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline Handle& Handle::operator=( const Self& aElem ) + { + TraceDump(INFO_LEVEL, + (("[WLAN] Handle assignement operator +: 0x%08x"), this)); + + if ( *this != aElem ) + { + Dispose(); + + iData = aElem.iData; + iRefCount = aElem.iRefCount; + + TraceDump(INFO_LEVEL, (("[WLAN] data: 0x%08x"), iData)); + TraceDump(INFO_LEVEL, (("[WLAN] refcount: 0x%08x"), iRefCount)); + + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), + __LINE__, (iRefCount != NULL) ); + + ++(*iRefCount); + } + else + { + // left intentionally empty + } + + TraceDump(INFO_LEVEL, (("[WLAN] reference count: %d"), *iRefCount)); + TraceDump(INFO_LEVEL, + (("[WLAN] Handle assignement operator -: 0x%08x"), this)); + + return *this; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline T* Handle::operator->() + { + return iData; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline T* Handle::Data() + { + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), + __LINE__, (iData != NULL) ); + return iData; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline const T* Handle::Data() const + { + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), + __LINE__, (iData != NULL) ); + return iData; + } + +// ----------------------------------------------------------------------------- +// only upon allocation failure return EFalse +// ----------------------------------------------------------------------------- +// +template +inline TBool Handle::Bind( T& aElem ) + { + TraceDump(INFO_LEVEL, (("[WLAN] Handle::Bind +: 0x%08x"), this)); + + TBool ret( ETrue ); + + if ( aElem != *iData ) + { + if ( --(*iRefCount) == 0 ) + { + TraceDump(INFO_LEVEL, + ("[WLAN] Handle::Bind deallocate referenced data")); + TraceDump(INFO_LEVEL, + (("[WLAN] old data delloac: 0x%08x"), iData)); + TraceDump(INFO_LEVEL, (("[WLAN] refcount: 0x%08x"), iRefCount)); + + delete iData; + ++(*iRefCount); // recycle counter + } + else + { + // references still exist after this critter is a goner + // as we are doing a rebind we shall create a new counter + iRefCount = new TInt( 1 ); + if ( !iRefCount ) + { + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + ret = EFalse; + } + else + { + // allocation success + // left intentionally empty + TraceDump(INFO_LEVEL, + (("[WLAN] new refcount: 0x%08x"), iRefCount)); + } + } + + iData = &aElem; + TraceDump(INFO_LEVEL, (("[WLAN] new data: 0x%08x"), iData)); + } + else + { + // left intentionally empty + } + + TraceDump(INFO_LEVEL, (("[WLAN] reference count: %d"), *iRefCount)); + TraceDump(INFO_LEVEL, (("[WLAN] Handle::Bind -: 0x%08x"), this)); + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void Handle::Dispose() + { + TraceDump(INFO_LEVEL, (("[WLAN] Handle::Dispose +: 0x%08x"), this)); + + if ( IsValid() ) + { + // we are a valid object + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), + __LINE__, (iRefCount != NULL) ); + + if ( --(*iRefCount) == 0 ) + { + TraceDump(INFO_LEVEL, + ("[WLAN] Handle::Dispose deallocate referenced data")); + + TraceDump(INFO_LEVEL, (("[WLAN] data: 0x%08x"), iData)); + delete iData; + TraceDump(INFO_LEVEL, (("[WLAN] refcount: 0x%08x"), iRefCount)); + delete iRefCount; + } + else + { + // references still exist after this critter is a goner + // left intentionally empty + TraceDump(INFO_LEVEL, + (("[WLAN] reference count: %d"), *iRefCount)); + } + } + else + { + // we are an invalid object + // left intentionally empty + } + + TraceDump(INFO_LEVEL, (("[WLAN] Handle::Dispose -: 0x%08x"), this)); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaheap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaheap.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanHeap declaration +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLAN_OSA_HEAP_H +#define WLAN_OSA_HEAP_H + +class RWlanHeap + { + +public: + struct SCell { + /** + The length of the cell, which includes the length of + this header. + */ + TInt len; + + + /** + A pointer to the next cell in the free list. + */ + SCell* next; + }; + + enum {EAllocCellSize = sizeof(TInt)}; + + /** + Size of a free cell header. + */ + enum {EFreeCellSize = sizeof(SCell)}; + + /** + @internalComponent + */ + struct _s_align {char c; double d;}; + + /** + The default cell alignment. + */ + enum {ECellAlignment = sizeof(_s_align)-sizeof(double)}; + +public: + static RWlanHeap* FixedHeap( + TAny* aBase, + TInt aMaxLength, + TInt aAllocationUnit ); +public: + /** + Allocates a cell of the specified size from the heap. + + If there is insufficient memory available on the heap from which to allocate + a cell of the required size, the function returns NULL. + + The cell is aligned according to the alignment value specified at construction, + or the default alignment value, if an explict value was not specified. + + The resulting size of the allocated cell may be rounded up to a + value greater than aSize, but is guaranteed to be not less than aSize. + + @param aSize The + size of the cell to be allocated from the heap + + @return A pointer to the allocated cell. NULL if there is insufficient memory + available. + + @see KMaxTInt + */ + TAny* Alloc(TInt aSize); + + /** + Frees the specified cell and returns it to the heap. + + @param aCell A pointer to a valid cell; this pointer can also be NULL, + in which case the function does nothing and just returns. + */ + void Free(TAny* aPtr); + + /** + Gets the total free space currently available on the heap and the space + available in the largest free block. + + The space available represents the total space which can be allocated. + + Note that compressing the heap may reduce the total free space available and + the space available in the largest free block. + + @param aBiggestBlock On return, contains the space available + in the largest free block on the heap. + + @return The total free space currently available on the heap. + */ + TInt Available(TInt& aBiggestBlock) const; + +private: + + RWlanHeap(TInt aInitialSize, TInt aAllocationUnit ); + + TAny* RWlanHeap::operator new(TUint aSize, TAny* aBase); + + void Initialise(); + + /** + As much as possible, check a cell address and backspace it + to point at the cell header. + */ + RWlanHeap::SCell* GetAddress(const TAny* aCell) const; + + /** + Gets the length of the available space in the specified allocated cell. + + @param aCell A pointer to the allocated cell. + + @return The length of the available space in the allocated cell. + + */ + TInt AllocLen(const TAny* aCell) const; + + /** + Allocate without growing. aSize includes cell header and alignment. + */ + RWlanHeap::SCell* DoAlloc(TInt aSize, SCell*& aLastFree); + + void DoFree(SCell* pC); + + /** + Find the free cell that immediately follows aCell, if one exists + If found, aNext is set to point to it, else it is set to NULL. + aPrev is set to the free cell before aCell or the dummy free cell where there are no free cells before aCell. + Called with lock enabled. + */ + void FindFollowingFreeCell(SCell* aCell, SCell*& aPrev, SCell*& aNext); + + /** + Try to grow the heap cell 'aCell' in place, to size 'aSize'. + Requires the free cell immediately after aCell (aNext), and the free cell prior to + that (aPrev), to be provided. (As found by FindFollowingFreeCell) + */ + TInt TryToGrowCell(SCell* aCell,SCell* aPrev, SCell* aNext, TInt aSize); + +private: + + TInt iMinLength; + TInt iMaxLength; + TInt iOffset; + TInt iGrowBy; + TInt iChunkHandle; + TUint8* iBase; + TUint8* iTop; + TInt iAlign; + TInt iMinCell; + TInt iPageSize; + SCell iFree; + + }; + + +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,287 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: list declaration +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANLIST_H +#define WLANLIST_H + +#include "osalist_iterator.h" + +/** + * double linked list with limited STL interface + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +template +class list : public DBase + { + + typedef list Self; + +public: + + struct Node : public DBase + { + + /** + * Constructor. + * + * @since S60 v3.2 + */ + explicit Node( const T& aElem ) + : iElem( aElem ), iNext( NULL ), iPrev( NULL ) {}; + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~Node() {}; + + // Prohibit copy constructor. + Node( const Node& ); + // Prohibit assigment operator. + Node& operator= ( const Node& ); + + T iElem; + + Node* iNext; + Node* iPrev; + }; + + friend class list_iterator; + + // type definitions + typedef T value_type; + typedef list_iterator iterator; + typedef const list_iterator const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef TInt size_type; + + /** + * creates an empty list without any elements + * + * @since S60 v3.2 + */ + inline list() : iFirst( NULL ), iLast( NULL ), iNumOfElems( 0 ) {}; + + /** + * destroys all elements and frees the memory + * + * @since S60 v3.2 + */ + inline virtual ~list(); + + /** + * returns a bidirectional iterator for the first element + * for empty ranges equals to end() + * + * @since S60 v3.2 + * @return bidirectional iterator for the first element + */ + inline iterator begin(); + + /** + * returns a const bidirectional iterator for the first element + * for empty ranges equals to end() + * + * @since S60 v3.2 + * @return const bidirectional iterator for the first element + */ + inline const_iterator begin() const; + + /** + * returns a bidirectional iterator for the position after the last element + * + * @since S60 v3.2 + * @return bidirectional iterator for the position after the last element + */ + inline iterator end(); + + /** + * returns a const bidirectional iterator for + * the position after the last element + * + * @since S60 v3.2 + * @return a const bidirectional iterator + * for the position after the last element + */ + inline const_iterator end() const; + + /** + * returns the actual number of elements + * + * @since S60 v3.2 + * @return the actual number of elements + */ + inline size_type size() const; + + /** + * returns whether the container is empty + * + * @since S60 v3.2 + * @return ETrue if the container is empty + */ + inline TBool empty() const; + + /** + * returns reference to the first element + * (no check wether the 1st element exists) + * NOTE: if the container is empty the end result is undefined + * + * @since S60 v3.2 + * @return reference to the first element + */ + inline reference front(); + + /** + * returns const reference to the first element + * (no check wether the 1st element exists) + * NOTE: if the container is empty the end result is undefined + * + * @since S60 v3.2 + * @return const reference to the first element + */ + inline const_reference front() const; + + /** + * returns reference to the last element + * (no check wether the last element exists) + * NOTE: if the container is empty the end result is undefined + * + * @since S60 v3.2 + * @return reference to the last element + */ + inline reference back(); + + /** + * returns const reference to the last element + * (no check wether the last element exists) + * NOTE: if the container is empty the end result is undefined + * + * @since S60 v3.2 + * @return const reference to the last element + */ + inline const_reference back() const; + + /** + * removes all elements (makes container empty) + * + * @since S60 v3.2 + */ + inline void clear(); + + /** + * appends a copy of aElem at the end + * NOTE: either succeeds or has no effect, user must verify operation + * success by comparing size before and after call + * + * @since S60 v3.2 + * @param aElem element to be added + */ + inline void push_back( const_reference aElem ); + + /** + * removes the last element (does not return it) + * NOTE: if the container is empty the end result is undefined + * + * @since S60 v3.2 + */ + inline void pop_back(); + + /** + * inserts a copy of elem at the beginning + * NOTE: either succeeds or has no effect, user must verify operation + * success by comparing size before and after call + * + * @since S60 v3.2 + * @param aElem element to be added + */ + inline void push_front( const_reference aElem ); + + /** + * removes the first element (does not return it) + * NOTE: if the container is empty the end result is undefined + * + * @since S60 v3.2 + */ + inline void pop_front(); + + /** + * inserts aElem before aPos + * NOTE: aPos must be valid and != end() otherwise + * the end result is undefined + * NOTE: either succeeds or has no effect, user must verify operation + * success by comparing size before and after call + * + * @since S60 v3.2 + * @param aPos positon after the insertion of aElem + * @param aElem element to be inserted + * @return the position of the inserted element + */ + inline iterator insert( iterator aPos, const T& aElem ); + + /** + * removes the element at position aPos + * NOTE: aPos must be valid and != end() otherwise + * the end result is undefined + * + * @since S60 v3.2 + * @param aPos positon where elemt to be removed + * @return the position of the next element or the end() + * for empty sequence + */ + inline iterator erase( iterator aPos ); + +private: + + // deny assignement + Self& operator=( const Self& aElem ); + + // deny copy + list( const Self& aElem ); + +private: // data + + /** + * first node + * Own. + */ + Node* iFirst; + + /** + * last node + * Own. + */ + Node* iLast; + + /** + * number of elements (nodes) + */ + TInt iNumOfElems; + + }; + +#include "osalist.inl" + +#endif // WLANLIST_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,428 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: inline implementation of list +* +*/ + +/* +* %version: 5 % +*/ + +#include +#include "osa_includeme.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::~list() + { + clear(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::iterator list::begin() + { + // for empty ranges begin() == end() + return ( !(empty()) ? list_iterator( iFirst ) : end() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::const_iterator list::begin() const + { + // for empty ranges begin() == end() + return ( !(empty()) ? list_iterator( iFirst ) : end() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::iterator list::end() + { + return list_iterator(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::const_iterator list::end() const + { + return list_iterator(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::size_type list::size() const + { + return iNumOfElems; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TBool list::empty() const + { + return (!size()); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::reference list::front() + { + // front() for empty sequence is undefined so assert + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, size() ); + return iFirst->iElem; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::const_reference list::front() const + { + // front() for empty sequence is undefined so assert + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, size() ); + return iFirst->iElem; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::reference list::back() + { + // back() for empty sequence is undefined so assert + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, size() ); + return iLast->iElem; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::const_reference list::back() const + { + // back() for empty sequence is undefined so assert + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, size() ); + return iLast->iElem; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void list::clear() + { + Node* current = iFirst; + Node* next = current; + + iNumOfElems = 0; + iFirst = NULL; + iLast = NULL; + + while ( current ) + { + next = current->iNext; + delete current; + current = next; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void list::push_back( const_reference aElem ) + { + // allocate a new node for the element + Node* node = new Node( aElem ); + + if ( node ) + { + // allocation success now append the node to rear + if ( !empty() ) + { + // we are not empty just link to rear + node->iPrev = iLast; + iLast->iNext = node; + iLast = node; + } + else + { + // we are empty, so last and first nodes are the same + iFirst = node; + iLast = iFirst; + } + + ++iNumOfElems; // allways increment element count upon success + } + else + { + // allocation failure + // left intentionally empty + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void list::pop_back() + { + Node* prev = iLast->iPrev; + + if ( prev ) + { + // previous node exists, so make it the new last node + prev->iNext = NULL; + iLast = prev; + } + else + { + // no previous node exist, meaning that we are the only one + // and as we are gone there exist no one + iFirst = NULL; + iLast = NULL; + } + + --iNumOfElems; // always decrement upon pop + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void list::push_front( const_reference aElem ) + { + // allocate a new node for the element + Node* node = new Node( aElem ); + + if ( node ) + { + // allocation success now append the node to rear + if ( !empty() ) + { + // we are not empty just link to front + node->iNext = iFirst; + iFirst->iPrev = node; + iFirst = node; + } + else + { + // we are empty, so last and first nodes are the same + iFirst = node; + iLast = iFirst; + } + + ++iNumOfElems; // allways increment element count upon success + + } + else + { + // allocation failure + // left intentionally empty + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void list::pop_front() + { + Node* next = iFirst->iNext; + + if ( next ) + { + // next node exists, so make it the new first node + next->iPrev = NULL; + iFirst = next; + } + else + { + // no next node exist, meaning that we are the only one + // and as we are gone there exist no one + iFirst = NULL; + iLast = NULL; + } + + --iNumOfElems; // allways decrement upon pop + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::iterator list::insert( iterator aPos, const T& aElem ) + { + // allocate a new node for the element + Node* node = new Node( aElem ); + + if ( node ) + { + // allocation success now insert aElem before aPos + if ( aPos->iPrev ) + { + // a previous link exists + aPos->iPrev->iNext = node; // link old previous node to new node + } + + node->iPrev = aPos->iPrev; // back link new node + node->iNext = aPos(); // next link new node + aPos->iPrev = node; // back link pos to new node + + // allways increment element count upon success + ++iNumOfElems; + + const TInt KHeadInsertionCountMark( 2 ); + if ( size() == KHeadInsertionCountMark ) + { + // set new list head as this insertion was to the front + iFirst = node; + } + else + { + // left intentionally empty + } + } + else + { + // allocation failure + // left intentionally empty + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + // return the position of the inserted element (if any as node can be NULL) + // in case of NULL end() is returned + return ( (node != NULL) ? list_iterator( node ) : end() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list::iterator list::erase( iterator aPos ) + { + // extract node to be erased + Node* node = aPos(); + + if ( node->iNext ) + { + // next node exists + node->iNext->iPrev = node->iPrev; // back link next node + } + else + { + // next node does not exist so we don't have to relink it + // left intentionally empty + } + + if ( node->iPrev ) + { + // previous node exists + node->iPrev->iNext = node->iNext; // next link previous node + } + else + { + // previous node does not exist so we don't have to relink it + // left intentionally empty + } + + Node* next_node = node->iNext; + + if ( node == iFirst ) + { + // node to be deleted is the first one set the new head + iFirst = next_node; + } + else + { + // left intentionally empty + } + if ( node == iLast ) + { + // node to be deleted is the last one set new tail + iLast = node->iPrev; + } + else + { + // left unintentionally empty + } + + delete node; // delete the current node + + --iNumOfElems; // allways decrement element count + + if ( empty() ) + { + // we are now empty + iFirst = NULL; + iLast = NULL; + } + else + { + // left intentionally empty + } + + // return the position of the next element + // (if any as next_node can be NULL) + // in case of NULL end() is returned + return ( (NULL != next_node) + ? list_iterator( next_node ) : end() ); + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist_iterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist_iterator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: list declaration +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANLIST_ITERATOR_H +#define WLANLIST_ITERATOR_H + +#include "algorithm.h" // for operator != + +/** + * list iterator with limited interface + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +template +class list_iterator : public DBase + { + + typedef list_iterator Self; + +public: + + /** + * ctor + * + * @since S60 v3.2 + * @param aElem data to be iterated + */ + explicit list_iterator( T* aElem = NULL ) : iNode( aElem ) {}; + + /** + * dtor + * + * @since S60 v3.2 + */ + virtual ~list_iterator() {}; + + /** + * copy ctor + * + * @since S60 v3.2 + * @param aElem me, myself and I + */ + inline list_iterator( const Self& aElem ); + + /** + * assignment + * + * @since S60 v3.2 + * @param aElem me, myself and I + * @return me, myself and I + */ + inline Self& operator=( const Self& aElem ); + + /** + * operator -> + * + * @since S60 v3.2 + * @return node of the actual element + */ + inline T* operator->(); + + /** + * operator* + * + * @since S60 v3.2 + * @return actual element + */ + inline J& operator*(); + + /** + * operator++ (prefix++) step forward + * + * @since S60 v3.2 + * @return iterator with the new position + */ + inline Self& operator++(); + + /** + * operator-- (prefix--) step backward + * + * @since S60 v3.2 + * @return iterator with the new position + */ + inline Self& operator--(); + + /** + * operator() + * + * @since S60 v3.2 + * @return the one and only node + */ + inline T* operator()(); + + /** + * operator== + * + * @since S60 v3.2 + * @param aObj object to compare against + * @return ETrue upon equal, any other for non equal + */ + inline TBool operator== ( const Self& aObj ) const + { + return ( iNode == (aObj.iNode) ); + } + +private: + + /** + * list node + * Not own. + */ + T* iNode; + + }; + +#include "osalist_iterator.inl" + +#endif // WLANLIST_ITERATOR_H + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist_iterator.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osalist_iterator.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: inline implementation of list_iterator +* +*/ + +/* +* %version: 3 % +*/ + +#include "algorithm.h" // for operator != + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list_iterator::list_iterator( const Self& aElem ) + : iNode( aElem.iNode ) + { + + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list_iterator& list_iterator::operator=( const Self& aElem ) + { + iNode = aElem.iNode; + return *this; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline T* list_iterator::operator->() + { + return iNode; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline J& list_iterator::operator*() + { + return iNode->iElem; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list_iterator& list_iterator::operator++() + { + iNode = iNode->iNext; + return *this; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline list_iterator& list_iterator::operator--() + { + iNode = iNode->iPrev; + return *this; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline T* list_iterator::operator()() + { + return iNode; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osamemorypool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osamemorypool.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanMemoryPool declaration +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANMEMORYPOOL_H +#define WLANMEMORYPOOL_H + +#include "wlanobject.h" + +#include "osaplatformhwchunk.h" +#include "osalist.h" +#include "osahandle.h" + +struct SMemHeader; + +/** + * memory pool for managing memory + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class WlanMemoryPool : public DBase, public WlanObject + { + + typedef Handle HwChunkHandle; + +public: + + /** + * ctor + * NOTE: call IsValid() member from super class + * to validate object after ctor + * + * @since S60 v3.2 + * @param aUseCachedMemory ETrue if cached memory shall be used + * EFalse otherwise + * @param aAllocationUnit allocation unit size for interconnect memory in + * bytes + */ + explicit WlanMemoryPool( TBool aUseCachedMemory, TInt aAllocationUnit ); + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanMemoryPool(); + + /** + * Memory allocation. + * Correct alignment guaranteed + * + * @since S60 v3.2 + * @param aOsaMemoryType memory type to be allocated + * @param aSize size of the buffer to be allocated in bytes. + * Must be positive otherwise the allocation fails + * @param aZeroStamp zero stamp the memory or not + * @return begin of the allocated memory, NULL upon failure + */ + void* Alloc( MWlanOsa::TOsaMemoryType aOsaMemoryType, + TInt aSize, + TBool aZeroStamp ); + + /** + * Releases memory allocated by the Alloc method + * + * @since S60 v3.2 + * @param aPtr begin of the buffer to be freed + */ + void Free( void* aPtr ); + +private: + + /** + * Init pool + * + * @since S60 v3.2 + * @return ETrue upon success any other for failure + */ + TBool InitPool(); + + /** + * Appends hw chunk handle to the back of the list + * + * @since S60 v3.2 + * @param aHwChunkHandle hw chunk handle to be appended + * @return ETrue upon success any other for failure + */ + TBool PushBack( const HwChunkHandle& aHwChunkHandle ); + + /** + * Creates a new hw chunk and allocates memory from it + * + * @since S60 v3.2 + * @param aSize size of the buffer to be allocated in bytes. + * Must be positive otherwise the allocation fails + * @param aHwChunkId unique chunk identifier used when freeing the memory + * @param aZeroStamp zero stamp memory or not + * @return begin of the allocated memory, NULL upon failure + */ + void* HwChunkAllocWithCreate( const TInt aSize, + TInt& aHwChunkId, + TBool aZeroStamp ); + + /** + * Allocates memory from a hw chunk + * + * @since S60 v3.2 + * @param aSize size of the buffer to be allocated in bytes. Must be + * positive otherwise the allocation fails + * @param aHwChunkId unique chunk identifier used when freeing the memory + * @param aZeroStamp zero stamp memory or not + * @return begin of the allocated memory, NULL upon failure + */ + void* HwChunkAlloc( const TInt aSize, TInt& aHwChunkId, TBool aZeroStamp ); + + /** + * Evaluates is a chunk the initial chunk. + * The intial chunk is the one created at object creation time and its + * lifetime is equal to the lifetime of this object itself + * + * @since S60 v3.2 + * @param aChunk chunk to be evaluated against the intial chunk + * @return ETrue when aChunk is the intial chunk, any other if not + */ + inline TBool IsInitialChunk( WlanPlatformHwChunk* aChunk ); + + /** + * Frees memory from a hw chunk + * + * @since S60 v3.2 + * @param aMemHeader begin of the buffer to be freed + */ + void HwChunkFree( SMemHeader& aMemHeader ); + + // Prohibit copy constructor. + WlanMemoryPool( const WlanMemoryPool& ); + // Prohibit assigment operator. + WlanMemoryPool& operator= ( const WlanMemoryPool& ); + +private: // data + + typedef list HwChunkHandleList; + + typedef HwChunkHandleList::iterator iterator; + typedef HwChunkHandleList::const_iterator const_iterator; + typedef HwChunkHandleList::size_type size_type; + + /** + * list of hw chunks + */ + HwChunkHandleList iHwChunkHandles; + + /** + * ETrue if cached memory shall be used, + * EFalse otherwise + */ + TBool iUseCachedMemory; + + /** + * Allocation unit size in bytes + */ + TInt iAllocationUnit; + + /** + * Number of extra bytes required to align interconnect memory buffer + * start address returned to the requester to allocation unit boundary + */ + TInt iExtraPadding; + }; + +#endif // WLANMEMORYPOOL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaplatformhwchunk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaplatformhwchunk.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanPlatformHwChunk declaration +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANPLATFORMHWCHUNK_H +#define WLANPLATFORMHWCHUNK_H + +#include "wlanobject.h" + +class MWlanOsaChunkBase; +struct WlanPlatformHwChunkImpl; + +/** + * platform memory chunk for memory suitable for DMA xfer + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class WlanPlatformHwChunk : public DBase, public WlanObject + { + + friend class WlanPlatformHwChunkImpl; + +public: + + + /** + * ctor + * NOTE: call IsValid() member from super class + * to validate object after ctor + * + * @since S60 v3.2 + * @param aSizeInBytes size of the chunk to be created + * @param aUseCachedMemory ETrue if cached memory shall be used + * EFalse otherwise + * @param aAllocationUnit allocation unit size in bytes + */ + explicit WlanPlatformHwChunk( + TInt aSizeInBytes, + TBool aUseCachedMemory, + TInt aAllocationUnit ); + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanPlatformHwChunk(); + + /** + * Returns the chunk managed + * + * @since S60 v3.2 + * @return the chunk managed + */ + MWlanOsaChunkBase& Chunk(); + + /** + * Returns the chunk managed + * + * @since S60 v3.2 + * @return the chunk managed + */ + const MWlanOsaChunkBase& Chunk() const; + +private: + + /** + * Rounds up memory request size to physical page size + * + * @since S60 v3.2 + * @param size rounded up + */ + static inline TInt RoundToPageSize( TInt aSizeInBytes ); + + /** + * Allocate physical ram + * + * @since S60 v3.2 + * @param aSizeInBytes amount of physical ram to be allocated + * @param aPhysAddr (out) physical address of the memory allocated + * @return ETrue upon success, any other for failure + */ + static inline TBool AllocatePhysicalRam( + TInt aSizeInBytes, TPhysAddr& aPhysAddr ); + + /** + * Frees the physical ram allocated + * + * @since S60 v3.2 + * @param aPhysRamAddr physical address of the memory to be freed + * @param aPhysRamSize size of the physical ram to be freed + */ + static inline void FreePhysicalRam( + TPhysAddr aPhysRamAddr, TInt aPhysRamSize ); + + + /** + * Allocate a hw chunk + * + * @since S60 v3.2 + * @param aPhysRamAddr physical address of the + * memory to be associuated with the chunk + * @param aPhysRamSize size of the memory + * @param aAllocationUnit allocation unit size in bytes + * @return ETrue upon success, any other for failure + */ + inline TBool AllocateHardwareChunk( + TPhysAddr aPhysRamAddr, + TInt aPhysRamSize, + TInt aAllocationUnit ); + + /** + * Extract implementation details + * + * @since S60 v3.2 + * @return implementation details + */ + inline WlanPlatformHwChunkImpl& Pimpl(); + + /** + * Extract implementation details + * + * @since S60 v3.2 + * @return implementation details + */ + inline const WlanPlatformHwChunkImpl& Pimpl() const; + + // deny copying. + WlanPlatformHwChunk( const WlanPlatformHwChunk& ); + + // deny assigment. + WlanPlatformHwChunk& operator= ( const WlanPlatformHwChunk& ); + +private: // data + + /** + * implementation + * Own. + */ + WlanPlatformHwChunkImpl* iPimpl; + + /** + * ETrue if cached memory shall be used, + * EFalse otherwise + */ + TBool iUseCachedMemory; + }; + +#endif // WLANPLATFORMHWCHUNK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osatimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osatimer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanTimer declaration +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANTIMER_H +#define WLANTIMER_H + +#include +#include "wlanobject.h" + +class WlanOsa; + +/** + * concrete timer context object + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class WlanTimer : public MWlanTimer, public WlanObject + { + friend class WlanOsa; + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanTimer(); + + /** + * Constructor. + * + * @since S60 v3.2 + * @param aOsa wlanosa object + * @param aDfcQueue Pointer to the DFC queue to use + */ + explicit WlanTimer( WlanOsa& aOsa, void* aDfcQueue ); + +protected: // from base class MWlanTimer + + /** + * From MWlanTimer. + * Enqueue a timeout for execution. + * Either succeeds or has no effect. + * Calling this method for allready queued timeout has no effect + * + * @since S60 v3.2 + * @param aTimerClient timer client + * @param aCtx context for timer client callback + * @param aTimeoutInMicroSeconds timeout in microseconds + * @param aPeriodic periodic timer or not + */ + virtual void Enqueue( + MWlanTimerClient& aTimerClient, + TInt aCtx, + TInt aTimeoutInMicroSeconds, + TBool aPeriodic ); + + /** + * From MWlanTimer. + * Dequeue a queued timeout. + * Either succeeds or has no effect. + * Calling this method for non queued timeout has no effect + * + * @since S60 v3.2 + */ + virtual void Dequeue(); + +private: + + /** Prohibit copy constructor. */ + WlanTimer( const WlanTimer& ); + + /** Prohibit assigment operator. */ + WlanTimer& operator= ( const WlanTimer& ); + + /** + * timer execution entry + * + * @since S60 v3.2 + */ + static void TimerTrigger( TAny* aPtr ); + + /** + * timer execution entry + */ + void TimerTrigger(); + + /** + * Decrements the reference counter of this object and when all references + * are cleared the object is deleted. + */ + void RefDel(); + + /** + * Incrementes the reference counter. + */ + void RefAdd(); + +private: // data + + /** + * DFC for timer callbacks. + */ + TDfc iTimerDfc; + + /** + * osa object reference + */ + WlanOsa& iOsa; + + /** + * the one and only timer + */ + NTimer iNTimer; + + /** + * timer client callback interface + * Not Own. + */ + MWlanTimerClient* iTimerClient; + + /** + * timeout value + */ + TInt iTimeoutInMicroSeconds; + + /** + * callback context + */ + TInt iCtx; + + /** + * internal state flags + */ + TUint iFlags; + + /** + * reference counter for cleanup + */ + TUint iRefCnt; + + }; + +#endif // WLANTIMER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/osatimer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/osatimer.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanTimer inline implementation +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanTimerImpl& WlanTimer::Pimpl() + { + return *iPimpl; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/wlanobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/wlanobject.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanObject declaration +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANOBJECT_H +#define WLANOBJECT_H + +/** + * base object for every object instance that needs its validy + * checked after constructor call + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class WlanObject + { + +public: + + /** + * checks validy + * + * @since S60 v3.2 + * @return ETrue for valid object any other for invalid object + */ + inline TBool IsValid() const; + +protected: + + /** + * Constructor. + * + * @since S60 v3.2 + */ + WlanObject() : iValid( ETrue ) {}; + + /** + * validates object + * + * @since S60 v3.2 + */ + inline void Validate(); + + /** + * invalidates the object + * + * @since S60 v3.2 + */ + inline void InValidate(); + +private: // data + + /** + * marker to mark is the object valid or not + */ + TBool iValid; + + }; + +#include "wlanobject.inl" + +#endif // WLANOBJECT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/inc/wlanobject.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/inc/wlanobject.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: inline implementation of WlanObject +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool WlanObject::IsValid() const + { + return iValid; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanObject::Validate() + { + iValid = ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanObject::InValidate() + { + iValid = EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/src/osachunk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/src/osachunk.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanChunk implementation +* +*/ + +/* +* %version: 10 % +*/ + +#include "osa_includeme.h" + +#include + +#include "osachunk.h" +#include "osaheap.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanChunk::WlanChunk( + TUint8* aStartOfBuf, + TUint8* aEndOfBuf, + TInt aAllocationUnit ) + { + iHeap = RWlanHeap::FixedHeap( + aStartOfBuf, + aEndOfBuf - aStartOfBuf, + aAllocationUnit ); + + TraceDump(INFO_LEVEL | MEMCHUNK, + (("[WLAN] WlanChunk ctor -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanChunk::~WlanChunk() + { + TraceDump(INFO_LEVEL | MEMCHUNK, + (("[WLAN] WlanChunk dtor +: 0x%08x"), this)); + + TraceDump(INFO_LEVEL | MEMCHUNK, + (("[WLAN] WlanChunk dtor -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void* WlanChunk::Alloc( TInt aSize, TBool aZeroStamp ) + { + TraceDump(INFO_LEVEL | MEMCHUNK | MEMCHUNK_ALLOC, + (("[WLAN] WlanChunk::Alloc + this: 0x%08x"), this)); + TraceDump(MEMCHUNK_ALLOC, + (("[WLAN] allocation request size in bytes: %d"), aSize)); + + TAny* ptr = iHeap->Alloc( aSize ); + + if ( ptr && aZeroStamp ) + { + memset( ptr, 0, aSize ); + } + TraceDump(INFO_LEVEL | MEMCHUNK | MEMCHUNK_ALLOC, + (("[WLAN] WlanChunk::Alloc - this: 0x%08x"), this)); + + return ptr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanChunk::Free( void* aPtr ) + { + iHeap->Free( aPtr ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt WlanChunk::MaxFreeLinkSize() const + { + TraceDump(INFO_LEVEL | MEMCHUNK , + (("[WLAN] WlanChunk::MaxFreeLinkSize +- this: 0x%08x"), this)); + + TInt available; + iHeap->Available( available ); + return available; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanChunk::IsInUse() const + { + TraceDump(INFO_LEVEL | MEMCHUNK , + (("[WLAN] WlanChunk::IsInUse +- this: 0x%08x"), this)); + + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt WlanChunk::HeaderSize() const + { + return RWlanHeap::EAllocCellSize; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/src/osaheap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/src/osaheap.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanHeap implementation +* +*/ + +/* +* %version: 3 % +*/ + +#include +#include +#include "osaheap.h" + +#define __NEXT_CELL(p) ((SCell*)(((TUint8*)p)+p->len)) + +#define __ALIGN_X( _x,_y) (((_x) + ((_y) - 1)) & (~((_y) - 1))) + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +RWlanHeap* RWlanHeap::FixedHeap( + TAny* aBase, + TInt aInitialSize, + TInt aAllocationUnit ) + { + return new(aBase) RWlanHeap(aInitialSize, aAllocationUnit ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +RWlanHeap::RWlanHeap(TInt aMaxLength, TInt aAlign ) + : iMinLength(aMaxLength), iMaxLength(aMaxLength), iOffset(0), iGrowBy(0), iChunkHandle(0) + { + iAlign = aAlign ? aAlign : ECellAlignment; + iPageSize = 0; + Initialise(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* RWlanHeap::operator new(TUint aSize, TAny* aBase) + { + RWlanHeap* h = (RWlanHeap*)aBase; + h->iAlign = 0x80000000; // garbage value + h->iBase = ((TUint8*)aBase) + aSize; + return aBase; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RWlanHeap::Initialise() + { + + // Base address must be aligned to AllocationUnit + iBase = (TUint8*)__ALIGN_X((TUint32)iBase + EAllocCellSize, iAlign ); + TInt b = iBase - ((TUint8*)this - iOffset); + TInt len = _ALIGN_DOWN(iMinLength - b, iAlign); + iTop = iBase + len; + iMinLength = iTop - ((TUint8*)this - iOffset); + + // Min cell size equals to allocationUnit + iMinCell = iAlign; + + SCell* pM = (SCell*)iBase; // First free cell + iFree.next = pM; // Free list points to first free cell + iFree.len = 0; // Stop free from joining this with a free block + pM->next = NULL; // Terminate the free list + pM->len = len; // Set the size of the free cell + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* RWlanHeap::Alloc(TInt aSize) + { + // The size of allocatoted block MUST be aligned to allocationUnit + aSize = Max(__ALIGN_X(aSize + EAllocCellSize, iAlign), iMinCell ); + + SCell* pL = NULL; + SCell* pC = (SCell*)DoAlloc(aSize, pL); + + if (pC) + { + TAny* result = ((TUint8*)pC) + EAllocCellSize; + return result; + } + return NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +UEXPORT_C void RWlanHeap::Free(TAny* aCell) + { + if (!aCell) + { + return; + } + SCell* pC = GetAddress(aCell); + DoFree(pC); + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +UEXPORT_C RWlanHeap::SCell* RWlanHeap::GetAddress(const TAny* aCell) const + { + SCell* pC = (SCell*)(((TUint8*)aCell)-EAllocCellSize); + return pC; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +UEXPORT_C TInt RWlanHeap::AllocLen(const TAny* aCell) const + { + + SCell* pC = GetAddress(aCell); + return pC->len - EAllocCellSize; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +RWlanHeap::SCell* RWlanHeap::DoAlloc(TInt aSize, SCell*& aLastFree) + { + SCell* pP = &iFree; + SCell* pC = pP->next; + for (; pC; pP=pC, pC=pC->next) // Scan the free list + { + SCell* pE; + if (pC->len >= aSize) // Block size bigger than request + { + if (pC->len - aSize < iMinCell) // Leftover must be large enough to hold an SCell + { + aSize = pC->len; // It isn't, so take it all + pE = pC->next; // Set the next field + } + else + { + pE = (SCell*)(((TUint8*)pC)+aSize); // Take amount required + pE->len = pC->len - aSize; // Initialize new free cell + pE->next = pC->next; + } + pP->next = pE; // Update previous pointer + pC->len = aSize; // Set control size word + return pC; + } + } + aLastFree = pP; + return NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RWlanHeap::DoFree(SCell* pC) + { + SCell* pP = &iFree; + SCell* pE = pP->next; + for (; pE && pEnext) {} + if (pE) // Is there a following free cell? + { + SCell* pN = __NEXT_CELL(pC); + if (pN==pE) // Is it adjacent + { + pC->len += pE->len; // Yes - coalesce adjacent free cells + pC->next = pE->next; + } + else // pNnext = pE; // Otherwise just point to it + } + } + else + { + pC->next = NULL; // No following free cell + } + SCell* pN = __NEXT_CELL(pP); // pN=pP=&iFree if no preceding free cell + if (pN==pC) // Is it adjacent + { + pP->len += pC->len; // Yes - coalesce adjacent free cells + pP->next = pC->next; + pC = pP; // for size reduction check + } + else // pNnext = pC; // point previous cell to the one being freed + } + pN = __NEXT_CELL(pC); // End of amalgamated free cell + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RWlanHeap::FindFollowingFreeCell(SCell* aCell, SCell*& aPrev, SCell*& aNext) + { + aPrev = &iFree; + aNext = aPrev->next; + for (; aNext && aNext < aCell; aPrev = aNext, aNext = aNext->next ) {} + + if (aNext) // If there is a following free cell, check its directly after aCell. + { + SCell* pNextCell = __NEXT_CELL(aCell); // end of this cell + if (pNextCell!= aNext) + { + aNext = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt RWlanHeap::TryToGrowCell(SCell* aCell,SCell* aPrev, SCell* aNext, TInt aSize) + { + TInt extra = aSize - aCell->len; + if (aNext && (aNext->len >= extra)) // Is there a following free cell big enough? + { + if (aNext->len - extra >= iMinCell) // take part of free cell ? + { + SCell* pX = (SCell*)((TUint8*)aNext + extra); // remainder of free cell + pX->next = aNext->next; // remainder->next = original free cell->next + pX->len = aNext->len - extra; // remainder length = original free cell length - extra + aPrev->next = pX; // put remainder into free chain + } + else + { + extra = aNext->len; // Take whole free cell + aPrev->next = aNext->next; // remove from free chain + } + + aCell->len += extra; // update reallocated cell length + + return KErrNone; + } + return KErrGeneral; // No space to grow cell + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt RWlanHeap::Available(TInt& aBiggestBlock) const + { + + TInt total = 0; + TInt max = 0; + SCell* pC = iFree.next; + for (; pC; pC=pC->next) + { + TInt l = pC->len - EAllocCellSize; + if (l > max) + { + max = l; + } + total += l; + } + aBiggestBlock = max; + return total; + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/osa_common/src/osamemorypool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/osa_common/src/osamemorypool.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,600 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanMemoryPool implementation +* +*/ + +/* +* %version: 8 % +*/ + +#include "osa_includeme.h" + +#include + +#include "osamemorypool.h" +#include "osachunkbase.h" + +// allocator for general purpose memory +extern void* GpAlloc( TInt aSize, TBool aZeroStamp ); +// free for general purpose memory +extern void GpFree( void* aPtr ); + +// don't derive form DBase as we use placement new +struct SMemHeader + { +#ifndef NDEBUG + enum { KMagic = 0xBEEFCACE }; + TInt iMagicHead; +#endif // !NDEBUG + + TInt iHwChunkId; + + explicit SMemHeader( TInt aHwChunkId = 0 ) : + #ifndef NDEBUG + iMagicHead( KMagic ), + #endif // NDEBUG + iHwChunkId( aHwChunkId ) + {}; + +private: + + // Prohibit copy constructor. + SMemHeader( const SMemHeader& ); + // Prohibit assigment operator. + SMemHeader& operator= ( const SMemHeader& ); + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanMemoryPool::WlanMemoryPool( TBool aUseCachedMemory, TInt aAllocationUnit ) + : + iUseCachedMemory( aUseCachedMemory ), + iAllocationUnit( aAllocationUnit ), + iExtraPadding( 0 ) // actual value is determined later + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool ctor +: 0x%08x"), this)); + + const TBool ret( InitPool() ); + if ( ret ) + { + Validate(); + } + else + { + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + InValidate(); + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool ctor -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanMemoryPool::~WlanMemoryPool() + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool dtor +: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void* WlanMemoryPool::Alloc( + MWlanOsa::TOsaMemoryType aOsaMemoryType, + TInt aSize, + TBool aZeroStamp ) + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::Alloc +: 0x%08x"), this)); + TraceDump(MEMORYPOOL, (("[WLAN] memory type: %d"), aOsaMemoryType)); + TraceDump(MEMORYPOOL, (("[WLAN] size: %d"), aSize)); + + TUint8* addr = NULL; + + // length of our memory header + const TInt KOurHdrLen ( sizeof( SMemHeader ) ); + // actual size is the requested size + our header + TInt alloc_size ( aSize + KOurHdrLen ); + + if ( MWlanOsa::ENormalMemory == aOsaMemoryType ) + { + // normal allocation requested + + addr = static_cast(GpAlloc( alloc_size, aZeroStamp )); + if ( addr ) + { + // set header + new (addr) SMemHeader; + // set the address to be returned to the requester + addr += KOurHdrLen; + } + else + { + // failed: left intentionally empty + } + } + else if ( MWlanOsa::EInterconnectMemory == aOsaMemoryType ) + { + // hw pool allocation requested + + // in this case we need to make sure that the memory buffer start + // address returned to the requester is aligned to allocation unit + // boundary. We do this by adding the necessary number of padding + // bytes to the beginning of the allocated memory buffer + + alloc_size += iExtraPadding; + + TInt hw_chunk_id( 0 ); + addr = static_cast(HwChunkAlloc( + alloc_size, hw_chunk_id, aZeroStamp )); + if ( addr ) + { + // set header. The extra padding is before our header + new (addr + iExtraPadding) SMemHeader( hw_chunk_id ); + // set the address to be returned to the requester + addr += iExtraPadding + KOurHdrLen; + } + else + { + // failed: left intentionally empty + } + } + else + { + // unknown type + TraceDump(CRIT_LEVEL, (("[WLAN] critical: type: %d"), aOsaMemoryType)); + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + if ( addr ) + { + TraceDump(MEMORYPOOL, + (("[WLAN] address to be returned to client: 0x%08x"), addr)); + } + else + { + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::Alloc -: 0x%08x"), this)); + + return addr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMemoryPool::Free( void* aPtr ) + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::Free +: 0x%08x"), this)); + TraceDump(MEMORYPOOL, (("[WLAN] free address: 0x%08x"), aPtr)); + + SMemHeader* hdr = ((static_cast(aPtr)) - 1); + + TraceDump(MEMORYPOOL, (("[WLAN] header free address: 0x%08x"), hdr)); + +#ifndef NDEBUG + // validate magic + MWlanOsa::Assert( reinterpret_cast(WLAN_FILE), __LINE__, + (SMemHeader::KMagic == hdr->iMagicHead) ); +#endif // !NDEBUG + + if ( !(hdr->iHwChunkId) ) + { + GpFree( static_cast(hdr) ); + } + else + { + HwChunkFree( *hdr ); + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::Free -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanMemoryPool::InitPool() + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::InitPool +: 0x%08x"), this)); + + TBool ret( EFalse ); + + // create the initial hw chunk + WlanPlatformHwChunk* chunk = new WlanPlatformHwChunk( + KInitialHwChunkSize, + iUseCachedMemory, + iAllocationUnit ); + if ( chunk ) + { + if ( chunk->IsValid() ) + { + // chunk is valid + HwChunkHandle handle( *chunk ); + if ( handle->IsValid() ) + { + // handle is valid + ret = PushBack( handle ); + if ( ret ) + { + // push success + ret = ETrue; + + // determine the number of extra padding bytes needed on + // top of our memory header length for interconnect + // memory type so that the memory buffer start address + // returned to memory requester is always aligned to + // allocation unit boundary + + const TInt KNextLevelHdrLen = + (handle->Chunk()).HeaderSize(); + const TInt KRemainder ( + ( static_cast(sizeof( SMemHeader )) + + KNextLevelHdrLen ) + % iAllocationUnit ); + iExtraPadding = KRemainder ? + ( iAllocationUnit - KRemainder ) : KRemainder; + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] Extra padding: %d"), iExtraPadding)); + } + else + { + // push failure: left intentionally empty + } + } + else + { + // handle is invalid: left intentionally empty + } + } + else + { + // chunk is invalid: left intentionally empty + } + } + else + { + // allocation failure: left intentionally empty + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + if ( !ret ) + { + // something went wrong + delete chunk; + } + else + { + // left intentionally empty + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::InitPool -: 0x%08x"), this)); + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanMemoryPool::PushBack( const HwChunkHandle& aHwChunkHandle ) + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::PushBack +: 0x%08x"), this)); + + TBool ret( EFalse ); + const size_type size( iHwChunkHandles.size() ); + + iHwChunkHandles.push_back( aHwChunkHandle ); + if ( size != iHwChunkHandles.size() ) + { + // size difference prior and after push + // so it must have been a success + ret = ETrue; + } + else + { + // push failure :left intentionally empty + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::PushBack -: 0x%08x"), this)); + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void* WlanMemoryPool::HwChunkAllocWithCreate( const TInt aSize, + TInt& aHwChunkId, + TBool aZeroStamp ) + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::HwChunkAlloc +: 0x%08x"), this)); + + // initial allocation try is times 1.4 the requested size + const TInt KInitialAllocSize( (aSize * 14) / 10 ); + // try initial allocation amount + the requested amount times + const TInt KAllocationCounts( 2 ); + + const TInt allocation_size[KAllocationCounts] + = { KInitialAllocSize, aSize }; + + const TInt* pos = allocation_size; // start of sequence + // last of sequence + const TInt* const end = &( allocation_size[KAllocationCounts] ); + + WlanPlatformHwChunk* chunk = NULL; + + // loop in order to acquire a chunk for us + do + { + chunk = new WlanPlatformHwChunk( + *pos, + iUseCachedMemory, + iAllocationUnit ); + if ( chunk ) + { + if ( chunk->IsValid() ) + { + // ok + break; + } + else + { + // invalid chunk: + delete chunk; + chunk = NULL; + } + } + else + { + // allocation failure: left intentionally empty + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + ++pos; + } while ( pos < end ); + + void* addr = NULL; + + if ( chunk ) + { + // chunk acquire success + // must also be valid at this point + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + (chunk->IsValid()) ); + + HwChunkHandle handle( *chunk ); + if ( handle.IsValid() ) + { + if ( PushBack( handle ) ) + { + // allocation guaranteed as + // chunk final creation success + addr = chunk->Chunk().Alloc( + aSize, aZeroStamp ); + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + addr != NULL ); + + // set he hw chunk id for the caller + aHwChunkId = reinterpret_cast(chunk); + } + else + { + // PushBack failure: left intentionally empty + } + } + else + { + // invalid handle: left intentionally empty + } + + if ( !addr ) + { + // if we don't have an address at this point + // we don't need a chunk either + delete chunk; + } + else + { + // everything okay: left intentionally empty + } + } + else + { + // chunk acquire failure: left intentionally empty + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::HwChunkAlloc -: 0x%08x"), this)); + + return addr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void* WlanMemoryPool::HwChunkAlloc( const TInt aSize, + TInt& aHwChunkId, + TBool aZeroStamp ) + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::HwChunkAlloc +: 0x%08x"), this)); + + // lets search a chunk for us + const_iterator end( iHwChunkHandles.end() ); + iterator pos( iHwChunkHandles.begin() ); + + void* addr = NULL; + + // always atleast one exists in the sequence + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + (!(iHwChunkHandles.empty())) ); + + do + { + addr = ((*pos)->Chunk()).Alloc( aSize, aZeroStamp ); + if ( addr ) + { + break; + } + else + { + // left intentionally empty + } + + ++pos; + } while ( pos != end ); + + if ( addr ) + { + // allocation success: + // set the hw chunk id + aHwChunkId = reinterpret_cast((*pos).Data()); + } + else + { + // failed to allocate + // we shall now create a new chunk for allocation + addr = HwChunkAllocWithCreate( aSize, aHwChunkId, aZeroStamp ); + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::HwChunkAlloc -: 0x%08x"), this)); + + return addr; + } + +// --------------------------------------------------------------------------- +// in the front of the sequence we always have our initial chunk, +// the lifetime of which is to be equal to the lifetime of this object +// --------------------------------------------------------------------------- +// +inline +TBool WlanMemoryPool::IsInitialChunk( WlanPlatformHwChunk* aChunk ) + { + return ( aChunk == (iHwChunkHandles.front().Data()) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMemoryPool::HwChunkFree( SMemHeader& aMemHeader ) + { + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::HwChunkFree +: 0x%08x"), this)); + + // extract correct hw_chunk + WlanPlatformHwChunk* hw_chunk + = reinterpret_cast(aMemHeader.iHwChunkId); + + // deallocate; note the extra padding before our memory header + hw_chunk->Chunk().Free( + reinterpret_cast(&aMemHeader) - iExtraPadding ); + + if ( IsInitialChunk( hw_chunk ) ) + { + // is the initial chunk: left intentionally empty + } + else + { + + // not the initial chunk + if ( !(hw_chunk->Chunk().IsInUse()) ) + { + // the chunk is not inuse, this meaning nothing + // has been allocated from there, which means we can erase it + + TraceDump(MEMORYPOOL, ("[WLAN] WlanMemoryPool erase unused chunk")); + + // lets found the critter and erase it from the sequnce + + iterator pos( iHwChunkHandles.begin() ); + const_iterator end( iHwChunkHandles.end() ); + + // always atleast one exists in the sequence + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + (!(iHwChunkHandles.empty())) ); + + do + { + if ( ((*pos).Data()) == hw_chunk ) + { + // found a match + break; + } + else + { + // no match: left intentionally empty + } + + ++pos; + } while ( pos != end ); + + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + (pos != end) ); + + // erase the critter + iHwChunkHandles.erase( pos ); + + } + else + { + // the chunk is in use + // left intentionally empty + } + } + + TraceDump(INFO_LEVEL | MEMORYPOOL, + (("[WLAN] WlanMemoryPool::HwChunkFree -: 0x%08x"), this)); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/802dot11.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/802dot11.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,5973 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file mainly for 802.11 specific declarations and +* definitions. +* +*/ + +/* +* %version: 44 % +*/ + +#ifndef WLAN802DOT11_H +#define WLAN802DOT11_H + +#include "umac_types.h" +// for copy, equal and operator != support +#include "algorithm.h" +#include "pack.h" + +/** + * Returns a TUint16 host byte order value in WLAN MAC layer byte order + * (LSB first) + * + * @since S60 3.1 + * @param aNw value in network byte order + * @return value in host byte order + */ +extern TUint16 os_Hton( TUint16 aHost ); + +/** + * Returns a TUint16 WLAN MAC layer byte order (LSB first) value in host byte + * order + * + * @since S60 3.1 + * @param aNw value in network byte order + * @return value in host byte order + */ +extern TUint16 os_Ntoh( TUint16 aNw ); + +/** + * Returns a TUint32 host byte order value in WLAN MAC layer byte order + * (LSB first) + * + * @param aNw value in network byte order + * @return value in host byte order + */ +extern TUint32 os_H32ton( TUint32 aHost ); + +/** + * Returns a TUint32 WLAN MAC layer byte order (LSB first) value in host byte + * order + * + * @param aNw value in network byte order + * @return value in host byte order + */ +extern TUint32 os_N32toh( TUint32 aNw ); + +/** + * Allows also unaligned reading of a TUint16 WLAN MAC layer byte order + * (LSB first) value and returns the result in the byte order which + * is in use in the host + * + * @since S60 3.1 + * @param aNwSource where to read the WLAN MAC layer byte order value from + * @return the value which was read, in host byte order + */ +#ifdef __ARMCC_VERSION +/* Use the __packed qualifier for ARM compilations */ +inline TUint16 ReadUint16Toh( const __packed TUint16* aNwSource ) +#else +inline TUint16 ReadUint16Toh( const TUint16* aNwSource ) +#endif + { + const TUint16 loByte ( static_cast( + ( reinterpret_cast(aNwSource) )[0] ) ); + + const TUint16 hiByte ( static_cast( + ( reinterpret_cast(aNwSource) )[1] ) << 8 ); + + return ( os_Ntoh( loByte | hiByte ) ); + } + +/** + * Allows also unaligned writing of a TUint16 host byte order value + * into WLAN MAC layer byte order + * + * @since S60 3.1 + * @param aNwTarget where to write the WLAN MAC layer byte order value to + * @param aHostValue the host byte order value to be written + */ +#ifdef __ARMCC_VERSION +/* Use the __packed qualifier for ARM compilations */ +inline void WriteHtoUint16( __packed TUint16* aNwTarget, TUint16 aHostValue ) +#else +inline void WriteHtoUint16( TUint16* aNwTarget, TUint16 aHostValue ) +#endif + { + TUint16 nwValue = os_Hton( aHostValue ); + reinterpret_cast(aNwTarget)[0] = + ( reinterpret_cast(&nwValue) )[0]; + reinterpret_cast(aNwTarget)[1] = + ( reinterpret_cast(&nwValue) )[1]; + } + +/** + * Allows also unaligned reading of a TUint32 WLAN MAC layer byte order + * (LSB first) value and returns the result in the byte order which + * is in use in the host + * + * @param aNwSource where to read the WLAN MAC layer byte order value from + * @return the value which was read, in host byte order + */ +#ifdef __ARMCC_VERSION +/* Use the __packed qualifier for ARM compilations */ +inline TUint32 ReadUint32Toh( const __packed TUint32* aNwSource ) +#else +inline TUint32 ReadUint32Toh( const TUint32* aNwSource ) +#endif + { + const TUint32 byte0 ( static_cast( + ( reinterpret_cast(aNwSource) )[0] ) ); + + const TUint32 byte1 ( static_cast( + ( reinterpret_cast(aNwSource) )[1] ) << 8 ); + + const TUint32 byte2 ( static_cast( + ( reinterpret_cast(aNwSource) )[2] ) << 16 ); + + const TUint32 byte3 ( static_cast( + ( reinterpret_cast(aNwSource) )[3] ) << 24 ); + + return ( os_N32toh( byte0 | byte1 | byte2 | byte3 ) ); + } + +/** + * Allows also unaligned writing of a TUint32 host byte order value + * into WLAN MAC layer byte order + * + * @param aNwTarget where to write the WLAN MAC layer byte order value to + * @param aHostValue the host byte order value to be written + */ +#ifdef __ARMCC_VERSION +/* Use the __packed qualifier for ARM compilations */ +inline void WriteHtoUint32( __packed TUint32* aNwTarget, TUint32 aHostValue ) +#else +inline void WriteHtoUint32( TUint32* aNwTarget, TUint32 aHostValue ) +#endif + { + TUint32 nwValue = os_H32ton( aHostValue ); + reinterpret_cast(aNwTarget)[0] = + ( reinterpret_cast(&nwValue) )[0]; + reinterpret_cast(aNwTarget)[1] = + ( reinterpret_cast(&nwValue) )[1]; + reinterpret_cast(aNwTarget)[2] = + ( reinterpret_cast(&nwValue) )[2]; + reinterpret_cast(aNwTarget)[3] = + ( reinterpret_cast(&nwValue) )[3]; + } + +/** + * Reverses the byte order of a TUint16 value + * + * @since S60 3.1 + * @param aOriginal value whose byte order is to be reversed + * @return the input parameter in reversed byte order + */ +inline TUint16 ReverseUint16( TUint16 aOriginal ) + { + return ( ( aOriginal >> 8 ) | ( aOriginal << 8 ) ); + } + + +/** +* A measurement of time equal to 1024 µs. +*/ +const TUint16 KTU = 1024; + +/** +* Length of MAC header +*/ +const TUint8 KMacHeaderLength = 24; + +/** +* Length of QoS MAC header +*/ +const TUint8 KQoSMacHeaderLength = 26; + +/** +* Length of HT Control field in bytes +*/ +const TUint32 KHtControlFieldLength = 4; + +/** +* Length of QoS MAC header with HT Control field in bytes +*/ +const TUint8 KHtQoSMacHeaderLength = + KQoSMacHeaderLength + KHtControlFieldLength; + +/** +* Maximum number of 802.11b supported rates +* 1, 2, 5.5, 11 MBit/s +*/ +const TUint8 KMaxNumberOfDot11bRates = 4; + +/** +* Maximum number of actual supported rate elements in +* supported rates information element +*/ +const TUint8 KMaxNumberOfRates = 8; + +/** +* Maximum number of actual 802.11 supported rate elements in +* extended supported rates information element +*/ +const TUint8 KMaxNumberOfExtendedRates = 255; + +/** +* Maximum number of 802.11b plus 802.11g supported rates +*/ +const TUint8 KMaxNumberOfDot11bAndgRates = 14; + +/** +* Bit mask for checking is supported rate element +* part of BSS Basic Rate Set (MSB bit is set) +*/ +const TUint8 KBasicRateMask = 0x80; + +/** +* Maximum length for a WEP key in BYTES +*/ +const TUint32 KMaxWEPKeyLength = 29; // 232 bits + +/** +* Length of TKIP key; +*/ +const TUint8 KTKIPKeyLength = 16; + +/** +* Length of WEP Init.Vector in BYTES +*/ +const TUint8 KWepIVLength = 4; + +/** +* Length of WEP ICV in BYTES +*/ +const TUint8 KWEPICVLength = 4; + +/** +* Length of Extended IV field in bytes. +*/ +const TUint8 KWepExtendedIVLength = 4; + +/** +* Length of CCMP header in bytes. +*/ +const TUint8 KCcmpHeaderLength = 8; + +/** +* Length of WAPI header in bytes. +*/ +const TUint8 KWapiHeaderLength = 18; + +/** +* Length of WAPI MIC in bytes. +*/ +const TUint8 KWapiMicLength = 16; + +/** +* Mask to determine is Ext IV bit up in WEP IV +*/ +const TUint32 KWepExtendedIvMask = 0x20000000; + +/** +* Mask for Use Protection bit in ERP Information IE +*/ +const TUint8 KUseProtectionMask = 0x02; + +/** +* Length of MIC in BYTEs +*/ +const TUint8 KMicLength = 8; + +/** +* Length of the MIC key in BYTEs +*/ +const TUint8 KMicKeyLength = 8; + +/** +* Length of ID and Length fields of an information element. +*/ +const TUint8 KInfoElementHeaderLength = 2; + +/** +* Length of the challenge text in BYTES used in shared key authentication +*/ +const TUint8 KChallengeTextLength = 128; + +/** +* Ethernet header type field identifier for Bounce type packet +*/ +const TUint16 KBounceType = 0x8013; + +/** +* Ethernet header type field identifier for EAPOL type packet (IEEE 802.1X) +*/ +const TUint16 KEapolType = 0x888E; + +/** +* Ethernet header type field identifier for WAPI authentication, i.e. WAI, +* type packet +*/ +const TUint16 KWaiType = 0x88B4; + +/** +* Ethernet header type field identifier for IP type packet +*/ +const TUint16 KIpType = 0x0800; + +/** +* Ethernet header type field identifier for IPv6 type packet +*/ +const TUint16 KIpv6Type = 0x86DD; + +/** +* Ethernet header type field identifier for ARP type packet +*/ +const TUint16 KArpType = 0x0806; + +/** +* Length of OUI field in SNAP header +*/ +const TUint8 KOIULength = 3; + +/** +* Maximum length of 802.11 MSDU in bytes +*/ +const TUint16 KMaxDot11MsduLength = 2304; + +/** +* Maximum length of 802.11 A-MSDU in bytes +*/ +const TUint16 KMaxDot11AmsduLength = 7935; + +/** +* Length of trailing FCS in bytes +*/ +const TUint32 KFcsLength = 4; + +/** +* Maximum length in bytes of security encapsulation header in a +* 802.11 MPDU +*/ +const TUint16 KMaxDot11SecurityHeaderLength = KWapiHeaderLength; // 18 + +/** +* Maximum length in bytes of security encapsulation trailer in a +* 802.11 MPDU +*/ +const TUint16 KMaxDot11SecurityTrailerLength = KWapiMicLength; // 16 + +/** +* Maximum length in bytes of security encapsulation header and trailer in a +* 802.11 MPDU +*/ +const TUint16 KMaxDot11SecurityEncapsulationLength = // 34 + KMaxDot11SecurityHeaderLength + // 18 + KMaxDot11SecurityTrailerLength; // 16 + +/** +* Maximum length of 802.11 MPDU we will receive. +* This excludes the tailing FCS ( HW strips it ) +* and Address4 field in the MPDU header +* ( AP-to-AP mode frames are filtered out ) +*/ +const TUint16 KMaxDot11RxMpduLength = // 7999 + KHtQoSMacHeaderLength + // 30 + KMaxDot11SecurityEncapsulationLength + // 34 + KMaxDot11AmsduLength; // 7935 + +/** +* Maximum length of 802.11 MPDU we will transmit. +* This excludes the tailing FCS ( HW strips it ) +* and Address4 field in the MPDU header +* ( AP-to-AP mode frames are filtered out ) +* Additionally we don't currently support A-MSDU Tx +*/ +const TUint16 KMaxDot11TxMpduLength = // 2368 + KHtQoSMacHeaderLength + // 30 + KMaxDot11SecurityEncapsulationLength + // 34 + KMaxDot11MsduLength; // 2304 + +/** +* Maximum length of ethernet frame +*/ +const TUint16 KMaxEthernetFrameLength = 1514; + +/** +* Maximum value in ethernet length field +*/ +const TUint16 KMaxEthernetLengthFieldvalue = 1500; + +/** +* Length of the TKIP key in BYTEs +*/ +const TUint8 KTkIpKeyLength = 16; + +/** +* Length of IPv4 address field in BYTEs +*/ +const TUint8 KIpv4AddrLength = 4; + +/** +* Length of the priority field used in WPA MIC calculation +*/ +const TUint32 KWpaPriorityVecLen = 4; + +/** +* WPA priority field used in MIC calculation +*/ +const TUint8 KWpaPriorityVec[KWpaPriorityVecLen] = {0,0,0,0}; + +/** +* Mask for frame type for frame control field. +*/ +const TUint32 K802Dot11FrameTypeMask = 0xFFFF; + +/** +* Mask to determine if U-APSD bit is up in QoS info field of WMM IE +*/ +const TUint8 KUapsdQosInfoMask = 0x80; + +/** +* Mask for parameter set count in QoS info field of WMM IE +*/ +const TUint8 KParamSetCountQosInfoMask = 0x0F; + +/** +* Length of WMM Information Element +*/ +const TUint8 KWmmInfoElemLen = 7; + +/** +* Length of OUI field in Information Elements +*/ +const TUint8 KIeOuiLength = 3; + +typedef TUint8 TIeOui[KIeOuiLength]; + +/** +* OUI value of WMM Information Element and +* WMM Parameter Element +*/ +const TIeOui KWmmElemOui = { 0x00, 0x50, 0xF2 }; + +/** +* OUI Type value of WMM Information Element and +* WMM Parameter Element +*/ +const TUint8 KWmmElemOuiType = 2; + +/** +* OUI Subtype value of WMM Information Element +*/ +const TUint8 KWmmInfoElemOuiSubType = 0; + +/** +* OUI Subtype value of WMM Parameter Element +*/ +const TUint8 KWmmParamElemOuiSubtype = 1; + +/** +* Version of WMM Information Element +*/ +const TUint8 KWmmInfoElemVersion = 1; + +/** +* Version of WMM Parameter Element +*/ +const TUint8 KWmmParamElemVersion = 1; + +/** +* AC flags in QoS info field of WMM IE +* When a flag is set the corresponding AC is both trigger and delivery enabled +*/ +enum TQosInfoUapsdFlag + { + EAcVoUapsdFlag = 0x01, // Voice + EAcViUapsdFlag = 0x02, // Video + EAcBkUapsdFlag = 0x04, // Background + EAcBeUapsdFlag = 0x08 // Best Effort + }; + + +/** +* Maximum U-APSD Service Period length. Indicates the max number of MSDUs and +* MMPDUs the WMM AP may deliver to a WMM STA during any service period +* triggered by the WMM STA. +*/ +enum TQosInfoUapsdMaxSpLen + { + EMaxSpLenAllFrames = 0x00, + EMaxSpLenTwoFrames = 0x20, + EMaxSpLenFourFrames = 0x40, + EMaxSpLenSixFrames = 0x60 + }; + +const TUint8 K802Dot11AccessCategoryMask = 0x60; + +/** +* WMM Access Categories +*/ +enum TWmmAccessCategory + { + EAcBestEffort = 0x00, + EAcBackground = 0x20, + EAcVideo = 0x40, + EAcVoice = 0x60 + }; + +/** +* Number of WMM Access Categories +*/ +const TUint8 KNumOfWmmACs = 4; + +/** +* Mask for the Admission Control Mandatory flag +* in ACI/AIFSN field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmAdmissionCtrlMandatoryMask = 0x10; + +/** +* Mask for the AIFSN subfiled +* in ACI/AIFSN field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmAifsnMask = 0x0F; + +/** +* Mask for the ECWmin field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmEcwMinMask = 0x0F; + +/** +* Mask for the ECWmax field +* of AC parameter Record +* of WMM Parameter Element +*/ +const TUint8 KWmmEcwMaxMask = 0xF0; + +/** +* 802.11 Authentication sequence numbers +*/ +enum T802Dot11AuthenticationSeqNmbr + { + E802Dot11AuthenticationSeqNmbr1 = 1, + E802Dot11AuthenticationSeqNmbr2 = 2, + E802Dot11AuthenticationSeqNmbr3 = 3, + E802Dot11AuthenticationSeqNmbr4 = 4 + }; + +/** +* 802.11 supported rate bytes. Used e.g. in Beacon frames. +*/ +enum T802Dot11SupportedRate + { + E802Dot11Rate1MBit = 2, + E802Dot11Rate2MBit = 4, + E802Dot11Rate5p5MBit = 11, + E802Dot11Rate6MBit = 12, + E802Dot11Rate9MBit = 18, + E802Dot11Rate11MBit = 22, + E802Dot11Rate12MBit = 24, + E802Dot11Rate18MBit = 36, + E802Dot11Rate22MBit = 44, + E802Dot11Rate24MBit = 48, + E802Dot11Rate33MBit = 66, + E802Dot11Rate36MBit = 72, + E802Dot11Rate48MBit = 96, + E802Dot11Rate54MBit = 108 + }; + +/** +* Management frame information element IDs. +*/ +enum T802Dot11InformationElementID + { + E802Dot11SsidIE = 0, + E802Dot11SupportedRatesIE = 1, + E802Doi11FhParameterSetIE = 2, + E802Dot11DsParameterSetIE = 3, + E802Dot11CfParameterSetIE = 4, + E802Dot11TimIE = 5, + E802Dot11IbssParameterSetIE = 6, + E802Dot11CountryIE = 7, + E802Dot11HoppingPatternParamIE = 8, + E802Dot11HoppingPatternTableIE = 9, + E802Dot11RequestIE = 10, + + E802Dot11ChallengeTextIE = 16, + // Reserved for challenge text extension 17 - 31 + E802Dot11ErpInformationIE = 42, + E802Dot11HtCapabilitiesIE = 45, + E802Dot11ExtendedRatesIE = 50, + E802Dot11HtOperationIE = 61, + E802Dot11VendorSpecificIE = 221 + }; + +/** +* Bit masks for bit fields ín Frame Control field. +*/ +enum T802Dot11FrameControlBitMask + { + E802Dot11FrameControlProtVersionMask= 0x0003, + E802Dot11FrameControlTypeMask = 0x000C, + E802Dot11FrameControlSubtypeMask = 0x00F0, + E802Dot11FrameControlToDsMask = 0x0100, + E802Dot11FrameControlFromDsMask = 0x0200, + E802Dot11FrameControlMoreFragMask = 0x0400, + E802Dot11FrameControlRetryMask = 0x0800, + E802Dot11FrameControlPowerMgmtMask = 0x1000, + E802Dot11FrameControlMoreDataMask = 0x2000, + E802Dot11FrameControlWepMask = 0x4000, + E802Dot11FrameControlOrderMask = 0x8000 + }; + +/** +* Frame Control field type masks. +*/ +enum T802Dot11FrameControlBasicTypeMask +{ + E802Dot11FrameBasicTypeManagement = 0x00, + E802Dot11FrameBasicTypeControl = 0x04, + E802Dot11FrameBasicTypeData = 0x08 +}; + +/** +* Frame Control field subtype masks. +*/ +enum T802Dot11FrameControlTypeMask + { + E802Dot11FrameTypeAssociationReq = 0x00, + E802Dot11FrameTypeAssociationResp = 0x10, + E802Dot11FrameTypeReassociationReq = 0x20, + E802Dot11FrameTypeReassociationResp = 0x30, + E802Dot11FrameTypeProbeReq = 0x40, + E802Dot11FrameTypeProbeResp = 0x50, + E802Dot11FrameTypeBeacon = 0x80, + E802Dot11FrameTypeAtim = 0x90, + E802Dot11FrameTypeDisassociation = 0xA0, + E802Dot11FrameTypeAuthentication = 0xB0, + E802Dot11FrameTypeDeauthentication = 0xC0, + E802Dot11FrameTypePowerSavePoll = 0xA4, + E802Dot11FrameTypeReqToSend = 0xB4, + E802Dot11FrameTypeClearToSend = 0xC4, + E802Dot11FrameTypeAcknowledgement = 0xD4, + E802Dot11FrameTypeCfEnd = 0xE4, + E802Dot11FrameTypeCfEndCfAck = 0xF4, + E802Dot11FrameTypeData = 0x08, + E802Dot11FrameTypeDataCfAck = 0x18, + E802Dot11FrameTypeDataCfPoll = 0x28, + E802Dot11FrameTypeDataCfAckCfPoll = 0x38, + E802Dot11FrameTypeDataNull = 0x48, + E802Dot11FrameTypeCfAckNoData = 0x58, + E802Dot11FrameTypeCfPollNoData = 0x68, + E802Dot11FrameTypeCfAckCfPollNoData = 0x78, + E802Dot11FrameTypeQosData = 0x88, + E802Dot11FrameTypeQosDataCfAck = 0x98, + E802Dot11FrameTypeQosDataCfPoll = 0xA8, + E802Dot11FrameTypeQosDataCfAckCfPoll = 0xB8, + E802Dot11FrameTypeQosDataNull = 0xC8, + E802Dot11FrameTypeManagementAction = 0xD0, + + // not valid 802.11 types. + // just used at Tx completion to distinguish separate cases + E802Dot11FrameTypeAuthSeqNmbr1 = 0xFD, + E802Dot11FrameTypeAuthSeqNmbr3 = 0xFE, + E802Dot11FrameTypeDataEapol = 0xFF, + E802Dot11FrameTypeTestFrame = 0xFFFF + }; + +/** +* Bit masks for Capability Information field. +*/ +enum T802Dot11CapabilityBitMask + { + E802Dot11CapabilityEssMask = 0x0001, + E802Dot11CapabilityIbssMask = 0x0002, + E802Dot11CapabilityCfPollableMask = 0x0004, + E802Dot11CapabilityCfPollRequestMask= 0x0008, + E802Dot11CapabilityPrivacyMask = 0x0010, + // these little critters are from 802.11b spec + E802Dot11ShortPreambleMask = 0x0020, + E802Dot11PbccMask = 0x0040, + E802Dot11ChannelAgilityMask = 0x0080, + E802Dot11ShortSlotTimeMask = 0x0400, + E802Dot11RadioMeasurementMask = 0x1000 + }; + +/** +* Supported authentication modes +*/ +const TUint16 K802Dot11AuthModeOpen = 0; +const TUint16 K802Dot11AuthModeShared = 1; + +/** +* 802.11 status codes +*/ +enum T802Dot11ManagementStatusCode + { + E802Dot11StatusSuccess = 0, + E802Dot11StatusUnspecifiedFailure = 1, + // 2 -9 reserved + E802Dot11StatusUnsupportedCapabilities = 10, + E802Dot11StatusReAssociationDenied = 11, + E802Dot11StatusAssocDenied = 12, + E802Dot11StatusAuthAlgorithmNotSupported = 13, + E802Dot11StatusAuthFrameOutOfSequence = 14, + E802Dot11StatusChallengeFailure = 15, + E802Dot11StatusAuthRejectedTimeout = 16, + E802Dot11StatusAssocDeniedApFull = 17, + E802Dot11StatusAssocDeniedBasicRatesUnSupp = 18, + // following three little critters are from 802.11b spec + E802Dot11StatusAssocDeniedShortPreambleUnSupp = 19, + E802Dot11StatusAssocDeniedPbccUnSupp = 20, + E802Dot11StatusAssocDeniedChannelAgilityUnSupp = 21 + // 22 - 65,535 reserved + }; + +/** +* 802.11 reason codes +*/ +enum T802Dot11ManagementReasonCode + { + // 0 reserved + E802Dot11ReasonUnspecified = 1, + E802Dot11ReasonAuthNoLongerValid = 2, + E802Dot11ReasonDeauthStationLeft = 3, + E802Dot11ReasonDisAssocInactivity = 4, + E802Dot11ReasonDisAssocAPFull = 5, + E802Dot11ReasonClass2FrameWhenNotAuth = 6, + E802Dot11ReasonClass3FrameWhenNotAssoc = 7, + E802Dot11ReasonDisAssocStationLeft = 8, + E802Dot11ReasonAssocFailNotAuth = 9, + // 10 - 12 reserved + // WPA stuff + E802Dot11ReasonInvalidIe = 13, + E802Dot11ReasonMicFailure = 14, + E802Dot11ReasonHandshakeTimeout = 15, + E802Dot11ReasonGroupKeyUpdateTimeout = 16, + E802Dot11ReasonIeMismatch = 17, + E802Dot11ReasonMulticastChipherNotValid = 18, + E802Dot11ReasonUnicastChipherNotValid = 19, + E802Dot11ReasonAkmpNotValid = 20, + E802Dot11ReasonUnsupportedRsneVersion = 21, + E802Dot11ReasonInvalidRsneCapabilities = 22, + E802Dot11Reason1xAuthenticationFailed = 23, + // 24 - 65,535 reserved + }; + +/** +* 802.11 management frame fixed field and IE lengths in bytes +*/ +const TUint KTimeStampFixedFieldLength = 8; +const TUint KBeaconIntervalFixedFieldLength = 2; +const TUint KCapabilityInformationFixedFieldLength = 2; +const TUint K802Dot11ErpInformationIeDataLen = 1; + +/** +* 802.11 management frame IE data part min/max lengths in bytes +*/ + +const TUint K802Dot11SupportedRatesIeDataMinLen = 1; + +const TUint K802Dot11TimIeDataMinLen = 4; +const TUint K802Dot11TimIeDataMaxLen = 254; + +const TUint K802Dot11ExtendedRatesIeDataMinLen = 1; + +/** +* 802.11 BSS Membership Selector values for different features +*/ +enum T802Dot11BssMembershipSelector + { + E802Dot11HtPhy = 127 | KBasicRateMask // 255 + }; + +/** +* operator== for TMacAddress +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const TMacAddress& aLhs, const TMacAddress& aRhs ) + { + return ( equal( (aLhs.iMacAddress), + (aLhs.iMacAddress) + KMacAddressLength, + aRhs.iMacAddress) ); + } + +/** +* Sets or clears the group bit of the MAC address +* @param aMac the address +* @param aSet set or clear the bit +*/ +inline void GroupBit( TMacAddress& aMac, TBool aSet = ETrue ) + { + if ( aSet ) + { + aMac.iMacAddress[0] |= KBit0; + } + else + { + aMac.iMacAddress[0] &= ~KBit0; + } + } + +/** +* Evaluates if the group bit of the MAC address is set +* @param aMac the address +* @return ETrue if group bit is set EFalse in other case +*/ +inline TBool IsGroupBitSet( const TMacAddress& aMac ) + { + return (aMac.iMacAddress[0] & KBit0); + } + +/** +* Sets or clears the local bit of the MAC address +* @param aMac the address +* @param aSet set or clear the bit +*/ +inline void LocalBit( TMacAddress& aMac, TBool aSet = ETrue ) + { + if ( aSet ) + { + aMac.iMacAddress[0] |= KBit1; + } + else + { + aMac.iMacAddress[0] &= ~KBit1; + } + } + +/** +* Evaluates if the local bit of the MAC address is set +* @param aMac the address +* @return ETrue if group bit is set EFalse in other case +*/ +inline TBool IsLocalBitSet( const TMacAddress& aMac ) + { + return (aMac.iMacAddress[0] & KBit1); + } + +/** +* 802.11 information element header +*/ +#pragma pack( 1 ) +struct SInformationElementHeader + { + /** the element ID */ + const TUint8 iElementID; + /** length of the following IE */ + TUint8 iLength; + + /** + * Ctor + * @param aElementID element ID used + */ + explicit SInformationElementHeader( + T802Dot11InformationElementID aElementID ) + : iElementID( static_cast(aElementID) ), iLength( 0 ) {}; + /** + * Ctor + * @param aElementID element ID used + * @param aLength length of the information element following this header + */ + SInformationElementHeader( T802Dot11InformationElementID aElementID, + const TUint8 aLength ) + : iElementID( static_cast(aElementID) ), iLength( aLength ) {}; + +private: + + /** Prohibit assignment operator */ + SInformationElementHeader& operator= ( const SInformationElementHeader& ); + /** Prohibit copy constructor */ + SInformationElementHeader( const SInformationElementHeader& ); + } __PACKED; // 2 bytes + +/** +* operator== for SInformationElementHeader +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SInformationElementHeader& aLhs, + const SInformationElementHeader& aRhs ) + { + return static_cast(( aLhs.iElementID == aRhs.iElementID + && aLhs.iLength == aRhs.iLength )); + } + +/** +* 802.11 SSID information element +*/ +#pragma pack( 1 ) +struct SSsIdIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 bytes + /** SSID information element */ + TUint8 iSsIdIe[KMaxSSIDLength]; // 32 bytes + + /** + * Ctor + */ + inline SSsIdIE(); + + /** + * Ctor + * @param aData pointer to SSID + * @param aLength length of aData + */ + inline SSsIdIE( const TUint8* aData, TUint8 aLength ); + + /** + * Returns information elements length ( the element + its header ) + * @return see above + */ + TUint8 GetIeLength() const { return static_cast( + (iHeader.iLength + sizeof( SInformationElementHeader ) ) ); } + +private: + + /** Prohibit assignment operator */ + SSsIdIE& operator= ( const SSsIdIE& ); + /** Prohibit copy constructor */ + SSsIdIE( const SSsIdIE& ); + } __PACKED; // 34 bytes + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSsIdIE::SSsIdIE() : iHeader( E802Dot11SsidIE ) + { + os_memset( iSsIdIe, 0, sizeof( iSsIdIe ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSsIdIE::SSsIdIE( const TUint8* aData, TUint8 aLength ) + : iHeader( E802Dot11SsidIE ) + { + iHeader.iLength = aLength; + os_memcpy( &(iSsIdIe[0]), aData, aLength ); + } + +/** +* operator== for SSsIdIE +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal EFalse not equal +*/ +inline TBool operator== ( + const SSsIdIE& aLhs, + const SSsIdIE& aRhs) + { + return static_cast(( ( aLhs.iHeader == aRhs.iHeader ) + && !(os_memcmp( aLhs.iSsIdIe, aRhs.iSsIdIe, aLhs.iHeader.iLength )) )); + } + +/** +* 802.11 supported rates information element +*/ +#pragma pack( 1 ) +struct SSupportedRatesIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** + * supported rates information element + * NOTE! The 802.11 standard specifies that the max length of the + * information part of this IE is eight rates (eight bytes). + * However at least some APs seem to put all their supported rates + * into this element. In order to be able to associate with those + * APs we allocate enough space to incorporate all 802.11b/g rates + * in this IE. We ourselves will still always advertise max eight + * rates using this IE (and the rest using the Extended Supported + * Rates IE). + */ + TUint8 iSupportedRatesIE[KMaxNumberOfDot11bAndgRates]; // 14 + + /** + * Ctor + */ + inline SSupportedRatesIE(); + + /** + * operator[] to get supported rates element at given index + * @param aIdx index to be get + * @return value in given index + */ + inline TUint8 operator[] ( TUint8 aIdx ) const; + + /** + * sets IE data also sets the IE headers length field + * @param aIeData actual IE data + * @param aLength length of aIeData + */ + inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); + + /** + * Returns information element's actual length + * ( element's size + its header ) + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** + * Returns only the information element's actual length ( header excluded ) + * @return see above + */ + inline TUint8 GetElementLength() const; + + /** Marks IE zero length size */ + inline void Clear(); + + /** + * Appends a single rate element to IE + * @param aRate rate element to be appended + */ + inline void Append( TUint8 aRate ); + +private: + + /** Prohibit assignment operator */ + SSupportedRatesIE& operator= ( const SSupportedRatesIE& ); + /** Prohibit copy constructor */ + SSupportedRatesIE( const SSupportedRatesIE& ); + } __PACKED; // 16 bytes + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSupportedRatesIE::SSupportedRatesIE() + : iHeader( E802Dot11SupportedRatesIE, KMaxNumberOfRates ) + { + os_memset( iSupportedRatesIE, 0, sizeof( iSupportedRatesIE ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SSupportedRatesIE::SetIeData( + const TUint8* aIeData, + const TUint8 aLength) + { + iHeader.iLength = aLength; + os_memcpy( iSupportedRatesIE, aIeData, aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SSupportedRatesIE::operator[] ( TUint8 aIdx ) const + { + return iSupportedRatesIE[aIdx]; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SSupportedRatesIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SSupportedRatesIE::GetElementLength() const + { + return iHeader.iLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SSupportedRatesIE::Clear() + { + iHeader.iLength = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SSupportedRatesIE::Append( TUint8 aRate ) + { + iSupportedRatesIE[iHeader.iLength] = aRate; + ++(iHeader.iLength); + } + +/** +* operator== for SSupportedRatesIE +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SSupportedRatesIE& aLhs, + const SSupportedRatesIE& aRhs ) + { + return static_cast(( ( aLhs.iHeader == aRhs.iHeader ) + && !(os_memcmp( aLhs.iSupportedRatesIE, + aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) )); + } + +/** +* 802.11 extended supported rates information element +*/ +#pragma pack( 1 ) +struct SExtendedSupportedRatesIE + { + enum { KPad = 1 }; + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** supported rates information element */ + TUint8 iSupportedRatesIE[KMaxNumberOfExtendedRates]; // 255 + /** padding */ + TUint8 iPad[KPad]; // 1 + + /** + * Ctor + */ + inline SExtendedSupportedRatesIE(); + + /** + * operator[] to get supported rates element at given index + * @param aIdx index to be get + * @return value in given index + */ + inline TUint8 operator[] ( TUint8 aIdx ) const; + + /** + * Sets IE data and the IE header's length field + * @param aIeData actual IE data + * @param aLength length of aIeData + */ + inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); + + /** + * Returns information element's actual length + * ( element's size + its header ) + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** + * Returns only the information element's actual length ( header excluded ) + * @return see above + */ + inline TUint8 GetElementLength() const; + + /** Marks IE zero length size */ + inline void Clear(); + + /** + * Appends a single rate element to IE + * @param aRate rate element to be appended + */ + inline void Append( TUint8 aRate ); + +private: + + /** Prohibit assignment operator */ + SExtendedSupportedRatesIE& operator= ( const SExtendedSupportedRatesIE& ); + /** Prohibit copy constructor */ + SExtendedSupportedRatesIE( const SExtendedSupportedRatesIE& ); + } __PACKED; + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SExtendedSupportedRatesIE::SExtendedSupportedRatesIE() + : iHeader( E802Dot11ExtendedRatesIE, KMaxNumberOfExtendedRates ) + { + os_memset( iSupportedRatesIE, 0, sizeof( iSupportedRatesIE ) ); + os_memset( iPad, 0, sizeof( iPad ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SExtendedSupportedRatesIE::SetIeData( + const TUint8* aIeData, + const TUint8 aLength) + { + iHeader.iLength = aLength; + os_memcpy( iSupportedRatesIE, aIeData, aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SExtendedSupportedRatesIE::operator[] ( TUint8 aIdx ) const + { + return iSupportedRatesIE[aIdx]; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SExtendedSupportedRatesIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SExtendedSupportedRatesIE::GetElementLength() const + { + return iHeader.iLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SExtendedSupportedRatesIE::Clear() + { + iHeader.iLength = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SExtendedSupportedRatesIE::Append( TUint8 aRate ) + { + iSupportedRatesIE[iHeader.iLength] = aRate; + ++(iHeader.iLength); + } + +/** +* operator== for SExtendedSupportedRatesIE +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SExtendedSupportedRatesIE& aLhs, + const SExtendedSupportedRatesIE& aRhs ) + { + return static_cast(( ( aLhs.iHeader == aRhs.iHeader ) + && !(os_memcmp( aLhs.iSupportedRatesIE, + aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) )); + } + +#pragma pack( 1 ) +struct SDsParameterSetIE + { + SInformationElementHeader iHeader; // 2 + TUint8 iValue; // 1 + + inline SDsParameterSetIE( const TUint32 aValue ); + +private: + + /** Prohibit assignment operator */ + SDsParameterSetIE& operator= ( const SDsParameterSetIE& aObj ); + /** Prohibit copy constructor */ + SDsParameterSetIE( const SDsParameterSetIE& ); + } __PACKED; // 3 bytes + +inline SDsParameterSetIE::SDsParameterSetIE( const TUint32 aValue ) : + iHeader( E802Dot11DsParameterSetIE, sizeof( iValue ) ), + iValue( aValue ) + { + } + +const TUint K802Dot11DsParameterSetIeDataLen = + sizeof( SDsParameterSetIE ) - sizeof( SInformationElementHeader ); + + +#pragma pack( 1 ) +struct SIbssParameterSetIE + { + SInformationElementHeader iHeader; // 2 + TUint16 iValue; // 2 + + inline SIbssParameterSetIE( const TUint16 aValue ); + + inline TUint16 AtimWindow() const; + +private: + + /** Prohibit default contructor */ + SIbssParameterSetIE(); + /** Prohibit assignment operator */ + SIbssParameterSetIE& operator= ( const SIbssParameterSetIE& aObj ); + /** Prohibit copy constructor */ + SIbssParameterSetIE( const SIbssParameterSetIE& ); + } __PACKED; // 4 bytes + +inline SIbssParameterSetIE::SIbssParameterSetIE( const TUint16 aValue ) : + iHeader( E802Dot11IbssParameterSetIE, sizeof( iValue ) ) + { + WriteHtoUint16( &iValue, aValue ); + } + +inline TUint16 SIbssParameterSetIE::AtimWindow() const + { + return ( ReadUint16Toh( &iValue ) ); + } + +const TUint K802Dot11IbssParameterSetIeDataLen = + sizeof( SIbssParameterSetIE ) - sizeof( SInformationElementHeader ); + + +/** +* Inbound WMM information element without IE header +*/ +#pragma pack( 1 ) +struct SRxWmmIeData + { + TIeOui iOui; // 3 + TUint8 iOuiType; // 1 + TUint8 iOuiSubType; // 1 + TUint8 iVersion; // 1 + /** information element */ + TUint8 iQosInfo; // 1 + + /** + * Evaluates if U-APSD bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsUapsdBitSet() const; + + /** + * Gets the the parameter set count + * @return parameter set count + */ + inline TUint8 ParameterSetCount() const; + +private: + + /** Prohibit default constructor */ + SRxWmmIeData(); + /** Prohibit assignment operator */ + SRxWmmIeData& operator= ( const SRxWmmIeData& aObj ); + /** Prohibit copy constructor */ + SRxWmmIeData( const SRxWmmIeData& ); + } __PACKED; // 7 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SRxWmmIeData::IsUapsdBitSet() const + { + return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SRxWmmIeData::ParameterSetCount() const + { + return ( iQosInfo & KParamSetCountQosInfoMask ); + } + + +/** +* Outbound WMM information element +*/ +#pragma pack( 1 ) +struct STxWmmIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + TIeOui iOui; // 3 + TUint8 iOuiType; // 1 + TUint8 iOuiSubType; // 1 + TUint8 iVersion; // 1 + /** information element */ + TUint8 iQosInfo; // 1 + + + /** + * Ctor + */ + inline STxWmmIE() : iHeader( E802Dot11VendorSpecificIE, KWmmInfoElemLen ), + iOuiType( KWmmElemOuiType ), + iOuiSubType( KWmmInfoElemOuiSubType ), iVersion( KWmmInfoElemVersion ), + iQosInfo( 0 ) + { + os_memcpy( iOui, KWmmElemOui, KIeOuiLength ); + } + + /** + * Sets the U-APSD flags for different ACs + * @param aFlags flag(s) to be set + */ + inline void SetUapsdFlags( TQosInfoUapsdFlag aFlags ); + + /** + * Sets the maximum service period length + * @param aMaxSpLen length of the service period + */ + inline void SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen ); + + /** + * Returns information elements total length, i.e. + * element's length + header length + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** Clears the IE content, i.e. the iQosInfo field */ + inline void Clear(); + +private: + + /** Prohibit assignment operator */ + STxWmmIE& operator= ( const STxWmmIE& aObj ); + /** Prohibit copy constructor */ + STxWmmIE( const STxWmmIE& ); + } __PACKED; // 9 bytes + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxWmmIE::SetUapsdFlags( TQosInfoUapsdFlag aFlags ) + { + iQosInfo |= aFlags; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxWmmIE::SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen ) + { + iQosInfo |= aMaxSpLen; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 STxWmmIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void STxWmmIE::Clear() + { + iQosInfo = 0; + } + +/** +* AC parameters record of WMM parameter element +*/ +#pragma pack( 1 ) +struct SAcParamsRecord + { + + TUint8 iAciAifsn; // 1 + TUint8 iEcwMinMax; // 1 + TUint16 iTxOpLimit; // 2 + + inline TWmmAccessCategory AccessCategory() const; + + inline TBool AdmissionControlMandatory() const; + + inline TUint8 Aifsn() const; + + inline TUint16 CwMin() const; + + inline TUint16 CwMax() const; + + inline TUint16 TxOpLimit() const; + +private: + + /** Prohibit default constructor */ + SAcParamsRecord(); + /** Prohibit assignment operator */ + SAcParamsRecord& operator= ( const SAcParamsRecord& aObj ); + /** Prohibit copy constructor */ + SAcParamsRecord( const SAcParamsRecord& ); + } __PACKED; // 4 bytes + +inline TWmmAccessCategory SAcParamsRecord::AccessCategory() const + { + return ( static_cast(iAciAifsn & K802Dot11AccessCategoryMask) ); + } + +inline TBool SAcParamsRecord::AdmissionControlMandatory() const + { + return ( iAciAifsn & KWmmAdmissionCtrlMandatoryMask ); + } + +inline TUint8 SAcParamsRecord::Aifsn() const + { + return ( iAciAifsn & KWmmAifsnMask ); + } + +inline TUint16 SAcParamsRecord::CwMin() const + { + return ( ( static_cast( 1 ) << + ( iEcwMinMax & KWmmEcwMinMask ) ) - 1 ); + } + +inline TUint16 SAcParamsRecord::CwMax() const + { + return ( ( static_cast( 1 ) << + ( ( iEcwMinMax & KWmmEcwMaxMask ) >> 4 ) ) - 1 ); + } + +inline TUint16 SAcParamsRecord::TxOpLimit() const + { + // the TxOpLimit value in the AC parameters record is in units of 32 + // microseconds, but the value we need to return is in microseconds. + // Hence we need to multiply the nw provided value by 32 + const TUint16 KTxOpLimitMultiplier = 32; + + // the value provided by the nw cannot, in practice, be bigger than + // the value below. However, if the nw still provides a bigger value, we + // will return the microsecond value corresponding to this value + const TUint16 KTxOpLimitMaxNwValueInPractice = 2047; + + const TUint16 KTxOpLimitNwValue = ReadUint16Toh( &iTxOpLimit ); + + return ( KTxOpLimitNwValue <= KTxOpLimitMaxNwValueInPractice ? + KTxOpLimitNwValue * KTxOpLimitMultiplier : + KTxOpLimitMaxNwValueInPractice * KTxOpLimitMultiplier ); + } + +/** +* WMM Parameter Element without element header +*/ +#pragma pack( 1 ) +struct SWmmParamElemData + { + /** information element header */ + TIeOui iOui; // 3 + TUint8 iOuiType; // 1 + TUint8 iOuiSubType; // 1 + TUint8 iVersion; // 1 + /** information element fields: */ + TUint8 iQosInfo; // 1 + TUint8 iReserved; // 1 + SAcParamsRecord iAcParams[KNumOfWmmACs]; // 16 + + /** + * Evaluates if U-APSD bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsUapsdBitSet() const; + + /** + * Gets the the parameter set count + * @return parameter set count + */ + inline TUint8 ParameterSetCount() const; + +private: + + /** Prohibit default constructor */ + SWmmParamElemData(); + /** Prohibit assignment operator */ + SWmmParamElemData& operator= ( const SWmmParamElemData& aObj ); + /** Prohibit copy constructor */ + SWmmParamElemData( const SWmmParamElemData& ); + } __PACKED; // 24 + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SWmmParamElemData::IsUapsdBitSet() const + { + return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SWmmParamElemData::ParameterSetCount() const + { + return ( iQosInfo & KParamSetCountQosInfoMask ); + } + +/** +* HT capabilities element without IE header +*/ +#pragma pack( 1 ) +struct SHtCapabilitiesIeData + { + /** + * Bit masks for HT capabilities info field + */ + enum TCapabilitiesInfoBitMask + { + ELdpcRxMask = 0x0001, + EFortyMhzOperationMask = 0x0002, + EGreenfieldFormatMask = 0x0010, + EShortGiFor20MhzMask = 0x0020, + EShortGiFor40MhzMask = 0x0040, + EStbcTxMask = 0x0080, + EStbcRxMask = 0x0300, + EDelayedBlockAckMask = 0x0400, + EDsssCckIn40MhzMask = 0x1000, + EPsmpMask = 0x2000, + ELsigTxopProtectionMask = 0x8000 + }; + + /** + * Offsets for HT capabilities info field + */ + enum TCapabilitiesInfoOffset + { + EOffsetToStbcRx = 8 + }; + + /** + * Bit masks for SM power save subfield of + * HT capabilities info field + */ + enum TSmPowerSave + { + ESmPowerSaveStatic = 0x0000, + ESmPowerSaveDynamic = 0x0004, + ESmPowerSaveDisabled = 0x000C + }; + + /** + * Bit masks for A-MPDU parameters field + */ + enum TAmpduParametersBitMask + { + EMaxAmpduLenExpMask = 0x03, + EMinMpduStartSpacingMask = 0x1C + }; + + /** + * Offsets for A-MPDU parameters field + */ + enum TAmpduParametersOffset + { + EOffsetToMinMpduStartSpacing = 2 + }; + + /** + * Bit masks for iTxInfo subfield of + * Supported MCS set field + */ + enum TTxInfoMask + { + ETxMcsSetDefinedMask = 0x01, + ETxRxMcsSetNotEqualMask = 0x02 + }; + + /** + * Bit masks for HT extended capabilities field + */ + enum TExtCapabilitiesBitMask + { + EPcoMask = 0x0001, + EMcsFeedbackMask = 0x0300, + EHtcMask = 0x0400, + ERdResponderMask = 0x0800 + }; + + /** HT capabilities info */ + TUint16 iCapabilitiesInfo; // 2 + /** A-MPDU parameters */ + TUint8 iAmpdu; // 1 + /** Supported MCS set */ + TUint8 iRxMcsBitmask[10]; // 10 + TUint16 iRxDataRate; // 2 + TUint8 iTxInfo; // 1 + TUint8 iReserved[3]; // 3 + /** HT extended capabilities */ + TUint16 iExtCapabilities; // 2 + /** Transmit beamforming capabilities */ + TUint32 iTransBeamfCapa; // 4 + /** ASEL capabilities */ + TUint8 iAsel; // 1 + + /** + * Constructor + */ + inline SHtCapabilitiesIeData(); + + /** + * Evaluates if receiving LDPC coded packets is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool LdpcRx() const; + + /** + * Sets support for receiving LDPC coded packets + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetLdpcRx( TBool aValue ); + + /** + * Evaluates if 40 MHz operation is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool FortyMhzOperation() const; + + /** + * Sets support for 40 MHz operation + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetFortyMhzOperation( TBool aValue ); + + /** + * Sets support for SM power save + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetSmPowerSave( TSmPowerSave aSmPowerSave ); + + /** + * Evaluates if reception of HT Greenfield format PPDUs is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool GreenfieldFormat() const; + + /** + * Sets support for reception of HT Greenfield format PPDUs + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetGreenfieldFormat( TBool aValue ); + + /** + * Evaluates if short GI reception of 20 Mhz packets is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool ShortGiFor20Mhz() const; + + /** + * Sets support for short GI reception of 20 Mhz packets + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetShortGiFor20Mhz( TBool aValue ); + + /** + * Evaluates if short GI reception of 40 Mhz packets is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool ShortGiFor40Mhz() const; + + /** + * Sets support for short GI reception of 40 Mhz packets + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetShortGiFor40Mhz( TBool aValue ); + + /** + * Evaluates if Tx of PPDUs using STBC is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool StbcTx() const; + + /** + * Sets support for Tx of PPDUs using STBC + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetStbcTx( TBool aValue ); + + /** + * Returns STBC Rx support information + * @return see above + */ + inline TUint8 StbcRx() const; + + /** + * Sets STBC Rx support information + * @param aValue STBC Rx + */ + inline void SetStbcRx( TUint8 aValue ); + + /** + * Evaluates if HT delayed block ack is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool DelayedBlockAck() const; + + /** + * Sets support for HT delayed block ack + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetDelayedBlockAck( TBool aValue ); + + /** + * Sets max A-MSDU length + * @param aValue 0 for 3839 octets, 1 for 7935 octets + */ + inline void SetMaxAmsduLength( TUint8 aValue ); + + /** + * Evaluates if DSSS/CCK in 40 Mhz is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool DsssCckIn40Mhz() const; + + /** + * Sets support for DSSS/CCK in 40 Mhz + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetDsssCckIn40Mhz( TBool aValue ); + + /** + * Evaluates if PSMP operation is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool Psmp() const; + + /** + * Sets support for PSMP operation + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetPsmp( TBool aValue ); + + /** + * Evaluates if L-SIG TXOP protection is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool LsigTxopProtection() const; + + /** + * Sets support for L-SIG TXOP protection + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetLsigTxopProtection( TBool aValue ); + + /** + * Returns max A-MPDU length exponent + * @return see above + */ + inline TUint8 MaxAmpduLenExponent() const; + + /** + * Sets max A-MPDU length exponent + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetMaxAmpduLenExponent( TUint8 aValue ); + + /** + * Returns min MPDU start spacing + * @return see above + */ + inline TUint8 MinMpduStartSpacing() const; + + /** + * Sets min MPDU start spacing + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetMinMpduStartSpacing( TUint8 aValue ); + + /** + * Sets max supported Rx data rate + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetMaxRxDataRate( TUint16 aValue ); + + /** + * Sets Tx MCS set defined + * @param aValue ETrue if defined, EFalse otherwise + */ + inline void SetTxMcsSetDefined( TBool aValue ); + + /** + * Sets Tx Rx MCS set not equal + * @param aValue ETrue if not equal, EFalse otherwise + */ + inline void SetTxRxMcsSetNotEqual( TBool aValue ); + + /** + * Evaluates if PCO is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool Pco() const; + + /** + * Sets support for PCO + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetPco( TBool aValue ); + + /** + * Sets PCO transition time + * @param aValue PCO transition time + */ + inline void SetPcoTransitionTime( TUint8 aValue ); + + /** + * Returns MCS feedback + * @return see above + */ + inline TUint8 McsFeedback() const; + + /** + * Sets MCS feedback + * @param see above + */ + inline void SetMcsFeedback( TUint8 aValue ); + + /** + * Evaluates if +HTC is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool Htc() const; + + /** + * Sets support for +HTC + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetHtc( TBool aValue ); + + /** + * Evaluates if RD responder is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool RdResponder() const; + + /** + * Sets support for RD responder + * @param aValue ETrue if supported, EFalse otherwise + */ + inline void SetRdResponder( TBool aValue ); + + /** + * Returns Transmit beamforming capabilities + * @return see above + */ + inline TUint32 TransmitBeamformingCapabilities() const; + + /** + * Returns ASEL capabilities + * @return see above + */ + inline TUint8 AselCapabilities() const; + + private: + + /** Prohibit assignment operator */ + SHtCapabilitiesIeData& operator= ( const SHtCapabilitiesIeData& aObj ); + /** Prohibit copy constructor */ + SHtCapabilitiesIeData( const SHtCapabilitiesIeData& aObj ); + } __PACKED; // 26 bytes + +// --------------------------------------------------------------------------- +// Note that byte order is not an issue when the data members are +// initialized to zero, which is the case here +// --------------------------------------------------------------------------- +// +inline SHtCapabilitiesIeData::SHtCapabilitiesIeData() : + iAmpdu( 0 ), + iTxInfo( 0 ), + iAsel( 0 ) + { + WriteHtoUint16( &iCapabilitiesInfo, 0 ); + WriteHtoUint16( &iRxDataRate, 0 ); + WriteHtoUint16( &iExtCapabilities, 0 ); + WriteHtoUint32( &iTransBeamfCapa, 0 ); + os_memset( iRxMcsBitmask, 0, sizeof( iRxMcsBitmask ) ); + os_memset( iReserved, 0, sizeof( iReserved ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::LdpcRx() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & ELdpcRxMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetLdpcRx( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + ELdpcRxMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( &iCapabilitiesInfo, temp & ( ~ELdpcRxMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::FortyMhzOperation() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EFortyMhzOperationMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetFortyMhzOperation( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EFortyMhzOperationMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EFortyMhzOperationMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetSmPowerSave( TSmPowerSave aSmPowerSave ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + aSmPowerSave ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::GreenfieldFormat() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EGreenfieldFormatMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetGreenfieldFormat( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EGreenfieldFormatMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EGreenfieldFormatMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::ShortGiFor20Mhz() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EShortGiFor20MhzMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetShortGiFor20Mhz( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EShortGiFor20MhzMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EShortGiFor20MhzMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::ShortGiFor40Mhz() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EShortGiFor40MhzMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetShortGiFor40Mhz( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EShortGiFor40MhzMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EShortGiFor40MhzMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::StbcTx() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EStbcTxMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetStbcTx( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EStbcTxMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EStbcTxMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtCapabilitiesIeData::StbcRx() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EStbcRxMask ) + >> EOffsetToStbcRx ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetStbcRx( TUint8 aValue ) + { + const TUint16 KnewStbcRx ( aValue << EOffsetToStbcRx ); + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + KnewStbcRx ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::DelayedBlockAck() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EDelayedBlockAckMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetDelayedBlockAck( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EDelayedBlockAckMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EDelayedBlockAckMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetMaxAmsduLength( TUint8 aValue ) + { + const TUint8 KOffsetToMaxAmsduLength ( 11 ); + TUint16 KnewMaxAmsduLength ( aValue << KOffsetToMaxAmsduLength ); + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + KnewMaxAmsduLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::DsssCckIn40Mhz() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EDsssCckIn40MhzMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetDsssCckIn40Mhz( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EDsssCckIn40MhzMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EDsssCckIn40MhzMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::Psmp() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EPsmpMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetPsmp( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + EPsmpMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~EPsmpMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::LsigTxopProtection() const + { + return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & ELsigTxopProtectionMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetLsigTxopProtection( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iCapabilitiesInfo, + ReadUint16Toh( &iCapabilitiesInfo ) | + ELsigTxopProtectionMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) ); + WriteHtoUint16( + &iCapabilitiesInfo, + temp & ( ~ELsigTxopProtectionMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtCapabilitiesIeData::MaxAmpduLenExponent() const + { + return iAmpdu & EMaxAmpduLenExpMask; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetMaxAmpduLenExponent( TUint8 aValue ) + { + iAmpdu |= aValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtCapabilitiesIeData::MinMpduStartSpacing() const + { + return ( ( iAmpdu & EMinMpduStartSpacingMask ) + >> EOffsetToMinMpduStartSpacing ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetMinMpduStartSpacing( TUint8 aValue ) + { + iAmpdu |= ( aValue << EOffsetToMinMpduStartSpacing ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetMaxRxDataRate( TUint16 aValue ) + { + WriteHtoUint16( &iRxDataRate, aValue ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetTxMcsSetDefined( TBool aValue ) + { + if ( aValue ) + { + iTxInfo |= ETxMcsSetDefinedMask; + } + else + { + iTxInfo &= ( ~ETxMcsSetDefinedMask ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetTxRxMcsSetNotEqual( TBool aValue ) + { + if ( aValue ) + { + iTxInfo |= ETxRxMcsSetNotEqualMask; + } + else + { + iTxInfo &= ( ~ETxRxMcsSetNotEqualMask ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::Pco() const + { + return ( ( ReadUint16Toh( &iExtCapabilities ) & EPcoMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetPco( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iExtCapabilities, + ReadUint16Toh( &iExtCapabilities ) | + EPcoMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iExtCapabilities ) ); + WriteHtoUint16( &iExtCapabilities, temp & ( ~EPcoMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetPcoTransitionTime( TUint8 aValue ) + { + const TUint8 KOffsetToPcoTransitionTime ( 1 ); + const TUint16 KnewPcoTransitionTime ( + aValue << KOffsetToPcoTransitionTime ); + WriteHtoUint16( &iExtCapabilities, + ReadUint16Toh( &iExtCapabilities ) | + KnewPcoTransitionTime ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtCapabilitiesIeData::McsFeedback() const + { + const TUint8 KOffsetToMcsFeedback ( 8 ); + return ( ( ReadUint16Toh( &iExtCapabilities ) & EMcsFeedbackMask ) + >> KOffsetToMcsFeedback ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetMcsFeedback( TUint8 aValue ) + { + const TUint8 KOffsetToMcsFeedback ( 8 ); + const TUint16 KnewMcsFeedback ( aValue << KOffsetToMcsFeedback ); + WriteHtoUint16( &iExtCapabilities, + ReadUint16Toh( &iExtCapabilities ) | + KnewMcsFeedback ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::Htc() const + { + return ( ( ReadUint16Toh( &iExtCapabilities ) & EHtcMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetHtc( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iExtCapabilities, + ReadUint16Toh( &iExtCapabilities ) | + EHtcMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iExtCapabilities ) ); + WriteHtoUint16( &iExtCapabilities, temp & ( ~EHtcMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtCapabilitiesIeData::RdResponder() const + { + return ( ( ReadUint16Toh( &iExtCapabilities ) & ERdResponderMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIeData::SetRdResponder( TBool aValue ) + { + if ( aValue ) + { + WriteHtoUint16( &iExtCapabilities, + ReadUint16Toh( &iExtCapabilities ) | + ERdResponderMask ); + } + else + { + const TUint16 temp ( ReadUint16Toh( &iExtCapabilities ) ); + WriteHtoUint16( &iExtCapabilities, temp & ( ~ERdResponderMask ) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 SHtCapabilitiesIeData::TransmitBeamformingCapabilities() const + { + return ReadUint32Toh( &iTransBeamfCapa ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtCapabilitiesIeData::AselCapabilities() const + { + return iAsel; + } + +const TUint K802Dot11HtCapabilitiesIeDataLen = sizeof( SHtCapabilitiesIeData ); + +/** +* HT capabilities element +*/ +#pragma pack( 1 ) +struct SHtCapabilitiesIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** information element data */ + SHtCapabilitiesIeData iData; // 26 + + /** + * Constructor + */ + inline SHtCapabilitiesIE() : + iHeader( E802Dot11HtCapabilitiesIE, sizeof( SHtCapabilitiesIeData ) ) + { + } + + /** + * Returns information element's total length, i.e. + * element's length + header length + * @return see above + */ + inline TUint8 GetIeLength() const; + + /** + * Sets IE data and the IE header's length field + * @param aIeData actual IE data + * @param aLength length of aIeData + */ + inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); + +private: + + /** Prohibit assignment operator */ + SHtCapabilitiesIE& operator= ( const SHtCapabilitiesIE& aObj ); + /** Prohibit copy constructor */ + SHtCapabilitiesIE( const SHtCapabilitiesIE& aObj ); + } __PACKED; // 28 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtCapabilitiesIE::GetIeLength() const + { + return static_cast( + ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtCapabilitiesIE::SetIeData( + const TUint8* aIeData, + const TUint8 aLength) + { + iHeader.iLength = aLength; + os_memcpy( reinterpret_cast(&iData), aIeData, aLength ); + } + +/** +* HT Operation element without IE header +*/ +#pragma pack( 1 ) +struct SHtOperationIeData + { + /** + * Bit masks for byte2 field + */ + enum TByte2BitMask + { + ESecondaryChOffsetMask = 0x03, + EChWidthMask = 0x04, + ERifsModeMask = 0x08 + }; + + /** + * Bit masks for bytes3_4 field + */ + enum TBytes3_4BitMask + { + EHtProtectionMask = 0x0003, + ENonGreenfieldPresentMask = 0x0004 + }; + + /** + * Bit masks for bytes5_6 field + */ + enum TBytes5_6BitMask + { + EDualBeaconMask = 0x0040, + EDualCtsProtectionMask = 0x0080, + ELsigTxopProtectionMask = 0x0200, + EPcoActiveMask = 0x0400 + }; + + /** Primary channel */ + TUint8 iPrimaryChannel; // 1 + TUint8 iByte2; // 1 + TUint16 iBytes3_4; // 2 + TUint16 iBytes5_6; // 2 + /** Basic MCS set */ + TUint8 iBasicMcsSet[10]; // 10 + TUint8 iPadding[6]; // 6 + + /** + * Constructor + */ + inline SHtOperationIeData(); + + /** + * Returns secondary channel offset + * @return see above + */ + inline TUint8 SecondaryChOffset() const; + + /** + * Returns channel width + * @return see above + */ + inline TUint8 ChWidth() const; + + /** + * Evaluates if RIFS mode is supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool RifsMode() const; + + /** + * Returns HT protection mode + * @return see above + */ + inline TUint8 HtProtection() const; + + /** + * Evaluates if non-greefield HT STAs are present + * @return ETrue if present, EFalse otherwise + */ + inline TBool NonGreenfieldPresent() const; + + /** + * Evaluates if dual beacon is transmitted + * @return ETrue if transmitted, EFalse otherwise + */ + inline TBool DualBeacon() const; + + /** + * Evaluates if dual CTS protection is required + * @return ETrue if required, EFalse otherwise + */ + inline TBool DualCtsProtection() const; + + /** + * Evaluates if L-SIG TXOP protection is fully supported + * @return ETrue if supported, EFalse otherwise + */ + inline TBool LsigTxopProtection() const; + + /** + * Evaluates if PCO is active in the BSS + * @return ETrue if active, EFalse otherwise + */ + inline TBool PcoActive() const; + + private: + + /** Prohibit assignment operator */ + SHtOperationIeData& operator= ( const SHtOperationIeData& ); + /** Prohibit copy constructor */ + SHtOperationIeData( const SHtOperationIeData& ); + } __PACKED; // 22 bytes + +// --------------------------------------------------------------------------- +// Note that byte order is not an issue when the data members are +// initialized to zero; which is the case here +// --------------------------------------------------------------------------- +// +inline SHtOperationIeData::SHtOperationIeData() : + iPrimaryChannel( 0 ), + iByte2( 0 ) + { + WriteHtoUint16( &iBytes3_4, 0 ); + WriteHtoUint16( &iBytes5_6, 0 ); + os_memset( iBasicMcsSet, 0, sizeof( iBasicMcsSet ) ); + os_memset( iPadding, 0, sizeof( iPadding ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtOperationIeData::SecondaryChOffset() const + { + return iByte2 & ESecondaryChOffsetMask; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtOperationIeData::ChWidth() const + { + const TUint8 KOffsetToChWidth ( 2 ); + return ( ( iByte2 & EChWidthMask ) >> KOffsetToChWidth ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtOperationIeData::RifsMode() const + { + return ( (iByte2 & ERifsModeMask ) ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SHtOperationIeData::HtProtection() const + { + return iBytes3_4 & EHtProtectionMask; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtOperationIeData::NonGreenfieldPresent() const + { + return ( ( ReadUint16Toh( &iBytes3_4 ) & ENonGreenfieldPresentMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtOperationIeData::DualBeacon() const + { + return ( ( ReadUint16Toh( &iBytes5_6 ) & EDualBeaconMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtOperationIeData::DualCtsProtection() const + { + return ( ( ReadUint16Toh( &iBytes5_6 ) & EDualCtsProtectionMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtOperationIeData::LsigTxopProtection() const + { + return ( ( ReadUint16Toh( &iBytes5_6 ) & ELsigTxopProtectionMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SHtOperationIeData::PcoActive() const + { + return ( ( ReadUint16Toh( &iBytes5_6 ) & EPcoActiveMask ) + ? ETrue : EFalse ); + } + +const TUint K802Dot11HtOperationIeDataLen = sizeof( SHtOperationIeData ); + +/** +* HT Operation element +*/ +#pragma pack( 1 ) +struct SHtOperationIE + { + /** information element header */ + SInformationElementHeader iHeader; // 2 + /** information element data */ + SHtOperationIeData iData; // 22 + + /** + * Constructor + */ + inline SHtOperationIE() : + iHeader( E802Dot11HtOperationIE, sizeof( SHtOperationIeData ) ) + { + } + + /** + * Sets IE data and the IE header's length field + * @param aIeData actual IE data + * @param aLength length of aIeData + */ + inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); + +private: + + /** Prohibit assignment operator */ + SHtOperationIE& operator= ( const SHtOperationIE& ); + /** Prohibit copy constructor */ + SHtOperationIE( const SHtOperationIE& ); + } __PACKED; // 24 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtOperationIE::SetIeData( + const TUint8* aIeData, + const TUint8 aLength) + { + iHeader.iLength = aLength; + os_memcpy( reinterpret_cast(&iData), aIeData, aLength ); + } + + +// capability information fixed-field +// +// bit 14 - 15 13 11 - 12 10 8-9 7 6 +// ----------+-------+-----------+-------+---------+----------+------- +// reserved | DSSS- | reserved | short | reserved| Channel | PBCC +// | OFDM | | slot | | Agility | +// ----------+-------+-----------+-------+---------+----------+-------- +// bit 5 4 3 2 1 0 +// ----------+----------+----------+----------+----------+----------+ +// Short | Privacy | CF-Poll | CF | IBSS | ESS | +// Preamble| (WEP) | Request | Pollable | | | +// ----------+----------+----------+----------+----------+----------+ + +/** +* 802.11 management frame body capability information fixed-field +*/ +#pragma pack( 1 ) +struct SCapabilityInformationField + { + enum { KReservedFieldsMask = 0xEB00 }; + + /** capability information fixed field */ + TUint16 iCapabilityInformationField; + + /** + * Ctor + */ + inline SCapabilityInformationField(); + + /** + * Ctor + * @param aParam value used in iCapabilityInformationField field + */ + explicit inline SCapabilityInformationField( const TUint16 aParam ); + + /** + * Assignment operator for TUint16 type + * @param aParam value used as iCapabilityInformationField + */ + inline SCapabilityInformationField& operator= ( const TUint16 aParam ); + + /** + * Returns the value of the Capability Information Field + * @return + */ + inline TUint16 CapabilityInformationField() const; + /** + * Evaluates if ESS bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsEssBitSet() const; + /** + * Evaluates if IBSS bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsIbssBitSet() const; + /** + * Evaluates if Privaecy bit bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsPrivacyBitSet() const; + /** + * Evaluates if Short Preamble bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsShortPreambleBitSet() const; + /** + * Evaluates if PBCC bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsPbccBitSet() const; + /** + * Evaluates if Channel Agility bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsChannelAgilityBitSet() const; + /** + * Evaluates if short slot time bit is up + * @return ETrue if bit is up, otherwise EFalse + */ + inline TBool IsShortSlotTimeBitSet() const; + /** + * Clears both CF bits + */ + inline void ClearCfFields(); + /** + * Clear CF pollable field + */ + inline void ClearCfPollable(); + /** + * Clears both CF poll request field + */ + inline void ClearCfPollRequest(); + /** + * Sets the short preamble bit + */ + inline void SetShortPreamble(); + /** + * Clears the short preamble bit + */ + inline void ClearShortPreamble(); + /** + * sets the pbcc bit + */ + inline void SetPbcc(); + /** + * sets the IBSS bit + */ + inline void SetIbss(); + /** + * Clear PBCC bit + */ + inline void ClearPbcc(); + /** Clear reserved fields */ + inline void ClearReservedFields(); + /** Set WEP bit */ + inline void SetWepBit(); + /** Clear WEP bit */ + inline void ClearWepBit(); + /** Set RM bit */ + inline void SetRMBit(); + /** Clear RM bit */ + inline void ClearRMBit(); + +private: + + /** Prohibit copy constructor */ + SCapabilityInformationField( const SCapabilityInformationField& ); + } __PACKED; // 2 bytes + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SCapabilityInformationField::SCapabilityInformationField() + { + WriteHtoUint16( &iCapabilityInformationField, 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SCapabilityInformationField::SCapabilityInformationField( + const TUint16 aParam ) + { + WriteHtoUint16( &iCapabilityInformationField, aParam ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SCapabilityInformationField& SCapabilityInformationField::operator= ( + const TUint16 aParam ) + { + WriteHtoUint16( &iCapabilityInformationField, aParam ); + return (*this); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +inline TUint16 SCapabilityInformationField::CapabilityInformationField() const + { + return ( ReadUint16Toh( &iCapabilityInformationField ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsEssBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11CapabilityEssMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsIbssBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11CapabilityIbssMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsPrivacyBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11CapabilityPrivacyMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsShortPreambleBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11ShortPreambleMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsPbccBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11PbccMask ) + ? ETrue : EFalse ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsChannelAgilityBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11ChannelAgilityMask ) + ? ETrue : EFalse ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SCapabilityInformationField::IsShortSlotTimeBitSet() const + { + return ( ( ReadUint16Toh( &iCapabilityInformationField ) & + E802Dot11ShortSlotTimeMask ) + ? ETrue : EFalse ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearCfFields() + { + ClearCfPollable(); + ClearCfPollRequest(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearCfPollable() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11CapabilityCfPollableMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearCfPollRequest() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11CapabilityCfPollRequestMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetShortPreamble() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11ShortPreambleMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetPbcc() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11PbccMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetIbss() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11CapabilityIbssMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearShortPreamble() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11ShortPreambleMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearPbcc() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11PbccMask ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearReservedFields() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~KReservedFieldsMask ) ); + } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetRMBit() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11RadioMeasurementMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearRMBit() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11RadioMeasurementMask ) ); + } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::SetWepBit() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) | + E802Dot11CapabilityPrivacyMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SCapabilityInformationField::ClearWepBit() + { + WriteHtoUint16( &iCapabilityInformationField, + ReadUint16Toh( &iCapabilityInformationField ) & + ( ~E802Dot11CapabilityPrivacyMask ) ); + } + +/** +* operator== for SCapabilityInformationField +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SCapabilityInformationField& aLhs, + const SCapabilityInformationField& aRhs) + { + return static_cast( aLhs.CapabilityInformationField() + == aRhs.CapabilityInformationField() ); + } + +/** +* 802.11 management frame body listen interval fixed-field +*/ +#pragma pack( 1 ) +struct SListenIntervalField + { + /** listen interval fixed field */ + TUint16 iListenInterval; + + /** + * Ctor + */ + inline SListenIntervalField(); + + /** + * Ctor + * @param aParam value used in iListenInterval + */ + explicit inline SListenIntervalField( const TUint16 aParam ); + + /** + * Returns the value of the Listen Interval + * @return Listen Interval + */ + inline TUint16 ListenInterval() const; + + /** + * assignment operator for TUint16 type + * @param aInterval listen interval fixed field + */ + inline SListenIntervalField& operator= ( const TUint16 aInterval ); + +private: + + /** Prohibit assignment operator */ + SListenIntervalField& operator= ( const SListenIntervalField& ); + /** Prohibit copy constructor */ + SListenIntervalField( const SListenIntervalField& ); + } __PACKED; // 2 bytes + +inline SListenIntervalField::SListenIntervalField() + { + WriteHtoUint16( &iListenInterval, 0 ); + } + +inline SListenIntervalField::SListenIntervalField( const TUint16 aParam ) + { + WriteHtoUint16( &iListenInterval, aParam ); + } + +inline TUint16 SListenIntervalField::ListenInterval() const + { + return ( ReadUint16Toh( &iListenInterval ) ); + } + +inline SListenIntervalField& SListenIntervalField::operator= ( + const TUint16 aInterval ) + { + WriteHtoUint16( &iListenInterval, aInterval ); + return (*this); + } + +/** +* operator== for SListenIntervalField +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SListenIntervalField& aLhs, + const SListenIntervalField& aRhs) + { + return static_cast( aLhs.ListenInterval() == aRhs.ListenInterval() ); + } + + +/* + 802.11 DATA Frame + +----------------+ + | | + | Frame Control | + | 2 bytes | + +----------------+ + | | + | Duration ID | + | 2 bytes | + +----------------+ + | | + | Address 1 | + | 6 bytes | + +----------------+ + | | + | Address 2 | + | 6 bytes | + +----------------+ + | | + | Address 3 | + | 6 bytes | + +----------------+ + | | + | Sequence Cntrl | + | 2 bytes | + +----------------+ + | | + | Address 4 | + | 6 bytes | + +----------------+ + | DSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + | SSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + |Control - 1 byte| = 0x03 + +----------------+ + | OUI - 3 bytes | = 0x0 + | | + +----------------+ + | Type - 2 bytes | = Ethernet type (IP=0x0800) + +----------------+ + | | + | Data | + | | + ~ ~ + ~ ~ + | 46 to 1500 | + | bytes | + | | + +----------------+ + | FCS | + | 4 bytes | + +----------------+ + +*/ + +// FrameControl field of the 802.11 header +// +// |--------------------- control -----------------------| +// +// bit 15 14 13 12 11 10 9 8 +// +-------+-----+------+-----+-------+------+------+----+ +// | Order | WEP | More | Pwr | Retry | More | From | To | +// | | | Data | Mgmt| | Frag | DS | DS | +// +-------+-----+------+-----+-------+------+------+----+ +// 1 1 1 1 1 1 1 1 +//--------- type ------------| +// +// 7-4 3-2 1-0 +//---------+------+----------+ +// Subtype | Type | Protocol | +// | | Version | +//---------+------+----------+ +// 4 2 2 + +/** +* 802.11 Frame Control field +*/ +#pragma pack( 1 ) +struct SFrameControl + { + /** type field */ + TUint8 iType; + /** control filed */ + TUint8 iControl; + + /** + * Ctor + * @param aType type field + * @param aControl control field + */ + SFrameControl( + T802Dot11FrameControlTypeMask aType, + T802Dot11FrameControlBitMask aControl ) + : iType( static_cast(aType) ), + iControl( static_cast(aControl) ) {}; + + /** + * Returns type and control fields combined as a single TUint16 value + * @return see above + */ + inline TUint16 operator()() const; + +private: + + /** Prohibit assignment operator */ + SFrameControl& operator= ( const SFrameControl& aObj ); + /** Prohibit copy constructor */ + SFrameControl( const SFrameControl& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SFrameControl::operator()() const + { + TUint16 value( iType ); + return ( static_cast(( value << 8 ) + iControl )); + } + +/** +* operator== for SFrameControl +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SFrameControl& aLhs, + const SFrameControl& aRhs) + { + return static_cast( aLhs.iType == aRhs.iType + && aLhs.iControl == aRhs.iControl ); + } + + +#pragma pack( 1 ) +struct SPsPoll + { + const SFrameControl iFrameControl; // 2 bytes + TUint16 iAid; // 2 bytes + const TMacAddress iBssId; // 6 bytes + const TMacAddress iTa; // 6 bytes + + inline SPsPoll( + TUint16 aAid, + const TMacAddress& aBssId, + const TMacAddress& aTa ); + +private: + + /** Prohibit default contructor */ + SPsPoll(); + /** Prohibit assignment operator */ + SPsPoll& operator= ( const SPsPoll& ); + /** Prohibit copy constructor */ + SPsPoll( const SPsPoll& ); + } __PACKED; // 16 bytes + + +inline SPsPoll::SPsPoll( + TUint16 aAid, + const TMacAddress& aBssId, + const TMacAddress& aTa ) + : iFrameControl( E802Dot11FrameTypePowerSavePoll, + static_cast(0) ), + iBssId( aBssId ), iTa( aTa ) + { + // AID always has the 2 most significant bits set to 1 + WriteHtoUint16( &iAid, ( aAid | 0xC000 ) ); + } + + +// SequenceControl field of the 802.11 header +// +// bit 15 - 4 3 - 0 +// +-------------------+-----------+ +// | Sequence Number | Fragment | +// | | Number | +// +-------------------+-----------+ +// 12 4 + +/** +* 802.11 data frame MAC header +*/ +#pragma pack( 1 ) +struct SDataFrameHeader + { + /** frame control field */ + SFrameControl iFrameControl; // 2 bytes + /** duration field */ + TUint16 iDuration; // 2 bytes + /** address1 field */ + TMacAddress iAddress1; // 6 bytes + /** address2 field */ + TMacAddress iAddress2; // 6 bytes + /** address3 field */ + TMacAddress iAddress3; // 6 bytes + /** sequence control field */ + TUint16 iSeqCtl; // 2 bytes + // this littly piggy is only used in AP-AP mode + // which we don't do, so it is omitted + // const TMacAddress iAddress4; // 6 bytes + + /** + * Ctor + */ + inline SDataFrameHeader(); + + /** + * Sets WEP bit from Frame Control field + */ + inline void SetWepBit(); + /** + * Clears WEP bit from Frame Control field + */ + inline void ClearWepBit(); + /** + * Sets ToDS bit from Frame Control field + */ + inline void SetToDsBit(); + /** + * Clears ToDS bit from Frame Control field + */ + inline void ClearToDsBit(); + /** + * Clears FromDS bit from Frame Control field + */ + inline void ClearFromDsBit(); + /** + * Evaluates is FromDS bit set from Frame Control field + */ + inline TBool IsFromDsBitSet() const; + inline TBool IsToDsBitSet() const; + /** + * Evaluates is WEP bit set from Frame Control field + */ + inline TBool IsWepBitSet() const; + /** + * Evaluates is Order bit set from Frame Control field + */ + inline TBool IsOrderBitSet() const; + /** + * Sets Order bit from Frame Control field + */ + inline void SetOrderBit(); + /** + * Clears Order bit from Frame Control field + */ + inline void ClearOrderBit(); + + /** + * Gets Frame Control field + * @return reference to the frame control field + */ + inline const SFrameControl& GetFrameControl() const; + + /** + * Returns Sequence Number from iSeqCtl field + * @return Sequence Number + */ + inline TUint16 SequenceNumber() const; + +private: + + /** Prohibit assignment operator */ + SDataFrameHeader& operator= ( const SDataFrameHeader& aObj ); + /** Prohibit copy constructor */ + SDataFrameHeader( const SDataFrameHeader& ); + } __PACKED; + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDataFrameHeader::SDataFrameHeader() : + iFrameControl( E802Dot11FrameTypeData, + static_cast(0) ), + iAddress1( KZeroMacAddr ), + iAddress2( KZeroMacAddr ), + iAddress3( KZeroMacAddr ) + { + WriteHtoUint16( &iDuration, 0 ); + WriteHtoUint16( &iSeqCtl, 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::SetWepBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearWepBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::SetToDsBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlToDsMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearToDsBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlToDsMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearFromDsBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlFromDsMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsFromDsBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlFromDsMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsToDsBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlToDsMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsWepBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlWepMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SDataFrameHeader::IsOrderBitSet() const + { + return static_cast( iFrameControl.iControl & ( + E802Dot11FrameControlOrderMask >> 8 )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::SetOrderBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlOrderMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDataFrameHeader::ClearOrderBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlOrderMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const SFrameControl& SDataFrameHeader::GetFrameControl() const + { + return iFrameControl; + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +inline TUint16 SDataFrameHeader::SequenceNumber() const + { + return ( ReadUint16Toh( &iSeqCtl ) >> 4 ); + } + + +typedef SDataFrameHeader SNullDataFrame; +typedef SDataFrameHeader Sdot11MacHeader; + +typedef TUint16 T802Dot11QosControl; + +/** +* Bits 0-2 of the QoS Control field of a QoS Data Frame determine the user +* priority of the frame. This is a mask for those bits +*/ +const T802Dot11QosControl KWmmUserPriorityMask = 0x0007; + +/** +* Bit 7 of the QoS Control field of a QoS Data Frame indicates the presence +* of an A-MSDU in the frame (1: present, 0: not present) (IEEE 802.11n/D6.04). +* This is the mask for that bit +*/ +const T802Dot11QosControl KAmsduPresentMask = 0x0080; + +/** +* 802.11 QoS data frame MAC header +*/ +#pragma pack( 1 ) +struct SQosDataFrameHeader + { + /** 802.11 data frame MAC header */ + SDataFrameHeader iHdr; // 24 bytes + /** QoS control field */ + T802Dot11QosControl iQosControl; // 2 bytes + + /** + * Ctor + */ + inline SQosDataFrameHeader(); + + /** + * Resets the QoS Control field to zero + */ + inline void ResetQosControl(); + + /** + * Sets the WMM user priority (3 lowest bits) of the QoS Control field + */ + inline void SetUserPriority( TUint8 aPriority ); + + /** + * Returns the WMM user priority (3 lowest bits) of the QoS Control field + * @return WMM user priority + */ + inline TUint8 UserPriority() const; + + /** + * Returns A-MSDU presence + * @return ETrue if A-MSDU is present + * EFalse otherwise + */ + inline TBool AmsduPresent() const; + +private: + + /** Prohibit assignment operator */ + SQosDataFrameHeader& operator= ( const SQosDataFrameHeader& ); + /** Prohibit copy constructor */ + SQosDataFrameHeader( const SQosDataFrameHeader& ); + } __PACKED; // 26 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SQosDataFrameHeader::SQosDataFrameHeader() + { + WriteHtoUint16( &iQosControl, 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SQosDataFrameHeader::ResetQosControl() + { + WriteHtoUint16( &iQosControl, 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SQosDataFrameHeader::SetUserPriority( TUint8 aPriority ) + { + // clear old priority + WriteHtoUint16( &iQosControl, + ReadUint16Toh( &iQosControl ) & + ( ~KWmmUserPriorityMask ) ); + // set new priority + WriteHtoUint16( &iQosControl, + ReadUint16Toh( &iQosControl ) | + aPriority ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 SQosDataFrameHeader::UserPriority() const + { + return ( ReadUint16Toh( &iQosControl ) & KWmmUserPriorityMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool SQosDataFrameHeader::AmsduPresent() const + { + return ( ReadUint16Toh( &iQosControl ) & KAmsduPresentMask ); + } + +typedef SQosDataFrameHeader SQosNullDataFrame; + +/** +* 802.11 QoS data frame MAC header with HT Control field +*/ +#pragma pack( 1 ) +struct SHtQosDataFrameHeader + { + /** 802.11 data frame MAC header */ + SQosDataFrameHeader iQosDataFrameHdr; // 26 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + /** + * Constructor + */ + inline SHtQosDataFrameHeader(); + + /** + * Resets the HT Control field to zero + */ + inline void ResetHtControl(); + } __PACKED; // 30 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtQosDataFrameHeader::SHtQosDataFrameHeader() + { + WriteHtoUint32( &iHtControl, 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtQosDataFrameHeader::ResetHtControl() + { + WriteHtoUint32( &iHtControl, 0 ); + } + +typedef SHtQosDataFrameHeader SHtQosNullDataFrame; + +/** +* 802.11 A-MSDU subframe header +*/ +#pragma pack( 1 ) +struct SAmsduSubframeHeader + { + /** destination MAC address */ + TMacAddress iDa; // 6 bytes + /** source MAC address */ + TMacAddress iSa; // 6 bytes + /** length of the MSDU in bytes */ + TUint16 iLength; // 2 bytes + + /** + * Returns the length of the MSDU in bytes + */ + inline TUint16 Length() const; + +private: + + /** Prohibit default contructor */ + SAmsduSubframeHeader(); + /** Prohibit assignment operator */ + SAmsduSubframeHeader& operator= ( const SAmsduSubframeHeader&); + /** Prohibit copy constructor */ + SAmsduSubframeHeader( const SAmsduSubframeHeader& ); + } __PACKED; // 14 bytes + +// --------------------------------------------------------------------------- +// We need to reverse the byte order as according to IEEE 802.11n/D6.04 +// "The order of these fields and the bits within these fields (#2061) is +// the same as the IEEE 802.3 frame format", and IEEE 802.3 specifies the +// byte order of this field to be MSB first. WLAN MAC layer, however, uses +// LSB first byte order +// --------------------------------------------------------------------------- +// +inline TUint16 SAmsduSubframeHeader::Length() const + { + return ReverseUint16( ReadUint16Toh( &iLength ) ); + } + + +/** +* 802.11 management frame MAC header +*/ +#pragma pack( 1 ) +struct SManagementFrameHeader + { + /** frame control field */ + SFrameControl iFrameControl; // 2 bytes + /** duration field */ + TUint16 iDuration; // 2 bytes + /** DA address field */ + TMacAddress iDA; // 6 bytes frames destination = AP + /** SA address field */ + TMacAddress iSA; // 6 bytes source address + /** BSSID address field */ + TMacAddress iBSSID; // 6 bytes BSS identifier = iDA + /** sequence control field */ + TUint16 iSeqCtl; // 2 bytes + + /** + * Ctor + * @param aTypeMask frame control type mask + * @param aControlMask frame control control mask + */ + inline SManagementFrameHeader( + T802Dot11FrameControlTypeMask aTypeMask, + T802Dot11FrameControlBitMask aControlMask + = static_cast( 0 ) ); + + /** + * Set WEP bit from Frame Control Field + */ + inline void SetWepBit(); + /** + * Clear WEP bit from Frame Control Field + */ + inline void ClearWepBit(); + /** + * Sets Order bit from Frame Control field + */ + inline void SetOrderBit(); + +private: + + /** Prohibit default constructor */ + SManagementFrameHeader(); + /** Prohibit assignment operator */ + SManagementFrameHeader& operator= ( const SManagementFrameHeader& aObj ); + /** Prohibit copy constructor */ + SManagementFrameHeader( const SManagementFrameHeader& ); + } __PACKED; + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SManagementFrameHeader::SManagementFrameHeader( + T802Dot11FrameControlTypeMask aTypeMask, + T802Dot11FrameControlBitMask aControlMask ) : + iFrameControl( aTypeMask, aControlMask ), + iDA( KZeroMacAddr ), + iSA( KZeroMacAddr ), + iBSSID( KZeroMacAddr ) + { + WriteHtoUint16( &iDuration, 0 ); + WriteHtoUint16( &iSeqCtl, 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SManagementFrameHeader::SetWepBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SManagementFrameHeader::ClearWepBit() + { + iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SManagementFrameHeader::SetOrderBit() + { + iFrameControl.iControl |= ( E802Dot11FrameControlOrderMask >> 8 ); + } + + +/** +* 802.11 management frame MAC header with HT Control field +*/ +#pragma pack( 1 ) +struct SHtManagementFrameHeader + { + /** 802.11 management frame MAC header */ + SManagementFrameHeader iMgmtFrameHdr; // 24 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + + /** + * Resets the HT Control field to zero + */ + inline void ResetHtControl(); + +private: + + /** Prohibit default contructor */ + SHtManagementFrameHeader(); + /** Prohibit assignment operator */ + SHtManagementFrameHeader& operator= ( const SHtManagementFrameHeader& ); + /** Prohibit copy constructor */ + SHtManagementFrameHeader( const SHtManagementFrameHeader& ); + } __PACKED; // 28 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtManagementFrameHeader::ResetHtControl() + { + WriteHtoUint32( &iHtControl, 0 ); + } + + +/** +* 802.11 fixed fields of beacon and probe response frames +* +* @since S60 v3.2 +*/ +#pragma pack( 1 ) +struct SScanResponseFixedFields + { + enum { KTimestampLenInWords = 2 }; + + /** timestamp fixed field */ + TUint32 iTimestamp[KTimestampLenInWords]; // 8 bytes + /** beacon interval fixed field */ + TUint16 iBeaconInterval; // 2 bytes + /** capability fixed field */ + SCapabilityInformationField iCapability; // 2 bytes + + /** + * Returns the beacon interval + * + * @since S60 3.2 + * @return beacon interval + */ + inline TUint16 BeaconInterval() const; + +private: + + /** Prohibit default constructor */ + SScanResponseFixedFields(); + /** Prohibit assignment operator */ + SScanResponseFixedFields& operator= ( + const SScanResponseFixedFields& ); + /** Prohibit copy constructor */ + SScanResponseFixedFields( const SScanResponseFixedFields& ); + } __PACKED; + +inline TUint16 SScanResponseFixedFields::BeaconInterval() const + { + return ( ReadUint16Toh( &iBeaconInterval ) ); + } + +/** +* 802.11 fixed length components required in +* authentication request management frame +*/ +#pragma pack( 1 ) +struct SAuthenticationFixedFields + { + /** algorithm number */ + TUint16 iAlgorithmNumber; // 2 bytes + /** sequence number */ + TUint16 iSequenceNmbr; // 2 bytes + /** status code */ + TUint16 iStatusCode; // 2 bytes + + /** + * Ctor + * @param aAlgorithm authentication mode used + * @param aSeqNmbr sequence number used + * @param aStatusCode status code used + */ + inline SAuthenticationFixedFields( + const TUint16 aAlgorithm = K802Dot11AuthModeOpen, + const TUint16 aSeqNmbr = E802Dot11AuthenticationSeqNmbr1, + const T802Dot11ManagementStatusCode aStatusCode + = E802Dot11StatusSuccess ); + + /** + * Returns the authentication transaction algorithm number + * @return sequence number + */ + inline TUint16 AlgorithmNumber() const; + + /** + * Sets the authentication transaction algorithm number + * @param aSequenceNumber value to be set + */ + inline void SetAlgorithmNumber( + TUint16 aAlgorithmNumber ); + + /** + * Returns the authentication transaction sequence number + * @return sequence number + */ + inline TUint16 SequenceNumber() const; + + /** + * Sets the authentication transaction sequence number + * @param aSequenceNumber value to be set + */ + inline void SetSequenceNumber( TUint16 aSequenceNumber ); + + /** + * Returns the authentication transaction status code + * @return status code + */ + inline TUint16 StatusCode() const; + + } __PACKED; + +inline SAuthenticationFixedFields::SAuthenticationFixedFields( + const TUint16 aAlgorithm, + const TUint16 aSeqNmbr, + const T802Dot11ManagementStatusCode aStatusCode ) + { + WriteHtoUint16( &iAlgorithmNumber, static_cast( aAlgorithm ) ); + WriteHtoUint16( &iSequenceNmbr, static_cast( aSeqNmbr ) ); + WriteHtoUint16( &iStatusCode, static_cast( aStatusCode ) ); + } + +inline TUint16 SAuthenticationFixedFields::AlgorithmNumber() const + { + return ( ReadUint16Toh( &iAlgorithmNumber ) ); + } + +inline void SAuthenticationFixedFields::SetAlgorithmNumber( TUint16 aAlgorithmNumber ) + { + WriteHtoUint16( &iAlgorithmNumber, aAlgorithmNumber ); + } + +inline TUint16 SAuthenticationFixedFields::SequenceNumber() const + { + return ( ReadUint16Toh( &iSequenceNmbr ) ); + } + +inline void SAuthenticationFixedFields::SetSequenceNumber( + TUint16 aSequenceNumber ) + { + WriteHtoUint16( &iSequenceNmbr, aSequenceNumber ); + } + +inline TUint16 SAuthenticationFixedFields::StatusCode() const + { + return ( ReadUint16Toh( &iStatusCode ) ); + } + + +/** +* 802.11 authentication management frame +*/ +#pragma pack( 1 ) +struct SAuthenticationFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** authentication frame fixed fields */ + SAuthenticationFixedFields iAuthenticationFields; // 6 bytes + + /** Ctor */ + SAuthenticationFrame() + : iHeader( E802Dot11FrameTypeAuthentication ) {}; + + /** Increments sequnece number to next number we shall send */ + inline void IncrementSeqNmbr(); + + /** Resets sequnece number to initial value */ + inline void ResetSeqNmbr(); + + /** + * Gets the frames sequence number + * @return frames sequence number + */ + inline TUint16 GetSeqNmbr() const; + + /** + * Gets the frames status code field + * @return frames status code field + */ + inline TUint16 GetStatusCode() const; + + /** + * Gets the algorithm number + * @return algorithm number + */ + inline TUint16 GetAlgorithmNumber() const; + + /** Sets the WEP bit from frame control field */ + inline void SetWepBit(); + + /** Clears the WEP bit from frame control field */ + inline void ClearWepBit(); + + /** + * Sets the the algorithm number field + * @param aAlgorithm algorithm to be used + */ + inline void SetAlgorithmNmbr( TUint16 aAlgorithm ); + +private: + + /** Prohibit assignment operator */ + SAuthenticationFrame& operator= ( const SAuthenticationFrame& ); + /** Prohibit copy constructor */ + SAuthenticationFrame( const SAuthenticationFrame& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::IncrementSeqNmbr() + { + iAuthenticationFields.SetSequenceNumber( + iAuthenticationFields.SequenceNumber() + 2 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::ResetSeqNmbr() + { + iAuthenticationFields.SetSequenceNumber( E802Dot11AuthenticationSeqNmbr1 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SAuthenticationFrame::GetSeqNmbr() const + { + return ( iAuthenticationFields.SequenceNumber() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SAuthenticationFrame::GetStatusCode() const + { + return ( iAuthenticationFields.StatusCode() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::SetAlgorithmNmbr( + TUint16 aAlgorithm ) + { + iAuthenticationFields.SetAlgorithmNumber( aAlgorithm ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SAuthenticationFrame::GetAlgorithmNumber() const + { + return ( iAuthenticationFields.AlgorithmNumber() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::SetWepBit() + { + iHeader.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAuthenticationFrame::ClearWepBit() + { + iHeader.ClearWepBit(); + } + + +/** +* 802.11 authentication management frame with HT Control field +*/ +#pragma pack( 1 ) +struct SHtAuthenticationFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + /** authentication frame fixed fields */ + SAuthenticationFixedFields iAuthenticationFields; // 6 bytes + + /** Ctor */ + SHtAuthenticationFrame() + : iHeader( E802Dot11FrameTypeAuthentication ) + { + WriteHtoUint32( &iHtControl, 0 ); + // as the HT Control field is present, the order bit needs to be set + iHeader.SetOrderBit(); + }; + + /** Increments sequnece number to next number we shall send */ + inline void IncrementSeqNmbr(); + + /** Resets sequnece number to initial value */ + inline void ResetSeqNmbr(); + + /** + * Gets the frames sequence number + * @return frames sequence number + */ + inline TUint16 GetSeqNmbr() const; + + /** + * Gets the frames status code field + * @return frames status code field + */ + inline TUint16 GetStatusCode() const; + + /** + * Gets the algorithm number + * @return algorithm number + */ + inline TUint16 GetAlgorithmNumber() const; + + /** Sets the WEP bit from frame control field */ + inline void SetWepBit(); + + /** Clears the WEP bit from frame control field */ + inline void ClearWepBit(); + + /** + * Sets the the algorithm number field + * @param aAlgorithm algorithm to be used + */ + inline void SetAlgorithmNmbr( TUint16 aAlgorithm ); + +private: + + /** Prohibit assignment operator */ + SHtAuthenticationFrame& operator= ( const SHtAuthenticationFrame& ); + /** Prohibit copy constructor */ + SHtAuthenticationFrame( const SHtAuthenticationFrame& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAuthenticationFrame::IncrementSeqNmbr() + { + iAuthenticationFields.SetSequenceNumber( + iAuthenticationFields.SequenceNumber() + 2 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAuthenticationFrame::ResetSeqNmbr() + { + iAuthenticationFields.SetSequenceNumber( E802Dot11AuthenticationSeqNmbr1 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SHtAuthenticationFrame::GetSeqNmbr() const + { + return ( iAuthenticationFields.SequenceNumber() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SHtAuthenticationFrame::GetStatusCode() const + { + return ( iAuthenticationFields.StatusCode() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAuthenticationFrame::SetAlgorithmNmbr( + TUint16 aAlgorithm ) + { + iAuthenticationFields.SetAlgorithmNumber( aAlgorithm ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SHtAuthenticationFrame::GetAlgorithmNumber() const + { + return ( iAuthenticationFields.AlgorithmNumber() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAuthenticationFrame::SetWepBit() + { + iHeader.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAuthenticationFrame::ClearWepBit() + { + iHeader.ClearWepBit(); + } + + +/** +* 802.11 fixed length components required +* in association request management frame +*/ +#pragma pack( 1 ) +struct SAssociationRequestFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** listeninterval fixed field */ + SListenIntervalField iListenInterval; // 2 bytes + + /** Ctor */ + SAssociationRequestFixedFields() {}; + +private: + + /** Prohibit assignment operator */ + SAssociationRequestFixedFields& operator= ( + const SAssociationRequestFixedFields& ); + /** Prohibit copy constructor */ + SAssociationRequestFixedFields( + const SAssociationRequestFixedFields& ); + } __PACKED; + +/** +* operator== for SAssociationRequestFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SAssociationRequestFixedFields& aLhs, + const SAssociationRequestFixedFields& aRhs) + { + return static_cast( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo + && aLhs.iListenInterval == aRhs.iListenInterval ); + } + + +/** +* 802.11 association request management frame +* excluding variable length information elements +* - SSID +* - supported rates +*/ +#pragma pack( 1 ) +struct SAssociationRequestFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** association request fixed fields */ + SAssociationRequestFixedFields iFixedFields; // 4 bytes + + /** Ctor */ + SAssociationRequestFrame() + : iHeader( E802Dot11FrameTypeAssociationReq ), + iFixedFields() {}; + + /** + * Helper function to set short preamble bit in capability info + */ + inline void SetCapabilityShortPreamble(); + + /** + * Helper function to clear short preamble bit in capability info + */ + inline void ClearCapabilityShortPreamble(); + + /** + * Helper function to set PBCC bit in capability info + */ + inline void SetCapabilityPbcc(); + + /** + * Helper function to clear PBCC bit in capability info + */ + inline void ClearCapabilityPbcc(); + + /** + * Helper function to clear CF fields from capability info + */ + inline void ClearCFfields(); + + /** Helper function to clear reserved fields */ + inline void ClearReservedFields(); + + /** Helper function to set WEP bit from the capability info fixed field */ + inline void SetWepBit(); + + /** + * Helper function to clear WEP bit from + * the capability info fixed field + */ + inline void ClearWepBit(); + + /** Helper function to set Radio measurement bit from the capability info fixed field */ + inline void SetRMBit(); + + /** + * Helper function to clear Radio measurement bit from + * the capability info fixed field + */ + inline void ClearRMBit(); +private: + + /** Prohibit assignment operator */ + SAssociationRequestFrame& operator= ( + const SAssociationRequestFrame& ); + /** Prohibit copy constructor */ + SAssociationRequestFrame( + const SAssociationRequestFrame& ); + } __PACKED; // 28 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.SetShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.ClearShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.SetPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.ClearPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearCFfields() + { + iFixedFields.iCapabilityInfo.ClearCfFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearReservedFields() + { + iFixedFields.iCapabilityInfo.ClearReservedFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetRMBit() + { + iFixedFields.iCapabilityInfo.SetRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearRMBit() + { + iFixedFields.iCapabilityInfo.ClearRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::SetWepBit() + { + iFixedFields.iCapabilityInfo.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SAssociationRequestFrame::ClearWepBit() + { + iFixedFields.iCapabilityInfo.ClearWepBit(); + } + + +/** +* 802.11 association request management frame with HT Control field +* excluding variable length information elements +* - SSID +* - supported rates +*/ +#pragma pack( 1 ) +struct SHtAssociationRequestFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + /** association request fixed fields */ + SAssociationRequestFixedFields iFixedFields; // 4 bytes + + /** Ctor */ + SHtAssociationRequestFrame() + : iHeader( E802Dot11FrameTypeAssociationReq ), + iFixedFields() + { + WriteHtoUint32( &iHtControl, 0 ); + // as the HT Control field is present, the order bit needs to be set + iHeader.SetOrderBit(); + }; + + /** + * Helper function to set short preamble bit in capability info + */ + inline void SetCapabilityShortPreamble(); + + /** + * Helper function to clear short preamble bit in capability info + */ + inline void ClearCapabilityShortPreamble(); + + /** + * Helper function to set PBCC bit in capability info + */ + inline void SetCapabilityPbcc(); + + /** + * Helper function to clear PBCC bit in capability info + */ + inline void ClearCapabilityPbcc(); + + /** + * Helper function to clear CF fields from capability info + */ + inline void ClearCFfields(); + + /** Helper function to clear reserved fields */ + inline void ClearReservedFields(); + + /** Helper function to set WEP bit from the capability info fixed field */ + inline void SetWepBit(); + + /** + * Helper function to clear WEP bit from + * the capability info fixed field + */ + inline void ClearWepBit(); + + /** Helper function to set Radio measurement bit from the capability info fixed field */ + inline void SetRMBit(); + + /** + * Helper function to clear Radio measurement bit from + * the capability info fixed field + */ + inline void ClearRMBit(); + +private: + + /** Prohibit assignment operator */ + SHtAssociationRequestFrame& operator= ( + const SHtAssociationRequestFrame& ); + /** Prohibit copy constructor */ + SHtAssociationRequestFrame( + const SHtAssociationRequestFrame& ); + } __PACKED; // 32 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::SetCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.SetShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::ClearCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.ClearShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::SetCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.SetPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::ClearCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.ClearPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::ClearCFfields() + { + iFixedFields.iCapabilityInfo.ClearCfFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::ClearReservedFields() + { + iFixedFields.iCapabilityInfo.ClearReservedFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::SetRMBit() + { + iFixedFields.iCapabilityInfo.SetRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::ClearRMBit() + { + iFixedFields.iCapabilityInfo.ClearRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::SetWepBit() + { + iFixedFields.iCapabilityInfo.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtAssociationRequestFrame::ClearWepBit() + { + iFixedFields.iCapabilityInfo.ClearWepBit(); + } + + +/** +* 802.11 association response frame fixed fields +*/ +#pragma pack( 1 ) +struct SAssociationResponseFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** status code fixed field */ + TUint16 iStatusCode; // 2 bytes + /** AID fixed field */ + TUint16 iAID; // 2 bytes + + /** + * Returns the association response status code + * @return status code + */ + inline TUint16 StatusCode() const; + + /** + * Returns the Association ID (AID) + * @return AID + */ + inline TUint16 Aid() const; + +private: + + /** Prohibit default constructor */ + SAssociationResponseFixedFields(); + /** Prohibit assignment operator */ + SAssociationResponseFixedFields& operator= ( + const SAssociationResponseFixedFields& ); + /** Prohibit copy constructor */ + SAssociationResponseFixedFields( const SAssociationResponseFixedFields& ); + } __PACKED; + +inline TUint16 SAssociationResponseFixedFields::StatusCode() const + { + return ( ReadUint16Toh( &iStatusCode ) ); + } + +inline TUint16 SAssociationResponseFixedFields::Aid() const + { + return ( ReadUint16Toh( &iAID ) ); + } + + +/** +* 802.11 fixed length components required in deauthenticate frame +*/ +#pragma pack( 1 ) +struct SDeauthenticateFixedFields + { + /** reason code fixed field */ + TUint16 iReasonCode; + + /** Ctor */ + inline SDeauthenticateFixedFields(); + + /* + * Returns the reason code + * @return Reason code + */ + inline TUint16 ReasonCode() const; + + /** Setter for the reason code */ + inline void SetReasonCode( TUint16 aReasonCode ); + +private: + + /** Prohibit assignment operator */ + SDeauthenticateFixedFields& operator= ( + const SDeauthenticateFixedFields& ); + /** Prohibit copy constructor */ + SDeauthenticateFixedFields( const SDeauthenticateFixedFields& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDeauthenticateFixedFields::SDeauthenticateFixedFields() + { + WriteHtoUint16( &iReasonCode, E802Dot11ReasonDeauthStationLeft ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SDeauthenticateFixedFields::ReasonCode() const + { + return ( ReadUint16Toh( &iReasonCode ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDeauthenticateFixedFields::SetReasonCode( TUint16 aReasonCode ) + { + WriteHtoUint16( &iReasonCode, aReasonCode ); + } + +/** +* operator== for SDeauthenticateFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDeauthenticateFixedFields& aLhs, + const SDeauthenticateFixedFields& aRhs) + { + return static_cast( + aLhs.ReasonCode() == aRhs.ReasonCode() ); + } + +/** +* 802.11 deauthenticate management frame +*/ +#pragma pack( 1 ) +struct SDeauthenticateFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** reason code fixed field */ + SDeauthenticateFixedFields iReasonCode; // 2 bytes + + /** Ctor */ + SDeauthenticateFrame() + : iHeader( E802Dot11FrameTypeDeauthentication ), + iReasonCode() {}; + +private: + + /** Prohibit assignment operator */ + SDeauthenticateFrame& operator= ( const SDeauthenticateFrame& ); + /** Prohibit copy constructor */ + SDeauthenticateFrame( const SDeauthenticateFrame& ); + } __PACKED; + +/** +* operator== for SDeauthenticateFrame +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDeauthenticateFrame& aLhs, + const SDeauthenticateFrame& aRhs) + { + return ( aLhs == aRhs ); + } + + +/** +* 802.11 deauthenticate management frame with HT Control field +*/ +#pragma pack( 1 ) +struct SHtDeauthenticateFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + /** reason code fixed field */ + SDeauthenticateFixedFields iReasonCode; // 2 bytes + + /** Ctor */ + SHtDeauthenticateFrame() + : iHeader( E802Dot11FrameTypeDeauthentication ), + iReasonCode() + { + WriteHtoUint32( &iHtControl, 0 ); + // as the HT Control field is present, the order bit needs to be set + iHeader.SetOrderBit(); + }; + +private: + + /** Prohibit assignment operator */ + SHtDeauthenticateFrame& operator= ( const SHtDeauthenticateFrame& ); + /** Prohibit copy constructor */ + SHtDeauthenticateFrame( const SHtDeauthenticateFrame& ); + } __PACKED; + +/** +* operator== for SHtDeauthenticateFrame +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SHtDeauthenticateFrame& aLhs, + const SHtDeauthenticateFrame& aRhs) + { + return ( aLhs == aRhs ); + } + + +/** +* 802.11 fixed length components required in disassociate frame +*/ +#pragma pack( 1 ) +struct SDisAssociateFixedFields + { + /** reason code fixed field */ + TUint16 iReasonCode; + + /** Ctor */ + inline SDisAssociateFixedFields(); + + /* + * Returns the reason code + * @return Reason code + */ + inline TUint16 ReasonCode() const; + + /** Setter for the reason code */ + inline void SetReasonCode( TUint16 aReasonCode ); + +private: + // Prohibit assignment operator + SDisAssociateFixedFields& operator= ( const SDisAssociateFixedFields& ); + // Prohibit copy constructor + SDisAssociateFixedFields( const SDisAssociateFixedFields& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDisAssociateFixedFields::SDisAssociateFixedFields() + { + WriteHtoUint16( &iReasonCode, E802Dot11ReasonClass3FrameWhenNotAssoc ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SDisAssociateFixedFields::ReasonCode() const + { + return ( ReadUint16Toh( &iReasonCode ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SDisAssociateFixedFields::SetReasonCode( TUint16 aReasonCode ) + { + WriteHtoUint16( &iReasonCode, aReasonCode ); + } + +/** +* operator== for SDisAssociateFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDisAssociateFixedFields& aLhs, + const SDisAssociateFixedFields& aRhs) + { + return static_cast( + aLhs.ReasonCode() == aRhs.ReasonCode() ); + } + +/** +* 802.11 disassociate management frame +*/ +#pragma pack( 1 ) +struct SDisassociateFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** reason code fixed field */ + SDisAssociateFixedFields iReasonCode; // 2 bytes + + /** Ctor */ + SDisassociateFrame() + : iHeader( E802Dot11FrameTypeDisassociation ), + iReasonCode() {}; + +private: + + /** Prohibit assignment operator */ + SDisassociateFrame& operator= ( const SDisassociateFrame& ); + /** Prohibit copy constructor */ + SDisassociateFrame( const SDisassociateFrame& ); + } __PACKED; // 26 bytes + +/** +* operator== for SDisassociateFrame +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SDisassociateFrame& aLhs, + const SDisassociateFrame& aRhs) + { + return ( aLhs == aRhs ); + } + + +/** +* 802.11 disassociate management frame with HT Control field +*/ +#pragma pack( 1 ) +struct SHtDisassociateFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + /** reason code fixed field */ + SDisAssociateFixedFields iReasonCode; // 2 bytes + + /** Ctor */ + SHtDisassociateFrame() + : iHeader( E802Dot11FrameTypeDisassociation ), + iReasonCode() + { + WriteHtoUint32( &iHtControl, 0 ); + // as the HT Control field is present, the order bit needs to be set + iHeader.SetOrderBit(); + }; + +private: + + /** Prohibit assignment operator */ + SHtDisassociateFrame& operator= ( const SHtDisassociateFrame& ); + /** Prohibit copy constructor */ + SHtDisassociateFrame( const SHtDisassociateFrame& ); + } __PACKED; // 30 bytes + +/** +* operator== for SHtDisassociateFrame +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SHtDisassociateFrame& aLhs, + const SHtDisassociateFrame& aRhs) + { + return ( aLhs == aRhs ); + } + + +/** +* 802.11 fixed length components required +* in reassociation request management frame +*/ +#pragma pack( 1 ) +struct SReassociationRequestFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** listeninterval fixed field */ + SListenIntervalField iListenInterval; // 2 bytes + /** current AP address fixed field */ + TMacAddress iCurrentApAddress; // 6 bytes + + /** Ctor */ + inline SReassociationRequestFixedFields(); + +private: + + /** Prohibit assignment operator */ + SReassociationRequestFixedFields& operator= ( + const SReassociationRequestFixedFields& ); + /** Prohibit copy constructor */ + SReassociationRequestFixedFields( + const SReassociationRequestFixedFields& ); + } __PACKED; + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SReassociationRequestFixedFields::SReassociationRequestFixedFields() : + iCurrentApAddress( KZeroMacAddr ) + { + } + + +/** +* operator== for SReassociationRequestFixedFields +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SReassociationRequestFixedFields& aLhs, + const SReassociationRequestFixedFields& aRhs) + { + return static_cast( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo + && aLhs.iListenInterval == aRhs.iListenInterval + && aLhs.iCurrentApAddress == aRhs.iCurrentApAddress ); + } + +/** +* 802.11 reassociation request management frame +* excluding variable length information elements +*/ +#pragma pack( 1 ) +struct SReassociationRequestFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** association request fixed fields */ + SReassociationRequestFixedFields iFixedFields; // 10 bytes + + /** Ctor */ + SReassociationRequestFrame() + : iHeader( E802Dot11FrameTypeReassociationReq ), + iFixedFields() {}; + + /** + * Helper function to set short preamble bit in capability info + */ + inline void SetCapabilityShortPreamble(); + + /** + * Helper function to clear short preamble bit in capability info + */ + inline void ClearCapabilityShortPreamble(); + + /** + * Helper function to set PBCC bit in capability info + */ + inline void SetCapabilityPbcc(); + + /** + * Helper function to clear PBCC bit in capability info + */ + inline void ClearCapabilityPbcc(); + + /** + * Helper function to clear CF fields from capability info + */ + inline void ClearCFfields(); + + /** Helper function to clear reserved fields */ + inline void ClearReservedFields(); + + /** Helper function to set WEP bit from the capability info fixed field */ + inline void SetWepBit(); + + /** + * Helper function to clear WEP bit from + * the capability info fixed field + */ + inline void ClearWepBit(); + + /** Helper function to set Radio measurement bit from the capability info fixed field */ + inline void SetRMBit(); + + /** + * Helper function to clear Radio measurement bit from + * the capability info fixed field + */ + inline void ClearRMBit(); + +private: + + /** Prohibit assignment operator */ + SReassociationRequestFrame& operator= ( + const SReassociationRequestFrame& ); + /** Prohibit copy constructor */ + SReassociationRequestFrame( + const SReassociationRequestFrame& ); + } __PACKED; // 34 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.SetShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.ClearShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.SetPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.ClearPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearCFfields() + { + iFixedFields.iCapabilityInfo.ClearCfFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearReservedFields() + { + iFixedFields.iCapabilityInfo.ClearReservedFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetRMBit() + { + iFixedFields.iCapabilityInfo.SetRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearRMBit() + { + iFixedFields.iCapabilityInfo.ClearRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::SetWepBit() + { + iFixedFields.iCapabilityInfo.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SReassociationRequestFrame::ClearWepBit() + { + iFixedFields.iCapabilityInfo.ClearWepBit(); + } + + +/** +* 802.11 reassociation request management frame with HT Control field +* excluding variable length information elements +*/ +#pragma pack( 1 ) +struct SHtReassociationRequestFrame + { + /** management frame header */ + SManagementFrameHeader iHeader; // 24 bytes + /** HT control field */ + TUint32 iHtControl; // 4 bytes + /** association request fixed fields */ + SReassociationRequestFixedFields iFixedFields; // 10 bytes + + /** Ctor */ + SHtReassociationRequestFrame() + : iHeader( E802Dot11FrameTypeReassociationReq ), + iFixedFields() + { + WriteHtoUint32( &iHtControl, 0 ); + // as the HT Control field is present, the order bit needs to be set + iHeader.SetOrderBit(); + }; + + /** + * Helper function to set short preamble bit in capability info + */ + inline void SetCapabilityShortPreamble(); + + /** + * Helper function to clear short preamble bit in capability info + */ + inline void ClearCapabilityShortPreamble(); + + /** + * Helper function to set PBCC bit in capability info + */ + inline void SetCapabilityPbcc(); + + /** + * Helper function to clear PBCC bit in capability info + */ + inline void ClearCapabilityPbcc(); + + /** + * Helper function to clear CF fields from capability info + */ + inline void ClearCFfields(); + + /** Helper function to clear reserved fields */ + inline void ClearReservedFields(); + + /** Helper function to set Radio measurement bit from the capability info fixed field */ + inline void SetRMBit(); + + /** + * Helper function to clear Radio measurement bit from + * the capability info fixed field + */ + inline void ClearRMBit(); + + /** Helper function to set WEP bit from the capability info fixed field */ + inline void SetWepBit(); + + /** + * Helper function to clear WEP bit from + * the capability info fixed field + */ + inline void ClearWepBit(); + +private: + + /** Prohibit assignment operator */ + SHtReassociationRequestFrame& operator= ( + const SHtReassociationRequestFrame& ); + /** Prohibit copy constructor */ + SHtReassociationRequestFrame( + const SHtReassociationRequestFrame& ); + } __PACKED; // 38 bytes + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::SetCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.SetShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::ClearCapabilityShortPreamble() + { + iFixedFields.iCapabilityInfo.ClearShortPreamble(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::SetCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.SetPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::ClearCapabilityPbcc() + { + iFixedFields.iCapabilityInfo.ClearPbcc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::ClearCFfields() + { + iFixedFields.iCapabilityInfo.ClearCfFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::ClearReservedFields() + { + iFixedFields.iCapabilityInfo.ClearReservedFields(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::SetRMBit() + { + iFixedFields.iCapabilityInfo.SetRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::ClearRMBit() + { + iFixedFields.iCapabilityInfo.ClearRMBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::SetWepBit() + { + iFixedFields.iCapabilityInfo.SetWepBit(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void SHtReassociationRequestFrame::ClearWepBit() + { + iFixedFields.iCapabilityInfo.ClearWepBit(); + } + + +/** +* 802.11 reassociation response frame fixed fields +*/ +#pragma pack( 1 ) +struct SReassociationResponseFixedFields + { + /** capability info fixed field */ + SCapabilityInformationField iCapabilityInfo; // 2 bytes + /** status code fixed field */ + TUint16 iStatusCode; // 2 bytes + /** AID fixed field */ + TUint16 iAID; // 2 bytes + + /* + * Returns the reassociation response status code + * @return status code + */ + inline TUint16 StatusCode() const; + + /* + * Returns the Asociation ID (AID) + * @return AID + */ + inline TUint16 Aid() const; + +private: + + /** Prohibit default constructor */ + SReassociationResponseFixedFields(); + /** Prohibit assignment operator */ + SReassociationResponseFixedFields& operator= ( + const SReassociationResponseFixedFields& ); + /** Prohibit copy constructor */ + SReassociationResponseFixedFields( const SReassociationResponseFixedFields& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SReassociationResponseFixedFields::StatusCode() const + { + return ( ReadUint16Toh( &iStatusCode ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 SReassociationResponseFixedFields::Aid() const + { + return ( ReadUint16Toh( &iAID ) ); + } + + +/** +* SNAP header +*/ +#pragma pack( 1 ) +struct SSnapHeader + { + /** destination service access point */ + TUint8 iDSAP; + /** source service access point */ + TUint8 iSSAP; + /** control field */ + TUint8 iControl; + /** organizationally unique identifier */ + TUint8 iOUI[KOIULength]; // 3 + } __PACKED; // 6 bytes + +/** +* operator== for SSnapHeader +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +inline TBool operator== ( + const SSnapHeader& aLhs, + const SSnapHeader& aRhs) + { + return ( equal( reinterpret_cast(&aLhs), + reinterpret_cast(&aLhs) + sizeof(SSnapHeader), + reinterpret_cast(&aRhs) )); + } + +/** +* RFC 1042 encapsulation SNAP header +*/ +const SSnapHeader KEncapsulatingRfc1042SnapHeader + = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0x00 } }; + +/** +* 802.1 h SNAP header +*/ +const SSnapHeader KEncapsulating802_1hSnapHeader + = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0xF8 } }; + +/** +* 802.11 data frame encapsulation header +*/ +#pragma pack( 1 ) +struct SDataFrameEncapsulationHeader + { + /** SNAP header */ + SSnapHeader iSnapHeader; // 6 + } __PACKED; + +/** +* 802.11 data frame and its encapsulation header combined +*/ +#pragma pack( 1 ) +struct SDataMpduHeader + { + /** Ctor */ + SDataMpduHeader() + { + iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader; + } + + /** 802.11 data frame header */ + SDataFrameHeader iHdr; // 24 + /** 802.11 data frame encapsulation header */ + SDataFrameEncapsulationHeader iEncHdr; // 6 + } __PACKED; // 30 + +/* + 802.2 SNAP DATA Frame + +----------------+ + | | + | Destination | + | 6 bytes | + +----------------+ + | | + | Source | + | 6 bytes | + +----------------+ + | Frame Length | Must be <= 1500 Dec. + | 2 bytes | + +----------------+ + | DSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + | SSAP - 1 byte | = 0xAA ( SNAP ) + +----------------+ + |Control - 1 byte| = 0x03 + +----------------+ + | OUI - 3 bytes | = 0x0 + | | + +----------------+ + | Type - 2 bytes | = Ethernet type (IP=0x0800) + +----------------+ + | | + | Data | + | | + ~ ~ + ~ ~ + | 46 to 1500 | + | bytes | + | | + +----------------+ + | FCS | + | 4 bytes | + +----------------+ +*/ + +/* +This is an Ethernet Version 2 frame: + + +--------------+ + | | The destination address is a six byte Media Access + | Destination | Control (MAC) address, usually burned into the + | 6 bytes | ROM of the Ethernet card. + +--------------+ + | | The source address is a six byte MAC address, and + | Source | can signify a physical station or a broadcast. + | 6 bytes | + +--------------+ + | Type | The Type field it must be grater then 1500 dec. + | 2 bytes | + +--------------+ + | | Any higher layer information is placed in the + | Data | data field, which could contain protocol + | | information or user data. + ~ ~ + ~ ~ + | 46 to 1500 | + | bytes | + | | + +--------------+ + | FCS | + | 4 bytes | + +--------------+ + +*/ + +/** +* 802.11 QoS data frame and its encapsulation header combined +*/ +#pragma pack( 1 ) +struct SQosDataMpduHeader + { + /** Ctor */ + SQosDataMpduHeader() + { + iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader; + } + + /** 802.11 QoS data frame header */ + SQosDataFrameHeader iHdr; // 26 + /** 802.11 data frame encapsulation header */ + SDataFrameEncapsulationHeader iEncHdr; // 6 + } __PACKED; // 33 + +const TUint16 KUint16HiByteMask = 0xFF00; + +/** +* Ethernet 14-byte Header (RFC 894) +*/ +#pragma pack( 1 ) +struct SEthernetHeader + { + /** destination MAC address */ + TMacAddress iDA; // 6 + /** source MAC address */ + TMacAddress iSA; // 6 + /** ethernet type field */ + TUint16 iType; // 2 + + /** + * Returns the Ethernet Type + * @return ethernet type + */ + inline TUint16 Type() const; + +private: + + /** Prohibit default contructor */ + SEthernetHeader(); + /** Prohibit assignment operator */ + SEthernetHeader& operator= ( const SEthernetHeader& ); + /** Prohibit copy constructor */ + SEthernetHeader( const SEthernetHeader& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// We need to reverse the byte order as the IP world uses different byter +// order (MSB first) as WLAN MAC layer (LSB first) +// --------------------------------------------------------------------------- +// +inline TUint16 SEthernetHeader::Type() const + { + return ReverseUint16( ReadUint16Toh( &iType ) ); + } + +/** +* Ethernet type field +*/ +#pragma pack( 1 ) +struct SEthernetType + { + /** type field */ + TUint16 iType; // 2 + + /** + * Returns the Ethernet Type + * @return ethernet type + */ + inline TUint16 Type() const; + +private: + + /** Prohibit default contructor */ + SEthernetType(); + /** Prohibit assignment operator */ + SEthernetType& operator= ( const SEthernetType& ); + /** Prohibit copy constructor */ + SEthernetType( const SEthernetType& ); + } __PACKED; + +// --------------------------------------------------------------------------- +// We need to reverse the byte order as the IP world uses different byte +// order (MSB first) as WLAN MAC layer (LSB first) +// --------------------------------------------------------------------------- +// +inline TUint16 SEthernetType::Type() const + { + return ReverseUint16( ReadUint16Toh( &iType ) ); + } + + +// pop the pragma pack stack to return to normal alignment of structures +#pragma pack( ) + +#endif // WLAN802DOT11_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/802dot11DefaultValues.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/802dot11DefaultValues.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines values for some 802.11 attributes. +* +*/ + +/* +* %version: 16 % +*/ + +#ifndef _802DOT11DOT11DEFAULTVALUES_H +#define _802DOT11DOT11DEFAULTVALUES_H + +/** +* The time (in TUs) how long an MSDU can stay in +* a transmit queue +*/ +enum TDot11MaxTransmitMSDULifetime + { + EDot11MaxTransmitMSDULifetimeMin = 1, + EDot11MaxTransmitMSDULifetimeMax = 0xFFFFFFFF, + EDot11MaxTransmitMSDULifetimeDefault = 512 + }; + +/** +* This attribute shall indicate the number of octets in an MPDU, +* below which an RTS/CTS handshake shall not be performed. An +* RTS/CTS handshake shall be performed at the beginning of any +* frame exchange sequence where the MPDU is of type Data or +* Management, the MPDU has an individual address in the Address1 +* field, and the length of the MPDU is greater than +* this threshold. (For additional details, refer to Table 21 in +* 9.7.) Setting this attribute to be larger than the maximum +* MSDU size shall have the effect of turning off the RTS/CTS +* handshake for frames of Data or Management type transmitted by +* this STA. Setting this attribute to zero shall have the effect +* of turning on the RTS/CTS handshake for all frames of Data or +* Management type transmitted by this STA. +*/ + +enum TDot11RTSThreshold + { + EDot11RTSThresholdMin = 0, + EDot11RTSThresholdMax = 2347, + EDot11RTSThresholdDefault = EDot11RTSThresholdMax + }; + +/** +* This attribute shall specify the number of TUs that a +* responding STA should wait for the next frame in the +* authentication sequence +*/ +enum TDot11AuthenticationResponseTimeout + { + EDot11AuthenticateResponseTimeoutMin = 1, + EDot11AuthenticateResponseTimeoutMax = 0xFFFFFFFF, + EDot11AuthenticateResponseTimeoutDefault = 250 + }; + +/** +* This attribute shall specify the number of TUs that a +* requesting STA should wait for a response to a +* transmitted association-request MMPDU +*/ +enum TDot11AssociationResponseTimeOut + { + EDot11AssociationResponseTimeOutMin = 1, + EDot11AssociationResponseTimeOutMax = 0xFFFFFFFF, + EDot11AssociationResponseTimeOutDefault = 250 + }; + +/** +* This attribute specifies the value for Listen Interval (in milliseconds), +* which is used in (re-)association request when associating to a network. +* The value here is at least the max duration of a passive scan (as an AP +* may use the listen interval in determining the lifetime of frames that it +* buffers for a STA) +*/ +const TUint16 KDot11ListenIntervalInMs( 2000 ); // 2 s + + +/** +* CwMin & CwMax values per 802.11 standard +*/ + +/** for 802.11b */ +const TUint16 KDot11CwMinB = 31; +/** for 802.11a/g */ +const TUint16 KDot11CwMinAandG = 15; +/** for 802.11a/b/g */ +const TUint16 KDot11CwMax = 1023; + + +/** +* Default WMM parameter values for a WMM station +* per WiFi WMM specification v1.1 +*/ + +/** Background */ +const TUint16 KDot11BgCwMinB = KDot11CwMinB; +const TUint16 KDot11BgCwMinAandG = KDot11CwMinAandG; +const TUint16 KDot11BgCwMax = KDot11CwMax; +const TUint8 KDot11BgAifsn = 7; +const TUint16 KDot11BgTxopLimit = 0; + +/** Best Effort (Legacy) */ +const TUint16 KDot11BeCwMinB = KDot11CwMinB; +const TUint16 KDot11BeCwMinAandG = KDot11CwMinAandG; +const TUint16 KDot11BeCwMax = KDot11CwMax; +const TUint8 KDot11BeAifsn = 3; +const TUint16 KDot11BeTxopLimit = 0; + +/** Video */ +const TUint16 KDot11ViCwMinB = ( KDot11CwMinB + 1 ) / 2 - 1; +const TUint16 KDot11ViCwMinAandG = ( KDot11CwMinAandG + 1 ) / 2 - 1; +const TUint16 KDot11ViCwMaxB = KDot11CwMinB; +const TUint16 KDot11ViCwMaxAandG = KDot11CwMinAandG; +const TUint8 KDot11ViAifsn = 2; +const TUint16 KDot11ViTxopLimitB = 6016; +const TUint16 KDot11ViTxopLimitAandG = 3008; + +/** Voice */ +const TUint16 KDot11VoCwMinB = ( KDot11CwMinB + 1 ) / 4 - 1; +const TUint16 KDot11VoCwMinAandG = ( KDot11CwMinAandG + 1 ) / 4 - 1; +const TUint16 KDot11VoCwMaxB = ( KDot11CwMinB + 1 ) / 2 - 1; +const TUint16 KDot11VoCwMaxAandG = ( KDot11CwMinAandG + 1 ) / 2 - 1; +const TUint8 KDot11VoAifsn = 2; +const TUint16 KDot11VoTxopLimitB = 3264; +const TUint16 KDot11VoTxopLimitAandG = 1504; + + +/** The minimum value of AIFSN per WiFi WMM specification v1.1 */ +const TUint8 KDot11AifsnMin = 2; + +/** +* Medium Time specifies the amount of time a Transmit queue is allowed to +* access the WLAN air interface during one second interval. +* Value 0 means that the medium time is unlimited. +*/ +const TUint16 KDot11MediumTimeDefault = 0; + +#endif // _802DOT11DOT11DEFAULTVALUES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/Umac.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/Umac.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,395 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the Umac class. +* +*/ + +/* +* %version: 32 % +*/ + +#ifndef UMAC_H +#define UMAC_H + +#include "umaceventdispatcherclient.h" +#include "UmacProtocolStackSideUmac.h" +#include "UmacProtocolStackSideUmacCb.h" +#include "UmacManagementSideUmac.h" +#include "UmacManagementSideUmacCb.h" +#include "UmacTimerClient.h" +#include "umacdfcclient.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + + +class WlanContextImpl; +class WlanConnectContext; +class WlanPrivacyModeFilters; + +class Umac : + public MWlanProtocolStackSideUmac, + public WlanProtocolStackSideUmacCb, + public WlanManagementSideUmacCb, + public MWlanManagementSideUmac, + public MWlanTimerClient, + public MWlanEventDispatcherClient, + public MWlanDfcClient + { + +public: + + /** + * C++ default constructor. + */ + Umac(); + + virtual ~Umac(); + + virtual void OnTimeout( TWlanTimer aTimer ); + + virtual void OnDfc( TAny* aCtx ); + + void CompleteManagementCommand( + TInt aReason, + const TAny* aData = NULL, + TUint32 aLengthInBytes = 0 ); + + /** + * From MManagementSideUmac + * OID request handler routine + * @param aInputBuffer Pointer to the input buffer (set-operations) + * @param aInputBufferSize Size of the buffer pointed to by aInputBuffer + * @param aOutputBuffer Pointer to the output buffer (query-operations) + * @param aOutputBufferSize Size of the buffer pointed to by aOutputBuffer + * @return Status of the operation see #TStatus + */ + virtual void HandleOid( + const TOIDHeader* aOid, + TAny* aOutputBuffer, + TUint aOutputBufferSize ); + + /** + * From MManagementSideUmac + */ + virtual void AttachWsa( WHA::Wha* aWha ); + virtual TBool Init(); + virtual void BootUp( + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ); + + virtual void FinitSystem(); + + // From MWlanProtocolStackSideUmac + + virtual const TMacAddress& StationId() const; + + /** + * Triggers the setting of the Tx offset on the protocol stack side for + * every frame type which can be transmitted + */ + virtual void SetTxOffset(); + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void TxProtocolStackData( + TDataBuffer& aDataBuffer, + TBool aMore ); + + /** + * Gets the WLAN vendor needs for extra space (bytes) in frame buffers + * + * @param aRxOffset How much extra space needs to be reserved + * in the Rx buffer before every Rx frame that is received from the + * WHA layer. + * @param aTxHeaderSpace How much extra space needs to be reserved + * in the Tx buffer before every Tx frame that is given to the + * WHA layer. + * @param aTxTrailerSpace How much extra space needs to be reserved + * in the Tx buffer after every Tx frame that is given to the + * WHA layer. + */ + virtual void GetFrameExtraSpaceForVendor( + TUint8& aRxOffset, + TUint8& aTxHeaderSpace, + TUint8& aTxTrailerSpace ) const; + + /** + * From MWlanProtocolStackSideUmac + * Is protocol stack side transmission permitted + * + * @param aTxQueueState If the return value is ETrue, the state + * (full / not full) of every WHA transmit queue. Otherwise, not + * valid. + * Note! A frame shall not be submitted to a full queue - even if + * the return value would be ETrue + * @return ETrue if Tx frame submission is permitted + * EFalse if Tx frame submission is not permitted + */ + virtual TBool TxPermitted( TWhaTxQueueState& aTxQueueState ) const; + + /** + * From MWlanProtocolStackSideUmac + * Is user data Tx enabled + * + * @return ETrue if user data Tx is enabled + * EFalse if user data Tx is not enabled + */ + virtual TBool UserDataTxEnabled() const; + + virtual void WriteMgmtFrame(TDataBuffer& aDataBuffer); + +private: + + /** + * Connect OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConnect(const TAny *aInputBuffer); + + /** + * Start IBSS OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleStartIBSS(const TAny *aInputBuffer); + + /** + * Disconnect OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleDisconnect(); + + /** + * Set power mode OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleSetPowerMode(const TAny *aInputBuffer); + + /** + * Set RCPI trigger level OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleSetRcpiTriggerLevel(const TAny *aInputBuffer); + + /** + * Set Tx power level OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleSetTxPowerLevel(const TAny *aInputBuffer); + + /** + * Configure OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigure(const TAny *aInputBuffer); + + /** + * Scan OID request handler + * @param aInputBuffer Pointer to the input buffer + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleScan(const TAny *aInputBuffer); + + /** + * Stop scan OID request handler + * + * @since S60 3.2 + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + TBool HandleStopScan(); + + /** + * Get last RCPI OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleGetLastRcpi(); + + /** + * Disable user data OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleDisableUserData(); + + /** + * Enable user data OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleEnableUserData(); + + /** + * Add cipher key OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleAddCipherKey(const TAny *aInputBuffer); + + /** + * Add multicast address OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleAddMulticastAddr(const TAny *aInputBuffer); + + /** + * Remove multicast address OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleRemoveMulticastAddr(const TAny *aInputBuffer); + + /** + * BSS lost configure OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureBssLost(const TAny *aInputBuffer); + + /** + * Set Tx rate adaptation parameters OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleSetTxRateAdaptParams(const TAny *aInputBuffer); + + /** + * Configure Tx rate policies OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureTxRatePolicies(const TAny *aInputBuffer); + + /** + * Set power mode management parameters OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleSetPowerModeMgmtParams(const TAny *aInputBuffer); + + /** + * Configure PS Mode Traffic Override OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigurePwrModeMgmtTrafficOverride( + const TAny *aInputBuffer ); + + /** + * Get Frame Statistics OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleGetFrameStatistics(); + + /** + * Configure U-APSD OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureUapsd( const TAny *aInputBuffer ); + + /** + * Configure Tx Queue OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureTxQueue( const TAny *aInputBuffer ); + + /** + * Get MAC Address OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleGetMacAddress(); + + /** + * Configure ARP IP Address Filtering OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureArpIpAddressFiltering( + const TAny *aInputBuffer ); + + /** + * Configure HT Block Ack OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureHtBlockAck( const TAny *aInputBuffer ); + + /** + * Configure Proprietary SNAP Header OID request handler + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool HandleConfigureProprietarySnapHdr( + const TAny *aInputBuffer ); + + /** + * + */ + virtual TBool OnWhaCommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + /** + * + */ + virtual TBool OnInternalEvent( TInternalEvent aInternalEvent ); + + // Prohibit copy constructor + Umac( const Umac& ); + // Prohibit assigment operator + Umac& operator= ( const Umac& ); + +private: // Data + + /** pointer to our implementation details (pimpl-idiom) */ + WlanContextImpl* iPimpl; + + TBool iManagementRequestPending; + WlanManagementSideUmacCb::SOidOutputData iOidOutputData; + }; + +#endif // UMAC_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacAuthSeqNmbrExpected.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacAuthSeqNmbrExpected.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanAuthSeqNmbrExpected class. +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANAUTHSEQNMBREXPECTED_H +#define WLANAUTHSEQNMBREXPECTED_H + +#include "802dot11.h" + +/** +* Class for counting the expected authentication sequence number +*/ +class WlanAuthSeqNmbrExpected + { +public: + + /** + * C++ default constructor. + */ + WlanAuthSeqNmbrExpected() : + iAuthSeqNmbrExpected( E802Dot11AuthenticationSeqNmbr2 ) {}; + + /** + * Prefix ++ operator + * @return authentication sequence number expected + */ + inline TUint8 operator++(); + + /** + * Postfix ++ operator + * @return authentication sequence number expected + */ + inline TUint8 operator++( TInt ); + + /** Reset clas state to intial state */ + inline void Reset(); + + /** + * Gets authentication sequence number expected + * @return see above + */ + inline TUint8 GetAuthSeqNmbrExpected() const; + +private: + + // Prohibit copy constructor. + WlanAuthSeqNmbrExpected( const WlanAuthSeqNmbrExpected& ); + // Prohibit assigment operator. + WlanAuthSeqNmbrExpected& operator= ( + const WlanAuthSeqNmbrExpected& ); + +private: // Data + + /** authentication sequnce number expected */ + TUint8 iAuthSeqNmbrExpected; + }; + +inline TUint8 WlanAuthSeqNmbrExpected::operator++() + { + iAuthSeqNmbrExpected = E802Dot11AuthenticationSeqNmbr4; + return iAuthSeqNmbrExpected; + } + +inline TUint8 WlanAuthSeqNmbrExpected::operator++( TInt ) + { + iAuthSeqNmbrExpected = E802Dot11AuthenticationSeqNmbr4; + return iAuthSeqNmbrExpected; + } + +inline void WlanAuthSeqNmbrExpected::Reset() + { + iAuthSeqNmbrExpected = E802Dot11AuthenticationSeqNmbr2; + } + +inline TUint8 WlanAuthSeqNmbrExpected::GetAuthSeqNmbrExpected() const + { + return iAuthSeqNmbrExpected; + } + +#endif // WLANAUTHSEQNMBREXPECTED_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2122 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the UmacContextImpl class +* +*/ + +/* +* %version: 102 % +*/ + +#ifndef WLANCONTEXTIMPL_H +#define WLANCONTEXTIMPL_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +#include "Umac.h" +#include "FrameXferBlock.h" + +#include "802dot11.h" +#include "umacinternaldefinitions.h" +#include "UmacMib.h" +#include "UmacAuthSeqNmbrExpected.h" +#include "umaceventdispatcher.h" +#include "umacpacketscheduler.h" +#include "umacpacketschedulerclient.h" +#include "umacnullsender.h" + +#include "UmacDot11MacError.h" +#include "UmacDot11InitPhase1.h" +#include "UmacDot11Idle.h" + +#include "UmacDot11PrepareForBssMode.h" +#include "UmacDot11DisassociationPending.h" +#include "UmacDot11Synchronize.h" +#include "umacdot11idlescanningmode.h" + +#include "UmacDot11ReassociationPending.h" +#include "UmacDot11SoftReset.h" +#include "UmacDot11OpenAuthPending.h" +#include "UmacDot11SharedAuthPending.h" +#include "UmacDot11AssociationPending.h" +#include "UmacDot11DeauthPending.h" +#include "UmacDot11InfrastructureModeInit.h" +#include "UmacDot11PrepareForIbssMode.h" +#include "umacdot11ibssnormalmode.h" +#include "umacdot11ibssscanningmode.h" +#include "umacdot11infrastructurenormalmode.h" +#include "umacdot11infrastructurescanningmode.h" +#include "umacdot11pwrmgmttransitionmode.h" +#include "UmacDot11MibDefaultConfigure.h" + +#include "umacconnectcontext.h" +#include "umacprivacymodefilters.h" +#include "UmacTxRateAdaptation.h" +#include "UmacPRNGenerator.h" +#include "umacusertxdatacntx.h" +#include "umacdynamicpowermodemgmtcntx.h" +#include "umacnullsendcontroller.h" +#include "umacsignalpredictor.h" + +class WlanMacState; +class WlanConnectContext; +class UmacManagementSideUmacCb; +class WlanAddBroadcastWepKey; +class WlanConfigureTxQueueParams; +class WlanConfigureTxAutoRatePolicy; +class WlanWsaInitiliaze; +class WlanWsaConfigure; +class WlanWsaJoin; +class WlanWsaScan; +class WlanWhaStopScan; +class WlanWsaReadMib; +class WlanWsaWriteMib; +class WlanWsaDisconnect; +class WlanWsaSetBssParameters; +class WlanWsaAddKey; +class WlanWsaRemoveKey; +class WlanWsaSetPsMode; +class WlanWhaConfigureQueue; +class WlanWhaConfigureAc; +class WlanWhaRelease; + +struct SWsaCommands; + + +/** +* WLAN context implementation +*/ +class WlanContextImpl : + public WHA::MWhaCb, + public MWlanPacketSchedulerClient, + public MWlanNullSender + { + +public: + + /** + * Return value type for AddMulticastAddress() method + */ + enum TGroupAddStatus + { + EOk, + EFull, + EAlreadyExists + }; + + /** + * Lookup table to map 802.11 rate defintions + */ + class SupportedRateLookUp + { + public: // Methods + + /** Ctor */ + SupportedRateLookUp() : + // these initial values don't really matter as they are always + // overwritten + iSupportedRate( E802Dot11Rate1MBit ), iWsaRate( 0 ) {}; + + private: // Methods + + // Prohibit copy constructor + SupportedRateLookUp( const SupportedRateLookUp& ); + // Prohibit assigment operator + SupportedRateLookUp& operator== ( const SupportedRateLookUp&); + + public: // Data + + /** 802.11 rate defintions */ + T802Dot11SupportedRate iSupportedRate; + /** corresponding WHA rate */ + TUint32 iWsaRate; + }; + +protected: + + /** + * The states of the statemachine + */ + struct States + { + public: // Methods + + /** + * Ctor + */ + States() {}; + + private: // Methods + + // Prohibit assignment operator + States& operator= ( const States& ); + // Prohibit copy constructor + States( const States& ); + + public: // Data + WlanDot11InitPhase1 iInitPhase1State; + WlanDot11MibDefaultConfigure iMibDefaultConfigure; + WlanDot11Idle iIdleState; + WlanDot11PrepareForBssMode iPrepareForBssMode; + WlanDot11PrepareForIbssMode iPrepareForIbssMode; + WlanDot11OpenAuthPending iOpenAuthPendingState; + WlanDot11SharedAuthPending iSharedAuthPending; + WlanDot11AssociationPending iAssociationPendingState; + WlanDot11InfrastructureModeInit iInfrastructureModeInit; + WlanDot11IdleScanningMode iIdleScanningMode; + WlanDot11IbssNormalMode iIbssNormalMode; + WlanDot11IbssScanningMode iIbssScanningMode; + WlanDot11InfrastructureScanningMode + iInfrastructureScanningMode; + WlanDot11InfrastructureNormalMode + iInfrastructureNormalMode; + WlanDot11PwrMgmtTransitionMode iPwrMgmtTransitionMode; + WlanDot11DisassociationPending iDisassociationPendingState; + WlanDot11Synchronize iSynchronizeState; + WlanDot11ReassociationPending iReassociationPendingState; + WlanDot11DeauthPending iDeauthPendingState; + WlanDot11SoftReset iSoftResetState; + WlanDot11MacError iMacError; + }; + + /** + * 802.11 management frame templates + */ + class ManagementFrameTemplates + { + public: // Methods + + /** Ctor */ + ManagementFrameTemplates() : + ialign1( 0 ), + ialign2( 0 ), + ialign3( 0 ), + ialign4( 0 ), + ialign5( 0 ), + ialign6( 0 ), + ialign7( 0 ), + ialign8( 0 ), + ialign9( 0 ) + {}; + + private: // Methdods + + // Prohibit copy constructor + ManagementFrameTemplates( const ManagementFrameTemplates& ); + // Prohibit assigment operator + ManagementFrameTemplates& operator== ( + const ManagementFrameTemplates& ); + + public: // Data + + /** authenticate frame template */ + SAuthenticationFrame iAuthenticationFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign1; + /** authenticate frame template with HT Control field */ + SHtAuthenticationFrame iHtAuthenticationFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign2; + /** association frame template */ + SAssociationRequestFrame iAssociationRequestFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign3; + /** association frame template with HT Control field */ + SHtAssociationRequestFrame iHtAssociationRequestFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign4; + /** deauthenticate frame template */ + SDeauthenticateFrame iDeauthenticateFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign5; + /** deauthenticate frame template with HT Control field */ + SHtDeauthenticateFrame iHtDeauthenticateFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign6; + /** disassociation frame template */ + SDisassociateFrame iDisassociationFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign7; + /** disassociation frame template with HT Control field */ + SHtDisassociateFrame iHtDisassociationFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign8; + /** resassociation frame template */ + SReassociationRequestFrame iReassociationRequestFrame; + /** + * 32-bit align + * only needed because these structs are packed + */ + TUint32 ialign9; + /** resassociation frame template with HT Control field */ + SHtReassociationRequestFrame iHtReassociationRequestFrame; + }; + + /** + * Container for multicast groups (specified by group mac addresses) + * that we have joined. + * + * When we have joined any multicast groups + * we would like to receive only multicast packets that have been + * sent to those groups. + */ + class JoinedMulticastGroups + { + public: + + /** Ctor */ + JoinedMulticastGroups(); + + /** + * Adds a group. + * @param + * @return ETrue if aGroup was not fou + */ + TGroupAddStatus AddGroup( const TMacAddress& aGroup ); + + /** + * Removes a group. + * @param aGroup Group to be removed + * @return ETrue if aGroup was found (and hence removed) + * EFalse otherwise + */ + TBool RemoveGroup( const TMacAddress& aGroup ); + + /** + * Returns the number of groups that we are joined into + * currently. + * @return The number of groups joined currently. + */ + TUint8 Count() const; + + /** + * Gets all the groups by passing back a pointer to the 1st + * group which is followed by all the other groups that + * we are joined into. + * @return The number of groups (group addresses) returned + */ + TUint8 GetGroups( const TMacAddress*& aGroups ) const; + + /** + * Clears the whole container by removing all groups from it + */ + void Reset(); + + private: + + /** + * Finds aGroup + * @param aGroup Group to be located + * @param aIndex Index pointing to aGroup if aGroup was found + * @return ETrue if aGroup was found + * EFalse otherwise + */ + TBool FindGroup( + const TMacAddress& aGroup, + TUint& aIndex ) const; + + // Prohibit copy constructor + JoinedMulticastGroups( const JoinedMulticastGroups& ); + // Prohibit assigment operator + JoinedMulticastGroups& operator= + ( const JoinedMulticastGroups& ); + + private: // Data + + /** + * The maximum number of multicast groups that we allow. + * Note that the adaptation layer may support also + * any smaller number of addresses, including zero + */ + enum { KMaxNbrOfGroups = 32 }; + + /** storage for group entries */ + TMacAddress iStorage[KMaxNbrOfGroups]; + + /** is the corresponding storage entry free */ + TBool iFree[KMaxNbrOfGroups]; + + /** + * 1st free index. As there are no empty storage entries in + * the middle, this is also the number of groups that we are + * joined into currently */ + TUint8 iFirstFreeIndex; + }; + +public: + + /** + * C++ constructor. + * @param WlanContext context that owns us + */ + explicit WlanContextImpl( Umac& aUmac ); + + /** + * Dtor + */ + virtual ~WlanContextImpl(); + + /** + * Constructs our supported rates lookup table + */ + void MakeLookUpTable(); + + void AttachWsa( WHA::Wha* aWha ); + void BootUp( + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ); + inline WlanManagementSideUmacCb& WlanManagementSideCb() { return iUmac; } + inline WHA::Wha& Wha() { return *iWha; } + inline WlanMacState& CurrentState(); + + TBool OnDeferredWhaCommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + TBool OnDeferredInternalEvent( TInternalEvent aInternalEvent ); + + inline void RegisterEvent( const TOIDHeader& aOid ); + + inline void RegisterEvent( TInternalEvent aInternalEvent ); + + inline TBool ChannelEnabled( WlanEventDispatcher::TChannel aChannel ) const; + + inline void Enable( WlanEventDispatcher::TChannel aChannelMask ); + inline void Disable( WlanEventDispatcher::TChannel aChannelMask ); + + inline TBool DispatchEvent(); + + /** + * Determines if a command completion event for the specified + * command is registered + * + * @param aCommandId Id of the command to check + * @return ETrue if command completion event is registered + * EFalse otherwise + */ + inline TBool CommandCompletionEventRegistered( + WHA::TCompleteCommandId aCommandId ) const; + + /** + * Dispatches a single command completion event + * + * @since S60 3.1 + * @return ETrue If a global state change occurred as a result of the event + * dispatching + * EFalse otherwise + */ + inline TBool DispatchCommandCompletionEvent(); + + inline TBool ProtocolStackTxDataAllowed() const; + + /** + * Second level initializer. Does statemachine initialization + * @return ETrue success EFalse failure + */ + TBool Initialize(); + + WlanAddBroadcastWepKey& AddBroadcastWepKey(); + WlanConfigureTxQueueParams& ConfigureTxQueueParams(); + WlanConfigureTxAutoRatePolicy& ConfigureTxAutoRatePolicy(); + WlanWsaInitiliaze& WsaInitiliaze(); + WlanWsaConfigure& WsaConfigure(); + WlanWsaReadMib& WsaReadMib(); + WlanWsaWriteMib& WsaWriteMib(); + WlanWsaJoin& WsaJoin(); + WlanWsaScan& WsaScan(); + WlanWhaStopScan& WhaStopScan(); + WlanWsaDisconnect& WsaDisconnect(); + WlanWsaSetBssParameters& WsaSetBssParameters(); + WlanWsaAddKey& WsaAddKey(); + WlanWhaConfigureQueue& WhaConfigureQueue(); + WlanWsaSetPsMode& WsaSetPsMode(); + WlanWhaConfigureAc& WhaConfigureAc(); + WlanWhaRelease& WlanWhaRelease(); + + inline void WHASettings( const WHA::SSettings& aSettings ); + inline WHA::SSettings& WHASettings(); + inline const WHA::SSettings& WHASettings() const; + + /** + * Gets authentication frame template + * @return authentication frame template + */ + inline SAuthenticationFrame& GetAuthenticationFrame(); + + /** + * Gets authentication frame template with HT Control field + * @return authentication frame template + */ + inline SHtAuthenticationFrame& GetHtAuthenticationFrame(); + + /** + * Gets association request frame template + * @return association request frame template + */ + inline SAssociationRequestFrame& GetAssociationRequestFrame(); + + /** + * Gets association request frame template with HT Control field + * @return association request frame template + */ + inline SHtAssociationRequestFrame& GetHtAssociationRequestFrame(); + + /** + * Gets deauthenticate frame template + * @return deauthenticate frame template + */ + inline SDeauthenticateFrame& GetDeauthenticateFrame(); + + /** + * Gets deauthenticate frame template with HT Control field + * @return deauthenticate frame template + */ + inline SHtDeauthenticateFrame& GetHtDeauthenticateFrame(); + + /** + * Gets disassociation frame template + * @return disassociation frame template + */ + inline SDisassociateFrame& GetDisassociationFrame(); + + /** + * Gets disassociation frame template with HT Control field + * @return disassociation frame template + */ + inline SHtDisassociateFrame& GetHtDisassociationFrame(); + + /** + * Gets resassociation frame template + * @return resassociation frame template + */ + inline SReassociationRequestFrame& GetReassociationRequestFrame(); + + /** + * Gets resassociation frame template with HT Control field + * @return resassociation frame template + */ + inline SHtReassociationRequestFrame& GetHtReassociationRequestFrame(); + + /** + * Gets null data frame template + * @return resassociation frame template + */ + inline SNullDataFrame& NullDataFrame(); + + /** + * Gets QoS Null data frame template + * @return QoS Null data frame template + */ + inline SHtQosNullDataFrame& QosNullDataFrame(); + + /** + * Returns the length of the QoS Null data frame template when we + * know our current/target network. + * It's the length of a HT QoS Null data frame in case of a HT nw + * and otherwise the length of a regular (non-HT) QoS Null data frame + * @return Length of the currently relevant QoS Null data frame + */ + inline TUint16 QosNullDataFrameLength() const; + + /** + * Gets data frame template + * @return data frame template + */ + inline SDataFrameHeader& GetDataFrameHeader(); + + /** + * Gets protocol stack side ethernet tx context + * @return protocol stack side ethernet write context + */ + inline TWlanUserTxDataCntx& GetTxDataCntx(); + inline const TWlanUserTxDataCntx& GetTxDataCntx() const; + + /** + * Gets EAPOL stack side ethernet tx context + * @return EAPOL stack side ethernet write context + */ + inline TWlanUserTxDataCntx& GetMgmtTxDataCntx(); + inline const TWlanUserTxDataCntx& GetMgmtTxDataCntx() const; + + /** + * Resets authentication sequnece expected counter to initial state + */ + inline void ResetAuthSeqNmbrExpected(); + + /** + * Gets the current Tx rate and related rate policy associated with the + * specified Tx queue + * + * @param aQueueId id of the Tx queue + * @param aUseSpecialRatePolicy If ETrue, the use of the special Tx rate + * policy is requested + * If EFalse, the use of the special Tx rate policy is not requested + * @param aRate initial max Tx rate to use; if relevant + * @param aPolicyId ID of the rate class / policy to use + */ + inline void TxRatePolicy( + WHA::TQueueId aQueueId, + TBool aUseSpecialRatePolicy, + WHA::TRate& aRate, + TUint8& aPolicyId ) const; + + /** + * Gets BSSID + * @return BSSID + */ + inline TMacAddress& GetBssId(); + + inline void Aid( const TUint32 aAid ); + inline TUint32 Aid() const; + + inline void AtimWindow( const TUint32 aAtimWindow ); + inline TUint32 AtimWindow() const; + + /** + * Gets SSID + * @return SSID + */ + inline TSSID& GetSsId(); + + /** + * Gets used privacy mode + * @return used privacy mode + */ + inline TEncryptionStatus& EncryptionStatus(); + + inline WHA::TOperationMode NetworkOperationMode() const; + inline void NetworkOperationMode( + WHA::TOperationMode aOperationMode ); + + // setters and getters for key type + inline void GroupKeyType( WHA::TKeyType aKeyType ); + inline WHA::TKeyType GroupKeyType() const; + inline void PairWiseKeyType( WHA::TKeyType aKeyType ); + inline WHA::TKeyType PairWiseKeyType() const; + + inline void PairwiseCipher( TWlanCipherSuite aCipherSuite ); + inline TWlanCipherSuite PairwiseCipher() const; + + inline WHA::TChannelNumber NetworkChannelNumeber() const; + inline void NetworkChannelNumeber( WHA::TChannelNumber aChannelNumber ); + + inline TUint32 NetworkBeaconInterval() const; + inline void NetworkBeaconInterval( TUint32 aBeaconInterval ); + + inline WHA::TPsMode DesiredDot11PwrMgmtMode() const; + inline void DesiredDot11PwrMgmtMode( WHA::TPsMode aPsMode ); + + inline WHA::TPsMode CurrentDot11PwrMgmtMode() const; + inline void CurrentDot11PwrMgmtMode( WHA::TPsMode aPsMode ); + + inline const TDot11PsModeWakeupSetting& DesiredPsModeConfig() const; + inline void SetDesiredPsModeConfig( + const TDot11PsModeWakeupSetting& aPsModeWakeupSetting ); + + TPowerMgmtMode CurrentPwrMgmtMode() const; + + inline WHA::TPsMode ClientDot11PwrMgmtMode() const; + inline void ClientDot11PwrMgmtMode( TPowerMode aPsMode ); + + inline const TDot11PsModeWakeupSetting& ClientLightPsModeConfig() const; + inline void SetClientLightPsModeConfig( + TWlanWakeUpInterval aWakeupMode, + TUint8 aListenInterval ); + + inline const TDot11PsModeWakeupSetting& ClientDeepPsModeConfig() const; + inline void SetClientDeepPsModeConfig( + TWlanWakeUpInterval aWakeupMode, + TUint8 aListenInterval ); + + inline TBool DynamicPwrModeMgtDisabled() const; + void DynamicPwrModeMgtDisabled( TBool aValue ); + + inline TBool UseShortPreamble() const; + void UseShortPreamble( TBool aValue ); + + inline TBool Reassociate() const; + void Reassociate( TBool aValue ); + + inline TBool UseShortSlotTime() const; + void UseShortSlotTime( TBool aValue ); + + inline TBool ProtectionBitSet() const; + void ProtectionBitSet( TBool aValue ); + + inline TBool QosEnabled() const; + void QosEnabled( TBool aValue ); + + inline TBool UapsdEnabled() const; + void UapsdEnabled( TBool aValue ); + + inline TBool MulticastFilteringDisAllowed() const; + void MulticastFilteringDisAllowed( TBool aValue ); + + inline TBool ErpIePresent() const; + void ErpIePresent( TBool aValue ); + + inline TBool DisassociatedByAp() const; + void DisassociatedByAp( TBool aValue ); + + inline TBool UapsdRequestedForVoice() const; + void UapsdRequestedForVoice( TBool aValue ); + + inline TBool UapsdRequestedForVideo() const; + void UapsdRequestedForVideo( TBool aValue ); + + inline TBool UapsdRequestedForBestEffort() const; + void UapsdRequestedForBestEffort( TBool aValue ); + + inline TBool UapsdRequestedForBackground() const; + void UapsdRequestedForBackground( TBool aValue ); + + inline TBool UapsdUsedForVoice() const; + void UapsdUsedForVoice( TBool aValue ); + + inline TBool UapsdUsedForVideo() const; + void UapsdUsedForVideo( TBool aValue ); + + inline TBool UapsdUsedForBestEffort() const; + void UapsdUsedForBestEffort( TBool aValue ); + + inline TBool UapsdUsedForBackground() const; + void UapsdUsedForBackground( TBool aValue ); + + inline TBool ApTestOpportunitySeekStarted() const; + void ApTestOpportunitySeekStarted( TBool aValue ); + + inline TBool ApTestOpportunityIndicated() const; + void ApTestOpportunityIndicated( TBool aValue ); + + inline TBool HtSupportedByNw() const; + void HtSupportedByNw( TBool aValue ); + + inline TUint8 WmmParameterSetCount() const; + inline void WmmParameterSetCount( TUint8 aValue ); + + inline TUint32 RateBitMask() const; + inline void RateBitMask( TUint32 aValue ); + + inline TCwMinVector& CwMinVector(); + inline TCwMaxVector& CwMaxVector(); + inline TAifsVector& AifsVector(); + inline TTxOplimitVector& TxOplimitVector(); + inline TAcmVector& AcmVector(); + /** + * Returns our Wmm IE + * @return WMM IE + */ + inline STxWmmIE& OurWmmIe(); + + /** + * Returns the WLAN Mgmt client provided Tx rate policy + * + * @since S60 3.1 + * @return Tx rate policy + */ + inline TTxRatePolicy& RatePolicy(); + + /** + * Returns the WLAN Mgmt client provided Tx queue to Tx rate policy mapping + * + * @since S60 3.1 + * @return Tx queue to Tx rate policy mapping + */ + inline TQueue2RateClass& Queue2RateClass(); + + /** + * Returns the WLAN Mgmt client provided initial max Tx rate for every + * Mgmt client provided rate policy object + * + * @since S60 3.1 + * @return initial max Tx rate for every relevant Tx rate policy object + */ + inline TInitialMaxTxRate4RateClass& InitialMaxTxRate4RateClass(); + + /** + * Returns the WLAN Mgmt client provided Tx auto rate policy + * + * @return Tx auto rate policy + */ + inline TTxAutoRatePolicy& AutoRatePolicy(); + + /** + * Returns the ID of the special Tx auto rate policy + * Returns zero if a special Tx auto rate policy is not available + * + * @return the ID of the special Tx auto rate policy, or zero + */ + inline TUint8 SpecialTxAutoRatePolicy() const; + + /** + * Sets the ID of the special Tx auto rate policy + * + * @param aPolicyId the ID of the special Tx auto rate policy. Zero + * if a special Tx auto rate policy is not available + */ + inline void SpecialTxAutoRatePolicy( TUint8 aPolicyId ); + + /** + * Returns the WLAN Mgmt client provided HT MCS policy + * + * @since S60 3.1 + * @return Tx rate policy + */ + inline THtMcsPolicy& HtMcsPolicy(); + + /** + * Returns the WLAN Mgmt client provided Maximum U-APSD Service Period + * length + * + * @since S60 3.2 + * @return Maximum U-APSD Service Period length + */ + inline TQosInfoUapsdMaxSpLen& UapsdMaxSpLen(); + + inline TUint32 WhaCommandAct() const; + inline void WhaCommandAct( TUint32 aAct ); + + inline TUint32 Random(); + + /** + * Returns reference to the authentication algorithm number to be used + * @return authentication algorithm number + */ + inline TUint16& AuthenticationAlgorithmNumber(); + + /** + * To be called upon every Tx frame send completion + * @param aRate actual rate transmitted + * @param aSuccess was the frame transmitted successfully or not + * @param aRequestedRate Tx rate that was originally requested + */ + inline void OnTxCompleted( + const TUint32 aRate, + const TBool aSuccess, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate ); + + /** + * Gets buffer for Rx data + * + * @param aLengthinBytes Requested length of the buffer + * @param aInternal ETrue if the buffer request was triggered inside UMAC + * EFalse if it was triggered from WHA layer + * @return Pointer to the beginning of the buffer on success + * NULL if a buffer couldn't be allocated + */ + TUint8* GetRxBuffer( + const TUint16 aLengthinBytes, + TBool aInternal = EFalse ); + + /** + * Allocates Rx frame meta header + * @return Rx frame meta header upon success + * NULL otherwise + */ + TDataBuffer* GetRxFrameMetaHeader(); + + /** + * Deallocates Rx frame meta header + * @param aMetaHeader Meta header to deallocate + */ + void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ); + + TUint8* TxBuffer( TBool aWaitIfNotFree = EFalse ); + + /** + * Cancels the default timer + */ + inline void CancelTimer(); + + /** + * Gets the authentication sequence number expected + * @return authentication sequence number expected + */ + inline TUint8 GetAuthSeqNmbrExpected() const; + + /** + * Gets our supported rates IE + * @return supported rates IE + */ + inline SSupportedRatesIE& GetOurSupportedRatesIE(); + + /** + * Gets our extended supported rates IE + * @return extended supported rates IE + */ + inline SExtendedSupportedRatesIE& GetOurExtendedSupportedRatesIE(); + + /** + * Stores a Beacon or Probe Response frame body from the + * network we are going to connect to + * + * @since S60 3.2 + * @param aBody pointer to the frame body + */ + inline void SetScanResponseFrameBody( const TUint8* aBody ); + + /** + * Returns a pointer to a Beacon or Probe Response frame body from the + * network we are going to connect to + * + * @since S60 3.2 + * @return pointer to the frame body + */ + inline const TUint8* ScanResponseFrameBody() const; + + /** + * Stores a Beacon or Probe Response frame body length + * + * @since S60 3.2 + * @param aLength frame body length + */ + inline void SetScanResponseFrameBodyLength( TUint16 aLength ); + + /** + * Returns the length of a Beacon or Probe Response frame body from the + * network we are going to connect to + * + * @since S60 3.2 + * @return length of the frame body + */ + inline const TUint16 ScanResponseFrameBodyLength() const; + + /** + * Stores the IE(s) to be included into the (re-)association request. + * + * @since S60 3.2 + * @param aIeData pointer to the IE(s). NULL, if none to be included + */ + inline void IeData( const TUint8* aIeData ); + + /** + * Returns the IE(s) to be included into the (re-)association request. + * + * @since S60 3.2 + * @return pointer to the IE(s). NULL, if none to be included + */ + inline const TUint8* IeData() const; + + /** + * Stores the length of the IE(s) to be included into the (re-)association + * request. + * + * @since S60 3.2 + * @param aIeDataLength length of the IE(s) + */ + inline void IeDataLength( TUint16 aIeDataLength ); + + /** + * Returns the length of the IE(s) to be included into the (re-)association + * request. + * + * @since S60 3.2 + * @return length of the IE(s) + */ + inline TUint16 IeDataLength() const; + + /** + * Stores the Radio Measurement value to be included into the (re-)association + * request. + * + * @since S60 9.2 + * @param aRadioMeasurement True if Measurement on, otherwise false + */ + inline void RadioMeasurement( TBool aRadioMeasurement ); + + /** + * Returns the Radio Measurement value to be included into the (re-)association + * request. + * + * @since S60 9.2 + * @return Radio Measurement setting + */ + inline TBool RadioMeasurement() const; + + /** + * Sets desired privacy mode filter + * @param aEncryptionStatus desired privacy mode + */ + inline void SetActivePrivacyModeFilter( + WlanContextImpl& aCtxImpl, + TEncryptionStatus aEncryptionStatus ); + + /** + * Executes current privacy mode filter + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + inline TBool ExecuteActivePrivacyModeFilter( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + + /** + * Gets capability information field + * @return capability information field + */ + inline SCapabilityInformationField& GetCapabilityInformation(); + + /** + * Resets BSS loss indication flags. + */ + inline void ResetBssLossIndications(); + + /** + * Gets AP advertised supported rates IE + * @return supported rates IE + */ + inline SSupportedRatesIE& GetApSupportedRatesIE(); + + /** + * Gets AP advertised extended supported rates IE + * @return extended supported rates IE + */ + inline SExtendedSupportedRatesIE& GetApExtendedSupportedRatesIE(); + + /** Resets Tx rate adaptation object */ + inline void ResetTxRateAdaptation(); + + /** + * Gets min basic rate of BSS + * @return min basic rate of BSS + */ + inline TUint32& GetMinBasicRate(); + + inline TUint32& GetMaxBasicRate(); + + inline void ClearBasicRateSet(); + inline void BasicRateSetBitSet( const TUint32 aRateBitToSet ); + inline TUint32 BasicRateSet() const; + + inline TBool WsaCmdActive() const; + inline void ActivateWsaCmd(); + inline void DeActivateWsaCmd(); + + /** + * Increments authentication sequnece expected counter + * to next expected sequence number + */ + inline void IncrementAuthSeqNmbrExpected(); + + /** + * Sets the rate adaptation object + */ + inline TBool SetTxRateAdaptationRates( + TUint8 aPolicyId, + WHA::TRate aRateBitmask ); + + /** + * Sets the Tx rate adaptation policy to be used with the specified Tx queue + * @param aQueueId id of the Tx queue + * @param aPolicyId id of the Tx rate policy + */ + inline void SetTxRatePolicy( WHA::TQueueId aQueueId, TUint8 aPolicyId ); + + /** + * Sets the current max Tx rate which should be initially used when sending + * frames using the specified Tx rate policy. + * If this rate is not present in the specified rate policy, or if + * it is not supported either by the nw or by WHA layer, the next possible + * lower rate will be used instead. + * However, if the specified rate is lower that any rate in the specified + * rate policy, the lowest rate in the policy will be used. + * + * @since S60 3.1 + * @param aPolicyId id of the Tx rate policy + * @param aRate initial max Tx rate + */ + inline void SetCurrentMaxTxRate( TUint8 aPolicyId, WHA::TRate aRate ); + + /** + * Sets the Tx rate adaptation algorithm parameters + * + * @since S60 3.1 + * @param aMinStepUpCheckpoint minimum and initial rate increase + * checkpoint in units of frames + * Range: [aStepDownCheckpoint,aMaxStepUpCheckpoint] + * @param aMaxStepUpCheckpoint maximum rate increase checkpoint in units + * of frames + * Range: [aStepDownCheckpoint,UCHAR_MAX] + * @param aStepUpCheckpointFactor StepUpCheckpoint is multiplied with this + * value if sending a probe frame fails + * Range: [1,aMaxStepUpCheckpoint] + * @param aStepDownCheckpoint after this many frames the need to decrease + * the rate is checked + * Range: [2,UCHAR_MAX] + * @param aMinStepUpThreshold minimum and initial StepUpThreshold + * percentage + * Range: [1,aMaxStepUpThreshold] + * @param aMaxStepUpThreshold maximum StepUpThreshold percentage + * Range: [1,100] + * @param aStepUpThresholdIncrement StepUpThreshold is incremented by this + * value if sending a probe frame fails + * Range: [0,aMaxStepUpThreshold] + * @param aStepDownThreshold if the percentage of frames which failed to + * be transmitted at the originally requested rate is at least + * aStepDownThreshold at the aStepDownCheckpoint, the rate will + * be decreased + * Range: [1,100] + * @param aDisableProbeHandling if EFalse, the rate adaptation algorithm + * handles the first frame transmitted after a rate increase in a + * special way. Otherwise the special handling is disabled + */ + inline void SetTxRateAdaptationAlgorithmParams( + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ); + + /** + * To be called when BSS Lost indication is received from WLAN PDD + * + * @since S60 5.0 + * @return ETrue if Consecutive Beacons Lost indication needs to be sent to + * WLAN Mgmt Client + * EFalse otherwise + */ + inline TBool OnConsecutiveBeaconsLost(); + + /** + * To be called after more than threshold number of consecutive Tx failures + * + * @since S60 5.0 + * @return ETrue if Consecutive Tx Failures indication needs to be sent to + * WLAN Mgmt Client + * EFalse otherwise + */ + inline TBool OnConsecutiveTxFailures(); + + /** + * To be called after more than threshold number of consecutive 802.11 Power + * Mgmt Mode setting failures + * + * @since S60 5.0 + * @return ETrue if Consecutive Power Mode Set Failures indication needs to + * be sent to WLAN Mgmt Client + * EFalse otherwise + */ + inline TBool OnConsecutivePwrModeSetFailures(); + + /** + * To be called when we have successfully communicated with the current AP + * + * @since S60 3.1 + * @return ETrue if BSS Regained indication needs to be sent to WLAN Mgmt + * Client + * EFalse otherwise + */ + TBool OnBssRegained(); + + /** + * Pushes a packet to the packet scheduler + * + * @since S60 3.1 + * @param aPacket the packet to transmit + * @param aLength length of the packet + * @param aQueueId id of the queue to use when sending the packet + * @param aPacketId frame type + * @param aMetaHeader frame meta header + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + * @param aMulticastData ETrue if this is a multicast data frame + * @param aUseSpecialRatePolicy ETrue if use of the special Tx rate + * policy is requested for this frame Tx + * @return ETrue packet was accepted, EFalse otherwise + */ + inline TBool PushPacketToPacketScheduler( + const TAny* aPacket, + TUint32 aLength, + WHA::TQueueId aQueueId, + TUint32 aPacketId, + const TDataBuffer* aMetaHeader, + TBool aMore, + TBool aMulticastData, + TBool aUseSpecialRatePolicy = EFalse ); + + /** + * Removes all pending packet transmission entrys from + * the packet scheduler + * + * @since S60 3.1 + */ + inline void FlushPacketScheduler(); + + /** + * Schedules a packet and sends it if possible. + * If no packets to schedule exists does nothing + * If packet was send it is removed from the storage + * + * @since S60 3.1 + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + inline void SchedulePackets( TBool aMore ); + + /** + * Are there unsent Tx packets, i.e. packets not yet completed by WHA + * layer + * + * @since S60 3.2 + * @return ETrue if there are packets not yet completed by WHA layer + * EFalse otherwise + */ + inline TBool UnsentTxPackets() const; + + /** + * Increments the failed Tx packet counter + * + * @since S60 3.1 + */ + inline void IncrementFailedTxPacketCount(); + + /** + * Returns the value of failed Tx packet counter + * + * @since S60 3.1 + */ + inline TUint8 FailedTxPacketCount() const; + + /** + * Resets the failed Tx packet counter + * + * @since S60 3.1 + */ + inline void ResetFailedTxPacketCount(); + + /** + * Initializes the set power mgmt mode counter + * + * @since S60 3.1 + */ + inline void InitializeSetPsModeCount(); + + /** + * Decrements the set power mgmt mode counter by one + * + * @since S60 3.1 + */ + inline void DecrementSetPsModeCount(); + + /** + * Returns the value of the set power mgmt mode counter + * + * @since S60 3.1 + * @return Set power mgmt mode counter value + */ + inline TUint SetPsModeCount() const; + + /** + * Starts dynamic power mode management + * + * @since S60 3.1 + */ + inline void StartPowerModeManagement(); + + /** + * Stops dynamic power mode management + * + * @since S60 3.1 + */ + inline void StopPowerModeManagement(); + + /** + * To be called when transmitting a user data or WLAN Management Client frame + * + * Informs Dynamic Power Mode Manager about frame Tx. + * Determines the need to make a power mode transition. + * + * @since S60 3.1 + * @param aQueueId Id of the queue/AC via which the frame will be + * transmitted + * @param aEtherType Ethernet type of the frame + * @return To which power management mode to change; if any at all + */ + inline TPowerMgmtModeChange OnFrameTx( + WHA::TQueueId aQueueId, + TUint16 aEtherType ); + + /** + * To be called when accepting an Rx frame + * + * @since S60 3.1 + * @param aAccessCategory AC/Queue via which the frame has beeen transmitted + * @param aEtherType Ethernet type of the received frame + * @param aPayloadLength length of the ethernet frame payload + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return To which power management mode to change; if any at all + */ + inline TPowerMgmtModeChange OnFrameRx( + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TUint aPayloadLength, + TDaType aDaType ); + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aToLightPsTimeout time interval in microseconds after which + * transition from Active mode to Light PS mode is considered + * @param aToLightPsFrameThreshold frame count threshold used when + * considering transition from Active to Light PS mode + * @param aToActiveTimeout time interval in microseconds after which the + * frame counter used when considering transition from Light PS + * to Active mode is reset + * @param aToActiveFrameThreshold frame count threshold used when + * considering transition from Light PS to Active mode + * @param aToDeepPsTimeout time interval in microseconds after which + * transition from Light PS mode to Deep PS mode is considered + * @param aToDeepPsFrameThreshold frame count threshold used when + * considering transition from Light PS to Deep PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category + * @return ETrue if a state change occurred + * EFalse otherwise + */ + inline void SetPowerModeManagementParameters( + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * Configures dynamic power mode management traffic override + * + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting + * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting + * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC + * setting + * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC + * setting + * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting + * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting + * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC + * setting + * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC + * setting + * @return ETrue if a state change occurred + * EFalse otherwise + */ + inline void ConfigurePwrModeMgmtTrafficOverride( + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ); + + /** + * Freezes the dynamic power mode management traffic override settings + * provided earlier with the ConfigurePwrModeMgmtTrafficOverride() method + * and based on whether U-APSD is used for the different ACs/Tx queues + * + * @since S60 3.2 + */ + inline void FreezePwrModeMgmtTrafficOverride(); + + /** + * To be called upon Active to Light PS timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + inline TBool OnActiveToLightPsTimerTimeout(); + + /** + * To be called upon Light PS to Active timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + inline TBool OnLightPsToActiveTimerTimeout(); + + /** + * To be called upon Light PS to Deep PS timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + inline TBool OnLightPsToDeepPsTimerTimeout(); + + /** + * Adds a multicast (Rx) address to our internal bookkeeping. + * @param aMacAddress Address to be added + * @return See TGroupAddStatus definition. + */ + inline TGroupAddStatus AddMulticastAddress( + const TMacAddress& aMacAddress ); + + /** + * Removes a multicast (Rx) address from our internal bookkeeping. + * @param aMacAddress MAC address to be removed + * @return ETrue if address was found (and hence removed) + * EFalse otherwise + */ + inline TBool RemoveMulticastAddress( const TMacAddress& aMacAddress ); + + /** + * Returns the number of multicast (Rx) addresses that exist in our + * internal bookkeeping currently + * @return Address count + */ + inline TUint8 MulticastAddressCount() const; + + /** + * Gets all the multicast (Rx) addresses from our internal bookkeeping + * by passing back a pointer to the 1st address which is followed by + * all the other addresses. + * @return The number of addresses returned. + */ + inline TUint8 GetMulticastAddresses( + const TMacAddress*& aMacAddresses ) const; + + /** + * Clears our internal multicast (Rx) address bookkeeping by removing + * all addresses. + */ + inline void ResetMulticastAddresses(); + + inline void MarkInternalTxBufFree(); + + inline TBool InternalTxBufBeingWaited() const; + + inline void ClearInternalTxBufBeingWaitedFlag(); + + /** + * Resets frame statistics + * + * @since S60 3.2 + */ + inline void ResetFrameStatistics(); + + /** + * Increments Rx unicast data frame count by one + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + */ + inline void IncrementRxUnicastDataFrameCount( + WHA::TQueueId aAccessCategory ); + + /** + * Increments Tx unicast data frame count by one + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + */ + inline void IncrementTxUnicastDataFrameCount( + WHA::TQueueId aAccessCategory ); + + /** + * Increments Rx multicast data frame count by one + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + */ + inline void IncrementRxMulticastDataFrameCount( + WHA::TQueueId aAccessCategory ); + + /** + * Increments Tx multicast data frame count by one + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + */ + inline void IncrementTxMulticastDataFrameCount( + WHA::TQueueId aAccessCategory ); + + /** + * Increments Tx frame retry count by aCount + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + * @param aCount number to add to the current count + */ + inline void IncrementTxRetryCount( + WHA::TQueueId aAccessCategory, + TUint aCount ); + + /** + * Increments Tx error count by one + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + */ + inline void IncrementTxErrorCount(WHA::TQueueId aAccessCategory ); + + /** + * Increments cumulative Tx Media Delay by aDelay + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + * @param aDelay Amount of delay to add to the current cumulative delay + */ + inline void IncrementTxMediaDelay( + WHA::TQueueId aAccessCategory, + TUint aDelay ); + + /** + * Returns the average Tx Media Delay of the specified Access Category + * + * Note! When this method is called the txMediaDelay field shall contain + * the cumulative Tx Media Delay. + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue for which the average is requested + * @return Average Tx Media Delay + */ + TUint AverageTxMediaDelay( WHA::TQueueId aAccessCategory ) const; + + /** + * Calculates the average Tx Media Delay for all Access Categories + * and stores the results into frame statistics results + * + * @since S60 3.2 + */ + void CalculateAverageTxMediaDelays(); + + /** + * Increments cumulative Total Tx Delay by aDelay + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + * @param aDelay Amount of delay to add to the current cumulative delay + */ + inline void IncrementTotalTxDelay( + WHA::TQueueId aAccessCategory, + TUint aDelay ); + + /** + * Updates Total Tx Delay histogram + * + * @since S60 3.2 + * @param aAccessCategory AC/Queue via which the frame was transmitted + * @param aDelay Total Tx Delay of the frame + */ + void UpdateTotalTxDelayHistogram( + WHA::TQueueId aAccessCategory, + TUint aDelay ); + + /** + * Returns the average Total Tx Delay of the specified Access Category + * + * Note! When this method is called the totalTxDelay field shall contain + * the cumulative Total Tx Delay. + + * @since S60 3.2 + * @param aAccessCategory AC/Queue for which the average is requested + * @return Average Total Tx Delay + */ + TUint AverageTotalTxDelay( WHA::TQueueId aAccessCategory ) const; + + /** + * Calculates the average Total Tx Delay for all Access Categories + * and stores the results into frame statistics results + * + * @since S60 3.2 + */ + void CalculateAverageTotalTxDelays(); + + /** + * Stores FCS error count recorded in received MPDUs + * + * @since S60 3.2 + * @param aCount the value to set + */ + inline void StoreFcsErrorCount( TUint aCount ); + + /** + * Returns frame statistics + * + * @since S60 3.2 + * @return reference to frame statistics + */ + inline const TStatisticsResponse& FrameStatistics() const; + + /** + * Sets Null Frame Send Controller parameters + * + * @since S60 3.2 + * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call + * state and we transmit at least aVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this parameter, we enter Voice over WLAN Call state + * @param aVoiceCallEntryTxThreshold Threshold value for the number of + * Voice priority Tx frames to enter Voice over WLAN Call state + * @param aNullTimeout NULL frame sending interval + * @param aNoVoiceTimeout after this long time of no Voice priority data + * Tx, exit voice call state + * @param aKeepAliveTimeout Keep Alive frame sending interval in + * infrastructure mode + */ + inline void SetNullSendControllerParameters( + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout ); + + /** + * Starts Voice over WLAN Call maintenance + * + * @since S60 3.2 + */ + inline void StartVoiceOverWlanCallMaintenance(); + + /** + * Stops Voice over WLAN Call maintenance + * + * @since S60 3.2 + */ + inline void StopVoiceOverWlanCallMaintenance(); + + /** + * Terminates Voice over WLAN Call maintenance + */ + inline void TerminateVoiceOverWlanCallMaintenance(); + + /** + * Resumes QoS null frame sending, if relevant. + * Doesn't change the Voice over WLAN Call state + * + * @since S60 3.2 + */ + inline void ResumeQosNullSending(); + + /** + * Starts Keep Alive frame sending + * + * @since S60 3.2 + */ + inline void StartKeepAlive(); + + /** + * Stops Keep Alive frame sending + * + * @since S60 3.2 + */ + inline void StopKeepAlive(); + + /** + * To be called upon every RX Data frame (other than Null and QoS Null Data) + * + * @since S60 3.2 + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + * @param aPayloadLength length of the ethernet frame payload + */ + inline void OnDataRxCompleted( + WHA::TQueueId aQueueId, + TUint aPayloadLength ); + + /** + * To be called upon every Data frame (other than Null and QoS Null Data) + * send completion + * + * @since S60 3.2 + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + */ + inline void OnDataTxCompleted( WHA::TQueueId aQueueId ); + + /** + * To be called upon every QoS Null Data frame send completion + * + * @since S60 3.2 + */ + inline void OnQosNullDataTxCompleted(); + + /** + * To be called upon every Null Data frame send completion + * + * @since S60 3.2 + */ + inline void OnNullDataTxCompleted(); + + /** + * To be called upon Voice Call Entry Timer timeout + * + * @since S60 3.2 + */ + inline void OnVoiceCallEntryTimerTimeout(); + + /** + * To be called upon Null Timer timeout + * + * @since S60 3.2 + */ + inline void OnNullTimerTimeout(); + + /** + * To be called upon Voice Timer timeout + * + * @since S60 3.2 + */ + inline void OnNoVoiceTimerTimeout(); + + /** + * To be called upon Keep Alive Timer timeout + * + * @since S60 3.2 + */ + void OnKeepAliveTimerTimeout(); + + /** + * Insert new RCPI value into the Signal Predictor. + * + * @since S60 3.2 + * @param aTimestamp Current time (in microseconds) + * @param aRcpi RCPI value from HW + * @return ETrue if an indication about weakening signal should be created + * EFalse otherwise + */ + inline TBool InsertNewRcpiIntoPredictor( TInt64 aTimestamp, WHA::TRcpi aRcpi ); + + /** + * Gets the latest median RCPI value from Signal Predictor. + * + * @since S60 v3.2 + * @param aTimestamp Current time (in microseconds). + * @param aLatestMedian reference to the median. + * @return ETrue if median RCPI value is available. + * EFalse otherwise + */ + inline TBool GetLatestMedianRcpiFromPredictor( + TInt64 aTimestamp, + WHA::TRcpi& aLatestMedian ) const; + + /** + * Configures the Signal Predictor. + * + * @since S60 v5.0 + * @param aTimeToWarnLevel Specifies the time (in microseconds) + * how far into the future signal prediction is done. + * @param aTimeToNextInd The minimum time difference (in + * microseconds) between two signal loss prediction indications. + * @param aRcpiWarnLevel If this RCPI level is predicted to be + * reached within the time specified by aSpTimeToCountPrediction, + * a signal loss prediction indication is sent. + */ + inline void ConfigureWlanSignalPredictor( + TUint32 aTimeToWarnLevel, + TUint32 aTimeToNextInd, + WHA::TRcpi aRcpiWarnLevel ); + + /** + * Adds a WLAN feature supported by us to the list of those supported + * features which are indicated in BSS membership selector + * + * @param aFeature Feature to add + */ + void AddBssMembershipFeature( T802Dot11BssMembershipSelector aFeature ); + + /** + * Checks if the specified item is a WLAN feature indicated in BSS + * membership selector and if it is supported by us + * + * @param aItem Item to check + * @return ETrue if supported + * EFalse otherwise + */ + TBool BssMembershipFeatureSupported( TUint8 aItem ) const; + + /** + * Gets our HT Capabilities element + * @return HT Capabilities element + */ + inline SHtCapabilitiesIE& GetOurHtCapabilitiesIe(); + + /** + * Gets target/current network's HT Capabilities element + * @return HT Capabilities element + */ + inline SHtCapabilitiesIE& GetNwHtCapabilitiesIe(); + + /** + * Gets target/current network's HT Operation element + * @return HT Operation element + */ + inline SHtOperationIE& GetNwHtOperationIe(); + + /** + * Gets HT Block Ack configuration provided by WLAN Mgmt client + * @return HT Block Ack configuration + */ + inline WHA::ShtBlockAckConfigure& GetHtBlockAckConfigure(); + + /** + * Gets proprietary SNAP header provided by WLAN Mgmt client + * @return Proprieatary SNAP header + */ + inline SSnapHeader& GetProprietarySnapHeader(); + + /** + * Gets WHA layer transmission status + * + * @param aTxQueueState State (full / not full) of every WHA transmit queue + * @return ETrue if the Tx pipeline is active, i.e. Tx frame submission + * is allowed + * EFalse if the Tx pipeline is not active, i.e. Tx frame submission + * is not allowed + */ + inline TBool GetWhaTxStatus( TWhaTxQueueState& aTxQueueState ) const; + +protected: + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + /** + * Method called when packet has been flushed (removed) + * from packet scheduler + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet that was flushed + * @param aMetaHeader frame meta header + */ + virtual void OnPacketFlushEvent( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + /** + * Method called when Packet Scheduler's packet scheduling method + * should be called, as there exists a packet that is suitable for + * transmission. + * NOTE: if any other Packet Scheduler method is called within this + * context the result is undefined. + * + * @param aCtxImpl global state machine context + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + virtual void CommandResponse( + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + virtual void CommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + virtual void Indication( + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ); + + // Frame sending callbacks + + virtual void SendPacketTransfer( + WHA::TPacketId aPacketId ); + + virtual void SendPacketComplete( + WHA::TStatus aStatus, + WHA::TPacketId aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint8 aAckFailures, + TUint16 aSequenceNumber ); + + + // Frame receive + + virtual TAny* RequestForBuffer( TUint16 aLength ); + + virtual void ReceivePacket( + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + void* aBuffer, + TUint32 aFlags ); + + /** + * Request to send a Null Data Frame + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQosNull ETrue if a QoS Null Data frame should be transmitted + * EFalse if a regular Null Data frame should be transmitted + * @return ETrue if the send request was successfully submitted + * EFalse otherwise + */ + virtual TBool TxNullDataFrame( + WlanContextImpl& aCtxImpl, + TBool aQosNull ); + + // Prohibit copy constructor + WlanContextImpl( const WlanContextImpl& aCntx ); + // Prohibit assigment operator + WlanContextImpl& operator= ( const WlanContextImpl& ); + +public: // data + + WlanMacState* iCurrentMacState; + Umac& iUmac; + + + /** The states of the statemachine */ + States iStates; + /** 802.11 MIB */ + SWlanMib iWlanMib; + /** supported rates lookup table */ + SupportedRateLookUp + iSupportedRatesLookUpTable[KMaxNumberOfDot11bAndgRates]; + /** is protocol stack side datapath enabled or not */ + TBool iEnableUserData; + + TUint8* iCurrentRxBuffer; + +private: // definitions + + /** + * max number of features in our WLAN feature array (see below) + */ + static const TUint KMaxNumOfWlanFeatures = 1; + + /** + * value used in WLAN feature array for unallocated elements + */ + static const TUint8 KUnallocated = 0; + + /** + * container type for IDs of those WLAN features which are indicated in BSS + * membership selector + */ + typedef TUint8 TWlanFeatureArray[KMaxNumOfWlanFeatures]; + +private: // data + + /** + * ETrue if the Tx data buffer for frames created internally in this + * component is free (applies both to the DMA and the non-DMA Tx buffer). + * EFalse if it is in use + */ + TBool iInternalTxBufFree; + + /** + * ETrue if someone if waiting for the internal Tx Buffer to become + * available. EFalse othwerwise + */ + TBool iInternalTxBufBeingWaited; + + TWlanUserTxDataCntx iTxDataCntx; + TWlanUserTxDataCntx iMgmtTxDataCntx; + + /** data frame header template */ + SDataFrameHeader iDataFrameHeader; + + TUint32 iAlignNullData; + SNullDataFrame iNullDataFrame; + + TUint32 iAlignQosNullData; + SHtQosNullDataFrame iQosNullDataFrame; + + /** authentication sequence expected counter */ + WlanAuthSeqNmbrExpected iAuthSeqNmbrExpected; + /** connection state info */ + + WlanConnectContext iConnectContext; + /** available privacy mode filters */ + WlanPrivacyModeFilters iPrivacyModeFilters; + /** + * container for joined multicast (Rx) groups. Contains the + * multicast MAC addresses denoting the groups. + */ + JoinedMulticastGroups iJoinedMulticastGroups; + /** + * has Consecutive Beacons Lost indication already been sent to + * WLAN Mgmt Client + */ + TBool iConsecutiveBeaconsLostIndicated; + /** + * has Consecutive Tx Failures indication already been sent to + * WLAN Mgmt Client + */ + TBool iConsecutiveTxFailuresIndicated; + /** + * has Consecutive 802.11 Power Mgmt Mode Set Failures indication already + * been sent to WLAN Mgmt Client + */ + TBool iConsecutivePwrModeSetFailuresIndicated; + /** + * failed Tx packet counter used to determine if we should indicate + * Consecutive Tx Failures + */ + TUint8 iFailedTxPacketCount; + /** + * counter which states how many times we will still try to change the + * 802.11 power management mode before indicating Consecutive 802.11 + * Power Mgmt Mode Set Failures, if we continue to be unsuccessful in + * the power management mode changing + */ + TUint iSetPsModeCount; + + /** is a WHA cmd active */ + TBool iWsaCmdActive; + + WlanTxRateAdaptation iTxRateAdaptation; + + WlanPRNGenerator iPrnGenerator; + + // Asynchronous Completion Token for WHA command + TUint32 iWhaCommandAct; + + /** 802.11 management frame templates */ + ManagementFrameTemplates iManagementFrameTemplates; + + WHA::Wha* iWha; + WHA::SSettings iWHASettings; + + SWsaCommands* iWsaCommands; + + WlanEventDispatcher iEventDispatcher; + WlanPacketScheduler iPacketScheduler; + /** dynamic power mode context */ + WlanDynamicPowerModeMgmtCntx iDynamicPowerModeCntx; + + /** frame statistics counters */ + TStatisticsResponse iFrameStatistics; + + /** Null Data Frame sending controller */ + WlanNullSendController iNullSendController; + + /** WLAN signal predictor */ + WlanSignalPredictor iWlanSignalPredictor; + + /** + * includes IDs of those WLAN features which are indicated in BSS membership + * selector and which we support + */ + TWlanFeatureArray iOurBssMembershipFeatureArray; + + /** + * HT Capabilities element which we use to inform about our static HT + * capabilities + */ + SHtCapabilitiesIE iOurHtCapabilitiesIe; + + /** HT Block Ack configuration provided by WLAN Mgmt Client */ + WHA::ShtBlockAckConfigure iHtBlockAckConfigure; + + /** + * Otherwise valid received 802.11 Data frames containing this SNAP header + * are accepted and forwarded to the WLAN Management Client. + */ + SSnapHeader iProprietarySnapHeader; + }; + +#include "UmacContextImpl.inl" + +#endif // WLANCONTEXTIMPL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacContextImpl.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2119 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanContextImpl inline methods. +* +*/ + +/* +* %version: 75 % +*/ + +#include "umacconnectcontext.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanMacState& WlanContextImpl::CurrentState() + { + return *iCurrentMacState; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::SSettings& WlanContextImpl::WHASettings() + { + return iWHASettings; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const WHA::SSettings& WlanContextImpl::WHASettings() const + { + return iWHASettings; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::WHASettings( + const WHA::SSettings& aSSettings ) + { + iWHASettings = aSSettings; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SAuthenticationFrame& WlanContextImpl::GetAuthenticationFrame() + { + return iManagementFrameTemplates.iAuthenticationFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtAuthenticationFrame& WlanContextImpl::GetHtAuthenticationFrame() + { + return iManagementFrameTemplates.iHtAuthenticationFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SAssociationRequestFrame& +WlanContextImpl::GetAssociationRequestFrame() + { + return iManagementFrameTemplates.iAssociationRequestFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtAssociationRequestFrame& +WlanContextImpl::GetHtAssociationRequestFrame() + { + return iManagementFrameTemplates.iHtAssociationRequestFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDeauthenticateFrame& WlanContextImpl::GetDeauthenticateFrame() + { + return iManagementFrameTemplates.iDeauthenticateFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtDeauthenticateFrame& WlanContextImpl::GetHtDeauthenticateFrame() + { + return iManagementFrameTemplates.iHtDeauthenticateFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDisassociateFrame& WlanContextImpl::GetDisassociationFrame() + { + return iManagementFrameTemplates.iDisassociationFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtDisassociateFrame& WlanContextImpl::GetHtDisassociationFrame() + { + return iManagementFrameTemplates.iHtDisassociationFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SReassociationRequestFrame& WlanContextImpl::GetReassociationRequestFrame() + { + return iManagementFrameTemplates.iReassociationRequestFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtReassociationRequestFrame& +WlanContextImpl::GetHtReassociationRequestFrame() + { + return iManagementFrameTemplates.iHtReassociationRequestFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SNullDataFrame& WlanContextImpl::NullDataFrame() + { + return iNullDataFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtQosNullDataFrame& WlanContextImpl::QosNullDataFrame() + { + return iQosNullDataFrame; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 WlanContextImpl::QosNullDataFrameLength() const + { + return ( HtSupportedByNw() ? + sizeof( SHtQosNullDataFrame ) : + sizeof( SQosNullDataFrame ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SDataFrameHeader& WlanContextImpl::GetDataFrameHeader() + { + return iDataFrameHeader; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TWlanUserTxDataCntx& WlanContextImpl::GetTxDataCntx() + { + return iTxDataCntx; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TWlanUserTxDataCntx& WlanContextImpl::GetTxDataCntx() const + { + return iTxDataCntx; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TWlanUserTxDataCntx& WlanContextImpl::GetMgmtTxDataCntx() + { + return iMgmtTxDataCntx; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResetAuthSeqNmbrExpected() + { + iAuthSeqNmbrExpected.Reset(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::TxRatePolicy( + WHA::TQueueId aQueueId, + TBool aUseSpecialRatePolicy, + WHA::TRate& aRate, + TUint8& aPolicyId ) const + { + return iTxRateAdaptation.RatePolicy( + *this, + aQueueId, + aUseSpecialRatePolicy, + aRate, + aPolicyId ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TMacAddress& WlanContextImpl::GetBssId() + { + return iConnectContext.iBSSID; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::Aid( const TUint32 aAid ) + { + iConnectContext.iAid = aAid; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::Aid() const + { + return iConnectContext.iAid; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::AtimWindow( const TUint32 aAtimWindow ) + { + iConnectContext.iAtim = aAtimWindow; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::AtimWindow() const + { + return iConnectContext.iAtim; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TSSID& WlanContextImpl::GetSsId() + { + return iConnectContext.iSSID; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TEncryptionStatus& WlanContextImpl::EncryptionStatus() + { + return iConnectContext.iEncryptionStatus; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16& WlanContextImpl::AuthenticationAlgorithmNumber() + { + return iConnectContext.iAuthAlgorithmNbr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnTxCompleted( + const TUint32 aRate, + const TBool aSuccess, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate ) + { + if ( !( WHASettings().iCapability & + WHA::SSettings::KAutonomousRateAdapt ) ) + { + // as autonomous rate adaptation is not being used, inform our own + // rate adaptation object about Tx completion + iTxRateAdaptation.OnTxCompleted( aRate, aSuccess, aQueueId, + aRequestedRate ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::CancelTimer() + { + iUmac.CancelTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 WlanContextImpl::GetAuthSeqNmbrExpected() const + { + return iAuthSeqNmbrExpected.GetAuthSeqNmbrExpected(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSupportedRatesIE& WlanContextImpl::GetOurSupportedRatesIE() + { + return iConnectContext.iOurSupportedRates; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SExtendedSupportedRatesIE& WlanContextImpl::GetOurExtendedSupportedRatesIE() + { + return iConnectContext.iOurExtendedSupportedRates; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetScanResponseFrameBody( const TUint8* aBody ) + { + iConnectContext.iScanResponseFrameBody = aBody; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TUint8* WlanContextImpl::ScanResponseFrameBody() const + { + return iConnectContext.iScanResponseFrameBody; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetScanResponseFrameBodyLength( TUint16 aLength ) + { + iConnectContext.iScanResponseFrameBodyLength = aLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TUint16 WlanContextImpl::ScanResponseFrameBodyLength() const + { + return iConnectContext.iScanResponseFrameBodyLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IeData( const TUint8* aIeData ) + { + iConnectContext.iIeData = aIeData; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TUint8* WlanContextImpl::IeData() const + { + return iConnectContext.iIeData; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IeDataLength( TUint16 aIeDataLength ) + { + iConnectContext.iIeDataLength = aIeDataLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::RadioMeasurement() const + { + return iConnectContext.iRadioMeasurement; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::RadioMeasurement( TBool aRadioMeasurement ) + { + iConnectContext.iRadioMeasurement = aRadioMeasurement; + } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint16 WlanContextImpl::IeDataLength() const + { + return iConnectContext.iIeDataLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetActivePrivacyModeFilter( + WlanContextImpl& /*aCtxImpl*/, + TEncryptionStatus aEncryptionStatus ) + { + iPrivacyModeFilters.SetActiveFilter( aEncryptionStatus ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ExecuteActivePrivacyModeFilter( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const + { + return iPrivacyModeFilters.ExecuteFilter( + aFrameheader, + aUserDataEnabled, + aEthernetType, + aUnicastKeyExists, + aAesOrTkipOrWapiEncrypted ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SCapabilityInformationField& +WlanContextImpl::GetCapabilityInformation() + { + return iConnectContext.iCapabilityInformation; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::OnConsecutiveBeaconsLost() + { + TBool ret( EFalse ); + + if ( !iConsecutiveBeaconsLostIndicated ) + { + iConsecutiveBeaconsLostIndicated = ETrue; + ret = ETrue; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::OnConsecutiveTxFailures() + { + TBool ret( EFalse ); + + if ( !iConsecutiveTxFailuresIndicated ) + { + iConsecutiveTxFailuresIndicated = ETrue; + ret = ETrue; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::OnConsecutivePwrModeSetFailures() + { + TBool ret( EFalse ); + + if ( !iConsecutivePwrModeSetFailuresIndicated ) + { + iConsecutivePwrModeSetFailuresIndicated = ETrue; + ret = ETrue; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResetBssLossIndications() + { + iConsecutiveBeaconsLostIndicated = EFalse; + iConsecutiveTxFailuresIndicated = EFalse; + iConsecutivePwrModeSetFailuresIndicated = EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSupportedRatesIE& WlanContextImpl::GetApSupportedRatesIE() + { + return iConnectContext.iApSupportedRates; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SExtendedSupportedRatesIE& WlanContextImpl::GetApExtendedSupportedRatesIE() + { + return iConnectContext.iApExtendedSupportedRates; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResetTxRateAdaptation() + { + iTxRateAdaptation.Reset(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32& WlanContextImpl::GetMinBasicRate() + { + return iConnectContext.iNwsaMinBasicRate; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32& WlanContextImpl::GetMaxBasicRate() + { + return iConnectContext.iNwsaMaxBasicRate; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ClearBasicRateSet() + { + iConnectContext.iNwsaBasicRateSet = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::BasicRateSetBitSet( + const TUint32 aRateBitToSet ) + { + iConnectContext.iNwsaBasicRateSet |= aRateBitToSet; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::BasicRateSet() const + { + return iConnectContext.iNwsaBasicRateSet; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TOperationMode WlanContextImpl::NetworkOperationMode() const + { + return iConnectContext.iOperationMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::NetworkOperationMode( + WHA::TOperationMode aOperationMode ) + { + iConnectContext.iOperationMode = aOperationMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::GroupKeyType( + WHA::TKeyType aKeyType ) + { + iConnectContext.iGroupKeyType = aKeyType; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TKeyType WlanContextImpl::GroupKeyType() const + { + return iConnectContext.iGroupKeyType; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::PairWiseKeyType( + WHA::TKeyType aKeyType ) + { + iConnectContext.iPairWiseKeyType = aKeyType; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TKeyType WlanContextImpl::PairWiseKeyType() const + { + return iConnectContext.iPairWiseKeyType; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::PairwiseCipher( TWlanCipherSuite aCipherSuite ) + { + iConnectContext.iPairwiseCipher = aCipherSuite; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TWlanCipherSuite WlanContextImpl::PairwiseCipher() const + { + return iConnectContext.iPairwiseCipher; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TChannelNumber WlanContextImpl::NetworkChannelNumeber() const + { + return iConnectContext.iChannelNumber; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::NetworkChannelNumeber( + WHA::TChannelNumber aChannelNumber ) + { + iConnectContext.iChannelNumber = aChannelNumber; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::NetworkBeaconInterval() const + { + return iConnectContext.iBeaconInterval; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::NetworkBeaconInterval( + TUint32 aBeaconInterval ) + { + iConnectContext.iBeaconInterval = aBeaconInterval; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TPsMode WlanContextImpl::DesiredDot11PwrMgmtMode() const + { + return iConnectContext.iDesiredDot11PwrMgmtMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::DesiredDot11PwrMgmtMode( + WHA::TPsMode aPsMode ) + { + iConnectContext.iDesiredDot11PwrMgmtMode = aPsMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TPsMode WlanContextImpl::CurrentDot11PwrMgmtMode() const + { + return iConnectContext.iCurrentDot11PwrMgmtMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::CurrentDot11PwrMgmtMode( + WHA::TPsMode aPsMode ) + { + iConnectContext.iCurrentDot11PwrMgmtMode = aPsMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TDot11PsModeWakeupSetting& + WlanContextImpl::DesiredPsModeConfig() const + { + return iConnectContext.iDesiredPsModeConfig; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetDesiredPsModeConfig( + const TDot11PsModeWakeupSetting& aPsModeWakeupSetting ) + { + iConnectContext.iDesiredPsModeConfig = aPsModeWakeupSetting; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::TPsMode WlanContextImpl::ClientDot11PwrMgmtMode() const + { + return iConnectContext.iClientDesiredDot11PwrMgtMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ClientDot11PwrMgmtMode( + TPowerMode aPsMode ) + { + iConnectContext.iClientDesiredDot11PwrMgtMode = + static_cast(aPsMode); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TDot11PsModeWakeupSetting& + WlanContextImpl::ClientLightPsModeConfig() const + { + return iConnectContext.iClientLightPsModeConfig; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetClientLightPsModeConfig( + TWlanWakeUpInterval aWakeupMode, + TUint8 aListenInterval ) + { + iConnectContext.iClientLightPsModeConfig.iWakeupMode = aWakeupMode; + iConnectContext.iClientLightPsModeConfig.iListenInterval = aListenInterval; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TDot11PsModeWakeupSetting& + WlanContextImpl::ClientDeepPsModeConfig() const + { + return iConnectContext.iClientDeepPsModeConfig; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetClientDeepPsModeConfig( + TWlanWakeUpInterval aWakeupMode, + TUint8 aListenInterval ) + { + iConnectContext.iClientDeepPsModeConfig.iWakeupMode = aWakeupMode; + iConnectContext.iClientDeepPsModeConfig.iListenInterval = aListenInterval; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::DynamicPwrModeMgtDisabled() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KDynamicPwrModeMgmtDisabled ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UseShortPreamble() const + { + return (iConnectContext.iFlags & WlanConnectContext::KUseShortPreamble); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::Reassociate() const + { + return (iConnectContext.iFlags & WlanConnectContext::KReassociate); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UseShortSlotTime() const + { + return (iConnectContext.iFlags & WlanConnectContext::KUseShortSlotTime); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ProtectionBitSet() const + { + return (iConnectContext.iFlags & WlanConnectContext::KProtectionBitSet); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::QosEnabled() const + { + return (iConnectContext.iFlags & WlanConnectContext::KQosEnabled); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdEnabled() const + { + return (iConnectContext.iFlags & WlanConnectContext::KUapsdEnabled); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::MulticastFilteringDisAllowed() const + { + return (iConnectContext.iFlags & WlanConnectContext::KMulticastFilteringDisAllowed); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ErpIePresent() const + { + return (iConnectContext.iFlags & WlanConnectContext::KErpIePresent); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::DisassociatedByAp() const + { + return (iConnectContext.iFlags & WlanConnectContext::KDisassociatedByAp); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdRequestedForVoice() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdRequestedForVoice ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdRequestedForVideo() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdRequestedForVideo ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdRequestedForBestEffort() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdRequestedForBestEffort ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdRequestedForBackground() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdRequestedForBackground ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdUsedForVoice() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdUsedForVoice ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdUsedForVideo() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdUsedForVideo ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdUsedForBestEffort() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdUsedForBestEffort ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UapsdUsedForBackground() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KUapsdUsedForBackground ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ApTestOpportunitySeekStarted() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KApTestOpportunitySeekStarted ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ApTestOpportunityIndicated() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KApTestOpportunityIndicated ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::HtSupportedByNw() const + { + return ( iConnectContext.iFlags & + WlanConnectContext::KHtSupportedByNw ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 WlanContextImpl::WmmParameterSetCount() const + { + return iConnectContext.iWmmParamSetCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::WmmParameterSetCount( TUint8 aValue ) + { + iConnectContext.iWmmParamSetCount = aValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::RateBitMask() const + { + return iConnectContext.iRateBitMask; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::RateBitMask( TUint32 aValue ) + { + iConnectContext.iRateBitMask = aValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TCwMinVector& WlanContextImpl::CwMinVector() + { + return iConnectContext.iCwMin; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TCwMaxVector& WlanContextImpl::CwMaxVector() + { + return iConnectContext.iCwMax; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TAifsVector& WlanContextImpl::AifsVector() + { + return iConnectContext.iAIFS; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TTxOplimitVector& WlanContextImpl::TxOplimitVector() + { + return iConnectContext.iTxOplimit; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TAcmVector& WlanContextImpl::AcmVector() + { + return iConnectContext.iAdmCtrlMandatory; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline STxWmmIE& WlanContextImpl::OurWmmIe() + { + return iConnectContext.iOurWmmIe; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TTxRatePolicy& WlanContextImpl::RatePolicy() + { + return iConnectContext.iRatePolicy; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TQueue2RateClass& WlanContextImpl::Queue2RateClass() + { + return iConnectContext.iQueue2RateClass; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInitialMaxTxRate4RateClass& +WlanContextImpl::InitialMaxTxRate4RateClass() + { + return iConnectContext.iInitialMaxTxRate4RateClass; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TTxAutoRatePolicy& WlanContextImpl::AutoRatePolicy() + { + return iConnectContext.iAutoRatePolicy; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 WlanContextImpl::SpecialTxAutoRatePolicy() const + { + return iConnectContext.iSpecialTxRatePolicyId; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SpecialTxAutoRatePolicy( TUint8 aPolicyId ) + { + iConnectContext.iSpecialTxRatePolicyId = aPolicyId; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline THtMcsPolicy& WlanContextImpl::HtMcsPolicy() + { + return iConnectContext.iHtMcsPolicy; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TQosInfoUapsdMaxSpLen& WlanContextImpl::UapsdMaxSpLen() + { + return iConnectContext.iUapsdMaxSpLen; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::WsaCmdActive() const + { + return iWsaCmdActive; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ActivateWsaCmd() + { + iWsaCmdActive = ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::DeActivateWsaCmd() + { + iWsaCmdActive = EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementAuthSeqNmbrExpected() + { + ++iAuthSeqNmbrExpected; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::SetTxRateAdaptationRates( + TUint8 aPolicyId, + WHA::TRate aRateBitmask ) + { + return iTxRateAdaptation.SetRates( aPolicyId, aRateBitmask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetTxRatePolicy( WHA::TQueueId aQueueId, TUint8 aPolicyId ) + { + iTxRateAdaptation.SetPolicy( aQueueId, aPolicyId ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetCurrentMaxTxRate( + TUint8 aPolicyId, + WHA::TRate aRate ) + { + iTxRateAdaptation.SetCurrentMaxTxRate( aPolicyId, aRate ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetTxRateAdaptationAlgorithmParams( + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ) + { + iTxRateAdaptation.SetAlgorithmParameters( + aMinStepUpCheckpoint, + aMaxStepUpCheckpoint, + aStepUpCheckpointFactor, + aStepDownCheckpoint, + aMinStepUpThreshold, + aMaxStepUpThreshold, + aStepUpThresholdIncrement, + aStepDownThreshold, + aDisableProbeHandling ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::Random() + { + return iPrnGenerator.Generate(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 WlanContextImpl::WhaCommandAct() const + { + return iWhaCommandAct; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::WhaCommandAct( TUint32 aAct ) + { + iWhaCommandAct = aAct; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::RegisterEvent( const TOIDHeader& aOid ) + { + iEventDispatcher.Register( aOid ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::RegisterEvent( TInternalEvent aInternalEvent ) + { + iEventDispatcher.Register( aInternalEvent ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ChannelEnabled( + WlanEventDispatcher::TChannel aChannel ) const + { + return iEventDispatcher.ChannelEnabled( aChannel ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::Enable( + WlanEventDispatcher::TChannel aChannelMask ) + { + iEventDispatcher.Enable( aChannelMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::Disable( + WlanEventDispatcher::TChannel aChannelMask ) + { + iEventDispatcher.Disable( aChannelMask ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::DispatchEvent() + { + return iEventDispatcher.Dispatch(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::CommandCompletionEventRegistered( + WHA::TCompleteCommandId aCommandId ) const + { + return iEventDispatcher.CommandCompletionRegistered( aCommandId ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::DispatchCommandCompletionEvent() + { + return iEventDispatcher.DispatchCommandCompletionEvent(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::ProtocolStackTxDataAllowed() const + { + return iEnableUserData; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::PushPacketToPacketScheduler( + const TAny* aPacket, + TUint32 aLength, + WHA::TQueueId aQueueId, + TUint32 aPacketId, + const TDataBuffer* aMetaHeader, + TBool aMore, + TBool aMulticastData, + TBool aUseSpecialRatePolicy ) + { + return iPacketScheduler.Push( + *this, + aPacket, + aLength, + aQueueId, + aPacketId, + aMetaHeader, + aMore, + aMulticastData, + aUseSpecialRatePolicy ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::FlushPacketScheduler() + { + iPacketScheduler.Flush( *this ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SchedulePackets( TBool aMore ) + { + iPacketScheduler.SchedulePackets( *this, aMore ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::UnsentTxPackets() const + { + return iPacketScheduler.UnsentPackets(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementFailedTxPacketCount() + { + ++iFailedTxPacketCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 WlanContextImpl::FailedTxPacketCount() const + { + return iFailedTxPacketCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResetFailedTxPacketCount() + { + iFailedTxPacketCount = 0; + } + +// --------------------------------------------------------------------------- +// We use the failed Tx packet count threshold as the threshold value +// in this case, too - as informing AP about a power mgmt mode change +// also involves a frame Tx +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::InitializeSetPsModeCount() + { + iSetPsModeCount = iWlanMib.iFailedTxPacketCountThreshold; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::DecrementSetPsModeCount() + { + --iSetPsModeCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint WlanContextImpl::SetPsModeCount() const + { + return iSetPsModeCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StartPowerModeManagement() + { + iDynamicPowerModeCntx.StartPowerModeManagement(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StopPowerModeManagement() + { + iDynamicPowerModeCntx.StopPowerModeManagement(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TPowerMgmtModeChange WlanContextImpl::OnFrameTx( + WHA::TQueueId aQueueId, + TUint16 aEtherType ) + { + return iDynamicPowerModeCntx.OnFrameTx( aQueueId, aEtherType ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TPowerMgmtModeChange WlanContextImpl::OnFrameRx( + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TUint aPayloadLength, + TDaType aDaType ) + { + return iDynamicPowerModeCntx.OnFrameRx( + aAccessCategory, + aEtherType, + aPayloadLength, + aDaType ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetPowerModeManagementParameters( + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) + { + iDynamicPowerModeCntx.SetParameters( + aToLightPsTimeout, + aToLightPsFrameThreshold, + aToActiveTimeout, + aToActiveFrameThreshold, + aToDeepPsTimeout, + aToDeepPsFrameThreshold, + aUapsdRxFrameLengthThreshold ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ConfigurePwrModeMgmtTrafficOverride( + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ) + { + iDynamicPowerModeCntx.ConfigureTrafficOverride( + aStayInPsDespiteUapsdVoiceTraffic, + aStayInPsDespiteUapsdVideoTraffic, + aStayInPsDespiteUapsdBestEffortTraffic, + aStayInPsDespiteUapsdBackgroundTraffic, + aStayInPsDespiteLegacyVoiceTraffic, + aStayInPsDespiteLegacyVideoTraffic, + aStayInPsDespiteLegacyBestEffortTraffic, + aStayInPsDespiteLegacyBackgroundTraffic ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::FreezePwrModeMgmtTrafficOverride() + { + iDynamicPowerModeCntx.FreezeTrafficOverride(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::OnActiveToLightPsTimerTimeout() + { + return iDynamicPowerModeCntx.OnActiveToLightPsTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::OnLightPsToActiveTimerTimeout() + { + return iDynamicPowerModeCntx.OnLightPsToActiveTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::OnLightPsToDeepPsTimerTimeout() + { + return iDynamicPowerModeCntx.OnLightPsToDeepPsTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanContextImpl::TGroupAddStatus WlanContextImpl::AddMulticastAddress( + const TMacAddress& aMacAddress ) + { + return iJoinedMulticastGroups.AddGroup( aMacAddress ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::RemoveMulticastAddress( const TMacAddress& aMacAddress ) + { + return iJoinedMulticastGroups.RemoveGroup( aMacAddress ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 WlanContextImpl::MulticastAddressCount() const + { + return iJoinedMulticastGroups.Count(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8 WlanContextImpl::GetMulticastAddresses( + const TMacAddress*& aMacAddresses ) const + { + return iJoinedMulticastGroups.GetGroups( aMacAddresses ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResetMulticastAddresses() + { + iJoinedMulticastGroups.Reset(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::MarkInternalTxBufFree() + { + iInternalTxBufFree = ETrue; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanContextImpl::MarkInternalTxBufFree: buffer free again")); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::InternalTxBufBeingWaited() const + { + return iInternalTxBufBeingWaited; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ClearInternalTxBufBeingWaitedFlag() + { + iInternalTxBufBeingWaited = EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResetFrameStatistics() + { + os_memset( &iFrameStatistics, 0, sizeof( iFrameStatistics ) ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementRxUnicastDataFrameCount( + WHA::TQueueId aAccessCategory ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].rxUnicastDataFrameCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementTxUnicastDataFrameCount( + WHA::TQueueId aAccessCategory ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].txUnicastDataFrameCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementRxMulticastDataFrameCount( + WHA::TQueueId aAccessCategory ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].rxMulticastDataFrameCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementTxMulticastDataFrameCount( + WHA::TQueueId aAccessCategory) + { + ++iFrameStatistics.acSpecific[aAccessCategory].txMulticastDataFrameCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementTxRetryCount( + WHA::TQueueId aAccessCategory, + TUint aCount ) + { + iFrameStatistics.acSpecific[aAccessCategory].txRetryCount += aCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementTxErrorCount( + WHA::TQueueId aAccessCategory ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].txErrorCount; + } + +// --------------------------------------------------------------------------- +// Note! We use the Tx Media Delay field first to collect the +// cumulative Media Delay. The average Media Delay is then calculated at the +// point of reporting the frame statistics results to WLAN Mgmt client +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementTxMediaDelay( + WHA::TQueueId aAccessCategory, + TUint aDelay ) + { + iFrameStatistics.acSpecific[aAccessCategory].txMediaDelay += aDelay; + } + +// --------------------------------------------------------------------------- +// Note! We use the Total Tx Delay field first to collect the +// cumulative Total Tx Delay. The average Total Tx Delay is then calculated +// at the point of reporting the frame statistics results to WLAN Mgmt client +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::IncrementTotalTxDelay( + WHA::TQueueId aAccessCategory, + TUint aDelay ) + { + iFrameStatistics.acSpecific[aAccessCategory].totalTxDelay += aDelay; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StoreFcsErrorCount( TUint aCount ) + { + iFrameStatistics.fcsErrorCount = aCount; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TStatisticsResponse& WlanContextImpl::FrameStatistics() const + { + return iFrameStatistics; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::SetNullSendControllerParameters( + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout ) + { + iNullSendController.SetParameters( + aVoiceCallEntryTimeout, + aVoiceCallEntryTxThreshold, + aNullTimeout, + aNoVoiceTimeout, + aKeepAliveTimeout ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StartVoiceOverWlanCallMaintenance() + { + iNullSendController.StartVoiceOverWlanCallMaintenance(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StopVoiceOverWlanCallMaintenance() + { + iNullSendController.StopVoiceOverWlanCallMaintenance(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::TerminateVoiceOverWlanCallMaintenance() + { + iNullSendController.TerminateVoiceOverWlanCallMaintenance(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ResumeQosNullSending() + { + iNullSendController.ResumeQosNullSending(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StartKeepAlive() + { + iNullSendController.StartKeepAlive(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::StopKeepAlive() + { + iNullSendController.StopKeepAlive(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnDataRxCompleted( + WHA::TQueueId aQueueId, + TUint aPayloadLength ) + { + iNullSendController.OnFrameRx( aQueueId, aPayloadLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnDataTxCompleted( WHA::TQueueId aQueueId ) + { + iNullSendController.OnFrameTx( aQueueId ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnQosNullDataTxCompleted() + { + iNullSendController.OnQosNullDataTxCompleted(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnNullDataTxCompleted() + { + iNullSendController.OnNullDataTxCompleted(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnVoiceCallEntryTimerTimeout() + { + iNullSendController.OnVoiceCallEntryTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnNullTimerTimeout() + { + iNullSendController.OnNullTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnNoVoiceTimerTimeout() + { + iNullSendController.OnNoVoiceTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::OnKeepAliveTimerTimeout() + { + iNullSendController.OnKeepAliveTimerTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::InsertNewRcpiIntoPredictor( + TInt64 aTimestamp, + WHA::TRcpi aRcpi ) + { + return iWlanSignalPredictor.InsertNewRcpi( + // this cast is ok as the predictor is prepared for the possibility + // of the lower (TUint32) part of the timestamp rolling around + static_cast(aTimestamp), + aRcpi ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::GetLatestMedianRcpiFromPredictor( + TInt64 aTimestamp, + WHA::TRcpi& aLatestMedian ) const + { + return iWlanSignalPredictor.GetLatestMedian( + // this cast is ok as the predictor is prepared for the possibility + // of the lower (TUint32) part of the timestamp rolling around + static_cast(aTimestamp), + aLatestMedian ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanContextImpl::ConfigureWlanSignalPredictor( + TUint32 aTimeToWarnLevel, + TUint32 aTimeToNextInd, + WHA::TRcpi aRcpiWarnLevel) + { + iWlanSignalPredictor.ConfigureSignalPredictor( + aTimeToWarnLevel, + aTimeToNextInd, + aRcpiWarnLevel ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtCapabilitiesIE& WlanContextImpl::GetOurHtCapabilitiesIe() + { + return iOurHtCapabilitiesIe; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtCapabilitiesIE& WlanContextImpl::GetNwHtCapabilitiesIe() + { + return iConnectContext.iNwHtCapabilitiesIe; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SHtOperationIE& WlanContextImpl::GetNwHtOperationIe() + { + return iConnectContext.iNwHtOperationIe; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WHA::ShtBlockAckConfigure& WlanContextImpl::GetHtBlockAckConfigure() + { + return iHtBlockAckConfigure; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SSnapHeader& WlanContextImpl::GetProprietarySnapHeader() + { + return iProprietarySnapHeader; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanContextImpl::GetWhaTxStatus( + TWhaTxQueueState& aTxQueueState ) const + { + return iPacketScheduler.GetWhaTxStatus( *this, aTxQueueState ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDebug.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debugging/tracing related declarations & definitions +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef UMACDEBUG_H +#define UMACDEBUG_H + +struct TMacAddress; + +const TUint32 KCritLevel = 0x00000001; +const TUint32 KSeriousLevel = 0x00000002; +const TUint32 KErrorLevel = 0x00000004; +const TUint32 KWarningLevel = 0x00000008; +const TUint32 KInfoLevel = 0x00000010; + +const TUint32 KInitLevel = 0x00000020; +const TUint32 KUmacProtocolState = 0x00000040; +const TUint32 KWsaCmdState = 0x00000080; +const TUint32 KMutex = 0x00000100; +const TUint32 KWsaCallback = 0x00000200; +const TUint32 KUmacMgmtCallback = 0x00000400; +const TUint32 KUmacProtocolCallback = 0x00000800; +const TUint32 KWsaCmdStateDetails = 0x00001000; +const TUint32 KQos = 0x00002000; +const TUint32 KWlmCmd = 0x00004000; +const TUint32 KWlmIndication = 0x00008000; +const TUint32 KWlmCmdDetails = 0x00010000; +const TUint32 KUmacDetails = 0x00020000; +const TUint32 KWsaTx = 0x00040000; +const TUint32 KWsaTxDetails = 0x00080000; +const TUint32 KUmacAuth = 0x00100000; +const TUint32 KUmacAssoc = 0x00200000; +const TUint32 KPacketScheduler = 0x00400000; +const TUint32 KMemory = 0x00800000; +const TUint32 KTxRateAdapt = 0x01000000; +const TUint32 KRxFrame = 0x02000000; +const TUint32 KScan = 0x04000000; +const TUint32 KPwrStateTransition = 0x08000000; +const TUint32 KDot11StateTransit = 0x10000000; +const TUint32 KEventDispatcher = 0x20000000; + +/* for temporary trace */ +const TUint32 KScratch = 0x80000000; + + +extern void os_traceprint( + TUint32 aLevel, + const TUint8* aString ); +extern void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + TUint32 aArg1 ); +extern void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + const TUint8* aBeg, + /* one past last element to be traced */ + const TUint8* aEnd ); +extern void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + const TMacAddress& aMac ); +extern void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + const Sdot11MacHeader& aDot11Hdr ); + +extern void os_assert( + const TUint8* aError, + const TUint8* aFile, + TUint32 aLine ); + + +inline void OsAssert( + const TUint8* aError, + const TUint8* aFile, + TUint32 aLine ) + { + os_assert( aError, aFile, aLine ); + } + + +#ifndef NDEBUG /* for debug builds */ + +inline void OsTracePrint( + TUint32 aLevel, + const TUint8* aString ) + { + os_traceprint( aLevel, aString ); + } + +inline void OsTracePrint( + TUint32 aLevel, + const TUint8* aString, + TUint32 aArg1 ) + { + os_traceprint( aLevel, aString, aArg1 ); + } + +inline void OsTracePrint( + TUint32 aLevel, + const TUint8* aString, + const TUint8* aBeg, + // one past last element to be traced + const TUint8* aEnd ) + { + os_traceprint( aLevel, aString, aBeg, aEnd ); + } + +inline void OsTracePrint( + TUint32 aLevel, + const TUint8* aString, + const TMacAddress& aMac ) + { + os_traceprint( aLevel, aString, aMac ); + } + +inline void OsTracePrint( + TUint32 aLevel, + const TUint8* aString, + const Sdot11MacHeader& aDot11Hdr ) + { + os_traceprint( aLevel, aString, aDot11Hdr ); + } + +#else /* for release builds */ + +#define OsTracePrint(...) /* empty */ + +#endif // !NDEBUG + + +#endif // UMACDEBUG_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Associated.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Associated.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,681 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11Associated class +* +*/ + +/* +* %version: 46 % +*/ + +#ifndef WLANDOT11ASSOCIATED_H +#define WLANDOT11ASSOCIATED_H + +#include "UmacDot11State.h" +#include "FrameXferBlock.h" +#include "umacinternaldefinitions.h" + +class TWlanUserTxDataCntx; + +/** +* This is a state where STA has entered to state where +* it is able send MPDU's to a network +*/ +class WlanDot11Associated : public WlanDot11State + { +public: + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl global state machine context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual TBool TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ); + + virtual TAny* RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + +protected: + + /** + * C++ default constructor. + */ + WlanDot11Associated() {}; + + /** + * Destructor. + */ + virtual ~WlanDot11Associated() {}; + + virtual void DoSetTxMpduDaAddress( + SDataFrameHeader& aDataFrameHeader, + const TMacAddress& aMac ) const = 0; + + virtual TBool DoIsRxFrameSAourAddress( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* aSubFrameHeader = NULL ) const = 0; + + /** + * Called to check is To/From DS bit combination valid + + * @return ETrue valid combination, EFalse else + */ + virtual TBool DoIsValidAddressBitCombination( + const SDataFrameHeader& aFrameHeader ) const = 0; + + virtual void DoBuildEthernetFrame( + TDataBuffer& aBuffer, + const SDataMpduHeader& aDot11DataMpdu, + const TUint8* aStartOfEtherPayload, + TUint aEtherPayloadLength, + TBool aAmsdu, + TUint8* aCopyBuffer ) = 0; + + /** + * Handles a received frame having a proprietary SNAP header + * + * @since S60 3.1 + * @param aBuffer meta header for the Rx frame + * @param aQosData ETrue if this is a QoS data frame + * @param aFrame pointer to the start of the frame + * @param aSubFrameHeader Pointer to the beginning of the subframe header. + * NULL if the MSDU is not a subframe within an A-MSDU + * @param aLength frame length + * @param aDecryptHeaderLen length of the decrypt header of the + * frame (e.g. IV etc.) + * @param aDecryptTrailerLen length of the decrypt trailer of the + * frame (e.g. MIC etc.) + * @param aHtControlLen length of the HT Control field of the + * frame's MAC header; or zero if field is not present + * @param aCopyBuffer If not NULL, the frame is part of an A-MSDU + * and it needs to be copied to the buffer denoted by this + * pointer + */ + void HandleProprietarySnapRxFrame( + TDataBuffer& aBuffer, + TBool aQosData, + const TAny* const aFrame, + const SAmsduSubframeHeader* aSubFrameHeader, + TUint aLength, + TUint aDecryptHeaderLen, + TUint aDecryptTrailerLen, + TUint aHtControlLen, + TUint8* aCopyBuffer ) const; + + /** + * Called upon receiving a beacon frame + * @param aCtxImpl statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + /** + * Called upon receiving a probe response frame + * @param aCtxImpl statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnProbeResponseFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + /** + * Called upon receiving a deauthentication frame + * @param aCtxImpl statemachine context + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnDeauthenticateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ); + + /** + * Called upon receiving a disassociation frame + * @param aCtxImpl statemachine context + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnDisassociateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ); + + /** + * Determines if the received 802.11 Data MPDU - excluding the contained + * MSDU or A-MSDU - is valid + * @param aLength Length of the MPDU + * @param aFrameHeader MAC header of the MPDU + * @param aQosData ETrue if the MPDU is a QoS Data frame + * EFalse othwerwise + * @param aAmsdu ETrue if the MPDU contains an A-MSDU + * EFalse othwerwise + * @param aHtControlLen Length of the HT Control field in the MPDU's MAC + * header. Zero if the field is not present + * @param aSecurityHeaderLen Length of the security header of the MPDU. + * Zero if the payload is not encrypted + * @param aSecurityTrailerLen Length of the security trailer of the MPDU. + * Zero if the payload is not encrypted + * @return ETrue if the MPDU is valid, EFalse otherwise + */ + inline TBool RxDataMpduValid( + const TUint32 aLength, + const SDataFrameHeader& aFrameHeader, + TBool aQosData, + TBool aAmsdu, + TUint aHtControlLen, + TUint aSecurityHeaderLen, + TUint aSecurityTrailerLen ) const; + + /** + * Determines the minimum length that the received 802.11 Data MPDU must + * have so that we are able to process is + * @param aQosData ETrue if the frame is a QoS Data frame + * EFalse othwerwise + * @param aAmsdu ETrue if the MPDU contains an A-MSDU + * EFalse othwerwise + * @param aHtControlLen Length of the HT Control field in the MPDU's MAC + * header. Zero if the field is not present + * @param aSecurityHeaderLen Length of the security header of the MPDU. + * Zero if the payload is not encrypted + * @param aSecurityTrailerLen Length of the security trailer of the MPDU. + * Zero if the payload is not encrypted + * @return + */ + inline TUint MinAcceptableRxDataMpduLen( + TBool aQosData, + TBool aAmsdu, + TUint aHtControlLen, + TUint aSecurityHeaderLen, + TUint aSecurityTrailerLen ) const; + + /** + * Determines whether the Destination Address (DA) of the received MPDU is + * a unicast, a brodcast or a multicast (but not a broadcast) address + * @param aFrameHeader MAC header of the MPDU + * @return See above + */ + inline TDaType RxFrameDaType( + const SDataFrameHeader& aFrameHeader ) const; + + /** + * Determines if the received MSDU is valid to be forwarded to the + * relevant client + * @param aCtxImpl statemachine context + * @param aFrameHeader MAC header of the MPDU encapsulating the MSDU + * @param aSubFrameHeader Pointer to the beginning of the subframe header. + * NULL if the MSDU is not a subframe within an A-MSDU + * @param aStartOfSnap Pointer to the beginning of the SNAP header + * @param aEtherType Ethernet type of the received MSDU + * @param aMulticast ETrue if the frame is a multicast, EFalse otherwise + * @param aFlags Flags from WHA frame receive method + * @param aSnapstatus Result of the SNAP header check of the received MSDU + * @return ETrue if the MSDU is valid, EFalse otherwise + */ + inline TBool RxMsduValid( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* aSubFrameHeader, + const TUint8* aStartOfSnap, + TUint16 aEtherType, + TBool aMulticast, + TUint32 aFlags, + TSnapStatus& aSnapStatus ) const; + + /** + * Determines the Ethernet payload length of an MSDU, which may or may not + * be a part of an A-MSDU + * @param aMpduLength Length of the received MPDU + * @param aSubframeLength Length of the A-MSDU subframe. Zero if the MPDU + * doesn't contain an A-MSDU + * @param aQosData ETrue if the frame is a QoS Data frame + * EFalse othwerwise + * @param aHtControlLen Length of the HT Control field in the MPDU's MAC + * header. Zero if the field is not present + * @param aSecurityHeaderLen Length of the security header of the MPDU. + * Zero if the payload is not encrypted + * @param aSecurityTrailerLen Length of the security trailer of the MPDU. + * Zero if the payload is not encrypted + * @return Ethernet payload length of the MSDU + */ + inline TUint RxMsduEthernetPayloadLength( + const TUint32 aMpduLength, + TUint aSubframeLength, + TBool aQosData, + TUint aHtControlLen, + TUint aSecurityHeaderLen, + TUint aSecurityTrailerLen ) const; + + /** + * Allocates a new Rx buffer for a frame to be forwarded to WLAN Mgmt client + * @param aCtxImpl statemachine context + * @param aProprieatarySnapFrame ETrue if the frame contains a proprietary + * SNAP header, EFalse othwerwise + * @param aQosFrame ETrue if the frame is a QoS Data frame + * EFalse othwerwise + * @param aHtControlLen Length of the HT Control field in the frame's MAC + * header. Zero if the field is not present + * @param aEtherPayloadLength Length of the frame's Ethernet payload + * @return Pointer to the beginning of the allocated buffer + * NULL if allocation is unsuccessful + */ + inline TUint8* NewBufForMgmtClientRxFrame( + WlanContextImpl& aCtxImpl, + TBool aProprieatarySnapFrame, + TBool aQosFrame, + TUint aHtControlLen, + TUint aEtherPayloadLength ) const; + + /** + * Determines if the received MSDU is for the protocol stack client + * @param aEtherType Ethernet type of the received MSDU + * @param aSnapstatus Result of the SNAP header check of the received MSDU + * @return ETrue if the MSDU is for the protocol stack client + * EFalse if the MSDU is for the WLAN Mgmt client + */ + inline TBool RxMsduForUser( + TUint16 aEtherType, + TSnapStatus aSnapstatus ) const; + + /** + * Updates 802.11 Data frame Rx statistics + * @param aCtxImpl statemachine context + * @param aEtherType Ethernet type of the received frame + * @param aMulticast ETrue if the frame is a multicast, EFalse otherwise + * @param aAccessCategory Access Category of the received frame + */ + inline void UpdateDataFrameRxStatistics( + WlanContextImpl& aCtxImpl, + TUint16 aEtherType, + TBool aMulticast, + WHA::TQueueId aAccessCategory ) const; + + /** + * Called upon receiving a dot11 data MPDU + * @param aCtxImpl statemachine context + * @param aFlags Flags from WHA frame receive method + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnDataFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + TUint32 aFlags, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + /** + * Called upon receiving a 802.11 Management Action frame. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aFrame Pointer to the beginning of the received frame + * @param aLength Length of the frame. Measured from the first byte of + * the MAC header to the last byte of the frame body + * @param aRcpi Received channel power indicator + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + void OnManagementActionFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) const; + + void EncapsulateFrame( + WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer, + TUint16& aEtherType ); + + /** + * Determines if Tx frames need to be encrypted + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aDataBuffer meta header of the frame to be transmitted + * @return ETrue if Tx frames need to be encrypted + * EFalse otherwise + */ + TBool EncryptTxFrames( + WlanContextImpl& aCtxImpl, + const TDataBuffer& aDataBuffer ) const; + + /** + * Determines the space in bytes to be reserved for the security header + * in the MPDU to be transmitted + * + * @param aCtxImpl statemachine context + * @param aDataBuffer meta header of the frame to be transmitted + * @return See above + */ + TUint ComputeEncryptionOffsetAmount( + const WlanContextImpl& aCtxImpl, + const TDataBuffer& aDataBuffer ) const; + + /** + * Determines the space in bytes to be reserved for the security trailer + * in the MPDU to be transmitted + * + * @param aCtxImpl statemachine context + * @param aDataBuffer meta header of the frame to be transmitted + * @return See above + */ + TUint EncryptTrailerLength( + WlanContextImpl& aCtxImpl, + const TDataBuffer& aDataBuffer ) const; + + TUint ComputeQosOffsetAmount( WlanContextImpl& aCtxImpl ) const; + + TUint DecryptHdrOffset( + WlanContextImpl& aCtxImpl, + TUint32 aFlags ) const; + + TUint DecryptTrailerOffset( + WlanContextImpl& aCtxImpl, + TUint32 aFlags ) const; + + /** + * Checks the validity of SNAP header + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aStartOfSnap is a pointer to the start of the SNAP header + */ + TSnapStatus ValiDateSnapHeader( + WlanContextImpl& aCtxImpl, + const TUint8* aStartOfSnap ) const; + + void EncapsulateEthernetFrame( + WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer, + TUint16& aEtherType ) const; + + /** + * Encapsulates a frame starting with a proprietary SNAP header inside an + * MPDU + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aDataCntx user Tx frame context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aEncrypt ETrue if the frame needs to be encrypted + * EFalse otherwise + * @param aEncryptionOffset Length (bytes) to be reserved for the + * encryption header + * @param aEncryptTrailerLength Length (bytes) to be reserved for the + * encryption trailer + * @param aQosOffset Length (bytes) to be reserved for the + * QoS Control field + * @param aHtControlOffset Length (bytes) to be reserved for the + * HT Control field + */ + void EncapsulateSnapFrame( + WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer, + TBool aEncrypt, + TUint aEncryptionOffset, + TUint aEncryptTrailerLength, + TUint aQosOffset, + TUint aHtControlOffset ) const; + + /** + * Sets a ready made 802.11 frame to Tx buffer + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @param aDataCntx user Tx frame context + * @param aDataBuffer meta header of the frame to be transmitted + */ + void SetDot11FrameToTxBuffer( + const WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer ) const; + + /** + * Indicates Consecutive Beacons Lost + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutiveBeaconsLostIndication( WlanContextImpl& aCtxImpl ); + + /** + * Indicates Consecutive Tx Failures + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutiveTxFailuresIndication( WlanContextImpl& aCtxImpl ); + + virtual void DoRegainedBSSIndication( WlanContextImpl& aCtxImpl ); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + /** + * Adds a multicast MAC address and starts to filter (Rx) multicast + * traffic sent to any other MAC addresses than those that have been + * specified using this method + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be added + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool AddMulticastAddr( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr ); + + /** + * Removes a multicast MAC address from multicast (Rx) filtering + * configuration. So any packet that we receive and which has been sent + * to the multicast address in question is not accepted any more (i.e. + * it is filtered). + * However, if there are no addresses left in the multicast (Rx) filtering + * configuration after this remove, the multicast filtering is disabled + * and all (otherwise acceptable) multicast packets are accepted again. + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be removed + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool RemoveMulticastAddr( + WlanContextImpl& aCtxImpl, + TBool aRemoveAll, + const TMacAddress& aMacAddr ); + + /** + * From MWlanUserEvent + * Add/set (or replace) a broadcast WEP key + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Index of the key in the default key table + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @param aMac MAC address associated with the key + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ); + + /** + * From MWlanUserEvent + * Reconfigures the specified Tx queue if necessary + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQueueId ID of the queue to reconfigure + * @param aMediumTime The amount of time the queue is allowed to access + * the WLAN air interface. + * @param aMaxTxMSDULifetime Maximum Transmit MSDU Lifetime to be used + * for the specified queue. + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxQueueIfNecessary( + WlanContextImpl& aCtxImpl, + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ); + + /** + * Sets the WHA::KMibDot11GroupAddressesTable MIB + * + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + TBool SetGroupAddressesTableMib( + WlanContextImpl& aCtxImpl ); + + /** + * If the power mgmt mode needs to be changed - based on + * aPowerMgmtModeChange - proceeds with the necessary actions + * + * @param aCtxImpl statemachine context + * @param aPowerMgmtModeChange + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + TBool PowerMgmtModeChange( + WlanContextImpl& aCtxImpl, + TPowerMgmtModeChange aPowerMgmtModeChange ); + +private: + + /** + * Configures Tx rate policy objects, sets the policy object to use for + * every Tx Queue / QoS AC, and also sets the Initial Max Tx Rate to be + * used for the configured policy objects + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy rate policy (policy objects) + * @param aQueue2RateClass Tx queue (AC) to rate policy object mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for the + * policy objects + * @param aAutoRatePolicy auto rate policy + * @param aHtMcsPolicy HT MCS policy + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ); + + /** + * Configures dynamic power mode management traffic override + * + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting + * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting + * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC + * setting + * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC + * setting + * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting + * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting + * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC + * setting + * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC + * setting + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& aCtxImpl, + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ); + + // Prohibit copy constructor + WlanDot11Associated( const WlanDot11Associated& ); + // Prohibit assigment operator + WlanDot11Associated& operator= ( const WlanDot11Associated& ); + + }; + +#endif // WLANDOT11ASSOCIATED_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11AssociationPending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11AssociationPending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,243 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11AssociationPending class +* +*/ + +/* +* %version: 23 % +*/ + +#ifndef WLANDOT11ASSOCIATIONPENDING_H +#define WLANDOT11ASSOCIATIONPENDING_H + +#include "UmacDot11Connecting.h" + +/** +* AssociationPending is a state where STA has been successfully authenticated +* itself with an AP and has issued an association request +* and it's waiting a response to it. +*/ +class WlanDot11AssociationPending : public WlanDot11Connecting + { + +public: + + /** + * C++ default constructor. + */ + WlanDot11AssociationPending() : iState( EINIT ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11AssociationPending() {}; + +protected: + + // Types for the FSM + // + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // an association response message has been processed + ERXASSOCRESPONSE, + // associate request frame has been xferred + // to the WLAN device tx queue + ETX_ASSOCFRAME_XFER, + ETXCOMPLETE, + ETIMEOUT, // association timer timeout event + ETX_SCHEDULER_FULL, // packet scheduler is full + EPUSHPACKET, // packet push to packet scheduler possible + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + // start state of the state machine + EINIT, + // dot11-association message is sent + ETXASSOCREQFRAME, + // association response message is waited + EWAIT4ASSOCRESPONSE, + // AC configuration is done + ECONFIGUREAC, + // EPUSHPACKET event waited + EWAIT4PUSHPACKET, + // junction state prior moving to next dot11 state + ECONTINUEDOT11TRAVERSE, + // defined as an upper bound + ESTATEMAX + }; + + // association frame received flag + static const TUint32 KAssocReceived = (1 << 0); + // association was a success flag + static const TUint32 KAssocSuccess = (1 << 1); + // need to issue the ConfigureAc WHA cmd flag + static const TUint32 KConfigureAc = (1 << 2); + + /** + * ?member_description. + * @since S60 3.1 + * @return ETrue if we are associated EFalse in otherwise + */ + inline TBool Associated() const; + + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + void OnStateEntryEvent( + WlanContextImpl& aCtxImpl ); + + void OnTimeoutEvent( WlanContextImpl& aCtxImpl ); + + void OnTxAssocFrameXferEvent( WlanContextImpl& aCtxImpl ); + + void OnRxAssociationResponseEvent( WlanContextImpl& aCtxImpl ); + + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + void OnTxSchedulerFullEvent( WlanContextImpl& aCtxImpl ); + + void OnPushPacketEvent( WlanContextImpl& aCtxImpl ); + + void ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ); + + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + TBool SendAssociationRequest( WlanContextImpl& aCtxImpl ); + + TUint virtual ConstructAssociationRequestFrame( + WlanContextImpl& aCtxImpl, + TUint8*& aStartOfFrame ); + + /** + * Determines if association succeeded + * @param aCtxImpl global statemachine context + * @param aFrame pointer to the beginning of the association response + * frame + * @param aFlags flags from WHA frame receive method + */ + static T802Dot11ManagementStatusCode IsRxAssociationSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint32 aFlags ); + + static void StartAssociationFrameResponseTimer( + WlanContextImpl& aCtxImpl ); + + void ConfigureAc( + WlanContextImpl& aCtxImpl ); + + // from base class ? + + /** + * Returns the states name + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void Entry( WlanContextImpl& aCtxImpl ); + + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + virtual void OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ); + + /** + * Timer timeout function + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnTimeout( WlanContextImpl& aCtxImpl ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + +private: + + // Prohibit copy constructor + WlanDot11AssociationPending( + const WlanDot11AssociationPending& ); + // Prohibit assigment operator + WlanDot11AssociationPending& operator= ( + const WlanDot11AssociationPending& ); + +private: // Data + + TState iState; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** holds the name of the state */ + static const TInt8 iName[]; +#endif + }; + +#include "umacdot11associatepending.inl" + +#endif // WLANDOT11ASSOCIATIONPENDING_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11AuthenticatePending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11AuthenticatePending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,316 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11AuthenticatePending class +* +*/ + +/* +* %version: 22 % +*/ + +#ifndef WLANDOT11AUTHENTICATEPENDING_H +#define WLANDOT11AUTHENTICATEPENDING_H + +#include "UmacDot11Connecting.h" + +/** +* Infrastructure mode authnetication establishment base class. +* This is a state where authentication request has been sent +* to an AP and response to it is waited. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11AuthenticatePending : public WlanDot11Connecting + { +public: + + /** + * Destructor. + */ + virtual ~WlanDot11AuthenticatePending() {}; + +protected: + + // Types for the FSM + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ECONTINUE, // generic continue event + // a valid authentication response message has been processed + // authentication attempt may have accpeted or denied + ERXAUTHRESPONSE, + // authenticate request frame has been xferred + // to the WLAN device tx queue + ETX_AUTHFRAME_XFER, + ETX_SCHEDULER_FULL, // packet scheduler is full + ETIMEOUT, // authentication timer timeout event + EPUSHPACKET, // packet push to packet scheduler possible + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + // dot11-authentication message is sent + ETXAUTHFRAME, + // authentication response message is waited + EWAIT4AUTHRESPONSE, + // EPUSHPACKET event waited + EWAIT4PUSHPACKET, + // junction state prior moving to dot11associationpending + // or dot11softreset dot11 state + ECONTINUEDOT11TRAVERSE, + ESTATEMAX // defined as an upper bound + }; + + // authentication frame received flag + static const TUint32 KAuthReceived = (1 << 0); + // authentication was a success flag + static const TUint32 KAuthSuccess = (1 << 1); + +protected: + + /** + * C++ default constructor. + */ + WlanDot11AuthenticatePending() : iState( EINIT ) {}; + + /** + * Parses authentication response message(s) + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aAuthModeDesired authentication mode expected + * @param aFrame pointer to the beginning of the authentication response + * frame + * @param aFlags flags from WHA frame receive method + * @return ETrue proceed with authentication sequnce, otherwise abort + */ + static TBool ResolveAuthMessage( + WlanContextImpl&, + TUint16 aAuthModeDesired, + const void* aFrame, + TUint32 aFlags ); + + /** + * Sends authentication sequence number 1 message + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @return ETrue upon success, + * EFalse if packet scheduler discarded the frame + */ + TBool SendAuthSeqNbr1Frame( WlanContextImpl& aCtxImpl ) const; + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void StateEntryActions( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + static void StartAuthenticationFrameResponseTimer( + WlanContextImpl& aCtxImpl ); + +private: + + /** + * ?member_description. + * @since S60 3.1 + * @return ETrue if we are authenticated EFalse in otherwise + */ + inline TBool Authenticated() const; + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnStateEntryEvent( WlanContextImpl& aCtxImpl ) = 0; + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnRxAuthResponseEvent( WlanContextImpl& aCtxImpl ) = 0; + + /** + * Called internally to set the used + * authentication number to authenticate message + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnSetAlgorithmNumber( WlanContextImpl& aCtxImpl ) = 0; + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnContinueEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTimeoutEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnPushPacketEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxAuthFrameXferEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxSchedulerFullEvent( WlanContextImpl& aCtxImpl ); + + // Functions from base classes + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description. + * State exit method + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description. + * Timer timeout function + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aFlags flags from WHA frame receive method + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor + WlanDot11AuthenticatePending( const WlanDot11AuthenticatePending& ); + // Prohibit assigment operator + WlanDot11AuthenticatePending& operator= ( + const WlanDot11AuthenticatePending& ); + +protected: // Data + + TState iState; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; +#endif + }; + +#include "umacdot11authenticatepending.inl" + +#endif // WLANDOT11AUTHENTICATEPENDING_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Connecting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Connecting.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11Connecting class +* +*/ + +/* +* %version: 15 % +*/ + +#ifndef WLANDOT11CONNECTING_H +#define WLANDOT11CONNECTING_H + +#include "UmacDot11State.h" + +/** +* Infrastructure mode connection establishment base class. +* A composite state, which holds the common behaviour of its +* substates. In this state STA is locked to a specific radio channel and +* is performing authentication and association procedures. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11Connecting : public WlanDot11State + { +public: + + /** + * Destructor. + */ + virtual ~WlanDot11Connecting() {}; + +protected: + + /** + * C++ default constructor. + */ + WlanDot11Connecting() :iFlags( 0 ) {}; + + /** + * Checks is a class 2 frame + * @param aFrameType first byte from FrameControl field + * @return ETrue is class 2 frame, EFalse is not a class 2 frame + */ + static TBool IsClass2Frame( const TUint8 aFrameType ); + + /** + * Checks is a class 3 frame + * @param aFrameType first byte from FrameControl field + * @return ETrue is class 3 frame, EFalse is not a class 3 frame + */ + static TBool IsClass3Frame( const TUint8 aFrameType ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aFlags flags from WHA frame receive method + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ) = 0; + +private: + + /** + * From ?base_class ?member_description. + * Timer timeout function + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + // Prohibit copy constructor + WlanDot11Connecting( const WlanDot11Connecting& ); + // Prohibit assigment operator + WlanDot11Connecting& operator= ( const WlanDot11Connecting& ); + +protected: // Data + + /** mask for local deferred events */ + TUint32 iFlags; + }; + +#endif // WLANDOT11CONNECTING_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11DeauthPending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11DeauthPending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11DeauthPending class +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WLANDOT11DEAUTHPENDING_H +#define WLANDOT11DEAUTHPENDING_H + +#include "UmacDot11State.h" + +/** +* This is a state where deauthentication frame has been send to an AP +*/ +class WlanDot11DeauthPending : public WlanDot11State + { +public: + + /** + * C++ default constructor. + */ + WlanDot11DeauthPending() : iState( EINIT ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11DeauthPending() {}; + +private: + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // underlying sw layer tx delivery complete event + ETXCOMPLETE, + // packet scheduler is full + ETX_SCHEDULER_FULL, + // packet push to packet scheduler possible + EPUSHPACKET, + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + // start state of the state machine + EINIT, + // state for sending the deauthentication frame + ETXDEAUTHENTICATIONFRAME, + // EPUSHPACKET event waited + EWAIT4PUSHPACKET, + // junction state prior moving to next dot11 state + ECONTINUEDOT11TRAVERSE, + // defined as an upper bound + ESTATEMAX + }; + + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + void OnStateEntryEvent( + WlanContextImpl& aCtxImpl ); + + void OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ); + + void OnTxSchedulerFullEvent( WlanContextImpl& aCtxImpl ); + + void OnPushPacketEvent( WlanContextImpl& aCtxImpl ); + + void ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ); + + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + virtual void Entry( WlanContextImpl& aCtxImpl); + virtual void Exit( WlanContextImpl& aCtxImpl); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + /** + * Returns the states name + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor + WlanDot11DeauthPending( + const WlanDot11DeauthPending& ); + // Prohibit assigment operator + WlanDot11DeauthPending& operator= ( + const WlanDot11DeauthPending& ); + +private: // Data + + TState iState; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** name of the state */ + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11DEAUTHPENDING_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11DisassociationPending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11DisassociationPending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the UmacDot11DisassociationPending class +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef WLANDOT11DISASSOCIATIONPENDING_H +#define WLANDOT11DISASSOCIATIONPENDING_H + +#include "UmacDot11Roam.h" + +/** +* This is a state where disassociation request frame is sent to an AP. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11DisassociationPending : public WlanDot11Roam + { +public: + + /** + * C++ default constructor. + */ + WlanDot11DisassociationPending(); + + /** + * Destructor. + */ + virtual ~WlanDot11DisassociationPending(); + +private: + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // disassociation request frame has been sent + // from the WLAN device + ETXPACKETCOMPLETE, + // packet scheduler is full + ETX_SCHEDULER_FULL, + // packet push to packet scheduler possible + EPUSHPACKET, + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + // start state of the state machine + EINIT, + // state for sending the disassociation frame + ETXDISASSOCIATIONFRAME, + // EPUSHPACKET event waited + EWAIT4PUSHPACKET, + // junction state prior moving to next dot11 state + ECONTINUEDOT11TRAVERSE, + // defined as an upper bound + ESTATEMAX + }; + + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + void OnStateEntryEvent( + WlanContextImpl& aCtxImpl ); + + void OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ); + + void OnTxSchedulerFullEvent( WlanContextImpl& aCtxImpl ); + + void OnPushPacketEvent( WlanContextImpl& aCtxImpl ); + + void ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ); + + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + virtual void Entry( WlanContextImpl& aCtxImpl); + + virtual void Exit( WlanContextImpl& aCtxImpl); + + /** + * Returns the states name + * @since Series 60 3.1 + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor + WlanDot11DisassociationPending( + const WlanDot11DisassociationPending& ); + + // Prohibit assignment operator + WlanDot11DisassociationPending& operator= ( + const WlanDot11DisassociationPending& ); + +private: // Data + + TState iState; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + // name of the state + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11DISASSOCIATIONPENDING_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11IbssMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11IbssMode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11IbssMode class. +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef C_WLANDOT11IBSSMODE_H +#define C_WLANDOT11IBSSMODE_H + +#include "UmacDot11Associated.h" + +/** + * IBSS mode base class + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11IbssMode : public WlanDot11Associated + { + +public: + + virtual ~WlanDot11IbssMode() {}; + +protected: + + WlanDot11IbssMode() {}; + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void DoSetTxMpduDaAddress( + SDataFrameHeader& aDataFrameHeader, + const TMacAddress& aMac ) const; + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual TBool DoIsRxFrameSAourAddress( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* aSubFrameHeader ) const; + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual TBool DoIsValidAddressBitCombination( + const SDataFrameHeader& aFrameHeader ) const; + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void DoBuildEthernetFrame( + TDataBuffer& aBuffer, + const SDataMpduHeader& aDot11DataMpdu, + const TUint8* aStartOfEtherPayload, + TUint aEtherPayloadLength, + TBool aAmsdu, + TUint8* aCopyBuffer ); + +private: + + // Prohibit copy constructor + WlanDot11IbssMode( const WlanDot11IbssMode& ); + // Prohibit assigment operator + WlanDot11IbssMode& operator= ( const WlanDot11IbssMode& ); + + }; + +#endif // C_WLANDOT11IBSSMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Idle.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Idle.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,326 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11Idle class +* +*/ + +/* +* %version: 26 % +*/ + +#ifndef WLANDOT11IDLE_H +#define WLANDOT11IDLE_H + +#include "UmacDot11State.h" + +/** +* Logical start state of the dot11 protocol statemachine +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11Idle : public WlanDot11State + { + // Types for the FSM + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + ESCAN, // scan event + ECONNECT, // connect to BSS event + ECONNECTIBSS, // connect to IBSS event + EDISCONNECT, // disconnect event + ERELEASE, // release event + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + EWRITEMIB, // write mib + EFINIT, // end state + ESTATEMAX // defined as an upper bound + }; + +public: + + /** + * C++ default constructor. + */ + WlanDot11Idle() : + iState( EINIT ), + iCompletionCode( KErrNone ), + iEventMask( 0 ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11Idle() {}; + + void Set( TInt aCompletionCode ); + + /** + * Requests this state to indicate scan completion to management client + * upon state entry. + * + * @since S60 3.2 + */ + void CompleteScanUponEntry(); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * Connect (authenticate and associate) to a WLAN network + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network + * @param aBSSID BSSID of the access point + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption level + * @param aIsInfra ETrue when connecting to infrastructure network + * @param aScanResponseFrameBodyLength length of the scan response frame body + * @param aScanResponseFrameBody scan response frame body + * @param aIeData The IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * @param aIeDataLength Length of the IE(s) to be included into the + * (re-)association request + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ); + + virtual TBool StartIBSS( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aAtim, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus); + + virtual TBool Disconnect( WlanContextImpl& aCtxImpl ); + + /** + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * From MWlanUserEvent + * Make system ready for unloading + * + * @since S60 3.1 + */ + virtual void FinitSystem( WlanContextImpl& aCtxImpl ); + + /** + * From MWlanUserEvent + * Add/set (or replace) a broadcast WEP key also sets it as a PTK + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Index of the key in the default key table + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @param aMac MAC address associated with the key + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ); + + virtual TBool AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]); + + /** + * Returns the states name + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnScanEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnConnectEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnConnectIbssEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnDisconnectEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnReleaseEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void WriteSleepModeMib( WlanContextImpl& aCtxImpl ); + + void GenerateRandomBssIDForIbss( WlanContextImpl& aCtxImpl ) const; + + void CompleteOid( WlanContextImpl& aCtxImpl ); + + /** + * Indicates scan completion to management client if necessary + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void IndicateScanCompletion( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor + WlanDot11Idle( const WlanDot11Idle& ); + // Prohibit assigment operator + WlanDot11Idle& operator= ( const WlanDot11Idle& ); + +private: // Data + + TState iState; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** state name */ + static const TInt8 iName[]; +#endif + + /** completion code for user request */ + TInt iCompletionCode; + + static const TUint KCompleteUponEntry = (1 << 0); + /** indicate scan completion to management client upon state entry */ + static const TUint KIndicateScanCompletionUponEntry = (1 << 1); + + TUint iEventMask; + }; + +#endif // WLANDOT11IDLE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureMode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,349 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11InfrastructureMode class +* +*/ + +/* +* %version: 34 % +*/ + +#ifndef WLANDOT11INFRASTRUCTUREMODE_H +#define WLANDOT11INFRASTRUCTUREMODE_H + +#include "UmacDot11Associated.h" + +class WlanElementLocator; + +/** +* This is a state where STA has succesfully +* authenticated and associated to a infrastructuremode network +*/ +class WlanDot11InfrastructureMode : public WlanDot11Associated + { +public: + + /** + * Connect (authenticate and associate) to a BSS. + * As we are already connected, this means actually roaming. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network + * @param aBSSID BSSID of the access point + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption level + * @param aIsInfra ETrue when connecting to infrastructure network + * @param aScanResponseFrameBodyLength length of the scan response frame body + * @param aScanResponseFrameBody scan response frame body + * @param aIeData The IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * @param aIeDataLength Length of the IE(s) to be included into the + * (re-)association request + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ); + + /** + * Connect (authenticate and associate) to a BSS. + * As we are already connected, this means actually roaming. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network. + * @param aBSSID BSSID of the access point. + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption level. + * @return KErrNone = command completed successfully, + * any other = failure + */ + TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus ); + +protected: + + /** + * C++ default constructor. + */ + WlanDot11InfrastructureMode() {}; + + /** + * Destructor. + */ + virtual ~WlanDot11InfrastructureMode() {}; + + virtual void DoSetTxMpduDaAddress( + SDataFrameHeader& aDataFrameHeader, + const TMacAddress& aMac ) const; + + virtual TBool DoIsRxFrameSAourAddress( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* aSubFrameHeader ) const; + + virtual TBool DoIsValidAddressBitCombination( + const SDataFrameHeader& aFrameHeader ) const; + + virtual void DoBuildEthernetFrame( + TDataBuffer& aBuffer, + const SDataMpduHeader& aDot11DataMpdu, + const TUint8* aStartOfEtherPayload, + TUint aEtherPayloadLength, + TBool aAmsdu, + TUint8* aCopyBuffer ); + + /** + * Indicates Consecutive 802.11 Power Management Mode Set Failures + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutivePwrModeSetFailuresIndication( + WlanContextImpl& aCtxImpl ); + +private: + + /** + * Set trigger level for RCPI trigger. + * @param aCtxImpl statemachine context + * @param aRcpiTrigger RCPI trigger level + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool SetRcpiTriggerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger); + + /** + * Updates the RCPI Trigger Level MIB + * + * @since Series 60 3.1 + * @param aCtxImpl Global statemachine context + * @param aRcpiTrigger the value to assign to the MIB + * @param aCompleteManagementRequest ETrue if this request came from the + * WLAN Mgmt client and that request + * needs to be completed. + * EFalse otherwise. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool SetRcpiTriggerLevelMib( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger, + TBool aCompleteManagementRequest ); + + /** + * Validates our current ERP parameters + * + * @param aCtxImpl statemachine context + * @param aElementLocator + */ + void ValidateErpParams( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ); + + /** + * Validates our current QoS AC parameters + * + * @param aCtxImpl statemachine context + * @param aElementLocator + */ + void ValidateAcParams( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ); + + /** + * Validates our current HT operation parameters + * + * @param aCtxImpl statemachine context + * @param aElementLocator + */ + void ValidateHtBssOperationParams( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ); + + /** + * Called upon receiving a deauthentication frame + * @param aCtxImpl statemachine context + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnDeauthenticateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ); + + /** + * Called upon receiving a disassociation frame + * @param aCtxImpl statemachine context + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnDisassociateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ); + + /** + * Called upon receiving a beacon type frame + * + * @param aCtxImpl statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + /** + * Disconnect STA from current network. + * @param aCtxImpl statemachine context + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool Disconnect( WlanContextImpl& aCtxImpl ); + + /** + * Write for management data + * The frame to be sent needs to be in 802.3 format + * Data is copied to NIC's Tx queue. That normally succeeds, but in + * the event the Tx queue is full copying is deferred to a + * more appropriate time -> TxCompleted function + * @param aCtxImpl statemachine context + * @param aDataBuffer meta header of the frame to be transmitted + */ + virtual void TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ); + + /** + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + virtual void DoRcpiIndication( + WlanContextImpl& aCtxImpl, + WHA::TRcpi aRcpi ); + + /** + * Indicates that the WLAN device has detected problems in the power + * save mode operation of the AP + * + * @param aCtxImpl global statemachine context + */ + virtual void DoPsModeErrorIndication( WlanContextImpl& aCtxImpl ); + + /** + * Voice Call Entry timer timeout function + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnVoiceCallEntryTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Null timer timeout function + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnNullTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * No Voice timer timeout function + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnNoVoiceTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * To be called upon Keep Alive Timer timeout + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnKeepAliveTimerTimeout( WlanContextImpl& aCtxImpl ); + + virtual TBool OnWlanWakeUpIntervalChange( WlanContextImpl& aCtxImpl ); + + /** + * Request to send a Null Data Frame + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQosNull ETrue if a QoS Null Data frame should be transmitted + * EFalse if a regular Null Data frame should be transmitted + * @return ETrue if the send request was successfully submitted + * EFalse otherwise + */ + virtual TBool TxNullDataFrame( + WlanContextImpl& aCtxImpl, + TBool aQosNull ); + + + // Prohibit copy constructor. + WlanDot11InfrastructureMode( + const WlanDot11InfrastructureMode& ); + // Prohibit assigment operator. + WlanDot11InfrastructureMode& operator= ( + const WlanDot11InfrastructureMode& ); + }; + +#endif // WLANDOT11INFRASTRUCTUREMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureModeInit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InfrastructureModeInit.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,326 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11InfrastructureModeInit class +* +*/ + +/* +* %version: 22 % +*/ + +#ifndef WLANDOT11INFRASTRUCTUREMODEINIT_H +#define WLANDOT11INFRASTRUCTUREMODEINIT_H + +#include "UmacDot11InfrastructureMode.h" + +/** +* Initialization state for infrastructure mode +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11InfrastructureModeInit : public WlanDot11InfrastructureMode + { + +public: + + /** + * C++ default constructor. + */ + WlanDot11InfrastructureModeInit() : + iFlags( 0 ), + iState( EINIT ), + iDtim( 0 ), + iMibMemoryBuffer ( NULL ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11InfrastructureModeInit(); + +private: + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + // underlying sw layer tx delivery complete event + ETXCOMPLETE, + EBEACONPROCESSED, // beacon parsed for elements + EUSERDATAENABLE, // protocol stack side datapath enabled + EABORT, // abort fsm event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + EENABLEBEACONRX, // enable beacon reception + ESETNULLDATAFRAMETEMPLATE, // set NULL data frame template + ESETQOSNULLDATAFRAMETEMPLATE, // set QoS NULL data frame template + ESETPSPOLLTEMPLATE, // set ps poll frame template + EWAIT4BEACON, // wait 4 beacon state + EDISABLEBEACONRX, // disable beacon reception + ESETBSSPARAMS, // set BSS parameters + ECONFBEACONFILTERIETABLE, // configure beacon filter IE table + EWAIT4USERDATAENABLE, // wait 4 EUSERDATAENABLE event + // junction state prior moving to dot11awakemode + // or dot11enterdozemode dot11 state + ECONTINUEDOT11TRAVERSE, + ESTATEMAX // defined as an upper bound + }; + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void EnableBeaconRx( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void DisableBeaconRx( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void SetNullDataFrameTemplate( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void SetQosNullDataFrameTemplate( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void SetPsPollFrameTemplate( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void SetBssParams( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void ConfigureBeaconFilterIeTable( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + inline void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void OnBeaconProcessedEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void OnUserDataEnableEvent( WlanContextImpl& aCtxImpl ); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void CompleteConnectRequest( + WlanContextImpl& aCtxImpl, + TInt aCompletionCode ) const; + + /** + * From + * @since S60 3.1 + * @param ?arg1 ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * From + * @since S60 3.1 + * @param aCtxImpl Global state machine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From + * @since S60 3.1 + * @param aCtxImpl Global state machine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From + * @since S60 3.1 + * @param aCtxImpl Global state machine context + */ + virtual TBool EnableUserData( WlanContextImpl& aCtxImpl ); + + /** + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * Called upon receiving a beacon type frame + * + * @param aCtxImpl statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + // Prohibit copy constructor + WlanDot11InfrastructureModeInit( + const WlanDot11InfrastructureModeInit& ); + // Prohibit assigment operator + WlanDot11InfrastructureModeInit& operator= ( + const WlanDot11InfrastructureModeInit& ); + +private: // Data + + /** event flags */ + TUint32 iFlags; + /** current state */ + TState iState; + /** DTIM */ + TUint iDtim; + + // pointer to memory buffer used for mib writing + TAny* iMibMemoryBuffer; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** name of the state */ + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11INFRASTRUCTUREMODEINIT_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InitPhase1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11InitPhase1.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,296 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11InitPhase1 class +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WLANDOT11INITPHASE1_H +#define WLANDOT11INITPHASE1_H + +// INCLUDES +#include "UmacDot11State.h" + +/** +* This is the start (first level initialization) state of the statemachine +*/ +class WlanDot11InitPhase1 : public WlanDot11State + { + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // tx process complete event + EOIDCONFIGURE, // recv: OID-configure + EABORT, // abort event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the fsm + EINITILIAZE, // execute WHA-Initialize + ECOMPLETEBOOTUP, // complete bootup oid + EWAIT4OIDCONFIGURE, // wait 4 OID-configure + EHANDLEOIDCONFIGURE, // handle OID-configure + ECONFIGURE, // execute WHA-Configure + EREADSTATIONID, // read station ID mib + ECONFTXQUEUE, // configure tx-queue + ECONTINUEDOT11TRAVERSE, // entry: traverse dot11 state + ESTATEMAX // defined as an upper bound + }; + +public: + + /** + * C++ default constructor. + */ + WlanDot11InitPhase1() + : iState( EINIT ), + iRTSThreshold( 0 ), + iMaxTxMSDULifetime( 0 ), iPda( NULL ), iPdaLen( 0 ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11InitPhase1(); + + void BootUp( + WlanContextImpl& aCtxImpl, + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ); + +protected: + + /** + * Returns the states name + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + +private: + + /** + * State entry action + * @param aCtxImpl statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + inline void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since S60 3.1 + * @param ?arg1 ?description + * @return ?description + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnOIDConfigureEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void Initialize( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void Configure( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ReadStationID( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void CompleteOid( WlanContextImpl& aCtxImpl ) const; + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void HandleOIDConfigure( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureQueue( + WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureUmacFrameTemplates( WlanContextImpl& aCtxImpl ) const; + + /** + * Configures our own HT capabilities element + * + * @param aCtxImpl global statemachine context + */ + void ConfigureOurHtCapabilitiesElement( WlanContextImpl& aCtxImpl ) const; + // Methods from base classes + + /** + * Set inital WLAN specific parameters. + * @param aCtxImpl statemachine context + * @param aRTSThreshold + * Limit for packet size when to use RTS/CTS protocol. + * @param aMaxTxMSDULifetime + * Limit for packet size when to use RTS/CTS protocol. + * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call + * state and we transmit at least aVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this parameter, we enter Voice over WLAN Call state + * @param aVoiceCallEntryTxThreshold Threshold value for the number of + * Voice priority Tx frames to enter Voice over WLAN Call state + * @param aVoiceNullTimeout NULL frame sending interval during a Voice over + * WLAN call in U-APSD power save mode + * @param aNoVoiceTimeout after this long time of no Voice priority data + * Tx, exit Voice over WLAN call state + * @param aKeepAliveTimeout Keep Alive frame sending interval in + * infrastructure mode + * @param aSpRcpiIndicationLevel If this RCPI level is predicted to be + * reached within the time specified by aSpTimeToCountPrediction, + * a signal loss prediction indication is sent. + * @param aSpTimeToCountPrediction Specifies the time (in microseconds) + * how far into the future signal prediction is done. + * @param aSpMinIndicationInterval The minimum time difference (in + * microseconds) between two signal loss prediction indications. + * @return 0 = success, any other failure + */ + virtual TBool Configure( + WlanContextImpl& aCtxImpl, + TUint32 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aVoiceNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout, + TUint32 aSpRcpiIndicationLevel, + TUint32 aSpTimeToCountPrediction, + TUint32 aSpMinIndicationInterval); + + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + /** + * From MWlanUserEvent + * Make system ready for unloading + * + * @since S60 3.1 + */ + virtual void FinitSystem( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor. + WlanDot11InitPhase1( const WlanDot11InitPhase1& ); + // Prohibit assigment operator. + WlanDot11InitPhase1& operator= ( const WlanDot11InitPhase1& ); + +private: // Data + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** name of the state */ + static const TInt8 iName[]; +#endif + + /** current state */ + TState iState; + + TUint32 iRTSThreshold; + TUint32 iMaxTxMSDULifetime; + + TUint8* iPda; + TUint32 iPdaLen; + }; + +#endif // WLANDOT11INITPHASE1_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11MacError.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11MacError.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,690 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11MacError class. +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WLANDOT11MACERROR_H +#define WLANDOT11MACERROR_H + +#include "UmacDot11State.h" + +/** + * dot11 state object for unrecoverable error + * + * This state becomes the current state either + * by external or internal reason. + * External reason is the WHA-Error indication and internal reason + * for example a memory allocation failure. + * In any cause system must be reset in order to recover. + * This is the termination point for the dot11 state fsm + * and the whole framework must be deallocated from the memory and + * reinitialised as there is no future anymore in this domain... + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11MacError : public WlanDot11State + { + /** is entry method already executed or not */ + enum { KEntryExecuted = (1 << 0) }; + /** oid to be completed or not */ + enum { KCompleteOid = (1 << 1) }; + +public: + + /** + * C++ default constructor. + */ + WlanDot11MacError() : iFlags ( 0 ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11MacError() {}; + +private: + + // Functions from base classes + + /** + * From WlanMacState + * State entry method + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState + * State exit method + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From MWlanUserEvent + * Make system ready for unloading + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void FinitSystem( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ); + + /** + * From MWlanUserEvent + * Set inital WLAN specific parameters + * @param aCtxImpl statemachine context + * @param aRTSThreshold + * @param aMaxTxMSDULifetime + * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call + * state and we transmit at least aVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this parameter, we enter Voice over WLAN Call state + * @param aVoiceCallEntryTxThreshold Threshold value for the number of + * Voice priority Tx frames to enter Voice over WLAN Call state + * @param aVoiceNullTimeout NULL frame sending interval during a Voice over + * WLAN call in U-APSD power save mode + * @param aNoVoiceTimeout after this long time of no Voice priority data + * Tx, exit Voice over WLAN call state + * @param aKeepAliveTimeout Keep Alive frame sending interval in + * infrastructure mode + * @param aSpRcpiIndicationLevel If this RCPI level is predicted to be + * reached within the time specified by aSpTimeToCountPrediction, + * a signal loss prediction indication is sent. + * @param aSpTimeToCountPrediction Specifies the time (in microseconds) + * how far into the future signal prediction is done. + * @param aSpMinIndicationInterval The minimum time difference (in + * microseconds) between two signal loss prediction indications. + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Configure( + WlanContextImpl& aCtxImpl, + TUint32 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aVoiceNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout, + TUint32 aSpRcpiIndicationLevel, + TUint32 aSpTimeToCountPrediction, + TUint32 aSpMinIndicationInterval ); + + /** + * From MWlanUserEvent + * Connect (authenticate and associate) to a WLAN network + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network + * @param aBSSID BSSID of the access point + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption level + * @param aIsInfra ETrue when connecting to infrastructure network + * @param aScanResponseFrameBodyLength length of the scan response frame body + * @param aScanResponseFrameBody scan response frame body + * @param aIeData The IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * @param aIeDataLength Length of the IE(s) to be included into the + * (re-)association request + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ); + + /** + * From MWlanUserEvent + * Start an own IBSS network if there doesn't already exist a network + * with that name. If does then it is joined + * @param aCtxImpl statemachine context + * @param aSSID name of the network + * @param aBeaconInterval Beacon period in TUs (kusec). range:[1, 1024] + * @param aAtim ATIM window + * @param aChannel Used channel (1-14). + * Has to be legal at the current region. + * @param aEncryptionStatus, used encryption level + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool StartIBSS( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aAtim, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus ); + + /** + * From MWlanUserEvent + * Scan all available networks. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate rate that is used in active scanning see #TRate + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Scan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * From MWlanUserEvent + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ); + + /** + * From MWlanUserEvent + * Disconnect STA from current network. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Disconnect( WlanContextImpl& aCtxImpl ); + + /** + * From MWlanUserEvent + * Set 802.11 power mgmt mode in infrastructure networks. + * @param aCtxImpl statemachine context + * @param aPowerMode desired power mode + * @param aDisableDynamicPowerModeManagement If ETrue, disables the dynamic + * power mode management handling. Relevant only when aPowerMode + * is EPowerModePs + * @param aWakeupModeInLightPs WLAN wake-up mode in Light PS mode + * @param aListenIntervalInLightPs specifies the value of N for wake-up + * modes 2 and 3 in Light PS mode. + * @param aWakeupModeInDeepPs WLAN wake-up mode in Deep PS mode + * @param aListenIntervalInDeepPs specifies the value of N for wake-up + * modes 2 and 3 in Deep PS mode + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ); + + /** + * From MWlanUserEvent + * Set trigger level for RCPI trigger. + * @param aCtxImpl statemachine context + * @param aRcpiTrigger RCPI trigger level + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool SetRcpiTriggerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger); + + /** + * From MWlanUserEvent + * Gets last RCPI value + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool GetLastRcpi( + WlanContextImpl& aCtxImpl ); + + /** + * From MWlanUserEvent + * Add (or replace) a TKIP key + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aData data blob that holds TKIP parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id filed of WEP IV + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddTkIPKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * From MWlanUserEvent + * Add (or replace) a multicast TKIP key. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the TKIP parameters. + * @param aData TKIP parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastTKIPKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * From MWlanUserEvent + * Add (or replace) a pairwise AES key. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddAesKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + const TMacAddress& aMacAddr ); + + /** + * From MWlanUserEvent + * Add (or replace) an AES group key. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastAesKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * From MWlanUserEvent + * Add/set (or replace) a broadcast WEP key + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Index of the key in the default key table + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @param aMac MAC address associated with the key + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ); + + /** + * From MWlanUserEvent + * Add (or replace) a unicast WEP key. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMacAddr MAC address to which the WEP key corresponds to + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]); + + /** + * From MWlanUserEvent + * Add (or replace) a multicast WAPI key. + * + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the WAPI parameters. + * @param aData WAPI parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastWapiKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * From MWlanUserEvent + * Add (or replace) a pairwise WAPI key. + * + * @param aCtxImpl statemachine context + * @param aData data blob that holds WAPI parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id field of WEP IV + * @param aMacAddr MAC address of the peer station + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddUnicastWapiKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * From MWlanUserEvent + * Set transmission power level. + * This has to be legal at the current region. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aLevel Transmission power level in mW. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool SetTxPowerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aLevel); + + /** + * From MWlanUserEvent + * Adds a multicast MAC address and starts to filter (Rx) multicast + * traffic sent to any other MAC addresses than those that have been + * specified using this method + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be added + * @return + */ + virtual TBool AddMulticastAddr( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr ); + + /** + * From MWlanUserEvent + * Removes a multicast MAC address from multicast (Rx) filtering + * configuration. So any packet that we receive and which has been sent + * to the multicast address in question is not accepted any more (i.e. + * it is filtered). + * However, if there are no addresses left in the multicast (Rx) filtering + * configuration after this remove, the multicast filtering is disabled + * and all (otherwise acceptable) multicast packets are accepted again. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be removed + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool RemoveMulticastAddr( + WlanContextImpl& aCtxImpl, + TBool aRemoveAll, + const TMacAddress& aMacAddr ); + + /** + * From MWlanUserEvent + * Configures the parameters which define when BSS lost is indicated. + * The indication is sent when either one of the specified thresholds + * is exceeded. + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aBeaconLostCount beacon lost count threshold + * @aFailedTxPacketCount failed Tx packet count threshold + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureBssLost( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount, + TUint8 aFailedTxPacketCount ); + + /** + * From MWlanUserEvent + * Sets the Tx rate adaptation algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMinStepUpCheckpoint minimum and initial rate increase + * checkpoint in units of frames + * Range: [aStepDownCheckpoint,aMaxStepUpCheckpoint] + * @param aMaxStepUpCheckpoint maximum rate increase checkpoint in units + * of frames + * Range: [aStepDownCheckpoint,UCHAR_MAX] + * @param aStepUpCheckpointFactor StepUpCheckpoint is multiplied with this + * value if sending a probe frame fails + * Range: [1,aMaxStepUpCheckpoint] + * @param aStepDownCheckpoint after this many frames the need to decrease + * the rate is checked + * Range: [2,UCHAR_MAX] + * @param aMinStepUpThreshold minimum and initial StepUpThreshold + * percentage + * Range: [1,aMaxStepUpThreshold] + * @param aMaxStepUpThreshold maximum StepUpThreshold percentage + * Range: [1,100] + * @param aStepUpThresholdIncrement StepUpThreshold is incremented by this + * value if sending a probe frame fails + * Range: [0,aMaxStepUpThreshold] + * @param aStepDownThreshold if the percentage of frames which failed to + * be transmitted at the originally requested rate is at least + * aStepDownThreshold at the aStepDownCheckpoint, the rate will + * be decreased + * Range: [1,100] + * @param aDisableProbeHandling if EFalse, the rate adaptation algorithm + * handles the first frame transmitted after a rate increase in a + * special way. Otherwise the special handling is disabled + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetTxRateAdaptParams( + WlanContextImpl& aCtxImpl, + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ); + + /** + * From MWlanUserEvent + * Configures Tx rate policy objects, sets the policy object to use for + * every Tx Queue / QoS AC, and also sets the Initial Max Tx Rate to be + * used for the configured policy objects + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy rate policy (policy objects) + * @param aQueue2RateClass Tx queue (AC) to rate policy object mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for the + * policy objects + * @param aAutoRatePolicy auto rate policy + * @param aHtMcsPolicy HT MCS policy + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ); + + /** + * From MWlanUserEvent + * Gets data frame Rx & Tx statistics + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetFrameStatistics( WlanContextImpl& aCtxImpl ); + + /** + * From MWlanUserEvent + * Reconfigures the specified Tx queue if necessary + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQueueId ID of the queue to reconfigure + * @param aMediumTime The amount of time the queue is allowed to access + * the WLAN air interface. + * @param aMaxTxMSDULifetime Maximum Transmit MSDU Lifetime to be used + * for the specified queue. + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxQueueIfNecessary( + WlanContextImpl& aCtxImpl, + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ); + + /** + * From MWlanUserEvent + * Get our own MAC address + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetMacAddress( WlanContextImpl& aCtxImpl ); + + /** + * Configures ARP IP address filtering + * + * @param aCtxImpl statemachine context + * @param aEnableFiltering If ETrue, filtering is enabled + * If EFalse, filtering is disabled + * @param aIpv4Address If the target IP Address in a received ARP request + * doesn't match this address, the packet shall be discarded + * on the lower layers. + * Relevant only when enabling filtering. + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureArpIpAddressFiltering( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ); + + /** + * Configures HT Block Ack use + * + * @param aCtxImpl statemachine context + * @param aTxBlockAckUsage Bit map defining Block Ack use in Tx direction + * @param aRxBlockAckUsage Bit map defining Block Ack use in Rx direction + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureHtBlockAck( + WlanContextImpl& aCtxImpl, + TUint8 aTxBlockAckUsage, + TUint8 aRxBlockAckUsage ); + + /** + * From MWlanUserEvent + * Returns the states name + * + * @since S60 3.1 + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + +private: + + /** + * Completes WLAN Mgmt Client command + * + * @param aCtxImpl Global statemachine context + * @param aStatus Status code to return to WLAN Mgmt Client + * @return ETrue if a state change occurred in the global state machine + * EFalse otherwise + */ + TBool CompleteMgmtCommand( + WlanContextImpl& aCtxImpl, + TInt aStatus ); + + // Prohibit copy constructor + WlanDot11MacError( const WlanDot11MacError& ); + // Prohibit assigment operator + WlanDot11MacError& operator= ( const WlanDot11MacError& ); + +private: // Data + + /** flags */ + TUint32 iFlags; + +#ifndef NDEBUG + /** name of the state */ + static const TInt8 iName[]; +#endif // !NDEBUG + }; + +#endif // WLANDOT11MACERROR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11MibDefaultConfigure.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11MibDefaultConfigure.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11MibDefaultConfigure class. +* +*/ + +/* +* %version: 13 % +*/ + +#ifndef WLANDOT11MIBDEFAULTCONFIGURE_H +#define WLANDOT11MIBDEFAULTCONFIGURE_H + +#include "UmacDot11State.h" + +/** +* State for setting the MIB elements to their default values +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11MibDefaultConfigure : public WlanDot11State + { + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + // underlying sw layer tx delivery complete event + ETXCOMPLETE, + // abort FSM execution + EABORT, + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + ESETDOT11MAXRECEIVELIFETIME, + ESETDOT11SLOTTIME, + ESETDOT11GROUPADDRSTABLE, + ESETDOT11WEPDEFAULTKEY, + ESETDOT11CURRENTTXPOWERLEVEL, + ESETDOT11RTSTHRESHOLD, + ESETCTSTOSELF, + ESETARPIPADDRSTABLE, + ESETPROBEREQUESTTEMPLATE, + ESETRXFILTER, + ESETBEACONFILTERIETABLE, + ESETBEACONFILTERENABLE, + + // omit setting sleepmode MIB as it is + // set allways in dot11idle state entry + // after we traverse through this state + + ESETWLANWAKEUPINTERVAL, + ESETBEACONLOSTCOUNT, + ESETRCPITHRESHOLD, + ESETTXRATEPOLICY, + ESETHTCAPABILITIES, + ESETHTBSSOPERATION, + ESETHTSECONDARYBEACON, + ESETHTBLOCKACKCONFIGURE, + ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal + ESTATEMAX // defined as an upper bound + }; + +public: + + /** + * C++ default constructor. + */ + WlanDot11MibDefaultConfigure() : iState( EINIT ), iMemory( NULL ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11MibDefaultConfigure(); + +private: + + // Prohibit copy constructor + WlanDot11MibDefaultConfigure( const WlanDot11MibDefaultConfigure& ); + // Prohibit assigment operator + WlanDot11MibDefaultConfigure& operator=( + const WlanDot11MibDefaultConfigure& ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + void SetDot11MaxReceiveLifeTime( WlanContextImpl& aCtxImpl ); + void SetDot11SlotTime( WlanContextImpl& aCtxImpl ); + void SetDot11GroupAddrsTable( WlanContextImpl& aCtxImpl ); + void SetDot11WepDefaultKey( WlanContextImpl& aCtxImpl ); + void SetDot11CurrentTxPowerLevel( WlanContextImpl& aCtxImpl ); + void SetDot11RtsThreshold( WlanContextImpl& aCtxImpl ); + void SetCtsToSelf( WlanContextImpl& aCtxImpl ); + void SetArpIpAddrsTable( WlanContextImpl& aCtxImpl ); + void SetProbeRequestTemplate( WlanContextImpl& aCtxImpl ); + void SetRxFilter( WlanContextImpl& aCtxImpl ); + void SetBeaconFilterIeTable( WlanContextImpl& aCtxImpl ); + void SetBeaconFilterEnable( WlanContextImpl& aCtxImpl ); + void SetWlanWakeupInterval( WlanContextImpl& aCtxImpl ); + void SetBeaconLostCount( WlanContextImpl& aCtxImpl ); + void SetRcpiThreshold( WlanContextImpl& aCtxImpl ); + void SetTxRatePolicy( WlanContextImpl& aCtxImpl ); + void SetHtCapabilities( WlanContextImpl& aCtxImpl ); + void SetHtBssOperation( WlanContextImpl& aCtxImpl ); + void SetHtSecondaryBeacon( WlanContextImpl& aCtxImpl ); + void SetHtBlockAckConfigure( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + // Functions from base classes + + /** + * From ?base_class ?member_description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description + * Returns the states name + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + +private: // Data + + // state of the object + TState iState; + + // general purpose memory handle for the object + TAny* iMemory; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + // name of the state + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11MIBDEFAULTCONFIGURE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11OpenAuthPending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11OpenAuthPending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11OpenAuthPending class +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef WLANDOT11OPENAUTHPENDING_H +#define WLANDOT11OPENAUTHPENDING_H + +#include "UmacDot11AuthenticatePending.h" + +/** +* A class that implements dot11 open mode authentication frame exchange. +* This is a state where authentication request has been send +* to an AP and response to it is waited. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11OpenAuthPending : public WlanDot11AuthenticatePending + { +public: + + /** + * C++ default constructor. + */ + WlanDot11OpenAuthPending() {}; + + /** + * Destructor. + */ + virtual ~WlanDot11OpenAuthPending() {}; + +protected: + + // Functions from base classes + + /** + * From ?base_class ?member_description. + * Sets the used authentication number to authenticate message + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnSetAlgorithmNumber( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description. + * Returns the states name + * @since S60 3.1 + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aFlags flags from WHA frame receive method + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ); + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnRxAuthResponseEvent( WlanContextImpl& aCtxImpl ); + +private: + + // Prohibit copy constructor + WlanDot11OpenAuthPending( + const WlanDot11OpenAuthPending& ); + // Prohibit assigment operator + WlanDot11OpenAuthPending& operator= ( + const WlanDot11OpenAuthPending& ); + +protected: // Data + +#ifndef NDEBUG + /** name of the state */ + static const TInt8 iName[]; +#endif // !NDEBUG + }; + +#endif // WLANDOT11OPENAUTHPENDING_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11PrepareForBssMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11PrepareForBssMode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11PrepareForBssMode class +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WLANDOT11PREPAREFORBSSMODE_H +#define WLANDOT11PREPAREFORBSSMODE_H + +#include "UmacDot11State.h" + +/** +* State to join to a BSS network +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11PrepareForBssMode : public WlanDot11State + { + +public: + + /** + * C++ default constructor. + */ + WlanDot11PrepareForBssMode() : iState( EINIT ), iJoinFailed ( EFalse ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11PrepareForBssMode() {}; + + +private: // definitions + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // underlying sw layer tx delivery complete event + ETXCOMPLETE, + // abort FSM execution + EABORT, + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + ESETSLEEPMODE, // configure sleep mode mib + ESETDOT11SLOTTIME, // configure slottime mib if + // supported by the WLAN vendor solution + ESETCTSTOSELF, // configure ctstoself mib + ECONFTXQUEUE, // configure just the legacy tx queue + ECONFTXQUEUEPARAMS, // configure tx queue parameters + ESETTXRATEPOLICY, // set Tx rate policy + ESETHTCAPABILITIES, // configure HT capabilities mib + ESETHTBSSOPERATION, // configure HT BSS operation mib + ERESETHTCAPABILITIES, // reset HT capabilities mib + EISSUEJOIN, // issue join command + ESETHTBLOCKACKCONF, // configure HT Block Ack configure mib + ERESETHTBLOCKACKCONF, // reset HT Block Ack configure mib + ECONTINUEDOT11TRAVERSE, // continue dot11 fsm traversal + ESTATEMAX // defined as an upper bound + }; + +private: + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetSleepMode( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetDot11SlotTime( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetCtsToSelf( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureQueue( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureTxQueueParams( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetTxRatePolicy( WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the HT capabilities + * of the target network + * @param aCtxImpl global statemachine context + */ + void SetHtCapabilities( WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the dynamic HT configuration + * of the target network + * @param aCtxImpl statemachine context + */ + void SetHtBssOperation( WlanContextImpl& aCtxImpl ); + + /** + * Resets the HT Capabilities MIB to its default value + * @param aCtxImpl statemachine context + */ + void ResetHtCapabilities( WlanContextImpl& aCtxImpl ); + + /** + * Resets the HT Block Ack Configure MIB to its default value + * @param aCtxImpl statemachine context + */ + void ResetHtBlockAckConfiguration( WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the HT Block Ack configuration + * of the target network + * @param aCtxImpl statemachine context + */ + void SetHtBlockAckConfiguration( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void IssueJoin( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + // Functions from base classes + + /** + * From ?base_class ?member_description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description + */ + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + /** + * From ?base_class ?member_description + * Returns the states name + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // Prohibit copy constructor + WlanDot11PrepareForBssMode( const WlanDot11PrepareForBssMode& ); + // Prohibit assigment operator + WlanDot11PrepareForBssMode& operator=( + const WlanDot11PrepareForBssMode& ); + +private: // Data + + // state of the object + TState iState; + + // true, if the Join operation failed + TBool iJoinFailed; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + // name of the state + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11PREPAREFORBSSMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11PrepareForIbssMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11PrepareForIbssMode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,248 @@ +/* +* Copyright (c) 2005-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11PrepareForIbssMode class. +* +*/ + +/* +* %version: 12 % +*/ + +#ifndef WLANDOT11PREPAREFORIBSSMODE_H +#define WLANDOT11PREPAREFORIBSSMODE_H + +#include "UmacDot11State.h" + + +/** +* State to join to an IBSS network +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11PrepareForIbssMode : public WlanDot11State + { + +public: + + /** + * C++ default constructor. + */ + WlanDot11PrepareForIbssMode() : + iState( EINIT ), iStartIbss( EFalse ), iMemory( NULL ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11PrepareForIbssMode(); + + /** + * Sets input parameters for this state + * + * @since S60 3.2 + * @param aStartIbss are we starting a new IBSS + */ + void Set( TBool aStartIbss ); + +private: // definitions + + // Types for the FSM + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + ESETSLEEPMODE, // configure sleep mode mib + ESETDOT11SLOTTIME, // configure slottime mib if + // supported by the WLAN vendor solution + ESETCTSTOSELF, // configure ctstoself mib + ESETBEACON, // configure beacon template + ESETPROBERESP, // configure probe response template + ESETTXRATEPOLICY, // set Tx rate policy + ESETBEACONLOSTCOUNT, // set beacon lost count mib + EJOIN, // issue join + ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal + ESTATEMAX // defined as an upper bound + }; + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); + virtual void Exit( WlanContextImpl& aCtxImpl); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetSleepMode( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetDot11SlotTime( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetCtsToSelf( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureBeaconTemplate( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureProbeResponseTemplate( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetTxRatePolicy( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetBeaconLostCount( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void Join( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureTemplate( WlanContextImpl& aCtxImpl, TUint32& aLength ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + WHA::TRate BeaconTxRate( WlanContextImpl& aCtxImpl ) const; + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + WHA::TRate ProbeResponseTxRate( WlanContextImpl& aCtxImpl ) const; + + // Prohibit copy constructor. + WlanDot11PrepareForIbssMode( const WlanDot11PrepareForIbssMode& ); + // Prohibit assigment operator. + WlanDot11PrepareForIbssMode& operator= + ( const WlanDot11PrepareForIbssMode& ); + +private: // Data + + TState iState; + + /** ETrue, if we are starting a new IBSS */ + TBool iStartIbss; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** state name */ + static const TInt8 iName[]; +#endif + TUint8* iMemory; + }; + +#endif // WLANDOT11PREPAREFORIBSSMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11ReassociationPending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11ReassociationPending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the UmacDot11ReassociationPending class +* +*/ + +/* +* %version: 22 % +*/ + +#ifndef WLANDOT11REASSOCIATIONPENDING_H +#define WLANDOT11REASSOCIATIONPENDING_H + +#include "UmacDot11Connecting.h" + +/** +* This is a state where STA has been successfully +* authenticated with an AP, STA issues a reassociation request +* and then waits for a response to it. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11ReassociationPending : public WlanDot11Connecting + { +public: + + /** + * C++ default constructor. + */ + WlanDot11ReassociationPending(); + + /** + * Destructor. + */ + virtual ~WlanDot11ReassociationPending(); + +protected: + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // reassociation request frame has been xferred + // to the WLAN device tx queue + ETXREASSOCFRAMEXFER, + // reassociation response message has been processed + ERXREASSOCRESPONSE, + ETXCOMPLETE, + // reassociation timeout event + ETIMEOUT, + ETX_SCHEDULER_FULL, // packet scheduler is full + EPUSHPACKET, // packet push to packet scheduler possible + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + // start state of the state machine + EINIT, + // dot11-reassociation message is sent + ETXREASSOCIATIONFRAME, + // reassociation response message is waited + EWAIT4REASSOCIATIONRESPONSE, + // AC configuration is done + ECONFIGUREAC, + // EPUSHPACKET event waited + EWAIT4PUSHPACKET, + // junction state prior moving to next dot11 state + ECONTINUEDOT11TRAVERSE, + // defined as an upper bound + ESTATEMAX + }; + + // reassociation frame received flag + static const TUint32 KReassocReceived = (1 << 0); + // reassociation was a success, flag + static const TUint32 KReassocSuccess = (1 << 1); + // need to issue the ConfigureAc WHA cmd, flag + static const TUint32 KConfigureAc = (1 << 2); + + /** + * ?member_description. + * @since S60 3.1 + * @return ETrue if we are associated EFalse in otherwise + */ + inline TBool Associated() const; + + void Fsm( WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + inline void OnTxReassocFrameXferEvent( WlanContextImpl& aCtxImpl ); + + void OnRxReassocResponseEvent( WlanContextImpl& aCtxImpl ); + + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + void OnTimeoutEvent( WlanContextImpl& aCtxImpl ); + + void OnTxSchedulerFullEvent( WlanContextImpl& aCtxImpl ); + + void OnPushPacketEvent( WlanContextImpl& aCtxImpl ); + + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + TBool SendReassociationRequest( WlanContextImpl& aCtxImpl ); + + virtual TUint32 ConstructReassociationRequestFrame( + WlanContextImpl& aCtxImpl, + TUint8*& aStartOfFrame ); + + void StartReassociationResponseTimer( + WlanContextImpl& aCtxImpl ) const; + + static T802Dot11ManagementStatusCode IsRxReassociationSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint32 aFlags ); + + inline void ConfigureAc( + WlanContextImpl& aCtxImpl ); + + /** + * Returns the state's name + * @since Series 60 3.1 + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void Entry( WlanContextImpl& aCtxImpl ); + + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + virtual void OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + virtual TBool OnTimeout( WlanContextImpl& aCtxImpl ); + +private: + + // Prohibit copy constructor + WlanDot11ReassociationPending( + const WlanDot11ReassociationPending& ); + // Prohibit assigment operator + WlanDot11ReassociationPending& operator= ( + const WlanDot11ReassociationPending& ); + +protected: // Data + + TState iState; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + // holds the name of the state + static const TInt8 iName[]; +#endif + }; + +#include "umacdot11reassociationpending.inl" + +#endif // WLANDOT11REASSOCIATIONPENDING_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Roam.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Roam.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the UmacDot11Roam class +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANDOT11ROAM_H +#define WLANDOT11ROAM_H + +#include "UmacDot11State.h" + +/** +* Roaming base class. +* A composite state, which holds the common behaviour of its +* substates. +* +* @lib wlanumac.lib +* @since Series 60 3.1 +*/ +class WlanDot11Roam : public WlanDot11State + { + public: + + /** + * Destructor. + */ + virtual ~WlanDot11Roam(); + + protected: // New functions + + /** + * C++ default constructor. + */ + WlanDot11Roam(); + + private: + + // Prohibit copy constructor + WlanDot11Roam( const WlanDot11Roam& ); + // Prohibit assigment operator + WlanDot11Roam& operator= ( const WlanDot11Roam& ); + }; + +#endif // WLANDOT11ROAM_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11SharedAuthPending.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11SharedAuthPending.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11SharedAuthPending class +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef WLANDOT11SHAREDAUTHPENDING_H +#define WLANDOT11SHAREDAUTHPENDING_H + +#include "UmacDot11AuthenticatePending.h" + +/** +* A class that implements dot11 shared mode authentication frame exchange. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11SharedAuthPending : public WlanDot11AuthenticatePending + { +public: + + /** + * C++ default constructor. + */ + WlanDot11SharedAuthPending() : + iLatestRxAuthRespPtr ( NULL ), + iLatestRxAuthRespFlags ( 0 ) + {}; + + /** + * Destructor. + */ + virtual ~WlanDot11SharedAuthPending() { iLatestRxAuthRespPtr = NULL; }; + +private: + + /** + * Sends authentication sequence number 3 message + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @return ETrue upon success, + * EFalse if packet scheduler discarded the frame + */ + TBool SendAuthSeqNbr3Frame( WlanContextImpl& aCtxImpl ) const; + + // Functions from base classes + + /** + * From ?base_class ?member_description. + * Sets the used authentication number to authenticate message + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnSetAlgorithmNumber( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description. + * Returns the states name + * @since S60 3.1 + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aFlags flags from WHA frame receive method + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ); + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnRxAuthResponseEvent( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor. + WlanDot11SharedAuthPending( + const WlanDot11SharedAuthPending& ); + // Prohibit assigment operator. + WlanDot11SharedAuthPending& operator= + ( const WlanDot11SharedAuthPending& ); + +private: // Data + +#ifndef NDEBUG + /** name of the state */ + static const TInt8 iName[]; +#endif + /** + * pointer to the beginning of the latest received valid shared + * authentication response frame. Not own. + */ + const TUint8* iLatestRxAuthRespPtr; + + /** + * value of WHA::ReceivePacket() aFlags for the latest received + * valid shared authentication response frame + */ + TUint32 iLatestRxAuthRespFlags; + }; + +#endif // WLANDOT11SHAREDAUTHPENDING_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11SoftReset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11SoftReset.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11SoftReset class +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef WLANDOT11SOFTRESET_H +#define WLANDOT11SOFTRESET_H + +#include "UmacDot11State.h" + +/** + * Resets the WHA layer back to the same initial state which it was in after + * Initialize and Configure WHA commands. However, does not reset the MIB + * elements. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11SoftReset : public WlanDot11State + { +public: + + /** + * C++ default constructor. + */ + WlanDot11SoftReset() : iState( EINIT ) {}; + + /** + * Destructor. + */ + virtual ~WlanDot11SoftReset() {}; + +protected: + + // Types for the FSM + // + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // underlying sw layer tx delivery complete event + ETXCOMPLETE, + // abort execution event + EABORT, + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + // start state of the state machine + EINIT, + EISSUEDISCONNECT, + ECONFTXQUEUE, + ECONTINUEDOT11TRAVERSE, + // defined as an upper bound + ESTATEMAX + }; + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( + WlanContextImpl& aCtxImpl ); + + /** + * Performs state initialization actions. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void InitActions( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void IssueDisconnect( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureQueue( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * Returns the states name + * + * @since Series 60 3.1 + * @param aLength (OUT) length of the name of the state + * @return name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * From ?base_class1. + * ?description + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl); + + /** + * From ?base_class1. + * ?description + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl); + +private: + + // Prohibit copy constructor + WlanDot11SoftReset( const WlanDot11SoftReset& ); + // Prohibit assigment operator + WlanDot11SoftReset& operator= ( const WlanDot11SoftReset& ); + +protected: // Data + + TState iState; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** name of the state */ + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11SOFTRESET_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11State.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1357 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11State class +* +*/ + +/* +* %version: 57 % +*/ + +#ifndef WLANDOT11STATE_H +#define WLANDOT11STATE_H + +#include "umacinternaldefinitions.h" +#include "UmacMacActionState.h" + +class WlanWsaAddKey; +class WlanElementLocator; + + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib wlanumac.lib +* @since S60 3.1 +*/ +class WlanDot11State : public WlanMacActionState + { +public: + + /** + * Destructor. + */ + virtual ~WlanDot11State() {}; + + void AddDefaultBroadcastWepKeyComplete( + WlanContextImpl& aCtxImpl ) const; + + // Functions from base classes + + /** + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning see #TRate + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool Scan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * From WlanMacState. + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * Set 802.11 power mgmt mode in infrastructure networks. + * @param aCtxImpl statemachine context + * @param aPowerMode desired power mode + * @param aDisableDynamicPowerModeManagement If ETrue, disables the dynamic + * power mode management handling. Relevant only when aPowerMode + * is EPowerModePs + * @param aWakeupModeInLightPs WLAN wake-up mode in Light PS mode + * @param aListenIntervalInLightPs specifies the value of N for wake-up + * modes 2 and 3 in Light PS mode. + * @param aWakeupModeInDeepPs WLAN wake-up mode in Deep PS mode + * @param aListenIntervalInDeepPs specifies the value of N for wake-up + * modes 2 and 3 in Deep PS mode + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ); + + /** + * Enable user data from/to protcol stack + * (802.1x: pass data through after succesfull authentication) + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + */ + + virtual TBool EnableUserData( + WlanContextImpl& aCtxImpl ); + /** + * Disable user data from/to protcol stack + * (802.1x: block data during authentication). + * @param aCtxImpl global state machine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool DisableUserData( + WlanContextImpl& aCtxImpl ); + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl global state machine context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual TBool TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ); + + virtual void TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ); + + // Frame receive + + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + // from packet scheduler + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + /** + * Method called when Packet Scheduler's packet scheduling method + * should be called, as there exists a packet that is suitable for + * transmission. + * NOTE: if any other Packet Scheduler method is called within this + * context the result is undefined. + * + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ); + + /** + * Method called when packet has been flushed (removed) + * from packet scheduler + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet that was flushed + * @param aMetaHeader frame meta header + */ + virtual void OnPacketFlushEvent( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + virtual void Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ); + + /** + * Configure Tx queue parameters to WHA (adaptation) layer + * + * @param aCtxImpl statemachine context + * @param aQueueId Id of the queue to configure + * @param aCompleteManagementRequest ETrue if this request came from the + * WLAN Mgmt client and that request + * needs to be completed. + * EFalse otherwise. + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + TBool ConfigureTxQueue( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TBool aCompleteManagementRequest = EFalse ); + + virtual TBool ConfigureAcParams( + WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TBool SetCtsToSelfMib( WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the dynamic HT configuration + * of the target/current network + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureHtBssOperation( WlanContextImpl& aCtxImpl ); + +protected: + + static const TUint32 KCompleteManagementRequest = 0xACDCACDC; + + /** + * C++ default constructor. + */ + WlanDot11State() {}; + + /** + * Add/set (or replace) a broadcast WEP key, + * conditionally set it as the default key and as a pairwise key + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Index of the key in the default key table + * @param aUseAsDefaulKey use as the default key + * @param aUseAsPairwiseKey use as the pairwise key + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @param aMac MAC address associated with the key + * @return ETrue if state transition occurred, EFalse otherwise + */ + TBool OnAddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TBool aUseAsPairwiseKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ); + + /** + * Set inital WLAN specific parameters. + * @param aCtxImpl statemachine context + * @param aRTSThreshold + * limit for packet size when to use RTS/CTS protocol + * @param aMaxTxMSDULifetime + * Max. time to (re-)send whole MSDU packet. (In TUs.) + * @return status of the command, + + */ + static void OnConfigureUmacMib( + WlanContextImpl& aCtxImpl, + TUint16 aRTSThreshold, + TUint32 aMaxTxMSDULifetime); + + + /** + * + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param + * @return ETrue if ... + */ + TBool InitNetworkConnect( + WlanContextImpl& aCtxImpl, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody ) const; + + /** + * Resolves correct transmit queue for frame + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aDot11MacHeader start of dot11 mac header + * @return transmit queue id to use for the packet + */ + WHA::TQueueId QueueId( + const WlanContextImpl& aCtxImpl, + const TUint8* aDot11MacHeader ) const; + + /** + * Transmit dot11-deauthenticate frame. + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aReason reason code of the frame + * @param aWaitIfIntTxBufNotFree if ETrue, the caller wants to wait for the + * internal Tx buffer to become free if it is not free now + * if EFalse, the caller doesn't want to wait for the internal Tx + * buffer in case it happens to be occupied + * @return ETrue if Packet Scheduler accepted the frame for transmit + * EFalse otherwise + */ + TBool TxDeauthenticate( + WlanContextImpl& aCtxImpl, + T802Dot11ManagementReasonCode aReason, + TBool aWaitIfIntTxBufNotFree = EFalse ) const; + + /** + * Transmit dot11-disassociate frame. + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aReason reason code of the frame + * @param aWaitIfIntTxBufNotFree if ETrue, the caller wants to wait for the + * internal Tx buffer to become free if it is not free now + * if EFalse, the caller doesn't want to wait for the internal Tx + * buffer in case it happens to be occupied + * @return ETrue if Packet Scheduler accepted the frame for transmit + * EFalse otherwise + */ + TBool TxDisassociate( + WlanContextImpl& aCtxImpl, + T802Dot11ManagementReasonCode aReason, + TBool aWaitIfIntTxBufNotFree = EFalse ) const; + + /** + * Creates AES pairwise key setting context + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + * @param aWhaAddKey reference to WHA Add Key command object + * @param aMacAddr MAC address to be associated to the key + */ + static WHA::SAesPairwiseKey* CreateAesPtkCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TUint8* aData, + const TMacAddress& aMacAddr ); + + /** + * Creates TKIP pairwise key setting context + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + * @param aWhaAddKey reference to WHA Add Key command object + * @param aMacAddr MAC address to be associated to the key + */ + static WHA::STkipPairwiseKey* CreateTkipPtkCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TUint8* aData, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * Creates WEP pairwise key setting context + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + * @param aWhaAddKey reference to WHA Add Key command object + * @param aMacAddr MAC address to be associated with the key + * @param aKeyLength length of the key + * @param aKey the key + */ + static WHA::SWepPairwiseKey* CreateUnicastWepKeyCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength] ); + + /** + * Creates WAPI pairwise key setting context + * + * @param aCtxImpl global statemachine context + * @param aWhaAddKey reference to WHA Add Key command object + * @param aData key data + * @param aKeyIndex key index + * @param aMacAddr MAC address to be associated to the key + */ + static WHA::SWapiPairwiseKey* CreateWapiPtkCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TUint8* aData, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * Determines the initial transmit rate for Null Data, Qos Null + * and PS Poll templates. + * @since Series 60 3.1 + * @param aCtxImpl Global statemachine context + * @return Initial transmit rate + */ + WHA::TRate InitialSpecialFrameTxRate( + const WlanContextImpl& aCtxImpl ) const; + + /** + * Transfers a dot11 frame up to the client of the management interface + * + * @since Series 60 3.2 + * @param aCtxImpl global statemachine context + * @param aFrame frame to be transferred + * @param aLength length of the frame + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + TBool XferDot11FrameToMgmtClient( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint32 aLength, + const WHA::TRcpi aRcpi, + TUint8* aBuffer ) const; + + virtual TBool DoErrorIndication( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus ); + + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + virtual TBool OnWlanWakeUpIntervalChange( WlanContextImpl& aCtxImpl ); + + /** + * Returns a WHA queue ID / WMM Access Category corresponding to the 802.1d + * priority given as the parameter + * @since Series 60 3.1 + * @param aPriority 802.1d priority + */ + static WHA::TQueueId Queue( TUint8 aPriority ); + + static TBool UapsdEnabledInNetwork( + const SRxWmmIeData& aRxWmmIE ); + + static TBool UapsdEnabledInNetwork( + const SWmmParamElemData& aWmmParamElem ); + + static void EnableQos( WlanContextImpl& aCtxImpl, + TBool aUapsdEnabledInNw ); + + /** + * Determines if U-APSD will be used for the ACs/Tx Queues. + * This depends on whether U-APSD is supported by the AP, and if it + * is, whether WLAN Mgmt Client has requested U-APSD to be used + * for the AC. + * Also freezes the dynamic power mode management traffic override + * settings. + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + */ + static void DetermineAcUapsdUsage( WlanContextImpl& aCtxImpl ); + + /** + * Resets the specified AC (Access Category) parameters to default values. + * + * @param aCtxImpl statemachine context + * @param aAccessCategory access category + * @param aUseAandGvalues If ETrue uses the 802.11a/g specific + * default values. Otherwise uses the 802.11b default values + */ + static void ResetAcParameters( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TBool aUseAandGvalues ); + + /** + * Resets the AC (Access Category) parameters of every AC to default values. + * @param aCtxImpl statemachine context + * @param aUseAandGvalues If ETrue uses the 802.11a/g specific + * default values. Otherwise uses the 802.11b default values + */ + static void ResetAcParameters( + WlanContextImpl& aCtxImpl, + TBool aUseAandGvalues = EFalse ); + + /** + * Checks if the AC parameters of the specified AC are valid & reasonable + * @param aCtxImpl statemachine context + * @param aAccessCategory access category + */ + static TBool AcParametersValid( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory ); + + static void ParseAcParameters( + WlanContextImpl& aCtxImpl, + const SWmmParamElemData& aWmmParamElem ); + + /** + * Stores the Tx Rate Policy related information provided by wlan mgmt + * client + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy rate policy (policy objects) + * @param aQueue2RateClass Tx queue (AC) to rate policy object mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for the + * policy objects + * @param aAutoRatePolicy auto rate policy + * @param aHtMcsPolicy HT MCS policy + */ + static void StoreTxRatePolicyInfo( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ); + + /** + * Configures the Tx rate policies according to the information provided + * by the WLAN mgmt client + * + * @since Series 60 3.1 + * @param aCtxImpl Global statemachine context + * @param aCompleteMgmtRequest If ETrue, a WLAN Mgmt client request needs + * to be completed + * If EFalse, a request doesn't need to be completed + * @return ETrue if the operation succeeded & a state change occurred + * EFalse if a fatal error occurred + */ + TBool ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + TBool aCompleteMgmtRequest = EFalse ); + + /** + * Determines whether the outgoing data frame is question is a multicast + * + * @since Series 60 3.2 + * @param aDataFrameHdr ptr to the start of the data MAC frame header + * @return ETrue if the DA of the frame is a multicast address + * EFalse otherwise + */ + static TBool OutgoingMulticastDataFrame( const SDataFrameHeader* aDataFrameHdr ); + + /** + * Updates frame statistics after completed data frame transmit attempt + * + * @since Series 60 3.2 + * @param aCtxImpl Global statemachine context + * @param aAccessCategory AC/Queue via which the frame was transmitted + * @param aStatus frame Tx status + * @param aMulticastData ETrue if the frame was a multicast + * @param aAckFailures The number of times the frame was transmitted + * without receiving an acknowledgement + * @param aMediaDelay The total time the packet spent in the WLAN device + * before transmission was completed. + * @param aTotalTxDelay The time between SendPacket and SendPacketComplete + */ + static void UpdateTxDataFrameStatistics( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + WHA::TStatus aStatus, + TBool aMulticastData, + TUint aAckFailures, + TUint32 aMediaDelay, + TUint aTotalTxDelay ); + + /** + * Configures Tx rate policy objects, sets the policy object to use for + * every Tx Queue / QoS AC, and also sets the Initial Max Tx Rate to be + * used for the configured policy objects + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy rate policy (policy objects) + * @param aQueue2RateClass Tx queue (AC) to rate policy object mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for the + * policy objects + * @param aAutoRatePolicy auto rate policy + * @param aHtMcsPolicy HT MCS policy + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ); + + /** + * Determines if there is a meaningful diffrence between the desired 802.11 + * PS Mode wake-up settings compared to the current settings + * @param aCtxImpl statemachine context + * @return ETrue a meaningful difference exists + * EFalse otherwise + */ + TBool DifferenceInPsModeWakeupSettings( + const WlanContextImpl& aCtxImpl ) const; + + /** + * Informs lower layer about the HT capabilities + * of the target network + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + TBool ConfigureHtCapabilities( + WlanContextImpl& aCtxImpl ); + + /** + * Resets the HT Capabilities MIB to its default value + * @param aCtxImpl statemachine context + */ + void ResetHtCapabilitiesMib( WlanContextImpl& aCtxImpl ); + + /** + * Resets the HT Block Ack Configure MIB to its default value + * @param aCtxImpl statemachine context + */ + void ResetHtBlockAckConfigureMib( WlanContextImpl& aCtxImpl ); + + /** + * Determines if HT control field is present in received + * 802.11 management or 802.11 data frame + * @param aCtxImpl statemachine context + * @param aFrame received frame + * @param aFlags flags from WHA frame receive method + * @return ETrue if HT control field is present + * EFalse otherwise + */ + static TBool HtcFieldPresent( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + TUint32 aFlags ); + +private: + + /** + * @param aCtxImpl statemachine context + * @param aRate TRate value + * @return ETrue mapping success, any other failure + */ + static void ResolveScanRate( + WlanContextImpl& aCtxImpl, + const TRate aRate, + WHA::TRate& aScanRate ); + + static TBool NetworkCapabilityInformationMet( + WlanContextImpl& aCtxImpl ); + static TBool AreSupportedRatesMet( WlanContextImpl& aCtxImpl, + TBool aCheckAlsoExtendedRates ); + static TBool ProcessSingleSupportedRateElement( + WlanContextImpl& aCtxImpl, + const TUint8 aApRate, + TUint32& aRateBitmask ); + + /** + * Sets the WHA::KMibArpIpAddressTable MIB + * + * @param aCtxImpl statemachine context + * @param aEnableFiltering If ETrue, filtering is enabled + * If EFalse, filtering is disabled + * @param aIpv4Address Address to set in the MIB. Relevant only when + * enabling filtering + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + TBool SetArpIpAddressTableMib( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ); + + + // Functions from base classes + + virtual TBool OnDot11PwrMgmtTransitRequired( + WlanContextImpl& aCtxImpl ); + + /** + * Indicates Consecutive Beacons Lost + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutiveBeaconsLostIndication( WlanContextImpl& aCtxImpl ); + + virtual void DoRegainedBSSIndication( WlanContextImpl& aCtxImpl ); + + virtual void DoRadarIndication( WlanContextImpl& aCtxImpl ); + + virtual void DoRcpiIndication( + WlanContextImpl& aCtxImpl, + WHA::TRcpi aRcpi ); + + /** + * Indicates that the WLAN device has detected problems in the power + * save mode operation of the AP + * + * @param aCtxImpl global statemachine context + */ + virtual void DoPsModeErrorIndication( WlanContextImpl& aCtxImpl ); + + /** + * Add (or replace) a TKIP key + * @param aCtxImpl statemachine context + * @param aData data blob that holds TKIP parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id filed of WEP IV + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddTkIPKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * + * Add (or replace) a multicast TKIP key. + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the TKIP parameters. + * @param aData TKIP parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastTKIPKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * Add (or replace) a pairwise AES key. + * + * @param aCtxImpl statemachine context + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddAesKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + const TMacAddress& aMacAddr ); + + /** + * Add (or replace) an AES group key. + * + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastAesKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * Add (or replace) a unicast WEP key. + * @param aCtxImpl statemachine context + * @param aMacAddr MAC address to which the WEP key corresponds to + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]); + + /** + * From MWlanUserEvent + * Add (or replace) a multicast WAPI key. + * + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the WAPI parameters. + * @param aData WAPI parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastWapiKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * From MWlanUserEvent + * Add (or replace) a pairwise WAPI key. + * + * @param aCtxImpl statemachine context + * @param aData data blob that holds WAPI parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id field of WEP IV + * @param aMacAddr MAC address of the peer station + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddUnicastWapiKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * Set transmission power level. + * This has to be legal at the current region. + * @param aCtxImpl statemachine context + * @param aLevel Transmission power level in mW. + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool SetTxPowerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aLevel); + + /** + * Gets last RCPI value + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool GetLastRcpi( + WlanContextImpl& aCtxImpl ); + + /** + * Configures the parameters which define when BSS lost is indicated. + * The indication is sent when either one of the specified thresholds + * is exceeded. + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aBeaconLostCount beacon lost count threshold + * @aFailedTxPacketCount failed Tx packet count threshold + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureBssLost( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount, + TUint8 aFailedTxPacketCount ); + + /** + * Sets the Tx rate adaptation algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMinStepUpCheckpoint minimum and initial rate increase + * checkpoint in units of frames + * Range: [aStepDownCheckpoint,aMaxStepUpCheckpoint] + * @param aMaxStepUpCheckpoint maximum rate increase checkpoint in units + * of frames + * Range: [aStepDownCheckpoint,UCHAR_MAX] + * @param aStepUpCheckpointFactor StepUpCheckpoint is multiplied with this + * value if sending a probe frame fails + * Range: [1,aMaxStepUpCheckpoint] + * @param aStepDownCheckpoint after this many frames the need to decrease + * the rate is checked + * Range: [2,UCHAR_MAX] + * @param aMinStepUpThreshold minimum and initial StepUpThreshold + * percentage + * Range: [1,aMaxStepUpThreshold] + * @param aMaxStepUpThreshold maximum StepUpThreshold percentage + * Range: [1,100] + * @param aStepUpThresholdIncrement StepUpThreshold is incremented by this + * value if sending a probe frame fails + * Range: [0,aMaxStepUpThreshold] + * @param aStepDownThreshold if the percentage of frames which failed to + * be transmitted at the originally requested rate is at least + * aStepDownThreshold at the aStepDownCheckpoint, the rate will + * be decreased + * Range: [1,100] + * @param aDisableProbeHandling if EFalse, the rate adaptation algorithm + * handles the first frame transmitted after a rate increase in a + * special way. Otherwise the special handling is disabled + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetTxRateAdaptParams( + WlanContextImpl& aCtxImpl, + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ); + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aToLightPsTimeout time interval in microseconds after which + * transition from Active mode to Light PS mode is considered + * @param aToLightPsFrameThreshold frame count threshold used when + * considering transition from Active to Light PS mode + * @param aToActiveTimeout time interval in microseconds after which the + * frame counter used when considering transition from Light PS + * to Active mode is reset + * @param aToActiveFrameThreshold frame count threshold used when + * considering transition from Light PS to Active mode + * @param aToDeepPsTimeout time interval in microseconds after which + * transition from Light PS mode to Deep PS mode is considered + * @param aToDeepPsFrameThreshold frame count threshold used when + * considering transition from Light PS to Deep PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetPowerModeManagementParameters( + WlanContextImpl& aCtxImpl, + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * Configures dynamic power mode management traffic override + * + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting + * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting + * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC + * setting + * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC + * setting + * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting + * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting + * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC + * setting + * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC + * setting + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& aCtxImpl, + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ); + + /** + * Gets data frame Rx & Tx statistics + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetFrameStatistics( WlanContextImpl& aCtxImpl ); + + /** + * Configures U-APSD usage + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aMaxServicePeriodLength + * @param aUapsdForVoice if ETrue the Voice AC is made both trigger and + * delivery enabled when connecting to a QoS AP + * supporting U-APSD. + * Otherwise it's made neither trigger nor delivery + * enabled + * @param aUapsdForVideo if ETrue the Video AC is made both trigger and + * delivery enabled + * when connecting to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor delivery + * enabled + * @param aUapsdForBestEffort if ETrue the Best Effort AC is made both + * trigger and delivery enabled when connecting + * to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor + * delivery enabled + * @param aUapsdForBackground if ETrue the Background AC is made both + * trigger and delivery enabled when connecting + * to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor + * delivery enabled + */ + virtual TBool ConfigureUapsd( + WlanContextImpl& aCtxImpl, + TMaxServicePeriodLength aMaxServicePeriodLength, + TBool aUapsdForVoice, + TBool aUapsdForVideo, + TBool aUapsdForBestEffort, + TBool aUapsdForBackground ); + + /** + * Get our own MAC address + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetMacAddress( + WlanContextImpl& aCtxImpl ); + + /** + * Configures ARP IP address filtering + * + * @param aCtxImpl statemachine context + * @param aEnableFiltering If ETrue, filtering is enabled + * If EFalse, filtering is disabled + * @param aIpv4Address If the target IP Address in a received ARP request + * doesn't match this address, the packet shall be discarded + * on the lower layers. + * Relevant only when enabling filtering. + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureArpIpAddressFiltering( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ); + + /** + * Configures HT Block Ack use + * + * @param aCtxImpl statemachine context + * @param aTxBlockAckUsage Bit map defining Block Ack use in Tx direction + * @param aRxBlockAckUsage Bit map defining Block Ack use in Rx direction + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureHtBlockAck( + WlanContextImpl& aCtxImpl, + TUint8 aTxBlockAckUsage, + TUint8 aRxBlockAckUsage ); + + /** + * Configures Proprietary SNAP header. + * Valid received 802.11 Data frames containing this SNAP header + * are accepted and forwarded to the WLAN Management Client. + * + * @param aCtxImpl statemachine context + * @param + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureProprietarySnapHdr( + WlanContextImpl& aCtxImpl, + const TSnapHeader& aSnapHeader ); + + /** + * Sets the beacon lost count value + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aBeaconLostCount beacon lost count + * @return ETrue if a state change occurred + * EFalse otherwise + */ + TBool SetBeaconLostCountMib( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount); + + /** + * Resorts to using only a single Tx rate policy. + * This is done when the WLAN Mgmt client provides us with more rate + * classes / policies than the lower layers are able to handle + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aQueue2RateClass Tx queue to rate class mapping + */ + void ResortToSingleTxRatePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TQueue2RateClass& aQueue2RateClass ) const; + + /** + * Finalize the 802.11b/g non-autorate policy so that it contains only + * rates which are also supported by the lower layers and the current + * network + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aRateMasks intersection of 802.11b/g rates which are: + * - included in the rate class AND + * - supported by the lower layers AND + * - supported by the current network + * @param aInitialMaxTxRate4RateClass initial max Tx rate for every + * rate class + */ + void FinalizeTxRatePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TWhaRateMasks& aRateMasks, + TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass ) const; + + /** + * Builds a rate mask by including aRate in it if that rate has non-zero + * Tx Attempts and is supported both by the nw and by WHA layer. + * Additionally makes aTxAttempts zero if aRate is not supported either by + * the nw or by WHA layer. Otherwise keeps the aTxAttempts value intact + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRate the rate + * @param aTxAttempts nbr of Tx attempts to make with aRate + * @param aRateMask the rate mask + */ + void HandleRate( + WlanContextImpl& aCtxImpl, + WHA::TRate aRate, + TUint8& aTxAttempts, + WHA::TRate& aRateMask ) const; + + /** + * Builds a rate mask from a Rate Class and updates Tx attempts value in + * the Rate Class when necessary (see HandleRate()). + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRateClass the rate class + * @param aRateMask the rate mask + */ + void HandleRates( + WlanContextImpl& aCtxImpl, + TTxRateClass& aRateClass, + WHA::TRate& aRateMask ) const; + + /** + * Updates rate class and rate mask to contain the rates which both the + * WHA layer and the nw support + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aRateClassInd denotes the rate class within the rate policy + * @param aRateMask the rate mask + */ + void RecoverRatePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TUint aRateClassInd, + WHA::TRate& aRateMask ) const; + + /** + * Finalize the 802.11 b/g autorate policies so that they contain only + * rates which are also supported by the lower layers and the current + * network + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aAutoRatePolicy the autorate policies + */ + void FinalizeTxAutoratePolicy( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + TTxAutoRatePolicy& aAutoRatePolicy ) const; + + /** + * Modifies the rate policy configuration by adding a new special policy, + * which can be used for the transmission of certain frames, whose + * successful delivery is of special importance + * + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aAutoRatePolicy the autorate policies + * @param aHtMcsPolicy HT MCS policy + */ + void SpecialTxAutoratePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TTxAutoRatePolicy& aAutoRatePolicy, + THtMcsPolicy& aHtMcsPolicy ) const; + + /** + * Configures autorate policies to lower layers. + * Before that, finalizes the MCS policies so that they contain only + * MCSs which are also supported by the lower layers and the current + * network. + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aQueue2RateClass Tx queue to rate class mapping + * @param aHtMcsPolicy HT MCS policy + * @param aCompleteMgmtRequest If ETrue, a WLAN Mgmt client request needs + * to be completed + * If EFalse, a request doesn't need to be completed + */ + void ConfigureForTxAutoratePolicy( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + THtMcsPolicy& aHtMcsPolicy, + TBool aCompleteMgmtRequest ); + + /** + * Updates - if necessary - the provided HT MCS policy to contain only + * MCSs which both the WHA layer and the nw support + * + * @param aCtxImpl statemachine context + * @param aHtMcsPolicy HT MCS policy + * @param aNbrOfMcsSets Number of MCS sets in the MCS policy + */ + void HandleHtMcsPolicy( + WlanContextImpl& aCtxImpl, + THtMcsPolicy& aHtMcsPolicy, + TUint aNbrOfMcsSets ) const; + + /** + * Takes non-autorate policy into use. + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy the rate policy + * @param aRateMasks intersection of 802.11b/g rates which are: + * - included in the rate class AND + * - supported by the lower layers AND + * - supported by the current network + * @param aQueue2RateClass Tx queue to rate class mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for every + * rate class + * @param aCompleteMgmtRequest If ETrue, a WLAN Mgmt client request needs + * to be completed + * If EFalse, a request doesn't need to be completed + */ + TBool ConfigureForTxRatePolicy( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TWhaRateMasks& aRateMasks, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& initialMaxTxRate4RateClass, + TBool aCompleteMgmtRequest ); + + /** + * Locates and stores the HT Capabilities element data of the target nw + * + * @param aCtxImpl Statemachine context + * @param aElementLocator Initialized Element locator which can + * be used to locate information elements related to the + * target network + * @return ETrue if connecting to the target network is possible + * EFalse otherwise + */ + TBool HandleHtCapabilities( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) const; + + /** + * Locates and stores the HT Operation element data of the target nw + * + * @param aCtxImpl Statemachine context + * @param aElementLocator Initialized Element locator which can + * be used to locate information elements related to the + * target network + * @return ETrue if connecting to the target network is possible + * EFalse otherwise + */ + TBool HandleHtOperation( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) const; + + /** + * Locates the relevant HT related elements of the target nw and + * stores their data + * + * @param aCtxImpl Statemachine context + * @param aElementLocator Initialized Element locator which can + * be used to locate information elements related to the + * target network + * @return ETrue if connecting to the target network is possible + * EFalse otherwise + */ + TBool HandleDot11n( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) const; + + }; + +#endif // WLANDOT11STATE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11Synchronize.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the UmacDot11Synchronize class +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WLANDOT11SYNCHRONIZE_H +#define WLANDOT11SYNCHRONIZE_H + +#include "UmacDot11Roam.h" + + +/** +* Joins to a new BSS network so that reassociation to that network +* can be performed. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanDot11Synchronize : public WlanDot11Roam + { +public: + + /** + * C++ default constructor. + */ + WlanDot11Synchronize(); + + /** + * Destructor. + */ + virtual ~WlanDot11Synchronize(); + +protected: + + // Types for the FSMs + // + + // events for the FSM + enum TEvent + { + // state entry action to be executed + ESTATEENTRY, + // underlying sw layer tx delivery complete event + ETXCOMPLETE, + // abort FSM execution + EABORT, + // defined as an upper bound + EEVENTMAX + }; + + // states of the FSM + enum TState + { + // start state of the state machine + EINIT, + ESETDOT11SLOTTIME, // configure slottime mib if + // supported by the WLAN vendor solution + ESETCTSTOSELF, // configure ctstoself mib + ECONFTXQUEUE, // configure just the legacy tx queue + ECONFTXQUEUEPARAMS, // configure tx queue parameters + ESETTXRATEPOLICY, // set Tx rate policy + ESETHTCAPABILITIES, // configure HT capabilities mib + ESETHTBSSOPERATION, // configure HT BSS operation mib + ERESETHTCAPABILITIES, // reset HT capabilities mib + EISSUEJOIN, // issue join command + ESETHTBLOCKACKCONF, // configure HT Block Ack configure mib + ERESETHTBLOCKACKCONF, // reset HT Block Ack configure mib + ECONTINUEDOT11TRAVERSE, // continue dot11 fsm traversal + ESTATEMAX // defined as an upper bound + }; + + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + void OnStateEntryEvent( + WlanContextImpl& aCtxImpl ); + + void OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ); + + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + void ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ); + + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + TBool InitActions( + WlanContextImpl& aCtxImpl ); + + void SetDot11SlotTime( + WlanContextImpl& aCtxImpl ); + + void SetCtsToSelf( WlanContextImpl& aCtxImpl ); + + void ConfigureQueue( WlanContextImpl& aCtxImpl ); + + void ConfigureTxQueueParams( WlanContextImpl& aCtxImpl ); + + void SetTxRatePolicy( WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the HT capabilities + * of the target network + * @param aCtxImpl global statemachine context + */ + void SetHtCapabilities( WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the dynamic HT configuration + * of the target network + * @param aCtxImpl statemachine context + */ + void SetHtBssOperation( WlanContextImpl& aCtxImpl ); + + /** + * Resets the HT Capabilities MIB to its default value + * @param aCtxImpl statemachine context + */ + void ResetHtCapabilities( WlanContextImpl& aCtxImpl ); + + /** + * Resets the HT Block Ack Configure MIB to its default value + * @param aCtxImpl statemachine context + */ + void ResetHtBlockAckConfiguration( WlanContextImpl& aCtxImpl ); + + void IssueJoin( + WlanContextImpl& aCtxImpl ); + + /** + * Informs lower layer about the HT Block Ack configuration + * of the target network + * @param aCtxImpl statemachine context + */ + void SetHtBlockAckConfiguration( WlanContextImpl& aCtxImpl ); + +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + void Entry( WlanContextImpl& aCtxImpl ); + + void Exit( WlanContextImpl& aCtxImpl ); + + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + +private: + + // Prohibit copy constructor. + WlanDot11Synchronize( const WlanDot11Synchronize& ); + // Prohibit assigment operator. + WlanDot11Synchronize& operator=( const WlanDot11Synchronize& ); + +protected: // Data + + TState iState; + + // true, if the Join operation failed + TBool iJoinFailed; + +#ifndef NDEBUG + // max length of state name for tracing + enum { KMaxStateStringLength = 50 }; + // max length of event name for tracing + enum { KMaxEventStringLength = KMaxStateStringLength }; + + // state names for tracing + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + // event names for tracing + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + // name of the state + static const TInt8 iName[]; +#endif + }; + +#endif // WLANDOT11SYNCHRONIZE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMacActionState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMacActionState.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,295 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanMacActionState class. +* +*/ + +/* +* %version: 27 % +*/ + +#ifndef WLANMACACTIONSTATE_H +#define WLANMACACTIONSTATE_H + +#include "UmacMacState.h" +#include "umacwhacommandclient.h" + +class WlanDot11State; +class WlanWsaComplexCommand; +class WlanWsaCommand; +class WlanDot11InfrastructureMode; +class WlanDot11IbssMode; + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib wlanumac.lib +* @since Series 60 3.1 +*/ +class WlanMacActionState : + public WlanMacState, + public MWlanWhaCommandClient + { +public: + + /** + * Destructor. + */ + virtual inline ~WlanMacActionState(); + +public: + + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl global state machine context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual TBool TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ); + + virtual void TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ); + + virtual void Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ); + + // Frame receive + + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + // from packet scheduler + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + /** + * Method called when Packet Scheduler's packet scheduling method + * should be called, as there exists a packet that is suitable for + * transmission. + * NOTE: if any other Packet Scheduler method is called within this + * context the result is undefined. + * + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + +protected: + + /** + * C++ default constructor. + */ + WlanMacActionState() : iDot11HistoryState( NULL ) {}; + + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanDot11State& aNewState ); + + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanWsaComplexCommand& aNewState, + TUint32 aAct = 0 ); + + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanWsaCommand& aNewState, + TUint32 aAct = 0 ); + + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanWsaComplexCommand& aPrevState, + WlanWsaCommand& aNewState ); + + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanWsaComplexCommand& aPrevState, + WlanDot11State& aNewState ); + + /** + * dot11 protocol statemachine traversal from global state space + * to dot11infrastructuremode state space + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanDot11InfrastructureMode& aNewState ); + + /** + * dot11 protocol statemachine traversal + * within dot11infrastructuremode state space + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11InfrastructureMode& aPrevState, + WlanDot11InfrastructureMode& aNewState ); + + /** + * dot11 protocol statemachine traversal + * from dot11infrastructuremode state space to the global state space + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11InfrastructureMode& aPrevState, + WlanDot11State& aNewState ); + + /** + * dot11 protocol statemachine traversal from global state space + * to dot11ibssmode state space + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanDot11IbssMode& aNewState ); + + /** + * dot11 protocol statemachine traversal + * within dot11ibssmode state space + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11IbssMode& aPrevState, + WlanDot11IbssMode& aNewState ); + + /** + * dot11 protocol statemachine traversal + * from dot11ibssmode state space to the global state space + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11IbssMode& aPrevState, + WlanDot11State& aNewState ); + + inline WlanDot11State& Dot11History(); + +private: + + inline void Dot11History( WlanDot11State& aState ); + + void OnDot11InfrastructureModeStateSpaceEntry( + WlanContextImpl& aCtxImpl ); + + void OnDot11InfrastructureModeStateSpaceExit( + WlanContextImpl& aCtxImpl ) const; + + void OnDot11IbssModeStateSpaceEntry( + WlanContextImpl& aCtxImpl ) const; + + void OnDot11IbssModeStateSpaceExit( + WlanContextImpl& aCtxImpl ) const; + + /** + * Sets the Tx offset for every frame type which can be transmitted + * + * @param aCtxImpl global statemachine context + */ + void SetMgmtSideTxOffsets( WlanContextImpl& aCtxImpl ) const; + +private: // Data + + /** + * History (previous) state + * Not own + */ + WlanDot11State* iDot11HistoryState; + }; + + +#include "UmacMacActionState.inl" + +#endif // WLANMACACTIONSTATE_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMacActionState.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMacActionState.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanMacActionState inline methods. +* +*/ + +/* +* %version: 7 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanMacActionState::~WlanMacActionState() + { + iDot11HistoryState = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanDot11State& WlanMacActionState::Dot11History() + { + return *iDot11HistoryState; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanMacActionState::Dot11History( + WlanDot11State& aState ) + { + iDot11HistoryState = &aState; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMacState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMacState.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1172 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanMacState class +* +*/ + +/* +* %version: 53 % +*/ + +#ifndef WLANMACSTATE_H +#define WLANMACSTATE_H + +#include "802dot11.h" + +#include "UmacUserEvent.h" +#include "UmacWsaEvent.h" +#include "umacpacketschedulerclient.h" +#include "umacdfcclient.h" +#include "umacnullsender.h" + +class WlanContextImpl; +class WlanDot11State; +class WlanWsaCommand; +class WlanWsaComplexCommand; + +/** +* Interface layer for state machine context +* Has the default implementation of event handling +*/ +class WlanMacState : + public MWlanUserEvent, + public MWlanWsaEvent, + public MWlanPacketSchedulerClient, + public MWlanDfcClient, + public MWlanNullSender + { +public: + + /** + * Configure AC (Access Category) parameters to WHA (adaptation) layer + * + * @param aCtxImpl statemachine context + */ + virtual TBool ConfigureAcParams( + WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TBool SetCtsToSelfMib( WlanContextImpl& aCtxImpl ); + + /** + * Updates the RCPI Trigger Level MIB + * + * @since Series 60 3.1 + * @param aCtxImpl Global statemachine context + * @param aRcpiTrigger the value to assign to the MIB + * @param aCompleteManagementRequest ETrue if this request came from the + * WLAN Mgmt client and that request + * needs to be completed. + * EFalse otherwise. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool SetRcpiTriggerLevelMib( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger, + TBool aCompleteManagementRequest ); + + /** + * Informs lower layer about the dynamic HT configuration + * of the target/current network + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureHtBssOperation( WlanContextImpl& aCtxImpl ); + + /** + * Changes dot11 power management mode between active and PS mode + * + * @param aCtxImpl statemachine context + * @return ETrue if state change occurred, EFalse otherwise + */ + virtual TBool ChangePowerMgmtMode( + WlanContextImpl& aCtxImpl ); + + + // Methods from base classes + + /** + * Connect (authenticate and associate) to a BSS. + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network + * @param aBSSID BSSID of the access point + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption level + * @param aIsInfra ETrue when connecting to infrastructure network + * @param aScanResponseFrameBodyLength length of the scan response frame body + * @param aScanResponseFrameBody scan response frame body + * @param aIeData The IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * @param aIeDataLength Length of the IE(s) to be included into the + * (re-)association request + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ); + + /** + * Add TKIP key + * @param aCtxImpl statemachine context + * @param aData data blob that holds TKIP parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id filed of WEP IV + * @return KErrNotSupported + */ + virtual TBool AddTkIPKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * Add multicast TKIP key. + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the TKIP parameters. + * @param aData TKIP parameters. + * @return KErrNotSupported + */ + virtual TBool AddMulticastTKIPKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * Add (or replace) a pairwise AES key. + * + * @param aCtxImpl statemachine context + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddAesKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + const TMacAddress& aMacAddr ); + + /** + * Add (or replace) an AES group key. + * + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastAesKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * Add (or replace) a multicast WAPI key. + * + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the WAPI parameters. + * @param aData WAPI parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastWapiKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ); + + /** + * From MWlanUserEvent + * Add (or replace) a pairwise WAPI key. + * + * @param aCtxImpl statemachine context + * @param aData data blob that holds WAPI parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id field of WEP IV + * @param aMacAddr MAC address of the peer station + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddUnicastWapiKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ); + + /** + * Start an own IBSS network if there doesn't already + * exist a network that has the same name. + * @param aCtxImpl statemachine context + * @param aSSID name of the network + * @param aBeaconInterval Beacon period in TUs (kusec). range:[1, 1024] + * @param aAtim ATIM window (NOT USED) + * @param aChannel Used channel (1-14). + * Has to be legal in the current region. + * @param aEncryptionStatus Used encryption level + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool StartIBSS( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aAtim, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus ); + + /** + + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning see #TRate + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool Scan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ); + + /** + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * Disconnect STA from current network. + * @param aCtxImpl statemachine context + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool Disconnect(WlanContextImpl& aCtxImpl); + + /** + * Set 802.11 power mgmt mode in infrastructure networks. + * @param aCtxImpl statemachine context + * @param aPowerMode desired power mode + * @param aDisableDynamicPowerModeManagement If ETrue, disables the dynamic + * power mode management handling. Relevant only when aPowerMode + * is EPowerModePs + * @param aWakeupModeInLightPs WLAN wake-up mode in Light PS mode + * @param aListenIntervalInLightPs specifies the value of N for wake-up + * modes 2 and 3 in Light PS mode. + * @param aWakeupModeInDeepPs WLAN wake-up mode in Deep PS mode + * @param aListenIntervalInDeepPs specifies the value of N for wake-up + * modes 2 and 3 in Deep PS mode + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ); + + /** + * Set trigger level for RCPI trigger. + * @param aCtxImpl statemachine context + * @param aRcpiTrigger RCPI trigger level to be set + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool SetRcpiTriggerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger); + + /** + * Set transmission power level. + * This has to be legal at the current region. + * @param aCtxImpl statemachine context + * @param aLevel Transmission power level in mW. + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool SetTxPowerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aLevel); + + /** + * Set inital WLAN specific parameters. + * See 802Dot11DefaultValues.h for detaills + * @param aCtxImpl statemachine context + * @param aRTSThreshold + * @param aMaxTxMSDULifetime + * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call + * state and we transmit at least aVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this parameter, we enter Voice over WLAN Call state + * @param aVoiceCallEntryTxThreshold Threshold value for the number of + * Voice priority Tx frames to enter Voice over WLAN Call state + * @param aVoiceNullTimeout NULL frame sending interval during a Voice over + * WLAN call in U-APSD power save mode + * @param aNoVoiceTimeout after this long time of no Voice priority data + * Tx, exit Voice over WLAN call state + * @param aKeepAliveTimeout Keep Alive frame sending interval in + * infrastructure mode + * @param aSpRcpiIndicationLevel If this RCPI level is predicted to be + * reached within the time specified by aSpTimeToCountPrediction, + * a signal loss prediction indication is sent. + * @param aSpTimeToCountPrediction Specifies the time (in microseconds) + * how far into the future signal prediction is done. + * @param aSpMinIndicationInterval The minimum time difference (in + * microseconds) between two signal loss prediction indications. + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Configure( + WlanContextImpl& aCtxImpl, + TUint32 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aVoiceNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout, + TUint32 aSpRcpiIndicationLevel, + TUint32 aSpTimeToCountPrediction, + TUint32 aSpMinIndicationInterval ); + + /** + * From MWlanUserEvent + * Add/set (or replace) a broadcast WEP key + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aKeyIndex Index of the key in the default key table + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @param aMac MAC address associated with the key + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ); + + /** + * Add (or replace) a unicast WEP key. + * @param aCtxImpl statemachine context + * @param aMacAddr MAC address to which the WEP key corresponds to + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]); + + /** + * Disable user data from/to protcol stack + * (802.1x: block data during authentication). + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool DisableUserData( + WlanContextImpl& aCtxImpl ); + + /** + * Enable user data from/to protcol stack + * (802.1x: pass data through after succesfull authentication) + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + */ + virtual TBool EnableUserData( + WlanContextImpl& aCtxImpl ); + + /** + * Gets last RCPI value + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool GetLastRcpi( + WlanContextImpl& aCtxImpl ); + + /** + * Adds a multicast MAC address and starts to filter (Rx) multicast + * traffic sent to any other MAC addresses than those that have been + * specified using this method + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be added + * @return + */ + virtual TBool AddMulticastAddr( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr ); + + /** + * Removes a multicast MAC address from multicast (Rx) filtering + * configuration. So any packet that we receive and which has been sent + * to the multicast address in question is not accepted any more (i.e. + * it is filtered). + * However, if there are no addresses left in the multicast (Rx) filtering + * configuration after this remove, the multicast filtering is disabled + * and all (otherwise acceptable) multicast packets are accepted again. + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be removed + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool RemoveMulticastAddr( + WlanContextImpl& aCtxImpl, + TBool aRemoveAll, + const TMacAddress& aMacAddr ); + + /** + * Configures the parameters which define when BSS lost is indicated. + * The indication is sent when either one of the specified thresholds + * is exceeded. + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aBeaconLostCount beacon lost count threshold + * @aFailedTxPacketCount failed Tx packet count threshold + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureBssLost( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount, + TUint8 aFailedTxPacketCount ); + + /** + * Sets the Tx rate adaptation algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMinStepUpCheckpoint minimum and initial rate increase + * checkpoint in units of frames + * Range: [aStepDownCheckpoint,aMaxStepUpCheckpoint] + * @param aMaxStepUpCheckpoint maximum rate increase checkpoint in units + * of frames + * Range: [aStepDownCheckpoint,UCHAR_MAX] + * @param aStepUpCheckpointFactor StepUpCheckpoint is multiplied with this + * value if sending a probe frame fails + * Range: [1,aMaxStepUpCheckpoint] + * @param aStepDownCheckpoint after this many frames the need to decrease + * the rate is checked + * Range: [2,UCHAR_MAX] + * @param aMinStepUpThreshold minimum and initial StepUpThreshold + * percentage + * Range: [1,aMaxStepUpThreshold] + * @param aMaxStepUpThreshold maximum StepUpThreshold percentage + * Range: [1,100] + * @param aStepUpThresholdIncrement StepUpThreshold is incremented by this + * value if sending a probe frame fails + * Range: [0,aMaxStepUpThreshold] + * @param aStepDownThreshold if the percentage of frames which failed to + * be transmitted at the originally requested rate is at least + * aStepDownThreshold at the aStepDownCheckpoint, the rate will + * be decreased + * Range: [1,100] + * @param aDisableProbeHandling if EFalse, the rate adaptation algorithm + * handles the first frame transmitted after a rate increase in a + * special way. Otherwise the special handling is disabled + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetTxRateAdaptParams( + WlanContextImpl& aCtxImpl, + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ); + + /** + * Configures Tx rate policy objects, sets the policy object to use for + * every Tx Queue / QoS AC, and also sets the Initial Max Tx Rate to be + * used for the configured policy objects + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy rate policy (policy objects) + * @param aQueue2RateClass Tx queue (AC) to rate policy object mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for the + * policy objects + * @param aAutoRatePolicy auto rate policy + * @param aHtMcsPolicy HT MCS policy + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ); + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aToLightPsTimeout time interval in microseconds after which + * transition from Active mode to Light PS mode is considered + * @param aToLightPsFrameThreshold frame count threshold used when + * considering transition from Active to Light PS mode + * @param aToActiveTimeout time interval in microseconds after which the + * frame counter used when considering transition from Light PS + * to Active mode is reset + * @param aToActiveFrameThreshold frame count threshold used when + * considering transition from Light PS to Active mode + * @param aToDeepPsTimeout time interval in microseconds after which + * transition from Light PS mode to Deep PS mode is considered + * @param aToDeepPsFrameThreshold frame count threshold used when + * considering transition from Light PS to Deep PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetPowerModeManagementParameters( + WlanContextImpl& aCtxImpl, + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * Configures dynamic power mode management traffic override + * + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting + * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting + * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC + * setting + * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC + * setting + * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting + * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting + * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC + * setting + * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC + * setting + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& aCtxImpl, + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ); + + /** + * Gets data frame Rx & Tx statistics + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetFrameStatistics( WlanContextImpl& aCtxImpl ); + + /** + * Configures U-APSD usage + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aMaxServicePeriodLength + * @param aUapsdForVoice if ETrue the Voice AC is made both trigger and + * delivery enabled when connecting to a QoS AP + * supporting U-APSD. + * Otherwise it's made neither trigger nor delivery + * enabled + * @param aUapsdForVideo if ETrue the Video AC is made both trigger and + * delivery enabled + * when connecting to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor delivery + * enabled + * @param aUapsdForBestEffort if ETrue the Best Effort AC is made both + * trigger and delivery enabled when connecting + * to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor + * delivery enabled + * @param aUapsdForBackground if ETrue the Background AC is made both + * trigger and delivery enabled when connecting + * to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor + * delivery enabled + */ + virtual TBool ConfigureUapsd( + WlanContextImpl& aCtxImpl, + TMaxServicePeriodLength aMaxServicePeriodLength, + TBool aUapsdForVoice, + TBool aUapsdForVideo, + TBool aUapsdForBestEffort, + TBool aUapsdForBackground ); + + /** + * Reconfigures the specified Tx queue if necessary + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQueueId ID of the queue to reconfigure + * @param aMediumTime The amount of time the queue is allowed to access + * the WLAN air interface. + * @param aMaxTxMSDULifetime Maximum Transmit MSDU Lifetime to be used + * for the specified queue. + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxQueueIfNecessary( + WlanContextImpl& aCtxImpl, + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ); + + /** + * Get our own MAC address + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetMacAddress( + WlanContextImpl& aCtxImpl ); + + /** + * Triggers the setting of the Tx offset on the protocol stack side for + * every frame type which can be transmitted + * + * @param aCtxImpl statemachine context + */ + virtual void SetProtocolStackTxOffset( WlanContextImpl& aCtxImpl ) const; + + /** + * Configures ARP IP address filtering + * + * @param aCtxImpl statemachine context + * @param aEnableFiltering If ETrue, filtering is enabled + * If EFalse, filtering is disabled + * @param aIpv4Address If the target IP Address in a received ARP request + * doesn't match this address, the packet shall be discarded + * on the lower layers. + * Relevant only when enabling filtering. + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureArpIpAddressFiltering( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ); + + /** + * Configures HT Block Ack use + * + * @param aCtxImpl statemachine context + * @param aTxBlockAckUsage Bit map defining Block Ack use in Tx direction + * @param aRxBlockAckUsage Bit map defining Block Ack use in Rx direction + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureHtBlockAck( + WlanContextImpl& aCtxImpl, + TUint8 aTxBlockAckUsage, + TUint8 aRxBlockAckUsage ); + + /** + * Configures Proprietary SNAP header. + * Valid received 802.11 Data frames containing this SNAP header + * are accepted and forwarded to the WLAN Management Client. + * + * @param aCtxImpl statemachine context + * @param + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureProprietarySnapHdr( + WlanContextImpl& aCtxImpl, + const TSnapHeader& aSnapHeader ); + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl global state machine context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual TBool TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ); + + /** + * Write for management data + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl statemachine context + * @param aDataBuffer meta header of the frame to be transmitted + */ + virtual void TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ); + + /** + * From MWlanUserEvent + * Make system ready for unloading + * + * @since S60 3.1 + */ + virtual void FinitSystem( WlanContextImpl& aCtxImpl ); + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + virtual TBool CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& + aCommandCompletionParams ); + + virtual void Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ); + + // Frame receive + + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + // packet scheduler client + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + /** + * Method called when Packet Scheduler's packet scheduling method + * should be called, as there exists a packet that is suitable for + * transmission. + * NOTE: if any other Packet Scheduler method is called within this + * context the result is undefined. + * + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ); + + /** + * Method called when packet has been flushed (removed) + * from packet scheduler + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet that was flushed + * @param aMetaHeader frame meta header + */ + virtual void OnPacketFlushEvent( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ); + + /** + * Timer timeout function + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Voice Call Entry timer timeout function + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnVoiceCallEntryTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Null timer timeout function + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnNullTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * No Voice timer timeout function + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnNoVoiceTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * To be called upon Keep Alive Timer timeout + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnKeepAliveTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Active to Light PS timer timeout function + * + * @since S60 v5.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnActiveToLightPsTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Light PS to Active timer timeout function + * + * @since S60 v5.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnLightPsToActiveTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Light PS to Deep PS timer timeout function + * + * @since S60 v5.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnLightPsToDeepPsTimerTimeout( WlanContextImpl& aCtxImpl ); + + virtual void OnDfc( TAny* aCtx ); + + /** + * Request to send a Null Data Frame + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQosNull ETrue if a QoS Null Data frame should be transmitted + * EFalse if a regular Null Data frame should be transmitted + * @return ETrue if the send request was successfully submitted + * EFalse otherwise + */ + virtual TBool TxNullDataFrame( + WlanContextImpl& aCtxImpl, + TBool aQosNull ); + +public: // new methods + + virtual void Entry( WlanContextImpl& aCtxImpl) = 0; + virtual void Exit( WlanContextImpl& aCtxImpl) = 0; + + /** + * Returns the states name + * @param aLength (OUT) length of the name of the state + * @return a pointer to begin of a buffer of name of the state + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const = 0; +#endif // !NDEBUG + +protected: + + /** + * C++ default constructor. + */ + WlanMacState() {}; + + /** + * Destructor. + */ + virtual ~WlanMacState() {}; + + // New methods + + // Indications + + virtual TBool DoErrorIndication( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus ); + + /** + * Indicates Consecutive Beacons Lost + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutiveBeaconsLostIndication( WlanContextImpl& aCtxImpl ); + + /** + * Indicates Consecutive Tx Failures + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutiveTxFailuresIndication( WlanContextImpl& aCtxImpl ); + + /** + * Indicates Consecutive 802.11 Power Management Mode Set Failures + * to WLAN Mgmt Client; if necessary + * + * @since S60 5.0 + * @param aCtxImpl global statemachine context + */ + virtual void DoConsecutivePwrModeSetFailuresIndication( + WlanContextImpl& aCtxImpl ); + + /** + * Indicates BSS Regained + * to WLAN Mgmt Client; if necessary + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void DoRegainedBSSIndication( WlanContextImpl& aCtxImpl ); + + virtual void DoRadarIndication( WlanContextImpl& aCtxImpl ); + + virtual void DoRcpiIndication( + WlanContextImpl& aCtxImpl, + WHA::TRcpi aRcpi ); + + /** + * Indicates that the WLAN device has detected problems in the power + * save mode operation of the AP + * + * @param aCtxImpl global statemachine context + */ + virtual void DoPsModeErrorIndication( WlanContextImpl& aCtxImpl ); + + /** + * Called from SetPowerMode() when desired power mode + * differs from currently used one + * @param aCtxImpl statemachine context + */ + virtual TBool OnDot11PwrMgmtTransitRequired( + WlanContextImpl& aCtxImpl ); + + /** + * Resolves is a frame given type and subtype + * by comparing 2 frame control field LO bytes + * @param aLhs a frame control field LO byte + * @param aRhs a frame control field LO byte + * @param aTypeMatch (OUT) + * ETrue = type fields matched, EFalse = type fields did NOT match + * @return ETrue = was a given type and subtype, + * EFalse = was not a given type and subtype + */ + static TBool IsRequestedFrameType( + TUint8 aLhs, + TUint8 aRhs, + TBool& aTypeMatch); + + /** + * Requests a new oid = signals completion of oid + * @param aCtxImpl statemachine context + * @param aReason reason code to user mode + */ + static void OnOidComplete( + WlanContextImpl& aCtxImpl, + TInt aReason = KErrNone, + const TAny* aData = NULL, + TUint32 aLengthInBytes = 0 ); + + static void OnTxProtocolStackDataComplete( + WlanContextImpl& aCtxImpl, + TDataBuffer* aMetaHeader, + TInt aCompletionCode = KErrNone ); + + static void OnMgmtPathWriteComplete( + WlanContextImpl& aCtxImpl, + TInt aCompletionCode = KErrNone ); + + /** + * Sends an indication of an event to WLM + * @param aCtxImpl statemachine context + * @param aIndication an event that has occurred see #TIndication + */ + static void OnInDicationEvent( + WlanContextImpl& aCtxImpl, + TIndication aIndication ); + + /** + * Determines the Tx offset for every frame type which can be transmitted + * + * @param aCtxImpl global statemachine context + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames + * @param aDot11FrameTxOffset Tx offset for complete 802.11 frames + * @param aSnapFrameTxOffset Tx offset for SNAP frames + */ + void DetermineTxOffsets( + WlanContextImpl& aCtxImpl, + TUint32& aEthernetFrameTxOffset, + TUint32& aDot11FrameTxOffset, + TUint32& aSnapFrameTxOffset ) const; + +private: + + // Prohibit copy constructor. + WlanMacState( const WlanMacState& ); + // Prohibit assigment operator. + WlanMacState& operator= ( const WlanMacState& ); + +private: // Data + + }; + +#endif // WLANMACSTATE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacManagementSideUmac.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacManagementSideUmac.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanManagementSideUmac class. +* +*/ + +/* +* %version: 15 % +*/ + +#ifndef WLANMANAGEMENTSIDEUMAC_H +#define WLANMANAGEMENTSIDEUMAC_H + +#include "umacoidmsg.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +struct SOidMsgStorage; + +/** +* +*/ +class MWlanManagementSideUmac + { +public: + + virtual ~MWlanManagementSideUmac() {}; + + /** + * OID request handler routine + * @param aOutputBuffer Pointer to the output buffer (query-operations) + * @param aOutputBufferSize Size of the buffer pointed to by aOutputBuffer + * @return Status of the operation see #TStatus + */ + virtual void HandleOid( + const TOIDHeader* aOid, + TAny* aOutputBuffer, + TUint aOutputBufferSize) = 0; + + virtual void AttachWsa( WHA::Wha* aWha ) = 0; + + virtual TBool Init() = 0; + + virtual void BootUp( + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ) = 0; + + virtual void FinitSystem() = 0; + + /** + * Write management frame. + * @param aDataBuffer meta header of the frame to be transmitted + * @return KErrNone + */ + virtual void WriteMgmtFrame(TDataBuffer& aDataBuffer) = 0; + + /** + * Gets the WLAN vendor needs for extra space (bytes) in frame buffers + * + * @param aRxOffset How much extra space needs to be reserved + * in the Rx buffer before every Rx frame that is received from the + * WHA layer. + * @param aTxHeaderSpace How much extra space needs to be reserved + * in the Tx buffer before every Tx frame that is given to the + * WHA layer. + * @param aTxTrailerSpace How much extra space needs to be reserved + * in the Tx buffer after every Tx frame that is given to the + * WHA layer. + */ + virtual void GetFrameExtraSpaceForVendor( + TUint8& aRxOffset, + TUint8& aTxHeaderSpace, + TUint8& aTxTrailerSpace ) const = 0 ; + }; + +#endif // WLANMANAGEMENTSIDEUMAC_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacManagementSideUmacCb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacManagementSideUmacCb.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanManagementSideUmacCb class. +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef WLANMANAGEMENTSIDEUMACB_H +#define WLANMANAGEMENTSIDEUMACB_H + +class TDataBuffer; +struct TMacAddress; + +/** +* Callback interface class for oid completion and stuff +*/ +class WlanManagementSideUmacCb + { +public: // Types + + struct SOidOutputData + { + public: + + TUint32 iOidId; + TAny* iBufferSupplied; + TUint32 iLengthOfBufferSupplied; + + const TAny* iOidData; + TUint32 iLengthOfDataInBytes; + + SOidOutputData() + : iOidId( 0 ), + iBufferSupplied( NULL ), + iLengthOfBufferSupplied( 0 ), + iOidData( NULL ), + iLengthOfDataInBytes( 0 ) {}; + + private: + + /** Prohibit assignment operator */ + SOidOutputData& operator= ( const SOidOutputData& aObj ); + /** Prohibit copy constructor */ + SOidOutputData( const SOidOutputData& ); + }; + +public: + + // dtor + virtual ~WlanManagementSideUmacCb(); + + void Attach( WlanManagementSideUmacCb& aSelf ); + void Detach(); + + /** + * Called from statemachine when oid has been completed. + * Triggers handling of a new oid + * @param aOid OID handled + * @param aReason completion code + */ + virtual void OnOidCompleted( TInt aReason, SOidOutputData& OidOutputData ); + + /** + * Sets the Tx offset for every frame type which can be transmitted + * + * @since S60 5.0 + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames and Ethernet + * Test frames + * @param aDot11FrameTxOffset Tx offset for 802.11 frames + * @param aSnapFrameTxOffset Tx offset for SNAP frames + */ + virtual void SetMgmtSideTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ); + + /** + * Gets buffer for Rx data + * @param aLengthinBytes Requested buffer length + * @return buffer for Rx data upon success + * NULL otherwise + */ + virtual TUint8* GetBufferForRxData( TUint aLengthinBytes ); + + /** + * Get DMA xfer suitable Tx buffer for UMAC's internal use + * + * @since S60 3.1 + * @returns begin of the memory that can be used for DMA xfer + */ + virtual TUint8* DmaPrivateTxMemory(); + + /** + * Completes a data read operation from management side + * + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + */ + virtual void MgmtDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * Completes a data write operation from management side + * @param aErr completion code + */ + virtual void MgmtPathWriteComplete( TInt aErr ); + + /** + * Sends a indication to the management side + * @param aIndication indication code + */ + virtual void OnInDicationEvent( TIndication aIndication ); + + /** + * Frees the specified Rx frame buffer + * + * @param aBufferToFree The buffer to free + */ + virtual void MarkRxBufFree( TUint8* aBufferToFree ); + + virtual void RegisterTimeout( + TUint32 aTimeoutInMicroSeconds, + TWlanTimer aTimer = EWlanDefaultTimer ); + virtual void CancelTimeout( TWlanTimer aTimer = EWlanDefaultTimer ); + + virtual void RegisterDfc( TAny* aCntx ); + virtual void CancelDfc(); + + /** + * Allocates Rx frame meta header + * @return Rx frame meta header upon success + * NULL otherwise + */ + virtual TDataBuffer* GetRxFrameMetaHeader(); + + /** + * Deallocates Rx frame meta header + * @param aMetaHeader Meta header to deallocate + */ + virtual void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ); + +protected: + + WlanManagementSideUmacCb() : iSelf( NULL ) {}; + +private: + + // Prohibit copy constructor + WlanManagementSideUmacCb( const WlanManagementSideUmacCb& ); + // Prohibit assigment operator + WlanManagementSideUmacCb& operator= ( const WlanManagementSideUmacCb& ); + +private: // Data + + /** pointer to self */ + WlanManagementSideUmacCb* iSelf; + }; + +#endif // WLANMANAGEMENTSIDEUMACB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacMib.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the SWlanMib structure. +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef UMACMIB_H +#define UMACMIB_H + +#include "802dot11DefaultValues.h" +#include "wha_mibDefaultvalues.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +/** +* This attribute shall specify the number of TUs that a +* responding STA should wait for the next frame in the +* authentication sequence +*/ +const TUint32 dot11AuthenticationResponseTimeOut + = EDot11AuthenticateResponseTimeoutDefault; + +/** +* This attribute shall specify the number of TUs that a +* requesting STA should wait for a response to a +* transmitted association-request MMPDU +*/ +const TUint32 dot11AssociateResponseTimeout + = EDot11AssociationResponseTimeOutDefault; + +/** +* This structure holds 802.11 MIB values +*/ +struct SWlanMib + { + /** + * After exceeding this number of consecutive failed transmissions indicate + * BSS lost; by default + */ + enum { KFailedTxPacketCountThresholdDefault = 4 }; + + /** Ctor */ + inline SWlanMib(); + + /** + * The MAC address assigned to this STA + */ + TMacAddress dot11StationId; + /** + * The MaxTransmitMSDULifetime shall be the elapsed time in TU, after the + * initial transmission of an MSDU, after which further attempts to transmit + * the MSDU shall be terminated. + * The Lifetime may be specified separately for every WMM Access Category, + * i.e. Tx queue. + * Indexed with WHA::TQueueId + */ + TUint32 dot11MaxTransmitMSDULifetime[WHA::EQueueIdMax]; + /** MaxTransmitMSDULifetime default value */ + TUint32 dot11MaxTransmitMSDULifetimeDefault; + /** + * This attribute shall indicate the number of octets in an MPDU, below + * which an RTS/CTS handshake shall not be performed. An RTS/CTS + * handshake shall be performed at the beginning of any frame exchange + * sequence where the MPDU is of type Data or Management, the MPDU has an + * individual address in the Address1 field, and the length of the MPDU is + * greater than this threshold. Setting this attribute to be larger than + * the maximum MSDU size shall have the effect of turning off the RTS/CTS + * handshake for frames of Data or Management type transmitted by this STA. + * Setting this attribute to zero shall have the effect of turning on the + * RTS/CTS handshake for all frames of Data or Management type transmitted + * by this STA. + */ + TUint32 dot11RTSThreshold; + /** The Tx power level used to transmit data */ + WHA::TPowerLevel dot11CurrentTxPowerLevel; + /** The wlan wake-up interval in BSS mode */ + WHA::TWlanWakeUpInterval iWlanWakeupInterval; + /** + * Specifies the value of N for WLAN wake-up interval modes 2 and 3. So, + * is relevant only for wake-up interval modes 2 & 3 + */ + TUint8 iWlanListenInterval; + /** + * The number of consecutive beacons that can be lost in infrastructure + * mode before the WLAN device should send BSSLost event to us + */ + TUint32 iBeaconLostCount; + /** + * The number of consecutive transmissions that can fail totally before + * we indicate BSS lost + */ + TUint8 iFailedTxPacketCountThreshold; + /** + * The amount of time a Tx queue is allowed to access the WLAN air + * interface during one second interval. The unit of the parameter is 32 + * microseconds. Value 0 means that the Medium Time is unlimited. + * Indexed with WHA::TQueueId + */ + TUint16 iMediumTime[WHA::EQueueIdMax]; + +private: + /** Prohibit copy constructor */ + SWlanMib( const SWlanMib& ); + /** Prohibit assigment operator */ + SWlanMib& operator= ( const SWlanMib& ); + }; + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline SWlanMib::SWlanMib() : + dot11StationId( KZeroMacAddr ), + // dot11MaxTransmitMSDULifetimeDefault is properly initialized in + // WlanDot11State::OnConfigureUmacMib + dot11MaxTransmitMSDULifetimeDefault( 0 ), + dot11RTSThreshold( EDot11RTSThresholdDefault ), + dot11CurrentTxPowerLevel( 0 ), + iWlanWakeupInterval( WHA::KWlanWakeUpIntervalMibDefault.iMode ), + iWlanListenInterval( WHA::KListenIntervalDefault ), + iBeaconLostCount( WHA::KBeaconLostCountDefault ), + iFailedTxPacketCountThreshold( KFailedTxPacketCountThresholdDefault ) + { + // dot11MaxTransmitMSDULifetime is properly initialized in + // WlanDot11State::OnConfigureUmacMib + os_memset( + dot11MaxTransmitMSDULifetime, + 0, + sizeof( dot11MaxTransmitMSDULifetime) ); + + // iMediumTime is properly initialized in + // WlanDot11State::OnConfigureUmacMib + os_memset( iMediumTime, 0, sizeof( iMediumTime) ); + } + +#endif // UMACMIB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPRNGenerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPRNGenerator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPRNGenerator class. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANPNRGENERATOR_H +#define WLANPNRGENERATOR_H + +/** +* Class implements a pseudorandom number generator of 32 bit unsigned integers +* +* Full periodic PRN generator. +* All the numbers between 0 and 2pow31 - 1 are generated before repeating. +* Executes efficiently with 32-bit arithmetic +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanPRNGenerator + { + enum { EMultiplier = 16807 /* 7pow5 */}; + enum { EModulus = 2147483647 /* 2pow31 - 1 */}; + +public: + + /** + * C++ default constructor. + */ + inline WlanPRNGenerator(); + + /** + * PRN generation function. + * @since S60 3.1 + * @return generated PRN + */ + inline TUint32 Generate(); + +private: + + // Prohibit copy constructor + WlanPRNGenerator( const WlanPRNGenerator& ); + // Prohibit assigment operator + WlanPRNGenerator& operator= ( const WlanPRNGenerator& ); + +private: // Data + + /** PRN value */ + TUint32 iValue; + }; + +#include "UmacPRNGenerator.inl" + +#endif // WLANPNRGENERATOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPRNGenerator.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPRNGenerator.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanPRNGenerator inline methods. +* +*/ + +/* +* %version: 5 % +*/ + +extern TUint32 random( void ); + +inline WlanPRNGenerator::WlanPRNGenerator() : + // to keep static code analysers happy. Real initialization below + iValue( 0 ) + { + /// initiliase seed + iValue = random(); + } + +inline TUint32 WlanPRNGenerator::Generate() + { + iValue = ( EMultiplier * iValue ) % EModulus; + return iValue; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilter.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanPrivacyModeFilter class +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef MWLANPRIVACYMODEFILTER_H +#define MWLANPRIVACYMODEFILTER_H + +struct SDataFrameHeader; + +/** +* Class declares an interface for privacy mode rx filters +*/ +class MWlanPrivacyModeFilter + { +public: + + /** Dtor */ + virtual ~MWlanPrivacyModeFilter() {}; + + /** + * Filtering function for Rx-data frames + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const = 0; + }; + +#endif // MWLANPRIVACYMODEFILTER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilter1x.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilter1x.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilter1x class +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANPRIVACYMODEFILTER1X_H +#define WLANPRIVACYMODEFILTER1X_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements privacy mode 802.1x rx filter +* which is used when 802.1x is the active privacy mode +*/ +class WlanPrivacyModeFilter1x : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilter1x() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilter1x() {}; + + /** + * Filtering function for Rx-data frames + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor. + WlanPrivacyModeFilter1x( const WlanPrivacyModeFilter1x& ); + // Prohibit assigment operator. + WlanPrivacyModeFilter1x& operator= ( + const WlanPrivacyModeFilter1x& ); + }; + +#endif // WLANPRIVACYMODEFILTER1X_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterMixedMode1x.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterMixedMode1x.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilterMixedMode1x class +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANPRIVACYMODEFILTERMIXEDMODE1X_H +#define WLANPRIVACYMODEFILTERMIXEDMODE1X_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements mixed mode 802.1x rx filter +*/ +class WlanPrivacyModeFilterMixedMode1x : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilterMixedMode1x() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilterMixedMode1x() {}; + + /** + * Filtering function for Rx-data frames + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor + WlanPrivacyModeFilterMixedMode1x( + const WlanPrivacyModeFilterMixedMode1x& ); + // Prohibit assigment operator + WlanPrivacyModeFilterMixedMode1x& operator= ( + const WlanPrivacyModeFilterMixedMode1x& ); + }; + +#endif // WLANPRIVACYMODEFILTERMIXEDMODE1X_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterMixedModeWep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterMixedModeWep.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilterMixedModeWep class +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANPRIVACYMODEFILTERMIXEDMODEWEP_H +#define WLANPRIVACYMODEFILTERMIXEDMODEWEP_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements mixed mode WEP rx filter +*/ +class WlanPrivacyModeFilterMixedModeWep : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilterMixedModeWep() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilterMixedModeWep() {}; + + /** + * Filtering function for Rx-data frames + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor + WlanPrivacyModeFilterMixedModeWep( + const WlanPrivacyModeFilterMixedModeWep& ); + // Prohibit assigment operator + WlanPrivacyModeFilterMixedModeWep& operator= ( + const WlanPrivacyModeFilterMixedModeWep& ); + }; + +#endif // WLANPRIVACYMODEFILTERMIXEDMODEWEP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterNone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterNone.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilterNone class +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANPRIVACYMODEFILTERNONE_H +#define WLANPRIVACYMODEFILTERNONE_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements privacy mode none rx filter +* which is used when we are not in a privacy mode +*/ +class WlanPrivacyModeFilterNone : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilterNone() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilterNone() {}; + + /** + * Filtering function for Rx-data frames. + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor. + WlanPrivacyModeFilterNone( const WlanPrivacyModeFilterNone& ); + // Prohibit assigment operator. + WlanPrivacyModeFilterNone& operator= ( + const WlanPrivacyModeFilterNone& ); + }; + +#endif // WLANPRIVACYMODEFILTERNONE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterWep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterWep.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilterWep class +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef UMACPRIVACYMODEFILTERWEP_H +#define UMACPRIVACYMODEFILTERWEP_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements privacy mode WEP rx filter +* which is used when 802.11 WEP is the active privacy mode +*/ +class WlanPrivacyModeFilterWep : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilterWep() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilterWep() {}; + + /** + * Filtering function for Rx-data frames. + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor + WlanPrivacyModeFilterWep( const WlanPrivacyModeFilterWep& ); + // Prohibit assigment operator + WlanPrivacyModeFilterWep& operator= ( + const WlanPrivacyModeFilterWep& ); + }; + +#endif // UMACPRIVACYMODEFILTERWEP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterWpa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacPrivacyModeFilterWpa.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilterWpa class +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANPRIVACYMODEFILTERWPA_H +#define WLANPRIVACYMODEFILTERWPA_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements privacy mode WPA rx filter +* which is used when WPA is the active privacy mode +*/ +class WlanPrivacyModeFilterWpa : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilterWpa() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilterWpa() {}; + + /** + * Filtering function for Rx-data frames + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor + WlanPrivacyModeFilterWpa( const WlanPrivacyModeFilterWpa& ); + // Prohibit assigment operator + WlanPrivacyModeFilterWpa& operator= ( + const WlanPrivacyModeFilterWpa& ); + }; + +#endif // WLANPRIVACYMODEFILTERWPA_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacProtocolStackSideUmac.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacProtocolStackSideUmac.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanProtocolStackSideUmac class. +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANPROTOCOLSTACKSIDEUMAC_H +#define WLANPROTOCOLSTACKSIDEUMAC_H + +struct TMacAddress; +class TDataBuffer; + +/** +* +*/ +class MWlanProtocolStackSideUmac + { +public: + + virtual ~MWlanProtocolStackSideUmac() {}; + + virtual const TMacAddress& StationId() const = 0; + + /** + * Triggers the setting of the Tx offset for every frame type which can be + * transmitted + */ + virtual void SetTxOffset() = 0; + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void TxProtocolStackData( + TDataBuffer& aDataBuffer, + TBool aMore ) = 0; + + /** + * Gets the WLAN vendor needs for extra space (bytes) in frame buffers + * + * @param aRxOffset How much extra space needs to be reserved + * in the Rx buffer before every Rx frame that is received from the + * WHA layer. + * @param aTxHeaderSpace How much extra space needs to be reserved + * in the Tx buffer before every Tx frame that is given to the + * WHA layer. + * @param aTxTrailerSpace How much extra space needs to be reserved + * in the Tx buffer after every Tx frame that is given to the + * WHA layer. + */ + virtual void GetFrameExtraSpaceForVendor( + TUint8& aRxOffset, + TUint8& aTxHeaderSpace, + TUint8& aTxTrailerSpace ) const = 0 ; + + /** + * Is protocol stack side transmission permitted + * UMAC adaptation needs to call this method every time before calling + * TxProtocolStackData() to check if it is allowed to call that + * method! + * + * @param aTxQueueState If the return value is ETrue, the state + * (full / not full) of every WHA transmit queue. Otherwise, not + * valid. + * Note! A frame shall not be submitted to a full queue - even if + * the return value would be ETrue + * @return ETrue if Tx frame submission is permitted + * EFalse if Tx frame submission is not permitted + */ + virtual TBool TxPermitted( TWhaTxQueueState& aTxQueueState ) const = 0; + + /** + * Is user data Tx enabled + * + * @return ETrue if user data Tx is enabled + * EFalse if user data Tx is not enabled + */ + virtual TBool UserDataTxEnabled() const = 0; + }; + +#endif // WLANPROTOCOLSTACKSIDEUMAC_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacProtocolStackSideUmacCb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacProtocolStackSideUmacCb.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanProtocolStackSideUmacCb class. +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef WLANPROTOCOLSTACKSIDEUMACCB_H +#define WLANPROTOCOLSTACKSIDEUMACCB_H + +class TDataBuffer; + +/** +* +*/ +class WlanProtocolStackSideUmacCb + { +public: + + // dtor + virtual inline ~WlanProtocolStackSideUmacCb(); + + /** + * + * UMAC adaptation needs to call this method! + */ + inline void AttachProtocolStackSideUmacCb( + WlanProtocolStackSideUmacCb& aSelf ); + + /** + * + * UMAC adaptation needs to call this method! + */ + inline void DetachProtocolStackSideUmacCb(); + + /** + * Sets the Tx offset for every frame type which can be transmitted + * UMAC adaptation needs to implement this method! + * + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames + */ + virtual void SetProtocolStackTxOffset( + TUint32 aEthernetFrameTxOffset ); + + /** + * Called when the Tx packet in question has been trasferred to the WLAN + * device. + * + * UMAC adaptation needs to implement this method! + * @param aCompletionCode Status of the operation. + * @param aMetaHeader Meta header associated with the related Tx packet + */ + virtual void OnTxProtocolStackDataComplete( + TInt aCompletionCode, + TDataBuffer* aMetaHeader ); + + /** + * Called when a Tx packet - submitted by someone else than the Protocol + * Stack Side Client - has been trasferred to the WLAN device. + * + * Note! TxProtocolStackData() must not be called in the same context in + * which this method is called (but instead e.g. via a DFC)! + * + * UMAC adaptation needs to implement this method! + */ + virtual void OnOtherTxDataComplete(); + + /** + * Called when the Tx of a frame has completed (either successfully or + * unsuccessfully). + * + * Note! TxProtocolStackData() must not be called in the same context in + * which this method is called (but instead e.g. via a DFC)! + * + * UMAC adaptation needs to implement this method! + */ + virtual void OnTxDataSent(); + + /** + * Completes a data read operation from protocol stack side + * UMAC adaptation needs to implement this method! + * + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + * @return ETrue if this event was processed successfully + * EFalse otherwise + */ + virtual TBool ProtocolStackDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * Determines if the Protocol Stack Side client is ready to handle any + * callbacks from UMAC + * UMAC adaptation needs to implement this method! + * + * @return ETrue if the client is ready + * EFalse if the client is not ready + */ + virtual TBool ProtocolStackSideClientReady() const; + + /** + * Indicates that WLAN Mgmt Client has (re-)enabled protocol stack side + * user data Tx. + * UMAC adaptation needs to implement this method! + * To quickly resume user data Tx after roaming, UMAC adaptation should call + * MWlanProtocolStackSideUmac::TxProtocolStackData() as soon as possible + * after receiving this indication. Note! TxProtocolStackData() must not be + * called in the same context in which this method is called (but instead + * e.g. via a DFC)! + */ + virtual void UserDataReEnabled(); + +protected: + + WlanProtocolStackSideUmacCb() : iSelf( NULL ) {}; + +private: + + // Prohibit copy constructor + WlanProtocolStackSideUmacCb( const WlanProtocolStackSideUmacCb& ); + // Prohibit assigment operator + WlanProtocolStackSideUmacCb& operator= ( + const WlanProtocolStackSideUmacCb& ); + +private: // Data + + /** pointer to self */ + WlanProtocolStackSideUmacCb* iSelf; + }; + +#include "UmacProtocolStackSideUmacCb.inl" + +#endif // WLANPROTOCOLSTACKSIDEUMACCB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacProtocolStackSideUmacCb.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacProtocolStackSideUmacCb.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanProtocolStackSideUmacCb inline methods. +* +*/ + +/* +* %version: 9 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanProtocolStackSideUmacCb::~WlanProtocolStackSideUmacCb() + { + iSelf = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanProtocolStackSideUmacCb::AttachProtocolStackSideUmacCb( + WlanProtocolStackSideUmacCb& aSelf ) + { + iSelf = &aSelf; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanProtocolStackSideUmacCb::DetachProtocolStackSideUmacCb() + { + iSelf = NULL; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacTimerClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacTimerClient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: timer client callback interface +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANTIMERCLIENT_H +#define WLANTIMERCLIENT_H + +/** + * timer client callback interface + * + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class MWlanTimerClient + { + +public: // New functions + + /** + * timer callback + * + * @since S60 v3.1 + */ + virtual void OnTimeout( TWlanTimer aTimer ) = 0; + + }; + +#endif // WLANTIMERCLIENT_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacTxRateAdaptation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacTxRateAdaptation.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanTxRateAdaptation class +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WLANTXRATEADAPTATION_H +#define WLANTXRATEADAPTATION_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +class WlanContextImpl; + +/** +* Implements dynamic transmit rate adaptation. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanTxRateAdaptation + { + +public: + + /** + * C++ default constructor. + */ + WlanTxRateAdaptation(); + + /** + * Destructor. + */ + virtual ~WlanTxRateAdaptation() {}; + + /** + * Sets the rate adaptation object + * @since S60 3.1 + * @param aPolicyId id of the Tx rate policy for which the rates + * are set + * @param aRateBitmask contains the rates to be set + */ + TBool SetRates( TUint8 aPolicyId, WHA::TRate aRateBitmask ); + + /** + * Defines which Tx rate policy should be used when sending via + * the specified queue + * + * @since S60 3.1 + * @param aQueueId id of the Tx queue + * @param aPolicyId id of the Tx rate policy + */ + void SetPolicy( WHA::TQueueId aQueueId, TUint8 aPolicyId ); + + /** + * Sets the current max Tx rate which should be initially used when sending + * frames using the specified Tx rate policy. + * If this rate is not present in the specified rate policy, or if + * it is not supported either by the nw or by WHA layer, the next possible + * lower rate will be used instead. + * However, if the specified rate is lower that any rate in the specified + * rate policy, the lowest rate in the policy will be used. + * + * @since S60 3.1 + * @param aPolicyId id of the Tx rate policy + * @param aRate initial max Tx rate + */ + void SetCurrentMaxTxRate( TUint8 aPolicyId, WHA::TRate aRate ); + + /** + * Sets the Tx rate adaptation algorithm parameters + * + * @since S60 3.1 + * @param aMinStepUpCheckpoint minimum and initial rate increase + * checkpoint in units of frames + * Range: [aStepDownCheckpoint,aMaxStepUpCheckpoint] + * @param aMaxStepUpCheckpoint maximum rate increase checkpoint in units + * of frames + * Range: [aStepDownCheckpoint,UCHAR_MAX] + * @param aStepUpCheckpointFactor StepUpCheckpoint is multiplied with this + * value if sending a probe frame fails + * Range: [1,aMaxStepUpCheckpoint] + * @param aStepDownCheckpoint after this many frames the need to decrease + * the rate is checked + * Range: [2,UCHAR_MAX] + * @param aMinStepUpThreshold minimum and initial StepUpThreshold + * percentage + * Range: [1,aMaxStepUpThreshold] + * @param aMaxStepUpThreshold maximum StepUpThreshold percentage + * Range: [1,100] + * @param aStepUpThresholdIncrement StepUpThreshold is incremented by this + * value if sending a probe frame fails + * Range: [0,aMaxStepUpThreshold] + * @param aStepDownThreshold if the percentage of frames which failed to + * be transmitted at the originally requested rate is at least + * aStepDownThreshold at the aStepDownCheckpoint, the rate will + * be decreased + * Range: [1,100] + * @param aDisableProbeHandling if EFalse, the rate adaptation algorithm + * handles the first frame transmitted after a rate increase in a + * special way. Otherwise the special handling is disabled + */ + void SetAlgorithmParameters( + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ); + + /** + * Gets the current transmit rate & rate policy class to use when sending + * via the specified Tx queue + * + * @since S60 3.1 + * @param aCtxImpl Global statemachine context + * @param aQueueId ID of the Tx queue + * @param aUseSpecialRatePolicy ETrue if use of the special Tx rate + * policy is requested for this frame Tx + * @param aRate Rate to use. Note that this value is not relevant if + * autonomous rate adaptation is being used + * @param aPolicyId id of the Tx rate policy + */ + void RatePolicy( + const WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TBool aUseSpecialRatePolicy, + WHA::TRate& aRate, + TUint8& aPolicyId ) const; + + /** + * Called upon Tx operation complete + * + * @since S60 3.1 + * @param aRate the rate which was used to transmit the frame (if success) + * @param aSuccess did the send succeed + * @param aQueueId id of the queue via which the frame was transmitted + * @param aRequestedRate Tx rate that was originally requested + */ + void OnTxCompleted( + WHA::TRate aRate, + TBool aSuccess, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate ); + + /** + * Resets the state of the whole Tx rate adaptation object + */ + void Reset(); + +private: + + struct SBitRate + { + /* + * rates are in ascending order the lowest rate being the first + */ + WHA::TRate iBitRate; + // number of rates + SBitRate* iNext; + SBitRate* iPrev; + }; + + enum TRateStep + { + EKeepCurrent, + EStepDown, + EStepUp + }; + + struct SAlgorithmParams + { + /* + * minimum and initial rate increase checkpoint in units of frames + */ + TUint8 iMinStepUpCheckpoint; + /* + * maximum rate increase checkpoint in units of frames + */ + TUint8 iMaxStepUpCheckpoint; + /* + * iStepUpCheckpoint is multiplied with this value if sending a probe + * frame fails + */ + TUint8 iStepUpCheckpointFactor; + /* + * after this many frames the need to decrease the rate is checked + */ + TUint8 iStepDownCheckpoint; + /* + * minimum and initial StepUpThreshold percentage + */ + TUint8 iMinStepUpThreshold; + /* + * maximum iStepUpThreshold percentage value + */ + TUint8 iMaxStepUpThreshold; + /* + * iStepUpThreshold is incremented by this value if sending a probe + * frame fails + */ + TUint8 iStepUpThresholdIncrement; + /* + * if the percentage of frames which failed to be transmitted at the + * originally requested rate is at least iStepDownThreshold at the + * iStepDownCheckpoint, the rate will be decreased + */ + TUint8 iStepDownThreshold; + /* + * if EFalse, the rate adaptation algorithm handles the first frame + * transmitted after a rate increase in a special way. Otherwise the + * special handling is disabled + */ + TBool iDisableProbeHandling; + }; + + struct SPolicy + { + /** current Tx rate */ + SBitRate* iCurrentTxRate; + // first rate + SBitRate* iHead; + // last rate + SBitRate* iTail; + /** number of rate entrys */ + TUint iNumOfRates; + /** ETrue for a probe frame */ + TBool iProbe; + TUint iTxCount; + TUint iTxFailCount; + TUint iStepUpCheckpoint; + TUint iStepUpThreshold; + }; + + /** + * Resets the state related to the specified rate policy + * @param aPolicy the policy to reset + */ + void Reset( SPolicy& aPolicy ) const; + + /** + * Appends a rate to rate list + * @param aPolicyIndex index of the Tx rate policy to which to append + * @param aRate rate to append + */ + TBool AppendRate( TUint8 aPolicyIndex, WHA::TRate aRate ); + + /** + * Inserts a rate to rate list + * @param aPolicyIndex index of the Tx rate policy to which to insert + * @param aBlock rate list item to insert + */ + void InsertRate( TUint8 aPolicyIndex, SBitRate* aBlock ) const; + + /** + * Decrements Tx rate for the specified Tx rate policy + * @param aPolicy the policy + */ + void RateStepDown( SPolicy& aPolicy ) const; + + /** + * Increments Tx rate for the specified Tx rate policy + * @param aPolicy the policy + * @return ETrue if the operation succeeded + * EFalse if already using the highest rate + */ + TBool RateStepUp( SPolicy& aPolicy ) const; + + /** + * Called upon Tx operation complete + * @param aSuccess did the send succeed using the rate origianlly requested + * @param aPolicy policy which was used when transmitting the related frame + */ + TRateStep OnTxCompleted( + TBool aSuccess, + SPolicy& aPolicy ) const; + + // Prohibit copy constructor. + WlanTxRateAdaptation( const WlanTxRateAdaptation& ); + // Prohibit assigment operator. + WlanTxRateAdaptation& operator= + ( const WlanTxRateAdaptation& ); + +private: // Data + + SAlgorithmParams iAlgorithmParam; + + /** + * maps every Tx queue to a Tx policy + */ + TUint8 iQueue2Policy[WHA::EQueueIdMax]; + + /** + * maximum number of rate policies in use concurrently. + * We will use two policies, one for voice priority (voice AC) data + * and another for everything else, if possible. Otherwise only one policy + * is used. Parameters for policy 1 are at index 0, for policy 2 at index 1 + * and so on + */ + enum { KMaxRatePolicyCount = 2 }; + + SPolicy iPolicy[KMaxRatePolicyCount]; + }; + +#endif // WLANTXRATEADAPTATION_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacUserEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacUserEvent.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,730 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanUserEvent class +* +*/ + +/* +* %version: 34 % +*/ + +#ifndef MWLANUSEREVENT_H +#define MWLANUSEREVENT_H + +#include "umacoidmsg.h" + +class WlanContextImpl; +class TDataBuffer; +struct TMacAddress; + +/** +* Interface class for events originating from WLAN mgmt client +*/ +class MWlanUserEvent + { + +public: + + /** + * Connect (authenticate and associate) to a WLAN network + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network + * @param aBSSID BSSID of the access point + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption level + * @param aIsInfra ETrue when connecting to infrastructure network + * @param aScanResponseFrameBodyLength length of the scan response frame body + * @param aScanResponseFrameBody scan response frame body + * @param aIeData The IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * @param aIeDataLength Length of the IE(s) to be included into the + * (re-)association request + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ) = 0; + + /** + * Add TKIP key + * @param aCtxImpl statemachine context + * @param aData data blob that holds TKIP parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id field of WEP IV + * @param aMacAddr MAC address of the peer station + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddTkIPKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ) = 0; + + /** + * Add multicast TKIP key. + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the TKIP parameters. + * @param aData TKIP parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastTKIPKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ) = 0; + + /** + * Add (or replace) a pairwise AES key. + * + * @param aCtxImpl statemachine context + * @param aData AES parameters. + * @param aLength Length of the AES parameters. + * @param aMacAddr MAC address of the peer station + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddAesKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + const TMacAddress& aMacAddr ) = 0; + + /** + * Add (or replace) an AES group key. + * + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the AES parameters. + * @param aData AES parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastAesKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ) = 0; + + /** + * Add (or replace) a multicast WAPI key. + * @param aCtxImpl statemachine context + * @param aKeyIndex Value for the key id field of WEP IV. + * @param aLength Length of the WAPI parameters. + * @param aData WAPI parameters. + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddMulticastWapiKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 aLength, + const TUint8* aData ) = 0; + + /** + * Add (or replace) a pairwise WAPI key. + * + * @param aCtxImpl statemachine context + * @param aData data blob that holds WAPI parameters + * @param aLength length of the data blob + * @param aKeyIndex value for key id field of WEP IV + * @param aMacAddr MAC address of the peer station + * @return ETrue if state transition occurred, EFalse otherwise + */ + virtual TBool AddUnicastWapiKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 aLength, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ) = 0; + + /** + * Start an own IBSS network if there doesn't already exist a network + * with that name. If does then it is joined + * @param aCtxImpl statemachine context + * @param aSSID name of the network + * @param aBeaconInterval Beacon period in TUs (kusec). range:[1, 1024] + * @param aAtim ATIM window + * @param aChannel Used channel (1-14). + * Has to be legal at the current region. + * @param aEncryptionStatus, used encryption level + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool StartIBSS( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aAtim, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus) = 0; + + /** + * Scan all available networks. + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate rate that is used in active scanning see #TRate + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Scan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) = 0; + + /** + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ) = 0; + + /** + * Disconnect STA from current network. + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Disconnect( WlanContextImpl& aCtxImpl ) = 0; + + /** + * Set 802.11 power mgmt mode in infrastructure networks. + * @param aCtxImpl statemachine context + * @param aPowerMode desired power mode + * @param aDisableDynamicPowerModeManagement If ETrue, disables the dynamic + * power mode management handling. Relevant only when aPowerMode + * is EPowerModePs + * @param aWakeupModeInLightPs WLAN wake-up mode in Light PS mode + * @param aListenIntervalInLightPs specifies the value of N for wake-up + * modes 2 and 3 in Light PS mode. + * @param aWakeupModeInDeepPs WLAN wake-up mode in Deep PS mode + * @param aListenIntervalInDeepPs specifies the value of N for wake-up + * modes 2 and 3 in Deep PS mode + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ) = 0; + + /** + * Set trigger level for RCPI trigger. + * @param aCtxImpl statemachine context + * @param aRcpiTrigger RCPI trigger level + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool SetRcpiTriggerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger) = 0; + + /** + * Set transmission power level. This has to be legal at the current region. + * @param aCtxImpl statemachine context + * @param aLevel Transmission power level in mW. + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool SetTxPowerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aLevel) = 0; + + /** + * Set inital WLAN specific parameters + * @param aCtxImpl statemachine context + * @param aRTSThreshold + * @param aMaxTxMSDULifetime + * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call + * state and we transmit at least aVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this parameter, we enter Voice over WLAN Call state + * @param aVoiceCallEntryTxThreshold Threshold value for the number of + * Voice priority Tx frames to enter Voice over WLAN Call state + * @param aVoiceNullTimeout NULL frame sending interval during a Voice over + * WLAN call in U-APSD power save mode + * @param aNoVoiceTimeout after this long time of no Voice priority data + * Tx, exit Voice over WLAN call state + * @param aKeepAliveTimeout Keep Alive frame sending interval in + * infrastructure mode + * @param aSpRcpiIndicationLevel If this RCPI level is predicted to be + * reached within the time specified by aSpTimeToCountPrediction, + * a signal loss prediction indication is sent. + * @param aSpTimeToCountPrediction Specifies the time (in microseconds) + * how far into the future signal prediction is done. + * @param aSpMinIndicationInterval The minimum time difference (in + * microseconds) between two signal loss prediction indications. + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool Configure( + WlanContextImpl& aCtxImpl, + TUint32 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aVoiceNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout, + TUint32 aSpRcpiIndicationLevel, + TUint32 aSpTimeToCountPrediction, + TUint32 aSpMinIndicationInterval ) = 0; + + /** + * Add/set (or replace) a broadcast WEP key + * @param aCtxImpl statemachine context + * @param aKeyIndex Index of the key in the default key table + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @param aMac MAC address associated with the key + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ) = 0; + + /** + * Add (or replace) a unicast WEP key. + * @param aCtxImpl statemachine context + * @param aMacAddr MAC address to which the WEP key corresponds to + * @param aKeyLength Length of the key in BYTES + * @param aKey The WEP key + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]) = 0; + + /** + * Disable user data from/to protcol stack + * (802.1x: block data during authentication). + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool DisableUserData( + WlanContextImpl& aCtxImpl ) = 0; + + /** + * Enable user data from/to protcol stack + * (802.1x: pass data through after succesfull authentication) + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool EnableUserData( + WlanContextImpl& aCtxImpl ) = 0; + + /** + * Gets last RCPI value + * @param aCtxImpl statemachine context + * @return KErrNone command completed successfully + * any other = failure + */ + virtual TBool GetLastRcpi( + WlanContextImpl& aCtxImpl ) = 0; + + /** + * Adds a multicast MAC address and starts to filter (Rx) multicast + * traffic sent to any other MAC addresses than those that have been + * specified using this method + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be added + * @return + */ + virtual TBool AddMulticastAddr( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr ) = 0; + + /** + * Removes a multicast MAC address from multicast (Rx) filtering + * configuration. So any packet that we receive and which has been sent + * to the multicast address in question is not accepted any more (i.e. + * it is filtered). + * However, if there are no addresses left in the multicast (Rx) filtering + * configuration after this remove, the multicast filtering is disabled + * and all (otherwise acceptable) multicast packets are accepted again. + * @param aCtxImpl statemachine context + * @param aMacAddr The address to be removed + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool RemoveMulticastAddr( + WlanContextImpl& aCtxImpl, + TBool aRemoveAll, + const TMacAddress& aMacAddr ) = 0; + + /** + * Triggers the setting of the Tx offset on the protocol stack side for + * every frame type which can be transmitted + * + * @param aCtxImpl statemachine context + */ + virtual void SetProtocolStackTxOffset( + WlanContextImpl& aCtxImpl ) const = 0; + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl global state machine context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual TBool TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ) = 0; + + /** + * Write for management data + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl statemachine context + * @param aDataBuffer meta header of the frame to be transmitted + */ + virtual void TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ) = 0; + + /** + * System finit method. + * Make system ready for unloading + * + * @since S60 3.1 + */ + virtual void FinitSystem( WlanContextImpl& aCtxImpl ) = 0; + + /** + * Configures the parameters which define when BSS lost is indicated. + * The indication is sent when either one of the specified thresholds + * is exceeded. + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aBeaconLostCount beacon lost count threshold + * @param aFailedTxPacketCount failed Tx packet count threshold + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureBssLost( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount, + TUint8 aFailedTxPacketCount ) = 0; + + /** + * Sets the Tx rate adaptation algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aMinStepUpCheckpoint minimum and initial rate increase + * checkpoint in units of frames + * Range: [aStepDownCheckpoint,aMaxStepUpCheckpoint] + * @param aMaxStepUpCheckpoint maximum rate increase checkpoint in units + * of frames + * Range: [aStepDownCheckpoint,UCHAR_MAX] + * @param aStepUpCheckpointFactor StepUpCheckpoint is multiplied with this + * value if sending a probe frame fails + * Range: [1,aMaxStepUpCheckpoint] + * @param aStepDownCheckpoint after this many frames the need to decrease + * the rate is checked + * Range: [2,UCHAR_MAX] + * @param aMinStepUpThreshold minimum and initial StepUpThreshold + * percentage + * Range: [1,aMaxStepUpThreshold] + * @param aMaxStepUpThreshold maximum StepUpThreshold percentage + * Range: [1,100] + * @param aStepUpThresholdIncrement StepUpThreshold is incremented by this + * value if sending a probe frame fails + * Range: [0,aMaxStepUpThreshold] + * @param aStepDownThreshold if the percentage of frames which failed to + * be transmitted at the originally requested rate is at least + * aStepDownThreshold at the aStepDownCheckpoint, the rate will + * be decreased + * Range: [1,100] + * @param aDisableProbeHandling if EFalse, the rate adaptation algorithm + * handles the first frame transmitted after a rate increase in a + * special way. Otherwise the special handling is disabled + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetTxRateAdaptParams( + WlanContextImpl& aCtxImpl, + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ) = 0; + + /** + * Configures Tx rate policy objects, sets the policy object to use for + * every Tx Queue / QoS AC, and also sets the Initial Max Tx Rate to be + * used for the configured policy objects + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @param aRatePolicy rate policy (policy objects) + * @param aQueue2RateClass Tx queue (AC) to rate policy object mapping + * @param aInitialMaxTxRate4RateClass initial max Tx rate for the + * policy objects + * @param aAutoRatePolicy auto rate policy + * @param aHtMcsPolicy HT MCS policy + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ) = 0; + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aToLightPsTimeout time interval in microseconds after which + * transition from Active mode to Light PS mode is considered + * @param aToLightPsFrameThreshold frame count threshold used when + * considering transition from Active to Light PS mode + * @param aToActiveTimeout time interval in microseconds after which the + * frame counter used when considering transition from Light PS + * to Active mode is reset + * @param aToActiveFrameThreshold frame count threshold used when + * considering transition from Light PS to Active mode + * @param aToDeepPsTimeout time interval in microseconds after which + * transition from Light PS mode to Deep PS mode is considered + * @param aToDeepPsFrameThreshold frame count threshold used when + * considering transition from Light PS to Deep PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool SetPowerModeManagementParameters( + WlanContextImpl& aCtxImpl, + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) = 0; + + /** + * Configures dynamic power mode management traffic override + * + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting + * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting + * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC + * setting + * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC + * setting + * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting + * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting + * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC + * setting + * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC + * setting + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& aCtxImpl, + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ) = 0; + + /** + * Gets data frame Rx & Tx statistics + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetFrameStatistics( WlanContextImpl& aCtxImpl ) = 0; + + /** + * Configures U-APSD usage + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aMaxServicePeriodLength + * @param aUapsdForVoice if ETrue the Voice AC is made both trigger and + * delivery enabled when connecting to a QoS AP + * supporting U-APSD. + * Otherwise it's made neither trigger nor delivery + * enabled + * @param aUapsdForVideo if ETrue the Video AC is made both trigger and + * delivery enabled + * when connecting to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor delivery + * enabled + * @param aUapsdForBestEffort if ETrue the Best Effort AC is made both + * trigger and delivery enabled when connecting + * to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor + * delivery enabled + * @param aUapsdForBackground if ETrue the Background AC is made both + * trigger and delivery enabled when connecting + * to a QoS AP supporting U-APSD. + * Otherwise it's made neither trigger nor + * delivery enabled + */ + virtual TBool ConfigureUapsd( + WlanContextImpl& aCtxImpl, + TMaxServicePeriodLength aMaxServicePeriodLength, + TBool aUapsdForVoice, + TBool aUapsdForVideo, + TBool aUapsdForBestEffort, + TBool aUapsdForBackground ) = 0; + + /** + * Reconfigures the specified Tx queue if necessary + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQueueId ID of the queue to reconfigure + * @param aMediumTime The amount of time the queue is allowed to access + * the WLAN air interface. + * @param aMaxTxMSDULifetime Maximum Transmit MSDU Lifetime to be used + * for the specified queue. + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool ConfigureTxQueueIfNecessary( + WlanContextImpl& aCtxImpl, + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ) = 0; + + /** + * Get our own MAC address + * + * @since S60 v3.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred + * EFalse otherwise + */ + virtual TBool GetMacAddress( + WlanContextImpl& aCtxImpl ) = 0; + + /** + * Configures ARP IP address filtering + * + * @param aCtxImpl statemachine context + * @param aEnableFiltering If ETrue, filtering is enabled + * If EFalse, filtering is disabled + * @param aIpv4Address If the target IP Address in a received ARP request + * doesn't match this address, the packet shall be discarded + * on the lower layers. + * Relevant only when enabling filtering. + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureArpIpAddressFiltering( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ) = 0; + + /** + * Configures HT Block Ack use + * + * @param aCtxImpl statemachine context + * @param aTxBlockAckUsage Bit map defining Block Ack use in Tx direction + * @param aRxBlockAckUsage Bit map defining Block Ack use in Rx direction + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureHtBlockAck( + WlanContextImpl& aCtxImpl, + TUint8 aTxBlockAckUsage, + TUint8 aRxBlockAckUsage ) = 0; + + /** + * Configures Proprietary SNAP header. + * Valid received 802.11 Data frames containing this SNAP header + * are accepted and forwarded to the WLAN Management Client. + * + * @param aCtxImpl statemachine context + * @param + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool ConfigureProprietarySnapHdr( + WlanContextImpl& aCtxImpl, + const TSnapHeader& aSnapHeader ) = 0; + }; + +#endif // MWLANUSEREVENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaAddKey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaAddKey.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaAddKey class. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef WLANWSAADDKEY_H +#define WLANWSAADDKEY_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of Release WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaAddKey : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaAddKey() : + iKeyType( static_cast(0) ), + iKey( 0 ), + iEntryIndex( 0 ) {}; + + /** + * Destructor. + */ + virtual inline ~WlanWsaAddKey(); + + inline void Set( + WlanContextImpl& aCtxImpl, + WHA::TKeyType aKeyType, + const TAny* aKey, + TUint8 aEntryIndex ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // Prohibit copy constructor. + WlanWsaAddKey( const WlanWsaAddKey& ); + // Prohibit assigment operator. + WlanWsaAddKey& operator= ( const WlanWsaAddKey& ); + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + +private: // Data + + WHA::TKeyType iKeyType; + /** + * cipher key to add + * Not own + */ + const TAny* iKey; + TUint8 iEntryIndex; + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + }; + +#include "UmacWsaAddKey.inl" + +#endif // WLANWSAADDKEY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaAddKey.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaAddKey.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanWsaAddKey inline methods. +* +*/ + +/* +* %version: 9 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanWsaAddKey::~WlanWsaAddKey() + { + iKey = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanWsaAddKey::Set( + WlanContextImpl& /*aCtxImpl*/, + WHA::TKeyType aKeyType, + const TAny* aKey, + TUint8 aEntryIndex ) + { + iKeyType = aKeyType; + iKey = aKey; + iEntryIndex = aEntryIndex; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaCommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaCommand.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaCommand class. +* +*/ + +/* +* %version: 22 % +*/ + +#ifndef WLANWSACOMMAND_H +#define WLANWSACOMMAND_H + +#include "UmacMacState.h" + +class WlanContextImpl; +class WlanMacActionState; + +/** +* WHA command base class. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaCommand : public WlanMacState + { + +public: + + /** + * Destructor. + */ + virtual ~WlanWsaCommand(); + +public: + + virtual void Exit( WlanContextImpl& aCtxImpl ); + + void Act( WlanContextImpl& aCtxImpl, TUint32 aAct ) const; + + inline void History( WlanMacActionState& aState ); + +protected: + + /** + * C++ default constructor. + */ + WlanWsaCommand () : iMacActionHistoryState( NULL ) {}; + + void TraverseToHistoryState( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + inline WlanMacActionState& History(); + + void ChangeState( + WlanContextImpl& aCtxImpl, + WlanWsaCommand& aPrevState, + WlanMacActionState& aNewState ) const; + +private: + + /** + * Transmit a protocol stack frame + * + * The frame to be sent needs to be in 802.3 format + * @param aCtxImpl global state machine context + * @param aDataBuffer meta header of the frame to be transmitted + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual TBool TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ); + + virtual void TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ); + + // from wha side + + virtual void Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ); + + // Frame receive + + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + // from packet scheduler + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ); + + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ); + + /** + * Method called when Packet Scheduler's packet scheduling method + * should be called, as there exists a packet that is suitable for + * transmission. + * NOTE: if any other Packet Scheduler method is called within this + * context the result is undefined. + * + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ); + + virtual void OnPacketPushPossible( + WlanContextImpl& aCtxImpl ); + +private: // Data + + /** + * History (previous) state + * Not own + */ + WlanMacActionState* iMacActionHistoryState; + }; + +#include "UmacWsaCommand.inl" + +#endif // WLANWSACOMMAND_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaCommand.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaCommand.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanWsaCommand inline methods. +* +*/ + +/* +* %version: 9 % +*/ + +#include "UmacMacActionState.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanMacActionState& WlanWsaCommand::History() + { + return *iMacActionHistoryState; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanWsaCommand::History( + WlanMacActionState& aState ) + { + iMacActionHistoryState = &aState; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaComplexCommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaComplexCommand.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaComplexCommand class. +* +*/ + +/* +* %version: 13 % +*/ + +#ifndef WLANWSACOMPLEXCOMMAND_H +#define WLANWSACOMPLEXCOMMAND_H + +#include "UmacMacActionState.h" + + +/** +* Base class for complex WHA command objects +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaComplexCommand : public WlanMacActionState + { + +public: + + /** + * Destructor. + */ + virtual ~WlanWsaComplexCommand() {}; + + void Act( WlanContextImpl& aCtxImpl, TUint32 aAct ) const; + +protected: + + /** + * C++ default constructor. + */ + WlanWsaComplexCommand() {}; + + virtual TBool DoErrorIndication( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus ); + + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + inline void TraverseToHistoryState( WlanContextImpl& aCtxImpl ); + }; + +#include "UmacWsaComplexCommand.inl" + +#endif // WLANWSACOMPLEXCOMMAND_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaComplexCommand.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaComplexCommand.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanWsaComplexCommand inline methods. +* +*/ + +/* +* %version: 6 % +*/ + +inline void WlanWsaComplexCommand::TraverseToHistoryState( + WlanContextImpl& aCtxImpl ) + { + ChangeState( aCtxImpl, + *this, // previous state + Dot11History() // recall history state (new state) + ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaConfigure.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaConfigure.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaConfigure class. +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANWSACONFIGURE_H +#define WLANWSACONFIGURE_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of Configure WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaConfigure : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaConfigure() : + iData( NULL ), iLength( 0 ) {}; + +public: + + void Set( + WlanContextImpl& aCtxImpl, + const TAny* aData, + TUint32 aLength ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaConfigure( const WlanWsaConfigure& ); + // Prohibit assigment operator. + WlanWsaConfigure& operator= ( const WlanWsaConfigure& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + const TAny* iData; + TUint32 iLength; + }; + +#endif // WLANWSACONFIGURE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaDisconnect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaDisconnect.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaDisconnect class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANWSADISCONNECT_H +#define WLANWSADISCONNECT_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of Reset WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaDisconnect : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaDisconnect() {}; + + /** + * Destructor. + */ + virtual ~WlanWsaDisconnect() {}; + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaDisconnect( const WlanWsaDisconnect& ); + // Prohibit assigment operator. + WlanWsaDisconnect& operator= ( const WlanWsaDisconnect& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + }; + +#endif // WLANWSADISCONNECT_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaEvent.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanWsaEvent class. +* +*/ + +/* +* %version: 15 % +*/ + +#ifndef WLANWSAEVENT_H +#define WLANWSAEVENT_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +class WlanContextImpl; + +/** +* interface for evenets generated by WHA +* +* @lib wlanumac.lib +* @since S60 3.1 +*/ +class MWlanWsaEvent + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + MWlanWsaEvent() {}; + + /** + * Destructor. + */ + virtual ~MWlanWsaEvent() {}; + + public: // New functions + + // Command callbacks + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) = 0; + + virtual TBool CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& + aCommandCompletionParams ) = 0; + + virtual void Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ) = 0; + + // Frame receive + + virtual TAny* RequestForBuffer ( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) = 0; + + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ) = 0; + }; + +#endif // WLANWSAEVENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaInitiliaze.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaInitiliaze.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaInitiliaze class. +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANWSAINITILIAZE_H +#define WLANWSAINITILIAZE_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of Initialize WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaInitiliaze : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaInitiliaze() : + iData( NULL ), iLength( 0 ) {}; + +public: + + void Set( + WlanContextImpl& aCtxImpl, + const TAny* aData, + TUint32 aLength ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaInitiliaze( const WlanWsaInitiliaze& ); + // Prohibit assigment operator. + WlanWsaInitiliaze& operator= ( const WlanWsaInitiliaze& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + const TAny* iData; + TUint32 iLength; + }; + +#endif // WLANWSAINITILIAZE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaJoin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaJoin.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaJoin class. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef WLANWSAJOIN_H +#define WLANWSAJOIN_H + +#include "UmacWsaCommand.h" + +class WlanContextImpl; + +/** +* Encapsulates the execution of Join WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaJoin : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaJoin(); + + /** + * Destructor. + */ + virtual ~WlanWsaJoin() {}; + +public: + + void Set( + WlanContextImpl& aCtxImpl, + WHA::TOperationMode aMode, + WHA::TMacAddress& aBSSID, + WHA::TBand aBand, + WHA::SSSID& aSSID, + WHA::TChannelNumber aChannel, + TUint32 aBeaconInterval, + WHA::TRate aBasicRateSet, + TUint16 aAtimWindow, + WHA::TPreamble aPreambleType, + TBool aProbeForJoin ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaJoin( const WlanWsaJoin& ); + // Prohibit assigment operator. + WlanWsaJoin& operator= ( const WlanWsaJoin& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + WHA::TOperationMode iMode; + WHA::TMacAddress iBSSID; + WHA::SSSID iSSID; + WHA::TBand iBand; + WHA::TChannelNumber iChannel; + TUint32 iBeaconInterval; + WHA::TRate iBasicRateSet; + TUint16 iAtimWindow; + WHA::TPreamble iPreambleType; + TBool iProbeForJoin; + }; + +#endif // WLANWSAJOIN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaKeyIndexMapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaKeyIndexMapper.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaKeyIndexMapper class +* +*/ + +/* +* %version: 12 % +*/ + +#ifndef WLANWSAKEYINDEXMAPPER_H +#define WLANWSAKEYINDEXMAPPER_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +/** +* Maps an encryption key index to WHA key entry index. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaKeyIndexMapper + { + enum { KWepPairWiseKey = 4 }; + enum { KTkipPairWiseKey = 5 }; + enum { KTkipGroupKey = 6 }; + enum { KAesGroupKey = 7 }; + enum { KAesPairWiseKey = 8 }; + enum { KWapiPairWiseKey = KTkipPairWiseKey }; + enum { KWapiGroupKey = KTkipGroupKey }; + + public: + + static TUint8 Extract( + WHA::TKeyType aKeyType, + TUint32 aDefaultKeyNumber = 0 ); + + private: + + static inline TUint32 HandleWepPairwiseKey(); + static inline TUint32 HandleWepGroupKey( TUint32 aDefaultKeyNumber ); + static inline TUint32 HandleTkipGroupKey(); + static inline TUint32 HandleTkipPairWiseKey(); + static inline TUint32 HandleAesPairwiseKey(); + static inline TUint32 HandleAesGroupKey(); + static inline TUint32 HandleWapiPairwiseKey(); + static inline TUint32 HandleWapiGroupKey(); + }; + +#endif // WLANWSAKEYINDEXMAPPER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaReadMib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaReadMib.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaReadMib class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANWSAREADMIB_H +#define WLANWSAREADMIB_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of ReadMib WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaReadMib : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaReadMib() : iMib( static_cast(0) ) {}; + + /** + * Destructor. + */ + virtual ~WlanWsaReadMib() {}; + +public: + + inline void Set( + WlanContextImpl& aCtxImpl, + WHA::TMib aMib ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaReadMib( const WlanWsaReadMib& ); + // Prohibit assigment operator. + WlanWsaReadMib& operator= ( const WlanWsaReadMib& ); + +private: // Data + + WHA::TMib iMib; +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + }; + +#include "UmacWsaReadMib.inl" + +#endif // WLANWSAREADMIB_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaReadMib.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaReadMib.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanWsaReadMib inline methods. +* +*/ + +/* +* %version: 8 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanWsaReadMib::Set( + WlanContextImpl& /*aCtxImpl*/, + WHA::TMib aMib ) + { + iMib = aMib; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaScan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaScan.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaScan class. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef WLANWSASCAN_H +#define WLANWSASCAN_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of Scan WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaScan : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaScan() : + iMaxTransmitRate( static_cast(0)), + iBand( static_cast(0)), + iNumOfChannels( 0 ), + iChannels( NULL ), + iScanType( static_cast(0)), + iNumOfProbeRequests( 0 ), + iSplitScan( EFalse ), + iNumOfSSID( 0 ), + iSsid( NULL ) + {}; + + /** + * Destructor. + */ + virtual ~WlanWsaScan(); + + void Set( + WlanContextImpl& aCtxImpl, + TUint32 aMaxTransmitRate, + WHA::TBand aBand, + TUint8 aNumOfChannels, + const WHA::SChannels* aChannels, + WHA::TScanType aScanType, + TUint8 aNumOfProbeRequests, + TBool aSplitScan, + TUint8 aNumOfSSID, + const WHA::SSSID* aSSID ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaScan( const WlanWsaScan& ); + // Prohibit assigment operator. + WlanWsaScan& operator= ( const WlanWsaScan& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + WHA::TRate iMaxTransmitRate; + WHA::TBand iBand; + TUint8 iNumOfChannels; + /** + * channels to scan + * Not own + */ + const WHA::SChannels* iChannels; + WHA::TScanType iScanType; + TUint8 iNumOfProbeRequests; + TBool iSplitScan; + TUint8 iNumOfSSID; + /** + * SSID to scan + * Not own + */ + const WHA::SSSID* iSsid; + }; + +#endif // WLANWSASCAN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaSetBssParameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaSetBssParameters.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaSetBssParameters class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANWSASETBSSPARAMETERS_H +#define WLANWSASETBSSPARAMETERS_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of SetBssParameters WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaSetBssParameters : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaSetBssParameters() : iDtim( 0 ), iAid( 0 ) {}; + + /** + * Destructor. + */ + virtual ~WlanWsaSetBssParameters() {}; + + void Set( + WlanContextImpl& aCtxImpl, + TUint32 aDtim, + TUint32 aAid ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaSetBssParameters( const WlanWsaSetBssParameters& ); + // Prohibit assigment operator. + WlanWsaSetBssParameters& operator= ( + const WlanWsaSetBssParameters& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + TUint32 iDtim; + TUint32 iAid; + }; + +#endif // WLANWSASETBSSPARAMETERS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaSetPsMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaSetPsMode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaSetPsMode class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANWSASETPSMODE_H +#define WLANWSASETPSMODE_H + +#include "UmacWsaCommand.h" + +/** +* Encapsulates the execution of SetBssParameters WHA command. +* +* @lib wlanumac.lib +* @since S60 v3.1 +*/ +class WlanWsaSetPsMode : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaSetPsMode() : + iPsMode( static_cast(0) ) {}; + + /** + * Destructor. + */ + virtual ~WlanWsaSetPsMode() {}; + + inline void Set( + WlanContextImpl& aCtxImpl, + WHA::TPsMode aPsMode ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWsaSetPsMode( const WlanWsaSetPsMode& ); + // Prohibit assigment operator. + WlanWsaSetPsMode& operator= ( const WlanWsaSetPsMode& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + WHA::TPsMode iPsMode; + }; + +#include "UmacWsaSetPsMode.inl" + +#endif // WLANWSASETPSMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaSetPsMode.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaSetPsMode.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanWsaSetPsMode inline methods. +* +*/ + +/* +* %version: 7 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanWsaSetPsMode::Set( + WlanContextImpl& /*aCtxImpl*/, + WHA::TPsMode aPsMode ) + { + iPsMode = aPsMode; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaWriteMib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaWriteMib.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWsaWriteMib class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLANWSAWRITEMIB_H +#define WLANWSAWRITEMIB_H + +#include "UmacWsaCommand.h" + +/** +* WHA WriteMib command object encapsulation +* +* +* @lib wlanumac.lib +* @since S60 3.1 +*/ +class WlanWsaWriteMib : public WlanWsaCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanWsaWriteMib() : + iDfcPending( EFalse ), + iMib( static_cast(0) ), + iLength( 0 ), + iData( NULL ) {}; + + /** + * Destructor. + */ + virtual inline ~WlanWsaWriteMib(); + + inline void Set( + WlanContextImpl& aCtxImpl, + WHA::TMib aMib, + TUint32 aLength, + const TAny* aData ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); + virtual void Exit( WlanContextImpl& aCtxImpl); + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + virtual void OnDfc( TAny* aCtx ); + +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + inline void RegisterDfc(); + inline void CancelDfc(); + inline void DfcPending( TBool aValue ); + inline TBool DfcPending() const; + + // Prohibit copy constructor. + WlanWsaWriteMib( const WlanWsaWriteMib& ); + // Prohibit assigment operator. + WlanWsaWriteMib& operator= ( const WlanWsaWriteMib& ); + +private: // Data + +#ifndef NDEBUG + static const TInt8 iName[]; +#endif + + TBool iDfcPending; + WHA::TMib iMib; + TUint32 iLength; + /** + * Pointer to MIB data + * Not own + */ + const TAny* iData; + }; + +#include "UmacWsaWriteMib.inl" + +#endif // WLANWSAWRITEMIB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaWriteMib.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacWsaWriteMib.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanWsaWriteMib inline methods. +* +*/ + +/* +* %version: 9 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanWsaWriteMib::~WlanWsaWriteMib() + { + iData = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanWsaWriteMib::Set( + WlanContextImpl& /*aCtxImpl*/, + WHA::TMib aMib, + TUint32 aLength, + const TAny* aData ) + { + iMib = aMib; + iLength = aLength; + iData = aData; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanWsaWriteMib::DfcPending( TBool aValue ) + { + iDfcPending = aValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanWsaWriteMib::DfcPending() const + { + return iDfcPending; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/algorithm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/algorithm.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,280 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic operation definitions. +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef ALGORITHM_H +#define ALGORITHM_H + +/** +* global operator!= for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue equal, EFalse not equal +*/ +template< class T > +inline TBool operator!= ( + const T& aLhs, + const T& aRhs) + { + return !( aLhs == aRhs ); + } + +/** +* global operator > for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue greater, EFalse else +*/ +template< class T > +inline TBool operator > ( + const T& aLhs, + const T& aRhs) + { + return ( aRhs < aLhs ); + } + +/** +* global operator <= for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue smaller or equal, EFalse else +*/ +template< class T > +inline TBool operator <= ( + const T& aLhs, + const T& aRhs) + { + return !( aRhs < aLhs ); + } + +/** +* global operator >= for type T +* @param aLhs left hand side +* @param aRhs right hand side +* @return ETrue greater or equal, EFalse else +*/ +template< class T > +inline TBool operator >= ( + const T& aLhs, + const T& aRhs) + { + return !( aLhs < aRhs ); + } + +/** +* Just like equal in C++ STL for testing equality for T type +* Checks weather elements in the range [aBeg, aEnd) are equal +* to the elements in the range starting with aCmpBeg +* Complexity: linear +* @param aBeg begin of the search range +* @param aEnd end ( one past last element ) of the search range +* @param aCmpBeg begin of the range to be compared with +* @return ETrue equal, EFalse not equal +*/ +template< class T > +inline TBool equal( + const T* aBeg, + const T*const aEnd, + const T* aCmpBeg) + { + while ( aBeg != aEnd ) + { + if ( *aBeg != *aCmpBeg ) + { + return EFalse; + } + ++aBeg; + ++aCmpBeg; + } + + return ETrue; + } + +/** +* Just like find in C++ STL +* Returns the position of the first element in the range [aBeg, aEnd) +* that has a value equal to aValue +* Complexity: linear +* @param aBeg begin of range +* @param aEnd end ( one past last element ) of the range +* @param aValue value to be searched +* @return the position of the first element in the range (aBeg, aEnd] +* that has a value equal to aValue. aEnd is returned if no matching +* element is found +*/ +template< class T, class J > +inline T* find( + const T* aBeg, + const T* const aEnd, + const J& aValue) + { + while ( aBeg != aEnd ) + { + if ( *aBeg == aValue ) + { + break; + } + + ++aBeg; + } + + return const_cast(aBeg); + } + +/** +* Just like find_if in C++ STL +* Returns the position of the first element in the range [aBeg, aEnd) +* for which the unary predicate op(elem) yields true +* Complexity: linear +* @param aBeg begin of range +* @param aEnd end ( one past last element ) of the range +* @param aUnaryPredicate a unary predicate +* @return the position of the first element in the range (aBeg, aEnd] +* for which the unary predicate op(elem) yields true. +* aEnd is returned if no matching element is found +* NOTE: aUnaryPredicate should not change its state during a function call +*/ +template< class T, class J > +inline T* find_if( + const T* aBeg, + const T* const aEnd, + const J& aUnaryPredicate) + { + while ( aBeg != aEnd ) + { + if ( aUnaryPredicate( *aBeg ) ) + { + break; + } + + ++aBeg; + } + + return const_cast(aBeg); + } + +/** +* Just like fill in C++ STL for T type +* Assigns aValue to each element in the range [aBeg, aEnd) +* The caller must ensure that the destination range is big enough +* Complexity: linear +* @param aBeg begin of range +* @param aEnd end ( one past last element ) of the range +* @param aValue value to be assigned +*/ +template< class T, class J> +inline void fill( + T* aBeg, + const T* const aEnd, + const J& aValue) + { + while ( aBeg != aEnd ) + { + *aBeg = aValue; + ++aBeg; + } + } + +/** +* Just like fill_n in C++ STL for T type +* Assigns aValue to the first aNum elements in the range starting with aBeg +* The caller must ensure that the destination range is big enough +* Complexity: linear +* @param aBeg begin of range +* @param aNum number of elements to be processed +* @param aValue value to be assigned +*/ +template< class T, class J > +inline void fill_n( + T* aBeg, + TUint32 aNum, + const J& aValue) + { + while ( aNum ) + { + *aBeg = aValue; + ++aBeg; + --aNum; + } + } + +/** +* Just like copy in C++ STL +* @param aSrc begin of copy +* @param aSrcEnd end of copy +* @param aDest target of copy +* @return aDest +*/ +template +inline T* copy( + const T* aSrc, + const T* aSrcEnd, + T* aDest) + { + while ( aSrc != aSrcEnd ) + { + *aDest = *aSrc; + ++aSrc; + ++aDest; + } + + return aDest; + } + +template +inline T* reverse_copy( + const T* aSrcBeg, + const T* aSrcEnd, + T* aDest) + { + --aSrcEnd; + while ( aSrcEnd >= aSrcBeg ) + { + *aDest = *aSrcEnd; + --aSrcEnd; + ++aDest; + } + + return aDest; + } + +/** +* Does a looped copy for T type +* @param aSource source of the copy +* @param aDest destination where to copy +* @param aCount number of iterations +* @return aDest +*/ +template +inline TAny* assign( + const T* aSource, + T* aDest, + const TInt aCount) + { + TAny* origdest = static_cast(aDest); + for ( TInt idx = 0 ; idx != aCount ; ++idx, ++aSource, ++aDest ) + { + *aDest = *aSource; + } + + return origdest; + } + +#endif // ALGORITHM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/config.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The first file which every UMAC cpp file needs to include. +* +*/ + +/* +* %version: 16 % +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "umac_types.h" + +extern TAny* os_alloc( const TUint32 aLengthInBytes ); +extern void os_free( const TAny* aPtr ); + +// Returns the current time as the number of microseconds since midnight, +// January 1st, 0 AD nominal Gregorian +extern TInt64 os_systemTime( void ); + +#include "802dot11.h" + +#include "UmacDebug.h" + +#endif // CONFIG_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/pack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/pack.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definitions related to packed structs. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef PACK_H +#define PACK_H + +#ifdef __PACKED + #undef __PACKED +#endif //__PACKED + +#define __PACKED + +#endif // PACK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/trace_util.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/trace_util.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of some trace utility methods. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef TRACEUTIL_H +#define TRACEUTIL_H + +#include "802dot11.h" + +inline void TracePrint( + const TUint32 aTraceLevel, + const TUint16* aDataBegin, + const TUint16* const aDataEnd ) + { + while ( aDataBegin != aDataEnd ) + { + TraceDump(aTraceLevel, (("0x%04x"), *aDataBegin)); + ++aDataBegin; + } + } + +/** +* Generic data trace function +* @param aTraceLevel tracing level bitmask +* @param aData begin of data to be traced +* @param aLength length of the data +*/ +inline void TracePrint( + const TUint32 aTraceLevel, + const TUint8* aData, + const TUint32 aLength ) + { + + const TUint8* const end = aData + aLength; + while ( end != aData ) + { + TraceDump(aTraceLevel, (("%c"), *aData)); + ++aData; + } + } + +inline void TracePrint( const TUint32 aTraceLevel, const TMacAddress& aMac ) + { + TraceDump(aTraceLevel, (("%02x:%02x:%02x:%02x:%02x:%02x"), + aMac.iMacAddress[0], aMac.iMacAddress[1], aMac.iMacAddress[2], + aMac.iMacAddress[3], aMac.iMacAddress[4], aMac.iMacAddress[5])); + } + +#endif // TRACEUTIL_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umac_types.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UMAC type definitions. +* +*/ + +/* +* %version: 28 % +*/ + +#ifndef UMACTYPES_H +#define UMACTYPES_H + +#include "am_platform_libraries.h" +#include "pack.h" +#include + +/// Indication data type +typedef enum _TIndication + { + EMediaDisconnect, + EOsPowerStandby, + EHWFailed, + EConsecutiveBeaconsLost, + EConsecutiveTxFailures, + EConsecutivePwrModeSetFailures, + EBSSRegained, + EWepDecryptFailure, + EPairwiseKeyMicFailure, + EGroupKeyMicFailure, + ERcpiTrigger, + EScanCompleted, + ESignalLossPrediction, + EApTestOpportunity, + EVoiceCallOn, + EVoiceCallOff, + EPsModeError + } TIndication; + + +/** +* Maximum length of an SSID in BYTES +*/ +const TUint8 KMaxSSIDLength = 32; + +/** +* Length of a MAC address +*/ +const TUint8 KMacAddressLength = 6; + +/** +* 802.11 WEP key ID values +*/ +enum T802Dot11WepKeyId + { + E802Dot11WepKeyId0 = 0, + E802Dot11WepKeyId1 = 1, + E802Dot11WepKeyId2 = 2, + E802Dot11WepKeyId3 = 3, + // defined as an upper bound + E802Dot11WepKeyIdMax = 4 + }; + +/** Tx queues. They have a 1:1 mapping with QoS Access Categories */ + +enum TQueueId + { + ELegacy, + EBackGround, + EVideo, + EVoice, + EQueueIdMax // defined as upper bound + }; + +/** + * WHA transmit queue state + */ +enum TTxQueueState + { + ETxQueueFull, + ETxQueueNotFull + }; + +/** +* MAC address +*/ +#pragma pack( 1 ) +struct TMacAddress + { + /** the MAC address */ + TUint8 iMacAddress[KMacAddressLength]; + } __PACKED; // 6 bytes + +// pop the pragma pack stack to return to normal alignment of structures +#pragma pack( ) + +/** +* Broadcast MAC Address. +*/ +const TMacAddress KBroadcastMacAddr = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; + +/** +* MAC address that is all zeros +*/ +const TMacAddress KZeroMacAddr = {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; + +/** IP v4 address */ +typedef TUint32 TIpv4Address; + +/** Length of OUI field in SNAP header */ +const TUint8 KOuiLength = 3; + +/** SNAP header */ +#pragma pack( 1 ) +typedef struct _TSnapHeader + { + /** destination service access point */ + TUint8 iDSAP; + /** source service access point */ + TUint8 iSSAP; + /** control field */ + TUint8 iControl; + /** organizationally unique identifier */ + TUint8 iOUI[KOuiLength]; // 3 + } TSnapHeader; // 6 bytes +#pragma pack() + +/** + * state of all WHA transmit queues + */ +typedef TTxQueueState TWhaTxQueueState[EQueueIdMax]; + + +// returns aDest +extern TAny* os_memcpy( + TAny* aDest, + const TAny* aSrc, + TUint32 aLengthinBytes ); + +// return 0 if equal +extern TInt os_memcmp( + const TAny* aLhs, + const TAny* aRhs, + TUint aNumOfBytes ); + +extern TAny* os_memset( + void* aDest, + TInt aValue, + TUint aCount ); + + +/** internal UMAC events bitmask type */ +typedef TUint32 TInternalEvent; + +/** internal UMAC event requiring us to update the AC parameters to + * WHA layer + */ +const TUint32 KAcParamUpdate = ( 1 << 0 ); +/** internal UMAC event requiring us to change the dot11 power mgmt mode */ +const TUint32 KPowerMgmtTransition = ( 1 << 1 ); +/** internal UMAC default timer timeout event */ +const TUint32 KTimeout = ( 1 << 2 ); +/** internal UMAC Voice Call Entry timer timeout event */ +const TUint32 KVoiceCallEntryTimerTimeout = ( 1 << 3 ); +/** internal UMAC Null timer timeout event */ +const TUint32 KNullTimerTimeout = ( 1 << 4 ); +/** internal UMAC No Voice timer timeout event */ +const TUint32 KNoVoiceTimerTimeout = ( 1 << 5 ); +/** internal UMAC Keep Alive timer timeout event */ +const TUint32 KKeepAliveTimerTimeout = ( 1 << 6 ); +/** internal UMAC Active to Light PS timer timeout event */ +const TUint32 KActiveToLightPsTimerTimeout = ( 1 << 7 ); +/** internal UMAC Light PS to Active timer timeout event */ +const TUint32 KLightPsToActiveTimerTimeout = ( 1 << 8 ); +/** internal UMAC Light PS to Deep PS timer timeout event */ +const TUint32 KLightPsToDeepPsTimerTimeout = ( 1 << 9 ); +/** internal UMAC event requiring us to set the cts to self MIB */ +const TUint32 KSetCtsToSelf = ( 1 << 10 ); +/** internal UMAC event requiring us to set the RCPI trigger level MIB */ +const TUint32 KSetRcpiTriggerLevel = ( 1 << 11 ); +/** internal UMAC event requiring us to set the HT BSS Operation MIB */ +const TUint32 KSetHtBssOperation = ( 1 << 12 ); + + +/** internal WLAN LDD timer type */ +enum TWlanTimer + { + EWlanDefaultTimer, + EWlanVoiceCallEntryTimer, + EWlanNullTimer, + EWlanNoVoiceTimer, + EWlanKeepAliveTimer, + EWlanActiveToLightPsTimer, + EWlanLightPsToActiveTimer, + EWlanLightPsToDeepPsTimer + }; + +#endif // UMACTYPES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanActiveModePowerModeMgr class +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLAN_ACTIVE_MODE_POWER_MODE_MGR +#define WLAN_ACTIVE_MODE_POWER_MODE_MGR + +#include "umacpowermodemgrbase.h" + +class WlanContextImpl; + +/** +* Class implementing infrastructure mode dynamic power mode management +* algorithm for Active mode (CAM) +*/ +class WlanActiveModePowerModeMgr : public WlanPowerModeMgrBase + { + +public: + + /** Ctor */ + WlanActiveModePowerModeMgr(); + + /** Dtor */ + virtual ~WlanActiveModePowerModeMgr(); + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 5.1 + * @param aToLightPsFrameThreshold frame count threshold for changing to + * Light PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network + */ + inline void SetParameters( + TUint aToLightPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * To be called when transmitting a frame + * Determines the need to make a power mode transition + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + * @param aEtherType Ethernet type of the frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameTx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TUint16 aEtherType, + TBool aIgnoreThisFrame ); + + /** + * To be called when accepting an Rx frame + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aAccessCategory AC/Queue via which the frame was transmitted + * @param aEtherType Ethernet type of the received frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @param aPayloadLength length of the ethernet frame payload + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameRx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TDaType aDaType ); + + /** + * From WlanPowerModeMgrBase + * To be called upon Active to Light PS timer timeout + * + * @since S60 5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + virtual TBool OnActiveToLightPsTimerTimeout(); + + /** + * From WlanPowerModeMgrBase + * Resets the state of the object + * + * @since S60 3.1 + */ + virtual void DoReset(); + +private: + + // Prohibit copy constructor + WlanActiveModePowerModeMgr( const WlanActiveModePowerModeMgr& ); + // Prohibit assignment operator + WlanActiveModePowerModeMgr& operator= ( + const WlanActiveModePowerModeMgr& ); + +private: // Data + + /** + * Rx/Tx frame counter used when considering change to + * Light PS mode + */ + TUint iToLightPsFrameCount; + + /** + * Rx/Tx frame count threshold used when considering change to + * Light PS mode + */ + TUint iToLightPsFrameThreshold; + }; + +#include "umacactivemodepowermodemgr.inl" + +#endif // WLAN_ACTIVE_MODE_POWER_MODE_MGR diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacactivemodepowermodemgr.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanActiveModePowerModeMgr inline methods +* +*/ + +/* +* %version: 4 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanActiveModePowerModeMgr::SetParameters( + TUint aToLightPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) + { + iToLightPsFrameThreshold = aToLightPsFrameThreshold; + iUapsdRxFrameLengthThreshold = aUapsdRxFrameLengthThreshold; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacaddbroadcastwepkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacaddbroadcastwepkey.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanAddBroadcastWepKey class. +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANADDBROADCASTWEPKEY_H +#define WLANADDBROADCASTWEPKEY_H + +#include "UmacWsaComplexCommand.h" + + +/** +* FSM for inserting a single default WEP key +* Inserts it as group and pairwise key +* and also marks it as the default group key +* +* @lib wlanumac.lib +* @since S60 3.1 +*/ +class WlanAddBroadcastWepKey : public WlanWsaComplexCommand + { + + // Types for the FSM + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + EADDGROUPKEY, // add group key + EWRITEMIB, // write mib (conditional exec) + EADDPAIRWISEKEY,// add pairwise key (conditional exec) + EFINIT, // end state + ESTATEMAX // defined as an upper bound + }; + +public: + + /** + * C++ default constructor. + */ + WlanAddBroadcastWepKey() : + iState( EINIT ), iFlags( 0 ), iKeyIndex( 0 ), iKeyLength( 0 ), + iKey( NULL ), iMacAddr( KZeroMacAddr ), iMemory( NULL ) {}; + + /** + * Destructor. + */ + virtual inline ~WlanAddBroadcastWepKey(); + + /** + * ?member_description. + * @since S60 3.1 + * @param + */ + void Set( + const TMacAddress& aMac, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TBool aUseAsPairwiseKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength] ); + +private: + + // Prohibit copy constructor. + WlanAddBroadcastWepKey( const WlanAddBroadcastWepKey& ); + // Prohibit assigment operator. + WlanAddBroadcastWepKey& operator= + ( const WlanAddBroadcastWepKey& ); + + virtual void Entry( WlanContextImpl& aCtxImpl ); + virtual void Exit( WlanContextImpl& aCtxImpl); + +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void AddGroupKey( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void AddPairwiseKey( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void WriteMib( WlanContextImpl& aCtxImpl ); + + /** + * evaluates if key is to be marked as the default key + * @since S60 3.1 + * @return ETrue when evaluates true + */ + inline TBool UseAsDefaultKey() const; + + /** + * evaluates if key is inserted as a pairwise key + * @since S60 3.1 + * @return ETrue when evaluates true + */ + inline TBool UseAsPairwiseKey() const; + + static const TUint32 KUseAsDefaultKey = ( 1 << 0 ); + static const TUint32 KUseAsPairwiseKey = ( 1 << 1 ); + +private: // Data + + TState iState; + + TUint32 iFlags; + TUint32 iKeyIndex; + TUint32 iKeyLength; + /** + * cipher key to add + * Not own + */ + const TUint8* iKey; + TMacAddress iMacAddr; + + // general purpose memory handle for the object + TAny* iMemory; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + + static const TInt8 iName[]; +#endif // !NDEBUG + }; + +#include "umacaddbroadcastwepkey.inl" + +#endif // WLANADDBROADCASTWEPKEY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacaddbroadcastwepkey.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacaddbroadcastwepkey.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanAddBroadcastWepKey inline methods. +* +*/ + +/* +* %version: 6 % +*/ + +inline WlanAddBroadcastWepKey::~WlanAddBroadcastWepKey() + { + iKey = NULL; + iMemory = NULL; + } + +inline TBool WlanAddBroadcastWepKey::UseAsDefaultKey() const + { + return iFlags & KUseAsDefaultKey; + }; + +inline TBool WlanAddBroadcastWepKey::UseAsPairwiseKey() const + { + return iFlags & KUseAsPairwiseKey; + }; diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaccarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaccarray.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class template for constant size arrays. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef _CARRAY_H +#define _CARRAY_H + +/* + * + * The following code declares class array, + * an STL container (as wrapper) for arrays of constant size. + * + * compile time modifiable polies: + * - to call delete or not to 4 members of array + * - copy ctor and assignment operator policies; see umaccarraypolicy.h + */ + +#include "algorithm.h" + +typedef TUint size_t; + +#include "umactypemanip.h" +#include "umaccarraypolicy.h" + +template +< + class T, + size_t the_size, + bool deletepointees = EFalse, // call delete or not 4 members of array + class CopyingPolicy = ShallowCopy, // check out policyCarray.h 4 these + class HeapAllocationPolicy = OpNewAlloc // our allocation policy 4 a heap allocated Carray +> +class Carray : protected CopyingPolicy, + public HeapAllocationPolicy +{ + typedef Carray Self; + +private: + T v[the_size]; + + // compile time function selectives + void delete_pointees( Int2Type ); + void delete_pointees( Int2Type ) {}; + +public: + + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef size_t size_type; + typedef size_t TUint; + + // default constructor + Carray() {}; + // construct with inital data + // do not allow to be used in explicit conversations + explicit + Carray(T* p) { copy(p, p + the_size, begin()); } + + ~Carray() { delete_pointees( Int2Type() ); } + + // iterator support + iterator begin() {return v;} + const_iterator begin() const {return v;} + iterator end() {return v + the_size;} + const_iterator end() const {return v + the_size;} + + // size is constant + size_type size() const {return the_size;} + size_type max_size() const {return the_size;} + + // direct element access + reference operator[](size_t i) {return v[i];} + const_reference operator[](size_t i) const {return v[i];} + + // front() and back() + reference front() {return v[0]; } + const_reference front() const {return v[0]; } + reference back() {return v[the_size-1]; } + const_reference back() const {return v[the_size-1];} + + //swap + void swap(Self& r) { swap_ranges(begin(), end(), r.begin()); } + + // conversion to ordinary array + const T* data() const {return v;} + T* data() {return v;} + + // assignment + Self& operator=(const Self&); + + // copy ctor + Carray(const Self& o) + { Copy(const_cast(o.begin()), const_cast(o.end()), begin()); } +}; + +template +inline +void Carray::delete_pointees(Int2Type) + { + for( size_t i = 0 ; i < size() ; ++i ) + { + delete v[i]; + } + } + +// asignment operator +template +inline +Carray& +Carray::operator=(const Self& o) + { + // use policy chosen at compile time + Copy(const_cast(o.begin()), const_cast(o.end()), begin()); + return (*this); + } + +// comparisons +template +inline +bool operator == (const Carray& x, +const Carray& y) + { + return equal(x.begin(), x.end(), y.begin()); + } + +// global swap() +template +inline void swap (Carray& x, +Carray& y) + { + x.swap(y); + } + +#endif //_CARRAY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaccarraypolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaccarraypolicy.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Policies for constant size arrays class template +* (see umaccarray.h). +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef _POLICYCARRAY_H +#define _POLICYCARRAY_H + +/* + * + * Copy ctor and assignment operator policies 4 Carray + * + * @usage examples: + * + * Carray > obj; + * Carray > obj2; + * obj[0] = new int(1); + * obj[1] = new int(2); + * // test deep copy + * Carray > obj6(obj); + * // test deep assignment + * obj2 = obj6; + * + * Carray obj3; + * Carray obj4; + * obj3[0] = 1; + * obj3[1] = 2; + * // test shallow copy + * Carray obj5(obj3); + * // test shallow assignment + * obj4 = obj3; + * + * Carray > obj7; + * Carray > obj9; + * obj7[0] = new clonable(1); + * obj7[1] = new clonable(2); + * // test clone copy + * Carray > obj8(obj7); + * // test clone assignment + * obj9 = obj7; + * + * Carray > obj10; + * Carray > obj11; + * // does not compile as it should not + * obj10 = obj11; + */ + +#include "algorithm.h" + +// normal shallow copy +template +struct ShallowCopy +{ +typedef T* iterator; + + static void Copy(iterator srcbegin, iterator srcend, iterator trgbegin) + { + copy(srcbegin, srcend, trgbegin); + } +}; + +// calls Clone() 4 copy +template +struct CloneCopy +{ +typedef T** iterator; + + static void Copy(iterator srcbegin, iterator srcend, iterator trgbegin) + { + while(srcbegin != srcend) + { + *trgbegin = (*srcbegin)->Clone(); + + ++srcbegin; + ++trgbegin; + } + } +}; + +// just what name states copying and assignment are not allowed +template +struct NoCopy {}; + +// global new and delete operators +struct OpNewAlloc +{ + static void* operator new(size_t size) + { + return ::operator new(size); + } + + static void operator delete(void* p , size_t /*size*/) + { + ::operator delete(p); + } +}; + +#endif //_POLICYCARRAY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconfiguretxautoratepolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconfiguretxautoratepolicy.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanConfigureTxAutoRatePolicy class. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLAN_CONFIGURE_TX_AUTO_RATE_POLICY_H +#define WLAN_CONFIGURE_TX_AUTO_RATE_POLICY_H + +#include "UmacWsaComplexCommand.h" +#include "umacinternaldefinitions.h" + + +/** + * Configures the relevant txAutoRatePolicy MIB entries to enable the lower + * layers to perform autonomous rate adaptation + * + * @lib wlanumac.lib + * @since S60 v5.0 + */ +class WlanConfigureTxAutoRatePolicy : public WlanWsaComplexCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanConfigureTxAutoRatePolicy(); + + /** + * Destructor. + */ + virtual ~WlanConfigureTxAutoRatePolicy(); + + /** + * Provides the input parameters for this state + * + * @since S60 5.0 + * @param aCompleteMgmtRequest ETrue if WLAN Mgmt Client request needs to be + * completed when we are done; EFalse otherwise + */ + void Set( TBool aCompleteMgmtRequest ); + +private: + + // Types for the FSM + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + ESETAUTORATEPOLICY, + EFINIT, + ESTATEMAX // defined as an upper bound + }; + + /** + * Dispatches the internal state machine events + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + * @param aEvent The event to dispatch + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * Handles the Internal State Entry event + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * Handles the Tx Complete event. + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * Handles the Abort event. + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * Handles internal state machine state changes. + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + * @param aNewState The state to change to + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + */ + void SetAutoRatePolicy( + WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * Performs state entry actions + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * Performs state exit actions + * + * @since S60 5.0 + * @param aCtxImpl Global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl); + + /** + * From WlanMacState. + * Returns the name of this state. + * + * @since S60 5.0 + * @param aLength Length of the returned name buffer + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // Prohibit copy constructor. + WlanConfigureTxAutoRatePolicy( const WlanConfigureTxAutoRatePolicy& ); + // Prohibit assignment operator. + WlanConfigureTxAutoRatePolicy& operator= + ( const WlanConfigureTxAutoRatePolicy& ); + +private: // Data + + /** state of the internal state machine */ + TState iState; + /** + * ETrue if WLAN Mgmt Client request needs to be completed when we are + * done, EFalse otherwise + */ + TBool iCompleteMgmtRequest; + // memory handle for TxAutoRatePolicyMib objects. Own + WHA::StxAutoRatePolicy* iTxAutoRatePolicyMib; + /** number of rate policy classes to configure */ + TUint iNumberOfPolicyClassesToConfigure; + /** ID of the rate policy class being configured */ + TUint iRatePolicyClass; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + static const TInt8 iName[]; +#endif // !NDEBUG + + }; + +#endif // WLAN_CONFIGURE_TX_AUTO_RATE_POLICY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconfiguretxqueueparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconfiguretxqueueparams.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanConfigureTxQueueParams class +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef WLAN_CONFIGURE_TX_QUEUE_PARAMS_H +#define WLAN_CONFIGURE_TX_QUEUE_PARAMS_H + +#include "UmacWsaComplexCommand.h" + +/** + * configures tx queue parameters of the device + * + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanConfigureTxQueueParams : public WlanWsaComplexCommand + { + +public: + + /** + * C++ default constructor. + */ + WlanConfigureTxQueueParams() : + iState( EINIT ) {}; + + /** + * Destructor. + */ + virtual ~WlanConfigureTxQueueParams() {}; + +private: + + // Types for the FSM + + // events for the FSM + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + EEVENTMAX // defined as an upper bound + }; + + // states of the FSM + enum TState + { + EINIT, // start state of the state machine + ECONFIGUREBESTEFFORTQUEUE, + ECONFIGUREVOICEQUEUE, + ECONFIGUREVIDEOQUEUE, + ECONFIGUREBACKGROUNDQUEUE, + ECONFIGUREAC, + EFINIT, + ESTATEMAX // defined as an upper bound + }; + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?member_description. + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureQueue( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId ); + + /** + * ?member_description. + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + void ConfigureAc( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * ?description + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * ?description + * + * @since Series 60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl); + + /** + * From ?base_class1. + * ?description + * + * @since Series 60 3.1 + * @param + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // Prohibit copy constructor. + WlanConfigureTxQueueParams( const WlanConfigureTxQueueParams& ); + // Prohibit assignment operator. + WlanConfigureTxQueueParams& operator= + ( const WlanConfigureTxQueueParams& ); + +private: // Data + + TState iState; + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** state names for tracing */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + /** event names for tracing */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + static const TInt8 iName[]; +#endif // !NDEBUG + + }; + +#endif // WLAN_CONFIGURE_TX_QUEUE_PARAMS_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconnectcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconnectcontext.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,346 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanConnectContext class. +* +*/ + +/* +* %version: 21 % +*/ + +#ifndef WLANCONNECTCONTEXT_H +#define WLANCONNECTCONTEXT_H + +#include "umac_types.h" +#include "umacinternaldefinitions.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +#include "802dot11.h" +#include "umacoidmsg.h" +#include "wha_mibDefaultvalues.h" + +/** + * WLAN connection context + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanConnectContext + { + +public: + + /** + * C++ default constructor. + */ + inline WlanConnectContext(); + + /** + * Destructor. + */ + virtual inline ~WlanConnectContext(); + +private: + + // Prohibit copy constructor + WlanConnectContext( const WlanConnectContext& ); + // Prohibit assigment operator + WlanConnectContext& operator= ( const WlanConnectContext& ); + +public: // Data + + /** items from Connect mgmt command; begin */ + /** + * pointer to a Beacon or Probe Response frame body from the network + * to connect to. This pointer is temporarily stored here in the roaming case + * Not own. + */ + const TUint8* iScanResponseFrameBody; + /** length of the Beacon / Probe Response frame body (above) */ + TUint16 iScanResponseFrameBodyLength; + /** + * the IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * Not own. + */ + const TUint8* iIeData; + /** length of IE(s) to be included into the (re-)association request */ + TUint8 iIeDataLength; + /** BSSID where to connect/connectted to */ + ::TMacAddress iBSSID; + /** SSID where to connect/connectted to */ + TSSID iSSID; + /** authentication algorithm number to be used */ + TUint16 iAuthAlgorithmNbr; + /** used privacy mode */ + TEncryptionStatus iEncryptionStatus; + /** Pairwise cipher to be used */ + TWlanCipherSuite iPairwiseCipher; + /** Radio Measurement settings */ + TBool iRadioMeasurement; + /** adhoc or infrastructure mode */ + WHA::TOperationMode iOperationMode; + /** items from Connect mgmt command; end */ + + /** group key type inserted */ + WHA::TKeyType iGroupKeyType; + /** pairwise key type inserted */ + WHA::TKeyType iPairWiseKeyType; + + /** items initially set from scaninfo - begin */ + /** minimum basic rate of the network */ + TUint32 iNwsaMinBasicRate; + /** maxium basic rate of the network*/ + TUint32 iNwsaMaxBasicRate; + /** basic rate set of the network*/ + TUint32 iNwsaBasicRateSet; + /** specifies to used channel of the network */ + WHA::TChannelNumber iChannelNumber; + /** items initially set from scaninfo - end */ + + /** the desired dot11 power management mode in BSS mode */ + WHA::TPsMode iDesiredDot11PwrMgmtMode; + /** the current dot11 power management mode in BSS mode */ + WHA::TPsMode iCurrentDot11PwrMgmtMode; + + /** the desired PS mode config */ + TDot11PsModeWakeupSetting iDesiredPsModeConfig; + /** + * the desired dot11 power management mode in BSS mode + * from WLAN Mgmt Client perspective + */ + WHA::TPsMode iClientDesiredDot11PwrMgtMode; + + /** the desired Light PS mode config from WLAN Mgmt Client perspective */ + TDot11PsModeWakeupSetting iClientLightPsModeConfig; + + /** the desired Deep PS mode config from WLAN Mgmt Client perspective */ + TDot11PsModeWakeupSetting iClientDeepPsModeConfig; + + /** beacon interval */ + TUint32 iBeaconInterval; + /** ATIM window */ + TUint32 iAtim; + + /** holds the flags defined below it */ + TUint32 iFlags; + /** if network has short slottime bit set */ + static const TUint32 KUseShortSlotTime = ( 1 << 0 ); + /** if network has protection bit set we must use ctstoself */ + static const TUint32 KProtectionBitSet = ( 1 << 1 ); + /** QoS supported by the network */ + static const TUint32 KQosEnabled = ( 1 << 2 ); + /** does AP demand to use short preamble or not */ + static const TUint32 KUseShortPreamble = ( 1 << 3 ); + /** + * if we are roaming we will perform reassociation + * instead of association. + */ + static const TUint32 KReassociate = ( 1 << 4 ); + /** U-APSD supported by the network */ + static const TUint32 KUapsdEnabled = ( 1 << 5 ); + /** multicast filtering is not allowed */ + static const TUint32 KMulticastFilteringDisAllowed = ( 1 << 6 ); + /** network has sent ERP IE in beacon/probe response */ + static const TUint32 KErpIePresent = ( 1 << 7 ); + /** + * the AP has sent us either a disassociation or + * a deauthentication frame. + */ + static const TUint32 KDisassociatedByAp = ( 1 << 8 ); + /** + * set if WLAN mgmt client has requested Voice AC to be made + * both trigger and delivery enabled + */ + static const TUint32 KUapsdRequestedForVoice = ( 1 << 9 ); + /** + * set if WLAN mgmt client has requested Video AC to be made + * both trigger and delivery enabled + */ + static const TUint32 KUapsdRequestedForVideo = ( 1 << 10 ); + /** + * set if WLAN mgmt client has requested Best Effort AC to be made + * both trigger and delivery enabled + */ + static const TUint32 KUapsdRequestedForBestEffort = ( 1 << 11 ); + /** + * set if WLAN mgmt client has requested Background AC to be made + * both trigger and delivery enabled + */ + static const TUint32 KUapsdRequestedForBackground = ( 1 << 12 ); + /** + * set if Voice AC is both trigger and delivery enabled + */ + static const TUint32 KUapsdUsedForVoice = ( 1 << 13 ); + /** + * set if Video AC is both trigger and delivery enabled + */ + static const TUint32 KUapsdUsedForVideo = ( 1 << 14 ); + /** + * set if Best Effort AC is both trigger and delivery enabled + */ + static const TUint32 KUapsdUsedForBestEffort = ( 1 << 15 ); + /** + * set if Background AC is both trigger and delivery enabled + */ + static const TUint32 KUapsdUsedForBackground = ( 1 << 16 ); + /** + * set if finding suitable time to perform AP tests has been started + */ + static const TUint32 KApTestOpportunitySeekStarted = ( 1 << 17 ); + /** + * set if suitable time to perform AP tests has been indicated to WLAN + * Mgmt Client + */ + static const TUint32 KApTestOpportunityIndicated = ( 1 << 18 ); + /** set if the target/current nw supports HT operation (802.11n) */ + static const TUint32 KHtSupportedByNw = ( 1 << 19 ); + /** + * set if WLAN Mgmt Client has disabled dynamic power mode management + */ + static const TUint32 KDynamicPwrModeMgmtDisabled = ( 1 << 20 ); + + + /** AP advertised supported rates IE */ + SSupportedRatesIE iApSupportedRates; + /** AP advertised extended supported rates IE */ + SExtendedSupportedRatesIE iApExtendedSupportedRates; + /** AP capability information fixed field */ + SCapabilityInformationField iCapabilityInformation; + /** association ID */ + TUint32 iAid; + + /** + * these are the rates we advertise + * to AP in assoc-request frame. Extended rates + * used also if more than eight rates supported + */ + SSupportedRatesIE iOurSupportedRates; + SExtendedSupportedRatesIE iOurExtendedSupportedRates; + + /** + * The following four arrays contain the Access Category + * parameters for the current network. + * Indexed with WHA::TQueueId values + */ + TCwMinVector iCwMin; + TCwMaxVector iCwMax; + TAifsVector iAIFS; + TTxOplimitVector iTxOplimit; + /** + * WMM Parater Set Count, which is a 4 bit value when coming + * from the network + * Has value KWmmParamSetNotDefined if WMM parameters have not + * been defined + */ + TUint8 iWmmParamSetCount; + /** + * WMM IE which we use to inform about our WMM (QoS) settings + */ + STxWmmIE iOurWmmIe; + /** + * Is admission control mandatory (i.e. required by the AP) for + * the ACs. Indexed with a WHA::TQueueId value + */ + TAcmVector iAdmCtrlMandatory; + /** + * Bitmask of WHA rates which both us and the nw support + */ + TUint32 iRateBitMask; + /* + * provided by WLAN mgmt client. + * Defines the rate class(es) to use for frame Tx. + * If WLAN PDD does not support as many rate classes as are specified + * here, only the rate class specified for ELegacy + * queue, which shall be the first policy in this array, will be used. + */ + TTxRatePolicy iRatePolicy; + /* + * provided by WLAN mgmt client. + * Defines the rate class to be used for every Tx queue / QoS Access + * Category. + * TQueueId is used to index this array. + */ + TQueue2RateClass iQueue2RateClass; + /* + * provided by WLAN mgmt client. + * Defines the Max Tx rate which will be initially used to transmit using + * the rate class in question. If the specified rate is not supported, + * the next lower supported rate from the rate policy will be used + * instead. + * Only the first numOfPolicyObjects values (see TTxRatePolicy) from + * the beginning of the array are relevant. + */ + TInitialMaxTxRate4RateClass iInitialMaxTxRate4RateClass; + /** + * provided by WLAN mgmt client. + * Defines the rate class(es) to use for frame Tx when the WLAN vendor + * implementation handles Tx rate adaptation. + * If WLAN PDD does not support as many rate classes as are specified + * in this command message, only the rate class specified for ELegacy + * queue, which shall be the first class in this array, will be used. + * The mapping defined in queue2RateClass applies also to these classes. + * The shortRetryLimit and the longRetryLimit values defined as part of + * the ratePolicy are relevant also with the auto rate policy. + * Only the first numOfPolicyObjects values (see TTxRatePolicy) from + * the beginning of the array are relevant. + */ + TTxAutoRatePolicy iAutoRatePolicy; + /** + * provided by WLAN mgmt client. + * Defines the HT MCS sets to use for frame Tx when communicating + * with a HT network. + * If WLAN PDD does not support as many MCS sets as are specified + * here, only the MCS set specified for ELegacy + * queue, which shall be the first MCS set in this array, will be used. + * The mapping defined in queue2RateClass applies also to these MCS sets. + * The shortRetryLimit and the longRetryLimit values defined as part of + * the iRatePolicy are relevant also with the MCS sets. + * Only the first numOfPolicyObjects values (see TTxRatePolicy) from + * the beginning of the array are relevant. + */ + THtMcsPolicy iHtMcsPolicy; + /** + * the ID of the special Tx rate policy which can be used to transmit + * frames whose successful delivery is of special importance. + * Value zero means that such a policy is not available. + */ + TUint8 iSpecialTxRatePolicyId; + /** + * Maximum U-APSD Service Period length. Indicates the max number of MSDUs and + * MMPDUs the WMM AP may deliver to a WMM STA during any service period + * triggered by the WMM STA. + * This value is provided by WLAN mgmt client + */ + TQosInfoUapsdMaxSpLen iUapsdMaxSpLen; + /** + * HT Capabilities element of the target/current network informing its + * static HT capabilities + */ + SHtCapabilitiesIE iNwHtCapabilitiesIe; + /** + * HT Operation element of the target/current network informing its + * dynamic HT configuration + */ + SHtOperationIE iNwHtOperationIe; + }; + +#include "umacconnectcontext.inl" + +#endif // WLANCONNECTCONTEXT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconnectcontext.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacconnectcontext.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanConnectContext inline methods +* +*/ + +/* +* %version: 15 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanConnectContext::WlanConnectContext() : + iScanResponseFrameBody( NULL ), + iScanResponseFrameBodyLength( 0 ), + iIeData( NULL ), + iIeDataLength( 0 ), + iBSSID( KZeroMacAddr ), + iAuthAlgorithmNbr( 0 ), + iEncryptionStatus( EEncryptionDisabled ), + iPairwiseCipher( EWlanCipherSuiteNone ), + iRadioMeasurement( EFalse ), + iOperationMode( WHA::EBSS ), + iGroupKeyType( WHA::EKeyNone ), + iPairWiseKeyType( WHA::EKeyNone ), + iNwsaMinBasicRate( 0 ), + iNwsaMaxBasicRate( 0 ), + iNwsaBasicRateSet( 0 ), + iChannelNumber( 0 ), + iDesiredDot11PwrMgmtMode( static_cast( 0 ) ), + iCurrentDot11PwrMgmtMode( static_cast( 0 ) ), + iClientDesiredDot11PwrMgtMode( static_cast( 0 ) ), + iBeaconInterval( 0 ), + iAtim( 0 ), + iFlags( 0 | + KUapsdRequestedForVoice | + KUapsdRequestedForVideo | + KUapsdRequestedForBestEffort | + KUapsdRequestedForBackground ), + iAid( 0 ), + iWmmParamSetCount( KWmmParamSetNotDefined ), + iRateBitMask( 0 ), + iSpecialTxRatePolicyId( 0 ), + iUapsdMaxSpLen( EMaxSpLenAllFrames ) + { + os_memset( &iSSID, 0, sizeof( iSSID ) ); + iDesiredPsModeConfig.iWakeupMode = EWakeUpIntervalAllBeacons; + iDesiredPsModeConfig.iListenInterval = 0 ; + iClientLightPsModeConfig.iWakeupMode = EWakeUpIntervalAllBeacons; + iClientLightPsModeConfig.iListenInterval = 0 ; + iClientDeepPsModeConfig.iWakeupMode = EWakeUpIntervalAllDtims; + iClientDeepPsModeConfig.iListenInterval = 0; + os_memset( iCwMin, 0, sizeof( iCwMin ) ); + os_memset( iCwMax, 0, sizeof( iCwMax ) ); + os_memset( iAIFS, 0, sizeof( iAIFS ) ); + os_memset( iTxOplimit, 0, sizeof( iTxOplimit ) ); + os_memset( iAdmCtrlMandatory, 0, sizeof( iAdmCtrlMandatory ) ); + + // first clear ... + os_memset( &iRatePolicy, 0, sizeof( iRatePolicy ) ); + // .. then initialize Tx rate policy with the default value, which + // specifies only a single rate class + // Note that the types WHA::StxRatePolicy and TTxRatePolicy are + // effectively equivalent upto - and including - the definition of the + // 1st rate class, so this memcpy is ok + os_memcpy( + &iRatePolicy, + &WHA::KTxRatePolicyMibDefault, + sizeof( WHA::KTxRatePolicyMibDefault ) ); + + // initialize every Tx queue to use the 1st rate class, at index 0 + os_memset( + &iQueue2RateClass, + 0, + sizeof( iQueue2RateClass ) ); + + os_memset( + &iInitialMaxTxRate4RateClass, + 0, + sizeof( iInitialMaxTxRate4RateClass ) ); + + // initialize initial max Tx rate for 1st rate class + iInitialMaxTxRate4RateClass[0] = WHA::KRate1Mbits; + + os_memset( + &iAutoRatePolicy, + 0, + sizeof( iAutoRatePolicy ) ); + + os_memset( + &iHtMcsPolicy, + 0, + sizeof( iHtMcsPolicy ) ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanConnectContext::~WlanConnectContext() + { + iScanResponseFrameBody = NULL; + iIeData = NULL; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdeeppsmodepowermodemgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdeeppsmodepowermodemgr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDeepPsModePowerModeMgr class +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLAN_DEEP_PS_MODE_POWER_MODE_MGR +#define WLAN_DEEP_PS_MODE_POWER_MODE_MGR + +#include "umacpowermodemgrbase.h" + +class WlanContextImpl; + +/** +* Class implementing infrastructure mode dynamic power mode management +* algorithm for Deep PS mode +*/ +class WlanDeepPsModePowerModeMgr : public WlanPowerModeMgrBase + { + +public: + + /** Ctor */ + WlanDeepPsModePowerModeMgr(); + + /** Dtor */ + virtual ~WlanDeepPsModePowerModeMgr(); + + /** + * To be called when transmitting a frame + * + * @since S60 5.1 + * Determines the need to make a power mode transition + * @param aCtxImpl global statemachine context + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + * @param aEtherType Ethernet type of the frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameTx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TUint16 aEtherType, + TBool aIgnoreThisFrame ); + + /** + * To be called when accepting an Rx frame + * + * @since S60 5.1 + * @param aCtxImpl global statemachine context + * @param aAccessCategory AC/Queue via which the frame has beeen transmitted + * @param aEtherType Ethernet type of the received frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @param aPayloadLength length of the ethernet frame payload + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameRx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TDaType aDaType ); + + /** + * From WlanPowerModeMgrBase + * Resets the state of the object + * + * @since S60 5.1 + */ + virtual void DoReset() {}; + +private: // Methods + + // Prohibit copy constructor + WlanDeepPsModePowerModeMgr( const WlanDeepPsModePowerModeMgr& ); + // Prohibit assigment operator + WlanDeepPsModePowerModeMgr& operator= ( + const WlanDeepPsModePowerModeMgr& ); + +private: // Data + +}; + +#endif // WLAN_DEEP_PS_MODE_POWER_MODE_MGR diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdfcclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdfcclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: dfc client callback interface +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANDFCCLIENT_H +#define WLANDFCCLIENT_H + +/** + * dfc client callback interface + * + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class MWlanDfcClient + { + +public: + + /** + * dfc callback + * + * @since S60 v3.1 + * @param aCtx callback context + */ + virtual void OnDfc( TAny* aCtx ) = 0; + + }; + + +#endif // WLANDFCCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11associatepending.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11associatepending.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDot11AssociationPending inline methods. +* +*/ + +/* +* %version: 4 % +*/ + +inline TBool WlanDot11AssociationPending::Associated() const + { + return (iFlags & KAssocSuccess ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11authenticatepending.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11authenticatepending.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDot11AuthenticatePending inline methods. +* +*/ + +/* +* %version: 5 % +*/ + +inline TBool WlanDot11AuthenticatePending::Authenticated() const + { + return (iFlags & KAuthSuccess ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11ibssnormalmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11ibssnormalmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11IbssNormalMode class. +* +*/ + +/* +* %version: 13 % +*/ + +#ifndef C_WLANDOT11IBSSNORMALMODE_H +#define C_WLANDOT11IBSSNORMALMODE_H + + +#include "UmacDot11IbssMode.h" + +/** + * Normal IBSS mode operation state + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11IbssNormalMode : public WlanDot11IbssMode + { +public: + + WlanDot11IbssNormalMode() {}; + + + virtual ~WlanDot11IbssNormalMode() {}; + +private: + + // from base class WlanDot11Associated + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Exit( WlanContextImpl& aCtxImpl); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * Connect (authenticate and associate) to a WLAN network + * + * @since S60 3.1 + * @param aCtxImpl statemachine context + * @param aSSID Name of the network + * @param aBSSID BSSID of the access point + * @param aAuthAlgorithmNbr Authentication algorithm number to be used + * @param aEncryptionStatus Used encryption mode + * @param aIsInfra ETrue when connecting to infrastructure network + * @param aScanResponseFrameBodyLength length of the scan response frame body + * @param aScanResponseFrameBody scan response frame body + * @param aIeData The IE(s) to be included into the (re-)association request. + * NULL, if none to be included + * @param aIeDataLength Length of the IE(s) to be included into the + * (re-)association request + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual TBool Disconnect( WlanContextImpl& aCtxImpl ); + + /** + * Scan all available networks. + * This SW module decides is background scan or foreground scan used + * @param aCtxImpl statemachine context + * @param aMode passive or active scan see #TScanMode + * @param aSSID Network that APs are scanned. Can be broadcast SSID. + * @param aScanRate Rate that is used in active scanning + * @param aMinChannelTime min. time to listen beacons/probe responses on + * a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses on + * a channel + * @param aSplitScan if ETrue, use split scan + * @return KErrNone = command completed successfully, + * any other = failure + */ + virtual TBool RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + + /** + * Called upon receiving a beacon type frame + * @param aCtxImpl statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + // Prohibit copy constructor. + WlanDot11IbssNormalMode( const WlanDot11IbssNormalMode& ); + // Prohibit assigment operator. + WlanDot11IbssNormalMode& operator= ( const WlanDot11IbssNormalMode& ); + +private: // data + + /** + * name of the state + */ + static const TInt8 iName[]; + }; + +#endif // C_WLANDOT11IBSSNORMALMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11ibssscanningmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11ibssscanningmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,400 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11IbssScanningMode class. +* +*/ + +/* +* %version: 13 % +*/ + +#ifndef C_WLANDOT11IBSSSCANNINGMODE_H +#define C_WLANDOT11IBSSSCANNINGMODE_H + +#include "UmacDot11IbssMode.h" +#include "umacscanfsmcb.h" + +class WlanContextImpl; +class WlanScanFsmCntx; + +/** + * IBSS scanning mode state + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11IbssScanningMode : + public WlanDot11IbssMode, + public MWlanScanFsmCb + { + +public: + + /** Types for the FSM */ + + /** events for the FSM */ + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + ESTARTSCANNINGMODE, // start scanning mode event + ESCANMODERUNNING, // scan running event + ESTOPSCANNINGMODE, // stop scanning mode request + ESCANNINGMODEEXIT, // scanning mode termination event + + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + /** states of the FSM */ + enum TState + { + EINIT, // start state of the state machine + EEXECUTESCANFSM, // execute scan fsm + ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal + ESTATEMAX // defined as an upper bound + }; + + WlanDot11IbssScanningMode() + : iState( EINIT ), iCtxImpl( NULL ), + iMode( static_cast( 0 ) ), iScanRate( 0 ), iPimpl( NULL ), + iSSID( NULL ), iChannels( NULL ), iMinChannelTime( 0 ), + iMaxChannelTime( 0 ), iSplitScan( EFalse ) {}; + + virtual ~WlanDot11IbssScanningMode(); + + + void Set( WlanContextImpl& aCtxImpl ); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void Set( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + +private: + + /** + * Internal state transition method + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aNewState new internal state + */ + void ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState ); + + /** + * Feeds an event to internal fsm + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aEvent fsm event + */ + void Fsm( WlanContextImpl& aCtxImpl, TEvent aEvent ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ) const; + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStartScanningModeEvent( WlanContextImpl& aCtxImpl ); + + /** + * Handles Scan Running event from scan fsm + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void OnScanModeRunningEvent( WlanContextImpl& aCtxImpl ) const; + + /** + * Handles Stop Scanning Mode event from scan fsm + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void OnStopScanningModeEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnScanningModeExitEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ExecuteScanFsm( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + // from base class MWlanWhaCommandClient + + /** + * From MWlanWhaCommandClient. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + // from base class MWlanWsaEvent + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TBool CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TAny* RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + // from base class WlanDot11Associated + + /** + * From WlanDot11Associated. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + /** + * From WlanDot11Associated. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnProbeResponseFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + // from base class WlanMacState + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // from base class MWlanScanFsmCb + + virtual void OnScanFsmEvent( MWlanScanFsmCb::TEvent aEvent ); + + // Prohibit copy constructor. + WlanDot11IbssScanningMode( + const WlanDot11IbssScanningMode& ); + // Prohibit assigment operator. + WlanDot11IbssScanningMode& operator= ( + const WlanDot11IbssScanningMode& ); + +private: // data + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** + * state names for tracing + */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + + /** + * event names for tracing + */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + + /** + * state of the fsm + */ + TState iState; + + /** + * global state machine context + * Not own. + */ + WlanContextImpl* iCtxImpl; + + /** + * scan parameter as non-WHA types + */ + TScanMode iMode; + + /** + * scan parameter as non-WHA types + */ + TUint32 iScanRate; + + /** + * pointer to the scan fsm implementation + * Own. + */ + WlanScanFsmCntx* iPimpl; + + /** + * scan parameter as non-WHA types + * Not own. + */ + const TSSID* iSSID; + + /** + * scan parameter as non-WHA types + * Not own. + */ + SChannels* iChannels; + + /** + * minimum channel time + */ + TUint32 iMinChannelTime; + + /** + * maximum channel time + */ + TUint32 iMaxChannelTime; + + /** + * should split scan be used + */ + TBool iSplitScan; + }; + +#endif // C_WLANDOT11IBSSSCANNINGMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11idlescanningmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11idlescanningmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,391 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11IdleScanningMode class. +* +*/ + +/* +* %version: 12 % +*/ + +#ifndef C_WLANDOT11IDLESCANNINGMODE_H +#define C_WLANDOT11IDLESCANNINGMODE_H + +#include "UmacDot11State.h" +#include "umacscanfsmcb.h" + +class WlanContextImpl; +class WlanScanFsmCntx; + +/** + * Idle mode scanning state + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11IdleScanningMode : + public WlanDot11State, + public MWlanScanFsmCb + { + +public: + + /** Types for the FSM */ + + /** events for the FSM */ + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + ESTARTSCANNINGMODE, // start scanning mode event + ESCANMODERUNNING, // scan running event + ESTOPSCANNINGMODE, // stop scanning mode request + ESCANNINGMODEEXIT, // scanning mode termination event + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + /** states of the FSM */ + enum TState + { + EINIT, // start state of the state machine + ESETSLEEPMODE, // configure sleep mode mib + EEXECUTESCANFSM, // execute scan fsm + ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal + ESTATEMAX // defined as an upper bound + }; + + WlanDot11IdleScanningMode() + : iState( EINIT ), iCtxImpl( NULL ), + iMode( static_cast( 0 ) ), iScanRate( 0 ), iPimpl( NULL ), + iSSID( NULL ), iChannels( NULL ), iMinChannelTime( 0 ), + iMaxChannelTime( 0 ), iSplitScan( EFalse ) {}; + + virtual ~WlanDot11IdleScanningMode(); + + void Set( WlanContextImpl& aCtxImpl ); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void Set( + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ); + +private: + + /** + * Internal state transition method + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aNewState new internal state + */ + void ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState ); + + /** + * Feeds an event to internal fsm + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aEvent fsm event + */ + void Fsm( WlanContextImpl& aCtxImpl, TEvent aEvent ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStartScanningModeEvent( WlanContextImpl& aCtxImpl ); + + /** + * Handles Scan Running event from scan fsm + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void OnScanModeRunningEvent( WlanContextImpl& aCtxImpl ) const; + + /** + * Handles Stop Scanning Mode event from scan fsm + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void OnStopScanningModeEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnScanningModeExitEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetSleepMode( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ExecuteScanFsm( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + // from base class MWlanWhaCommandClient + + /** + * From MWlanWhaCommandClient. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + // from base class MWlanWsaEvent + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TBool CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TAny* RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ); + + // from base class WlanMacState + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // from base class MWlanScanFsmCb + + virtual void OnScanFsmEvent( MWlanScanFsmCb::TEvent aEvent ); + + // Prohibit copy constructor. + WlanDot11IdleScanningMode( + const WlanDot11IdleScanningMode& ); + // Prohibit assigment operator. + WlanDot11IdleScanningMode& operator= ( + const WlanDot11IdleScanningMode& ); + +private: // data + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** + * state names for tracing + */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + + /** + * event names for tracing + */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + + /** + * state of the fsm + */ + TState iState; + + /** + * global state machine context + * Not own. + */ + WlanContextImpl* iCtxImpl; + + /** + * scan parameter as non-WHA types + */ + TScanMode iMode; + + /** + * scan parameter as non-WHA types + */ + TUint32 iScanRate; + + /** + * pointer to the scan fsm implementation + * Own. + */ + WlanScanFsmCntx* iPimpl; + + /** + * scan parameter as non-WHA types + * Not own. + */ + const TSSID* iSSID; + + /** + * scan parameter as non-WHA types + * Not own. + */ + SChannels* iChannels; + + /** + * minimum channel time + */ + TUint32 iMinChannelTime; + + /** + * maximum channel time + */ + TUint32 iMaxChannelTime; + + /** + * should split scan be used + */ + TBool iSplitScan; + }; + +#endif // C_WLANDOT11IDLESCANNINGMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurenormalmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurenormalmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11InfrastructureNormalMode class. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef C_WLANDOT11INFRASTRUCTURENORMALMODE_H +#define C_WLANDOT11INFRASTRUCTURENORMALMODE_H + +#include "UmacDot11InfrastructureMode.h" + +/** + * Normal infrastructure mode operation state + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11InfrastructureNormalMode : public WlanDot11InfrastructureMode + { +public: + + /** + * C++ default constructor. + */ + WlanDot11InfrastructureNormalMode() {}; + + /** + * Destructor. + */ + virtual ~WlanDot11InfrastructureNormalMode() {}; + + /** + * Changes dot11 power management mode between active and PS mode + * + * @param aCtxImpl statemachine context + * @return ETrue if state change occurred, EFalse otherwise + */ + virtual TBool ChangePowerMgmtMode( + WlanContextImpl& aCtxImpl ); + + /** + * Active to Light PS timer timeout function + * + * @since S60 v5.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnActiveToLightPsTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Light PS to Active timer timeout function + * + * @since S60 v5.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnLightPsToActiveTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * Light PS to Deep PS timer timeout function + * + * @since S60 v5.1 + * @param aCtxImpl statemachine context + * @return ETrue if a state change occurred in the state machine + * EFalse otherwise + */ + virtual TBool OnLightPsToDeepPsTimerTimeout( WlanContextImpl& aCtxImpl ); + +private: + + // from base class WlanDot11Associated + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Exit( WlanContextImpl& aCtxImpl); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual TBool OnDot11PwrMgmtTransitRequired( WlanContextImpl& aCtxImpl ); + + // Prohibit copy constructor. + WlanDot11InfrastructureNormalMode( const WlanDot11InfrastructureNormalMode& ); + // Prohibit assigment operator. + WlanDot11InfrastructureNormalMode& operator= ( const WlanDot11InfrastructureNormalMode& ); + +private: // data + +#ifndef NDEBUG + /** + * name of the state + */ + static const TInt8 iName[]; +#endif // !NDEBUG + }; + +#endif // C_WLANDOT11INFRASTRUCTURENORMALMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurescanningmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurescanningmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,438 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11InfrastructureScanningMode +* class. +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef C_WLANDOT11DOT11INFRASTRUCTURESCANNINGMODE_H +#define C_WLANDOT11DOT11INFRASTRUCTURESCANNINGMODE_H + +#include "UmacDot11InfrastructureMode.h" +#include "umacscanfsmcb.h" + +class WlanContextImpl; +class WlanScanFsmCntx; + +/** + * Infrastructure mode scanning state + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11InfrastructureScanningMode : + public WlanDot11InfrastructureMode, + public MWlanScanFsmCb + { + +public: + + /** backtrack to previous dot11 state when internal fsm is complete */ + static const TUint32 KDot11StateBackTrack = ( 1 << 0 ); + + /** + * does difference in dot11 power management mode exist + * between pre and post scanning mode + */ + static const TUint32 KDot11PwrMgmtModeDifference = ( 1 << 1 ); + + /** Types for the FSM */ + + /** events for the FSM */ + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + ESTARTSCANNINGMODE, // start scanning mode event + ESCANMODERUNNING, // scan running event + ESTOPSCANNINGMODE, // stop scanning mode request + ESCANNINGMODEEXIT, // scanning mode termination event + + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + /** states of the FSM */ + enum TState + { + EINIT, // start state of the state machine + EEXECUTESCANFSM, // execute scan fsm + ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal + ESTATEMAX // defined as an upper bound + }; + + WlanDot11InfrastructureScanningMode() + : iState( EINIT ), iMode( static_cast(0) ), + iScanRate( 0 ), iFlags( 0 ), iPimpl( NULL ), iCtxImpl( NULL ), + iSSID( NULL ), iChannels( NULL ), iMinChannelTime( 0 ), + iMaxChannelTime( 0 ), + iScanType( WHA::EForcedBgScan ), + iSplitScan( EFalse ) {}; + + virtual ~WlanDot11InfrastructureScanningMode(); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + inline void Dot11StateBackTrack(); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void Set( WlanContextImpl& aCtxImpl ); + + /** + * + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + */ + void Set( + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan, + WHA::TScanType aScanType = WHA::EForcedBgScan ); + +private: + + /** + * Internal state transition method + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aNewState new internal state + */ + void ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState ); + + /** + * Feeds an event to internal fsm + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aEvent fsm event + */ + void Fsm( WlanContextImpl& aCtxImpl, TEvent aEvent ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ) const; + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStartScanningModeEvent( WlanContextImpl& aCtxImpl ); + + /** + * Handles Scan Running event from scan fsm + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void OnScanModeRunningEvent( WlanContextImpl& aCtxImpl ) const; + + /** + * Handles Stop Scanning Mode event from scan fsm + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + */ + void OnStopScanningModeEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnScanningModeExitEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ExecuteScanFsm( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + + // from base class MWlanWhaCommandClient + + /** + * From MWlanWhaCommandClient. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ); + + // from base class MWlanWsaEvent + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TBool CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual TAny* RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ); + + // from base class WlanDot11Associated + + /** + * From WlanDot11Associated. + * Called upon receiving a beacon type frame + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + /** + * From WlanDot11Associated. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aRcpi RCPI of the frame + * @param aBuffer pointer to the beginning of the Rx buffer allocated + * for the frame + */ + virtual void OnProbeResponseFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ); + + // from base class WlanMacState + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + virtual void Exit( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * Stop a previously started scan process. + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool StopScan( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // from base class MWlanScanFsmCb + + virtual void OnScanFsmEvent( MWlanScanFsmCb::TEvent aEvent ); + + // Prohibit copy constructor. + WlanDot11InfrastructureScanningMode( + const WlanDot11InfrastructureScanningMode& ); + // Prohibit assigment operator. + WlanDot11InfrastructureScanningMode& operator= ( + const WlanDot11InfrastructureScanningMode& ); + +private: // data + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** + * state names for tracing + */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + + /** + * event names for tracing + */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + + /** + * state of the fsm + */ + TState iState; + + /** + * scan parameter as non-WHA types + */ + TScanMode iMode; + + /** + * scan parameter as non-WHA types + */ + TUint32 iScanRate; + + /** + * storage for interal flag values + */ + TUint32 iFlags; + + /** + * pointer to the scan fsm implementation + * Own. + */ + WlanScanFsmCntx* iPimpl; + + /** + * global state machine context + * Not own. + */ + WlanContextImpl* iCtxImpl; + + /** + * scan parameter as non-WHA types + * Not own. + */ + const TSSID* iSSID; + + /** + * scan parameter as non-WHA types + * Not own. + */ + SChannels* iChannels; + + /** + * minimum channel time + */ + TUint32 iMinChannelTime; + + /** + * maximum channel time + */ + TUint32 iMaxChannelTime; + + /** + * WHA scan type + */ + WHA::TScanType iScanType; + + /** + * should split scan be used + */ + TBool iSplitScan; + }; + +#include "umacdot11infrastructurescanningmode.inl" + +#endif // C_WLANDOT11DOT11INFRASTRUCTURESCANNINGMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurescanningmode.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurescanningmode.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDot11InfrastructureScanningMode inline +* methods. +* +*/ + +/* +* %version: 5 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanDot11InfrastructureScanningMode::Dot11StateBackTrack() + { + iFlags |= KDot11StateBackTrack; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11pwrmgmttransitionmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11pwrmgmttransitionmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDot11PwrMgmtTransitionMode class +* +*/ + +/* +* %version: 12 % +*/ + +#ifndef C_WLANDOT11PWRMGMTTRANSITIONMODE_H +#define C_WLANDOT11PWRMGMTTRANSITIONMODE_H + +#include "UmacDot11InfrastructureMode.h" + +/** + * State for performing a change between CAM and PS power management states. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanDot11PwrMgmtTransitionMode : public WlanDot11InfrastructureMode + { + +public: + + /** Types for the FSM */ + + /** events for the FSM */ + enum TEvent + { + ESTATEENTRY, // state entry action to be executed + ETXCOMPLETE, // underlying sw layer tx delivery complete event + // dot11 power management transition complete event + EPWRMGMTTRANSITCOMPLETE, + EABORT, // abort execution event + EEVENTMAX // defined as an upper bound + }; + + /** states of the FSM */ + enum TState + { + EINIT, // start state of the state machine + ESETAWAKEMODE, // set dot11 power management awake mode + ESETWAKEUPINTERVAL, // set wlanwakeupinterval mib + ESETPSMODE, // set dot11 power management ps mode + // wait state for dot11 power management transition complete event + EWAIT4PWRMGMTTRANSITCOMPLETE, + ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal + ESTATEMAX // defined as an upper bound + }; + + WlanDot11PwrMgmtTransitionMode() : iState( EINIT ), iFlags( 0 ) {}; + + + virtual ~WlanDot11PwrMgmtTransitionMode() {}; + + + + + private: + + // Prohibit copy constructor. + WlanDot11PwrMgmtTransitionMode( const WlanDot11PwrMgmtTransitionMode& ); + // Prohibit assigment operator. + WlanDot11PwrMgmtTransitionMode& operator= ( + const WlanDot11PwrMgmtTransitionMode& ); + + /** + * Internal state transition method + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aNewState new internal state + */ + void ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState ); + + /** + * Feeds an event to internal fsm + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aEvent fsm event + */ + void Fsm( WlanContextImpl& aCtxImpl, TEvent aEvent ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnPwrMgmtTransitCompleteEvent( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void OnAbortEvent( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ActivateDot11AwakeMode( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void SetWakeUpInterval( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ActivateDot11PsMode( WlanContextImpl& aCtxImpl ); + + /** + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + */ + void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); + +// from base class WlanMacState + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Exit( WlanContextImpl& aCtxImpl); + + /** + * From WlanMacState. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + +// from base class MWlanWsaEvent + + /** + * From MWlanWsaEvent. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual TBool CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& + aCommandCompletionParams ); + +// from base class WlanMacState + + /** + * From WlanMacState. + * Set 802.11 power mgmt mode in infrastructure networks. + * @param aCtxImpl statemachine context + * @param aPowerMode desired power mode + * @param aDisableDynamicPowerModeManagement If ETrue, disables the dynamic + * power mode management handling. Relevant only when aPowerMode + * is EPowerModePs + * @param aWakeupModeInLightPs WLAN wake-up mode in Light PS mode + * @param aListenIntervalInLightPs specifies the value of N for wake-up + * modes 2 and 3 in Light PS mode. + * @param aWakeupModeInDeepPs WLAN wake-up mode in Deep PS mode + * @param aListenIntervalInDeepPs specifies the value of N for wake-up + * modes 2 and 3 in Deep PS mode + * @return ETrue if a state transition occurred + * EFalse otherwise + */ + virtual TBool SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ); + +private: // data + +#ifndef NDEBUG + /** max length of state name for tracing */ + enum { KMaxStateStringLength = 50 }; + + /** max length of event name for tracing */ + enum { KMaxEventStringLength = KMaxStateStringLength }; + + /** + * state names for tracing + */ + static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; + + /** + * event names for tracing + */ + static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + + /** + * state of the fsm + */ + TState iState; + + /** + * internal flags + */ + TUint32 iFlags; + }; + +#endif // C_WLANDOT11PWRMGMTTRANSITIONMODE_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11reassociationpending.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11reassociationpending.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDot11ReassociationPending inline +* methods. +* +*/ + +/* +* %version: 4 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanDot11ReassociationPending::WlanDot11ReassociationPending() : + iState( EINIT ) + { + }; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanDot11ReassociationPending::~WlanDot11ReassociationPending() + { + }; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool WlanDot11ReassociationPending::Associated() const + { + return (iFlags & KReassocSuccess ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanDot11ReassociationPending::OnTxReassocFrameXferEvent( + WlanContextImpl& aCtxImpl ) + { + ChangeInternalState( aCtxImpl, EWAIT4REASSOCIATIONRESPONSE ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanDot11ReassociationPending::ConfigureAc( + WlanContextImpl& aCtxImpl ) + { + ConfigureAcParams( aCtxImpl ); + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,416 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDynamicPowerModeMgmtCntx class +* +*/ + +/* +* %version: 12 % +*/ + +#ifndef WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX +#define WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX + +#include "umacinternaldefinitions.h" +#include "umacactivemodepowermodemgr.h" +#include "umaclightpsmodepowermodemgr.h" +#include "umacdeeppsmodepowermodemgr.h" + +class WlanContextImpl; +class WlanPowerModeMgrBase; + +/* +* Context for implementing dynamic power mode transition algorithm in +* infrastructure mode between PS and active power management mode +*/ +class WlanDynamicPowerModeMgmtCntx + { + +public: + + /** Ctor */ + explicit WlanDynamicPowerModeMgmtCntx( WlanContextImpl& aWlanCtxImpl ); + + /** Dtor */ + ~WlanDynamicPowerModeMgmtCntx(); + + /** + * Starts dynamic power mode management + * + * @since S60 3.1 + */ + void StartPowerModeManagement(); + + /** + * Stops dynamic power mode management + * + * @since S60 3.1 + */ + void StopPowerModeManagement(); + + /** + * To be called before frame Tx + * Determines the need to make a power mode transition + * + * @since S60 3.1 + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + * @param aEtherType Ethernet type of the frame + * @return To which power management mode to change; if any at all + */ + TPowerMgmtModeChange OnFrameTx( + WHA::TQueueId aQueueId, + TUint16 aEtherType ); + + /** + * To be called when accepting an Rx frame + * + * @since S60 3.1 + * @param aAccessCategory AC/Queue via which the frame has beeen transmitted + * @param aEtherType Ethernet type of the received frame + * @param aPayloadLength length of the ethernet frame payload + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return To which power management mode to change; if any at all + */ + TPowerMgmtModeChange OnFrameRx( + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TUint aPayloadLength, + TDaType aDaType ); + + /** + * To be called upon Active to Light PS timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + TBool OnActiveToLightPsTimerTimeout(); + + /** + * To be called upon Light PS to Active timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + TBool OnLightPsToActiveTimerTimeout(); + + /** + * To be called upon Light PS to Deep PS timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + TBool OnLightPsToDeepPsTimerTimeout(); + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 3.1 + * @param aToLightPsTimeout time interval in microseconds after which + * transition from Active mode to Light PS mode is considered + * @param aToLightPsFrameThreshold frame count threshold used when + * considering transition from Active to Light PS mode + * @param aToActiveTimeout time interval in microseconds after which the + * frame counter used when considering transition from Light PS + * to Active mode is reset + * @param aToActiveFrameThreshold frame count threshold used when + * considering transition from Light PS to Active mode + * @param aToDeepPsTimeout time interval in microseconds after which + * transition from Light PS mode to Deep PS mode is considered + * @param aToDeepPsFrameThreshold frame count threshold used when + * considering transition from Light PS to Deep PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category + */ + void SetParameters( + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * Configures dynamic power mode management traffic override + * + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + * + * @since S60 3.2 + * @param aCtxImpl statemachine context + * @param aStayInPsDespiteUapsdVoiceTraffic U-APSD Voice AC setting + * @param aStayInPsDespiteUapsdVideoTraffic U-APSD Video AC setting + * @param aStayInPsDespiteUapsdBestEffortTraffic U-APSD Best Effort AC + * setting + * @param aStayInPsDespiteUapsdBackgroundTraffic U-APSD Background AC + * setting + * @param aStayInPsDespiteLegacyVoiceTraffic legacy Voice AC setting + * @param aStayInPsDespiteLegacyVideoTraffic legacy Video AC setting + * @param aStayInPsDespiteLegacyBestEffortTraffic legacy Best Effort AC + * setting + * @param aStayInPsDespiteLegacyBackgroundTraffic legacy Background AC + * setting + * @return ETrue if a state change occurred + * EFalse otherwise + */ + void ConfigureTrafficOverride( + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ); + + /** + * Freezes the dynamic power mode management traffic override settings + * provided earlier with the ConfigureTrafficOverride() method and based + * on whether U-APSD is used for the different ACs/Tx queues + * + * @since S60 3.2 + */ + void FreezeTrafficOverride(); + +private: + + /** + * Starts ToLightPsTimer + * + * @since S60 5.1 + * @param aTimeout timeout in microseconds + */ + void RegisterToLightPsTimeout(); + + /** + * Starts ToActiveTimer + * + * @since S60 5.1 + * @param aTimeout timeout in microseconds + */ + void RegisterToActiveTimeout(); + + /** + * Starts ToDeepPsTimer + * + * @since S60 5.1 + * @param aTimeout timeout in microseconds + */ + void RegisterToDeepPsTimeout(); + + /** + * Cancels ToLightPsTimer + * + * @since S60 5.1 + * @param aTimeout timeout in microseconds + */ + void CancelToLightPsTimeout(); + + /** + * Cancels ToActiveTimer + * + * @since S60 5.1 + * @param aTimeout timeout in microseconds + */ + void CancelToActiveTimeout(); + + /** + * Cancels ToDeepPsTimer + * + * @since S60 5.1 + * @param aTimeout timeout in microseconds + */ + void CancelToDeepPsTimeout(); + + /** + * Cancels all running timers + * + * @since S60 5.1 + */ + inline void CancelTimeouts(); + + /** + * Returns data traffic override setting for Voice AC + * regarding U-APSD traffic + * + * @since S60 3.1 + * @return ETrue if Voice AC traffic shall be ignored + */ + inline TBool StayInPsDespiteUapsdVoiceTraffic() const; + + /** + * Returns data traffic override setting for Video AC + * regarding U-APSD traffic + * + * @since S60 3.1 + * @return ETrue if Video AC traffic shall be ignored + */ + inline TBool StayInPsDespiteUapsdVideoTraffic() const; + + /** + * Returns data traffic override setting for Best Effort AC + * regarding U-APSD traffic + * + * @since S60 3.1 + * @return ETrue if Best Effort AC traffic shall be ignored + */ + inline TBool StayInPsDespiteUapsdBestEffortTraffic() const; + + /** + * Returns data traffic override setting for Background AC + * regarding U-APSD traffic + * + * @since S60 3.1 + * @return ETrue if Background AC traffic shall be ignored + */ + inline TBool StayInPsDespiteUapsdBackgroundTraffic() const; + + /** + * Returns data traffic override setting for Voice AC + * regarding legacy, i.e. non-U-APSD, traffic + * + * @since S60 3.1 + * @return ETrue if Voice AC traffic shall be ignored + */ + inline TBool StayInPsDespiteLegacyVoiceTraffic() const; + + /** + * Returns data traffic override setting for Video AC + * regarding legacy, i.e. non-U-APSD, traffic + * + * @since S60 3.1 + * @return ETrue if Video AC traffic shall be ignored + */ + inline TBool StayInPsDespiteLegacyVideoTraffic() const; + + /** + * Returns data traffic override setting for Best Effort AC + * regarding legacy, i.e. non-U-APSD, traffic + * + * @since S60 3.1 + * @return ETrue if Best Effort AC traffic shall be ignored + */ + inline TBool StayInPsDespiteLegacyBestEffortTraffic() const; + + /** + * Returns data traffic override setting for Background AC + * regarding legacy, i.e. non-U-APSD, traffic + * + * @since S60 3.1 + * @return ETrue if Background AC traffic shall be ignored + */ + inline TBool StayInPsDespiteLegacyBackgroundTraffic() const; + + // Prohibit copy constructor + WlanDynamicPowerModeMgmtCntx( + const WlanDynamicPowerModeMgmtCntx& ); + // Prohibit assigment operator + WlanDynamicPowerModeMgmtCntx& operator= + ( const WlanDynamicPowerModeMgmtCntx& ); + +private: // Data + + /** flag value to store state transition need internally */ + TBool iStateChange; + /** stores the flags defined below */ + TUint32 iFlags; + /** + * any amount of U-APSD Voice AC Rx or Tx traffic won't cause a + * change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteUapsdVoiceTraffic = ( 1 << 0 ); + /** + * any amount of U-APSD Video AC Rx or Tx traffic won't cause a + * change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteUapsdVideoTraffic = ( 1 << 1 ); + /** + * any amount of U-APSD Best Effort AC Rx or Tx traffic won't cause a + * change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteUapsdBestEffortTraffic = ( 1 << 2 ); + /** + * any amount of U-APSD Background AC Rx or Tx traffic won't cause a + * change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteUapsdBackgroundTraffic = ( 1 << 3 ); + /** + * any amount of legacy, i.e. non U-APSD, Voice AC Rx or Tx traffic + * won't cause a change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteLegacyVoiceTraffic = ( 1 << 4 ); + /** + * any amount of legacy, i.e. non U-APSD, Video AC Rx or Tx traffic + * won't cause a change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteLegacyVideoTraffic = ( 1 << 5 ); + /** + * any amount of legacy, i.e. non U-APSD, Best Effort AC Rx or Tx traffic + * won't cause a change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteLegacyBestEffortTraffic = ( 1 << 6 ); + /** + * any amount of legacy, i.e. non U-APSD, Background AC Rx or Tx traffic + * won't cause a change from PS to CAM mode once PS mode has been entered + */ + static const TUint32 KStayInPsDespiteLegacyBackgroundTraffic = ( 1 << 7 ); + /** ToLightPsTimer started */ + static const TUint32 KToLightPsTimerStarted = ( 1 << 8 ); + /** ToActiveTimer started */ + static const TUint32 KToActiveTimerStarted = ( 1 << 9 ); + /** ToDeepPsTimer started */ + static const TUint32 KToDeepPsTimerStarted = ( 1 << 10 ); + + // time interval in microseconds after which transition from Active + // mode to Light PS mode is considered. + TUint32 iToLightPsTimeout; + + // time interval in microseconds after which the frame counter + // used when considering transition from Light PS to Active mode is reset. + TUint32 iToActiveTimeout; + + // time interval in microseconds after which transition from Light PS + // mode to Deep PS mode is considered. + TUint32 iToDeepPsTimeout; + + /** currently active power management mode context */ + WlanPowerModeMgrBase* iActiveCntx; + /** context for active mode */ + WlanActiveModePowerModeMgr iActiveModeCntx; + /** context for Light PS mode */ + WlanLightPsModePowerModeMgr iLightPsModeCntx; + /** context for Deep PS mode */ + WlanDeepPsModePowerModeMgr iDeepPsModeCntx; + /** global state machine context reference */ + WlanContextImpl& iWlanContextImpl; + /** + * the frozen Rx & Tx traffic ignoration setting for every AC + */ + TBool iIgnoreTraffic[WHA::EQueueIdMax]; + }; + +#include "umacdynamicpowermodemgmtcntx.inl" + +#endif // WLAN_DYNAMIC_POWER_MODE_MGMT_CNTX diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdynamicpowermodemgmtcntx.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDynamicPowerModeMgmtCntx inline methods +* +*/ + +/* +* %version: 5 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanDynamicPowerModeMgmtCntx::CancelTimeouts() + { + CancelToLightPsTimeout(); + CancelToActiveTimeout(); + CancelToDeepPsTimeout(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline +TBool WlanDynamicPowerModeMgmtCntx::StayInPsDespiteUapsdVoiceTraffic() const + { + return ( iFlags & KStayInPsDespiteUapsdVoiceTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline +TBool WlanDynamicPowerModeMgmtCntx::StayInPsDespiteUapsdVideoTraffic() const + { + return ( iFlags & KStayInPsDespiteUapsdVideoTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool +WlanDynamicPowerModeMgmtCntx::StayInPsDespiteUapsdBestEffortTraffic() const + { + return ( iFlags & KStayInPsDespiteUapsdBestEffortTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool +WlanDynamicPowerModeMgmtCntx::StayInPsDespiteUapsdBackgroundTraffic() const + { + return ( iFlags & KStayInPsDespiteUapsdBackgroundTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline +TBool WlanDynamicPowerModeMgmtCntx::StayInPsDespiteLegacyVoiceTraffic() const + { + return ( iFlags & KStayInPsDespiteLegacyVoiceTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline +TBool WlanDynamicPowerModeMgmtCntx::StayInPsDespiteLegacyVideoTraffic() const + { + return ( iFlags & KStayInPsDespiteLegacyVideoTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool +WlanDynamicPowerModeMgmtCntx::StayInPsDespiteLegacyBestEffortTraffic() const + { + return ( iFlags & KStayInPsDespiteLegacyBestEffortTraffic ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool +WlanDynamicPowerModeMgmtCntx::StayInPsDespiteLegacyBackgroundTraffic() const + { + return ( iFlags & KStayInPsDespiteLegacyBackgroundTraffic ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacelementlocator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacelementlocator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanElementLocator class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLAN_ELEMENT_LOCATOR_H +#define WLAN_ELEMENT_LOCATOR_H + + +/** + * Provides methods to locate 802.11 information elements. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanElementLocator + { + +public: + + enum TWlanLocateStatus + { + EWlanLocateOk, + EWlanLocateElementNotFound + }; + + /** + * Constructor. + * + * @since S60 3.1 + * @param aStart (IN) beginning of the area from where to locate + * elements + * @param aLength (IN) length of the area to search + */ + WlanElementLocator( const TUint8* aStart, TUint16 aLength ); + + /** + * Return requested information element data. + * @param aIeId Id of the requested IE data. See 802dot11.h + * @param aIeLength (OUT) Length of the IE. Zero if IE not found. + * @param aIeData (OUT) Pointer to the beginning of the IE data. + * NULL if IE not found. + * @param aValidateLength (IN) If ETrue, the indicated length of the IE + * data part is checked for validity against the relevant + * specification. + * If EFalse, the validity check is not done. + * @return Locate status. + */ + TWlanLocateStatus InformationElement( + TUint8 aIeId, + TUint8& aIeLength, + const TUint8** aIeData, + TBool aValidateLength = ETrue ); + + /** + * Return requested information element data. + * + * @since S60 3.2 + * @param aIeId (IN) Id of the requested IE data. See 802dot11.h + * @param aIeOui (IN) OUI of the requested IE data. See 802dot11.h + * @param aIeOuiType (IN) OUI Type of the requested IE data. + * See 802dot11.h + * @param aIeLength (OUT) Length of the IE. Zero if IE not found. + * @param aIeData (OUT) Pointer to the beginning of the IE data. + * NULL if IE not found. + * @return Locate status. + */ + TWlanLocateStatus InformationElement( + TUint8 aIeId, + const TIeOui& aIeOui, + TUint8 aIeOuiType, + TUint8& aIeLength, + const TUint8** aIeData ); + + /** + * Return requested information element data. + * @param aIeId (IN) Id of the requested IE data. See 802dot11.h + * @param aIeOui (IN) OUI of the requested IE data. See 802dot11.h + * @param aIeOuiType (IN) OUI Type of the requested IE data. + * See 802dot11.h + * @param aIeOuiSubtype (IN) OUI Subtype of the requested IE data. + * See 802dot11.h + * @param aIeLength (OUT) Length of the IE. Zero if IE not found. + * @param aIeData (OUT) Pointer to the beginning of the IE data. + * NULL if IE not found. + * @return Locate status. + */ + TWlanLocateStatus InformationElement( + TUint8 aIeId, + const TIeOui& aIeOui, + TUint8 aIeOuiType, + TUint8 aIeOuiSubtype, + TUint8& aIeLength, + const TUint8** aIeData ); + +private: + + /** + * Return the first information element data. + * @param aIeId (OUT) Id of the IE. See 802dot11.h. + * @param aIeLength (OUT) Length of the IE. Zero if IE not found. + * @param aIeData (OUT) Pointer to the beginning of the IE data. + * NULL if IE not found. + * @return Locate status. + */ + TWlanLocateStatus FirstIE( + TUint8& aIeId, + TUint8& aIeLength, + const TUint8** aIeData ); + + /** + * Return next information element data. + * @param aIeId (OUT) Id of the IE. See 802dot11.h. + * @param aIeLength (OUT) Length of the IE. Zero if IE not found. + * @param aIeData (OUT) Pointer to the beginning of the IE data. + * NULL if IE not found. + * @return Locate status. + */ + TWlanLocateStatus NextIE( + TUint8& aIeId, + TUint8& aIeLength, + const TUint8** aIeData ); + + /** + * Return current information element data. + * @param aIeId (OUT) Id of the IE. See 802dot11.h. + * @param aIeLength (OUT) Length of the IE. Zero if IE not found. + * @param aIeData (OUT) Pointer to the beginning of the IE data. + * NULL if IE not found. + * @return Locate status. + */ + TWlanLocateStatus CurrentIE( + TUint8& aIeId, + TUint8& aIeLength, + const TUint8** aIeData ) const; + + /** + * Validates the indicated length of the IE data part (aIeLength) against + * the relevant specification. + * @param aIeId (IN) Id of the IE. See 802dot11.h. + * @param aIeLength (IN) Length of the IE. + * @param aIeData (IN) Pointer to the beginning of the IE data. NULL + * if not relevant for the validity check. + * @param aIeOuiType (IN) OUI Type of the IE (if relevant) + * @param aIeOuiSubtype (IN) OUI Subtype of the IE (if relevant) + * @return + */ + WlanElementLocator::TWlanLocateStatus ValidIE( + TUint8 aIeId, + TUint8 aIeLength, + const TUint8* aIeData = 0, + TUint8 aIeOuiType = KWmmElemOuiType, + TUint8 aIeOuiSubtype = KWmmInfoElemOuiSubType ) const; + + // Prohibit copy constructor. + WlanElementLocator( const WlanElementLocator& ); + // Prohibit assigment operator. + WlanElementLocator& operator= + ( const WlanElementLocator& ); + +private: // data + + /** start of the search area */ + const TUint8* iStart; + /** length of the search area */ + TUint16 iLength; + /** Iterator for going through elements */ + const TUint8* iIterator; + }; + +#endif // WLAN_ELEMENT_LOCATOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcher.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanEventDispatcher class. +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef WLANEVENTDISPATCHER_H +#define WLANEVENTDISPATCHER_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +#include "umacoidmsg.h" + +#include "umac_types.h" + +class WlanContextImpl; +class MWlanEventDispatcherClient; + +/** + * Event dispatcher which is used to serialize MAC prototocl + * statemachine access. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanEventDispatcher + { + +public: + + /** channel identifier type */ + typedef TUint32 TChannel; + + /** oid channel identifier */ + static const TChannel KOidChannel = ( 1 << 0 ); + + explicit WlanEventDispatcher( + MWlanEventDispatcherClient& aEventDispatcherClient ); + + inline ~WlanEventDispatcher(); + + /** + * Registers a WHA command completion event + * + * @since S60 3.1 + * @param aCompleteCommandId ID of the WHA command + * @param aStatus Command completion status + * @param aCommandCompletionParams Command completion output parameters + */ + void Register( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ); + + /** + * Registers a WLAN Mgmt Client command + * + * @since S60 3.1 + * @param aOid Command parameters + */ + inline void Register( const TOIDHeader& aOid ); + + /** + * Registers an internal UMAC event (triggered by an external event) + * + * @since S60 3.1 + * @param aInternalEvent Event to register + */ + inline void Register( TInternalEvent aInternalEvent ); + + /** + * Enables the specified event dispatching channels + * + * @since S60 3.1 + * @param aChannelMask Mask of the channels to enable + */ + inline void Enable( TChannel aChannelMask ); + + /** + * Disables the specified event dispatching channels + * + * @since S60 3.1 + * @param aChannelMask Mask of the channels to disable + */ + inline void Disable( TChannel aChannelMask ); + + /** + * Determines if specified even dispatching channel(s) is (are) enabled + * + * @since S60 3.1 + * @param aChannel The channel(s) to check + * @return ETrue if the channel(s) is (are) enabled + * EFalse otherwise + */ + inline TBool ChannelEnabled( TChannel aChannel ) const; + + /** + * Dispatches a single event, if there are any registered + * + * @since S60 3.1 + * @return ETrue If a global state change occurred because of the event + * dispatching + * EFalse otherwise + */ + TBool Dispatch(); + + /** + * Dispatches a single command completion event + * + * @since S60 3.1 + * @return ETrue If a global state change occurred as a result of the event + * dispatching + * EFalse otherwise + */ + TBool DispatchCommandCompletionEvent(); + + /** + * Determines if a command completion event for the specified + * command is registered + * + * @param aCommandId Id of the command to check + * @return ETrue if command completion event is registered + * EFalse otherwise + */ + inline TBool CommandCompletionRegistered( + WHA::TCompleteCommandId aCommandId ) const; + +private: + + /** + * Dispatches a single internal event + * + * @since S60 3.1 + * @return ETrue If a global state change occurred because of the event + * dispatching + * EFalse otherwise + */ + TBool DispatchInternalEvent(); + + /** + * Dispatches a single WLAN Mgmt Client command event + * + * @since S60 3.1 + * @return ETrue If a global state change occurred because of the event + * dispatching + * EFalse otherwise + */ + TBool DispatchOidEvent(); + + // Prohibit copy constructor. + WlanEventDispatcher( const WlanEventDispatcher& ); + // Prohibit assigment operator. + WlanEventDispatcher& operator= ( const WlanEventDispatcher& ); + +private: // data + + MWlanEventDispatcherClient& iEventDispatcherClient; + + struct TCommandResp + { + WHA::TCompleteCommandId iId; + WHA::TStatus iStatus; + WHA::UCommandCompletionParams iParams; + + inline TCommandResp(); + }; + + /** + * stores WHA command completion output parameters + */ + TCommandResp iWhaCommandCompletionParams; + + /** + * True, if a command completion event has been registed. + * At most one command completion event can exist at a time + */ + TBool iCommandCompletionRegistered; + + /** + * bit mask specifying the event dispatching channels which are currently + * disabled (if any) + */ + TChannel iDisableChannelMask; + + /** + * pointer to the structure holding the WLAN Mgmt Client command + * parameters. NULL if a command event is not registered + * Not own. + */ + const TOIDHeader* iOid; + + /** + * bitmask for registered internal events + */ + TInternalEvent iInternalEvents; + + }; + +#include "umaceventdispatcher.inl" + +#endif // WLANEVENTDISPATCHER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcher.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcher.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event dispatcher that is used to serialize MAC prototocl +* statemachine access +* +*/ + +/* +* %version: 10 % +*/ + +#include "umacinternaldefinitions.h" + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanEventDispatcher::~WlanEventDispatcher() + { + iOid = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanEventDispatcher::TCommandResp::TCommandResp() : + iId( static_cast( 0 ) ), + iStatus( static_cast( 0 ) ) + { + os_memset( &iParams, 0, sizeof(iParams) ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanEventDispatcher::Enable( + TChannel aChannelMask ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC * eventdispatcher * enable events") ); + + iDisableChannelMask &= ~aChannelMask; + + OsTracePrint( KEventDispatcher, + (TUint8*)("current mask: 0x%02x"), iDisableChannelMask ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanEventDispatcher::Disable( + TChannel aChannelMask ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC * eventdispatcher * disable events") ); + + iDisableChannelMask |= aChannelMask; + + OsTracePrint( KEventDispatcher, + (TUint8*)("current mask: 0x%02x"), iDisableChannelMask ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanEventDispatcher::Register( const TOIDHeader& aOid ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC * eventdispatcher * register OID") ); + OsTracePrint( KEventDispatcher, (TUint8*)("OID id: 0x%08x"), aOid.oid_id ); + + if ( iOid ) + { + // programming error + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + iOid = &aOid; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanEventDispatcher::Register( TInternalEvent aInternalEvent ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC: WlanEventDispatcher::Register(): register internal event: %d"), + aInternalEvent ); + iInternalEvents |= aInternalEvent; + + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC: WlanEventDispatcher::Register(): iInternalEvents: %d"), + iInternalEvents ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanEventDispatcher::ChannelEnabled( + TChannel aChannel ) const + { + return !(iDisableChannelMask & aChannel); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool WlanEventDispatcher::CommandCompletionRegistered( + WHA::TCompleteCommandId aCommandId ) const + { + return ( iCommandCompletionRegistered && + aCommandId == iWhaCommandCompletionParams.iId ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcherclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcherclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanEventDispatcherClient class. +* +*/ + +/* +* %version: 21 % +*/ + +#ifndef M_WLANEVENTDISPATCHERCLIENT_H +#define M_WLANEVENTDISPATCHERCLIENT_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +class WlanContextImpl; + +/** + * Event dispatcher callback interface + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class MWlanEventDispatcherClient + { + +public: + + /** + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + * @param + * @param + * @param + * @return + */ + + virtual TBool HandleConnect(const TAny *aInputBuffer) = 0; + + virtual TBool HandleStartIBSS(const TAny *aInputBuffer) = 0; + + virtual TBool HandleDisconnect() = 0; + + virtual TBool HandleSetPowerMode(const TAny *aInputBuffer) = 0; + + virtual TBool HandleSetRcpiTriggerLevel(const TAny *aInputBuffer) = 0; + + virtual TBool HandleSetTxPowerLevel(const TAny *aInputBuffer) = 0; + + virtual TBool HandleConfigure(const TAny *aInputBuffer) = 0; + + virtual TBool HandleScan(const TAny *aInputBuffer ) = 0; + + virtual TBool HandleStopScan() = 0; + + virtual TBool HandleGetLastRcpi() = 0; + + virtual TBool HandleDisableUserData() = 0; + + virtual TBool HandleEnableUserData() = 0; + + virtual TBool HandleAddCipherKey(const TAny *aInputBuffer) = 0; + + virtual TBool HandleAddMulticastAddr(const TAny *aInputBuffer) = 0; + + virtual TBool HandleRemoveMulticastAddr(const TAny *aInputBuffer) = 0; + + virtual TBool HandleConfigureBssLost(const TAny *aInputBuffer) = 0; + + virtual TBool HandleSetTxRateAdaptParams(const TAny *aInputBuffer) = 0; + + virtual TBool HandleConfigureTxRatePolicies(const TAny *aInputBuffer) = 0; + + virtual TBool HandleSetPowerModeMgmtParams(const TAny *aInputBuffer) = 0; + + virtual TBool HandleConfigurePwrModeMgmtTrafficOverride( + const TAny *aInputBuffer ) = 0; + + virtual TBool HandleGetFrameStatistics() = 0; + + virtual TBool HandleConfigureUapsd( const TAny *aInputBuffer ) = 0; + + virtual TBool HandleConfigureTxQueue( const TAny *aInputBuffer ) = 0; + + virtual TBool HandleGetMacAddress() = 0; + + virtual TBool HandleConfigureArpIpAddressFiltering( + const TAny *aInputBuffer ) = 0; + + virtual TBool HandleConfigureHtBlockAck( const TAny *aInputBuffer ) = 0; + + virtual TBool HandleConfigureProprietarySnapHdr( + const TAny *aInputBuffer ) = 0; + + virtual TBool OnWhaCommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ) = 0; + + virtual TBool OnInternalEvent( TInternalEvent aInternalEvent ) = 0; + }; + +#endif // M_WLANEVENTDISPATCHERCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacinternaldefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacinternaldefinitions.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UMAC internal types and constants +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef WLANINTERNALDEFINITIONS_H +#define WLANINTERNALDEFINITIONS_H + +#include "am_platform_libraries.h" // basic types +#include "umacoidmsg.h" +#include "802dot11.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + + +typedef TUint16 TCwMinVector[WHA::Wha::KNumOfEdcaQueues]; +typedef TUint16 TCwMaxVector[WHA::Wha::KNumOfEdcaQueues]; +typedef TUint8 TAifsVector[WHA::Wha::KNumOfEdcaQueues]; +typedef TUint16 TTxOplimitVector[WHA::Wha::KNumOfEdcaQueues]; +typedef TBool TAcmVector[WHA::Wha::KNumOfEdcaQueues]; + +// MPDU SNAP header validation status codes +enum TSnapStatus + { + ESnapUnknown, // unknown SNAP encountered + ESnapDot11Ok, // SNAP used by generic data MPDUs encountered + ESnapProprietaryOk // vendor specific SNAP encountered + }; + +const TUint8 KWmmParamSetNotDefined = 255; + +// DA type +enum TDaType + { + EUnicastAddress, + EMulticastAddress, + EBroadcastAddress + }; + +// Type used to instruct Dynamic 802.11 Pwr Mode Mgt regarding switching from +// PS to CAM mode after frame Tx +enum TDynamicCamSwitch + { + ECamSwitchNotForced, + // if in PS, switch to CAM + ESwitchToCam, + // if in PS, stay in PS + EDontSwitchToCam + }; + +enum TPowerMgmtMode + { + EActive, + ELightPs, + EDeepPs + }; + +enum TPowerMgmtModeChange + { + ENoChange, + EToActive, + EToLightPs, + EToDeepPs + }; + +struct TDot11PsModeWakeupSetting + { + /** + * WLAN wake-up mode in 802.11 PS mode. + */ + TWlanWakeUpInterval iWakeupMode; + /** + * Specifies the value of N for wake-up modes 2 and 3. So, is relevant + * only for wake-up modes 2 & 3 + */ + TUint8 iListenInterval; + }; + +typedef WHA::TRate TWhaRateMasks[KMaxNbrOfRateClasses]; + +// Value to denote an undefined SNAP header +const SSnapHeader KUndefinedSnapHeader + = { 0x00, 0x00, 0x00, { 0x00, 0x00, 0x00 } }; + +#endif // WLANINTERNALDEFINITIONS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanLightPsModePowerModeMgr class +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLAN_LIGHT_PS_MODE_POWER_MODE_MGR +#define WLAN_LIGHT_PS_MODE_POWER_MODE_MGR + +#include "umacpowermodemgrbase.h" + +class WlanContextImpl; + +/** +* Class implementing infrastructure mode dynamic power mode management +* algorithm for Light PS mode +*/ +class WlanLightPsModePowerModeMgr : public WlanPowerModeMgrBase + { + +public: + + /** Ctor */ + WlanLightPsModePowerModeMgr(); + + /** Dtor */ + virtual ~WlanLightPsModePowerModeMgr(); + + /** + * Sets the dynamic power mode transition algorithm parameters + * + * @since S60 5.1 + * @param aToActiveFrameThreshold frame count threshold for changing to + * active mode + * @param aToDeepPsFrameThreshold frame count threshold for changing to + * Deep PS mode + * @param aUapsdRxFrameLengthThreshold received frame + * payload length (in bytes) threshold in U-APSD network + */ + inline void SetParameters( + TUint aToActiveFrameThreshold, + TUint aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ); + + /** + * To be called when transmitting a frame + * + * @since S60 5.1 + * Determines the need to make a power mode transition + * @param aCtxImpl global statemachine context + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + * @param aEtherType Ethernet type of the frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameTx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TUint16 aEtherType, + TBool aIgnoreThisFrame ); + + /** + * To be called when accepting an Rx frame + * + * @since S60 5.1 + * @param aCtxImpl global statemachine context + * @param aAccessCategory AC/Queue via which the frame has beeen transmitted + * @param aEtherType Ethernet type of the received frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @param aPayloadLength length of the ethernet frame payload + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameRx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TDaType aDaType ); + + /** + * From WlanPowerModeMgrBase + * To be called upon Light PS to Active timer timeout + * + * @since S60 5.1 + * @param aCtxImpl global statemachine context + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + virtual TBool OnLightPsToActiveTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * From WlanPowerModeMgrBase + * To be called upon Light PS to Deep PS timer timeout + * + * @since S60 5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + virtual TBool OnLightPsToDeepPsTimerTimeout(); + + /** + * From WlanPowerModeMgrBase + * Resets the state of the object + * + * @since S60 5.1 + */ + virtual void DoReset(); + +private: // Methods + + // Prohibit copy constructor + WlanLightPsModePowerModeMgr( const WlanLightPsModePowerModeMgr& ); + // Prohibit assigment operator + WlanLightPsModePowerModeMgr& operator= ( + const WlanLightPsModePowerModeMgr& ); + +private: // Data + + /** + * Rx/Tx frame counter used when considering change to + * Active mode + */ + TUint iToActiveFrameCount; + + /** + * Rx/Tx frame count threshold used when considering change to + * Active mode + */ + TUint iToActiveFrameThreshold; + + /** + * Rx/Tx frame counter used when considering change to + * Deep PS mode + */ + TUint iToDeepPsFrameCount; + + /** + * Rx/Tx frame count threshold used when considering change to + * Deep PS mode + */ + TUint iToDeepPsFrameThreshold; +}; + +#include "umaclightpsmodepowermodemgr.inl" + +#endif // WLAN_LIGHT_PS_MODE_POWER_MODE_MGR diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaclightpsmodepowermodemgr.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanLightPsModePowerModeMgr inline methods +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanLightPsModePowerModeMgr::SetParameters( + TUint aToActiveFrameThreshold, + TUint aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) + { + iToActiveFrameThreshold = aToActiveFrameThreshold; + iToDeepPsFrameThreshold = aToDeepPsFrameThreshold; + iUapsdRxFrameLengthThreshold = aUapsdRxFrameLengthThreshold; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanNullSendController class +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef WLAN_NULL_SEND_CONTROLLER +#define WLAN_NULL_SEND_CONTROLLER + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +class WlanContextImpl; +class MWlanNullSender; + +/* +* Encapsulates periodic NULL or QoS NULL frame sending functionality +*/ +class WlanNullSendController + { + +public: + + /** Ctor */ + explicit inline WlanNullSendController( + WlanContextImpl& aWlanCtxImpl, + MWlanNullSender& aNullSender ); + + /** Dtor */ + inline ~WlanNullSendController(); + + /** + * Sets the null frame sending parameters + * + * @since S60 3.2 + * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call + * state and we transmit at least aVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this parameter, we enter Voice over WLAN Call state + * @param aVoiceCallEntryThreshold Threshold value for the number of + * Voice priority frames to enter Voice over WLAN Call state + * @param aNullTimeout NULL frame sending interval + * @param aNoVoiceTimeout after this long time of no Voice priority data + * Tx, exit voice call state + * @param aKeepAliveTimeout Keep Alive frame sending interval + */ + inline void SetParameters( + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryThreshold, + TUint32 aNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout ); + + /** + * Starts Voice over WLAN Call maintenance + * + * @since S60 3.2 + */ + void StartVoiceOverWlanCallMaintenance(); + + /** + * Stops Voice over WLAN Call maintenance + * Note! Does not reset the Voice over WLAN Call state! + * + * @since S60 3.2 + */ + inline void StopVoiceOverWlanCallMaintenance(); + + /** + * Terminates Voice over WLAN Call maintenance + */ + inline void TerminateVoiceOverWlanCallMaintenance(); + + /** + * Resumes QoS Null Data frame sending when necessary. + * Doesn't change the Voice Call state + * + * @since S60 3.2 + */ + void ResumeQosNullSending(); + + /** + * Starts Keep Alive frame sending + * + * @since S60 3.2 + */ + inline void StartKeepAlive(); + + /** + * Stops Keep Alive frame sending + * + * @since S60 3.2 + */ + inline void StopKeepAlive(); + + /** + * To be called upon every Data frame Rx (other than Null and QoS Null Data) + * + * @since S60 3.2 + * @param aQueueId Id of the queue/AC via which the frame was transmitted + * @param aPayloadLength length of the ethernet frame payload + */ + void OnFrameRx( + WHA::TQueueId aQueueId, + TUint aPayloadLength ); + + /** + * To be called upon every Data frame (other than Null and QoS Null Data) + * send completion + * + * @since S60 3.2 + * @param aQueueId Id of the queue/AC via which the frame was transmitted + */ + void OnFrameTx( WHA::TQueueId aQueueId ); + + /** + * To be called upon Voice Call Entry Timer timeout + * + * @since S60 3.2 + */ + void OnVoiceCallEntryTimerTimeout(); + + /** + * To be called upon Null Timer timeout + * + * @since S60 3.2 + */ + void OnNullTimerTimeout(); + + /** + * To be called upon every QoS Null Data frame send completion + * + * @since S60 3.2 + */ + void OnQosNullDataTxCompleted(); + + /** + * To be called upon every Null Data frame send completion + * + * @since S60 3.2 + */ + inline void OnNullDataTxCompleted(); + + /** + * To be called upon Voice Timer timeout + * + * @since S60 3.2 + */ + void OnNoVoiceTimerTimeout(); + + /** + * To be called upon Keep Alive Timer timeout + * + * @since S60 3.2 + */ + void OnKeepAliveTimerTimeout(); + +private: + + /** + * Arms the Voice Call Entry timer + * + * @since S60 3.2 + */ + void RegisterVoiceCallEntryTimeout(); + + /** + * Arms the Null timer + * + * @since S60 3.2 + * @param aTimeoutInMicroSeconds Timeout in microseconds + */ + void RegisterNullTimeout( TUint32 aTimeoutInMicroSeconds ); + + /** + * Arms the No Voice timer + * + * @since S60 3.2 + * @param aTimeoutInMicroSeconds Timeout in microseconds + */ + void RegisterNoVoiceTimeout( TUint32 aTimeoutInMicroSeconds ); + + /** + * Arms the Keep Alive timer + * + * @since S60 3.2 + * @param aTimeoutInMicroSeconds Timeout in microseconds + */ + void RegisterKeepAliveTimeout( TUint32 aTimeoutInMicroSeconds ); + + /** + * Cancels the Voice Call Entry Timer + * + * @since S60 3.2 + */ + void CancelVoiceCallEntryTimeout(); + + /** + * Cancels the Null Timer + * + * @since S60 3.2 + */ + void CancelNullTimeout(); + + /** + * Cancels the No Voice Timer + * + * @since S60 3.2 + */ + void CancelNoVoiceTimeout(); + + /** + * Cancels the Keep Alive Timer + * + * @since S60 3.2 + */ + void CancelKeepAliveTimeout(); + + /** + * Enters the Voice Call state + */ + void EnterVoiceCallState(); + + // Prohibit copy constructor + WlanNullSendController( + const WlanNullSendController& ); + // Prohibit assigment operator + WlanNullSendController& operator= + ( const WlanNullSendController& ); + +private: // Data + + /** stores the flags defined below */ + TUint32 iFlags; + /** + * this flag is set when Voice over WLAN Call maintenance has been started + */ + static const TUint32 KVoiceOverWlanCallMaintenanceStarted = ( 1 << 0 ); + /** + * this flag is set when we are in voice call state + */ + static const TUint32 KVoiceCallEntryPending = ( 1 << 1 ); + /** + * this flag is set when we are in voice call state + */ + static const TUint32 KInVoiceCallState = ( 1 << 2 ); + /** + * this flag is set when the Null Timer has been armed + */ + static const TUint32 KNullTimerArmed = ( 1 << 3 ); + /** + * this flag is set when the No Voice Timer has been armed + */ + static const TUint32 KNoVoiceTimerArmed = ( 1 << 4 ); + /** + * this flag is set when the Keep Alive Timer has been armed + */ + static const TUint32 KKeepAliveStarted = ( 1 << 5 ); + /** + * this flag is set when the Keep Alive Timer has been armed + */ + static const TUint32 KKeepAliveTimerArmed = ( 1 << 6 ); + /** + * how many time stamps of potential Voice over WLAN downlink frames + * we will store and investigate when determining if we should continue + * in Voice over WLAN call state based on them - in the absence of actual + * Voice priority traffic + */ + static const TUint KBestEffortVoiceRxTimeStampCnt = 5; + /** + * when we are not in Voice over WLAN Call + * state and we transmit at least iVoiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) + * denoted by this attribute, we enter Voice over WLAN Call state + */ + TUint32 iVoiceCallEntryTimeout; + /* + * threshold value for the number of Voice priority Tx/Rx frames to enter + * Voice over WLAN Call state + */ + TUint32 iVoiceCallEntryThreshold; + /** + * after this long time (microseconds) of no transmitted frames, + * a NULL frame needs to be transmitted + */ + TUint32 iNullTimeout; + /** + * after this long time (microseconds) of no transmitted Voice priority + * frames, exit voice call state + */ + TUint32 iNoVoiceTimeout; + /* + * time stamp (microseconds) of the latest Voice priority frame Rx or Tx + * in Voice Call state + */ + TInt64 iLatestVoiceRxOrTxInVoiceCallState; + /** + * if the Ethernet payload length (in bytes) of a Best Effort frame + * received during Voice over WLAN call state in WMM nw is shorter + * than this threshold, it's a potential carrier of downlink Voice + * over WLAN Call data, which is erroneously tagged as Best Effort + */ + TUint iBestEffortVoiceRxLengthThreshold; + /* + * time stamps of the latest potential Voice over WLAN downlink frames + * erroneously taggead as Best Effort. + * Stored as a ring buffer. + */ + TInt64 iBestEffortVoiceRxTimeStamp[KBestEffortVoiceRxTimeStampCnt]; + /** + * index where to store the time stamp of the next potential Voice over + * WLAN downlink frame. + * Note that as the time stamps are stored as a ring buffer, this is + * also the location of the oldest stored time stamp. + */ + TUint iBestEffortVoiceRxInd; + /** + * size of the time window (in microseconds) during which we need + * to receive KBestEffortVoiceRxTimeStampCnt potential Voice over WLAN + * frames in order to continue in Voice over WLAN call state even if + * there's no actual Voice priority traffic + */ + TUint iBestEffortVoiceRxTimeWindow; + /** + * after this long time (microseconds) of no transmitted frames, + * a keep alive frame needs to be transmitted + */ + TUint32 iKeepAliveTimeout; + /* time stamp of the latest frame Tx */ + TInt64 iLatestTx; + /** + * counter for our Voice priority Tx frames in Voice Call State Entry + * pending state + */ + TUint iVoiceCallEntryTxCount; + /** + * counter for Voice priority Rx frames in Voice Call State Entry + * pending state + */ + TUint iVoiceCallEntryRxCount; + /** global state machine context reference */ + WlanContextImpl& iWlanContextImpl; + /** Null Data Frame Sender reference */ + MWlanNullSender& iNullSender; + }; + +#include "umacnullsendcontroller.inl" + +#endif // WLAN_NULL_SEND_CONTROLLER diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsendcontroller.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanNullSendController inline +* methods. +* +*/ + +/* +* %version: 10 % +*/ + +// Default Voice Call Entry timeout +// This value is used if no other value has been provided +const TUint32 KDefaultVoiceCallEntryTimeout = 300000; // 300 ms + +// Default Voice Call Entry Threshold +// This value is used if no other value has been provided +const TUint32 KDefaultVoiceCallEntryThreshold = 5; + +// Default Null timeout +// This value is used if no other value has been provided +const TUint32 KDefaultNullTimeout = 20000; // 20 ms + +// Default No Voice timeout +// This value is used if no other value has been provided +const TUint32 KDefaultNoVoiceTimeout = 1000000; // 1 s + +// Default Keep Alive timeout +// This value is used if no other value has been provided +const TUint32 KDefaultKeepAliveTimeout = 200000000; // 200 s + +// Default value for frame payload length threashold of a potential +// carrier of downlink Voice over WLAN Call data, which is erroneously +// tagged as Best Effort +const TUint KDefaultBestEffortVoiceRxLengthThreshold = 400; // bytes + +// Default value for the length of the time window within which we +// study the potential carriers of downlink Voice over WLAN Call data, +// which are erroneously tagged as Best Effort +const TUint KDefaultBestEffortVoiceRxTimeWindow = 375000; // 375 ms + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanNullSendController::WlanNullSendController( + WlanContextImpl& aWlanCtxImpl, + MWlanNullSender& aNullSender ) : + iFlags( 0 ), + iVoiceCallEntryTimeout( KDefaultVoiceCallEntryTimeout ), + iVoiceCallEntryThreshold( KDefaultVoiceCallEntryThreshold ), + iNullTimeout( KDefaultNullTimeout ), + iNoVoiceTimeout( KDefaultNoVoiceTimeout ), + iLatestVoiceRxOrTxInVoiceCallState( 0 ), + iBestEffortVoiceRxLengthThreshold( + KDefaultBestEffortVoiceRxLengthThreshold ), + iBestEffortVoiceRxInd( 0 ), + iBestEffortVoiceRxTimeWindow( KDefaultBestEffortVoiceRxTimeWindow ), + iKeepAliveTimeout( KDefaultKeepAliveTimeout ), + iLatestTx( 0 ), + iVoiceCallEntryTxCount( 0 ), + iVoiceCallEntryRxCount( 0 ), + iWlanContextImpl( aWlanCtxImpl ), + iNullSender( aNullSender ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::WlanNullSendController") ); + os_memset( + iBestEffortVoiceRxTimeStamp, + 0, + sizeof( iBestEffortVoiceRxTimeStamp ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanNullSendController::~WlanNullSendController() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::~WlanNullSendController") ); + + // cancel any possibly running timers + CancelVoiceCallEntryTimeout(); + CancelNullTimeout(); + CancelNoVoiceTimeout(); + CancelKeepAliveTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanNullSendController::SetParameters( + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryThreshold, + TUint32 aNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::SetParameters: aVoiceCallEntryTimeout: %d"), + aVoiceCallEntryTimeout ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::SetParameters: aVoiceCallEntryThreshold: %d"), + aVoiceCallEntryThreshold ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::SetParameters: aNullTimeout: %d"), + aNullTimeout ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::SetParameters: aNoVoiceTimeout: %d"), + aNoVoiceTimeout ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::SetParameters: aKeepAliveTimeout: %d"), + aKeepAliveTimeout ); + + iVoiceCallEntryTimeout = aVoiceCallEntryTimeout; + iVoiceCallEntryThreshold = aVoiceCallEntryThreshold; + iNullTimeout = aNullTimeout; + iNoVoiceTimeout = aNoVoiceTimeout; + iKeepAliveTimeout = aKeepAliveTimeout; + iBestEffortVoiceRxTimeWindow = + ( aVoiceCallEntryTimeout / ( aVoiceCallEntryThreshold - 1 ) ) + * KBestEffortVoiceRxTimeStampCnt; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::SetParameters: " + "iBestEffortVoiceRxTimeWindow: %d"), + iBestEffortVoiceRxTimeWindow ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanNullSendController::StopVoiceOverWlanCallMaintenance() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::StopVoiceOverWlanCallMaintenance") ); + + iFlags &= ~KVoiceOverWlanCallMaintenanceStarted; + + // cancel relevant possibly running timers + CancelVoiceCallEntryTimeout(); + CancelNullTimeout(); + CancelNoVoiceTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanNullSendController::TerminateVoiceOverWlanCallMaintenance() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::TerminateVoiceOverWlanCallMaintenance") ); + + StopVoiceOverWlanCallMaintenance(); + iFlags &= ~KInVoiceCallState; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanNullSendController::StartKeepAlive() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::StartKeepAlive") ); + + iFlags |= KKeepAliveStarted; + RegisterKeepAliveTimeout( iKeepAliveTimeout ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanNullSendController::StopKeepAlive() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::StopKeepAlive") ); + + iFlags &= ~KKeepAliveStarted; + // cancel possibly running timer + CancelKeepAliveTimeout(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanNullSendController::OnNullDataTxCompleted() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnNullDataTxCompleted") ); + + if ( iFlags & KKeepAliveStarted ) + { + // we are still doing Keep Alive and as the previous Null Data, i.e. + // Keep Alive, Frame has been transmitted, we re-arm the timer for + // the next round + RegisterKeepAliveTimeout( iKeepAliveTimeout ); + + // There's no need to check for the need to re-arm the NullTimer, because + // it won't happen in practice that a Keep Alive (Null Data) frame + // transmit would complete when the NullTimer is armed, as we won't need + // to send any Keep Alive frames during a Voice Call, i.e. when the + // NullTimer is running, because there's frequent frame Tx activity + // during a Voice Call + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsender.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacnullsender.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanNullSender class. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLAN_NULL_SENDER_H +#define WLAN_NULL_SENDER_H + +/** + * Null Data Frame Sender interface + * + * @lib wlanumac.lib + * @since S60 v3.2 + */ +class MWlanNullSender + { + +public: + + /** + * Request to send a Null Data Frame + * + * @since S60 v3.2 + * @param aCtxImpl statemachine context + * @param aQosNull ETrue if a QoS Null Data frame should be transmitted + * EFalse if a regular Null Data frame should be transmitted + * @return ETrue if the send request was successfully submitted + * EFalse otherwise + */ + virtual TBool TxNullDataFrame( + WlanContextImpl& aCtxImpl, + TBool aQosNull ) = 0; + + }; + +#endif // WLAN_NULL_SENDER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacoidmsg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacoidmsg.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1053 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains definitions for OID messages, which are +* used for issuing management commands to UMAC. +* +*/ + +/* +* %version: 42 % +*/ + +#ifndef WLAN_OID_MSG_H +#define WLAN_OID_MSG_H + +#include "umac_types.h" + + + // Query + // | Set + // | | +enum TWlanCommandId // | | + { // | | + E802_11_CONNECT = 0x0C000000, // X + E802_11_START_IBSS, // X + E802_11_SCAN, // X + E802_11_STOP_SCAN, // X + E802_11_DISCONNECT, // X + E802_11_SET_POWER_MODE, // X + E802_11_SET_RCPI_TRIGGER_LEVEL, // X + E802_11_SET_TX_POWER_LEVEL, // X + E802_11_CONFIGURE, // X + E802_11_GET_LAST_RCPI, // X + E802_11_DISABLE_USER_DATA, // X + E802_11_ENABLE_USER_DATA, // X + E802_11_ADD_CIPHER_KEY, // X + E802_11_ADD_MULTICAST_ADDR, // X + E802_11_REMOVE_MULTICAST_ADDR, // X + E802_11_CONFIGURE_BSS_LOST, // X + E802_11_SET_TX_RATE_ADAPT_PARAMS, // X + E802_11_CONFIGURE_TX_RATE_POLICIES, // X + E802_11_SET_POWER_MODE_MGMT_PARAMS, // X + E802_11_CONFIGURE_PWR_MODE_MGMT_TRAFFIC_OVERRIDE, // X + E802_11_GET_FRAME_STATISTICS, // X + E802_11_CONFIGURE_UAPSD, // X + E802_11_CONFIGURE_TX_QUEUE, // X + E802_11_GET_MAC_ADDRESS, // X + E802_11_CONFIGURE_ARP_IP_ADDRESS_FILTERING, // X + E802_11_CONFIGURE_HT_BLOCK_ACK, // X + E802_11_CONFIGURE_PROPRIETARY_SNAP_HDR // X + }; + +const TUint KMaxCipherKeyLength = 32; // 256 bits + +// ------------------------------------------------------------------------- + +/** 802.11 Power management modes */ +enum TPowerMode + { + /** Continuous Awake Mode (CAM). */ + EPowerModeCam, + /** Power Save (PS) Mode */ + EPowerModePs + }; + +/** WLAN wake-up modes in 802.11 PS mode */ +enum TWlanWakeUpInterval + { + EWakeUpIntervalAllBeacons = 0, + EWakeUpIntervalAllDtims = 1, + EWakeUpIntervalEveryNthBeacon = 2, + EWakeUpIntervalEveryNthDtim = 3, + }; + +// ------------------------------------------------------------------------- +enum TAuthenticationMode + { + /** + * IEEE 802.11 open authentication mode. + * No checks when accepting clients in this mode. + */ + EAuthModeOpen, + /** IEEE 802.11 shared authentication that uses pre-shared WEP-key. */ + EAuthModeShared, + /** Vendor specific authentication mode */ + EAuthModeLeap, + /** Not a real mode, defined as an upper bound. */ + EAuthModeMax + }; + +// ------------------------------------------------------------------------- +/** WLAN rates, units of 500 kbit/sec */ +enum TRate + { + ENoRate = 0, + E1Mbps = 2, + E2Mbps = 4, + E5_5Mbps = 11, + E11Mbps = 22, + E22Mbps = 44, + EBASIC_1Mbps = 0x82, + EBASIC_2Mbps = 0x84, + EBASIC_5_5Mbps = 0x8b, + EBASIC_11Mbps = 0x96, + EBASIC_22Mbps = 0xac + }; + +// ------------------------------------------------------------------------- + +typedef enum _TEncryptionStatus + { + /** Security is disabled. */ + EEncryptionDisabled, + /** Use WEP security */ + EEncryptionWep, + /** Use 802.1x security */ + EEncryption802dot1x, + /** Use WPA security */ + EEncryptionWpa, + /** WEP mixed cell */ + EEncryptionWepMixed, + /** 802.1x mixed cell */ + EEncryption802dot1xMixed, + /** Use WAPI security */ + EEncryptionWAPI + } TEncryptionStatus; + +// ------------------------------------------------------------------------- +/** +* The possible cipher suites. +*/ +enum TWlanCipherSuite + { + EWlanCipherSuiteNone, + EWlanCipherSuiteTkip, + EWlanCipherSuiteCcmp, + EWlanCipherSuiteWep, + EWlanCipherSuiteWapi + }; + +// ------------------------------------------------------------------------- +// +// PRAGMA PACK 4 BEGINS +// +#pragma pack(4) + +typedef struct _TSSID + { + /** + * Length of ssid-field in octets. This can be zero. + * If this is set to zero in the Scan command (message) when doing an + * active scan, a broadcast scan is performed. + */ + TUint32 ssidLength; + /** + * SSID information field. + */ + TUint8 ssid[KMaxSSIDLength]; + } TSSID; + +#pragma pack() +// +// PRAGMA PACK 4 ENDS +// +// ------------------------------------------------------------------------- + + +enum TScanMode + { + /** Send probe requests to specified channels. */ + EActiveScan, + /** Listen beacons from specified channels. */ + EPassiveScan + }; + +typedef struct _SChannels + { + TUint8 iBand; // 1 = 2.4 GHz, 2 = 4.9 GHz, 4 = 5 GHz + TUint8 iChannels2dot4GHz[2]; + TUint8 iChannels4dot9GHz[3]; + TUint8 iChannels5GHz[26]; + } SChannels; + +// ------------------------------------------------------------------------- + +typedef struct _TTxRateClass + { + /** Number of attempts to tx at 54 Mbits/s */ + TUint8 txPolicy54; + /** Number of attempts to tx at 48 Mbits/s */ + TUint8 txPolicy48; + /** Number of attempts to tx at 36 Mbits/s */ + TUint8 txPolicy36; + /** Number of attempts to tx at 33 Mbits/s */ + TUint8 txPolicy33; + /** Number of attempts to tx at 24 Mbits/s */ + TUint8 txPolicy24; + /** Number of attempts to tx at 22 Mbits/s */ + TUint8 txPolicy22; + /** Number of attempts to tx at 18 Mbits/s */ + TUint8 txPolicy18; + /** Number of attempts to tx at 12 Mbits/s */ + TUint8 txPolicy12; + /** Number of attempts to tx at 11 Mbits/s */ + TUint8 txPolicy11; + /** Number of attempts to tx at 9 Mbits/s */ + TUint8 txPolicy9; + /** Number of attempts to tx at 6 Mbits/s */ + TUint8 txPolicy6; + /** Number of attempts to tx at 5.5 Mbits/s */ + TUint8 txPolicy5_5; + /** Number of attempts to tx at 2 Mbits/s */ + TUint8 txPolicy2; + /** Number of attempts to tx at 1 Mbits/s */ + TUint8 txPolicy1; + + /** 802.11 ShortRetryLimit used in the rate class */ + TUint8 shortRetryLimit; + /** 802.11 LongRetryLimit used in the rate class */ + TUint8 longRetryLimit; + + /** + * Transmit flags. + * Bit 0 - truncate. If this bit is set, then attempts to send a frame + * stop when the total valid per-rate attempts have been exhausted, + * otherwise, and also in the case the feature is not supported + * by WHA layer, transmissions will continue at the lowest available + * rate until the appropriate one of the iShortRetryLimit, iLongRetryLimit, + * dot11MaxTransmitMsduLifetime, is exhausted. [optional] + * Bit 1 - indicates if the preamble override from the rate class should + * be used in transmit. [optional] + * Bit 2 - defines the type of preamble to be used by the rate class. + * 0 means long preamble and 1 means short preamble. [optional] + */ + TUint32 flags; + } TTxRateClass; + +const TUint8 KMaxNbrOfRateClasses = 4; + +typedef struct _TTxRatePolicy + { + TUint32 numOfPolicyObjects; + TTxRateClass txRateClass[KMaxNbrOfRateClasses]; + } TTxRatePolicy; + +// ------------------------------------------------------------------------- + +typedef TUint8 TRateClassIndex; + +/** Tx Queue to Rate Class mapping */ + +typedef TRateClassIndex TQueue2RateClass[EQueueIdMax]; + +// ------------------------------------------------------------------------- + +typedef TUint32 TRateMask; + +/** Initial Max Tx Rate for Rate Class */ +typedef TRateMask TInitialMaxTxRate4RateClass[KMaxNbrOfRateClasses]; + +/** Tx rate masks */ + +const TRateMask KRate1Mbits = 0x00000001; +const TRateMask KRate2Mbits = 0x00000002; +const TRateMask KRate5_5Mbits = 0x00000004; +const TRateMask KRate6Mbits = 0x00000008; +const TRateMask KRate9Mbits = 0x00000010; +const TRateMask KRate11Mbits = 0x00000020; +const TRateMask KRate12Mbits = 0x00000040; +const TRateMask KRate18Mbits = 0x00000080; +const TRateMask KRate22Mbits = 0x00000100; +const TRateMask KRate24Mbits = 0x00000200; +const TRateMask KRate33Mbits = 0x00000400; +const TRateMask KRate36Mbits = 0x00000800; +const TRateMask KRate48Mbits = 0x00001000; +const TRateMask KRate54Mbits = 0x00002000; + +/** +* Rate policy to use when the WLAN vendor implementation handles +* Tx rate adaptation +*/ +typedef TRateMask TTxAutoRatePolicy[KMaxNbrOfRateClasses]; + +// ------------------------------------------------------------------------- + +const TUint8 KHtMcsSetLength = 10; +typedef TUint8 THtMcsSet[KHtMcsSetLength]; +typedef THtMcsSet THtMcsPolicy[KMaxNbrOfRateClasses]; + +// ------------------------------------------------------------------------- + +/** the possible values for maximum service period length */ +enum TMaxServicePeriodLength + { + EMaxServicePeriodLengthAll = 0x00, + EMaxServicePeriodLengthTwo = 0x20, + EMaxServicePeriodLengthFour = 0x40, + EMaxServicePeriodLengthSix = 0x60, + }; + +// ------------------------------------------------------------------------- + +/** data frame statistics per Access Category */ +typedef struct _TAccessCategoryStatistics + { + /** nbr of received unicast data frames */ + TUint rxUnicastDataFrameCount; + /** nbr of successfully transmitted unicast data frames */ + TUint txUnicastDataFrameCount; + /** nbr of received multicast data frames */ + TUint rxMulticastDataFrameCount; + /** nbr of successfully transmitted multicast data frames */ + TUint txMulticastDataFrameCount; + /** nbr of data frame transmit retries */ + TUint txRetryCount; + /** nbr of data frames that could not be delivered to the WLAN AP/STA */ + TUint txErrorCount; + /** + * average data frame Transmit / Media Delay in microseconds. + * Zero if no frames were transmitted. + */ + TUint txMediaDelay; + /** + * average data frame Total Transmit Delay in microseconds. + * Zero if no frames were transmitted. + */ + TUint totalTxDelay; + /** nbr of data frames whose total transmit delay was <= 10ms */ + TUint totalTxDelayBin0; + /** nbr of data frames whose total transmit delay was ]10,20]ms */ + TUint totalTxDelayBin1; + /** nbr of data frames whose total transmit delay was ]20,40]ms */ + TUint totalTxDelayBin2; + /** nbr of data frames whose total transmit delay was > 40ms */ + TUint totalTxDelayBin3; + } TAccessCategoryStatistics; + +// ------------------------------------------------------------------------- + + +/** +* Common header for all messages. +*/ +#pragma pack(4) +typedef struct _TOIDHeader + { + /** OID identification (TWlanCommandId). */ + TUint32 oid_id; + } TOIDHeader; +#pragma pack() + + +// ------------------------------------------------------------------------- + +typedef struct _TConnectMsg + { + /** Common message header */ + TOIDHeader hdr; + /** Name of the network. */ + TSSID SSID; + /** BSSID of the access point / IBSS network. */ + TMacAddress BSSID; + /** Authentication algorithm number to be used */ + TUint16 authAlgorithmNbr; + /** Used encryption mode */ + TEncryptionStatus encryptionStatus; + /** Pairwise cipher to use; if any */ + TWlanCipherSuite pairwiseCipher; + /** + * ETrue when connecting to an infrastructure network; + * EFalse otherwise. + */ + TBool isInfra; + /** + * Pointer to a Beacon or Probe Response frame body from the network + * to connect to + */ + const TUint8* scanResponseFrameBody; + /** Length of the Beacon or Probe Response frame body */ + TUint16 scanResponseFrameBodyLength; + /** + * Pointer to the IE(s) to be included into the (re-)association request. + * NULL if there are no IE(s) to be included. + */ + const TUint8* ieData; + /** Length of the IEs */ + TUint16 ieDataLength; + /** + * ETrue if the current pairwise cipher key should be marked as invalid + * EFalse if the current pairwise cipher key should not be marked as invalid + * If a pairwise key doesn't exist, this value has no effect + **/ + TBool invalidatePairwiseKey; + /** + * ETrue if the current group cipher key should be marked as invalid + * EFalse if the current group cipher key should not be marked as invalid + * If a group key doesn't exist, this value has no effect + **/ + TBool invalidateGroupKey; + /** + * ETrue if Radio Measurements are on + */ + TBool radioMeasurement; + } TConnectMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TStartIBSSMsg + { + /** Common message header */ + TOIDHeader hdr; + /** Name of the network. */ + TSSID SSID; + /** Beacon period in TUs (kusec). */ + TUint32 beaconInterval; + /** ATIM window. */ + TUint32 ATIM; + /** Used channel (1-14). Has to be legal in the current region. */ + TUint32 channel; + /** + * Used encryption mode. + * [EEncryptionWep|EEncryptionDisabled] + */ + TEncryptionStatus encryptionStatus; + } TStartIBSSMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TScanMsg + { + /** Common message header */ + TOIDHeader hdr; + /** Scan mode [active|passive]. */ + TScanMode mode; + /** Network whose APs are scanned. Can be broadcast SSID. */ + TSSID SSID; + /** Rate that is used in active scanning. */ + TRate scanRate; + /** Channel set for scanning */ + SChannels channels; + /** Min. time to listen beacons/probe responses on a channel. */ + TUint32 minChannelTime; + /** Max. time to listen beacons/probe responses on a channel. */ + TUint32 maxChannelTime; + /** ETrue if split scan shall be used; EFalse otherwise */ + TBool splitScan; + } TScanMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TStopScanMsg + { + /** Common message header */ + TOIDHeader hdr; + } TStopScanMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TDisconnectMsg + { + /** Common message header */ + TOIDHeader hdr; + } TDisconnectMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TSetPowerModeMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * 802.11 Power management mode. If the mode is EPowerModePs, we start + * with Light PS + */ + TPowerMode powerMode; + /** + * This setting is relevant only if powerMode is EPowerModePs. + * If ETrue, disables the dynamic power mode management handling in UMAC. + * If EFalse, allows the dynamic power mode management handling in UMAC. + */ + TBool disableDynamicPowerModeManagement; + + /** + * WLAN wake-up mode in Light PS mode + */ + TWlanWakeUpInterval wakeupModeInLightPs; + /** + * Specifies the value of N for wake-up modes 2 and 3 in Light PS mode. + * So, is relevant only for wake-up modes 2 & 3 + */ + TUint8 listenIntervalInLightPs; + + /** + * WLAN wake-up mode in Deep PS mode + */ + TWlanWakeUpInterval wakeupModeInDeepPs; + /** + * Specifies the value of N for wake-up modes 2 and 3 in Deep PS mode. + * So, is relevant only for wake-up modes 2 & 3 + */ + TUint8 listenIntervalInDeepPs; + } TSetPowerModeMsg; + +// ------------------------------------------------------------------------- +typedef struct _TSetRcpiTriggerLevelMsg + { + /** Common message header */ + TOIDHeader hdr; + /** RCPI trigger level. */ + TInt32 RcpiTrigger; + } TSetRcpiTriggerLevelMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TSetTxPowerLevelMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * Transmission power level in dBm. + */ + TUint32 level; + } TSetTxPowerLevelMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureMsg + { + /** Common message header */ + TOIDHeader hdr; + /** Limit for packet size when to use RTS/CTS protocol. */ + TUint16 RTSThreshold; + /** Max. time to (re-)send whole MSDU packet (in TUs) */ + TUint32 maxTxMSDULifetime; + /** + * When U-APSD power save mode is used for Voice AC, we are not in Voice + * over WLAN Call state and we transmit at least voiceCallEntryTxThreshold + * Voice priority frames during the time period (microseconds) denoted by + * this parameter, we enter Voice over WLAN Call state + */ + TUint32 voiceCallEntryTimeout; + /** + * Threshold value for the number of Voice priority frames to enter + * Voice over WLAN Call state. (See also the voiceCallEntryTimeout + * parameter) + */ + TUint32 voiceCallEntryTxThreshold; + /** + * The time interval (in microseconds) between QoS Null Data frames, + * which we send during a Voice over WLAN Call in U-APSD power save + * mode, if there are no other frames to be transmitted + */ + TUint32 voiceNullTimeout; + /** + * If there are no Voice priority frames transmitted during the duration + * of this timer (microseconds), we assume that the Voice over WLAN + * Call has ended and we will stop sending the QoS Null Data frames + * in U-APSD power save mode + */ + TUint32 noVoiceTimeout; + /** + * The time interval (in microseconds) between Null Data frames, + * which we send to the AP in infrastructure mode to keep the WLAN + * connection alive, if there are no other frames to be transmitted + */ + TUint32 keepAliveTimeout; + /** + * If this RCPI level is predicted to be reached within the time + * specified by spTimeToCountPrediction, a signal loss prediction + * indication is sent. + */ + TUint32 spRcpiIndicationLevel; + /** + * Specifies the time (in microseconds) how far into the future signal + * prediction is done. + */ + TUint32 spTimeToCountPrediction; + /** + * The minimum time difference (in microseconds) between two signal + * loss prediction indications. + */ + TUint32 spMinIndicationInterval; + + } TConfigureMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TGetLastRcpiMsg + { + /** Common message header */ + TOIDHeader hdr; + } TGetLastRcpiMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TDisableUserDataMsg + { + /** Common message header */ + TOIDHeader hdr; + } TDisableUserDataMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TEnableUserDataMsg + { + /** Common message header */ + TOIDHeader hdr; + } TEnableUserDataMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TAddCipherKeyMsg + { + /** Common message header */ + TOIDHeader hdr; + /** cipher suite */ + TWlanCipherSuite cipherSuite; + /** index of the key */ + TUint8 keyIndex; + /** data blob that holds the cipher key */ + TUint8 data[KMaxCipherKeyLength]; + /** length of the data blob */ + TUint32 length; + /** defines the MAC address the key is used for */ + TMacAddress macAddress; + /** Is the key used as a default key. Applies to broadcast wep keys */ + TBool useAsDefaultKey; + } TAddCipherKeyMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TAddMulticastAddrMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * Defines the multicast MAC address to be added. + * Note that this will also automatically enable multicast filtering, + * if it hasn't already been enabled by an earlier TAddMulticastAddrMsg. + */ + TMacAddress macAddress; + } TAddMulticastAddrMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TRemoveMulticastAddrMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * If ETrue, remove all the currently specified multicast addresses. + * Otherwise remove only macAddress (included in this message). + * Note that if there are no multicast addresses left after this removal, + * the multicast filtering will be disabled and all multicast packets will + * again be received and accepted. + */ + TBool removeAll; + /** Defines the multicast MAC address to be removed */ + TMacAddress macAddress; + } TRemoveMulticastAddrMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureBssLostMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * The number of consecutive beacons that can be lost in infrastructure + * mode before BSS Lost is indicated + */ + TUint32 beaconLostCount; + /** + * The number of consecutive transmissions that can fail totally before + * BSS lost is indicated + */ + TUint8 failedTxPacketCount; + } TConfigureBssLostMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TSetTxRateAdaptationParamsMsg + { + /** Common message header */ + TOIDHeader hdr; + /* + * minimum and initial rate increase checkpoint in units of frames + * Range: [stepDownCheckpoint,maxStepUpCheckpoint] + */ + TUint8 minStepUpCheckpoint; + /* + * maximum rate increase checkpoint in units of frames + * Range: [stepDownCheckpoint,UCHAR_MAX] + */ + TUint8 maxStepUpCheckpoint; + /* + * rate increase checkpoint is multiplied with this value if sending a + * probe frame fails + * Range: [1,maxStepUpCheckpoint] + */ + TUint8 stepUpCheckpointFactor; + /* + * after this many frames the need to decrease the rate is checked + * Range: [2,UCHAR_MAX] + */ + TUint8 stepDownCheckpoint; + /* + * minimum and initial rate increase threshold percentage + * Range: [1,maxStepUpThreshold] + */ + TUint8 minStepUpThreshold; + /* + * maximum rate increase threshold percentage value + * Range: [1,100] + */ + TUint8 maxStepUpThreshold; + /* + * rate increase threshold is incremented by this value if sending a probe + * frame fails + * Range: [0,maxStepUpThreshold] + */ + TUint8 stepUpThresholdIncrement; + /* + * rate decrease threshold percentage + * Range: [1,100] + */ + TUint8 stepDownThreshold; + /* + * if EFalse, the rate adaptation algorithm handles the first frame + * transmitted after a rate increase in a special way. Otherwise the + * special handling is disabled + */ + TBool disableProbeHandling; + } TSetTxRateAdaptationParamsMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureTxRatePoliciesMsg + { + /** Common message header */ + TOIDHeader hdr; + /* + * defines the rate class(es) to use for frame Tx. + * If WLAN PDD does not support as many rate classes as are specified + * in this command message, only the rate class specified for ELegacy + * queue, which shall be the first class in this array, will be used. + */ + TTxRatePolicy ratePolicy; + /* + * for every Tx queue / QoS Access Category, defines the rate class to + * be used. + * TQueueId is used to index this array. + */ + TQueue2RateClass queue2RateClass; + /* + * Max Tx rate which will be initially used to transmit using the + * rate class in question. If the specified rate is not supported, + * the next lower supported rate from the rate class will be used + * instead. + * Only the first numOfPolicyObjects values (see TTxRatePolicy) from + * the beginning of the array are relevant. + */ + TInitialMaxTxRate4RateClass initialMaxTxRate4RateClass; + /** + * defines the rate class(es) to use for frame Tx when the WLAN vendor + * implementation handles Tx rate adaptation. + * If WLAN PDD does not support as many rate classes as are specified + * in this command message, only the rate class specified for ELegacy + * queue, which shall be the first class in this array, will be used. + * The mapping defined in queue2RateClass applies also to these classes. + * The shortRetryLimit and the longRetryLimit values defined as part of + * the ratePolicy are relevant also with the auto rate policy. + * Only the first numOfPolicyObjects values (see TTxRatePolicy) from + * the beginning of the array are relevant. + */ + TTxAutoRatePolicy autoRatePolicy; + /** + * defines the HT MCS sets to use for frame Tx when communicating + * with a HT network. + * If WLAN PDD does not support as many MCS sets as are specified + * in this command message, only the MCS set specified for ELegacy + * queue, which shall be the first MCS set in this array, will be used. + * The mapping defined in queue2RateClass applies also to these MCS sets. + * The shortRetryLimit and the longRetryLimit values defined as part of + * the ratePolicy are relevant also with the MCS sets. + * Only the first numOfPolicyObjects values (see TTxRatePolicy) from + * the beginning of the array are relevant. + */ + THtMcsPolicy htMcsPolicy; + } TConfigureTxRatePoliciesMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TSetPowerModeMgmtParamsMsg + { + /** Common message header */ + TOIDHeader hdr; + /* + * time interval in microseconds after which transition from Active mode + * to Light PS mode is considered + */ + TUint32 toLightPsTimeout; + /* + * frame count threshold used when considering transition from Active + * to Light PS mode + */ + TUint16 toLightPsFrameThreshold; + /* + * time interval in microseconds after which the frame counter used when + * considering transition from Light PS to Active mode is reset + */ + TUint32 toActiveTimeout; + /* + * frame count threshold used when considering transition from Light PS + * to Active mode + */ + TUint16 toActiveFrameThreshold; + /* + * time interval in microseconds after which transition from Light PS mode + * to Deep PS mode is considered + */ + TUint32 toDeepPsTimeout; + /* + * frame count threshold used when considering transition from Light PS + * to Deep PS mode + */ + TUint16 toDeepPsFrameThreshold; + /* + * received frame payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category + */ + TUint16 uapsdRxFrameLengthThreshold; + } TSetPowerModeMgmtParamsMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigurePwrModeMgmtTrafficOverrideMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * The settings here become effective once using the PS mode has been + * allowed by WLAN Mgmt Client. + * When a setting below is ETrue, any amount of Rx or Tx traffic via + * the AC in question won't cause a change from PS to CAM mode once PS + * mode has been entered, and traffic via that AC won't make us to + * stay in CAM either. + * Every AC has a separate setting for U-APSD and legacy PS. + * The U-APSD setting is used if U-APSD is used for the AC in question. + * Otherwise the corresponding legacy setting is used. + */ + /** + * U-APSD Voice AC setting + */ + TBool stayInPsDespiteUapsdVoiceTraffic; + /** + * U-APSD Video AC setting + */ + TBool stayInPsDespiteUapsdVideoTraffic; + /** + * U-APSD Best Effort AC setting + */ + TBool stayInPsDespiteUapsdBestEffortTraffic; + /** + * U-APSD Background AC setting + */ + TBool stayInPsDespiteUapsdBackgroundTraffic; + /** + * legacy Voice AC setting + */ + TBool stayInPsDespiteLegacyVoiceTraffic; + /** + * legacy Video AC setting + */ + TBool stayInPsDespiteLegacyVideoTraffic; + /** + * legacy Best Effort AC setting + */ + TBool stayInPsDespiteLegacyBestEffortTraffic; + /** + * legacy Background AC setting + */ + TBool stayInPsDespiteLegacyBackgroundTraffic; + } TConfigurePwrModeMgmtTrafficOverrideMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TGetFrameStatisticsMsg + { + /** Common message header */ + TOIDHeader hdr; + } TGetFrameStatisticsMsg; + + +typedef struct _TStatisticsResponse + { + /** data frame statistics per Access Category */ + TAccessCategoryStatistics acSpecific[EQueueIdMax]; + /** nbr of FCS errors in received MPDUs */ + TUint fcsErrorCount; + } TStatisticsResponse; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureUapsdMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * the maximum number of buffered MSDUs and MMPDUs the AP may send during + * a service period + */ + TMaxServicePeriodLength maxServicePeriodLength; + /** + * if ETrue the Voice AC is made both trigger and delivery enabled + * when connecting to a QoS AP supporting U-APSD + */ + TBool uapsdForVoice; + /** + * if ETrue the Video AC is made both trigger and delivery enabled + * when connecting to a QoS AP supporting U-APSD + */ + TBool uapsdForVideo; + /** + * if ETrue the Best Effort AC is made both trigger and delivery enabled + * when connecting to a QoS AP supporting U-APSD + */ + TBool uapsdForBestEffort; + /** + * if ETrue the Background AC is made both trigger and delivery enabled + * when connecting to a QoS AP supporting U-APSD + */ + TBool uapsdForBackground; + } TConfigureUapsdMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureTxQueueMsg + { + /** Common message header */ + TOIDHeader hdr; + /* ID of the transmit queue to configure */ + TQueueId queueId; + /** + * The amount of time the queue is allowed to access the WLAN air + * interface during one second interval. The unit of the parameter is + * 32 microseconds. Value 0 means that the medium time is unlimited. + */ + TUint16 mediumTime; + /** + * Maximum Transmit MSDU Lifetime to be used for the specified queue. + * Overrides the global maxTxMSDULifetime value specified in TConfigureMsg. + * Unit: TUs + */ + TUint32 maxTxMSDULifetime; + } TConfigureTxQueueMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TGetMacAddressMsg + { + /** Common message header */ + TOIDHeader hdr; + } TGetMacAddressMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureArpIpAddressFilteringMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * if ETrue the filtering will be enabled + * if EFalse the filtering will be disabled + */ + TBool enableFiltering; + /** + * When filtering is enabled and the WLAN device receives an ARP packet + * where the target protocol address field does not match this address + * the packet is dropped. + * Note that the address needs to be in big-endian byte order. + */ + TIpv4Address ipV4Addr; + } TConfigureArpIpAddressFilteringMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureHtBlockAckMsg + { + /** Common message header */ + TOIDHeader hdr; + + static const TUint8 KTid0 = ( 1 << 0 ); + static const TUint8 KTid1 = ( 1 << 1 ); + static const TUint8 KTid2 = ( 1 << 2 ); + static const TUint8 KTid3 = ( 1 << 3 ); + static const TUint8 KTid4 = ( 1 << 4 ); + static const TUint8 KTid5 = ( 1 << 5 ); + static const TUint8 KTid6 = ( 1 << 6 ); + static const TUint8 KTid7 = ( 1 << 7 ); + + /** + * A bit-map containing the block ACK usage status for the tx direction. + * Each bit corresponds to a TID, bit 0 corresponding to TID 0. + * If a bit is set, block ACK can be used for the corresponding TID. The + * WLAN device may initiate block ACK session with the AP for the TID in + * question. + * If a bit is not set and there already is a block ACK session with the + * AP for this TID, the WLAN device should terminate the session. + */ + TUint8 iTxBlockAckUsage; + /* + * A bit-map containing the block ACK usage status the rx direction. + * Each bit corresponds to a TID, bit 0 corresponding to TID 0. + * If a bit is set, block ACK can be is used for the corresponding TID. The + * WLAN device may accept block ACK session requests from the AP for this + * TID. + * If a bit is not set, block ACK should not be used for the corresponding + * TID. The WLAN device should reject block ACK session requests from the + * AP for this TID. If there already is a block ACK session with the AP for + * this TID, the WLAN device should terminate the session. + */ + TUint8 iRxBlockAckUsage; + } TConfigureHtBlockAckMsg; + +// ------------------------------------------------------------------------- + +typedef struct _TConfigureProprietarySnapHdrMsg + { + /** Common message header */ + TOIDHeader hdr; + /** + * Otherwise valid received 802.11 Data frames containing this SNAP header + * are accepted and forwarded to the WLAN Management Client. + * Currently only a single SNAP header can be configured. So if this + * command is issued several times, the provided SNAP header replaces the + * previous one. + */ + TSnapHeader snapHdr; + } TConfigureProprietarySnapHdrMsg; + + +#endif // WLAN_OID_MSG_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpacketscheduler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpacketscheduler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,435 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPacketScheduler class. +* +*/ + +/* +* %version: 21 % +*/ + +#ifndef T_WLANPACKETSCHEDULER_H +#define T_WLANPACKETSCHEDULER_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +#include "802dot11.h" + +#include "umaccarray.h" + +class MWlanPacketSchedulerClient; +class WlanContextImpl; +class TDataBuffer; + +/** + * 802.11 Packet scheduler + * When packet transmit is possible the packets are transmitted + * in the priority order + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanPacketScheduler + { + // stores context information about a packet + struct SPacketIdCntx + { + // free or not + TBool iFree; + // id of the send queue + WHA::TQueueId iQueueId; + // frame id used by the packet scheduler client + TUint32 iFrameId; + // frame meta header used by the packet scheduler client + const TDataBuffer* iMetaHeader; + // requested Tx rate + WHA::TRate iRequestedTxRate; + // ETrue if this is a multicast data frame + TBool iMulticastData; + // time when the packet transmit request was submitted to WHA layer + TInt64 iSendReqTimeStamp; + // ETrue if the use of the special rate policy is requested for the + // transmission of this frame + TBool iUseSpecialRatePolicy; + }; + + struct SElement + { + // free or not + TBool iFree; + // start of packet buffer to send + const TAny* iPacket; + // length of the packet buffer to send + TUint32 iLength; + // link to packet id context + SPacketIdCntx* iPacketIdCntx; + }; + + class TPacketIdCntxsPredicate + { + public: + + TPacketIdCntxsPredicate() : iKey( ETrue ) {}; + + TBool operator() ( const SPacketIdCntx& aEntry ) const + { + return aEntry.iFree == iKey; + } + + private: + + // Prohibit copy constructor. + TPacketIdCntxsPredicate( const TPacketIdCntxsPredicate& ); + // Prohibit assigment operator. + TPacketIdCntxsPredicate& operator= ( const TPacketIdCntxsPredicate& ); + + const TBool iKey; + }; + + class TElementPredicate + { + public: + + TElementPredicate() : iKey( ETrue ) {}; + explicit TElementPredicate( TBool aKey ) : iKey( aKey ) {}; + + TBool operator() ( const SElement& aEntry ) const + { + return aEntry.iFree == iKey; + } + + private: + + // Prohibit copy constructor. + TElementPredicate( const TElementPredicate& ); + // Prohibit assigment operator. + TElementPredicate& operator= ( const TElementPredicate& ); + + const TBool iKey; + }; + + /** + * max number of packet IDs existing any given time + */ + static const TUint32 KMaxNumOfPacketIds = 60; + + /** + * storage type for packet ID contexes + */ + typedef Carray< + SPacketIdCntx, + KMaxNumOfPacketIds, + EFalse, // no delete pointees + NoCopy // disallow copying + > TPacketIdCntxs; + + /** + * number of packets supported in the storage + * (4 user data - 1 per AC, 1 Wlan Mgmt Client and 1 internal packet) + */ + static const TUint32 KNumOfElements = 6; + + /** + * storage type for packet contexts + */ + typedef Carray< + SElement, + KNumOfElements, + EFalse, // no delete pointees + NoCopy // disallow copying + > TPacketElements; + + /** + * state of the transmit queue + */ + enum TQueueState + { + EQueueFull, + EQueueNotFull + }; + + /** + * mapper for transmit queue state + */ + typedef Carray< + TQueueState, + WHA::EQueueIdMax, + EFalse, // no delete pointees + NoCopy // disallow copying + > TQueueStates; + +public: + + /** + * Constructor. + * + * @since S60 3.1 + * @param aWlanPacketSchedulerClient reference to Packet Scheduler Client + */ + explicit WlanPacketScheduler( + MWlanPacketSchedulerClient& aWlanPacketSchedulerClient ); + + /** + * Pushes a packet to be sent to storage. + * NOTE: if no space is available in the storage the operation fails + * and packet scheduler informs the client by using a method call + * when it should call this method again + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + * @param aPacket the packet to transmit + * @param aLength length of the packet + * @param aQueueId id of the queue to use when sending the packet + * @param aPacketId frame type + * @param aMetaHeader frame meta header + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + * @param aMulticastData ETrue if this is a multicast data frame + * @param aUseSpecialRatePolicy ETrue if use of the special Tx rate + * policy is requested for this frame Tx + * @return ETrue packet was accepted, EFalse otherwise + */ + TBool Push( + WlanContextImpl& aCtxImpl, + const TAny* aPacket, + TUint32 aLength, + WHA::TQueueId aQueueId, + TUint32 aPacketId, + const TDataBuffer* aMetaHeader, + TBool aMore, + TBool aMulticastData, + TBool aUseSpecialRatePolicy ); + + /** + * Removes all pending packet transmission entrys + * meaning the scheduler is empty after this call + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + */ + void Flush( WlanContextImpl& aCtxImpl ); + + /** + * Schedules a packet and sends it if possible. + * If no packets to schedule exist, does nothing + * If packet is sent, it is removed from the storage + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + void SchedulePackets( WlanContextImpl& aCtxImpl, TBool aMore ); + + /** + * Packet transfer event + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + */ + void SendPacketTransfer( + WlanContextImpl& aCtxImpl, + WHA::TPacketId aPacketId ); + + /** + * Packet processed from WLAN device transmit queue event + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + */ + void SendPacketComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + WHA::TPacketId aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint8 aAckFailures ); + + /** + * Gets WHA layer transmission status + * + * @param aCtxImpl the one and only global state machine context + * @param aTxQueueState State (full / not full) of every WHA transmit queue + * @return ETrue if the Tx pipeline is active, i.e. Tx frame submission + * is allowed + * EFalse if the Tx pipeline is not active, i.e. Tx frame submission + * is not allowed + */ + TBool GetWhaTxStatus( + const WlanContextImpl& aCtxImpl, + TWhaTxQueueState& aTxQueueState ) const; + + /** + * Are there unsent Tx packets, i.e. packets not yet completed by WHA + * layer + * + * @since S60 3.2 + * @return ETrue if there are packets not yet completed by WHA layer + * EFalse otherwise + */ + inline TBool UnsentPackets() const; + +private: + + // Prohibit copy constructor + WlanPacketScheduler( const WlanPacketScheduler& ); + // Prohibit assigment operator + WlanPacketScheduler& operator= ( const WlanPacketScheduler& ); + + /** + * Evalutes if multiple packets are ready for transmitting. + * Checks does a packet exist in a non-full queue + * + * @since S60 3.1 + * @return ETrue multiple packets ready for transmitting exists, + * EFalse otherwise + */ + TBool MultipleReadyPacketsPending(); + + /** + * Sets current packet pointer to point + * to next current packet if such exists + * + * @since S60 3.1 + */ + void SetNextCurrent(); + + /** + * Extracts a free element slot + * + * @since S60 3.1 + * @return free element slot, NULL upon failure + */ + SElement* FreeElementSlot(); + + /** + * Extracts a free packet ID context + * + * @since S60 3.1 + * @return free packet ID context, NULL upon failure + */ + SPacketIdCntx* FreePacketIdCntx(); + + /** + * Sets the current packet pointer point to a new packet to be transmitted, + * if one exists in a queue defined by supplied parameter. + * This method is called after packet has been processed from WLAN device's + * transmit queue. As the current packet pointer is always supposed to + * point to the highest priority packet that is in a non-full queue this + * method might or might not set the current packet pointer + * + * @since S60 3.1 + * @param aCompletedCntx packet ID context of a packet processed from + * WLAN devices transmit queue + */ + void SetCurrentPacket( const SPacketIdCntx& aCompletedCntx ); + + /** + * Sets the state of the tx pipeline to active + * + * @since S60 3.1 + * @param aQueueId id of the queue + */ + inline void StartTxPipeLine(); + + /** + * Sets the state of the given queue to full + * + * @since S60 3.1 + * @param aQueueId id of the queue + */ + inline void TranmsitQueueFull( WHA::TQueueId aQueueId ); + + /** + * Sets the state of the tx pipeline to stop + * + * @since S60 3.1 + * @param aQueueId id of the queue + */ + inline void StopTxPipeLine(); + + /** + * Evaluates can the packet scheduler accept + * any more packets or is it full + * + * @since S60 3.1 + * @return ETrue if the scheduler is full + * and can not accept any more packets, EFalse otherwise + */ + inline TBool Full() const; + + /** + * Returns the priority of the provided WHA Queue + * + * @param aQueueId id of the WHA queue + * @return Priority of the provided queue + */ + static inline TUint Priority( WHA::TQueueId aQueueId ); + +private: // data + + /** + * this flag is set when we need to signal the Packet Scheduler client + * when packet push is again possible + */ + static const TUint32 KSignalPushPacket = (1 << 0); + + /** + * packet scheduler client + */ + MWlanPacketSchedulerClient& iPacketSchedulerClient; + + /** + * points to highest priority packet of queue that is not full + */ + SElement* iCurrent; + /** + * is tx pipeline active or stopped + */ + TBool iTxPipelineActive; + /** + * number of packets stored inside scheduler + */ + TUint32 iNumOfPackets; + /** + * number of packets not yet completed by WHA layer + */ + TUint32 iNumOfNotCompletedPackets; + /** + * packet ID contexts + */ + TPacketIdCntxs iPacketIdCntxs; + /** + * packet contexts + */ + TPacketElements iPacketElements; + /** + * transmit queue states + */ + TQueueStates iQueueStates; + /** + * holds internal state + */ + TUint32 iFlags; + }; + +#include "umacpacketscheduler.inl" + + +#endif // T_WLANPACKETSCHEDULER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpacketscheduler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpacketscheduler.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The one and only packet scheduler +* +*/ + +/* +* %version: 9 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanPacketScheduler::UnsentPackets() const + { + return ( iNumOfNotCompletedPackets > 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanPacketScheduler::TranmsitQueueFull( + WHA::TQueueId aQueueId ) + { + iQueueStates[aQueueId] = EQueueFull; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanPacketScheduler::StopTxPipeLine() + { + iTxPipelineActive = EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanPacketScheduler::StartTxPipeLine() + { + iTxPipelineActive = ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanPacketScheduler::Full() const + { + return (iNumOfPackets == KNumOfElements); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TUint WlanPacketScheduler::Priority( WHA::TQueueId aQueueId) + { + // Defines a priority for every WHA Queue + const TUint KWhaQueuePriorityTable[] = + { 1, // priority of WHA::ELegacy + 0, // priority of WHA::EBackGround + 2, // priority of WHA::EVideo + 3 // priority of WHA::EVoice + }; + + return KWhaQueuePriorityTable[aQueueId]; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpacketschedulerclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpacketschedulerclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanPacketSchedulerClient class. +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef M_WLANPACKETSCHEDULERCLIENT_H +#define M_WLANPACKETSCHEDULERCLIENT_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +class WlanContextImpl; + +/** + * Packet scheduler client (callback) interface declaration + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class MWlanPacketSchedulerClient + { + +public: + + /** + * Method called when packet has been transferred to the WLAN device + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet whose transfer is complete + * @param aMetaHeader frame meta header + */ + virtual void OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) = 0; + + /** + * Method called when packet has been processed + * from WLAN devices transmit queue + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + * @param aPacketId packet which transfer is complete + * @param aRequestedRate Tx rate that was originally requested + * @param aMulticastData ETrue if the packet in question is a multicast + * data frame + */ + virtual void OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ) = 0; + + /** + * Method called when packet has been flushed (removed) + * from packet scheduler + * + * @since S60 3.1 + * @param aCtxImpl global state machine context + * @param aPacketId packet that was flushed + * @param aMetaHeader frame meta header + */ + virtual void OnPacketFlushEvent( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) = 0; + + /** + * Method called when packet scheduling method should be called, + * as there exists a packet that is suitable for transmission + * NOTE: if any other packet scheduler method is called within this + * context the result is undefined + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + * @param aMore ETrue if another frame is also ready to be transmitted + * EFalse otherwise + */ + virtual void CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ) = 0; + + /** + * Method called when packet push is guaranteed to succeed. + * This method is only called once sometime after a packet push + * has failed + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + */ + virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl ) = 0; + }; + + +#endif // M_WLANPACKETSCHEDULERCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpowermodemgrbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacpowermodemgrbase.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPowerModeMgrBase class +* +*/ + +/* +* %version: 12 % +*/ + +#ifndef WLAN_POWER_MODE_MGR_BASE_H +#define WLAN_POWER_MODE_MGR_BASE_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +#include "umacinternaldefinitions.h" + +class WlanContextImpl; + +/** +* Common base class for classes implementing dynamic power mode transition +* algorithm between PS and active mode in infrastructure mode +*/ +class WlanPowerModeMgrBase + { +public: + + /** Dtor */ + virtual ~WlanPowerModeMgrBase(); + + /** + * To be called when transmitting a frame + * Determines the need to make a power mode transition + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aQueueId Id of the queue/AC via which the frame will be transmitted + * @param aEtherType Ethernet type of the frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameTx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TUint16 aEtherType, + TBool aIgnoreThisFrame ) = 0; + + /** + * To be called when accepting an Rx frame + * + * @since S60 3.1 + * @param aCtxImpl global statemachine context + * @param aAccessCategory AC/Queue via which the frame has beeen transmitted + * @param aEtherType Ethernet type of the received frame + * @param aIgnoreThisFrame shall this frame be ignored from dynamic power + * mode management perspective + * @param aPayloadLength length of the ethernet frame payload + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return To which power management mode to change; if any at all + */ + virtual TPowerMgmtModeChange OnFrameRx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TDaType aDaType ) = 0; + + /** + * To be called upon Active to Light PS timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + virtual TBool OnActiveToLightPsTimerTimeout(); + + /** + * To be called upon Light PS to Active timer timeout + * + * @since S60 v5.1 + * @param aCtxImpl global statemachine context + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + virtual TBool OnLightPsToActiveTimerTimeout( WlanContextImpl& aCtxImpl ); + + /** + * To be called upon Light PS to Deep PS timer timeout + * + * @since S60 v5.1 + * @return ETrue if power mode transition should be done, + * EFalse otherwise + */ + virtual TBool OnLightPsToDeepPsTimerTimeout(); + + /** + * Resets the state of the object + * + * @since S60 3.1 + */ + void Reset(); + + /** + * Resets the state of the derived object + * + * @since S60 3.1 + */ + virtual void DoReset() = 0; + +protected: + + /** Ctor */ + WlanPowerModeMgrBase(); + + /** + * Determines the need to increment frame counter + * + * @since S60 3.1 + * @param aCtxImpl + * @param aAccessCategory + * @param aPayloadLength + * @param aUapsdRxFrameLengthThreshold + * @param aDaType DA type (Unicast, Multicast or Broadcast) of the frame + * @return ETrue if the frame should increment relevant frame counter, + * EFalse otherwise + */ + static TBool CountThisFrame( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TUint16 aUapsdRxFrameLengthThreshold, + TDaType aDaType ); + +private: + + // Prohibit copy constructor + WlanPowerModeMgrBase( const WlanPowerModeMgrBase& ); + // Prohibit assigment operator + WlanPowerModeMgrBase& operator= ( const WlanPowerModeMgrBase& ); + +protected: // Data + + /** + * Frame payload length threshold value (in bytes) for U-APSD + */ + TUint16 iUapsdRxFrameLengthThreshold; + }; + +#endif // WLAN_POWER_MODE_MGR_BASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacprivacymodefilters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacprivacymodefilters.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilters class. +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANPRIVACYMODEFILTERS_H +#define WLANPRIVACYMODEFILTERS_H + +#include "umacoidmsg.h" +#include "UmacPrivacyModeFilter.h" +#include "UmacPrivacyModeFilterNone.h" +#include "UmacPrivacyModeFilterWep.h" +#include "UmacPrivacyModeFilterWpa.h" +#include "UmacPrivacyModeFilter1x.h" +#include "UmacPrivacyModeFilterMixedModeWep.h" +#include "UmacPrivacyModeFilterMixedMode1x.h" +#include "umacprivacymodefilterwapi.h" + + +struct SDataFrameHeader; + +/** + * Privacy mode Rx filters context + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanPrivacyModeFilters + { + +public: + + /** + * C++ default constructor. + */ + inline WlanPrivacyModeFilters(); + + /** + * Destructor. + */ + inline virtual ~WlanPrivacyModeFilters(); + + /** + * Sets desired privacy mode + * + * @since S60 3.1 + * @param aEncryptionStatus desired privacy mode + * @return ETrue filter set success any other failure + */ + virtual void SetActiveFilter( + TEncryptionStatus aEncryptionStatus ); + + /** + * Executes current privacy mode filter + * + * @since S60 3.1 + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + inline TBool ExecuteFilter( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor + WlanPrivacyModeFilters( const WlanPrivacyModeFilters& ); + // Prohibit assigment operator + WlanPrivacyModeFilters& operator= + ( const WlanPrivacyModeFilters& ); + +protected: // Data + + /** privacy mode none filter */ + WlanPrivacyModeFilterNone iNone; + /** privacy mode 802.11 WEP filter */ + WlanPrivacyModeFilterWep iWep; + /** privacy mode WPA filter */ + WlanPrivacyModeFilterWpa iWpa; + /** privacy mode 802.1x filter */ + WlanPrivacyModeFilter1x i1x; + /** privacy mode mixed cell filter */ + WlanPrivacyModeFilterMixedModeWep iMixedModeWep; + /** privacy mode 802.1x mixed cell filter */ + WlanPrivacyModeFilterMixedMode1x iMixedMode1x; + /** privacy mode WAPI filter */ + WlanPrivacyModeFilterWapi iWapi; + /** currently active privacy filter */ + MWlanPrivacyModeFilter* iActiveFilter; + }; + +#include "umacprivacymodefilters.inl" + +#endif // WLANPRIVACYMODEFILTERS_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacprivacymodefilters.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacprivacymodefilters.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanPrivacyModeFilters inline methods. +* +*/ + +/* +* %version: 7 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanPrivacyModeFilters::WlanPrivacyModeFilters() + : iActiveFilter( NULL ) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanPrivacyModeFilters::~WlanPrivacyModeFilters() + { + iActiveFilter = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanPrivacyModeFilters::ExecuteFilter( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const + { + return (*iActiveFilter)( + aFrameheader, + aUserDataEnabled, + aEthernetType, + aUnicastKeyExists, + aAesOrTkipOrWapiEncrypted ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacprivacymodefilterwapi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacprivacymodefilterwapi.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanPrivacyModeFilterWapi class +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANPRIVACYMODEFILTERWAPI_H +#define WLANPRIVACYMODEFILTERWAPI_H + +#include "UmacPrivacyModeFilter.h" + +/** +* Class Implements privacy mode WAPI Rx filter +* which is used when WAPI is the active privacy mode +*/ +class WlanPrivacyModeFilterWapi : public MWlanPrivacyModeFilter + { +public: + + /** + * C++ default constructor. + */ + WlanPrivacyModeFilterWapi() {}; + + /** Dtor */ + virtual ~WlanPrivacyModeFilterWapi() {}; + + /** + * Filtering function for Rx-data frames + * @param aFrameheader Header of the received frame + * @param aUserDataEnabled is protocol stack side datapath + * enabled or not + * @param aEthernetType Ethernet Type of the received frame + * @param aUnicastKeyExists AP <-> client unicast key + * is configured or not + * @param aAesOrTkipOrWapiEncrypted ETrue if the frame is encrypted with AES, + * TKIP or WAPI, EFalse otherwise + * @return ETrue if frame can be accepted, EFalse otherwise + */ + virtual TBool operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const; + +private: + + // Prohibit copy constructor + WlanPrivacyModeFilterWapi( const WlanPrivacyModeFilterWapi& ); + // Prohibit assignment operator + WlanPrivacyModeFilterWapi& operator= ( + const WlanPrivacyModeFilterWapi& ); + }; + +#endif // WLANPRIVACYMODEFILTERWAPI_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsm.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TWlanScanFsm class. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef T_WLANSCANFSM_H +#define T_WLANSCANFSM_H + +class WlanScanFsmCntx; + +/** + * Scan state machine. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class TWlanScanFsm + { + +public: + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void StartScanningMode( WlanScanFsmCntx& aCnxt ); + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void StopScanningMode( WlanScanFsmCntx& aCnxt ); + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void OnScanningModeStarted( WlanScanFsmCntx& aCnxt ); + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void OnScanningModeStopped( WlanScanFsmCntx& aCnxt ); + +protected: + + TWlanScanFsm() {}; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + void ChangeState( WlanScanFsmCntx& aCnxt, TWlanScanFsm& aNewState ) const; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void Entry( WlanScanFsmCntx& aCnxt ) = 0; + +private: + + }; + +#endif // T_WLANSCANFSM_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsmcb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsmcb.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: scan fsm callback interface layer +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef M_WLANSCANFSMCB_H +#define M_WLANSCANFSMCB_H + +class MWlanScanFsmCb + { + +public: + + enum TEvent + { + EFSMSTARTSCANNINGMODE, + EFSMSCANMODERUNNING, + EFSMSTOPSCANNINGMODE, + EFSMSCANMODESTOPPED + }; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void OnScanFsmEvent( TEvent aEvent ) = 0; + + +protected: + + + + }; + + +#endif // M_WLANSCANFSMCB_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsmcntx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsmcntx.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanScanFsmCntx class. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef C_WLANSCANFSMCNTX_H +#define C_WLANSCANFSMCNTX_H + +#include "umacscanmoderunning.h" +#include "umacscanmodestopped.h" +#include "umacstartscanningmode.h" +#include "umacstopscanningmode.h" + +class TWlanScanFsm; +class MWlanScanFsmCb; + +/** + * Scan statemachine context. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanScanFsmCntx + { + + friend class TWlanScanFsm; + friend class TWlanScanModeRunning; + friend class TWlanScanModeStopped; + friend class TWlanStartScanningMode; + friend class TWlanStopScanningMode; + +public: + + + inline explicit WlanScanFsmCntx( MWlanScanFsmCb& aCb ); + + /** + * ?description + * + * @since S60 3.1 + * @return ?description + */ + inline TWlanScanFsm& Current(); + +private: + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + inline void Current( TWlanScanFsm& aNewCurrent ); + + /** + * ?description + * + * @since S60 3.1 + * @return ?description + */ + inline MWlanScanFsmCb& Cb(); + + /** + * ?description + * + * @since S60 3.1 + * @return ?description + */ + inline TWlanScanFsm& ScanModeRunning(); + + /** + * ?description + * + * @since S60 3.1 + * @return ?description + */ + inline TWlanScanFsm& ScanModeStopped(); + + /** + * ?description + * + * @since S60 3.1 + * @return ?description + */ + inline TWlanScanFsm& StartScanningMode(); + + /** + * ?description + * + * @since S60 3.1 + * @return ?description + */ + inline TWlanScanFsm& StopScanningMode(); + + // Prohibit copy constructor + WlanScanFsmCntx( const WlanScanFsmCntx& ); + // Prohibit assigment operator + WlanScanFsmCntx& operator= ( const WlanScanFsmCntx& ); + +private: // data + + /** + * ?description_of_member + */ + MWlanScanFsmCb& iCb; + + /** + * ?description_of_member + */ + TWlanScanModeRunning iWlanScanModeRunning; + + /** + * ?description_of_member + */ + TWlanScanModeStopped iWlanScanModeStopped; + + /** + * ?description_of_member + */ + TWlanStartScanningMode iWlanStartScanningMode; + + /** + * ?description_of_member + */ + TWlanStopScanningMode iWlanStopScanningMode; + + /** + * ?description_of_pointer_member + * Own. + */ + TWlanScanFsm* iCurrentState; + + }; + +#include "umacscanfsmcntx.inl" + +#endif // C_WLANSCANFSMCNTX_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsmcntx.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanfsmcntx.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanScanFsmCntx inline +* methods. +* +*/ + +/* +* %version: 7 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanScanFsmCntx::WlanScanFsmCntx( MWlanScanFsmCb& aCb ) : + iCb( aCb ), + // to keep static code analysers happy. Actual initialization below + iCurrentState( NULL ) + { + iCurrentState = &iWlanScanModeStopped; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TWlanScanFsm& WlanScanFsmCntx::Current() + { + return *iCurrentState; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanScanFsmCntx::Current( + TWlanScanFsm& aNewCurrent ) + { + iCurrentState = &aNewCurrent; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline MWlanScanFsmCb& WlanScanFsmCntx::Cb() + { + return iCb; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TWlanScanFsm& WlanScanFsmCntx::ScanModeRunning() + { + return iWlanScanModeRunning; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TWlanScanFsm& WlanScanFsmCntx::ScanModeStopped() + { + return iWlanScanModeStopped; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TWlanScanFsm& WlanScanFsmCntx::StartScanningMode() + { + return iWlanStartScanningMode; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TWlanScanFsm& WlanScanFsmCntx::StopScanningMode() + { + return iWlanStopScanningMode; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanmoderunning.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanmoderunning.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TWlanScanModeRunning class. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef T_WLANSCANMODERUNNING_H +#define T_WLANSCANMODERUNNING_H + +#include "umacscanfsm.h" + +/** + * Scan executing state. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class TWlanScanModeRunning : public TWlanScanFsm + { + +public: + + TWlanScanModeRunning() {}; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + +private: + + // from base class TWlanScanFsm + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanScanFsmCntx& aCnxt ); + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void StopScanningMode( WlanScanFsmCntx& aCnxt ); + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void OnScanningModeStopped( WlanScanFsmCntx& aCnxt ); + + // Prohibit copy constructor + TWlanScanModeRunning( const TWlanScanModeRunning& ); + // Prohibit assigment operator + TWlanScanModeRunning& operator= ( const TWlanScanModeRunning& ); + + }; + + +#endif // T_WLANSCANMODERUNNING_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanmodestopped.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacscanmodestopped.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TWlanScanModeStopped class. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef T_WLANSCANMODESTOPPED_H +#define T_WLANSCANMODESTOPPED_H + +#include "umacscanfsm.h" + +/** + * Scan stopped state. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class TWlanScanModeStopped : public TWlanScanFsm + { + +public: + + TWlanScanModeStopped() {}; + +private: + + // from base class TWlanScanFsm + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanScanFsmCntx& aCnxt ); + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void StartScanningMode( WlanScanFsmCntx& aCnxt ); + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void StopScanningMode( WlanScanFsmCntx& aCnxt ); + + // Prohibit copy constructor + TWlanScanModeStopped( const TWlanScanModeStopped& ); + // Prohibit assigment operator + TWlanScanModeStopped& operator= ( const TWlanScanModeStopped& ); + }; + +#endif // T_WLANSCANMODESTOPPED_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacsignalpredictor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacsignalpredictor.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,358 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TWlanSignalPredictor class. +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANSIGNALPREDICTOR_H +#define WLANSIGNALPREDICTOR_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +/** + * Signal Level Predictor machine. + * + * @lib wlanumac.lib + * @since S60 v3.2 + */ +class WlanSignalPredictor + { + +public: + + /** + * Constructor. + */ + WlanSignalPredictor(); + + /** + * Destructor. + */ + inline ~WlanSignalPredictor(); + + /** + * Starts the Signal Predictor. + * If signal predictor is stopped, Start command will start it. + * By default it is started. + * @since S60 v3.2 + */ + inline void Start(); + + /** + * Stops the Signal Predictor. + * + * @since S60 v3.2 + */ + inline void Stop(); + + /** + * Configure the Signal Predictor operation. + * + * Note! If given param is 0, then old value remains. + * @since S60 v3.2 + * @param aTimeToWarnLevel Specifies the time (in microseconds) + * how far into the future signal prediction is done. + * @param aTimeToNextInd The minimum time difference (in + * microseconds) between two signal loss prediction indications. + * @param aRcpiWarnLevel If this RCPI level is predicted to be + * reached within the time specified by aSpTimeToCountPrediction, + * a signal loss prediction indication is sent. + */ + void ConfigureSignalPredictor( + TUint32 aTimeToWarnLevel, + TUint32 aTimeToNextInd, + WHA::TRcpi aRcpiWarnLevel ); + + /** + * Insert new rcpi information into the Signal Predictor. + * + * @since S60 v3.2 + * @param aTimestamp 32-bit timestamp in microseconds. + * @param aRcpi rcpi value from HW + * @return ETrue if signal loss prediction indication should be sent + */ + TBool InsertNewRcpi( + TUint32 aTimestamp, + WHA::TRcpi aRcpi ); + + /** + * Get the latest median value from Signal Predictor. + * + * @since S60 v3.2 + * @param aTimestamp 32-bit timestamp in milliseconds. + * @param aLatestMedian reference to the median. + * @return Boolean about if median value is available. + */ + TBool GetLatestMedian( + TUint32 aTimestamp, + TUint8& aLatestMedian ) const; + + /** + * Get the latest rcpi from Signal Predictor. + * + * @since S60 v3.2 + * @param aTimestamp 32-bit timestamp in milliseconds. + * @param aLatestRcpi reference to the rcpi. + * @return Boolean about if rcpi value is available. + */ + TBool GetLatestRcpi( + TUint32 aTimestamp, + TUint8& aLatestRcpi ); + +protected: + + /** + * Checks if there are too old values in rcpi table. + * + * @since S60 v3.2 + * @param aTimestamp 32-bit timestamp in milliseconds. + */ + void RemoveOldValues( + TUint32 aTimestamp ); + + /** + * removes an old value from rcpi table. + * + * @since S60 v3.2 + * @param aIndex Index of rcpi to be removed from rcpi table. + */ + void RemoveValue( + TUint8 aIndex ); + + /** + * Inserts new median value into median table. + * + * @since S60 v3.2 + * @param aTimestamp 32-bit timestamp in milliseconds. + * @param aMedian a new median value. + * @return ETrue if signal loss prediction indication should be sent + */ + TBool InsertMedian( + TUint32 aTimestamp, + TUint8 aMedian ); + + /** + * Inserts new rcpi value into rcpi table. + * + * @since S60 v3.2 + * @param aTimestamp 32-bit timestamp in milliseconds. + * @param aRcpi a new rcpi value. + * @return ETrue if signal loss prediction indication should be sent + */ + TBool InsertValue( + TUint32 aTimestamp, + WHA::TRcpi aRcpi ); + + /** + * Count the current median from the rcpi table. + * + * @since S60 v3.2 + * @return Current median value. + */ + TUint8 GetCurrentMedian() const; + + /** + * Counts the estimation about the signal behaviour. + * + * @since S60 v3.2 + * @return ETrue if signal loss prediction indication should be sent + */ + TBool GetPrediction(); + + /** + * Get the time interval between old and new times. + * + * @since S60 v3.2. + * @param aOldTime 32-bit timestamp in milliseconds. + * @param aNewTime 32-bit timestamp in milliseconds. + * @return Time interval in milliseconds. + */ + TUint32 Delay( + TUint32 aOldTime, + TUint32 aNewTime ) const; + +private: + + struct TValue /* value info element */ + { + TUint32 iTimestamp; /* timestamp */ + TUint8 iPrev; /* next smaller rcpi value */ + TUint8 iNext; /* next bigger rcpi value */ + WHA::TRcpi iRcpi; /* rcpi value */ + TUint8 iPad; /* padding byte */ + }; + + struct TLastRoam /* roaming info element */ + { + TUint32 iTimestamp;/* timestamp */ + TBool iDone; /* valid or not */ + }; + + /** + * Only one iten + */ + static const TUint KOneValue = 1; + + /** + * Just dummy data pattern + */ + static const TUint8 KDummy = 0x55; + + /** + * Rcpi table size + */ + static const TUint32 KValueCountMax = 25; + + /** + * Median table size + */ + static const TUint32 KMedianCountMax = 2; + + /** + * Minimum time delay which is needed to accept next rcpi value + */ + static const TUint32 KValueDelay = 10; + + /** + * Minimum time delay which is needed to accept next median value + */ + static const TUint32 KMedianDelay = 35; + + /** + * Window size in milliseconds + */ + static const TUint32 KWindowSizeDefault = 1000; + + /** + * Time to indication sending in milliseconds + */ + static const TUint32 KTimeToIndicationLevel = 1000; + + /** + * Minimum time in milliseconds to next signal loss prediction indication sending + */ + static const TUint32 KTimeToNextIndication = 1000; + + /** + * Rcpi level when signal loss prediction indication generated + */ + static const TUint8 KRoamLevel = 80; + + /** + * Rcpi level above which, the indication is not sent + */ + static const TUint8 KDiffRoamLevel = 120; + + /** + * Minimum count of rcpi values to get signal loss prediction + */ + static const TUint8 KMinValueCountForPrediction = 10; + + /** + * rcpi table + */ + TValue iLevelTable[ KValueCountMax ]; + + /** + * median table + */ + TValue iMedianTable[ KMedianCountMax ]; + + /** + * time interval to the indication level in milliseconds + */ + TUint32 iTimeToWarnLevel; + + /** + * observation time interval in milliseconds + */ + TUint32 iWindowSize; + + /** + * minimum time interval between two signal loss prediction + * indications, in milliseconds + */ + TUint32 iTimeToNextInd; + + /** + * level when roam indication in generated + */ + TUint8 iWarningLevel; + + /** + * rcpi count in the rcpi table + */ + TUint8 iValueCount; + + /** + * median count in the median table + */ + TUint8 iMedianCount; + + /** + * index of the latest median item in the median table + */ + TUint8 iLatestMedian; + + /** + * index of the latest rcpi item in the rcpi table + */ + TUint8 iOldestValue; + + /** + * index of the latest rcpi item in the rcpi table + */ + TUint8 iLatestValue; + + /** + * index of the least rcpi item in the rcpi table + */ + TUint8 iLeastRcpi; + + /** + * index of the biggest rcpi item in the rcpi table + */ + TUint8 iMaxRcpi; + + /** + * Used value count, max value is KValueCountMax + */ + TUint8 iValueCountMax; + + /** + * Used value count, max value is KValueCountMax + */ + TUint8 iMinValueCountForPrediction; + + /** + * State information */ + TBool iRunning; + + /** + * Last signal loss prediction indication info + */ + TLastRoam iRoamed; + }; + +#include "umacsignalpredictor.inl" + +#endif // WLANSIGNALPREDICTOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacsignalpredictor.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacsignalpredictor.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of inline methods +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline WlanSignalPredictor::~WlanSignalPredictor() + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::~WlanSignalPredictor") ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanSignalPredictor::Start() + { + OsTracePrint( KRxFrame, (TUint8*)("UMAC: WlanSignalPredictor::Start") ); + iRunning = ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanSignalPredictor::Stop() + { + OsTracePrint( KRxFrame, (TUint8*)("UMAC: WlanSignalPredictor::Stop") ); + iRunning = EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacstartscanningmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacstartscanningmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TWlanStartScanningMode class. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef T_WLANSTARTSCANNINGMODE_H +#define T_WLANSTARTSCANNINGMODE_H + +#include "umacscanfsm.h" + +/** + * Start scanning state. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class TWlanStartScanningMode : public TWlanScanFsm + { + +public: + + TWlanStartScanningMode() {}; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + +private: + + // from base class TWlanScanFsm + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanScanFsmCntx& aCnxt ); + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void OnScanningModeStarted( WlanScanFsmCntx& aCnxt ); + + // Prohibit copy constructor + TWlanStartScanningMode( const TWlanStartScanningMode& ); + // Prohibit assigment operator + TWlanStartScanningMode& operator= ( const TWlanStartScanningMode& ); + }; + +#endif // T_WLANSTARTSCANNINGMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacstopscanningmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacstopscanningmode.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TWlanStopScanningMode class. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef T_WLANSTOPSCANNINGMODE_H +#define T_WLANSTOPSCANNINGMODE_H + +#include "umacscanfsm.h" + +/** + * Stop scanning state. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class TWlanStopScanningMode : public TWlanScanFsm + { + +public: + + TWlanStopScanningMode () {}; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + +private: + + // from base class TWlanScanFsm + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanScanFsmCntx& aCnxt ); + + /** + * From TWlanScanFsm. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void OnScanningModeStopped( WlanScanFsmCntx& aCnxt ); + + // Prohibit copy constructor + TWlanStopScanningMode( const TWlanStopScanningMode& ); + // Prohibit assigment operator + TWlanStopScanningMode& operator= ( const TWlanStopScanningMode& ); + }; + +#endif // T_WLANSTOPSCANNINGMODE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umactypemanip.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umactypemanip.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic type manipulation templates. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef _TYPEMANIP_H +#define _TYPEMANIP_H + +//////////////////////////////////////////////////////////////////////////////// +// class template Int2Type +// Converts each integral constant into a unique type +// Invocation: Int2Type where v is a compile-time constant integral +// Defines 'value', an enum that evaluates to v +//////////////////////////////////////////////////////////////////////////////// + +template +struct Int2Type +{ + enum { value = v }; +}; + +//////////////////////////////////////////////////////////////////////////////// +// class template Type2Type +// Converts each type into a unique, insipid type +// Invocation Type2Type where T is a type +// Defines the type OriginalType which maps back to T +//////////////////////////////////////////////////////////////////////////////// + +template +struct Type2Type +{ + typedef T OriginalType; +}; + +#endif // _TYPEMANIP_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacusertxdatacntx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacusertxdatacntx.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of TWlanUserTxDataCntx class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef T_WLANUSERTXDATACNTX_H +#define T_WLANUSERTXDATACNTX_H + +#include "802dot11.h" + +class TDataBuffer; + +/** + * Encapsulates a frame transmit buffer + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class TWlanUserTxDataCntx + { + +public: + + TWlanUserTxDataCntx () : + iStartOfFrame( 0 ), + iLengthOfData( 0 ), + iEthernetBuffer( NULL ) {} + + inline TUint8* StartOfFrame(); + + inline void LengthOfFrame( TUint aFrameLength ); + + inline TUint LengthOfFrame() const; + + inline void Dot11FrameReady( TUint8* aStartOfFrame, TUint aLengthOfFrame ); + +private: // data + + /** pointer to the beginning of the ready to be sent 802.11 frame */ + TUint8* iStartOfFrame; + /** + * length of the data in the buffer + */ + TUint iLengthOfData; + /** + * data buffer that holds the ethernet II critter to send next + * its waiting for dot11 encapulation here + */ + TDataBuffer* iEthernetBuffer; + }; + +#include "umacusertxdatacntx.inl" + +#endif // T_WLANUSERTXDATACNTX_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacusertxdatacntx.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacusertxdatacntx.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of TWlanUserTxDataCntx inline +* methods. +* +*/ + +/* +* %version: 8 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TUint8* TWlanUserTxDataCntx::StartOfFrame() + { + return iStartOfFrame; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void TWlanUserTxDataCntx::LengthOfFrame( TUint aFrameLength ) + { + iLengthOfData = aFrameLength; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TUint TWlanUserTxDataCntx::LengthOfFrame() const + { + return iLengthOfData; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void TWlanUserTxDataCntx::Dot11FrameReady( + TUint8* aStartOfFrame, + TUint aLengthOfFrame ) + { + iStartOfFrame = aStartOfFrame; + iLengthOfData = aLengthOfFrame; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhacommandclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhacommandclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanWhaCommandClient class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef M_WLANWHACOMMANDCLIENT_H +#define M_WLANWHACOMMANDCLIENT_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +class WlanContextImpl; + +/** + * WHA command callback interface. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class MWlanWhaCommandClient + { + +public: + + /** + * Method called by WHA command object after it has received a correponding + * commmad response event. + * It is guarantedd by the frame work that response matches + * to the command send by the WHA command client. So it is not required + * to check the aCommandId parameter for programming error + * (matches to the command send). + * This method is called just prior state object transition is done, + * so one must not make a state object transition inside this method + * + * @since S60 3.1 + * @param aCtxImpl the one and only global state machine context + * @param aCommandId WHA command identifier + * @param aStatus comamnd specific status code + * @param aCommandResponseParams command specific response paramaters, if any + * @param aAct Asynchronous Completion Token used by the WHA command client, + * returned by the caller of this method just as it was supplied + */ + virtual void OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ) = 0; + + }; + +#endif // M_WLANWHACOMMANDCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhaconfigureac.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhaconfigureac.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWhaConfigureAc class. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef WLANWHACONFIGUREAC_H +#define WLANWHACONFIGUREAC_H + +#include "UmacWsaCommand.h" +#include "umacinternaldefinitions.h" +#include "UmacContextImpl.h" + +/** + * Encapsulates the execution of ConfigureAc WHA command. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanWhaConfigureAc : public WlanWsaCommand + { + +public: + + WlanWhaConfigureAc(); + + virtual ~WlanWhaConfigureAc() {}; + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + void Set( + const TCwMinVector& aCwMin, + const TCwMaxVector& aCwMax, + const TAifsVector& aAIFS, + const TTxOplimitVector& aTxOplimit ); + +private: + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWhaConfigureAc( const WlanWhaConfigureAc& ); + // Prohibit assigment operator. + WlanWhaConfigureAc& operator= ( const WlanWhaConfigureAc& ); + +private: // data + +#ifndef NDEBUG + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + + TUint16 iCwMin[WHA::Wha::KNumOfEdcaQueues]; + TUint16 iCwMax[WHA::Wha::KNumOfEdcaQueues]; + TUint8 iAIFS[WHA::Wha::KNumOfEdcaQueues]; + TUint16 iTxOplimit[WHA::Wha::KNumOfEdcaQueues]; + }; + +#endif // WLANWHACONFIGUREAC_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhaconfigurequeue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhaconfigurequeue.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWhaConfigureQueue class. +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef T_WLANWHACONFIGUREQUEUE_H +#define T_WLANWHACONFIGUREQUEUE_H + +#include "UmacWsaCommand.h" + +/** + * Encapsulates the execution of ConfigureQueue WHA command. + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanWhaConfigureQueue : public WlanWsaCommand + { + +public: + + WlanWhaConfigureQueue() : + iQueueId( static_cast(0) ), + iMaxLifeTime( 0 ), + iPsScheme( static_cast(0) ), + iAckPolicy( static_cast(0) ), + iMediumTime( 0 ) {}; + + virtual ~WlanWhaConfigureQueue() {}; + + /** + * ?description + * + * @since S60 3.1 + * @param aQueueId + * @param aMaxLifeTime + * @param aPsScheme + * @param aAckPolicy + * @param aMediumTime + */ + void Set( + WHA::TQueueId aQueueId, + TUint32 aMaxLifeTime, + WHA::TPsScheme aPsScheme, + WHA::TAckPolicy aAckPolicy, + TUint16 aMediumTime ); + +private: + + virtual void Entry( WlanContextImpl& aCtxImpl ); +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWhaConfigureQueue( const WlanWhaConfigureQueue& ); + // Prohibit assigment operator. + WlanWhaConfigureQueue& operator= ( const WlanWhaConfigureQueue& ); + +private: // data + +#ifndef NDEBUG + /** + * ?description_of_member + */ + static const TInt8 iName[]; +#endif + + WHA::TQueueId iQueueId; + TUint32 iMaxLifeTime; + WHA::TPsScheme iPsScheme; + WHA::TAckPolicy iAckPolicy; + TUint16 iMediumTime; + }; + +#endif // T_WLANWHACONFIGUREQUEUE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwharelease.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwharelease.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWhaRelease class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLAN_WHA_RELEASE_H +#define WLAN_WHA_RELEASE_H + +#include "UmacWsaCommand.h" + +/** + * Encapsulates the execution of Release WHA command. + * + * @lib ?library + * @since S60 3.1 + */ +class WlanWhaRelease : public WlanWsaCommand + { + +public: + + WlanWhaRelease() {}; + + virtual ~WlanWhaRelease() {}; + +private: + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + */ + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + // Prohibit copy constructor. + WlanWhaRelease( const WlanWhaRelease& ); + // Prohibit assigment operator. + WlanWhaRelease& operator= ( const WlanWhaRelease& ); + +private: // data + +#ifndef NDEBUG + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + }; + +#endif // WLAN_WHA_RELEASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhastopscan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhastopscan.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWhaStopScan class. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLAN_WHA_STOP_SCAN_H +#define WLAN_WHA_STOP_SCAN_H + +#include "UmacWsaCommand.h" + +/** + * Encapsulates the execution of StopScan WHA command. + * + * @lib wlanumac.lib + * @since S60 v3.2 + */ +class WlanWhaStopScan : public WlanWsaCommand + { + +public: + + WlanWhaStopScan() {}; + + virtual ~WlanWhaStopScan() {}; + +private: + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.2 + * @param ?arg1 ?description + */ + virtual void Entry( WlanContextImpl& aCtxImpl ); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.2 + * @param ?arg1 ?description + */ + virtual void CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ); + + /** + * From ?base_class1. + * ?description + * + * @since S60 3.2 + * @param ?arg1 ?description + */ +#ifndef NDEBUG + virtual const TInt8* GetStateName( TUint8& aLength ) const; +#endif // !NDEBUG + + // Prohibit copy constructor. + WlanWhaStopScan( const WlanWhaStopScan& ); + // Prohibit assigment operator. + WlanWhaStopScan& operator= ( const WlanWhaStopScan& ); + +private: // data + +#ifndef NDEBUG + /** + * name of the state + */ + static const TInt8 iName[]; +#endif + }; + +#endif // WLAN_WHA_STOP_SCAN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhatodot11typeconverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacwhatodot11typeconverter.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanWhaToDot11TypeConverter class. +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef T_WLANWHATODOT11TYPECONVERTER_H +#define T_WLANWHATODOT11TYPECONVERTER_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +#include "umacoidmsg.h" + +class WlanContextImpl; +struct SSupportedRatesIE; +struct SExtendedSupportedRatesIE; + +/** + * Converts WHA types to dot11 types + * + * @lib wlanumac.lib + * @since S60 v3.1 + */ +class WlanWhaToDot11TypeConverter + { + +public: + + /** + * ?description + * + * @since S60 3.1 + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + static void Convert( + WHA::TRate aRateMask, + SSupportedRatesIE& aRateIe, + SExtendedSupportedRatesIE& aExtRateIe ); + + /** + * Converts scan parameters to WHA types + * + * @since S60 3.2 + * @param aCtxImpl global statemachine context + * @param aSsid SSID as non-WHA type + * @param aWhaSsid SSID as WHA type + * @param aChannels channel information as non-WHA type + * @param aMinChannelTime min. time to listen beacons/probe responses + * on a channel + * @param aMaxChannelTime max. time to listen beacons/probe responses + * on a channel + * @param aWhaChannels channel information as WHA type + * @param aWhaChannelCount number of channels to be scanned + * @return ETrue when successful + * EFalse when memory allocation fails + */ + static TBool ConvertToWhaTypes( + WlanContextImpl& aCtxImpl, + const TSSID* aSsid, + WHA::SSSID& aWhaSsid, + const SChannels* aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + WHA::SChannels*& aWhaChannels, + TUint8& aWhaChannelCount ); + +private: + + WlanWhaToDot11TypeConverter() {}; + + // Prohibit copy constructor. + WlanWhaToDot11TypeConverter( const WlanWhaToDot11TypeConverter& ); + // Prohibit assigment operator. + WlanWhaToDot11TypeConverter& operator= + ( const WlanWhaToDot11TypeConverter& ); + + }; + +#endif // T_WLANWHATODOT11TYPECONVERTER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/inc/wha_mibDefaultvalues.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/inc/wha_mibDefaultvalues.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines default constant MIB structures +* for default WHA MIB configuration +* +*/ + +/* +* %version: 19 % +*/ + +#ifndef WHA_MIBDEFAULTVALUES_H +#define WHA_MIBDEFAULTVALUES_H + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + +NAMESPACE_BEGIN_WHA + +// dot11MaxReceiveLifeTime +// +const TUint32 KDot11MaxReceiveLifeTimeDefault = 512; + +const Sdot11MaxReceiveLifeTime KDot11MaxReceiveLifeTimeMibDefault + = { KDot11MaxReceiveLifeTimeDefault }; + + +// dot11SlotTime +// +const TUint32 KDot11SlotTimeDefault = KSlotTime20; + +const Sdot11SlotTime KDot11SlotTimeMibDefault + = { KDot11SlotTimeDefault }; + + +// dot11GroupAddressesTable +// +const Sdot11GroupAddressesTable KDot11GroupAddressesTableMibDefault = + { + EFalse, // disable + 0, // NumOfAddrs + 0 + }; + + +// dot11WepDefaultKeyId +// +const TPrivacyKeyId KDot11WepDefaultKeyId = KPrivacyKeyId0; + +const Sdot11WepDefaultKeyId KDot11WepDefaultKeyIdMib + = { KDot11WepDefaultKeyId }; + + +// dot11CurrentTxPowerLevel +// +const TPowerLevel KDot11CurrentTxPowerLevelDefault = 20; + +const Sdot11CurrentTxPowerLevel KDot11CurrentTxPowerLevelMibDefault + = { KDot11CurrentTxPowerLevelDefault }; + + +// ctsToSelf +// +const TBool KCtsToSelfDefault = EFalse; + +const SctsToSelf KCtsToSelfMibDefault + = { KCtsToSelfDefault }; + + +// arpIpAddressTable +// +const WHA::SarpIpAddressTable KArpIpAddressTableMibDefault = + { + EFalse, 0 + }; + +// rxFilter +// +const TUint32 KRxFilterDefault = 0; + +const SrxFilter KRxFilterMibDefault + = { KRxFilterDefault }; + + +// beaconFilterIeTable +// +const SbeaconFilterIeTable KBeaconFilterIeTableMibDefault = + { + 0, // numofElems + 0 // empty IE table + }; + + +// beaconFilterEnable +// +const SbeaconFilterEnable KBeaconFilterEnableMibDefault = + { + ETrue, // filtering enabled + 0 + }; + + +// wlanWakeUpInterval +// +const TUint8 KListenIntervalDefault = 1; +const SwlanWakeUpInterval KWlanWakeUpIntervalMibDefault + = { KWakeUpIntervalAllBeacons, + KListenIntervalDefault, + 0 // iReserved + }; + + +// beaconLostCount +// +const TUint32 KBeaconLostCountDefault = 5; + +const SbeaconLostCount KBeaconLostCountMibDefault + = { KBeaconLostCountDefault }; + + +// rcpiThreshold +// +const TRcpi KRcpiThresholdDefault = 0; + +const SrcpiThreshold KRcpiThresholdMibDefault + = { KRcpiThresholdDefault }; + + +// txRatePolicy +// + +const TUint8 KDefaultTxRatePolicyId = 1; + +const TUint8 KTxPolicy54Default = 0; +const TUint8 KTxPolicy48Default = 0; +const TUint8 KTxPolicy36Default = 0; +const TUint8 KTxPolicy33Default = 0; +const TUint8 KTxPolicy24Default = 0; +const TUint8 KTxPolicy22Default = 0; +const TUint8 KTxPolicy18Default = 0; +const TUint8 KTxPolicy12Default = 0; +const TUint8 KTxPolicy11Default = 0; +const TUint8 KTxPolicy9Default = 0; +const TUint8 KTxPolicy6Default = 0; +const TUint8 KTxPolicy5_5Default = 0; +const TUint8 KTxPolicy2Default = 0; +const TUint8 KTxPolicy1Default = 1; + +const TUint8 KShortRetryLimitDefault = 7; +const TUint8 KLongRetryLimitDefault = 4; + +const TUint32 KFlagsDefault = 0; + +const TUint32 KNumOfPolicyObjectsDefault = 1; + +const StxRatePolicy KTxRatePolicyMibDefault = + { // rate policy struct + KNumOfPolicyObjectsDefault, + { // rate class array + { // rate class struct + KTxPolicy54Default, + KTxPolicy48Default, + KTxPolicy36Default, + KTxPolicy33Default, + KTxPolicy24Default, + KTxPolicy22Default, + KTxPolicy18Default, + KTxPolicy12Default, + KTxPolicy11Default, + KTxPolicy9Default, + KTxPolicy6Default, + KTxPolicy5_5Default, + KTxPolicy2Default, + KTxPolicy1Default, + KShortRetryLimitDefault, + KLongRetryLimitDefault, + KFlagsDefault + } + } + }; + + +// htCapabilities +// +const TBool KHtSupportDefault = EFalse; + +const ShtCapabilities KHtCapabilitiesMibDefault = + { + KHtSupportDefault, // HT support + { { 0, 0, 0, 0, 0, 0 } }, // MAC + 0, // STBC Tx + 0, // A-MPDU + 0, // capabilities + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Rx MCS set + 0, // min MPDU spacing in A-MPDUs + 0, // MCS feedback + 0, // transmit beamforming + 0, // ASEL + { 0, 0, 0 } // padding + }; + + +// htBssOperation +// +const ShtBssOperation KHtBssOperationMibDefault = + { + 0, // HT information + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // basic MCS set + 0, // HT protection mode + 0, // secondary ch offset + 0, // AP ch width + { 0, 0, 0 } // padding + }; + +// htSecondaryBeacon +// +const ShtSecondaryBeacon KHtSecondaryBeaconMibDefault = + { + KHtSecBeaconRxPrimaryOnly, + 0 + }; + +// htBlockAckConfigure +// +const TUint8 KHtBlockAckDefault = 0x00; // Block Ack disabled for all TIDs + +const ShtBlockAckConfigure KHtBlockAckConfigureMibDefault = + { + KHtBlockAckDefault, + KHtBlockAckDefault, + 0 // padding + }; + +NAMESPACE_END_WHA + +#endif // WHA_MIBDEFAULTVALUES_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/Umac.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/Umac.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1530 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the Umac class +* +*/ + +/* +* %version: 54 % +*/ + +#include "config.h" +#include "UmacContextImpl.h" + +#include "Umac.h" +#include "umacoidmsg.h" + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +Umac::Umac() : iPimpl( NULL ), iManagementRequestPending( EFalse ) + { + os_memset( &iOidOutputData, 0, sizeof( iOidOutputData ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +Umac::~Umac() + { + if ( iPimpl ) + { + OsTracePrint( KInitLevel, + (TUint8*)("UMAC: Umac::~Umac(): deallocate internal impl")); + + iPimpl->~WlanContextImpl(); + os_free( iPimpl ); + iPimpl = NULL; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::OnTimeout( TWlanTimer aTimer ) + { + if ( iPimpl->WsaCmdActive() ) // WHA layer in use + { + // ...defer access + + switch ( aTimer ) + { + case EWlanDefaultTimer: + iPimpl->RegisterEvent( KTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): timeout event registered")); + break; + case EWlanVoiceCallEntryTimer: + iPimpl->RegisterEvent( KVoiceCallEntryTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): Voice Call Entry timer timeout event registered")); + break; + case EWlanNullTimer: + iPimpl->RegisterEvent( KNullTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): null timer timeout event registered")); + break; + case EWlanNoVoiceTimer: + iPimpl->RegisterEvent( KNoVoiceTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): No Voice timer timeout event registered")); + break; + case EWlanKeepAliveTimer: + iPimpl->RegisterEvent( KKeepAliveTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): Keep Alive timer timeout event registered")); + break; + case EWlanActiveToLightPsTimer: + iPimpl->RegisterEvent( KActiveToLightPsTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): Active to Light PS timer timeout event registered")); + break; + case EWlanLightPsToActiveTimer: + iPimpl->RegisterEvent( KLightPsToActiveTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): Light PS to Active timer timeout event registered")); + break; + case EWlanLightPsToDeepPsTimer: + iPimpl->RegisterEvent( KLightPsToDeepPsTimerTimeout ); + + OsTracePrint( KEventDispatcher, + (TUint8*)("UMAC: Umac::OnTimeout(): Light PS to Deep PS timer timeout event registered")); + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: unknown timer: %d"), aTimer ); + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { + // WHA layer not in use, proceed with the event handling immediately + + switch ( aTimer ) + { + case EWlanDefaultTimer: + iPimpl->CurrentState().OnTimeout( *iPimpl ); + break; + case EWlanVoiceCallEntryTimer: + iPimpl->CurrentState().OnVoiceCallEntryTimerTimeout( *iPimpl ); + break; + case EWlanNullTimer: + iPimpl->CurrentState().OnNullTimerTimeout( *iPimpl ); + break; + case EWlanNoVoiceTimer: + iPimpl->CurrentState().OnNoVoiceTimerTimeout( *iPimpl ); + break; + case EWlanKeepAliveTimer: + iPimpl->CurrentState().OnKeepAliveTimerTimeout( *iPimpl ); + break; + case EWlanActiveToLightPsTimer: + iPimpl->CurrentState().OnActiveToLightPsTimerTimeout( *iPimpl ); + break; + case EWlanLightPsToActiveTimer: + iPimpl->CurrentState().OnLightPsToActiveTimerTimeout( *iPimpl ); + break; + case EWlanLightPsToDeepPsTimer: + iPimpl->CurrentState().OnLightPsToDeepPsTimerTimeout( *iPimpl ); + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: unknown timer: %d"), aTimer ); + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::OnDfc( TAny* aCtx ) + { + if ( !(iPimpl->WsaCmdActive()) ) + { + // WHA layer NOT in use + // this is an implementation error as we only use dfc callback + // to break WHA command dispatching context, + // when we issue a synchronous command + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + + iPimpl->CurrentState().OnDfc( aCtx ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::CompleteManagementCommand( + TInt aReason, + const TAny* aData, + TUint32 aLengthInBytes ) + { + if ( iManagementRequestPending ) + { + // complete pending managemement request + iManagementRequestPending = EFalse; + iOidOutputData.iOidData = aData; + iOidOutputData.iLengthOfDataInBytes = aLengthInBytes; + OnOidCompleted( aReason, iOidOutputData ); + } + else + { + // no request pending so there's nothing to do + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::AttachWsa( WHA::Wha* aWha ) + { + OsTracePrint( KInitLevel, (TUint8*)("UMAC: Umac::AttachWsa(): 0x%08x"), + reinterpret_cast(aWha) ); + + // just forward to next layer + iPimpl->AttachWsa( aWha ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::Init() + { + OsTracePrint( KInitLevel, (TUint8*)("UMAC: Umac::Init()")); + + TBool ret( EFalse ); + + // deallocation of objecs allocated here is done in destructor + + iPimpl = static_cast + (os_alloc( sizeof(WlanContextImpl) )); + + if ( iPimpl ) + { + new (iPimpl) WlanContextImpl( *this ); + ret = iPimpl->Initialize(); + } + else + { + // failed + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: Umac::Init(): alloc internal impl failure -> abort")); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::BootUp( + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ) + { + OsTracePrint( KInitLevel, (TUint8*)("UMAC: * BootUp()")); + iManagementRequestPending = ETrue; + iPimpl->BootUp( aPda, aPdaLength, aFw, aFwLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::FinitSystem() + { + OsTracePrint( KInitLevel, (TUint8*)("UMAC: * FinitSystem()")); + iManagementRequestPending = ETrue; + iPimpl->CurrentState().FinitSystem( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const TMacAddress& Umac::StationId() const + { + return iPimpl->iWlanMib.dot11StationId; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::SetTxOffset() + { + iPimpl->CurrentState().SetProtocolStackTxOffset( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::TxProtocolStackData( + TDataBuffer& aDataBuffer, + TBool aMore ) + { + iPimpl->CurrentState().TxData( *iPimpl, aDataBuffer, aMore ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::GetFrameExtraSpaceForVendor( + TUint8& aRxOffset, + TUint8& aTxHeaderSpace, + TUint8& aTxTrailerSpace ) const + { + aRxOffset = iPimpl->WHASettings().iRxoffset; + aTxHeaderSpace = iPimpl->WHASettings().iTxFrameHeaderSpace; + aTxTrailerSpace = iPimpl->WHASettings().iTxFrameTrailerSpace; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::TxPermitted( TWhaTxQueueState& aTxQueueState ) const + { + return ( iPimpl->ProtocolStackTxDataAllowed() && + iPimpl->GetWhaTxStatus( aTxQueueState ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::UserDataTxEnabled() const + { + return ( iPimpl->ProtocolStackTxDataAllowed() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::WriteMgmtFrame(TDataBuffer& aDataBuffer) + { + iPimpl->CurrentState().TxMgmtData( *iPimpl, aDataBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void Umac::HandleOid( + const TOIDHeader* aOid, + TAny* aOutputBuffer, + TUint aOutputBufferSize ) + { + iManagementRequestPending = ETrue; + + iOidOutputData.iBufferSupplied = aOutputBuffer; + iOidOutputData.iLengthOfBufferSupplied = aOutputBufferSize; + iOidOutputData.iOidId = aOid->oid_id; + + if (// WHA layer in use + iPimpl->WsaCmdActive() + || // OR + // oid channel is disabled + !(iPimpl->ChannelEnabled( WlanEventDispatcher::KOidChannel )) ) + { + // ...defer access + iPimpl->RegisterEvent( *aOid ); + return; + } + + switch(aOid->oid_id) + { + case E802_11_CONFIGURE: + HandleConfigure( aOid ); + break; + case E802_11_CONNECT: + HandleConnect( aOid ); + break; + case E802_11_START_IBSS: + HandleStartIBSS(aOid); + break; + case E802_11_SCAN: + HandleScan( aOid ); + break; + case E802_11_STOP_SCAN: + HandleStopScan(); + break; + case E802_11_DISCONNECT: + HandleDisconnect(); + break; + case E802_11_SET_POWER_MODE: + HandleSetPowerMode(aOid); + break; + case E802_11_SET_RCPI_TRIGGER_LEVEL: + HandleSetRcpiTriggerLevel(aOid); + break; + case E802_11_SET_TX_POWER_LEVEL: + HandleSetTxPowerLevel(aOid); + break; + case E802_11_GET_LAST_RCPI: + HandleGetLastRcpi(); + break; + case E802_11_DISABLE_USER_DATA: + HandleDisableUserData(); + break; + case E802_11_ENABLE_USER_DATA: + HandleEnableUserData(); + break; + case E802_11_ADD_CIPHER_KEY: + HandleAddCipherKey(aOid); + break; + case E802_11_ADD_MULTICAST_ADDR: + HandleAddMulticastAddr(aOid); + break; + case E802_11_REMOVE_MULTICAST_ADDR: + HandleRemoveMulticastAddr(aOid); + break; + case E802_11_CONFIGURE_BSS_LOST: + HandleConfigureBssLost(aOid); + break; + case E802_11_SET_TX_RATE_ADAPT_PARAMS: + HandleSetTxRateAdaptParams(aOid); + break; + case E802_11_CONFIGURE_TX_RATE_POLICIES: + HandleConfigureTxRatePolicies(aOid); + break; + case E802_11_SET_POWER_MODE_MGMT_PARAMS: + HandleSetPowerModeMgmtParams(aOid); + break; + case E802_11_CONFIGURE_PWR_MODE_MGMT_TRAFFIC_OVERRIDE: + HandleConfigurePwrModeMgmtTrafficOverride(aOid); + break; + case E802_11_GET_FRAME_STATISTICS: + HandleGetFrameStatistics(); + break; + case E802_11_CONFIGURE_UAPSD: + HandleConfigureUapsd(aOid); + break; + case E802_11_CONFIGURE_TX_QUEUE: + HandleConfigureTxQueue(aOid); + break; + case E802_11_GET_MAC_ADDRESS: + HandleGetMacAddress(); + break; + case E802_11_CONFIGURE_ARP_IP_ADDRESS_FILTERING: + HandleConfigureArpIpAddressFiltering(aOid); + break; + case E802_11_CONFIGURE_HT_BLOCK_ACK: + HandleConfigureHtBlockAck(aOid); + break; + case E802_11_CONFIGURE_PROPRIETARY_SNAP_HDR: + HandleConfigureProprietarySnapHdr(aOid); + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: OID: 0x%08x"), aOid->oid_id ); + OsAssert((TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConnect(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*)("Umac::HandleConnect: WLM-E802_11_CONNECT") ); + + const TConnectMsg* msg + = static_cast(aInputBuffer); + +#ifndef NDEBUG + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: SSID:") ); + TUint8 ssidTraceBuf[KMaxSSIDLength + 1]; // + 1 for NULL termination + os_memset( ssidTraceBuf, 0, sizeof( ssidTraceBuf ) ); + os_memcpy( ssidTraceBuf, msg->SSID.ssid, msg->SSID.ssidLength ); + OsTracePrint( KWlmCmdDetails, ssidTraceBuf ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: BSSID:"), + msg->BSSID ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: auth algorithm nbr: %d"), + msg->authAlgorithmNbr ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: encryptionStatus: %d"), + msg->encryptionStatus ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: pairwiseCipher: %d"), + msg->pairwiseCipher ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: isInfra: %d"), + msg->isInfra ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: scanResponseFrameBody (pointer): 0x%08x"), + reinterpret_cast(msg->scanResponseFrameBody) ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: scanResponseFrameBodyLength: %d"), + msg->scanResponseFrameBodyLength ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: ieData (pointer): 0x%08x"), + reinterpret_cast(msg->ieData) ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: ieDataLength: %d"), + msg->ieDataLength ); + if ( msg->ieData ) + { + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: ieData data:"), + msg->ieData, msg->ieData + msg->ieDataLength ); + } + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: invalidatePairwiseKey (bool): %d"), + msg->invalidatePairwiseKey ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: invalidateGroupKey (bool): %d"), + msg->invalidateGroupKey ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConnect: radiomeasurement (bool): %d"), + msg->radioMeasurement ); +#endif // !NDEBUG + + // make sure that these are clear when starting the connect operation + // + iPimpl->SetScanResponseFrameBodyLength( 0 ); + iPimpl->SetScanResponseFrameBody( NULL ); + + // invalidate cipher keys per mgmt client instructions + + if ( msg->invalidatePairwiseKey ) + { + iPimpl->PairWiseKeyType( WHA::EKeyNone ); + } + if ( msg->invalidateGroupKey ) + { + iPimpl->GroupKeyType( WHA::EKeyNone ); + } + + iPimpl->PairwiseCipher( msg->pairwiseCipher ); + + //Set Radio Measurement setting for later use + iPimpl->RadioMeasurement( msg->radioMeasurement ); + + return iPimpl->CurrentState().Connect( + *iPimpl, + msg->SSID, + msg->BSSID, + msg->authAlgorithmNbr, + msg->encryptionStatus, + msg->isInfra, + msg->scanResponseFrameBodyLength, + msg->scanResponseFrameBody, + msg->ieData, + msg->ieDataLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleStartIBSS(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleStartIBSS(): WLM-E802_11_START_IBSS") ); + + const TStartIBSSMsg* msg + = static_cast(aInputBuffer); + + return iPimpl->CurrentState().StartIBSS( + *iPimpl, + msg->SSID, + msg->beaconInterval, + msg->ATIM, + msg->channel, + msg->encryptionStatus ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleDisconnect() + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleDisconnect(): WLM-E802_11_DISCONNECT") ); + + return iPimpl->CurrentState().Disconnect( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleSetPowerMode(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: WLM-E802_11_SET_POWER_MODE") ); + + const TSetPowerModeMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: powerMode (0=CAM, 1=PS): %d"), + msg->powerMode ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: disableDynamicPowerModeManagement: %d"), + msg->disableDynamicPowerModeManagement ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: wakeupModeInLightPs (0=all Beacons, 1=all DTims, 2=Nth beacon, 3=Nth Dtim): %d"), + msg->wakeupModeInLightPs ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: listenIntervalInLightPs: %d"), + msg->listenIntervalInLightPs ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: wakeupModeInDeepPs (0=all Beacons, 1=all DTims, 2=Nth beacon, 3=Nth Dtim): %d"), + msg->wakeupModeInDeepPs ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerMode: listenIntervalInDeepPs: %d"), + msg->listenIntervalInDeepPs ); + + return iPimpl->CurrentState().SetPowerMode( + *iPimpl, + msg->powerMode, + msg->disableDynamicPowerModeManagement, + msg->wakeupModeInLightPs, + msg->listenIntervalInLightPs, + msg->wakeupModeInDeepPs, + msg->listenIntervalInDeepPs ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleSetRcpiTriggerLevel(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleSetRcpiTriggerLevel: WLM-E802_11_SET_RCPI_TRIGGER_LEVEL") ); + + const TSetRcpiTriggerLevelMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetRcpiTriggerLevel: RcpiTrigger: %d"), + msg->RcpiTrigger ); + + return iPimpl->CurrentState().SetRcpiTriggerLevel( + *iPimpl, + msg->RcpiTrigger ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleSetTxPowerLevel(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleSetTxPowerLevel: WLM-E802_11_SET_TX_POWER_LEVEL") ); + + const TSetTxPowerLevelMsg* msg + = static_cast(aInputBuffer); + + return iPimpl->CurrentState().SetTxPowerLevel( + *iPimpl, + msg->level ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigure(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleConfigure(): WLM-E802_11_CONFIGURE") ); + + const TConfigureMsg* msg = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: RTSThreshold: %d"), + msg->RTSThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: maxTxMSDULifetime: %d"), + msg->maxTxMSDULifetime ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: voiceCallEntryTimeout: %d"), + msg->voiceCallEntryTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: voiceCallEntryTxThreshold: %d"), + msg->voiceCallEntryTxThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: voiceNullTimeout: %d"), + msg->voiceNullTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: noVoiceTimeout: %d"), + msg->noVoiceTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: keepAliveTimeout: %d"), + msg->keepAliveTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: spRcpiIndicationLevel: %d"), + msg->spRcpiIndicationLevel ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: spTimeToCountPrediction: %d"), + msg->spTimeToCountPrediction ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigure: spMinIndicationInterval: %d"), + msg->spMinIndicationInterval ); + + return iPimpl->CurrentState().Configure( + *iPimpl, + msg->RTSThreshold, + msg->maxTxMSDULifetime, + msg->voiceCallEntryTimeout, + msg->voiceCallEntryTxThreshold, + msg->voiceNullTimeout, + msg->noVoiceTimeout, + msg->keepAliveTimeout, + msg->spRcpiIndicationLevel, + msg->spTimeToCountPrediction, + msg->spMinIndicationInterval ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleScan( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleScan: WLM-E802_11_SCAN") ); + + TScanMsg* msg + = static_cast(const_cast(aInputBuffer)); + +#ifndef NDEBUG + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleScan: mode: %d (0: active, 1: passive)"), + msg->mode ); + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleScan: SSID length: %d"), + msg->SSID.ssidLength ); + + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleScan: SSID:") ); + TUint8 ssidTraceBuf[KMaxSSIDLength + 1]; // + 1 for NULL termination + os_memset( ssidTraceBuf, 0, sizeof( ssidTraceBuf ) ); + os_memcpy( ssidTraceBuf, msg->SSID.ssid, msg->SSID.ssidLength ); + OsTracePrint( KWlmCmdDetails, ssidTraceBuf ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleScan: scanRate: %d"), + msg->scanRate ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleScan: minChannelTime: %d"), + msg->minChannelTime ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleScan: maxChannelTime: %d"), + msg->maxChannelTime ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleScan: splitScan: %d"), + msg->splitScan ); +#endif // !NDEBUG + + return iPimpl->CurrentState().Scan( + *iPimpl, + msg->mode, + msg->SSID, + msg->scanRate, + msg->channels, + msg->minChannelTime, + msg->maxChannelTime, + msg->splitScan ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleStopScan() + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleStopScan: WLM-E802_11_STOP_SCAN") ); + + return iPimpl->CurrentState().StopScan( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleGetLastRcpi() + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleGetLastRcpi: WLM-E802_11_GET_LAST_RCPI") ); + + return iPimpl->CurrentState().GetLastRcpi( + *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleDisableUserData() + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleDisableUserData: WLM-E802_11_DISABLE_USER_DATA") ); + + return iPimpl->CurrentState().DisableUserData( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleEnableUserData() + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleEnableUserData: WLM-E802_11_ENABLE_USER_DATA") ); + + return iPimpl->CurrentState().EnableUserData( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleAddCipherKey(const TAny *aInputBuffer) + { + TBool ret( EFalse ); + + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleAddCipherKey: WLM-E802_11_ADD_CIPHER_KEY") ); + + const TAddCipherKeyMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): cipherSuite: %d"), msg->cipherSuite ); + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): keyIndex: %d"), msg->keyIndex ); + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): length: %d"), msg->length ); + + for(TUint8 i = 0; i < msg->length; i++ ) + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): key data: 0x%02x"), + msg->data[i] ); + } + + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): macAddress:"), msg->macAddress ); + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): useAsDefaultKey: %d"), + (msg->useAsDefaultKey)? 1 : 0 ); + + switch( msg->cipherSuite ) + { + case EWlanCipherSuiteTkip: + if ( msg->macAddress == KBroadcastMacAddr ) + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add multicast TKIP key") ); + + ret = iPimpl->CurrentState().AddMulticastTKIPKey( + *iPimpl, + static_cast(msg->keyIndex), + msg->length, + msg->data ); + } + else + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add pairwise TKIP key") ); + ret = iPimpl->CurrentState().AddTkIPKey( + *iPimpl, + msg->data, + msg->length, + static_cast(msg->keyIndex), + msg->macAddress ); + } + break; + case EWlanCipherSuiteCcmp: + if ( msg->macAddress == KBroadcastMacAddr ) + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add multicast AES key") ); + + ret = iPimpl->CurrentState().AddMulticastAesKey( + *iPimpl, + static_cast(msg->keyIndex), + msg->length, + msg->data ); + } + else + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add pairwise AES key") ); + ret = iPimpl->CurrentState().AddAesKey( + *iPimpl, + msg->data, + msg->length, + msg->macAddress ); + } + break; + case EWlanCipherSuiteWep: + if ( msg->macAddress == KBroadcastMacAddr ) + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add broadcast wep key") ); + ret = iPimpl->CurrentState().AddBroadcastWepKey( + *iPimpl, + msg->keyIndex, + msg->useAsDefaultKey, + msg->length, + msg->data, + msg->macAddress ); + } + else + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add unicast wep key") ); + ret = iPimpl->CurrentState().AddUnicastWepKey( + *iPimpl, + msg->macAddress, + msg->length, + msg->data ); + } + break; + case EWlanCipherSuiteWapi: + if ( msg->macAddress == KBroadcastMacAddr ) + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add multicast wapi key") ); + ret = iPimpl->CurrentState().AddMulticastWapiKey( + *iPimpl, + static_cast(msg->keyIndex), + msg->length, + msg->data ); + } + else + { + OsTracePrint( KWlmCmdDetails, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): add pairwise wapi key") ); + ret = iPimpl->CurrentState().AddUnicastWapiKey( + *iPimpl, + msg->data, + msg->length, + static_cast(msg->keyIndex), + msg->macAddress ); + } + break; + default: + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): cipherSuite: %d"), + msg->cipherSuite ); + OsAssert( + (TUint8*)("UMAC: Umac::HandleAddCipherKey(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleAddMulticastAddr(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleAddMulticastAddr(): WLM-E802_11_ADD_MULTICAST_ADDR") ); + + const TAddMulticastAddrMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleAddMulticastAddr(): macAddress:"), + msg->macAddress ); + + return iPimpl->CurrentState().AddMulticastAddr( + *iPimpl, + msg->macAddress ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleRemoveMulticastAddr(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleRemoveMulticastAddr(): WLM-E802_11_REMOVE_MULTICAST_ADDR") ); + + const TRemoveMulticastAddrMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleRemoveMulticastAddr(): removeAll: %d"), + msg->removeAll ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleRemoveMulticastAddr(): macAddress:"), + msg->macAddress ); + + return iPimpl->CurrentState().RemoveMulticastAddr( + *iPimpl, + msg->removeAll, + msg->macAddress ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureBssLost(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigureBssLost(): WLM-E802_11_CONFIGURE_BSS_LOST") ); + + const TConfigureBssLostMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureBssLost: beaconLostCount: %d"), + msg->beaconLostCount ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureBssLost: failedTxPacketCount: %d"), + msg->failedTxPacketCount ); + + return iPimpl->CurrentState().ConfigureBssLost( + *iPimpl, + msg->beaconLostCount, + msg->failedTxPacketCount ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleSetTxRateAdaptParams(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: WLM-E802_11_SET_TX_RATE_ADAPT_PARAMS") ); + + const TSetTxRateAdaptationParamsMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: minStepUpCheckpoint: %d"), + msg->minStepUpCheckpoint ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: maxStepUpCheckpoint: %d"), + msg->maxStepUpCheckpoint ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: stepUpCheckpointFactor: %d"), + msg->stepUpCheckpointFactor ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: stepDownCheckpoint: %d"), + msg->stepDownCheckpoint ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: minStepUpThreshold: %d"), + msg->minStepUpThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: maxStepUpThreshold: %d"), + msg->maxStepUpThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: stepUpThresholdIncrement: %d"), + msg->stepUpThresholdIncrement ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: stepDownThreshold: %d"), + msg->stepDownThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetTxRateAdaptParams: disableProbeHandling: %d"), + msg->disableProbeHandling ); + + return iPimpl->CurrentState().SetTxRateAdaptParams( + *iPimpl, + msg->minStepUpCheckpoint, + msg->maxStepUpCheckpoint, + msg->stepUpCheckpointFactor, + msg->stepDownCheckpoint, + msg->minStepUpThreshold, + msg->maxStepUpThreshold, + msg->stepUpThresholdIncrement, + msg->stepDownThreshold, + msg->disableProbeHandling ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureTxRatePolicies( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: WLM-E802_11_CONFIGURE_TX_RATE_POLICIES") ); + + const TConfigureTxRatePoliciesMsg* msg + = static_cast(aInputBuffer); + +#ifndef NDEBUG + + // trace the rate policy objects + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: numOfPolicyObjects: %d"), + msg->ratePolicy.numOfPolicyObjects ); + + for ( TUint i = 0; i < msg->ratePolicy.numOfPolicyObjects; ++i ) + { + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: Tx policy object ind: %d; values:"), + i ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 54 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy54 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 48 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy48 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 36 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy36 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 33 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy33 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 24 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy24 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 22 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy22 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 18 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy18 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 12 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy12 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 11 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy11 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 9 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy9 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 6 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy6 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 5.5 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy5_5 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 2 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy2 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: 1 Mbps: %d"), + msg->ratePolicy.txRateClass[i].txPolicy1 ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: shortRetryLimit: %d"), + msg->ratePolicy.txRateClass[i].shortRetryLimit ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: longRetryLimit: %d"), + msg->ratePolicy.txRateClass[i].longRetryLimit ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: flags: %d"), + msg->ratePolicy.txRateClass[i].flags ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: autoRatePolicy: 0x%08x"), + msg->autoRatePolicy[i] ); + } + + // trace rate policy object to use for every Tx queue + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: Rate policy object to use for a Tx queue:") ); + + for ( TUint j = 0; j < EQueueIdMax; ++j ) + { + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: Queue id: %d"), + j ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: rate policy object ind: %d"), + msg->queue2RateClass[j] ); + } + + // trace initial max Tx rate to use for every rate policy object + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: initial max Tx rate to use for a policy object:") ); + + for ( TUint k = 0; k < msg->ratePolicy.numOfPolicyObjects; ++k ) + { + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: policy object ind: %d"), + k ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: initial max Tx rate: 0x%08x"), + msg->initialMaxTxRate4RateClass[k] ); + } + + for ( TUint m = 0; m < msg->ratePolicy.numOfPolicyObjects; ++m ) + { + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxRatePolicies: mcs set ind: %d"), + m ); + + for ( TUint mcsBucket = 0; mcsBucket < KHtMcsSetLength; ++mcsBucket ) + { + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: 0x%02x"), + msg->htMcsPolicy[m][mcsBucket] ); + } + } + +#endif + + return iPimpl->CurrentState().ConfigureTxRatePolicies( + *iPimpl, + msg->ratePolicy, + msg->queue2RateClass, + msg->initialMaxTxRate4RateClass, + msg->autoRatePolicy, + msg->htMcsPolicy ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleSetPowerModeMgmtParams(const TAny *aInputBuffer) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams(): WLM-E802_11_SET_POWER_MODE_MGMT_PARAMS") ); + + const TSetPowerModeMgmtParamsMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: toLightPsTimeout: %d"), + msg->toLightPsTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: toLightPsFrameThreshold: %d"), + msg->toLightPsFrameThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: toActiveTimeout: %d"), + msg->toActiveTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: toActiveFrameThreshold: %d"), + msg->toActiveFrameThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: toDeepPsTimeout: %d"), + msg->toDeepPsTimeout ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: toDeepPsFrameThreshold: %d"), + msg->toDeepPsFrameThreshold ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: uapsdRxFrameLengthThreshold: %d"), + msg->uapsdRxFrameLengthThreshold ); + + return iPimpl->CurrentState().SetPowerModeManagementParameters( + *iPimpl, + msg->toLightPsTimeout, + msg->toLightPsFrameThreshold, + msg->toActiveTimeout, + msg->toActiveFrameThreshold, + msg->toDeepPsTimeout, + msg->toDeepPsFrameThreshold, + msg->uapsdRxFrameLengthThreshold ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigurePwrModeMgmtTrafficOverride( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: WLM-E802_11_CONFIGURE_PWR_MODE_MGMT_TRAFFIC_OVERRIDE") ); + + const TConfigurePwrModeMgmtTrafficOverrideMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteUapsdVoiceTraffic: %d"), + msg->stayInPsDespiteUapsdVoiceTraffic ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteUapsdVideoTraffic: %d"), + msg->stayInPsDespiteUapsdVideoTraffic ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteUapsdBestEffortTraffic: %d"), + msg->stayInPsDespiteUapsdBestEffortTraffic ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteUapsdBackgroundTraffic: %d"), + msg->stayInPsDespiteUapsdBackgroundTraffic ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteLegacyVoiceTraffic: %d"), + msg->stayInPsDespiteLegacyVoiceTraffic ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteLegacyVideoTraffic: %d"), + msg->stayInPsDespiteLegacyVideoTraffic ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteLegacyBestEffortTraffic: %d"), + msg->stayInPsDespiteLegacyBestEffortTraffic ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigurePwrModeMgmtTrafficOverride: stayInPsDespiteLegacyBackgroundTraffic: %d"), + msg->stayInPsDespiteLegacyBackgroundTraffic ); + + return iPimpl->CurrentState().ConfigurePwrModeMgmtTrafficOverride( + *iPimpl, + msg->stayInPsDespiteUapsdVoiceTraffic, + msg->stayInPsDespiteUapsdVideoTraffic, + msg->stayInPsDespiteUapsdBestEffortTraffic, + msg->stayInPsDespiteUapsdBackgroundTraffic, + msg->stayInPsDespiteLegacyVoiceTraffic, + msg->stayInPsDespiteLegacyVideoTraffic, + msg->stayInPsDespiteLegacyBestEffortTraffic, + msg->stayInPsDespiteLegacyBackgroundTraffic ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleGetFrameStatistics() + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: WLM-E802_11_GET_FRAME_STATISTICS") ); + + return iPimpl->CurrentState().GetFrameStatistics( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureUapsd( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleSetPowerModeMgmtParams: WLM-E802_11_CONFIGURE_UAPSD") ); + + const TConfigureUapsdMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureUapsd: maxServicePeriodLength: 0x%02x (0x00: all, 0x20: 2, 0x40: 4, 0x60: 6"), + msg->maxServicePeriodLength ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureUapsd: uapsdForVoice: %d"), + msg->uapsdForVoice ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureUapsd: uapsdForVideo: %d"), + msg->uapsdForVideo ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureUapsd: uapsdForBestEffort: %d"), + msg->uapsdForBestEffort ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureUapsd: uapsdForBackground: %d"), + msg->uapsdForBackground ); + + return iPimpl->CurrentState().ConfigureUapsd( + *iPimpl, + msg->maxServicePeriodLength, + msg->uapsdForVoice, + msg->uapsdForVideo, + msg->uapsdForBestEffort, + msg->uapsdForBackground ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureTxQueue( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigureTxQueue: WLM-E802_11_CONFIGURE_TX_QUEUE") ); + + const TConfigureTxQueueMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxQueue: queueId: %d"), + msg->queueId ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxQueue: mediumTime: %d"), + msg->mediumTime ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureTxQueue: maxTxMSDULifetime: %d"), + msg->maxTxMSDULifetime ); + + return iPimpl->CurrentState().ConfigureTxQueueIfNecessary( + *iPimpl, + msg->queueId, + msg->mediumTime, + msg->maxTxMSDULifetime ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleGetMacAddress() + { + OsTracePrint( KWlmCmd, + (TUint8*)("UMAC: Umac::HandleGetMacAddress: WLM-E802_11_GET_MAC_ADDRESS") ); + + return iPimpl->CurrentState().GetMacAddress( *iPimpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureArpIpAddressFiltering( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigureArpIpAddressFiltering: WLM-E802_11_CONFIGURE_ARP_IP_ADDRESS_FILTERING") ); + + const TConfigureArpIpAddressFilteringMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureArpIpAddressFiltering: enableFiltering: %d"), + msg->enableFiltering ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureArpIpAddressFiltering: ipV4Addr: 0x%08x"), + msg->ipV4Addr ); + + return iPimpl->CurrentState().ConfigureArpIpAddressFiltering( + *iPimpl, + msg->enableFiltering, + msg->ipV4Addr ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureHtBlockAck( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigureHtBlockAck: WLM-E802_11_CONFIGURE_HT_BLOCK_ACK") ); + + const TConfigureHtBlockAckMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureHtBlockAck: iTxBlockAckUsage: 0x%02x"), + msg->iTxBlockAckUsage ); + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: Umac::HandleConfigureHtBlockAck: iRxBlockAckUsage: 0x%02x"), + msg->iRxBlockAckUsage ); + + return iPimpl->CurrentState().ConfigureHtBlockAck( + *iPimpl, + msg->iTxBlockAckUsage, + msg->iRxBlockAckUsage ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::HandleConfigureProprietarySnapHdr( const TAny *aInputBuffer ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: Umac::HandleConfigureProprietarySnapHdr: WLM-E802_11_CONFIGURE_PROPRIETARY_SNAP_HDR") ); + + const TConfigureProprietarySnapHdrMsg* msg + = static_cast(aInputBuffer); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("Umac::HandleConfigureProprietarySnapHdr: snapHdr:"), + reinterpret_cast(&(msg->snapHdr)), + reinterpret_cast(&(msg->snapHdr)) + + sizeof( TSnapHeader ) ); + + return iPimpl->CurrentState().ConfigureProprietarySnapHdr( + *iPimpl, + msg->snapHdr ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::OnWhaCommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ) + { + return iPimpl->OnDeferredWhaCommandComplete( + aCompleteCommandId, + aStatus, + aCommandCompletionParams ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool Umac::OnInternalEvent( TInternalEvent aInternalEvent ) + { + return iPimpl->OnDeferredInternalEvent( aInternalEvent ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacContextImpl.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1876 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanContextImpl class +* +*/ + +/* +* %version: 70 % +*/ + +#include "config.h" +#include "UmacContextImpl.h" +#include "umacconnectcontext.h" +#include "UmacWsaInitiliaze.h" +#include "UmacWsaConfigure.h" +#include "UmacWsaReadMib.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaJoin.h" +#include "UmacWsaDisconnect.h" +#include "UmacWsaScan.h" +#include "umacwhastopscan.h" +#include "UmacWsaSetBssParameters.h" +#include "UmacWsaAddKey.h" +#include "UmacWsaSetPsMode.h" +#include "umacwhaconfigurequeue.h" +#include "umacwhaconfigureac.h" +#include "umacwharelease.h" + +#include "umacaddbroadcastwepkey.h" +#include "umacconfiguretxqueueparams.h" +#include "umacconfiguretxautoratepolicy.h" + + +struct SWsaCommands + { + WlanConfigureTxQueueParams iConfigureTxQueueParams; + WlanAddBroadcastWepKey iAddBroadcastWepKey; + WlanConfigureTxAutoRatePolicy iConfigureTxAutoRatePolicy; + WlanWsaInitiliaze iWsaInitiliaze; + WlanWsaConfigure iWsaConfigure; + WlanWsaReadMib iWsaReadMib; + WlanWsaWriteMib iWsaWriteMib; + WlanWsaJoin iWsaJoin; + WlanWsaDisconnect iWsaDisconnect; + WlanWsaScan iWsaScan; + WlanWhaStopScan iWhaStopScan; + WlanWsaSetBssParameters iWsaSetBssParameters; + WlanWsaAddKey iWsaAddKey; + WlanWsaSetPsMode iWsaSetPsMode; + WlanWhaConfigureQueue iWhaConfigureQueue; + WlanWhaConfigureAc iWhaConfigureAc; + WlanWhaRelease iWlanWhaRelease; + }; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanContextImpl::WlanContextImpl( Umac& aUmac ) : + iCurrentMacState( NULL ), + iUmac( aUmac ), + iEnableUserData( EFalse ), + iCurrentRxBuffer( NULL ), + iInternalTxBufFree ( ETrue ), + iInternalTxBufBeingWaited ( EFalse ), + iAlignNullData( 0 ), + iAlignQosNullData( 0 ), + iConsecutiveBeaconsLostIndicated ( EFalse ), + iConsecutiveTxFailuresIndicated ( EFalse ), + iConsecutivePwrModeSetFailuresIndicated ( EFalse ), + iFailedTxPacketCount ( 0 ), + iWsaCmdActive( EFalse ), + iWhaCommandAct( 0 ), + iWha( NULL ), + iWsaCommands( NULL ), + iEventDispatcher( aUmac ), + iPacketScheduler( *this ), + iDynamicPowerModeCntx ( *this ), + iNullSendController( *this, *this ), + iProprietarySnapHeader( KUndefinedSnapHeader ) + { + OsTracePrint( KInitLevel, + (TUint8*)("UMAC: WlanContextImpl::WlanContextImpl(): this: 0x%08x"), + reinterpret_cast(this) ); + + os_memset( + iSupportedRatesLookUpTable, + 0, + sizeof( iSupportedRatesLookUpTable ) ); + + os_memset( &iWHASettings, 0, sizeof( iWHASettings ) ); + + os_memset( + &iOurBssMembershipFeatureArray, + KUnallocated, + sizeof( iOurBssMembershipFeatureArray ) ); + + os_memset( + &iHtBlockAckConfigure, + 0, + sizeof( iHtBlockAckConfigure ) ); + + ResetFrameStatistics(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::BootUp( + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ) + { + // boot the system up + OsTracePrint( KInitLevel, (TUint8*)("UMAC: WlanContextImpl::BootUp")); + + iStates.iInitPhase1State.BootUp( *this, aPda, aPdaLength, aFw, aFwLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanAddBroadcastWepKey& WlanContextImpl::AddBroadcastWepKey() + { + return iWsaCommands->iAddBroadcastWepKey; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanConfigureTxQueueParams& WlanContextImpl::ConfigureTxQueueParams() + { + return iWsaCommands->iConfigureTxQueueParams; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanConfigureTxAutoRatePolicy& WlanContextImpl::ConfigureTxAutoRatePolicy() + { + return iWsaCommands->iConfigureTxAutoRatePolicy; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaInitiliaze& WlanContextImpl::WsaInitiliaze() + { + return iWsaCommands->iWsaInitiliaze; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaConfigure& WlanContextImpl::WsaConfigure() + { + return iWsaCommands->iWsaConfigure; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaReadMib& WlanContextImpl::WsaReadMib() + { + return iWsaCommands->iWsaReadMib; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaWriteMib& WlanContextImpl::WsaWriteMib() + { + return iWsaCommands->iWsaWriteMib; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaJoin& WlanContextImpl::WsaJoin() + { + return iWsaCommands->iWsaJoin; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaDisconnect& WlanContextImpl::WsaDisconnect() + { + return iWsaCommands->iWsaDisconnect; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaSetBssParameters& WlanContextImpl::WsaSetBssParameters() + { + return iWsaCommands->iWsaSetBssParameters; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaScan& WlanContextImpl::WsaScan() + { + return iWsaCommands->iWsaScan; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWhaStopScan& WlanContextImpl::WhaStopScan() + { + return iWsaCommands->iWhaStopScan; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaAddKey& WlanContextImpl::WsaAddKey() + { + return iWsaCommands->iWsaAddKey; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaSetPsMode& WlanContextImpl::WsaSetPsMode() + { + return iWsaCommands->iWsaSetPsMode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWhaConfigureQueue& WlanContextImpl::WhaConfigureQueue() + { + return iWsaCommands->iWhaConfigureQueue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWhaConfigureAc& WlanContextImpl::WhaConfigureAc() + { + return iWsaCommands->iWhaConfigureAc; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWhaRelease& WlanContextImpl::WlanWhaRelease() + { + return iWsaCommands->iWlanWhaRelease; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanContextImpl::Initialize() + { + // deallocation of objecs allocated here is done in destructor + + iStates.iIdleScanningMode.Set( *this ); + iStates.iIbssScanningMode.Set( *this ); + iStates.iInfrastructureScanningMode.Set( *this ); + + iCurrentMacState = &(iStates.iInitPhase1State); + + OsTracePrint( KInitLevel, (TUint8*)("UMAC: WlanContextImpl::Initialize: alloc WSA commands; size: %d"), sizeof(SWsaCommands)); + + iWsaCommands + = static_cast(os_alloc( sizeof(SWsaCommands) )); + if ( !iWsaCommands ) + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: WlanContextImpl::Initialize: alloc WSA commands failure -> abort")); + return EFalse; + } + + new (iWsaCommands) SWsaCommands; + + // made it + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanContextImpl::~WlanContextImpl() + { + OsTracePrint( KInitLevel, + (TUint8*)("UMAC: WlanContextImpl::~WlanContextImpl")); + +#ifndef RD_WLAN_DDK + delete iWha; +#endif + iWha = NULL; + + if ( iWsaCommands ) + { + iWsaCommands->~SWsaCommands(); + os_free( iWsaCommands ); + iWsaCommands = NULL; + } + + iCurrentMacState = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::MakeLookUpTable() + { + // make bit rate lookup table + + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC * construct dot11 rate to WHA rate lookup table")); + + TUint index(0); + + if ( iWHASettings.iRates & WHA::KRate1Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate1MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate1Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate2Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate2MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate2Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate5_5Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate5p5MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate5_5Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate6Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate6MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate6Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate9Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate9MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate9Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate11Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate11MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate11Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate12Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate12MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate12Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate18Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate18MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate18Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate22Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate22MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate22Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate24Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate24MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate24Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate33Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate33MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate33Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate36Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate36MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate36Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate48Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate48MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate48Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + if ( iWHASettings.iRates & WHA::KRate54Mbits ) + { + iSupportedRatesLookUpTable[index].iSupportedRate = E802Dot11Rate54MBit; + iSupportedRatesLookUpTable[index].iWsaRate = WHA::KRate54Mbits; + + OsTracePrint( KUmacDetails, (TUint8*)("current index: %d"), index); + OsTracePrint( KUmacDetails, (TUint8*)("dot11 rate added: 0x%02x"), + iSupportedRatesLookUpTable[index].iSupportedRate); + OsTracePrint( KUmacDetails, (TUint8*)("WHA rate added: 0x%08x"), + iSupportedRatesLookUpTable[index].iWsaRate); + + ++index; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::AttachWsa( WHA::Wha* aWha ) + { + iWha = aWha; + + OsTracePrint( KInitLevel, + (TUint8*)("UMAC: WlanContextImpl::AttachWsa: address: 0x%08x"), + reinterpret_cast(iWha) ); + OsTracePrint( KInitLevel, (TUint8*)("UMAC: WHA-CMD-Attach")); + // attach the NWSA-callback + iWha->Attach( *this ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::CommandResponse( + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCallback, + (TUint8*)("UMAC * WHA-CB-CommandResponse()")); + + iCurrentMacState->CommandResponse( + *this, + aCommandId, + aStatus, + aCommandResponseParams ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanContextImpl::OnDeferredWhaCommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ) + { + if ( WsaCmdActive() ) + { + // programming error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return iCurrentMacState->CommandComplete( + *this, + aCompleteCommandId, + aStatus, + aCommandCompletionParams ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanContextImpl::OnDeferredInternalEvent( TInternalEvent aInternalEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanContextImpl::OnDeferredInternalEvent()")); + + TBool stateChanged ( EFalse ); + + if ( WsaCmdActive() ) + { + // programming error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + switch ( aInternalEvent ) + { + case KAcParamUpdate: + stateChanged = iCurrentMacState->ConfigureAcParams( *this ); + break; + case KPowerMgmtTransition: + stateChanged = iCurrentMacState->ChangePowerMgmtMode( *this ); + break; + case KTimeout: + stateChanged = iCurrentMacState->OnTimeout( *this ); + break; + case KVoiceCallEntryTimerTimeout: + stateChanged = iCurrentMacState->OnVoiceCallEntryTimerTimeout( + *this ); + break; + case KNullTimerTimeout: + stateChanged = iCurrentMacState->OnNullTimerTimeout( *this ); + break; + case KNoVoiceTimerTimeout: + stateChanged = iCurrentMacState->OnNoVoiceTimerTimeout( *this ); + break; + case KKeepAliveTimerTimeout: + stateChanged = iCurrentMacState->OnKeepAliveTimerTimeout( *this ); + break; + case KActiveToLightPsTimerTimeout: + stateChanged = iCurrentMacState->OnActiveToLightPsTimerTimeout( + *this ); + break; + case KLightPsToActiveTimerTimeout: + stateChanged = iCurrentMacState->OnLightPsToActiveTimerTimeout( + *this ); + break; + case KLightPsToDeepPsTimerTimeout: + stateChanged = iCurrentMacState->OnLightPsToDeepPsTimerTimeout( + *this ); + break; + case KSetCtsToSelf: + stateChanged = iCurrentMacState->SetCtsToSelfMib( *this ); + break; + case KSetRcpiTriggerLevel: + stateChanged = iCurrentMacState->SetRcpiTriggerLevelMib( + *this, + WHA::KRcpiThresholdDefault, + EFalse ); + break; + case KSetHtBssOperation: + stateChanged = iCurrentMacState->ConfigureHtBssOperation( *this ); + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aInternalEvent: %d"), aInternalEvent ); + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); + } + return stateChanged; + } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::CommandComplete( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ) + { + OsTracePrint( KWsaCallback, + (TUint8*)("UMAC: WHA-CB-CommandComplete: aStatus: %d"), + aStatus ); + + if ( !WsaCmdActive() ) + { + iCurrentMacState->CommandComplete( + *this, + aCompleteCommandId, + aStatus, + aCommandCompletionParams ); + } + else + { + // WHA command is in progress so we must defer this access + iEventDispatcher.Register( + aCompleteCommandId, + aStatus, + aCommandCompletionParams ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::Indication( + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ) + { + OsTracePrint( KWsaCallback, + (TUint8*)("UMAC: WHA-CB-Indication: indication: %d"), aIndicationId); + + iCurrentMacState->Indication( + *this, + aIndicationId, + aIndicationParams ); + } + +// Frame sending callbacks + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::SendPacketTransfer( + WHA::TPacketId aPacketId ) + { +#ifndef NDEBUG + OsTracePrint( KWsaCallback | KWsaTx, + (TUint8*)("UMAC: WHA-CB-SendPacketTransfer: aPacketId: 0x%08x"), + aPacketId ); +#endif // !NDEBUG + + iPacketScheduler.SendPacketTransfer( *this, aPacketId ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::SendPacketComplete( + WHA::TStatus aStatus, + WHA::TPacketId aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint8 aAckFailures, + TUint16 aSequenceNumber ) + { +#ifndef NDEBUG + OsTracePrint( KWsaCallback | KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aStatus: %d"), + aStatus ); + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aPacketId: 0x%08x"), + aPacketId ); + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aRate: 0x%08x"), + aRate ); + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aPacketQueueDelay: %d"), + aPacketQueueDelay ); + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aMediaDelay: %d"), + aMediaDelay ); + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aAckFailures: %d"), + aAckFailures ); + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WHA-CB-SendPacketComplete: aSequenceNumber: %d"), + aSequenceNumber ); +#endif // !NDEBUG + + iPacketScheduler.SendPacketComplete( + *this, + aStatus, + aPacketId, + aRate, + aPacketQueueDelay, + aMediaDelay, + aAckFailures ); + } + +// Frame receive + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* WlanContextImpl::RequestForBuffer( + TUint16 aLength ) + { +#ifndef NDEBUG + OsTracePrint( KWsaCallback, + (TUint8*)("UMAC: WHA-CB-RequestForBuffer: aLength: %d"), aLength); +#endif // !NDEBUG + + TAny* buffer = iCurrentMacState->RequestForBuffer( *this, aLength ); + + return buffer; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::ReceivePacket( + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + void* aBuffer, + TUint32 aFlags ) + { +#ifndef NDEBUG + OsTracePrint( KWsaCallback | KRxFrame, (TUint8*) + ("UMAC: WHA-CB-ReceivePacket(): aStatus: %d"), aStatus); + OsTracePrint( KWsaCallback | KRxFrame, (TUint8*) + ("UMAC: aLength: %d"), aLength); + OsTracePrint( KWsaCallback | KRxFrame, (TUint8*) + ("UMAC: aBuffer: 0x%08x"), reinterpret_cast(aBuffer) ); + OsTracePrint( KWsaCallback | KRxFrame, (TUint8*) + ("UMAC: aFlags: 0x%08x"), aFlags ); + + if ( aFrame ) + { + SDataMpduHeader* hdr + = reinterpret_cast(const_cast(aFrame)); + + OsTracePrint( KRxFrame, + (TUint8*)("UMAC: WlanContextImpl::ReceivePacket: sequence nbr: %d"), + hdr->iHdr.SequenceNumber() ); + OsTracePrint( KRxFrame, + (TUint8*)("UMAC: WlanContextImpl::ReceivePacket: sequence nbr: 0x%04x"), + hdr->iHdr.SequenceNumber() ); + } +#endif // !NDEBUG + + if ( !(WHASettings().iCapability & WHA::SSettings::KMultipleRxBuffers ) ) + { + aBuffer = iCurrentRxBuffer; + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: single Rx buf mode; aBuffer set to: 0x%08x"), + reinterpret_cast(aBuffer) ); + } + +#ifndef NDEBUG + if ( !aBuffer ) + { + // the Rx buffer pointer is NULL. Irrespective of the mode (single or + // multiple Rx buffers) this is a sign of an implementation error in + // the lower layers + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: Rx buf pointer is NULL") ); + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } +#endif // !NDEBUG + + iCurrentMacState->ReceivePacket( + *this, + aStatus, + aFrame, + aLength, + aRate, + aRcpi, + aChannel, + reinterpret_cast(aBuffer), + aFlags ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanContextImpl::TxNullDataFrame( + WlanContextImpl& aCtxImpl, + TBool aQosNull ) + { + return iCurrentMacState->TxNullDataFrame( aCtxImpl, aQosNull ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanContextImpl::JoinedMulticastGroups::JoinedMulticastGroups() + : iFirstFreeIndex( 0 ) + { + os_memset( iStorage, 0, sizeof( iStorage ) ); + Reset(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanContextImpl::TGroupAddStatus + WlanContextImpl::JoinedMulticastGroups::AddGroup( + const TMacAddress& aGroup ) + { + TGroupAddStatus addStatus( EOk ); + TUint index( 0 ); + + if ( iFirstFreeIndex == KMaxNbrOfGroups ) + { + // container full, cannot add any more + addStatus = EFull; + } + else + { + // not full + + if ( FindGroup( aGroup, index ) ) + { + // group already exists, don't add again + addStatus = EAlreadyExists; + } + else + { + // doesn't exist yet, so go ahead and add it + iStorage[iFirstFreeIndex] = aGroup; + ++iFirstFreeIndex; + } + } + + return addStatus; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanContextImpl::JoinedMulticastGroups::RemoveGroup( + const TMacAddress& aGroup ) + { + TBool foundAndRemoved( EFalse ); + TUint index( 0 ); + + if ( FindGroup( aGroup, index ) ) + { + // entry found + + if ( index < ( iFirstFreeIndex - 1 ) ) + { + // it wasn't the last (or the only) entry, so replace the entry to + // be removed with the last entry so that we don't create an empty + // slot in the middle (or in the beginning) + iStorage[index] = iStorage[iFirstFreeIndex - 1]; + iFree[iFirstFreeIndex - 1] = ETrue; + } + else + { + // it was the last (and possibly also the only) entry + // just mark the entry to be free + iFree[index] = ETrue; + } + + foundAndRemoved = ETrue; + --iFirstFreeIndex; + } + + return foundAndRemoved; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUint8 WlanContextImpl::JoinedMulticastGroups::Count() const + { + return iFirstFreeIndex; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUint8 WlanContextImpl::JoinedMulticastGroups::GetGroups( + const TMacAddress*& aGroups ) const + { + aGroups = iStorage; + return iFirstFreeIndex; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::JoinedMulticastGroups::Reset() + { + for (TUint8 i = 0; i < KMaxNbrOfGroups; i++ ) + { + iFree[i] = ETrue; + } + + iFirstFreeIndex = 0; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanContextImpl::JoinedMulticastGroups::FindGroup( + const TMacAddress& aGroup, TUint& aIndex ) const + { + TBool found( EFalse ); + TUint index( 0 ); + + while ( !found && ( index < iFirstFreeIndex ) ) + { + if ( aGroup == iStorage[index] ) + { + found = ETrue; + aIndex = index; + } + else + { + ++index; + } + } + + return found; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UseShortSlotTime( + TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KUseShortSlotTime; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KUseShortSlotTime); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::ProtectionBitSet( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KProtectionBitSet; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KProtectionBitSet); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::QosEnabled( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KQosEnabled; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KQosEnabled); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdEnabled( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KUapsdEnabled; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KUapsdEnabled); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::MulticastFilteringDisAllowed( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KMulticastFilteringDisAllowed; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KMulticastFilteringDisAllowed); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::ErpIePresent( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KErpIePresent; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KErpIePresent); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::DisassociatedByAp( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KDisassociatedByAp; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KDisassociatedByAp); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdRequestedForVoice( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KUapsdRequestedForVoice; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KUapsdRequestedForVoice); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdRequestedForVideo( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KUapsdRequestedForVideo; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KUapsdRequestedForVideo); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdRequestedForBestEffort( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KUapsdRequestedForBestEffort; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KUapsdRequestedForBestEffort); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdRequestedForBackground( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KUapsdRequestedForBackground; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KUapsdRequestedForBackground); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdUsedForVoice( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KUapsdUsedForVoice; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KUapsdUsedForVoice); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdUsedForVideo( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KUapsdUsedForVideo; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KUapsdUsedForVideo); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdUsedForBestEffort( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KUapsdUsedForBestEffort; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KUapsdUsedForBestEffort); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UapsdUsedForBackground( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KUapsdUsedForBackground; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KUapsdUsedForBackground); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::ApTestOpportunitySeekStarted( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KApTestOpportunitySeekStarted; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KApTestOpportunitySeekStarted); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::ApTestOpportunityIndicated( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KApTestOpportunityIndicated; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KApTestOpportunityIndicated); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::HtSupportedByNw( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KHtSupportedByNw; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KHtSupportedByNw); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::Reassociate( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KReassociate; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KReassociate); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::UseShortPreamble( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= WlanConnectContext::KUseShortPreamble; + } + else + { + iConnectContext.iFlags &= ~(WlanConnectContext::KUseShortPreamble); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtMode WlanContextImpl::CurrentPwrMgmtMode() const + { + if ( CurrentDot11PwrMgmtMode() == WHA::KPsDisable ) + { + return EActive; + } + else + { + const TDot11PsModeWakeupSetting lightPsModeWakeupSetting = + ClientLightPsModeConfig(); + + if ( iWlanMib.iWlanWakeupInterval == + lightPsModeWakeupSetting.iWakeupMode ) + { + if ( iWlanMib.iWlanWakeupInterval + == EWakeUpIntervalEveryNthBeacon || + iWlanMib.iWlanWakeupInterval + == EWakeUpIntervalEveryNthDtim ) + { + if ( iWlanMib.iWlanListenInterval == + lightPsModeWakeupSetting.iListenInterval ) + { + return ELightPs; + } + else + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + // this return value is not relevant + return ELightPs; + } + } + else + { + // for these wake-up modes a possible difference in listen + // interval is not meaningful + return ELightPs; + } + } + else + { + const TDot11PsModeWakeupSetting deepPsModeWakeupSetting = + ClientDeepPsModeConfig(); + + if ( iWlanMib.iWlanWakeupInterval == + deepPsModeWakeupSetting.iWakeupMode ) + { + if ( iWlanMib.iWlanWakeupInterval + == EWakeUpIntervalEveryNthBeacon || + iWlanMib.iWlanWakeupInterval + == EWakeUpIntervalEveryNthDtim ) + { + if ( iWlanMib.iWlanListenInterval == + deepPsModeWakeupSetting.iListenInterval ) + { + return EDeepPs; + } + else + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + // this return value is not relevant + return ELightPs; + } + } + else + { + // for these wake-up modes a possible difference in listen + // interval is not meaningful + return EDeepPs; + } + } + else + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + // this return value is not relevant + return EActive; + } + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::DynamicPwrModeMgtDisabled( TBool aValue ) + { + if ( aValue ) + { + iConnectContext.iFlags |= + WlanConnectContext::KDynamicPwrModeMgmtDisabled; + } + else + { + iConnectContext.iFlags &= + ~(WlanConnectContext::KDynamicPwrModeMgmtDisabled); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* WlanContextImpl::GetRxBuffer( + const TUint16 aLengthinBytes, + TBool aInternal ) + { + TUint8* buffer ( NULL ); + + if ( aLengthinBytes <= KMaxDot11RxMpduLength ) + { + if ( aInternal ) + { + buffer = iUmac.GetBufferForRxData( aLengthinBytes ); + } + else + { + buffer = iUmac.GetBufferForRxData( + aLengthinBytes + iWHASettings.iRxoffset ); + + // set the current Rx buffer. This must be done only for + // non-internal Rx buf requests, i.e. requests from WHA layer + iCurrentRxBuffer = buffer; + } + + if ( buffer ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanContextImpl::GetRxBuffer: buf addr: 0x%08x"), + reinterpret_cast(buffer) ); + return buffer; + } + else + { + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanContextImpl::GetRxBuffer: WARNING: buffer reservation failed") ); + + return NULL; + } + } + else + { + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanContextImpl::GetRxBuffer: WARNING: Buffer longer than max MPDU len requested. NULL returned") ); + return NULL; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* WlanContextImpl::GetRxFrameMetaHeader() + { + return iUmac.GetRxFrameMetaHeader(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ) + { + iUmac.FreeRxFrameMetaHeader( aMetaHeader ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* WlanContextImpl::TxBuffer( TBool aWaitIfNotFree ) + { + TUint8* address ( NULL ); + + if ( iInternalTxBufFree ) + { + address = iUmac.DmaPrivateTxMemory() + iWHASettings.iTxFrameHeaderSpace; + + if ( address ) + { + // valid address will be returned => mark buffer to be in use + iInternalTxBufFree = EFalse; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanContextImpl::TxBuffer: internal Tx buf now in use")); + } + } + else + { + // buffer already in use. NULL will be returned. + + if ( aWaitIfNotFree ) + { + // client would like to wait for the buffer to become free + + if ( !iInternalTxBufBeingWaited ) + { + // the buffer is not being waited for currently + + // Note that someone is now waiting for the buffer + iInternalTxBufBeingWaited = ETrue; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanContextImpl::TxBuffer: internal Tx buf already in use => now being waited for")); + } + else + { + // the buffer is already being waited for. This is an + // implementation error + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); + } + } + } + + return address; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanContextImpl::OnBssRegained() + { + TBool ret( EFalse ); + + if ( iConsecutiveBeaconsLostIndicated || + iConsecutiveTxFailuresIndicated || + iConsecutivePwrModeSetFailuresIndicated ) + { + ResetBssLossIndications(); + ret = ETrue; + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUint WlanContextImpl::AverageTxMediaDelay( + WHA::TQueueId aAccessCategory ) const + { + const TUint totalTxDataFrameCount = + iFrameStatistics.acSpecific[aAccessCategory].txUnicastDataFrameCount + + iFrameStatistics.acSpecific[aAccessCategory].txMulticastDataFrameCount; + + // return zero if no frames have been transmitted via this AC + return totalTxDataFrameCount ? + iFrameStatistics.acSpecific[aAccessCategory].txMediaDelay / + totalTxDataFrameCount : + 0; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::CalculateAverageTxMediaDelays() + { + for ( TUint accessCategory = 0; + accessCategory < EQueueIdMax; + ++accessCategory ) + { + iFrameStatistics.acSpecific[accessCategory].txMediaDelay = + AverageTxMediaDelay( static_cast(accessCategory) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanContextImpl::UpdateTotalTxDelayHistogram( + WHA::TQueueId aAccessCategory, + TUint aDelay ) + { + const TUint KTotalTxDelayBin0UpperBound = 10000; // 10 ms + const TUint KTotalTxDelayBin1UpperBound = 20000; // 20 ms + const TUint KTotalTxDelayBin2UpperBound = 40000; // 40 ms + + if ( aDelay <= KTotalTxDelayBin0UpperBound ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin0; + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanContextImpl::UpdateTotalTxDelayHistogram: bin 0 cnt incremented. Count now: %d"), + iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin0 ); + } + else if ( aDelay > KTotalTxDelayBin0UpperBound && + aDelay <= KTotalTxDelayBin1UpperBound ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin1; + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanContextImpl::UpdateTotalTxDelayHistogram: bin 1 cnt incremented. Count now: %d"), + iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin1 ); + } + else if ( aDelay > KTotalTxDelayBin1UpperBound && + aDelay <= KTotalTxDelayBin2UpperBound ) + { + ++iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin2; + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanContextImpl::UpdateTotalTxDelayHistogram: bin 2 cnt incremented. Count now: %d"), + iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin2 ); + } + else // aDelay > KTotalTxDelayBin2UpperBound + { + ++iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin3; + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanContextImpl::UpdateTotalTxDelayHistogram: bin 3 cnt incremented. Count now: %d"), + iFrameStatistics.acSpecific[aAccessCategory].totalTxDelayBin3 ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUint WlanContextImpl::AverageTotalTxDelay( + WHA::TQueueId aAccessCategory ) const + { + const TUint totalTxDataFrameCount = + iFrameStatistics.acSpecific[aAccessCategory].txUnicastDataFrameCount + + iFrameStatistics.acSpecific[aAccessCategory].txMulticastDataFrameCount; + + // return zero if no frames have been transmitted via this AC + return totalTxDataFrameCount ? + iFrameStatistics.acSpecific[aAccessCategory].totalTxDelay / + totalTxDataFrameCount : + 0; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::CalculateAverageTotalTxDelays() + { + for ( TUint accessCategory = 0; + accessCategory < EQueueIdMax; + ++accessCategory ) + { + iFrameStatistics.acSpecific[accessCategory].totalTxDelay = + AverageTotalTxDelay( static_cast(accessCategory) ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::AddBssMembershipFeature( + T802Dot11BssMembershipSelector aFeature ) + { + TUint8 i ( 0 ); + + do + { + if ( iOurBssMembershipFeatureArray[i] == KUnallocated ) + { + iOurBssMembershipFeatureArray[i] = aFeature; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanContextImpl::AddBssMembershipFeature: feature %d added to our feature list"), + aFeature ); + + break; + } + else + { + ++i; + } + } while ( i != KMaxNumOfWlanFeatures ); + +#ifndef NDEBUG + if ( i == KMaxNumOfWlanFeatures ) + { + // not enough space reserved for features + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: WlanContextImpl::AddBssMembershipFeature: ERROR: not enough space reserved for features") ); + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } +#endif + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanContextImpl::BssMembershipFeatureSupported( TUint8 aItem ) const + { + TBool supported ( EFalse ); + + TUint8 i ( 0 ); + + do + { + if ( aItem == iOurBssMembershipFeatureArray[i] ) + { + supported = ETrue; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanContextImpl::BssMembershipFeatureSupported: feature %d is supported by us"), + aItem ); + + break; + } + else + { + ++i; + } + } while ( i != KMaxNumOfWlanFeatures ); + + return supported; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + iCurrentMacState->OnPacketTransferComplete( + aCtxImpl, + aPacketId, + aMetaHeader ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ) + { + iCurrentMacState->OnPacketSendComplete( + aCtxImpl, + aStatus, + aPacketId, + aRate, + aPacketQueueDelay, + aMediaDelay, + aTotalTxDelay, + aAckFailures, + aQueueId, + aRequestedRate, + aMulticastData ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ) + { + iCurrentMacState->CallPacketSchedule( aCtxImpl, aMore ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::OnPacketFlushEvent( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + iCurrentMacState->OnPacketFlushEvent( aCtxImpl, aPacketId, aMetaHeader ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanContextImpl::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + iCurrentMacState->OnPacketPushPossible( aCtxImpl ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Associated.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Associated.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2725 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11Associated class +* +*/ + +/* +* %version: 95 % +*/ + +#include "config.h" +#include "UmacDot11Associated.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "umacinternaldefinitions.h" + +/** +* Mask to determine the used encryption from WHA::ReceivePacket's aFlags +* parameter +*/ +const TUint32 KReceivePacketEncryptionMask = 0x00038000; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* /*aFrame*/, + const TUint32 /*aLength*/, + WHA::TRcpi /*aRcpi*/, + TUint8* aBuffer ) + { + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnProbeResponseFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* /*aFrame*/, + const TUint32 /*aLength*/, + WHA::TRcpi /*aRcpi*/, + TUint8* aBuffer ) + { + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnDeauthenticateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ) + { + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnDisassociateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ) + { + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TSnapStatus WlanDot11Associated::ValiDateSnapHeader( + WlanContextImpl& aCtxImpl, + const TUint8* aStartOfSnap ) const + { + TSnapStatus snapStatus( ESnapUnknown ); + + if ( !os_memcmp( + aStartOfSnap, + &KEncapsulatingRfc1042SnapHeader, + sizeof( KEncapsulatingRfc1042SnapHeader ) ) ) + { + snapStatus = ESnapDot11Ok; + } + else if ( !os_memcmp( + aStartOfSnap, + &KEncapsulating802_1hSnapHeader, + sizeof( KEncapsulating802_1hSnapHeader ) ) ) + { + snapStatus = ESnapDot11Ok; + } + else + { + // unknown SNAP. Status already correct. No action needed + } + + if ( snapStatus == ESnapUnknown && + aCtxImpl.NetworkOperationMode() == WHA::EBSS && + aCtxImpl.GetProprietarySnapHeader() != KUndefinedSnapHeader ) + { + // SNAP still unknown, but we a are in a infrastructure network and + // a proprietary SNAP header has been defined. + // Check if the SNAP is this proprietary SNAP header + + if ( !os_memcmp( + aStartOfSnap, + &(aCtxImpl.GetProprietarySnapHeader()), + sizeof( aCtxImpl.GetProprietarySnapHeader() ) ) ) + { + snapStatus = ESnapProprietaryOk; + } + } + + return snapStatus; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanDot11Associated::RxDataMpduValid( + const TUint32 aLength, + const SDataFrameHeader& aFrameHeader, + TBool aQosData, + TBool aAmsdu, + TUint aHtControlLen, + TUint aSecurityHeaderLen, + TUint aSecurityTrailerLen ) const + { + //======================================================================== + // validate frame length + //======================================================================== + + const TUint KMinAcceptableRxDataMpduLen ( + MinAcceptableRxDataMpduLen( + aQosData, + aAmsdu, + aHtControlLen, + aSecurityHeaderLen, + aSecurityTrailerLen ) ); + + if ( aLength < KMinAcceptableRxDataMpduLen ) + { + // frame shorter than min acceptable length; reject it + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Associated::RxDataMpduValid: WARNING: MPDU rejected because its shorter than min acceptable length of %d"), + KMinAcceptableRxDataMpduLen ); + + return EFalse; + } + + //======================================================================== + // validate To DS & From DS bits + //======================================================================== + + if ( !DoIsValidAddressBitCombination( aFrameHeader ) ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::RxDataMpduValid: MPDU rejected because of invalid To DS and/or From DS bit values") ); + + return EFalse; + } + + return ETrue; + } + +// --------------------------------------------------------------------------- +// defines the minimum acceptable Data MPDU length as: +// dot11 MAC header length including SNAP and possibly existing HT Control +// field +// + security header length +// + subframe header length if the QoS Data MPDU contains an A-MSDU +// + security trailer length +// + Ethernet type field length +// --------------------------------------------------------------------------- +// +inline TUint WlanDot11Associated::MinAcceptableRxDataMpduLen( + TBool aQosData, + TBool aAmsdu, + TUint aHtControlLen, + TUint aSecurityHeaderLen, + TUint aSecurityTrailerLen ) const + { + return aQosData ? + sizeof( SQosDataMpduHeader ) + aHtControlLen + + aSecurityHeaderLen + + ( aAmsdu ? sizeof( SAmsduSubframeHeader ) : 0 ) + + aSecurityTrailerLen + + sizeof( SEthernetType ) + : + sizeof( SDataMpduHeader ) + + aSecurityHeaderLen + + aSecurityTrailerLen + + sizeof( SEthernetType ); + } + +// --------------------------------------------------------------------------- +// Note that address 1 is the DA (Destination Address) both in infrastructure +// and IBSS network Rx frames +// --------------------------------------------------------------------------- +// +inline TDaType WlanDot11Associated::RxFrameDaType( + const SDataFrameHeader& aFrameHeader ) const + { + if ( IsGroupBitSet( aFrameHeader.iAddress1 ) ) + { + // a multicast + if ( aFrameHeader.iAddress1 == KBroadcastMacAddr ) + { + // also a brodcast + return EBroadcastAddress; + } + else + { + // a multicast but not a broadcast + return EMulticastAddress; + } + } + else + { + // a unicast + return EUnicastAddress; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanDot11Associated::RxMsduValid( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* aSubFrameHeader, + const TUint8* aStartOfSnap, + TUint16 aEtherType, + TBool aMulticast, + TUint32 aFlags, + TSnapStatus& aSnapStatus ) const + { + //======================================================================== + // validate SNAP header + //======================================================================== + + aSnapStatus = ValiDateSnapHeader( aCtxImpl, aStartOfSnap ); + + if ( aSnapStatus == ESnapUnknown ) + { + // SNAP header is invalid + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::RxMsduValid: MSDU rejected because of invalid snap:"), + aStartOfSnap, aStartOfSnap + sizeof( SSnapHeader ) ); + + return EFalse; + } + + // determine if SA is our MAC address + const TBool KSaIsOurMac ( + DoIsRxFrameSAourAddress( aCtxImpl, aFrameHeader, aSubFrameHeader ) ); + + //======================================================================== + // if this is a proprietary test MSDU but not sent by us, its not valid + // for us + //======================================================================== + + if ( aEtherType == KBounceType && !KSaIsOurMac ) + { +#ifndef NDEBUG + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::RxMsduValid: proprietary test MSDU, but not sent by us. MSDU rejected") ); + + if ( aSubFrameHeader ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Subframe DA:"), aSubFrameHeader->iDa ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Subframe SA:"), aSubFrameHeader->iSa ); + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Address1:"), aFrameHeader.iAddress1); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Address2:"), aFrameHeader.iAddress2); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Address3:"), aFrameHeader.iAddress3); + } +#endif + + return EFalse; + } + + //======================================================================== + // non-test multicast MSDUs sent by us are not relevant for us + //======================================================================== + + if ( // SA is our MAC address + KSaIsOurMac + // AND this is a multicast frame + && aMulticast + // AND this is not a test frame + && aEtherType != KBounceType ) + { + // we have received a non-test multicast frame that was sent by us. + // Ignore it. + +#ifndef NDEBUG + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::RxMsduValid: MSDU rejected because its a non-test multicast MSDU sent by us")); + + if ( aSubFrameHeader ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Subframe DA:"), aSubFrameHeader->iDa ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Subframe SA:"), aSubFrameHeader->iSa ); + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Address1:"), aFrameHeader.iAddress1); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Address2:"), aFrameHeader.iAddress2); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: Address3:"), aFrameHeader.iAddress3); + } +#endif + + return EFalse; + } + + // determine the encryption of the frame + const TUint32 KEncryption ( aFlags & KReceivePacketEncryptionMask ); + + if ( aSnapStatus != ESnapProprietaryOk ) + { + //==================================================================== + // validate MSDU with the applicable privacy mode filter + //==================================================================== + if ( !aCtxImpl.ExecuteActivePrivacyModeFilter( + aFrameHeader, + aCtxImpl.iEnableUserData, + aEtherType, + aCtxImpl.PairWiseKeyType() != WHA::EKeyNone, + ( KEncryption == WHA::KEncryptAes || + KEncryption == WHA::KEncryptTkip || + KEncryption == WHA::KEncryptWapi ) ) ) + { + return EFalse; + } + } + + // this MSDU has passed all our checks, so it is valid for us + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint WlanDot11Associated::RxMsduEthernetPayloadLength( + const TUint32 aMpduLength, + TUint aSubframeLength, + TBool aQosData, + TUint aHtControlLen, + TUint aSecurityHeaderLen, + TUint aSecurityTrailerLen ) const + { + TUint length ( 0 ); + + if ( aSubframeLength ) + { + // this ethernet payload is carried in an A-MSDU subframe + + length = aSubframeLength - sizeof( SSnapHeader ); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: subframe eth payload len: %d"), + length ); + } + else + { + // this ethernet payload is carried in a non-A-MSDU frame + + if ( aQosData ) + { + length = + // total length of the Rx frame + aMpduLength + // - MAC header length including SNAP + - ( sizeof( SQosDataMpduHeader ) + aHtControlLen ) + // - security header length + - aSecurityHeaderLen + // - security trailer length + - aSecurityTrailerLen; + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: qos data eth payload len: %d"), + length ); + } + else + { + length = + // total length of the Rx frame + aMpduLength + // MAC header length including SNAP + - sizeof( SDataMpduHeader ) + // - security header length + - aSecurityHeaderLen + // - security trailer length + - aSecurityTrailerLen; + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: non-qos data eth payload len: %d"), + length ); + } + } + + return length; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8* WlanDot11Associated::NewBufForMgmtClientRxFrame( + WlanContextImpl& aCtxImpl, + TBool aProprieatarySnapFrame, + TBool aQosFrame, + TUint aHtControlLen, + TUint aEtherPayloadLength ) const + { + TUint requiredLength ( 0 ); + + if ( aProprieatarySnapFrame ) + { + // forwarded as a Data MPDU + + requiredLength = aQosFrame ? + sizeof( SQosDataFrameHeader ) + + aHtControlLen + + aEtherPayloadLength : + sizeof( SDataFrameHeader ) + + aEtherPayloadLength; + } + else + { + // forwarded as Ethernet frame + + requiredLength = 2 * sizeof( TMacAddress ) + aEtherPayloadLength; + } + + // request for a new Rx buffer + return aCtxImpl.GetRxBuffer( + requiredLength, + // tell that this is an internally triggered buffer request + ETrue ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanDot11Associated::RxMsduForUser( + TUint16 aEtherType, + TSnapStatus aSnapstatus ) const + { + if ( // not an EAPOL frame AND + aEtherType != KEapolType && + // not a WAI frame AND + aEtherType != KWaiType && + // not a WLAN Mgmt Client test frame + aEtherType != KBounceType && + // not a proprietary SNAP frame + aSnapstatus != ESnapProprietaryOk ) + { + // a user data / protocol stack data frame + + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanDot11Associated::UpdateDataFrameRxStatistics( + WlanContextImpl& aCtxImpl, + TUint16 aEtherType, + TBool aMulticast, + WHA::TQueueId aAccessCategory ) const + { + if ( aEtherType != KBounceType ) + { + // other than WLAN Mgmt Client test data frame received + + if ( aMulticast ) + { + // multicast frame + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: inc rx mcast cnt for AC: %d"), + aAccessCategory ); + + // update frame statistics + aCtxImpl.IncrementRxMulticastDataFrameCount( aAccessCategory ); + } + else + { + // unicast frame + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: inc rx unicast cnt for AC: %d"), + aAccessCategory ); + + // update frame statistics + aCtxImpl.IncrementRxUnicastDataFrameCount( aAccessCategory ); + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnDataFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + TUint32 aFlags, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::OnDataFrameRx") ); + + SDataMpduHeader* hdr + = reinterpret_cast(const_cast(aFrame)); + SQosDataMpduHeader* qoshdr + = reinterpret_cast(const_cast(aFrame)); + + // determine the length of the security header (e.g. IV etc.) ... + const TUint KSecurityHeaderLen( DecryptHdrOffset( aCtxImpl, aFlags ) ); + + OsTracePrint( KRxFrame, (TUint8*)("UMAC: KSecurityHeaderLen: %d"), + KSecurityHeaderLen ); + + // ... and the security trailer (e.g. MIC etc.) + const TUint KSecurityTrailerLen( DecryptTrailerOffset( aCtxImpl, aFlags ) ); + + OsTracePrint( KRxFrame, (TUint8*)("UMAC: KSecurityTrailerLen: %d"), + KSecurityTrailerLen ); + + // as the MAC header of a QoS data MPDU has an additional field + // we need to take that into account; so make a note if we indeed have + // received a QoS data MPDU + const TBool KQosData = + ( hdr->iHdr.iFrameControl.iType == E802Dot11FrameTypeQosData ) ? + ETrue : EFalse; + + // the MAC header of HT QoS data MPDU also has an additional field, + // so determine if that field is present and hence has a non-zero length + const TUint KHtControlLen ( + KQosData && HtcFieldPresent( aCtxImpl, aFrame, aFlags ) ? + KHtControlFieldLength : 0 ); + + // determine if the MPDU contains an A-MSDU + const TBool KAmsdu ( + KQosData && qoshdr->iHdr.AmsduPresent() ? ETrue : EFalse ); + + if ( !RxDataMpduValid( + aLength, + hdr->iHdr, + KQosData, + KAmsdu, + KHtControlLen, + KSecurityHeaderLen, + KSecurityTrailerLen ) ) + { + // the overall MAC MPDU (disregarding the included MSDU(s) at this + // point) is not valid for us. Release the Rx buffer & abort + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + return; + } + + TUint8* framePtr ( 0 ); + WHA::TQueueId accessCategory( WHA::ELegacy ); + + // User Priority is regarded as Best Effort (i.e. Legacy, i.e. zero) unless + // the received MPDU is a QoS Data MPDU & a different priority is + // specified in its MAC header + TUint8 userPriority( 0 ); + + if ( KQosData ) + { + // a QoS Data MPDU + + // move framePtr past the MAC header + framePtr = reinterpret_cast( + reinterpret_cast( hdr ) + 1 ) + + KHtControlLen; + + // get the User Priority + userPriority = qoshdr->iHdr.UserPriority(); + + // make a note of the Access Category corresponding to the + // user priority of the MPDU (note that there's a one to one + // mapping between Queue id and Access Category) + accessCategory = Queue( userPriority ); + } + else + { + // move framePtr past the MAC header + framePtr = reinterpret_cast( + reinterpret_cast( hdr ) + 1 ); + } + + // move after possibly existing security header and possibly existing + // A-MSDU subframe header, i.e. beginning of SNAP header + framePtr += KAmsdu ? + KSecurityHeaderLen + sizeof( SAmsduSubframeHeader ) : + KSecurityHeaderLen; + TUint8* snapLocation ( framePtr ); + + // determine the DA type + const TDaType KDaType ( RxFrameDaType( hdr->iHdr ) ); + + TSnapStatus snapstatus( ESnapUnknown ); + TDataBuffer* latestValidPacketForUsr ( NULL ); + TUint nbrOfpacketsForUsr ( 0 ); + TUint nbrOfpacketsForMgmtClient ( 0 ); + const TUint KMaxNbrOfPacketsForUsr ( 30 ); + const TUint KMaxNbrOfPacketsForMgmtClient ( 10 ); + const TDataBuffer* packetsForUsr[KMaxNbrOfPacketsForUsr]; + const TDataBuffer* packetsForMgmtClient[KMaxNbrOfPacketsForMgmtClient]; + // one byte past the last actual payload byte (so excluding the potentially + // present security trailer) of the MPDU + const TUint8* const KMpduPayloadEnd ( + reinterpret_cast(aFrame) + + aLength + - KSecurityTrailerLen ); + TPowerMgmtModeChange powerMgmtModeChange ( ENoChange ); + + // handle every MSDU contained in this MPDU. If this is not an A-MSDU + // there's only a single MSDU in it. + do + { + TUint8* rxBuffer ( aBuffer ); + + // move after SNAP header to Ethernet type field + framePtr += sizeof( SSnapHeader ); + const SEthernetType* const KEtherTypeLocation + = reinterpret_cast( framePtr ); + + // determine Ethernet type + const TUint16 KEtherType = KEtherTypeLocation->Type(); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: ether type: 0x%04x"), + KEtherType ); + + // pointer to subframe heaader; or NULL if the MPDU doesn't contain + // an A-MSDU + const SAmsduSubframeHeader* KSubframeHdr ( KAmsdu ? + ( reinterpret_cast( + snapLocation) - 1 ) : + NULL ); + + // determine if this is a multicast MSDU + TBool KMulticastMsdu ( EFalse ); + if ( KSubframeHdr ) + { + KMulticastMsdu = IsGroupBitSet( KSubframeHdr->iDa ); + } + else + { + KMulticastMsdu = ( KDaType == EUnicastAddress ? EFalse : ETrue ); + } + + // determine subframe length, which can be non-zero only if the MPDU + // contains an A-MSDU + const TUint KSubframeLen ( KSubframeHdr ? KSubframeHdr->Length() : 0 ); + + if ( !RxMsduValid( + aCtxImpl, + hdr->iHdr, + KSubframeHdr, + snapLocation, + KEtherType, + KMulticastMsdu, + aFlags, + snapstatus ) ) + { + // this MSDU is not valid/relevant for us + + if ( KAmsdu ) + { + // move pointer to the SNAP of the possibly existing next + // subframe + snapLocation += + Align4( sizeof( SAmsduSubframeHeader ) + KSubframeLen ); + // update frame pointer accordingly + framePtr = snapLocation; + + continue; + } + else + { + // this MPDU doesn't contain an A-MSDU, so there cannot be + // more than a single MSDU in it + break; + } + } + + // determine if this MSDU is for user / protocol stack + const TBool KMsduForUser ( RxMsduForUser( KEtherType, snapstatus) ); + + if ( KMsduForUser && !aCtxImpl.iUmac.ProtocolStackSideClientReady() ) + { + // this MSDU should be forwarded up the protocol stack but the + // protocol stack client is not ready. So we need to skip at + // least this MSDU. + // Move pointer to the SNAP of the possibly existing next subframe + snapLocation += + Align4( sizeof( SAmsduSubframeHeader ) + KSubframeLen ); + // update frame pointer accordingly + framePtr = snapLocation; + + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WARNING: protocol stack client not ready; MSDU ignored") ); + + continue; + } + + TDataBuffer* metaHdr ( aCtxImpl.GetRxFrameMetaHeader() ); + if ( !metaHdr ) + { + // no memory available for Rx frame meta header. This means that + // we are not able to forward to higher layers the current MSDU or + // any MSDU(s) that possibly follow it in this same MPDU + + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WARNING: no memory for Rx frame meta hdr; MSDU ignored") ); + break; + } + + const TUint KEtherPayloadLen( RxMsduEthernetPayloadLength( + aLength, + KSubframeLen, + KQosData, + KHtControlLen, + KSecurityHeaderLen, + KSecurityTrailerLen ) ); + + if ( !KMsduForUser && KAmsdu ) + { + // an MSDU for WLAN Mgmt Client which is also a part of an + // A-MSDU. In this case we need to allocate a new buffer for + // this packet and copy it there. This is necessary as an + // A-MSDU may contain MSDUs both for the protocol stack side + // and for WLAN Mgmt Client. Either one of those clients may + // complete the handling of its MSDUs first at which point the + // Rx buffer(s) for its MSDU(s) is freed. So we need to make + // sure that a buffer is not freed while a client is still + // handling MSDU(s) contained in it. We do this by always + // copying WLAN Mgmt client MSDU(s) part of an A-MSDU to + // new buffers. + + rxBuffer = NewBufForMgmtClientRxFrame( + aCtxImpl, + snapstatus == ESnapProprietaryOk, + KQosData, + KHtControlLen, + snapstatus == ESnapProprietaryOk ? + KSubframeLen : KEtherPayloadLen ); + + if ( !rxBuffer ) + { + // allocation failed so we need to skip at least this MSDU. + + // Move pointer to the SNAP of the possibly existing next + // subframe + snapLocation += + Align4( sizeof( SAmsduSubframeHeader ) + KSubframeLen ); // update frame pointer accordingly + // update frame pointer accordingly + framePtr = snapLocation; + + // also release the meta hdr which was planned to be used for + // this MSDU + aCtxImpl.FreeRxFrameMetaHeader( metaHdr ); + + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WARNING: new buf alloc for mgmt client frame failed; MSDU ignored") ); + continue; + } + } + + // set the offset to the beginning of the Rx buffer from the beginning + // of the meta header. Note that this may be also negative + metaHdr->KeSetBufferOffset( + rxBuffer + - reinterpret_cast(metaHdr) ); + + if ( snapstatus == ESnapProprietaryOk ) + { + HandleProprietarySnapRxFrame( + *metaHdr, + KQosData, + aFrame, + KSubframeHdr, + aLength, + KSecurityHeaderLen, + KSecurityTrailerLen, + KHtControlLen, + KAmsdu ? rxBuffer : NULL ); + } + else + { + DoBuildEthernetFrame( + *metaHdr, + *hdr, + // start of ethernet payload (includes ether type field) + reinterpret_cast(KEtherTypeLocation), + // length of ethernet payload + KEtherPayloadLen, + KAmsdu, + !KMsduForUser && KAmsdu ? rxBuffer : NULL ); + } + + // set the frame's User Priority to the Rx buffer being passed + // to the client + metaHdr->SetUserPriority( userPriority ); + // set the RCPI + metaHdr->KeSetRcpi( aRcpi ); + + if ( KEtherType == KBounceType ) + { + metaHdr->FrameType( + TDataBuffer::KEthernetTestFrame ); + } + + if ( KMsduForUser ) + { + // a user data / protocol stack data frame + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: data frame rx")); + + packetsForUsr[nbrOfpacketsForUsr++] = metaHdr; + latestValidPacketForUsr = metaHdr; + if ( KAmsdu ) + { + metaHdr->KeSetFlags( TDataBuffer::KDontReleaseBuffer ); + } + } + else + { + // a WLAN Mgmt Client data frame + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: mgmt client frame rx")); + + packetsForMgmtClient[nbrOfpacketsForMgmtClient++] = metaHdr; + } + + // move pointer to the SNAP of the possibly existing next subframe + snapLocation += Align4( sizeof( SAmsduSubframeHeader ) + KSubframeLen ); + // update frame pointer accordingly + framePtr = snapLocation; + + UpdateDataFrameRxStatistics( + aCtxImpl, + KEtherType, + KMulticastMsdu, + accessCategory ); + + // inform dynamic power mode mgr about Rx data frame acceptance + if ( // if this is not our test frame AND + KEtherType != KBounceType && + // need to change power mgmt mode hasn't already been detected + // based on this received (A-)MSDU + powerMgmtModeChange == ENoChange ) + { + powerMgmtModeChange = aCtxImpl.OnFrameRx( + accessCategory, + KEtherType, + KEtherPayloadLen, + KDaType ); + } + + // inform Null Send Controller about data frame Rx + aCtxImpl.OnDataRxCompleted( + ( KEtherType == KEapolType || KEtherType == KWaiType ) ? + // as EAPOL and WAI frames or not really Voice data (they + // are just sometimes sent with Voice priority), handle them + // here as Best Effort (Legacy) + WHA::ELegacy : + accessCategory, + KEtherPayloadLen ); + + // for a non-A-MSDU this loop is executed only once + } while ( KAmsdu && snapLocation < KMpduPayloadEnd ); + + if ( nbrOfpacketsForUsr ) + { + latestValidPacketForUsr->KeClearFlags( + TDataBuffer::KDontReleaseBuffer ); + + // complete user data / protocol stack data frame(s) + if ( !aCtxImpl.iUmac.ProtocolStackDataReceiveComplete( + packetsForUsr[0], + nbrOfpacketsForUsr ) ) + { + // there's no protocol stack client to whom to complete Rx packets. + // (Actually the control should never arrive here as we have + // checked the readiness of the protocol stack client already + // earlier) + nbrOfpacketsForUsr = 0; + } + } + + if ( nbrOfpacketsForMgmtClient ) + { + // complete WLAN Mgmt Client data frame(s) + aCtxImpl.iUmac.MgmtDataReceiveComplete( + packetsForMgmtClient[0], + nbrOfpacketsForMgmtClient ); + } + + if ( ( !nbrOfpacketsForUsr && !nbrOfpacketsForMgmtClient ) || + ( KAmsdu && !nbrOfpacketsForUsr ) ) + { + // the contents of the original Rx buffer are not needed any more, + // so deallocate it + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: free original Rx buf")); + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + + // if any change is needed regarding our power mgmt mode, + // proceed with it + PowerMgmtModeChange( aCtxImpl, powerMgmtModeChange ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnManagementActionFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) const + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::OnManagementActionFrameRx")); + + TDataBuffer* metaHdr ( aCtxImpl.GetRxFrameMetaHeader() ); + + if ( metaHdr ) + { + // set length and type + metaHdr->KeSetLength( aLength ); + metaHdr->FrameType( TDataBuffer::KDot11Frame ); + // set RCPI + metaHdr->KeSetRcpi( aRcpi ); + + // set the offset to the beginning of the Rx buffer from the beginning + // of the meta header. Note that this may be also negative + metaHdr->KeSetBufferOffset( + aBuffer + - reinterpret_cast(metaHdr) ); + + // set the offset to the beginning of the actual frame within the + // Rx buffer + metaHdr->KeSetOffsetToFrameBeginning( + reinterpret_cast(aFrame) // frame beginning + - aBuffer ); // buffer beginning + + // complete + const TDataBuffer* KMetaHdr ( metaHdr ); + aCtxImpl.iUmac.MgmtDataReceiveComplete( KMetaHdr, 1 ); + } + else + { + // no memory available for the meta header. In this case we have no + // other choice than to discard the received frame. + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + OsTracePrint( KWarningLevel | KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::OnManagementActionFrameRx: WARNING: no memory for meta hdr => abort rx") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* WlanDot11Associated::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + return aCtxImpl.GetRxBuffer( aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate /*aRate*/, + WHA::TRcpi aRcpi, + WHA::TChannelNumber /*aChannel*/, + TUint8* aBuffer, + TUint32 aFlags ) + { + SDataMpduHeader* hdr( + reinterpret_cast(const_cast(aFrame)) ); + + if ( aStatus == WHA::KSuccess ) + { + // packet reception success lets see what type of frame we have + OsTracePrint( KRxFrame, + (TUint8*) + ("UMAC: WlanDot11Associated::ReceivePacket:frame receive success, frame type: 0x%02x"), + hdr->iHdr.iFrameControl.iType ); + + if ( ( hdr->iHdr.iFrameControl.iType == E802Dot11FrameTypeData ) + || ( hdr->iHdr.iFrameControl.iType == E802Dot11FrameTypeQosData ) ) + { + OnDataFrameRx( aCtxImpl, aFrame, aLength, aFlags, aRcpi, aBuffer ); + + if ( aCtxImpl.InsertNewRcpiIntoPredictor( os_systemTime(), aRcpi ) ) + { + // indicate WLAN signal loss prediction to WLAN Mgmt Client + OnInDicationEvent( aCtxImpl, ESignalLossPrediction ); + } + } + else if ( hdr->iHdr.iFrameControl.iType + == E802Dot11FrameTypeManagementAction ) + { + OnManagementActionFrameRx( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aBuffer ); + + if ( aCtxImpl.InsertNewRcpiIntoPredictor( os_systemTime(), aRcpi ) ) + { + // indicate WLAN signal loss prediction to WLAN Mgmt Client + OnInDicationEvent( aCtxImpl, ESignalLossPrediction ); + } + } + else if ( hdr->iHdr.iFrameControl.iType + == E802Dot11FrameTypeDeauthentication ) + { + OnDeauthenticateFrameRx( aCtxImpl, aBuffer ); + } + else if ( hdr->iHdr.iFrameControl.iType + == E802Dot11FrameTypeDisassociation ) + { + OnDisassociateFrameRx( aCtxImpl, aBuffer ); + } + else if ( hdr->iHdr.iFrameControl.iType + == E802Dot11FrameTypeBeacon ) + { + OnBeaconFrameRx( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } + else if ( hdr->iHdr.iFrameControl.iType + == E802Dot11FrameTypeProbeResp ) + { + OnProbeResponseFrameRx( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } + else + { + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Associated::ReceivePacket: unsupported frame type: 0x%02x"), + hdr->iHdr.iFrameControl.iType ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + else if ( aStatus == WHA::KDecryptFailure ) + { + // decryption error + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Associated::ReceivePacket: decrypt error for frame:"), hdr->iHdr ); + + OnInDicationEvent( aCtxImpl, EWepDecryptFailure ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + else if ( aStatus == WHA::KMicFailure ) + { + // MIC failed + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Associated::ReceivePacket: MIC error for frame:"), hdr->iHdr ); + + // address 1 is always the DA in our case + OnInDicationEvent( aCtxImpl, + (IsGroupBitSet( hdr->iHdr.iAddress1 )) + ? EGroupKeyMicFailure : EPairwiseKeyMicFailure + ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + else + { + // packet rececption failed + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Associated::ReceivePacket: frame receive failure")); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::EncryptTxFrames( + WlanContextImpl& aCtxImpl, + const TDataBuffer& aDataBuffer ) const + { + TBool encrypt ( EFalse ); + + if ( aDataBuffer.KeFlags() & TDataBuffer::KTxFrameMustNotBeEncrypted ) + { + // our client has instructed us not the encrypt this frame under + // any circumstances. EFalse will be returned. + // No further action needed + } + else + { + const WHA::TKeyType pairwiseKey ( aCtxImpl.PairWiseKeyType() ); + const WHA::TKeyType groupKey ( aCtxImpl.GroupKeyType() ); + + if ( pairwiseKey != WHA::EKeyNone ) + { + // pairwise key set => use encryption + encrypt = ETrue; + } + else + { + // pairwise key not set + + if ( groupKey == WHA::EWepGroupKey ) + { + // wep group key set => use encryption + encrypt = ETrue; + } + } + } + + return encrypt; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint WlanDot11Associated::DecryptHdrOffset( + WlanContextImpl& aCtxImpl, + TUint32 aFlags ) const + { + TUint offset( 0 ); + + const TUint32 encryption ( aFlags & KReceivePacketEncryptionMask ); + + if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KNoSecHdrAndTrailer ) + { + // no security header is present on this sw layer. It is removed + // on lower layers; when necessary. + // We will return zero, so no further actions + } + else + { + // IV and/or Ext IV or CCMP header is present + // on this sw layer; when applicable + + if ( encryption == WHA::KEncryptAes ) + { + offset = KCcmpHeaderLength; + } + else if ( encryption == WHA::KEncryptTkip ) + { + offset = KWepIVLength + KWepExtendedIVLength; + } + else if ( encryption == WHA::KEncryptWep ) + { + offset = KWepIVLength; + } + else if ( encryption == WHA::KEncryptWapi ) + { + offset = KWapiHeaderLength; + } + else + { + // frame not encrypted; returns zero + } + } + + return offset; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint WlanDot11Associated::DecryptTrailerOffset( + WlanContextImpl& aCtxImpl, + TUint32 aFlags ) const + { + TUint offset( 0 ); + + const TUint32 encryption ( aFlags & KReceivePacketEncryptionMask ); + + if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KNoSecHdrAndTrailer ) + { + // no security trailer is present on this sw layer. It is removed + // on lower layers; when necessary. + // We will return zero, so no further actions + } + else + { + // ICV and/or MIC field is present on this sw layer; when applicable + + if ( encryption == WHA::KEncryptAes ) + { + offset = KMicLength; + } + else if ( encryption == WHA::KEncryptTkip ) + { + offset = KMicLength + KWEPICVLength; + } + else if ( encryption == WHA::KEncryptWep ) + { + offset = KWEPICVLength; + } + else if ( encryption == WHA::KEncryptWapi ) + { + offset = KWapiMicLength; + } + else + { + // frame not encrypted; returns zero + } + } + + return offset; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint WlanDot11Associated::ComputeEncryptionOffsetAmount( + const WlanContextImpl& aCtxImpl, + const TDataBuffer& aDataBuffer ) const + { + TUint offset( 0 ); + + if ( // our client has instructed us not the encrypt this frame under + // any circumstances OR + ( aDataBuffer.KeFlags() & TDataBuffer::KTxFrameMustNotBeEncrypted ) || + // no space is reserved for security header on this sw layer. It is + // done on lower layers; when necessary. + ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KNoSecHdrAndTrailer ) ) + { + // We will return zero, so no further actions + } + else + { + // encryption is allowed if relevant and + // space is reserved for IV and/or Ext IV or CCMP header + // on this sw layer; when necessary + + const WHA::TKeyType groupKey( aCtxImpl.GroupKeyType() ); + const WHA::TKeyType pairwiseKey( aCtxImpl.PairWiseKeyType() ); + + if ( pairwiseKey == WHA::EAesPairWiseKey ) + { + offset = KCcmpHeaderLength; + } + else if ( pairwiseKey == WHA::ETkipPairWiseKey ) + { + offset = KWepIVLength + KWepExtendedIVLength; + } + else if ( pairwiseKey == WHA::EWepPairWiseKey ) + { + offset = KWepIVLength; + } + else if ( pairwiseKey == WHA::EWapiPairWiseKey ) + { + offset = KWapiHeaderLength; + } + else + { + // don't care of anything else + } + + if ( !offset ) + { + // no encryption used based on pairwise key presence + // check for WEP groupkey presence + if ( groupKey == WHA::EWepGroupKey ) + { + offset = KWepIVLength; + } + else + { + // don't care of anything else as group key encyption is not + // supported for the other key types. For them we always have + // a pairwise key + } + } + } + + return offset; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint WlanDot11Associated::EncryptTrailerLength( + WlanContextImpl& aCtxImpl, + const TDataBuffer& aDataBuffer ) const + { + TUint length( 0 ); + + if ( // our client has instructed us not the encrypt this frame under + // any circumstances OR + ( aDataBuffer.KeFlags() & TDataBuffer::KTxFrameMustNotBeEncrypted ) || + // no space is reserved for security header on this sw layer. It is + // done on lower layers; when necessary. + ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KNoSecHdrAndTrailer ) ) + { + // We will return zero, so no further actions + } + else + { + // encryption is allowed if relevant and + // space is reserved for ICV and/or MIC + // on this sw layer; when necessary + + const WHA::TKeyType groupKey( aCtxImpl.GroupKeyType() ); + const WHA::TKeyType pairwiseKey( aCtxImpl.PairWiseKeyType() ); + + if ( pairwiseKey == WHA::EAesPairWiseKey ) + { + length = KMicLength; + } + else if ( pairwiseKey == WHA::ETkipPairWiseKey ) + { + length = KMicLength + KWEPICVLength; + } + else if ( pairwiseKey == WHA::EWepPairWiseKey ) + { + length = KWEPICVLength; + } + else if ( pairwiseKey == WHA::EWapiPairWiseKey ) + { + length = KWapiMicLength; + } + else + { + // don't care of anything else + } + + if ( !length ) + { + // no pairwise key present + // check for groupkey + if ( groupKey == WHA::EWepGroupKey ) + { + length = KWEPICVLength; + } + else + { + // don't care of anything else as group key encyption is not + // supported for the other key types. For them we always have + // a pairwise key + } + } + } + + return length; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint WlanDot11Associated::ComputeQosOffsetAmount( + WlanContextImpl& aCtxImpl ) const + { + const TUint KNoQosHeader( 0 ); + + if ( aCtxImpl.QosEnabled() ) + { + return sizeof( T802Dot11QosControl ); + } + else + { + return KNoQosHeader; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::EncapsulateEthernetFrame( + WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer, + TUint16& aEtherType ) const + { + TUint8* etherFrameBeginning ( aDataBuffer.GetBuffer() ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11Associated::EncapsulateEthernetFrame: supplied ether frame start address: 0x%08x"), + reinterpret_cast(etherFrameBeginning) ); + + // start of dot11 frame + SDataFrameHeader* dot11_dataframe_hdr ( NULL ); + + // start of ethernet frame + const SEthernetHeader* ether_hdr + = reinterpret_cast(etherFrameBeginning); + + // determine Ethernet type + aEtherType = ether_hdr->Type(); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: ether type: 0x%04x"), + aEtherType ); + + // compute space required for encryption header + // after dot11 radio header and before data payload + const TUint encryption_offset = ( + ComputeEncryptionOffsetAmount( aCtxImpl, aDataBuffer ) ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: encryption_offset: %d"), + encryption_offset ); + + const TUint32 ether_offset = (KMacAddressLength << 1); + + // take a backup copy of the destination and source addresses from the + // ethernet frame as they will get overwritten + + TMacAddress da; + os_memcpy( + reinterpret_cast(&da), + etherFrameBeginning, + sizeof( TMacAddress ) ); + TMacAddress sa; + os_memcpy( + reinterpret_cast(&sa), + etherFrameBeginning + sizeof( TMacAddress ), + sizeof( TMacAddress ) ); + + // compute space possibly required at the end of the dot11 mac + // header for the QoS control field, which is required for QoS data frames + // This will be needed (i.e. the qosOffset will be > 0) if QoS is enabled + const TUint qosOffset = ComputeQosOffsetAmount( aCtxImpl ); + // the mac header of HT QoS data frames also has an additional field, + // so determine if that field needs to be present and hence has a non-zero + // length + const TUint KHtControlOffset ( aCtxImpl.HtSupportedByNw() ? + KHtControlFieldLength : 0 ); + + if ( qosOffset ) + { + // a QoS data frame + + OsTracePrint( KWsaTxDetails | KQos, (TUint8*) + ("UMAC: qos data frame")); + + SQosDataFrameHeader* dot11QosDataFrameHdr = + reinterpret_cast( + etherFrameBeginning + + ether_offset + - sizeof( KEncapsulatingRfc1042SnapHeader ) + - encryption_offset + - KHtControlOffset + - sizeof( SQosDataFrameHeader ) ); + + // construct the MAC header + new (dot11QosDataFrameHdr) SQosDataFrameHeader; + + // set the frame type + dot11QosDataFrameHdr->iHdr.iFrameControl.iType = E802Dot11FrameTypeQosData; + + // reset the QoS control field + // => ack policy == acknowledge && priority == best effort + dot11QosDataFrameHdr->ResetQosControl(); + + // set the user priority + dot11QosDataFrameHdr->SetUserPriority( aDataBuffer.UserPriority() ); + + dot11_dataframe_hdr = reinterpret_cast( + dot11QosDataFrameHdr); + + if ( KHtControlOffset ) + { + // HT control field is present => order bit needs to be set + dot11QosDataFrameHdr->iHdr.SetOrderBit(); + + // clear the HT Control field, too + reinterpret_cast( + dot11QosDataFrameHdr)->ResetHtControl(); + } + else + { + // HT control field is not present => order bit needs to be cleared + dot11QosDataFrameHdr->iHdr.ClearOrderBit(); + } + } + else + { + // a non-QoS data frame + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: non-qos data frame")); + + dot11_dataframe_hdr = reinterpret_cast( + etherFrameBeginning + + ether_offset + - sizeof( KEncapsulatingRfc1042SnapHeader ) + - encryption_offset + - sizeof( SDataFrameHeader ) ); + + // construct the MAC header. In this case this also sets the frame type + // correctly + new (dot11_dataframe_hdr) SDataFrameHeader; + } + + // set the source address + dot11_dataframe_hdr->iAddress2 = sa; + + // set the destination address + DoSetTxMpduDaAddress( *dot11_dataframe_hdr, da ); + + // set the To DS bit + if ( aCtxImpl.NetworkOperationMode() == WHA::EBSS ) + { + dot11_dataframe_hdr->SetToDsBit(); + // set the BSS ID + dot11_dataframe_hdr->iAddress1 = aCtxImpl.GetBssId(); + } + else + { + dot11_dataframe_hdr->ClearToDsBit(); + // set the BSS ID + dot11_dataframe_hdr->iAddress3 = aCtxImpl.GetBssId(); + } + + // determine if the frame needs to be encrypted + if ( EncryptTxFrames( aCtxImpl, aDataBuffer ) ) + { + dot11_dataframe_hdr->SetWepBit(); + } + else + { + dot11_dataframe_hdr->ClearWepBit(); + } + + // set the snap header to correct location. + os_memcpy( + reinterpret_cast(dot11_dataframe_hdr) + + sizeof( SDataFrameHeader ) + + qosOffset + + KHtControlOffset + // space occupied by encryption header(s) + + encryption_offset, + &KEncapsulatingRfc1042SnapHeader, + sizeof( KEncapsulatingRfc1042SnapHeader ) ); + + // clear the area reserved for IV etc, when necessary + if ( encryption_offset ) + { + os_memset( + reinterpret_cast(dot11_dataframe_hdr) + + sizeof( SDataFrameHeader ) + + qosOffset + + KHtControlOffset, + 0, + encryption_offset ); + } + + // compute padding required for encryption trailer (ICV, MIC etc) + const TUint encryptTrailerLength = ( + EncryptTrailerLength( aCtxImpl, aDataBuffer ) ); + + // clear the area reserved for encryption trailer, when necessary + if ( encryptTrailerLength ) + { + os_memset( + reinterpret_cast(dot11_dataframe_hdr) + + sizeof( SDataFrameHeader ) + + qosOffset + + KHtControlOffset + + encryption_offset + + sizeof( SSnapHeader ) + + aDataBuffer.GetLength() - ether_offset, + 0, + encryptTrailerLength ); + } + + // calculate frame length + const TUint length_of_frame = + // MAC header length + sizeof( SDataFrameHeader ) + // length of possibly existing QoS control field + + qosOffset + // length of possibly existing HT control field + + KHtControlOffset + // SNAP header length + + sizeof( SSnapHeader ) + // length of ethernet payload (including ether type) + + aDataBuffer.GetLength() - ether_offset + // encryption header length + + encryption_offset + // encryption trailer length + + encryptTrailerLength; + + // we now have a dot11 frame ready to be sent + aDataCntx.Dot11FrameReady( + reinterpret_cast(dot11_dataframe_hdr), + length_of_frame ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: length_of_frame (excl. fcs): %d"), + length_of_frame ); + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: frame start address: 0x%08x"), + reinterpret_cast(dot11_dataframe_hdr) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::EncapsulateSnapFrame( + WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer, + TBool aEncrypt, + TUint aEncryptionOffset, + TUint aEncryptTrailerLength, + TUint aQosOffset, + TUint aHtControlOffset ) const + { + // extract start of frame. The frame starts with a SNAP header + TUint8* snapFrameBeginning ( aDataBuffer.GetBuffer() ); + + // start of dot11 frame + SDataFrameHeader* dot11_dataframe_hdr( NULL ); + + if ( aQosOffset ) + { + OsTracePrint( KWsaTxDetails | KQos, (TUint8*) + ("UMAC: qos data frame")); + + SQosDataFrameHeader* dot11QosDataFrameHdr( + reinterpret_cast( + snapFrameBeginning + - aEncryptionOffset + - aHtControlOffset + - sizeof( SQosDataFrameHeader )) ); + + // construct the MAC header + new (dot11QosDataFrameHdr) SQosDataFrameHeader; + + // set the frame type + dot11QosDataFrameHdr->iHdr.iFrameControl.iType = E802Dot11FrameTypeQosData; + + // reset the QoS control field + // => ack policy == acknowledge && priority == best effort + dot11QosDataFrameHdr->ResetQosControl(); + + // set the user priority + dot11QosDataFrameHdr->SetUserPriority( aDataBuffer.UserPriority() ); + + dot11_dataframe_hdr = reinterpret_cast( + dot11QosDataFrameHdr); + + if ( aHtControlOffset ) + { + // HT control field is present => order bit needs to be set + dot11QosDataFrameHdr->iHdr.SetOrderBit(); + // clear the HT Control field, too + reinterpret_cast( + dot11QosDataFrameHdr)->ResetHtControl(); + } + else + { + // HT control field is not present => order bit needs to be cleared + dot11QosDataFrameHdr->iHdr.ClearOrderBit(); + } + } + else + { + OsTracePrint( KWsaTxDetails | KQos, (TUint8*) + ("UMAC: non-qos data frame")); + + dot11_dataframe_hdr = reinterpret_cast( + snapFrameBeginning + - aEncryptionOffset + - sizeof( SDataFrameHeader ) ); + + // construct the MAC header. In this case this also sets the frame type + // correctly + new (dot11_dataframe_hdr) SDataFrameHeader; + } + + // set the source address + dot11_dataframe_hdr->iAddress2 = aCtxImpl.iWlanMib.dot11StationId; + + // set the destination address + DoSetTxMpduDaAddress( *dot11_dataframe_hdr, + aDataBuffer.KeDestinationAddress() ); + + // set the To DS bit + if ( aCtxImpl.NetworkOperationMode() == WHA::EBSS ) + { + dot11_dataframe_hdr->SetToDsBit(); + // set the BSS ID + dot11_dataframe_hdr->iAddress1 = aCtxImpl.GetBssId(); + } + else + { + dot11_dataframe_hdr->ClearToDsBit(); + // set the BSS ID + dot11_dataframe_hdr->iAddress3 = aCtxImpl.GetBssId(); + } + + // determine if the frame needs to be encrypted + if ( aEncrypt ) + { + dot11_dataframe_hdr->SetWepBit(); + } + else + { + dot11_dataframe_hdr->ClearWepBit(); + } + + // clear the area reserved for IV etc, when necessary + if ( aEncryptionOffset ) + { + os_memset( + reinterpret_cast(dot11_dataframe_hdr) + + sizeof( SDataFrameHeader ) + + aQosOffset + + aHtControlOffset, + 0, + aEncryptionOffset ); + } + + // clear the area reserved for encryption trailer, when necessary + if ( aEncryptTrailerLength ) + { + os_memset( + reinterpret_cast(dot11_dataframe_hdr) + + sizeof( SDataFrameHeader ) + + aQosOffset + + aHtControlOffset + + aEncryptionOffset + + aDataBuffer.GetLength(), + 0, + aEncryptTrailerLength ); + } + + // calculate frame length + const TUint length_of_frame = + // MAC header length + sizeof( SDataFrameHeader ) + + // length of possibly existing QoS control field + aQosOffset + + // length of possibly existing HT control field + aHtControlOffset + + // payload (including SNAP header) + aDataBuffer.GetLength() + // encryption header length + + aEncryptionOffset + // encryption trailer length + + aEncryptTrailerLength; + + // we now have a dot11 frame ready to be sent + aDataCntx.Dot11FrameReady( + reinterpret_cast(dot11_dataframe_hdr), + length_of_frame ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: length_of_frame: %d"), + length_of_frame ); + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: frame start address: 0x%08x"), + reinterpret_cast(dot11_dataframe_hdr) ); + // trace the dot11 frame header + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: Encapsulated prorietary SNAP Tx frame:"), + *(reinterpret_cast(dot11_dataframe_hdr))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::SetDot11FrameToTxBuffer( + const WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer ) const + { + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11Associated::SetDot11FrameToTxBuffer") ); + + if ( aCtxImpl.HtSupportedByNw() && aCtxImpl.QosEnabled() ) + { + // in this case we need to insert the HT Control field to the + // otherwise ready 802.11 MAC frame + + const TUint KOrigLengthOfFrame = aDataBuffer.GetLength(); + const TUint KMgmtFrameMacHdrLen = sizeof( SManagementFrameHeader ); + TUint8* KFrameStart = aDataBuffer.GetBuffer(); + + os_memcpy( + KFrameStart + + KMgmtFrameMacHdrLen + + KHtControlFieldLength, + KFrameStart + + KMgmtFrameMacHdrLen, + KOrigLengthOfFrame - KMgmtFrameMacHdrLen ); + + // clear the added HT Control field + reinterpret_cast( + KFrameStart)->ResetHtControl(); + // update frame length + aDataBuffer.KeSetLength( KOrigLengthOfFrame + KHtControlFieldLength ); + // as the HT control field is present the order bit needs to be set + reinterpret_cast( + KFrameStart)->iMgmtFrameHdr.SetOrderBit(); + } + + // we now have a dot11 frame ready to be sent + aDataCntx.Dot11FrameReady( + aDataBuffer.GetBuffer(), + aDataBuffer.GetLength() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::EncapsulateFrame( + WlanContextImpl& aCtxImpl, + TWlanUserTxDataCntx& aDataCntx, + TDataBuffer& aDataBuffer, + TUint16& aEtherType ) + { + const TDataBuffer::TFrameType KFrameType( aDataBuffer.FrameType() ); + + OsTracePrint( KWsaTx, (TUint8*) + ("UMAC: WlanDot11Associated::EncapsulateFrame: frame type: %d"), + KFrameType ); + + if ( KFrameType == TDataBuffer::KEthernetFrame || + KFrameType == TDataBuffer::KEthernetTestFrame ) + { + // ethernet II frame in the buffer for tx + + EncapsulateEthernetFrame( + aCtxImpl, + aDataCntx, + aDataBuffer, + aEtherType ); + } + else if ( KFrameType == TDataBuffer::KSnapFrame ) + { + // frame beginning with a SNAP header in the buffer for tx + + EncapsulateSnapFrame( + aCtxImpl, + aDataCntx, + aDataBuffer, + EncryptTxFrames( aCtxImpl, aDataBuffer ), + ComputeEncryptionOffsetAmount( aCtxImpl, aDataBuffer ), + EncryptTrailerLength( aCtxImpl, aDataBuffer ), + ComputeQosOffsetAmount( aCtxImpl ), + aCtxImpl.HtSupportedByNw() ? + KHtControlFieldLength : + 0 ); + } + else if ( KFrameType == TDataBuffer::KDot11Frame ) + { + // ready made 802.11 frame in the buffer for tx + + SetDot11FrameToTxBuffer( aCtxImpl, aDataCntx, aDataBuffer ); + } + else + { + // not supported + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: frame_type: %d"), + KFrameType ); + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ) + { + TWlanUserTxDataCntx& data_cntx( aCtxImpl.GetTxDataCntx() ); + + TBool stateChange( EFalse ); + + if ( (aCtxImpl.ProtocolStackTxDataAllowed()) ) + { + // protocol stack tx data allowed + // now construct a dot11 frame from databuffer to storage + + TUint16 etherType( 0 ); // initial value: not relevant + + // construct the frame + EncapsulateFrame( aCtxImpl, data_cntx, aDataBuffer, etherType ); + + // dot11 frame ready to be sent so push it to the packet sceduler + + // start of dot11 frame to send + const TUint8* start_of_frame( + data_cntx.StartOfFrame() ); + + // select correct tx queue + const WHA::TQueueId queue_id( + QueueId( aCtxImpl, start_of_frame ) ); + + // push the frame to packet scheduler for transmission + aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + data_cntx.LengthOfFrame(), + queue_id, + E802Dot11FrameTypeData, + &aDataBuffer, + aMore, + OutgoingMulticastDataFrame( + reinterpret_cast( start_of_frame ) ) ); + // now just wait for the scheduler to call completion methods + + // check if we need to change power mgmt mode because of frame Tx + const TPowerMgmtModeChange KPowerMgmtModeChange ( + aCtxImpl.OnFrameTx( queue_id, etherType ) ); + + // if any change change is needed regarding our power mgmt mode, + // proceed with it + stateChange = PowerMgmtModeChange( aCtxImpl, KPowerMgmtModeChange ); + } + else + { + // protocol stack tx data not allowed + +#ifndef NDEBUG + // programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: Tx attempted when it's not allowed") ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); +#else + aCtxImpl.iUmac.OnTxProtocolStackDataComplete( + KErrNone, + &aDataBuffer ); +#endif + } + + return stateChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 /*aPacketQueueDelay*/, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ) + { + if ( aPacketId == E802Dot11FrameTypeData || + aPacketId == E802Dot11FrameTypeDataEapol ) + { + // update data frame statistics + UpdateTxDataFrameStatistics( + aCtxImpl, + aQueueId, + aStatus, + aMulticastData, + aAckFailures, + aMediaDelay, + aTotalTxDelay ); + } + else if ( aPacketId == E802Dot11FrameTypeQosDataNull ) + { + // inform Null Data frame sending controller of QoS Null data Tx + // completion; successful or not + aCtxImpl.OnQosNullDataTxCompleted(); + } + else if ( aPacketId == E802Dot11FrameTypeDataNull ) + { + // inform Null Data frame sending controller of Null data Tx + // completion; successful or not + aCtxImpl.OnNullDataTxCompleted(); + } + + if ( aStatus == WHA::KSuccess ) + { + aCtxImpl.OnTxCompleted( aRate, ETrue, aQueueId, aRequestedRate ); + + aCtxImpl.ResetFailedTxPacketCount(); + DoRegainedBSSIndication( aCtxImpl ); + + if ( aPacketId == E802Dot11FrameTypeData || + aPacketId == E802Dot11FrameTypeDataEapol || + aPacketId == E802Dot11FrameTypeTestFrame ) + { + // inform Null Data frame sending controller of successful + // data frame Tx completion + aCtxImpl.OnDataTxCompleted( + aPacketId == E802Dot11FrameTypeDataEapol ? + // as EAPOL and WAI frames or not really Voice data (we just + // send them with Voice priority in WMM nw), handle them + // here as Best Effort (Legacy) + WHA::ELegacy : + aQueueId ); + } + } + else if ( aStatus == WHA::KErrorLifetimeExceeded && !aAckFailures ) + { + // the packet was discarded by WLAN PDD without any Tx attempts + // So this is not a Tx failure and we don't need to take + // any further actions + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11Associated::OnPacketSendComplete: packet expired in PDD without any Tx attempts)")); + } + else + { + // an actual Tx failure has occurred + + aCtxImpl.OnTxCompleted( aRate, EFalse, aQueueId, aRequestedRate ); + + aCtxImpl.IncrementFailedTxPacketCount(); + + // if we have failed to send more than threshold number of + // consecutive packets, send Consecutive Tx Failures indication to + // WLAN Mgmt Client - unless already sent + if ( aCtxImpl.FailedTxPacketCount() > + aCtxImpl.iWlanMib.iFailedTxPacketCountThreshold ) + { + DoConsecutiveTxFailuresIndication( aCtxImpl ); + aCtxImpl.ResetFailedTxPacketCount(); + } + } + + aCtxImpl.iUmac.OnTxDataSent(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::DoConsecutiveBeaconsLostIndication( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.OnConsecutiveBeaconsLost() ) + { + OnInDicationEvent( aCtxImpl, EConsecutiveBeaconsLost ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Associated::DoConsecutiveTxFailuresIndication( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.OnConsecutiveTxFailures() ) + { + OnInDicationEvent( aCtxImpl, EConsecutiveTxFailures ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::DoRegainedBSSIndication( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.OnBssRegained() ) + { + OnInDicationEvent( aCtxImpl, EBSSRegained ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::AddMulticastAddr( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr ) + { + TBool stateTransitionOccurred( EFalse ); + + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::AddMulticastAddr(): addr to be added:"), + aMacAddr); + + if ( aCtxImpl.MulticastFilteringDisAllowed() ) + { + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::AddMulticastAddr(): Multicast filtering disallowed")); + + OnOidComplete( aCtxImpl, KErrGeneral ); + } + else + { + if ( aCtxImpl.WHASettings().iNumOfGroupTableEntrys > + aCtxImpl.MulticastAddressCount() ) + { + // wha layer is able to take in an address + + // 1st try to add the address to our own internal bookkeeping + WlanContextImpl::TGroupAddStatus addStatus = + aCtxImpl.AddMulticastAddress( aMacAddr ); + + switch ( addStatus ) + { + case WlanContextImpl::EOk: + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::AddMulticastAddr(): Address will be added to the MIB")); + // the address needed to be added and adding went ok. + // Now update the group addresses MIB + stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); + break; + case WlanContextImpl::EAlreadyExists: + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::AddMulticastAddr(): Address already exists")); + // the specified address already exists so there's no need + // to update the group addresses MIB + // just complete the request with OK status + OnOidComplete( aCtxImpl ); + stateTransitionOccurred = EFalse; + break; + case WlanContextImpl::EFull: + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::AddMulticastAddr(): Internal address table full; disallow multicast filtering")); + // we are not able to take in any more addresses. + // We will totally disable the multicast filtering + // and we won't allow it to be enabled any more during + // the current nw connection + // + aCtxImpl.ResetMulticastAddresses(); + aCtxImpl.MulticastFilteringDisAllowed( ETrue ); + stateTransitionOccurred = + SetGroupAddressesTableMib( aCtxImpl ); + break; + default: + // programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: addStatus: %d"), addStatus ); + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::AddMulticastAddr(): WHA not able to accept address; disallow multicast filtering")); + // wha layer is not able to take in an address. Either this is one + // address too many, or it doesn't support even a single address. + // In either case we will totally disable the multicast filtering + // and we won't allow it to be enabled any more during the current + // nw connection + aCtxImpl.ResetMulticastAddresses(); + aCtxImpl.MulticastFilteringDisAllowed( ETrue ); + stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); + } + } + + // signal caller whether a state transition occurred or not + return stateTransitionOccurred; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::RemoveMulticastAddr( + WlanContextImpl& aCtxImpl, + TBool aRemoveAll, + const TMacAddress& aMacAddr ) + { + TBool stateTransitionOccurred( EFalse ); + + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): addr to be removed:"), + aMacAddr); + + if ( aCtxImpl.MulticastFilteringDisAllowed() ) + { + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): Multicast filtering disallowed")); + // filtering is not allowed currently so there can't be any addresses + // to remove. Just complete the request with OK status + OnOidComplete( aCtxImpl ); + } + else + { + if ( aRemoveAll ) + { + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): remove all")); + // remove all addresses; naturally will also disable filtering + aCtxImpl.ResetMulticastAddresses(); + stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); + } + else + { + // 1st remove the specified address from our own internal + // bookkeeping, if it exists + if ( aCtxImpl.RemoveMulticastAddress( aMacAddr ) ) + { + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): removing the specified address")); + // it existed, so update the group addresses MIB, too + stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); + } + else + { + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): specified address doesn't exist, nothing to do")); + // it did't exist, so there's nothing to remove + // Just complete the request with OK status + OnOidComplete( aCtxImpl ); + } + } + } + + // signal caller whether a state transition occurred or not + return stateTransitionOccurred; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ) + { + return OnAddBroadcastWepKey( aCtxImpl, aKeyIndex, aUseAsDefaulKey, + EFalse, // do NOT set as PTK + aKeyLength, aKey, aMac ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11Associated::ConfigureTxQueueIfNecessary( + WlanContextImpl& aCtxImpl, + TQueueId aQueueId, + TUint16 aMediumTime, + TUint32 aMaxTxMSDULifetime ) + { + // this cast is safe as the types are effectively the same + const WHA::TQueueId whaQueueId = static_cast(aQueueId); + + if ( aMediumTime != aCtxImpl.iWlanMib.iMediumTime[whaQueueId] || + aMaxTxMSDULifetime != + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[whaQueueId] ) + { + // at least one of the parameters for this queue is changed => a + // reconfiguration is needed + + // update the queue parameters. These values will be used in the + // queue reconfiguration + + aCtxImpl.iWlanMib.iMediumTime[aQueueId] = aMediumTime; + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[whaQueueId] = + aMaxTxMSDULifetime; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Associated::ConfigureTxQueueIfNecessary: reconfiguring the queue is necessary") ); + + // reconfigure the queue. Also request the WLAN mgmt client request + // to be completed + return ConfigureTxQueue( aCtxImpl, whaQueueId, ETrue ); + } + else + { + // the provided queue parameters have not changed, so no need to + // reconfigure the queue + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Associated::ConfigureTxQueueIfNecessary: no queue reconfigure is necessary") ); + + // complete the WLAN Mgmt Client request + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::SetGroupAddressesTableMib( + WlanContextImpl& aCtxImpl ) + { + const TMacAddress* multicastAddresses( NULL ); + const TUint32 nbrOfAddrs( + aCtxImpl.GetMulticastAddresses( multicastAddresses ) ); + + TUint32 mibLength( + // mib header length + WHA::Sdot11GroupAddressesTable::KHeaderSize + // + mib data length + + ( sizeof( TMacAddress ) * nbrOfAddrs ) ); + + // align length of MIB to 4-byte boundary + mibLength = Align4( mibLength ); + + OsTracePrint( + KWlmCmdDetails, + (TUint8*) + ("UMAC: WlanDot11Associated::SetGroupAddressesTableMib(): mibLength: %d"), + mibLength ); + + // allocate memory for the mib to write + WHA::Sdot11GroupAddressesTable* mib + = static_cast + (os_alloc( mibLength )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Associated::SetGroupAddressesTableMib(): memory allocating failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + if ( nbrOfAddrs ) + { + // at least one address exists, so enable multicast address filtering + mib->iEnable = ETrue; + } + else + { + // no addresses, so disable filtering + mib->iEnable = EFalse; + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: WlanDot11Associated::SetGroupAddressesTableMib(): no addresses; disable filtering") ); + } + + mib->iNumOfAddrs = nbrOfAddrs; + + // copy the multicast addresses after the mib header + os_memcpy( mib->iAddrData, + reinterpret_cast(const_cast( + multicastAddresses)), + ( sizeof( TMacAddress ) * nbrOfAddrs ) ); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibDot11GroupAddressesTable, + mibLength, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( mib ); // release the allocated memory + + // signal caller that a state transition occurred + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::PowerMgmtModeChange( + WlanContextImpl& aCtxImpl, + TPowerMgmtModeChange aPowerMgmtModeChange ) + { + TBool stateChange ( EFalse ); + + if ( aPowerMgmtModeChange != ENoChange ) + { + // power mgmt mode change needed + + if ( aPowerMgmtModeChange == EToActive ) + { + aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsDisable ); + } + else if ( aPowerMgmtModeChange == EToLightPs ) + { + aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsEnable ); + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientLightPsModeConfig() ); + } + else // aPowerMgmtModeChange == EToDeepPs + { + aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsEnable ); + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientDeepPsModeConfig() ); + } + + if ( !(aCtxImpl.WsaCmdActive()) ) + { + // proceed with the power mgmt mode change + stateChange = ChangePowerMgmtMode( aCtxImpl ); + } + else + { + // WHA command is in progress so we must defer this access + aCtxImpl.RegisterEvent( KPowerMgmtTransition ); + + OsTracePrint( KEventDispatcher | KPwrStateTransition, + (TUint8*)("UMAC: WlanDot11Associated::PowerMgmtModeChange: power mgmt mode change event registered")); + } + } + + return stateChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Associated::HandleProprietarySnapRxFrame( + TDataBuffer& aBuffer, + TBool aQosData, + const TAny* const aFrame, + const SAmsduSubframeHeader* aSubFrameHeader, + TUint aLength, + TUint aDecryptHeaderLen, + TUint aDecryptTrailerLen, + TUint aHtControlLen, + TUint8* aCopyBuffer ) const + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::HandleProprietarySnapRxFrame")); + + // prepare received frame with proprietary SNAP header for wlan mgmt client + // Remove the possibly existing security header & trailer before + // passing the frame up + + const TUint8* frameBeginning = reinterpret_cast(aFrame); + const TUint KMacHdrLen( aQosData ? + sizeof( SQosDataFrameHeader ) + aHtControlLen : + sizeof( SDataFrameHeader ) ); + // subframe header length is non-zero only if the frame is part of an + // A-MSDU, i.e. if aCopyBuffer is not NULL + const TUint KSubframeHdrLen ( + aCopyBuffer ? sizeof( SAmsduSubframeHeader ) : 0 ); + // determine subframe length + const TUint KSubframeLen ( + aSubFrameHeader ? aSubFrameHeader->Length() : 0 ); + + if ( aCopyBuffer ) + { + // the frame needs to be copied to the copy buffer, which means + // that it is part of an A-MSDU + + // 1st copy the MAC header + os_memcpy( aCopyBuffer, frameBeginning, KMacHdrLen ); + + // then copy the subframe body following the subframe header + os_memcpy( + aCopyBuffer + + KMacHdrLen, + reinterpret_cast(aSubFrameHeader) + KSubframeHdrLen, + KSubframeLen ); + + // update to point to the new location + frameBeginning = aCopyBuffer; + } + else + { + // no copying to the copy buffer is required + + if ( aDecryptHeaderLen ) + { + // decrypt header exists. Shift the MAC header so that it + // overwrites the decrypt header, thus removing it + + TUint8* dest( const_cast(frameBeginning) + + aDecryptHeaderLen ); + + TUint copyBlockSize( aQosData ? + sizeof( SQosDataFrameHeader ) + aHtControlLen : + sizeof( SDataFrameHeader ) ); + + os_memcpy( dest, frameBeginning, copyBlockSize ); + + // update to point to the new location + frameBeginning = dest; + } + } + +#ifndef NDEBUG + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11Associated::HandleProprietarySnapRxFrame: MPDU header:"), + *(reinterpret_cast( + frameBeginning))); +#endif + + // set the frame length + if ( aCopyBuffer ) + { + aBuffer.KeSetLength( KMacHdrLen + KSubframeLen ); + } + else + { + aBuffer.KeSetLength( + aLength - aDecryptHeaderLen - aDecryptTrailerLen ); + } + // set the frame type + aBuffer.FrameType( TDataBuffer::KDot11Frame ); + // set the offset to the beginning of the actual frame within the + // Rx buffer + aBuffer.KeSetOffsetToFrameBeginning( + frameBeginning // frame beginning + - aBuffer.KeGetBufferStart() ); // buffer beginning + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Associated::ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11Associated::ConfigureTxRatePolicies")); + + TBool stateChange( EFalse ); + + if ( aCtxImpl.ProtocolStackTxDataAllowed() ) + { + // store the provided information ... + StoreTxRatePolicyInfo( + aCtxImpl, + aRatePolicy, + aQueue2RateClass, + aInitialMaxTxRate4RateClass, + aAutoRatePolicy, + aHtMcsPolicy ); + + // ... take it into use; and specify that the mgmt client request needs + // to be completed when doing it + stateChange = WlanDot11State::ConfigureTxRatePolicies( aCtxImpl, + ETrue ); + if ( !stateChange ) + { + // a fatal error occurred. Simulate MAC Not Responding error + // Note that the Mgmt Client request will be completed when + // entering the dot11error state + stateChange = DoErrorIndication( + aCtxImpl, + WHA::KErrorMacNotResponding ); + } + } + else + { + // as user data is not allowed currently, it means that WLAN Mgmt client + // will request us to connect to a new nw shortly and this policy is for + // that new nw. So we shouldn't take the new rate policy into use yet, + // as we don't know which rates the new nw will be supporting. We just + // store the provided information for later use + stateChange = WlanDot11State::ConfigureTxRatePolicies( + aCtxImpl, + aRatePolicy, + aQueue2RateClass, + aInitialMaxTxRate4RateClass, + aAutoRatePolicy, + aHtMcsPolicy ); + } + + return stateChange; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11Associated::ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& aCtxImpl, + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Associated::ConfigurePwrModeMgmtTrafficOverride")); + + aCtxImpl.ConfigurePwrModeMgmtTrafficOverride( + aStayInPsDespiteUapsdVoiceTraffic, + aStayInPsDespiteUapsdVideoTraffic, + aStayInPsDespiteUapsdBestEffortTraffic, + aStayInPsDespiteUapsdBackgroundTraffic, + aStayInPsDespiteLegacyVoiceTraffic, + aStayInPsDespiteLegacyVideoTraffic, + aStayInPsDespiteLegacyBestEffortTraffic, + aStayInPsDespiteLegacyBackgroundTraffic ); + + // as we are already connected and aware of the network capabilities, we + // also need to freeze the dynamic power mode mgmt traffic + // override/ignoration settings so that they become immediately effective + aCtxImpl.FreezePwrModeMgmtTrafficOverride(); + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11AssociationPending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11AssociationPending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,994 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11AssociationPending class +* +*/ + +/* +* %version: 45 % +*/ + +#include "config.h" +#include "UmacDot11AssociationPending.h" +#include "UmacContextImpl.h" +#include "umacelementlocator.h" +#include "umacwhaconfigureac.h" +#include "802dot11DefaultValues.h" + +#ifndef NDEBUG +const TInt8 WlanDot11AssociationPending::iName[] = "dot11-associationpending"; + +const TUint8 WlanDot11AssociationPending::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ETXASSOCREQFRAME"}, + {"EWAIT4ASSOCRESPONSE"}, + {"ECONFIGUREAC"}, + {"EWAIT4PUSHPACKET"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11AssociationPending::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ERXASSOCRESPONSE"}, + {"ETX_ASSOCFRAME_XFER"}, + {"ETXCOMPLETE"}, + {"ETIMEOUT"}, + {"ETX_SCHEDULER_FULL"}, + {"EPUSHPACKET"} + }; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::Entry( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacProtocolState | KUmacAssoc, + (TUint8*)("UMAC: WlanDot11AssociationPending::Entry()")); + + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // no need to do event dispatching as this + // thing is triggered by the user and + // is executed synchronously as we only do OID completion + // at the end of authenticate + association process + + if ( iState == EINIT ) + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + else + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // reset our local FSM for the next time... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacAssoc, + (TUint8*)("UMAC: WlanDot11AssociationPending::Fsm(): FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacAssoc, (TUint8*)("UMAC: event:")); + OsTracePrint( KUmacAssoc, iEventName[aEvent] ); + OsTracePrint( KUmacAssoc, (TUint8*)("UMAC: state:")); + OsTracePrint( KUmacAssoc, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETX_ASSOCFRAME_XFER: + OnTxAssocFrameXferEvent( aCtxImpl ); + break; + case ERXASSOCRESPONSE: + OnRxAssociationResponseEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ETIMEOUT: + OnTimeoutEvent( aCtxImpl ); + break; + case ETX_SCHEDULER_FULL: + OnTxSchedulerFullEvent( aCtxImpl ); + break; + case EPUSHPACKET: + OnPushPacketEvent( aCtxImpl ); + break; + default: + // cath internal FSM programming error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacAssoc, + (TUint8*)("UMAC: WlanDot11AssociationPending::OnStateEntryEvent()")); + + switch ( iState ) + { + case EINIT: + iFlags = 0; + ChangeInternalState( aCtxImpl, ETXASSOCREQFRAME ); + break; + case ETXASSOCREQFRAME: + // send the associate frame + if ( !SendAssociationRequest( aCtxImpl ) ) + { + // tx of dot11-associate frame failed + // because packet scheduler was full + // or because we didn't get a Tx buffer + // so we enter to a wait state + Fsm( aCtxImpl, ETX_SCHEDULER_FULL ); + } + break; + case EWAIT4ASSOCRESPONSE: + // start a timer to wait for the response frame + StartAssociationFrameResponseTimer( aCtxImpl ); + break; + case ECONFIGUREAC: + ConfigureAc( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + case EWAIT4PUSHPACKET: + // nothing to do here than wait + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for association response timeout event. +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnTimeoutEvent( + WlanContextImpl& aCtxImpl ) + { + // set completion code + // as dot11idle state does the OID completion + aCtxImpl.iStates.iIdleState.Set( KErrTimedOut ); + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// ----------------------------------------------------------------------------- +// Handler for associate request frame +// has been xferred to the WLAN device event +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnTxAssocFrameXferEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + ChangeInternalState( aCtxImpl, EWAIT4ASSOCRESPONSE ); + } + +// ----------------------------------------------------------------------------- +// Handler for rx association response event. +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnRxAssociationResponseEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4ASSOCRESPONSE: + if ( iFlags & KConfigureAc ) + { + ChangeInternalState( aCtxImpl, ECONFIGUREAC ); + } + else + { + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + break; + default: + // this means that we have recieved a valid dot11 + // associate response frame that we are waiting for + // but we are not internally in such a state + // only feasible situation for this is that + // someone has skipped a call to the packet xfer method + // that informs of associate request frame + // xfer to the WLAN device. + // other case is that our fsm is totally messed up + // so we catch this +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ECONFIGUREAC: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for scheduler full event upon trying to tx dot11-associate frame +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnTxSchedulerFullEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: packet scheduler full during association process") ); + + ChangeInternalState( aCtxImpl, EWAIT4PUSHPACKET ); + } + +// ----------------------------------------------------------------------------- +// Handler for push packet to packet scheduler possible event +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnPushPacketEvent( + WlanContextImpl& aCtxImpl ) + { + if ( iState == EWAIT4PUSHPACKET ) + { + ChangeInternalState( aCtxImpl, ETXASSOCREQFRAME ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + if ( iFlags & KAssocSuccess ) + { + // traverse to next dot11state + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iInfrastructureModeInit // next state + ); + } + else + { + // proceed back to idle + // + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::ChangeInternalState(): old state:")); +#ifndef NDEBUG + OsTracePrint( KUmacAssoc, iStateName[iState] ); + OsTracePrint( KUmacAssoc, (TUint8*)("new state:")); + OsTracePrint( KUmacAssoc, iStateName[aNewState] ); +#endif + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11AssociationPending::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11AssociationPending::SendAssociationRequest( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::SendAssociationRequest")); + + TBool status ( EFalse ); + TUint8* startOfFrame ( NULL ); + + const TUint32 length_of_frame + = ConstructAssociationRequestFrame( aCtxImpl, startOfFrame ); + + if ( length_of_frame ) + { + // frame is ready for delivery in the tx buffer + // send association request message to the AP + + const WHA::TQueueId queue_id + = QueueId( aCtxImpl, startOfFrame ); + + // push the frame to packet scheduler for transmission + status = aCtxImpl.PushPacketToPacketScheduler( + startOfFrame, + length_of_frame, + queue_id, + E802Dot11FrameTypeAssociationReq, + NULL, + EFalse, + EFalse, + ETrue ); + + if ( !status ) + { + // as we came here we did get an internal Tx buffer for the frame + // but packet push to scheduler failed. In this case we need cancel + // the internal Tx buffer reservation as we will request it again + // when the Packet Scheduler is again ready for packet push + aCtxImpl.MarkInternalTxBufFree(); + } + } + else + { + // frame not ready for delivery. EFalse will be returned + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUint WlanDot11AssociationPending::ConstructAssociationRequestFrame( + WlanContextImpl& aCtxImpl, + TUint8*& aStartOfFrame ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::ConstructAssociationRequestFrame") ); + + TUint32 lengthOfFrame ( 0 ); + + // client doesn't have to take care of the tx buffer header space + // as the method below does that by itself + aStartOfFrame = aCtxImpl.TxBuffer( ETrue ); + + if ( aStartOfFrame ) + { + // construct association request frame + // note that we don't need to set SA because we have already set it + // in the initialization phase of the state machine + // Also capabilty information field is already set to frame template + // in AreNetworkRequirementsMet() method + + TUint8* buffer_ptr = aStartOfFrame; + + if ( aCtxImpl.HtSupportedByNw() && aCtxImpl.QosEnabled() ) + { + // set the BSSID field + (aCtxImpl.GetHtAssociationRequestFrame()).iHeader.iBSSID = + aCtxImpl.GetBssId(); + // set the DA field + (aCtxImpl.GetHtAssociationRequestFrame()).iHeader.iDA = + aCtxImpl.GetBssId(); + // set listen interval (in units of beacon interval) + (aCtxImpl.GetHtAssociationRequestFrame()).iFixedFields.iListenInterval + = KDot11ListenIntervalInMs / aCtxImpl.NetworkBeaconInterval(); + + // copy frame to tx-buffer to correct offset + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetHtAssociationRequestFrame()), + sizeof( SHtAssociationRequestFrame ) ); + + buffer_ptr += sizeof( SHtAssociationRequestFrame ); + } + else + { + // set the BSSID field + (aCtxImpl.GetAssociationRequestFrame()).iHeader.iBSSID = + aCtxImpl.GetBssId(); + // set the DA field + (aCtxImpl.GetAssociationRequestFrame()).iHeader.iDA = + aCtxImpl.GetBssId(); + // set listen interval (in units of beacon interval) + (aCtxImpl.GetAssociationRequestFrame()).iFixedFields.iListenInterval + = KDot11ListenIntervalInMs / aCtxImpl.NetworkBeaconInterval(); + + // copy frame to tx-buffer to correct offset + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetAssociationRequestFrame()), + sizeof( SAssociationRequestFrame ) ); + + buffer_ptr += sizeof( SAssociationRequestFrame ); + } + + // set SSID IE + + SSsIdIE ssid_ie( (aCtxImpl.GetSsId()).ssid, + (aCtxImpl.GetSsId()).ssidLength ); + + const TUint8 ssidIeLength( ssid_ie.GetIeLength() ); + + os_memcpy( + buffer_ptr, + &ssid_ie, + ssidIeLength ); + + buffer_ptr += ssidIeLength; + + // set supported rates IE + + const TUint8 supportedRatesIeLength( + aCtxImpl.GetOurSupportedRatesIE().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetOurSupportedRatesIE()), + supportedRatesIeLength ); + + buffer_ptr += supportedRatesIeLength; + + if ( aCtxImpl.HtSupportedByNw() ) + { + // set HT capabilities element + + const TUint8 htCapabilitiesIeLength( + aCtxImpl.GetOurHtCapabilitiesIe().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetOurHtCapabilitiesIe()), + htCapabilitiesIeLength ); + + buffer_ptr += htCapabilitiesIeLength; + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: HT capabilities element added") ); + } + + // set extended supported rates IE if it's not empty + if ( aCtxImpl.GetOurExtendedSupportedRatesIE().GetElementLength() ) + { + const TUint8 extSupportedRatesIeLength( + aCtxImpl.GetOurExtendedSupportedRatesIE().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetOurExtendedSupportedRatesIE()), + extSupportedRatesIeLength ); + + buffer_ptr += extSupportedRatesIeLength; + } + + // set any IEs possibly provided by management client + const TUint8* ieData( aCtxImpl.IeData() ); + if ( ieData ) + { + const TUint16 ieDataLength( aCtxImpl.IeDataLength() ); + + os_memcpy( buffer_ptr, ieData, ieDataLength ); + buffer_ptr += ieDataLength; + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: management client supplied IE(s) added") ); + } + + // set WMM IE if needed + if ( aCtxImpl.QosEnabled() ) + { + const TUint8 wmmIeLength( aCtxImpl.OurWmmIe().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.OurWmmIe()), + wmmIeLength); + + buffer_ptr += wmmIeLength; + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WMM IE added") ); + } + + // length of frame + lengthOfFrame = buffer_ptr - aStartOfFrame; + } + else + { + // we didn't get a Tx buffer => frame not sent. Zero will be returned + // as the frame length to indicate that + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::ConstructAssociationRequestFrame: no internal Tx buffer available") ); + } + + return lengthOfFrame; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +T802Dot11ManagementStatusCode +WlanDot11AssociationPending::IsRxAssociationSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint32 aFlags ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::IsRxAssociationSuccess")); + // get the fixed fields from association response + const SAssociationResponseFixedFields* fields = + HtcFieldPresent( aCtxImpl, aFrame, aFlags ) ? + reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SHtManagementFrameHeader )) : + reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SManagementFrameHeader ) ); + + // store AID + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::IsRxAssociationSuccess: AID extracted from association response: 0x%04x"), + fields->Aid() ); + aCtxImpl.Aid( fields->Aid() ); + + return static_cast( + fields->StatusCode() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::StartAssociationFrameResponseTimer( + WlanContextImpl& aCtxImpl ) + { + // start association response timeout timer + const TUint32 timeout( dot11AssociateResponseTimeout * KTU ); + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::StartAssociationFrameResponseTimer: timeout in microseconds: %d"), + timeout); + + aCtxImpl.iUmac.RegisterTimeout( timeout ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::ConfigureAc( + WlanContextImpl& aCtxImpl ) + { + ConfigureAcParams( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate /*aRate*/, + WHA::TRcpi aRcpi, + WHA::TChannelNumber /*aChannel*/, + TUint8* aBuffer, + TUint32 aFlags ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: dot11-associatepending::ReceivePacket()") ); + + if ( aStatus == WHA::KSuccess ) + { + // receive success + const Sdot11MacHeader* dot11_hdr( + static_cast(aFrame) ); + + // we accept only frames with ToDS bit cleared + if ( dot11_hdr->IsToDsBitSet() ) + { + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: associating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: rx-frame: ToDs bit set, discard frame") ); + + // release the Rx buffer & abort + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + return; + } + + const TBool class3_frame( IsClass3Frame( + dot11_hdr->iFrameControl.iType ) ); + const TBool unicast_addr( !IsGroupBitSet( dot11_hdr->iAddress1 ) ); + + if ( class3_frame && unicast_addr ) + { + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: associating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("rx class3 frame with unicast DA address") ); + + // class 3 frame rx and unicast address in address1 field + + // That's not the frame we are expecting so release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + + if ( !Associated() ) + { + // we do not have a valid association with the + // BSS where the frame came + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: TxDisassociate") ); + + // set the BSSID of the existing network; and the DA + if ( aCtxImpl.HtSupportedByNw() ) + { + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iBSSID + = aCtxImpl.GetBssId(); + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iDA + = aCtxImpl.GetBssId(); + } + else + { + (aCtxImpl.GetDisassociationFrame()).iHeader.iBSSID + = aCtxImpl.GetBssId(); + (aCtxImpl.GetDisassociationFrame()).iHeader.iDA + = aCtxImpl.GetBssId(); + } + if ( !TxDisassociate( + aCtxImpl, + E802Dot11ReasonClass3FrameWhenNotAssoc ) ) + { + // frame was not sent because either packet scheduler was + // full or because we didn't get a Tx buffer. In any case + // we won't try to send it again. + } + } + else + { + // this section is left intentionally empty + } + } + else + { + // default handler + OnReceiveFrameSuccess( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aFlags, + aBuffer ); + } + } + else // --- aStatus == WHA::KSuccess --- + { + // receive failed, so discard and release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ) + { + // receive success + // parse frame in order to determine if it is what we are expecting + SManagementFrameHeader* frame_hdr + = static_cast + (const_cast(aFrame)); + + TBool type_match( EFalse ); + + if ( // this an association response frame + IsRequestedFrameType( + frame_hdr->iFrameControl.iType, + E802Dot11FrameTypeAssociationResp, type_match ) + // AND our MAC address is DA + && ( frame_hdr->iDA == aCtxImpl.iWlanMib.dot11StationId ) + // AND we haven't received the assoc response yet + && ( !( iFlags & KAssocReceived ) ) ) + { + T802Dot11ManagementStatusCode status + = IsRxAssociationSuccess( aCtxImpl, aFrame, aFlags ); + + if ( status == E802Dot11StatusSuccess ) + { + // --- begin WMM + if ( aCtxImpl.QosEnabled() ) + { + WlanElementLocator elementLocator( + reinterpret_cast( aFrame ) + + sizeof( SManagementFrameHeader ) + + sizeof( SAssociationResponseFixedFields ), + aLength - + sizeof( SManagementFrameHeader ) + + sizeof( SAssociationResponseFixedFields ) ); + + TUint8 length( 0 ); + const TUint8* data( NULL ); + + // is WMM Parameter Element present + if ( elementLocator.InformationElement( + E802Dot11VendorSpecificIE, + KWmmElemOui, + KWmmElemOuiType, + KWmmParamElemOuiSubtype, + length, + &data ) == WlanElementLocator::EWlanLocateOk ) + { + // WMM Parameter Element found + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::ReceivePacket(): WMM param set cnt: %d"), + (reinterpret_cast(data))->ParameterSetCount() ); + + if ( (reinterpret_cast + (data))->ParameterSetCount() + != aCtxImpl.WmmParameterSetCount() ) + { + // AC parameters have changed => parse again + ParseAcParameters( + aCtxImpl, + reinterpret_cast(*data ) ); + // in this case we need to re-issue configure AC wha cmd + // so make a note of that + iFlags |= KConfigureAc; + } + } + else + { + // protocol error from AP; just try to continue with + // current WMM parameters + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::ReceivePacket(): PROTOCOL ERROR from AP side") ); + } + } + // --- end WMM + } + else + { + // association failed + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: dot11-association denied; status code: %d"), + status); + + // in this case we will go back to idle state + // where the connect oid will be completed. + // So set the completion code value to be returned to user mode + aCtxImpl.iStates.iIdleState.Set( status ); + } + + // forward the association response frame to Wlan Mgmt client + if ( XferDot11FrameToMgmtClient( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aBuffer ) ) + { + // forwarding succeeded. Now we can say that we have received + // the assoc response successfully + + iFlags |= KAssocReceived; + aCtxImpl.CancelTimer(); + + if ( status == E802Dot11StatusSuccess ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: association pending: association success") ); + + iFlags |= KAssocSuccess; + } + + Fsm( aCtxImpl, ERXASSOCRESPONSE ); + } + else + { + // forwarding the frame to WLAN Mgmt client failed, which + // won't happen in this situation under the normal circumstances. + // Anyhow, it has happened now, so we have no other choice than to + // discard the frame. The Rx buffer has already been + // released. So no action here + } + } + else + { + // not a valid frame in this situation; we just silently discard it + OsTracePrint( KUmacAssoc | KUmacDetails, (TUint8*) + ("UMAC: WlanDot11AssociationPending::OnReceiveFrameSuccess: " + "not relevant frame; ignore")); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// ----------------------------------------------------------------------------- +// completion method called when packet has been xferred to the WLAN device +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::OnPacketTransferComplete")); + + if ( aPacketId == E802Dot11FrameTypeData ) + { + OnTxProtocolStackDataComplete( aCtxImpl, aMetaHeader ); + } + else if ( aPacketId == E802Dot11FrameTypeDataEapol || + aPacketId == E802Dot11FrameTypeManagementAction || + aPacketId == E802Dot11FrameTypeTestFrame ) + { + OnMgmtPathWriteComplete( aCtxImpl ); + } + else + { + // this frame Tx request didn't come from above us (i.e. neither + // through the user data nor the management data API) but is + // related to a frame Tx we have done internally. So we need to mark + // the internal Tx buffer free again + aCtxImpl.MarkInternalTxBufFree(); + } + + if ( aPacketId == E802Dot11FrameTypeAssociationReq ) + { + // associate tx message has been xferred to the WLAN device + + Fsm( aCtxImpl, ETX_ASSOCFRAME_XFER ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11AssociationPending::OnTimeout( + WlanContextImpl& aCtxImpl ) + { + TBool stateChange ( ETrue ); + + switch ( iState ) + { + case EWAIT4ASSOCRESPONSE: + // association timeout + + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::OnTimeout: timeout => association failed!") ); + + Fsm( aCtxImpl, ETIMEOUT ); + + // in this case we return ETrue, i.e. signal the caller that a + // state change occurred + + break; + default: + // a timeout occurred when we weren't expecting it (yet). This + // means that a timeout callback had already been registered when + // we tried to cancel this timer the previous time (regarding + // authentication). So this callback is not relevant for + // association and can be ignored. + + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::OnTimeout: irrelevant timeout; ignored") ); + + // Signal the caller that no state change occurred + stateChange = EFalse; + } + + return stateChange; + } + +// ----------------------------------------------------------------------------- +// packet sceduler notification that a packet push is guaranteed to succeed +// ----------------------------------------------------------------------------- +// +void WlanDot11AssociationPending::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + // feed a critter to the fsm + Fsm( aCtxImpl, EPUSHPACKET ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11AuthenticatePending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11AuthenticatePending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,713 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11AuthenticatePending class +* +*/ + +/* +* %version: 38 % +*/ + +#include "config.h" +#include "UmacDot11AuthenticatePending.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TUint8 WlanDot11AuthenticatePending::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ETXAUTHFRAME"}, + {"EWAIT4AUTHRESPONSE"}, + {"EWAIT4PUSHPACKET"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11AuthenticatePending::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, {"ECONTINUE"}, {"ERXAUTHRESPONSE"}, + {"ETX_AUTHFRAME_XFER"}, {"ETX_SCHEDULER_FULL"}, + {"ETIMEOUT"}, {"EPUSHPACKET"} + }; +#endif +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::Entry( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacProtocolState | KUmacAuth, + (TUint8*)("UMAC * execute dot11 authenticate")); + + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // no need to do event dispatching as this + // thing is triggered by the user and + // is executed synchronously as we only do OID completion + // at the end of authenticate + association process + // for the same reason we don't execute any asynchronous WHA commands + // from here so authetication protocol does not include multiple + // this object entry method executions + + if ( iState == EINIT ) + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + else + { + // implementation error see comment block above why +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // we are departing this dot11state to another dot11state, + // which means we are either: + // 1) proceeding to WlanDot11AssociationPending state + // in case of authentication success + // 2) proceeding to WlanDot11Idle state + // in case of authentication failure + // we simple reset our local FSM for the next time... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::StateEntryActions( + WlanContextImpl& aCtxImpl ) + { + iFlags = 0; + + if ( aCtxImpl.HtSupportedByNw() ) + { + aCtxImpl.GetHtAuthenticationFrame().ResetSeqNmbr(); + aCtxImpl.GetHtAuthenticationFrame().ClearWepBit(); + } + else + { + aCtxImpl.GetAuthenticationFrame().ResetSeqNmbr(); + aCtxImpl.GetAuthenticationFrame().ClearWepBit(); + } + + aCtxImpl.ResetAuthSeqNmbrExpected(); + + // its up to our sub states to fill this block + OnSetAlgorithmNumber( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// Start authentication frame response timer +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::StartAuthenticationFrameResponseTimer( + WlanContextImpl& aCtxImpl ) + { + // start authentication frame response timeout timer + const TUint32 timeout( dot11AuthenticationResponseTimeOut * KTU ); + + OsTracePrint( KUmacAuth, ( + TUint8*)("UMAC: WlanDot11AuthenticatePending::StartAuthenticationFrameResponseTimer:timeout in microseconds: %d"), + timeout ); + + aCtxImpl.iUmac.RegisterTimeout( timeout ); + } + +// ----------------------------------------------------------------------------- +// Send authenticate seq.number 1 message +// ----------------------------------------------------------------------------- +// +TBool WlanDot11AuthenticatePending::SendAuthSeqNbr1Frame( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::SendAuthSeqNbr1Frame") ); + + TBool status ( EFalse ); + + // client doesn't have to take care of the tx buffer header space + // as the method below does that by itself + TUint8* start_of_frame = aCtxImpl.TxBuffer( ETrue ); + + if ( start_of_frame ) + { + TUint32 frameLength ( 0 ); + + if ( aCtxImpl.HtSupportedByNw() && aCtxImpl.QosEnabled() ) + { + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: Algorithm number: %d"), + aCtxImpl.GetHtAuthenticationFrame().GetAlgorithmNumber()); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: Sequence number: %d"), + aCtxImpl.GetHtAuthenticationFrame().GetSeqNmbr()); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: Status code: %d"), + aCtxImpl.GetHtAuthenticationFrame().GetStatusCode()); + + frameLength = sizeof( SHtAuthenticationFrame ); + + os_memcpy( + start_of_frame, + &(aCtxImpl.GetHtAuthenticationFrame()), + frameLength ); + } + else + { + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: Algorithm number: %d"), + aCtxImpl.GetAuthenticationFrame().GetAlgorithmNumber()); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: Sequence number: %d"), + aCtxImpl.GetAuthenticationFrame().GetSeqNmbr()); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: Status code: %d"), + aCtxImpl.GetAuthenticationFrame().GetStatusCode()); + + frameLength = sizeof( SAuthenticationFrame ); + + os_memcpy( + start_of_frame, + &(aCtxImpl.GetAuthenticationFrame()), + frameLength ); + } + + // trace the frame critter + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: dot11 authenticate frame tx:"), + *(reinterpret_cast(start_of_frame)) ); + + const WHA::TQueueId queue_id + = QueueId( aCtxImpl, start_of_frame ); + + // push the frame to packet scheduler for transmission + status = aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + frameLength, + queue_id, + E802Dot11FrameTypeAuthSeqNmbr1, + NULL, + EFalse, + EFalse, + ETrue ); + + if ( !status ) + { + // as we came here we did get an internal Tx buffer for the frame + // but packet push to scheduler failed. In this case we need cancel + // the internal Tx buffer reservation as we will request it again + // when the Packet Scheduler is again ready for packet push + aCtxImpl.MarkInternalTxBufFree(); + } + } + else + { + // we didn't get a Tx buffer. EFalse will be returned + // to indicate that + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::SendAuthSeqNbr1Frame: no internal Tx buffer available") ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// completion method called when packet has been xferred to the WLAN device +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::OnPacketTransferComplete")); + + if ( aPacketId == E802Dot11FrameTypeData ) + { + OnTxProtocolStackDataComplete( aCtxImpl, aMetaHeader ); + } + else if ( aPacketId == E802Dot11FrameTypeDataEapol || + aPacketId == E802Dot11FrameTypeManagementAction || + aPacketId == E802Dot11FrameTypeTestFrame ) + { + OnMgmtPathWriteComplete( aCtxImpl ); + } + else + { + // this frame Tx request didn't come from above us (i.e. neither + // through the user data nor the management data API) but is + // related to a frame Tx we have done internally. So we need to mark + // the internal Tx buffer free again + aCtxImpl.MarkInternalTxBufFree(); + } + + if ( aPacketId == E802Dot11FrameTypeAuthSeqNmbr1 + || aPacketId == E802Dot11FrameTypeAuthSeqNmbr3 ) + { + // authenticate tx message has been xferred to the WLAN device + + // so feed an event critter to the fsm + Fsm( aCtxImpl, ETX_AUTHFRAME_XFER ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11AuthenticatePending::ResolveAuthMessage( + WlanContextImpl& aCtxImpl, + TUint16 aAuthModeDesired, + const void* aFrame, + TUint32 aFlags ) + { + TBool ret( EFalse ); + const SAuthenticationFixedFields* auth_fields = + HtcFieldPresent( aCtxImpl, aFrame, aFlags ) ? + reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SHtManagementFrameHeader )) : + reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SManagementFrameHeader )); + + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::ResolveAuthMessage: auth message sequence number expected: %d"), + aCtxImpl.GetAuthSeqNmbrExpected() ); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::ResolveAuthMessage: auth message sequence number: %d"), + auth_fields->SequenceNumber() ); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::ResolveAuthMessage: algorithm number expected: %d"), + aAuthModeDesired ); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::ResolveAuthMessage: algorithm number: %d"), + auth_fields->AlgorithmNumber() ); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::ResolveAuthMessage: status code: %d"), + auth_fields->StatusCode() ); + + if ( // is desired mode authentication + ( auth_fields->AlgorithmNumber() == aAuthModeDesired ) + // AND is authentication transaction sequence number expected + && ( auth_fields->SequenceNumber() == aCtxImpl.GetAuthSeqNmbrExpected() ) + // AND the status code is successful + && ( auth_fields->StatusCode() == E802Dot11StatusSuccess )) + { + ret = ETrue; + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacAuth, + (TUint8*)("UMAC * dot11-authenticatepending * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacAuth, (TUint8*)("event:")); + OsTracePrint( KUmacAuth, iEventName[aEvent] ); + OsTracePrint( KUmacAuth, (TUint8*)("state:")); + OsTracePrint( KUmacAuth, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ECONTINUE: + OnContinueEvent( aCtxImpl ); + break; + case ERXAUTHRESPONSE: + OnRxAuthResponseEvent( aCtxImpl ); + break; + case ETX_AUTHFRAME_XFER: + OnTxAuthFrameXferEvent( aCtxImpl ); + break; + case ETX_SCHEDULER_FULL: + OnTxSchedulerFullEvent( aCtxImpl ); + break; + case ETIMEOUT: + OnTimeoutEvent( aCtxImpl ); + break; + case EPUSHPACKET: + OnPushPacketEvent( aCtxImpl ); + break; + default: + // cath internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for generic continue event. +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnContinueEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + ChangeInternalState( aCtxImpl, ETXAUTHFRAME ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for authentication response timeout event. +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnTimeoutEvent( + WlanContextImpl& aCtxImpl ) + { + // set completion code + // as dot11idle state does the OID completion + aCtxImpl.iStates.iIdleState.Set( KErrTimedOut ); + // authentication was not successful + iFlags &= ~KAuthSuccess; + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// ----------------------------------------------------------------------------- +// Handler for push packet to packet scheduler possible event +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnPushPacketEvent( + WlanContextImpl& aCtxImpl ) + { + if ( iState == EWAIT4PUSHPACKET ) + { + ChangeInternalState( aCtxImpl, ETXAUTHFRAME ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for authenticate request frame +// has been xferred to the WLAN device event +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnTxAuthFrameXferEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + ChangeInternalState( aCtxImpl, EWAIT4AUTHRESPONSE ); + } + +// ----------------------------------------------------------------------------- +// Handler for scheduler full event upon trying to tx dot11-authenticate frame +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnTxSchedulerFullEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: packet scheduler full during authentication process") ); + + ChangeInternalState( aCtxImpl, EWAIT4PUSHPACKET ); + } + +// ----------------------------------------------------------------------------- +// continue dot11 protocol statemachine traversal +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + if ( iFlags & KAuthSuccess ) + { + // authentication was a success + // so we proceed to reassociation state - if this happens to be a + // roaming case - or to association state + // + if ( aCtxImpl.Reassociate() ) + { + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iReassociationPendingState // next state + ); + } + else + { + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iAssociationPendingState // next state + ); + } + } + else + { + // authentication was a failure + // either due AP denial or by timeout + // the reason does not really intrest us here + // as the procedure is the same... + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11AuthenticatePending::OnTimeout( + WlanContextImpl& aCtxImpl ) + { + TBool stateChange ( ETrue ); + + switch ( iState ) + { + case EWAIT4AUTHRESPONSE: + // authentication response timeout + + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::OnTimeout: authentication resp. timeout => authenication failed!") ); + + Fsm( aCtxImpl, ETIMEOUT ); + + // in this case we return ETrue, i.e. signal the caller that a + // state change occurred + + break; + default: + // a timeout occurred when we weren't expecting it (yet). This + // means that a timeout callback had already been registered when + // we tried to cancel this timer the previous time (regarding + // the previous authentication frame). So this callback is not + // relevant and can be ignored. + + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AuthenticatePending::OnTimeout: irrelevant timeout; ignored") ); + + // Signal the caller that no state change occurred + stateChange = EFalse; + } + + return stateChange; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate /*aRate*/, + WHA::TRcpi aRcpi, + WHA::TChannelNumber /*aChannel*/, + TUint8* aBuffer, + TUint32 aFlags ) + { + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: dot11-authenticatepending::ReceivePacket()") ); + + if ( aStatus == WHA::KSuccess ) + { + // receive success + const Sdot11MacHeader* dot11_hdr( + static_cast(aFrame) ); + + // we accept only frames with ToDS bit cleared + if ( dot11_hdr->IsToDsBitSet() ) + { + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("UMAC: authenticating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("UMAC: rx-frame: ToDs bit set, discard frame") ); + + // release the Rx buffer & abort + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + return; + } + + const TBool class2_frame( IsClass2Frame( dot11_hdr->iFrameControl.iType ) ); + const TBool class3_frame( IsClass3Frame( dot11_hdr->iFrameControl.iType ) ); + const TBool unicast_addr( !IsGroupBitSet( dot11_hdr->iAddress1 ) ); + + if ( class2_frame && unicast_addr ) + { + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("UMAC: authenticating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("rx class2 frame with unicast DA address") ); + + // class 2 frame rx and unicast address in address1 field + // That's not the frame we are expecting. + // Note that we release the Rx buffer at the end of this method + + if ( !Authenticated() ) + { + // we do not have a valid authentication with the + // BSS where the frame came + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("TxDeauthenticate") ); + if ( !TxDeauthenticate( + aCtxImpl, + E802Dot11ReasonClass2FrameWhenNotAuth ) ) + { + // frame was not sent because either packet scheduler was + // full or because we didn't get a Tx buffer. In any case + // we won't try to send it again. + } + } + } + else if ( class3_frame && unicast_addr ) + { + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("UMAC: authenticating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("rx class3 frame with unicast DA address") ); + + // class 3 frame rx and unicast address in address1 field + // That's not the frame we are expecting + // Note that we release the Rx buffer at the end of this method + + if ( !Authenticated() ) + { + // we do not have a valid authentication with the + // BSS where the frame came + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("TxDeauthenticate") ); + if ( !TxDeauthenticate( + aCtxImpl, + E802Dot11ReasonClass3FrameWhenNotAssoc ) ) + { + // frame was not sent because either packet scheduler was + // full or because we didn't get a Tx buffer. In any case + // we won't try to send it again. + } + } + else + { + // we do have a valid authentication with the + // STA that sent the frame + OsTracePrint( KWarningLevel | KUmacAuth, + (TUint8*)("UMAC: TxDisassociate") ); + + // set the BSSID of the existing network; and the DA + if ( aCtxImpl.HtSupportedByNw() ) + { + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iBSSID = + aCtxImpl.GetBssId(); + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iDA = + aCtxImpl.GetBssId(); + } + else + { + (aCtxImpl.GetDisassociationFrame()).iHeader.iBSSID = + aCtxImpl.GetBssId(); + (aCtxImpl.GetDisassociationFrame()).iHeader.iDA = + aCtxImpl.GetBssId(); + } + if ( !TxDisassociate( + aCtxImpl, + E802Dot11ReasonClass3FrameWhenNotAssoc ) ) + { + // frame was not sent because either packet scheduler was + // full or because we didn't get a Tx buffer. In any case + // we won't try to send it again. + } + } + } + else + { + // default handler + OnReceiveFrameSuccess( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aFlags, + aBuffer ); + } + } + else // aStatus == WHA::KSuccess + { + // receive failed, so no action here + } + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// ----------------------------------------------------------------------------- +// packet sceduler notification that a packet push is guaranteed to succeed +// ----------------------------------------------------------------------------- +// +void WlanDot11AuthenticatePending::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + // feed a critter to the fsm + Fsm( aCtxImpl, EPUSHPACKET ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Connecting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Connecting.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11Connecting class +* +*/ + +/* +* %version: 15 % +*/ + +#include "config.h" +#include "UmacDot11Connecting.h" +#include "UmacContextImpl.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Connecting::IsClass2Frame( const TUint8 aFrameType ) + { + return ( aFrameType == E802Dot11FrameTypeAssociationReq + || aFrameType == E802Dot11FrameTypeAssociationResp + || aFrameType == E802Dot11FrameTypeReassociationReq + || aFrameType == E802Dot11FrameTypeReassociationResp + || aFrameType == E802Dot11FrameTypeDisassociation ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Connecting::IsClass3Frame( const TUint8 aFrameType ) + { + return ( aFrameType & E802Dot11FrameTypeData ); // is any data type frame + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* WlanDot11Connecting::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + return aCtxImpl.GetRxBuffer( aLength ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11DeauthPending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11DeauthPending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,349 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11DeauthPending class +* +*/ + +/* +* %version: 24 % +*/ + +#include "config.h" +#include "UmacDot11DeauthPending.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanDot11DeauthPending::iName[] = "dot11-deauthpending"; + +const TUint8 WlanDot11DeauthPending::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ETXDEAUTHENTICATIONFRAME"}, + {"EWAIT4PUSHPACKET"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11DeauthPending::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"ETX_SCHEDULER_FULL"}, + {"EPUSHPACKET"} + }; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11DeauthPending::Fsm(): event: ")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11DeauthPending::Fsm(): state: ")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ETX_SCHEDULER_FULL: + OnTxSchedulerFullEvent( aCtxImpl ); + break; + case EPUSHPACKET: + OnPushPacketEvent( aCtxImpl ); + break; + default: + OsAssert( + (TUint8*)("UMAC: WlanDot11DeauthPending::Fsm: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11DeauthPending::OnStateEntryEvent()")); + + switch ( iState ) + { + case EINIT: + ChangeInternalState( aCtxImpl, ETXDEAUTHENTICATIONFRAME ); + break; + case ETXDEAUTHENTICATIONFRAME: + if ( !TxDeauthenticate( + aCtxImpl, + E802Dot11ReasonDeauthStationLeft, + ETrue ) ) + { + // tx of dot11 deauthentication frame failed + // because packet scheduler was full + // or because we didn't get a Tx buffer + // so we enter to a wait state + Fsm( aCtxImpl, ETX_SCHEDULER_FULL ); + } + break; + case EWAIT4PUSHPACKET: + // nothing to do here than wait + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for tx complete event. +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11DeauthPending::OnTxCompleteEvent()")); + + if ( iState == ETXDEAUTHENTICATIONFRAME ) + { + // deauthentication frame has been sent + // continue state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + else + { + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for scheduler full event upon trying to tx dot11 deauthenticate frame +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::OnTxSchedulerFullEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: WlanDot11DeauthPending::OnTxSchedulerFullEvent:packet scheduler full during deauthentication process") ); + + ChangeInternalState( aCtxImpl, EWAIT4PUSHPACKET ); + } + +// ----------------------------------------------------------------------------- +// Handler for push packet to packet scheduler possible event +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::OnPushPacketEvent( + WlanContextImpl& aCtxImpl ) + { + if ( iState == EWAIT4PUSHPACKET ) + { + ChangeInternalState( aCtxImpl, ETXDEAUTHENTICATIONFRAME ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11DeauthPending::ContinueDot11StateTraversal()")); + + // we will go to soft reset state in any case + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSoftResetState // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11DeauthPending::ChangeInternalState(): old state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11DeauthPending::ChangeInternalState(): new state:")); + OsTracePrint( KUmacDetails, iStateName[aNewState] ); +#endif + + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11DeauthPending::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::Entry( WlanContextImpl& aCtxImpl) + { + OsTracePrint( KUmacProtocolState, + (TUint8*)("UMAC: WlanDot11DeauthPending::Entry()") ); + + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // no need to do event dispatching as this + // thing is triggered by the user and + // is executed synchronously as we only do OID completion + // at the end of disconnect process + // Additionally we don't execute any asynchronous WHA commands + // from here so deauthentication protocol does not include multiple + // this object entry method executions + + if ( iState == EINIT ) + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + else + { + // implementation error see comment block above why +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::Exit( WlanContextImpl& /*aCtxImpl*/) + { + OsTracePrint( + KUmacProtocolState, + (TUint8*)("UMAC: WlanDot11DeauthPending::Exit()")); + + // reset our local FSM for the next time... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 /*aPacketQueueDelay*/, + TUint32 /*aMediaDelay*/, + TUint /*aTotalTxDelay*/, + TUint8 /*aAckFailures*/, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool /*aMulticastData*/ ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11DeauthPending::OnPacketSendComplete")); + + aCtxImpl.OnTxCompleted( aRate, + static_cast(aStatus == WHA::KSuccess), + aQueueId, + aRequestedRate ); + + if ( aPacketId == E802Dot11FrameTypeDeauthentication ) + { + // deauthentication tx message has been sent from the WLAN device + // No matter whether the sending was successful or not we will continue + // with our disconnect actions + Fsm( aCtxImpl, ETXCOMPLETE ); + } + } + +// ----------------------------------------------------------------------------- +// We don't want to accept frames of any kind in this state +// ----------------------------------------------------------------------------- +// +TAny* WlanDot11DeauthPending::RequestForBuffer( + WlanContextImpl& /*aCtxImpl*/, + TUint16 /*aLength*/ ) + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// packet sceduler notification that a packet push is guaranteed to succeed +// ----------------------------------------------------------------------------- +// +void WlanDot11DeauthPending::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + // feed a critter to the fsm + Fsm( aCtxImpl, EPUSHPACKET ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11DisassociationPending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11DisassociationPending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,360 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UmacDot11DisassociationPending class +* +*/ + +/* +* %version: 22 % +*/ + +#include "config.h" +#include "UmacDot11DisassociationPending.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanDot11DisassociationPending::iName[] = "dot11-disassociationpending"; + +const TUint8 WlanDot11DisassociationPending::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ETXDISASSOCIATIONFRAME"}, + {"EWAIT4PUSHPACKET"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11DisassociationPending::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXPACKETCOMPLETE"}, + {"ETX_SCHEDULER_FULL"}, + {"EPUSHPACKET"} + }; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11DisassociationPending::WlanDot11DisassociationPending() + : iState( EINIT ) + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11DisassociationPending::~WlanDot11DisassociationPending() + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::Entry( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacProtocolState | KUmacAssoc, + (TUint8*)("UMAC: WlanDot11DisassociationPending::Entry()")); + + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // no need to do event dispatching as this + // thing is triggered by the user and + // is executed synchronously as we only do OID completion + // at the end of reassociation process + // Additionally we don't execute any asynchronous WHA commands + // from here so disassociation protocol does not include multiple + // this object entry method executions + + if ( iState == EINIT ) + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + else + { + // implementation error see comment block above why +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// completion method called when packet has been sent from the WLAN device +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 /*aPacketQueueDelay*/, + TUint32 /*aMediaDelay*/, + TUint /*aTotalTxDelay*/, + TUint8 /*aAckFailures*/, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool /*aMulticastData*/ ) + { + OsTracePrint( + KUmacAssoc, + (TUint8*)("UMAC: WlanDot11DisassociationPending::OnPacketSendComplete")); + + aCtxImpl.OnTxCompleted( aRate, + static_cast(aStatus == WHA::KSuccess), + aQueueId, + aRequestedRate ); + + if ( aPacketId == E802Dot11FrameTypeDisassociation ) + { + // disassociation tx message has been sent from the WLAN device + // No matter whether the sending was successful or not we will proceed + // with our roaming actions + + Fsm( aCtxImpl, ETXPACKETCOMPLETE ); + } + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11DisassociationPending::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::Exit( WlanContextImpl& /*aCtxImpl*/ ) + { + OsTracePrint( + KUmacProtocolState, + (TUint8*)("UMAC: WlanDot11DisassociationPending::Exit()")); + + // we are departing this dot11state to another dot11state (dot11synchronize) + // we simple reset our local FSM for the next time... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacAssoc, + (TUint8*)("UMAC: WlanDot11DisassociationPending::Fsm(): event: ")); + OsTracePrint( KUmacAssoc, iEventName[aEvent] ); + OsTracePrint( + KUmacAssoc, + (TUint8*)("UMAC: WlanDot11DisassociationPending::Fsm(): state: ")); + OsTracePrint( KUmacAssoc, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXPACKETCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ETX_SCHEDULER_FULL: + OnTxSchedulerFullEvent( aCtxImpl ); + break; + case EPUSHPACKET: + OnPushPacketEvent( aCtxImpl ); + break; + default: + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacAssoc, + (TUint8*)("UMAC: WlanDot11DisassociationPending::OnStateEntryEvent()")); + + switch ( iState ) + { + case EINIT: + // continue with the state traversal + ChangeInternalState( aCtxImpl, ETXDISASSOCIATIONFRAME ); + break; + case ETXDISASSOCIATIONFRAME: + if ( !TxDisassociate( + aCtxImpl, + E802Dot11ReasonDisAssocStationLeft, + ETrue ) ) + { + // tx of dot11 disassociate frame failed + // because packet scheduler was full + // or because we didn't get a Tx buffer + // so we enter to a wait state + Fsm( aCtxImpl, ETX_SCHEDULER_FULL ); + } + break; + case EWAIT4PUSHPACKET: + // nothing to do here than wait + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for tx complete event. +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacAssoc, + (TUint8*)("UMAC: WlanDot11DisassociationPending::OnTxCompleteEvent()")); + + if ( iState == ETXDISASSOCIATIONFRAME ) + { + + // disassociate frame has been sent + // continue state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + else + { + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for scheduler full event upon trying to tx dot11 disassociate frame +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::OnTxSchedulerFullEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11DisassociationPending::OnTxSchedulerFullEvent:packet scheduler full during disassociation process") ); + + ChangeInternalState( aCtxImpl, EWAIT4PUSHPACKET ); + } + +// ----------------------------------------------------------------------------- +// Handler for push packet to packet scheduler possible event +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::OnPushPacketEvent( + WlanContextImpl& aCtxImpl ) + { + if ( iState == EWAIT4PUSHPACKET ) + { + ChangeInternalState( aCtxImpl, ETXDISASSOCIATIONFRAME ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacAssoc, + (TUint8*) + ("UMAC: WlanDot11DisassociationPending::ContinueDot11StateTraversal()")); + + // proceed to synchronize state... + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSynchronizeState // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11DisassociationPending::ChangeInternalState(): old state:")); + OsTracePrint( KUmacAssoc, iStateName[iState] ); + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11DisassociationPending::ChangeInternalState(): new state:")); + OsTracePrint( KUmacAssoc, iStateName[aNewState] ); +#endif + + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// packet sceduler notification that a packet push is guaranteed to succeed +// ----------------------------------------------------------------------------- +// +void WlanDot11DisassociationPending::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + // feed a critter to the fsm + Fsm( aCtxImpl, EPUSHPACKET ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11IbssMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11IbssMode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11IbssMode class. +* +*/ + +/* +* %version: 21 % +*/ + +#include "config.h" +#include "UmacDot11IbssMode.h" +#include "UmacContextImpl.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11IbssMode::DoSetTxMpduDaAddress( + SDataFrameHeader& aDataFrameHeader, + const TMacAddress& aMac ) const + { + aDataFrameHeader.iAddress1 = aMac; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11IbssMode::DoIsRxFrameSAourAddress( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* /*aSubFrameHeader*/) const + { + return aFrameHeader.iAddress2 == aCtxImpl.iWlanMib.dot11StationId; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11IbssMode::DoIsValidAddressBitCombination( + const SDataFrameHeader& aFrameHeader ) const + { + return !( aFrameHeader.IsFromDsBitSet() + || aFrameHeader.IsToDsBitSet() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11IbssMode::DoBuildEthernetFrame( + TDataBuffer& aBuffer, + const SDataMpduHeader& aDot11DataMpdu, + const TUint8* aStartOfEtherPayload, + TUint aEtherPayloadLength, + TBool /*aAmsdu*/, + TUint8* /*aCopyBuffer*/ ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::DoBuildEthernetFrame")); + + // copy SA to the correct location. + os_memcpy( + const_cast(aStartOfEtherPayload) - sizeof( TMacAddress ), + reinterpret_cast( + aDot11DataMpdu.iHdr.iAddress2.iMacAddress ), + sizeof( TMacAddress ) ); + + // copy DA to the correct location. + os_memcpy( + const_cast(aStartOfEtherPayload) + - ( 2 * sizeof( TMacAddress ) ), + reinterpret_cast( + aDot11DataMpdu.iHdr.iAddress1.iMacAddress ), + sizeof( TMacAddress ) ); + + // set the length + aBuffer.KeSetLength( + aEtherPayloadLength + + ( sizeof( TMacAddress ) * 2 ) ); + + // set the frame type + aBuffer.FrameType( TDataBuffer::KEthernetFrame ); + + // set the offset to the beginning of the ready ethernet frame + // from the beginning of the Rx buf + aBuffer.KeSetOffsetToFrameBeginning( + aStartOfEtherPayload - ( 2 * sizeof( TMacAddress ) ) // frame beginning + - aBuffer.KeGetBufferStart() ); // buffer beginning + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11IbssMode::DoBuildEthernetFrame: offset to frame beginning: %d"), + aBuffer.KeOffsetToFrameBeginning()); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Idle.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,797 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UmacDot11Idle class +* +*/ + +/* +* %version: 41 % +*/ + +#include "config.h" +#include "UmacDot11Idle.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "umacwharelease.h" +#include "wha_mibDefaultvalues.h" +#include "UmacWsaAddKey.h" +#include "UmacWsaKeyIndexMapper.h" + +#ifndef NDEBUG +const TInt8 WlanDot11Idle::iName[] = "dot11-idle"; + +const TUint8 WlanDot11Idle::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EWRITEMIB"}, + {"EFINIT"} + }; + +const TUint8 WlanDot11Idle::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, {"ETXCOMPLETE"}, {"ESCAN"}, + {"ECONNECT"}, {"ECONNECTIBSS"}, {"EDISCONNECT"}, + {"ERELEASE"}, {"EABORT"} + }; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +#ifndef NDEBUG +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const TInt8* WlanDot11Idle::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::Set( TInt aCompletionCode ) + { + iEventMask |= KCompleteUponEntry; + iCompletionCode = aCompletionCode; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::CompleteScanUponEntry() + { + iEventMask |= KIndicateScanCompletionUponEntry; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::Entry( WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::Exit( WlanContextImpl& /*aCtxImpl*/ ) + { + // reset fsm for the next time we come back to this state + iState = EINIT; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt WlanDot11Idle::StartIBSS( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + TUint32 aBeaconInterval, + TUint32 aAtim, + TUint32 aChannel, + TEncryptionStatus aEncryptionStatus) + { + aCtxImpl.NetworkOperationMode( WHA::EIBSS ); + GenerateRandomBssIDForIbss( aCtxImpl ); + (aCtxImpl.GetSsId()) = aSSID; + aCtxImpl.NetworkChannelNumeber( aChannel ); + aCtxImpl.NetworkBeaconInterval( aBeaconInterval ); + aCtxImpl.AtimWindow( aAtim ); + aCtxImpl.UseShortPreamble( ETrue ); + (aCtxImpl.EncryptionStatus()) = aEncryptionStatus; + + // clear & set our supported rates + // + aCtxImpl.GetOurSupportedRatesIE().Clear(); + aCtxImpl.GetOurExtendedSupportedRatesIE().Clear(); + + TUint rateCount ( 0 ); + TUint8 rate_to_add( 0 ); + aCtxImpl.ClearBasicRateSet(); + aCtxImpl.GetMinBasicRate() = 0; + aCtxImpl.GetMaxBasicRate() = 0; + + for (TUint i = 0; i < KMaxNumberOfDot11bAndgRates; ++i ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Idle::StartIBSS(): iSupportedRate: %d"), + aCtxImpl.iSupportedRatesLookUpTable[i].iSupportedRate ); + + if ( aCtxImpl.iSupportedRatesLookUpTable[i].iSupportedRate) + { + if ( rateCount < KMaxNumberOfRates ) + { + rate_to_add + = aCtxImpl.iSupportedRatesLookUpTable[i].iSupportedRate; + + if ( rate_to_add == E802Dot11Rate1MBit || + rate_to_add == E802Dot11Rate2MBit || + rate_to_add == E802Dot11Rate5p5MBit || + rate_to_add == E802Dot11Rate11MBit ) + { + // make this rate a basic rate + rate_to_add |= KBasicRateMask; + // and add it to our WHA basic rate mask + aCtxImpl.BasicRateSetBitSet( + aCtxImpl.iSupportedRatesLookUpTable[i].iWsaRate ); + + // store min basic rate + if ( aCtxImpl.GetMinBasicRate() == 0 ) + { + aCtxImpl.GetMinBasicRate() = + aCtxImpl.iSupportedRatesLookUpTable[i].iWsaRate; + } + + // store max basic rate + if ( aCtxImpl.GetMaxBasicRate() < + aCtxImpl.iSupportedRatesLookUpTable[i].iWsaRate ) + { + aCtxImpl.GetMaxBasicRate() + = aCtxImpl.iSupportedRatesLookUpTable[i].iWsaRate; + } + } + + aCtxImpl.GetOurSupportedRatesIE().Append( rate_to_add ); + + ++rateCount; + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: rateCount: %d"), rateCount ); + } + else + { + aCtxImpl.GetOurExtendedSupportedRatesIE().Append( + aCtxImpl.iSupportedRatesLookUpTable[i].iSupportedRate ); + + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: %d:th rate added to ext rates"), i + 1 ); + } + } + } + +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Idle::StartIBSS(): supported rates len: %d"), + aCtxImpl.GetOurSupportedRatesIE().iHeader.iLength ); + + + TUint8* ptr + = reinterpret_cast + (&(aCtxImpl.GetOurSupportedRatesIE().iSupportedRatesIE)); + for (TUint8 j = 0; j < aCtxImpl.GetOurSupportedRatesIE().iHeader.iLength; j++ ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Idle::StartIBSS(): supported rate: %d"), + *ptr ); + ptr++; + } + + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Idle::StartIBSS(): ext supported rates len: %d"), + aCtxImpl.GetOurExtendedSupportedRatesIE().iHeader.iLength ); + + ptr = reinterpret_cast + (&(aCtxImpl.GetOurExtendedSupportedRatesIE().iSupportedRatesIE)); + for (TUint8 j = 0 + ; j < aCtxImpl.GetOurExtendedSupportedRatesIE().iHeader.iLength + ; j++ ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: extended supported rate: %d"), *ptr ); + ptr++; + } + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: min basic WHA rate: 0x%08x"), aCtxImpl.GetMinBasicRate() ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: max basic WHA rate: 0x%08x"), aCtxImpl.GetMaxBasicRate() ); + +#endif + + // as we are starting our own IBSS nw, the "common" rates between us + // and the network are our supported rates + aCtxImpl.RateBitMask( aCtxImpl.WHASettings().iRates ); + + // determine U-APSD usage for the ACs/Tx queues; which in this (IBSS) case + // means disabling U-APSD + DetermineAcUapsdUsage( aCtxImpl ); + + // inform the next state that we are starting a new IBSS + aCtxImpl.iStates.iPrepareForIbssMode.Set( ETrue ); + + Fsm( aCtxImpl, ECONNECTIBSS ); + + // global state transition will occur + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Idle::Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool aIsInfra, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ) + { + TBool ret( ETrue ); + + (aCtxImpl.GetBssId())= aBSSID; + (aCtxImpl.GetSsId()) = aSSID; + (aCtxImpl.EncryptionStatus()) = aEncryptionStatus; + (aCtxImpl.AuthenticationAlgorithmNumber()) = aAuthAlgorithmNbr; + // set the BSSID field + (aCtxImpl.GetAuthenticationFrame()).iHeader.iBSSID + = (aCtxImpl.GetBssId()); + (aCtxImpl.GetHtAuthenticationFrame()).iHeader.iBSSID + = (aCtxImpl.GetBssId()); + // set the DA field + (aCtxImpl.GetAuthenticationFrame()).iHeader.iDA + = (aCtxImpl.GetBssId()); + (aCtxImpl.GetHtAuthenticationFrame()).iHeader.iDA + = (aCtxImpl.GetBssId()); + // set the SA field + (aCtxImpl.GetAuthenticationFrame()).iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + (aCtxImpl.GetHtAuthenticationFrame()).iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.NetworkOperationMode( + aIsInfra ? WHA::EBSS : WHA::EIBSS ); + + // store Tx IE data for later access + // pointers supplied are valid to the point the + // corresponding completion method is called + aCtxImpl.IeData( aIeData ); + aCtxImpl.IeDataLength( aIeDataLength ); + + + // check do we meet the requirements for the network + // and construct necessary objects for establishing the connection + if ( InitNetworkConnect( + aCtxImpl, + aScanResponseFrameBodyLength, + aScanResponseFrameBody ) ) + { + // continue + + // make WHA types + WHA::SSSID ssid; + ssid.iSSIDLength = aSSID.ssidLength; + os_memcpy( ssid.iSSID, aSSID.ssid, ssid.iSSIDLength ); + + // infrastructure or IBSS mode + if ( aIsInfra ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Idle::Connect: infra")); + + Fsm( aCtxImpl, ECONNECT ); + } + else // --- IBSS mode --- + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Idle::Connect: IBSS")); + + Fsm( aCtxImpl, ECONNECTIBSS ); + } + } + else // --- InitNetworkConnect failure --- + { + // abort + ret = EFalse; + OnOidComplete( aCtxImpl, KErrGeneral ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Idle::Disconnect( + WlanContextImpl& aCtxImpl ) + { + Fsm( aCtxImpl, EDISCONNECT ); + + // global state transition will occur + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Idle::RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + // scanning mode requested + // set parameters + // NOTE: OID command parameters are guaranteed to be valid + // to the point a correcponding completion method is called + + aCtxImpl.iStates.iIdleScanningMode.Set( + aMode, aSSID, aScanRate, aChannels, + aMinChannelTime, aMaxChannelTime, aSplitScan ); + + Fsm( aCtxImpl, ESCAN ); + + return ETrue; // global statemachine transition will occur + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::FinitSystem( + WlanContextImpl& aCtxImpl ) + { + Fsm( aCtxImpl, ERELEASE ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Idle::AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ) + { + return OnAddBroadcastWepKey( aCtxImpl, aKeyIndex, aUseAsDefaulKey, + EFalse, // do not set as PTK + aKeyLength, aKey, aMac ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11Idle::AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]) + { + // allocate memory for the key structure + WHA::SWepPairwiseKey* key = static_cast + (os_alloc( WHA::SWepPairwiseKey::KHeaderSize + aKeyLength )); + + if ( !key ) + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + return EFalse; + } + + os_memcpy( + &(key->iMacAddr), + aMacAddr.iMacAddress, + sizeof(key->iMacAddr) ); + key->iKeyLengthInBytes = static_cast(aKeyLength); + os_memcpy( key->iKey, aKey, key->iKeyLengthInBytes ); + + WlanWsaAddKey& wsa_cmd = aCtxImpl.WsaAddKey(); + wsa_cmd.Set( aCtxImpl, + WHA::EWepPairWiseKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EWepPairWiseKey ) ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // allways remember to release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC * dot11-idle * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*)("event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*)("state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ESCAN: + OnScanEvent( aCtxImpl ); + break; + case ECONNECT: + OnConnectEvent( aCtxImpl ); + break; + case ECONNECTIBSS: + OnConnectIbssEvent( aCtxImpl ); + break; + case EDISCONNECT: + OnDisconnectEvent( aCtxImpl ); + break; + case ERELEASE: + OnReleaseEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + if ( aCtxImpl.Reassociate() ) + { + // a roaming case + ChangeInternalState( aCtxImpl, EFINIT ); + } + else + { + // not a roaming case + ChangeInternalState( aCtxImpl, EWRITEMIB ); + } + break; + case EWRITEMIB: + WriteSleepModeMib( aCtxImpl ); + break; + case EFINIT: + // fsm execution complete + + // execute OID completion if necessary + CompleteOid( aCtxImpl ); + // indicate scan completion if necessary + IndicateScanCompletion( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWRITEMIB: + ChangeInternalState( aCtxImpl, EFINIT ); + break; + case EFINIT: + // default handler has issued a WHA command and we + // have come back to this object + // we have absolutely nothing to do here + // expect mayby complete something + CompleteOid( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11Idle::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, (TUint8*)("UMAC * dot11-idle * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnScanEvent( + WlanContextImpl& aCtxImpl ) + { + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleScanningMode // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnConnectEvent( + WlanContextImpl& aCtxImpl ) + { + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iPrepareForBssMode // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnConnectIbssEvent( + WlanContextImpl& aCtxImpl ) + { + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iPrepareForIbssMode // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnDisconnectEvent( + WlanContextImpl& aCtxImpl ) + { + // set completion code for the oid + Set( KErrNone ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSoftResetState // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::OnReleaseEvent( + WlanContextImpl& aCtxImpl ) + { + // register oid completion by setting completion value + Set( KErrNone ); + // and execute transition + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WlanWhaRelease() // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::WriteSleepModeMib( + WlanContextImpl& aCtxImpl ) + { + WHA::SsleepMode* mib + = static_cast(os_alloc( sizeof( WHA::SsleepMode ) )); + + if ( !mib ) + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + return; + } + + // allocation success continue + mib->iMode = WHA::KLowPowerMode; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibSleepMode, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::GenerateRandomBssIDForIbss( + WlanContextImpl& aCtxImpl ) const + { + // generate random BSSID for IBSS + TMacAddress mac; + TUint16* ptr = reinterpret_cast(mac.iMacAddress); + const TUint16* const ptr_end + = ptr + (sizeof(TMacAddress) / sizeof(TUint16)); + + while ( ptr != ptr_end ) + { + *ptr = aCtxImpl.Random(); + ++ptr; + } + + // the Universal/Local bit must be set ( 2nd bit of octet 0 ) + // the Induvidual/Group bit must be cleared ( 1st bit of octet 0 ) + GroupBit( mac, EFalse ); // clear + LocalBit( mac ); // set + + // store the BSSID + aCtxImpl.GetBssId() = mac; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::CompleteOid( + WlanContextImpl& aCtxImpl ) + { + if ( iEventMask & KCompleteUponEntry ) + { + iEventMask &= ~KCompleteUponEntry; + + OnOidComplete( aCtxImpl, iCompletionCode ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Idle::IndicateScanCompletion( + WlanContextImpl& aCtxImpl ) + { + if ( iEventMask & KIndicateScanCompletionUponEntry ) + { + iEventMask &= ~KIndicateScanCompletionUponEntry; + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11Idle::IndicateScanCompletion: Send scan complete indication")); + + OnInDicationEvent( aCtxImpl, EScanCompleted ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureMode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,994 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11InfrastructureMode class +* +*/ + +/* +* %version: 63 % +*/ + +#include "config.h" +#include "UmacDot11InfrastructureMode.h" +#include "UmacWsaAddKey.h" +#include "umacaddbroadcastwepkey.h" +#include "UmacContextImpl.h" +#include "UmacWsaKeyIndexMapper.h" +#include "UmacWsaWriteMib.h" +#include "umacelementlocator.h" +#include "umacwhaconfigureac.h" +#include "FrameXferBlock.h" + + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus, + TBool /*aIsInfra*/, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ) + { + // store data for later access. + // Pointers supplied are valid to the point the + // corresponding completion method is called + + aCtxImpl.SetScanResponseFrameBody( aScanResponseFrameBody ); + aCtxImpl.SetScanResponseFrameBodyLength( aScanResponseFrameBodyLength ); + aCtxImpl.IeData( aIeData ); + aCtxImpl.IeDataLength( aIeDataLength ); + + return Connect( + aCtxImpl, + aSSID, + aBSSID, + aAuthAlgorithmNbr, + aEncryptionStatus + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 aAuthAlgorithmNbr, + TEncryptionStatus aEncryptionStatus ) + { + // construct disassociation frame + // note that we don't have to set SA because we have already set it + // in the initialize phase of the dot11 state machine + // + + // set the BSSID of the existing network + (aCtxImpl.GetDisassociationFrame()).iHeader.iBSSID = aCtxImpl.GetBssId(); + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iBSSID = aCtxImpl.GetBssId(); + // set the DA + (aCtxImpl.GetDisassociationFrame()).iHeader.iDA = aCtxImpl.GetBssId(); + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iDA = aCtxImpl.GetBssId(); + + // set current BSSID in reassociation request frame + (aCtxImpl.GetReassociationRequestFrame()).iFixedFields.iCurrentApAddress = + aCtxImpl.GetBssId(); + (aCtxImpl.GetHtReassociationRequestFrame()).iFixedFields.iCurrentApAddress = + aCtxImpl.GetBssId(); + + // ... and make a note that we need to perform reassociation + // instead of association later on towards the new AP + aCtxImpl.Reassociate( ETrue ); + + + // Store parameters of the new BSS to connect to + // + (aCtxImpl.GetBssId())= aBSSID; + (aCtxImpl.GetSsId()) = aSSID; + (aCtxImpl.EncryptionStatus()) = aEncryptionStatus; + + // set values in authentication frame + // + (aCtxImpl.AuthenticationAlgorithmNumber()) = aAuthAlgorithmNbr; + // set the BSSID field + (aCtxImpl.GetAuthenticationFrame()).iHeader.iBSSID = aBSSID; + (aCtxImpl.GetHtAuthenticationFrame()).iHeader.iBSSID = aBSSID; + // set the DA field + (aCtxImpl.GetAuthenticationFrame()).iHeader.iDA = aBSSID; + (aCtxImpl.GetHtAuthenticationFrame()).iHeader.iDA = aBSSID; + // set the SA field + (aCtxImpl.GetAuthenticationFrame()).iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + (aCtxImpl.GetHtAuthenticationFrame()).iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.NetworkOperationMode( WHA::EBSS ); + + if ( aCtxImpl.DisassociatedByAp() ) + { + // if the AP has already sent us a disassociation or deauthentication + // frame, we won't send it a disassociation frame any more. So in this + // case we skip the dot11DisassociationPending state and go directly to + // dot11Synchronize state. + + aCtxImpl.DisassociatedByAp( EFalse ); // also reset the flag + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSynchronizeState // next state + ); + } + else + { + // the most common case, i.e. we are still associated with the current + // AP. So make a state change to dot11DisassociationPending + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iDisassociationPendingState // next state + ); + } + + // signal caller that state transition occurred + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::SetRcpiTriggerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::SetRcpiTriggerLevel: aRcpiTrigger: %d"), + aRcpiTrigger ); + + // update the MIB. Also request the WLAN mgmt client request + // to be completed + return SetRcpiTriggerLevelMib(aCtxImpl, aRcpiTrigger, ETrue ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::SetRcpiTriggerLevelMib( + WlanContextImpl& aCtxImpl, + TUint32 aRcpiTrigger, + TBool aCompleteManagementRequest ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::SetRcpiTriggerLevelMib: aRcpiTrigger: %d"), + aRcpiTrigger ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::SetRcpiTriggerLevelMib: aCompleteManagementRequest: %d"), + aCompleteManagementRequest ); + + // allocate memory for the mib to write + WHA::SrcpiThreshold* mib = static_cast + (os_alloc( sizeof(WHA::SrcpiThreshold) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::SetRcpiTriggerLevelMib: abort") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + mib->iThreshold = aRcpiTrigger; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( aCtxImpl, WHA::KMibRcpiThreshold, sizeof(*mib), mib ); + + const TUint32 KNoNeedToCompleteManagementRequest = 0; + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd, // next state + aCompleteManagementRequest ? KCompleteManagementRequest : + KNoNeedToCompleteManagementRequest + ); + + os_free( mib ); // release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::OnDeauthenticateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ) + { + // note that the AP has disassociated us (as the AP deauthenticated us + // we are also disassociated) + aCtxImpl.DisassociatedByAp( ETrue ); + aCtxImpl.StopVoiceOverWlanCallMaintenance(); + aCtxImpl.StopKeepAlive(); + OnInDicationEvent( aCtxImpl, EMediaDisconnect ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::OnDisassociateFrameRx( + WlanContextImpl& aCtxImpl, + TUint8* aBuffer ) + { + // note that the AP has disassociated us + aCtxImpl.DisassociatedByAp( ETrue ); + aCtxImpl.StopVoiceOverWlanCallMaintenance(); + aCtxImpl.StopKeepAlive(); + OnInDicationEvent( aCtxImpl, EMediaDisconnect ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi /*aRcpi*/, + TUint8* aBuffer ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::OnBeaconFrameRx()")); + + // buffer begin + const TUint8* ptr = reinterpret_cast(aFrame); + + // bypass mac header, timestamp fixed field, beacon interval fixed field + // and capability fixed field + const TUint8 offset = + KMacHeaderLength + + KTimeStampFixedFieldLength + + KBeaconIntervalFixedFieldLength + + KCapabilityInformationFixedFieldLength; + ptr += offset; // we now point to the beginning of IEs + + if ( aLength > offset ) + { + //================================================================= + // Check if any dynamic nw parameters, that we are monitoring, have + // changed. If they have, take the new parameters into use + //================================================================= + + WlanElementLocator elementLocator( ptr, aLength - offset ); + + ValidateErpParams( aCtxImpl, elementLocator ); + + if ( aCtxImpl.QosEnabled() ) + { + ValidateAcParams( aCtxImpl, elementLocator ); + } + else + { + // this is not a QoS connection => not relevant to check + // for AC parameter changes + } + + if ( aCtxImpl.HtSupportedByNw() ) + { + ValidateHtBssOperationParams( aCtxImpl, elementLocator ); + } + else + { + // this is not a HT connection => not relevant to check + // for HT operation parameter changes + } + } + else + { + // frame too short to contain any IEs => ignore it + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::OnBeaconFrameRx: WARNING: frame too short to contain any IEs => ignored") ); + } + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::ValidateErpParams( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) + { + TUint8 length( 0 ); + const TUint8* elementData( NULL ); + + if ( WlanElementLocator::EWlanLocateOk == + aElementLocator.InformationElement( + E802Dot11ErpInformationIE, + length, + &elementData ) ) + { + // ERP IE found + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::ValidateErpParams(): ERP IE present")); + + if ( ( *elementData & KUseProtectionMask ) != aCtxImpl.ProtectionBitSet() ) + { + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::ValidateErpParams(): use protection setting changed, is now: %d"), + *elementData & KUseProtectionMask ); + + // use protection setting has changed, update the setting & + // re-set the MIB + // + aCtxImpl.ProtectionBitSet( *elementData & KUseProtectionMask ); + + if ( !(aCtxImpl.WsaCmdActive()) ) + { + SetCtsToSelfMib( aCtxImpl ); + } + else + { + // WHA command is in progress so we must defer this access + aCtxImpl.RegisterEvent( KSetCtsToSelf ); + } + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::ValidateAcParams( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) + { + TUint8 length( 0 ); + const TUint8* elementData( NULL ); + + // is WMM Parameter Element present + if ( aElementLocator.InformationElement( + E802Dot11VendorSpecificIE, + KWmmElemOui, + KWmmElemOuiType, + KWmmParamElemOuiSubtype, + length, + &elementData ) + == WlanElementLocator::EWlanLocateOk ) + { + // element found + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::ValidateAcParams(): WMM param elem present")); + + if ( (reinterpret_cast(elementData))->ParameterSetCount() + != aCtxImpl.WmmParameterSetCount() ) + { + // AC parameters have changed => parse them again + // + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::ValidateAcParams(): WMM param set count changed (value: %d) => params changed"), + (reinterpret_cast(elementData))->ParameterSetCount() ); + + ParseAcParameters( aCtxImpl, + reinterpret_cast(*elementData ) ); + + // we also need to configure the ACs again + // + if ( !(aCtxImpl.WsaCmdActive()) ) + { + ConfigureAcParams( aCtxImpl ); + } + else + { + // WHA command is in progress so we must defer this access + aCtxImpl.RegisterEvent( KAcParamUpdate ); + } + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::ValidateHtBssOperationParams( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) + { + TUint8 length( 0 ); + const TUint8* elementData( NULL ); + + if ( WlanElementLocator::EWlanLocateOk == + aElementLocator.InformationElement( + E802Dot11HtOperationIE, + length, + &elementData ) ) + { + // HT Operation element found + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::ValidateHtBssOperationParams: element present")); + + if ( os_memcmp( + elementData, + &(aCtxImpl.GetNwHtOperationIe().iData), + sizeof( SHtOperationIeData ) ) ) + { + // content of the element has changed + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: element changed")); + + // store the changed element content to our context + aCtxImpl.GetNwHtOperationIe().SetIeData( + elementData, + length ); + + // inform the lower layers about the new HT operation + // configuration + if ( !(aCtxImpl.WsaCmdActive()) ) + { + ConfigureHtBssOperation( aCtxImpl ); + } + else + { + // WHA command is in progress so we must defer this access + aCtxImpl.RegisterEvent( KSetHtBssOperation ); + } + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::DoSetTxMpduDaAddress( + SDataFrameHeader& aDataFrameHeader, + const TMacAddress& aMac ) const + { + aDataFrameHeader.iAddress3 = aMac; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::DoIsRxFrameSAourAddress( + WlanContextImpl& aCtxImpl, + const SDataFrameHeader& aFrameHeader, + const SAmsduSubframeHeader* aSubFrameHeader ) const + { + if ( aSubFrameHeader ) + { + // the MSDU is part of an A-MSDU and the caller wants to use the + // SA in the subframe header for this check + return aSubFrameHeader->iSa == aCtxImpl.iWlanMib.dot11StationId; + } + else + { + // the caller wants to use the SA in the MAC header for this check + return aFrameHeader.iAddress3 == aCtxImpl.iWlanMib.dot11StationId; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::DoIsValidAddressBitCombination( + const SDataFrameHeader& aFrameHeader ) const + { + return (aFrameHeader.IsFromDsBitSet() && !(aFrameHeader.IsToDsBitSet())); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::DoBuildEthernetFrame( + TDataBuffer& aBuffer, + const SDataMpduHeader& aDot11DataMpdu, + const TUint8* aStartOfEtherPayload, + TUint aEtherPayloadLength, + TBool aAmsdu, + TUint8* aCopyBuffer ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::DoBuildEthernetFrame")); + + TUint8* realEtherPayloadStart ( const_cast(aStartOfEtherPayload) ); + + if ( aCopyBuffer ) + { + // the frame needs to be copied to the copy buffer + + // update to point to the new location + realEtherPayloadStart = aCopyBuffer + ( 2 * sizeof( TMacAddress ) ); + + os_memcpy( + realEtherPayloadStart, + aStartOfEtherPayload, + aEtherPayloadLength ); + } + + if ( aAmsdu ) + { + // this MSDU is part of an A-MSDU. Assign SA and DA from subframe + // header + const SAmsduSubframeHeader* KSubframeHeader ( + reinterpret_cast( + aStartOfEtherPayload + - sizeof( SSnapHeader ) + - sizeof( SAmsduSubframeHeader ) ) ); + + // copy SA to the correct location. + // We do that first so that it doesn't get overwritten by DA + os_memcpy( + const_cast(realEtherPayloadStart) - sizeof( TMacAddress ), + reinterpret_cast(KSubframeHeader->iSa.iMacAddress), + sizeof( TMacAddress ) ); + + // copy DA to the correct location. + os_memcpy( + const_cast(realEtherPayloadStart) + - ( 2 * sizeof( TMacAddress ) ), + reinterpret_cast(KSubframeHeader->iDa.iMacAddress ), + sizeof( TMacAddress ) ); + + } + else + { + // assign SA and DA from MAC header + + // copy SA to the correct location. + // We do that first so that it doesn't get overwritten by DA + os_memcpy( + const_cast(realEtherPayloadStart) - sizeof( TMacAddress ), + reinterpret_cast( + aDot11DataMpdu.iHdr.iAddress3.iMacAddress ), + sizeof( TMacAddress ) ); + + // copy DA to the correct location. + os_memcpy( + const_cast(realEtherPayloadStart) + - ( 2 * sizeof( TMacAddress ) ), + reinterpret_cast( + aDot11DataMpdu.iHdr.iAddress1.iMacAddress ), + sizeof( TMacAddress ) ); + } + + // set the length + aBuffer.KeSetLength( + aEtherPayloadLength + + ( sizeof( TMacAddress ) * 2 ) ); + + // set the frame type + aBuffer.FrameType( TDataBuffer::KEthernetFrame ); + + // set the offset to the beginning of the ready ethernet frame + // from the beginning of the Rx buf + aBuffer.KeSetOffsetToFrameBeginning( + realEtherPayloadStart - ( 2 * sizeof( TMacAddress ) ) // frame beginning + - aBuffer.KeGetBufferStart() ); // buffer beginning + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::DoBuildEthernetFrame: offset to frame beginning: %d"), + aBuffer.KeOffsetToFrameBeginning()); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::DoConsecutivePwrModeSetFailuresIndication( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.OnConsecutivePwrModeSetFailures() ) + { + OnInDicationEvent( aCtxImpl, EConsecutivePwrModeSetFailures ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::Disconnect( WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KInfoLevel, (TUint8*)("UMAC: WlanDot11InfrastructureMode::Disconnect():")); + + // set completion code to idle state + // as it does the request completion + + aCtxImpl.iStates.iIdleState.Set( KErrNone ); + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iDeauthPendingState // next state + ); + + // signal caller that state transition occurred + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + // scanning mode requested + // set parameters + // NOTE: OID command parameters are guaranteed to be valid + // to the point a correcponding completion method is called + + aCtxImpl.iStates.iInfrastructureScanningMode.Set( + aMode, aSSID, aScanRate, aChannels, + aMinChannelTime, aMaxChannelTime, aSplitScan ); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iInfrastructureScanningMode // next state + ); + + return ETrue; // global statemachine transition will occur + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ) + { + TWlanUserTxDataCntx& data_cntx( aCtxImpl.GetMgmtTxDataCntx() ); + + // make a note of the frame type + const TDataBuffer::TFrameType frameType( aDataBuffer.FrameType() ); + + TUint16 etherType( 0 ); // initial value: not relevant + + // construct a dot11 frame from databuffer to storage + EncapsulateFrame( aCtxImpl, data_cntx, aDataBuffer, etherType ); + + // start of dot11 frame to send + const TUint8* start_of_frame( data_cntx.StartOfFrame() ); + + // select correct tx queue + const WHA::TQueueId queue_id( + QueueId( aCtxImpl, start_of_frame ) ); + + T802Dot11FrameControlTypeMask dot11FrameType ( E802Dot11FrameTypeDataEapol ); + TBool useSpecialTxAutoRatePolicy( EFalse ); + + switch ( frameType ) + { + case TDataBuffer::KEthernetFrame: + // dot11FrameType already correct + + // request special Tx autorate policy use for EAPOL and WAI frames + useSpecialTxAutoRatePolicy = ETrue; + break; + case TDataBuffer::KDot11Frame: + dot11FrameType = E802Dot11FrameTypeManagementAction; + break; + case TDataBuffer::KSnapFrame: + // these frames have the same Tx completion handling as Eapol + // frames so we use the same dot11FrameType value - which is + // already correct - for them, too + break; + case TDataBuffer::KEthernetTestFrame: + dot11FrameType = E802Dot11FrameTypeTestFrame; + break; + default: + // programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: unsupported frame type: %d"), frameType ); + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // push the frame to packet scheduler for transmission + aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + data_cntx.LengthOfFrame(), + queue_id, + dot11FrameType, + &aDataBuffer, + EFalse, + EFalse, + useSpecialTxAutoRatePolicy ); + + // now just wait for the scheduler to call completion methods + + if ( frameType == TDataBuffer::KEthernetFrame ) + { + // check if we need to change power mgmt mode because of the frame Tx + + const TPowerMgmtModeChange KPowerMgmtModeChange ( + aCtxImpl.OnFrameTx( queue_id, etherType ) ); + + // if any change change is needed regarding our power mgmt mode, + // proceed with it + PowerMgmtModeChange( aCtxImpl, KPowerMgmtModeChange ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::DoRcpiIndication( + WlanContextImpl& aCtxImpl, + WHA::TRcpi aRcpi ) + { + OsTracePrint( KWlmIndication, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::DoRcpiIndication: rcpi: %d"), + aRcpi ); + + OnInDicationEvent( aCtxImpl, ERcpiTrigger ); + + // restore the MIB back to its default value, i.e. zero. + // This means that no further RCPI indications should arrive from WHA + // layer until the RCPI threshold is set again by WLAN Mgmt Client + if ( !(aCtxImpl.WsaCmdActive()) ) + { + SetRcpiTriggerLevelMib( aCtxImpl, WHA::KRcpiThresholdDefault, EFalse ); + } + else + { + // WHA command is in progress so we must defer this access + aCtxImpl.RegisterEvent( KSetRcpiTriggerLevel ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureMode::DoPsModeErrorIndication( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWlmIndication, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::DoPsModeErrorIndication") ); + + OnInDicationEvent( aCtxImpl, EPsModeError ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::OnVoiceCallEntryTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + aCtxImpl.OnVoiceCallEntryTimerTimeout(); + + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::OnNullTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + aCtxImpl.OnNullTimerTimeout(); + + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::OnNoVoiceTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + aCtxImpl.OnNoVoiceTimerTimeout(); + + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::OnKeepAliveTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + aCtxImpl.OnKeepAliveTimerTimeout(); + + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::OnWlanWakeUpIntervalChange( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: : WlanDot11InfrastructureMode::OnWlanWakeUpIntervalChange")); + + WHA::SwlanWakeUpInterval* mib + = static_cast + (os_alloc( sizeof( WHA::SwlanWakeUpInterval ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OnOidComplete( aCtxImpl ); // complete also + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11InfrastructureMode::OnWlanWakeUpIntervalChange: alloc failed, abort") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + // determine the desired new wake-up setting + const TDot11PsModeWakeupSetting KDesiredPsModeConfig ( + aCtxImpl.DesiredPsModeConfig() ); + + // take it into use + + mib->iMode = KDesiredPsModeConfig.iWakeupMode; + mib->iListenInterval = KDesiredPsModeConfig.iListenInterval; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, WHA::KMibWlanWakeUpInterval, sizeof(*mib), mib ); + + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC: WlanDot11InfrastructureMode::OnWlanWakeUpIntervalChange: desired mode: %d"), + mib->iMode ); + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::OnWlanWakeUpIntervalChange: desired listen interval: %d"), + mib->iListenInterval ); + + // store the new setting also locally + aCtxImpl.iWlanMib.iWlanWakeupInterval = mib->iMode; + aCtxImpl.iWlanMib.iWlanListenInterval = mib->iListenInterval; + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd, // next state + // the ACT signals that this operation should be completed to user + WlanDot11State::KCompleteManagementRequest + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + + // signal state transition change + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureMode::TxNullDataFrame( + WlanContextImpl& aCtxImpl, + TBool aQosNull ) + { + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureMode::TxNullDataFrame: aQosNull: %d"), + aQosNull ); + + TBool status ( ETrue ); + + TUint32 lengthOfFrame( 0 ); + T802Dot11FrameControlTypeMask frameType( E802Dot11FrameTypeDataNull ); + + // copy Null Data frame to tx-buffer to correct offset + // client doesn't need to take care of the tx buffer header space + // as the method below does it by itself + TUint8* start_of_frame = aCtxImpl.TxBuffer(); + + if ( start_of_frame ) + { + if ( aQosNull ) + { + // transmit of QoS Null Data Frame requested + + lengthOfFrame = aCtxImpl.QosNullDataFrameLength(); + frameType = E802Dot11FrameTypeQosDataNull; + + os_memcpy( + start_of_frame, + &(aCtxImpl.QosNullDataFrame()), + lengthOfFrame ); + + // as this needs to be a trigger frame for Voice AC, set the User + // Priority of the frame accordingly + + const TUint8 K802Dot1dPriorityVoice = 6; + SQosDataFrameHeader* qosHdr = + reinterpret_cast(start_of_frame); + qosHdr->SetUserPriority( K802Dot1dPriorityVoice ); + + // note that the Order bit of the Frame Control field of the QoS + // Null data frame has already been given the correct value in + // WlanMacActionState::OnDot11InfrastructureModeStateSpaceEntry() + // method + } + else + { + // transmit of Null Data Frame requested + + lengthOfFrame = sizeof( SNullDataFrame ); + // frame type is already correct for this case + + os_memcpy( + start_of_frame, + &(aCtxImpl.NullDataFrame()), + lengthOfFrame ); + } + + // determine Tx queue + const WHA::TQueueId queue_id( QueueId( aCtxImpl, start_of_frame ) ); + + // send the Null Data frame by pushing it to packet scheduler + aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + lengthOfFrame, + queue_id, + frameType, + NULL, + EFalse, + EFalse ); + } + else + { + // we didn't get a Tx buffer so we can't submit a frame send request. + status = EFalse; + } + + return status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureModeInit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InfrastructureModeInit.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,962 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDot11InfrastructureModeInit class +* +*/ + +/* +* %version: 40 % +*/ + +#include "config.h" +#include "UmacDot11InfrastructureModeInit.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaSetBssParameters.h" +#include "umacelementlocator.h" + + +// amount of memory allocated in the mib write buffer +const TUint KMibBufferAllocLen( 100 ); + +#ifndef NDEBUG +const TInt8 WlanDot11InfrastructureModeInit::iName[] + = "dot11-infrastructuremodeinit"; + +const TUint8 WlanDot11InfrastructureModeInit::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EENABLEBEACONRX"}, + {"ESETNULLDATAFRAMETEMPLATE"}, + {"ESETQOSNULLDATAFRAMETEMPLATE"}, + {"ESETPSPOLLTEMPLATE"}, + {"EWAIT4BEACON"}, + {"EDISABLEBEACONRX"}, + {"ESETBSSPARAMS"}, + {"ECONFBEACONFILTERIETABLE"}, + {"EWAIT4USERDATAENABLE"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11InfrastructureModeInit::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"EBEACONPROCESSED"}, + {"EUSERDATAENABLE"}, + {"EABORT"} + }; +#endif + +// beacon has been processed +const TUint32 KBeaconHandled = (1 << 0); +// scan OID has been issued +const TUint32 KScanning = (1 << 1); +// BSS Parameters have been set +const TUint32 KBssParamsSet = (1 << 2); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11InfrastructureModeInit::~WlanDot11InfrastructureModeInit() + { + iMibMemoryBuffer = NULL; + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11InfrastructureModeInit::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::Entry( + WlanContextImpl& aCtxImpl) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC* panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( !(aCtxImpl.DispatchEvent()) ) + { + // no state transition occurred + // dispatcher might or might not have had an event to be dispatched + // in any case we are still in the current state and can continue... + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + else // --- !(aCtxImpl.DispatchEvent()) + { + // state transition occurred + // we are no longer in the current state, + // so we won't do anything as we might mess things up + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + if ( !(iFlags & KScanning) ) + { + // we are about to make a transition to another dot11 state + // and that state is not the scanning state + // from scanning state we shall come back to this dot11 state + // so basically this means that + // only thing we shall do is to reset our FSM for the next round... + iState = EINIT; + os_free( iMibMemoryBuffer ); + iMibMemoryBuffer = NULL; + } + else + { + iFlags &= ~KScanning; + + OsTracePrint( KScan, (TUint8*) + ("UMAC * dot11-infrastructuremodeinit * switch to scan mode") ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanDot11InfrastructureModeInit::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC * dot11-infrastructuremodeinit * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*)("event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*)("state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EBEACONPROCESSED: + OnBeaconProcessedEvent( aCtxImpl ); + break; + case EUSERDATAENABLE: + OnUserDataEnableEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + iMibMemoryBuffer = os_alloc( KMibBufferAllocLen ); + if ( iMibMemoryBuffer ) + { + // reset event flag and continue with the state traversal + iFlags = 0; + ChangeInternalState( aCtxImpl, EENABLEBEACONRX ); + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + break; + case EENABLEBEACONRX: + // enable beacon frame reception + EnableBeaconRx( aCtxImpl ); + break; + case ESETNULLDATAFRAMETEMPLATE: + // configure NULL data frame template + SetNullDataFrameTemplate( aCtxImpl ); + break; + case ESETQOSNULLDATAFRAMETEMPLATE: + // configure NULL data frame template + SetQosNullDataFrameTemplate( aCtxImpl ); + break; + case ESETPSPOLLTEMPLATE: + // configure ps poll frame template + SetPsPollFrameTemplate( aCtxImpl ); + break; + case ESETBSSPARAMS: + // set the BSS parameters + SetBssParams( aCtxImpl ); + break; + case EDISABLEBEACONRX: + // disable beacon frame reception + DisableBeaconRx( aCtxImpl ); + break; + case ECONFBEACONFILTERIETABLE: + // configure beaconfiltertable MIB + ConfigureBeaconFilterIeTable( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + // continue dot11 state traversal to dot11awake mode + // or to dot11eneterdoze state + ContinueDot11StateTraversal( aCtxImpl ); + break; + // these critters don't have an entry action + // but the entry event gets sent automatically by the framework + // from state traversal method so they have to be defined here + case EWAIT4BEACON: + case EWAIT4USERDATAENABLE: + break; + default: + // catch internal FSM programming error + OsTracePrint( + KErrorLevel, + (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnStateEntryEvent(): state: %d"), + iState); + OsAssert( + (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnStateEntryEvent(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4BEACON: + // event handler for this state is needed + // as we may re-enter this dot11 state (e.g. from scanning state + // or because we autonomously requested a WHA cmd to be executed) + // while waiting for this event to occur + if ( iFlags & KBeaconHandled ) + { + // give a correct event for the FSM critter + Fsm( aCtxImpl, EBEACONPROCESSED ); + } + break; + case EWAIT4USERDATAENABLE: + // event handler for this state is needed + // as we may re-enter this dot11 state (e.g. from scanning state + // or because we autonomously requested a WHA cmd to be executed) + // while waiting for this event to occur + if ( aCtxImpl.ProtocolStackTxDataAllowed() ) + { + // give a correct event for the FSM critter + Fsm( aCtxImpl, EUSERDATAENABLE ); + } + break; + case EENABLEBEACONRX: + ChangeInternalState( aCtxImpl, + ESETNULLDATAFRAMETEMPLATE ); + break; + case ESETNULLDATAFRAMETEMPLATE: + ChangeInternalState( aCtxImpl, + ESETQOSNULLDATAFRAMETEMPLATE ); + break; + case ESETQOSNULLDATAFRAMETEMPLATE: + ChangeInternalState( aCtxImpl, + ESETPSPOLLTEMPLATE ); + break; + case ESETPSPOLLTEMPLATE: + // as we have configured the ps poll frame we shall now + // complete the request + CompleteConnectRequest( aCtxImpl, KErrNone ); + ChangeInternalState( aCtxImpl, + EWAIT4BEACON ); + break; + case EDISABLEBEACONRX: + ChangeInternalState( aCtxImpl, + ESETBSSPARAMS ); + break; + case ESETBSSPARAMS: + ChangeInternalState( aCtxImpl, + ECONFBEACONFILTERIETABLE ); + break; + case ECONFBEACONFILTERIETABLE: + if ( aCtxImpl.ProtocolStackTxDataAllowed() ) + { + // user data enabled continue + // state traversal + ChangeInternalState( aCtxImpl, + ECONTINUEDOT11TRAVERSE ); + } + else + { + // user data is not enabled wait 4 it + ChangeInternalState( aCtxImpl, + EWAIT4USERDATAENABLE ); + } + + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("state: %d"), iState); + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::OnBeaconProcessedEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4BEACON: + // continue state traversal + ChangeInternalState( aCtxImpl, EDISABLEBEACONRX ); + break; + default: + // if the beacon gets processed in an earlier internal + // state than EWAIT4BEACON, we won't change to + // EDISABLEBEACONRX as it would disrupt the sequence + // of actions. So we will do this internal state change + // later in its due time + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::OnUserDataEnableEvent( + WlanContextImpl& aCtxImpl ) + { + // continue state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-infrastructuremodeinit * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::EnableBeaconRx( + WlanContextImpl& aCtxImpl ) + { + const TUint32 KBeaconRxEnableValue( 1 ); + + WHA::SbeaconFilterEnable* mib + = static_cast(iMibMemoryBuffer); + + // enable reception of every beacon from the BSS + mib->iEnable = EFalse; + // even though this attribute is nowadays deprecated, we still continue to + // set it in this case; to be on the safe side + mib->iCount = KBeaconRxEnableValue; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibBeaconFilterEnable, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::DisableBeaconRx( + WlanContextImpl& aCtxImpl ) + { + const TUint32 KBeaconRxDisableValue( 0 ); + + WHA::SbeaconFilterEnable* mib + = static_cast(iMibMemoryBuffer); + + // disable reception of beacons except those specified + // by beaconFilterIeTable + mib->iEnable = ETrue; + mib->iCount = KBeaconRxDisableValue; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibBeaconFilterEnable, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::SetNullDataFrameTemplate( + WlanContextImpl& aCtxImpl ) + { + TUint32 mibLength( + WHA::StemplateFrame::KHeaderSize + + sizeof( SNullDataFrame ) ); + + // align length of MIB to 4-byte boundary + mibLength = Align4( mibLength ); + + if ( mibLength > KMibBufferAllocLen ) + { + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: mib length: %d"), mibLength); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + WHA::StemplateFrame* mib + = static_cast(iMibMemoryBuffer); + + mib->iFrameType = WHA::KNullDataTemplate; + + mib->iInitialTransmitRate = InitialSpecialFrameTxRate( aCtxImpl ); + mib->iLength = sizeof( SNullDataFrame ); + + // copy the null data frame after the mib header + os_memcpy( mib->iTemplateData, + reinterpret_cast(&(aCtxImpl.NullDataFrame())), + sizeof( SNullDataFrame ) ); + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, + WHA::KMibTemplateFrame, + mibLength, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::SetQosNullDataFrameTemplate( + WlanContextImpl& aCtxImpl ) + { + const TUint16 KQosNullDataFrameLength ( aCtxImpl.QosNullDataFrameLength() ); + TUint16 mibLength( + WHA::StemplateFrame::KHeaderSize + + KQosNullDataFrameLength ); + + // align length of MIB to 4-byte boundary + mibLength = Align4( mibLength ); + + if ( mibLength > KMibBufferAllocLen ) + { + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: mib length: %d"), mibLength); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + WHA::StemplateFrame* mib + = static_cast(iMibMemoryBuffer); + + mib->iFrameType = WHA::KQosNullDataTemplate; + mib->iInitialTransmitRate = InitialSpecialFrameTxRate( aCtxImpl ); + mib->iLength = KQosNullDataFrameLength; + + // note that the Order bit of the Frame Control field of the QoS Null data + // frame template has already been given the correct value in + // WlanMacActionState::OnDot11InfrastructureModeStateSpaceEntry() method + + // copy the QoS null data frame after the mib header + os_memcpy( mib->iTemplateData, + reinterpret_cast(&(aCtxImpl.QosNullDataFrame())), + KQosNullDataFrameLength ); + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, + WHA::KMibTemplateFrame, + mibLength, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::SetPsPollFrameTemplate( + WlanContextImpl& aCtxImpl ) + { + TUint32 mibLength( + WHA::StemplateFrame::KHeaderSize + + sizeof( SPsPoll ) ); + + // align length of MIB to 4-byte boundary + mibLength = Align4( mibLength ); + + if ( mibLength > KMibBufferAllocLen ) + { + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: mib length: %d"), mibLength); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + WHA::StemplateFrame* mib + = static_cast(iMibMemoryBuffer); + + mib->iFrameType = WHA::KPSPollTemplate; + + mib->iInitialTransmitRate = InitialSpecialFrameTxRate( aCtxImpl ); + mib->iLength = sizeof( SPsPoll ); + + // construct the ps poll frame after the mib header + new (mib->iTemplateData) SPsPoll( + static_cast(aCtxImpl.Aid()), + aCtxImpl.GetBssId(), + aCtxImpl.iWlanMib.dot11StationId ); + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, + WHA::KMibTemplateFrame, + mibLength, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::SetBssParams( + WlanContextImpl& aCtxImpl ) + { + WlanWsaSetBssParameters& wsa_cmd = aCtxImpl.WsaSetBssParameters(); + + OsTracePrint( KDot11StateTransit | KUmacDetails, (TUint8*) + ("UMAC * dot11-infrastructuremodeinit * DTIM period: %d"), iDtim ); + OsTracePrint( KDot11StateTransit | KUmacDetails, + (TUint8*)("UMAC * dot11-infrastructuremodeinit * AID: 0x%04x"), + aCtxImpl.Aid() ); + + wsa_cmd.Set( aCtxImpl, iDtim, aCtxImpl.Aid() ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + + iFlags |= KBssParamsSet; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnBeaconFrameRx()") ); + + if ( !(iFlags & KBeaconHandled) ) + { + OsTracePrint( KDot11StateTransit | KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnBeaconFrameRx: process beacon frame") ); + + // buffer begin + const TUint8* ptr = reinterpret_cast(aFrame); + + // bypass mac header, timestamp fixed field, beacon interval fixed field + // and capability fixed field + const TUint8 offset = + KMacHeaderLength + + KTimeStampFixedFieldLength + + KBeaconIntervalFixedFieldLength + + KCapabilityInformationFixedFieldLength; + ptr += offset; // we now point to the beginning of IEs + + // ---- begin: extract DTIM period ---- + + WlanElementLocator elementLocator( ptr, aLength - offset ); + TUint8 elementDatalength( 0 ); + const TUint8* elementData( NULL ); + + // if TIM IE is not found or the value of DTIM period in the IE is + // zero, we use this value for DTIM period + const TUint8 KRecoveryDtimPeriod ( 1 ); + + if ( WlanElementLocator::EWlanLocateOk == + elementLocator.InformationElement( + E802Dot11TimIE, + elementDatalength, + &elementData ) ) + { + // extract DTIM period + + const TUint KDtimOffset ( 1 ); + iDtim = elementData[KDtimOffset] ? + elementData[KDtimOffset] : KRecoveryDtimPeriod; + + OsTracePrint( KDot11StateTransit | KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnBeaconFrameRx: DTIM period: %d"), + iDtim ); + } + else + { + // TIM IE not found + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnBeaconFrameRx: WARNING: TIM IE extraction failure") ); + + iDtim = KRecoveryDtimPeriod; + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnBeaconFrameRx: fake DTIM period to %d"), + iDtim ); + } + + // ---- end: extract DTIM period ---- + + // we now point just after TIM IE + + iFlags |= KBeaconHandled; // mark us handled + + // forward the beacon frame to Wlan Mgmt client + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::OnBeaconFrameRx: fwd the beacon to Wlan Mgmt client") ); + XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + + if ( !(aCtxImpl.WsaCmdActive()) ) + { + // no WHA command pending send event to the fsm + Fsm( aCtxImpl, EBEACONPROCESSED ); + } + + } + else // --- !(iFlags & KBeaconHandled) --- + { + // we have already processed a beacon in this dot11 state + // so we have nothing to do + + // except to release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::ConfigureBeaconFilterIeTable( + WlanContextImpl& aCtxImpl ) + { + TUint32 mibLength = WHA::SbeaconFilterIeTable::KHeaderSize; + + WHA::SbeaconFilterIeTable* mib + = static_cast(iMibMemoryBuffer); + + // ================================================================= + // track ERP information IE for change + // ================================================================= + // + WHA::SDefaultIeFilterTable* filter_table( + reinterpret_cast(mib->iIeTable) ); + + filter_table->iIe = E802Dot11ErpInformationIE; + filter_table->iTreatMeant = WHA::SDefaultIeFilterTable::KTrackChange; + + mibLength += sizeof( WHA::SDefaultIeFilterTable ); + + // ================================================================= + // track WMM Parameter Element for change + // ================================================================= + // + WHA::SIe221FilterTable* filterTableEntry( + reinterpret_cast(filter_table + 1) ); + + filterTableEntry->iIe = E802Dot11VendorSpecificIE; + filterTableEntry->iTreatMeant = WHA::SIe221FilterTable::KTrackChange; + + os_memcpy( filterTableEntry->iOui, KWmmElemOui, sizeof( KWmmElemOui ) ); + filterTableEntry->iType = KWmmElemOuiType; + + // For this element we have to assign both + // OUI Subtype (1 byte) and Version (1 byte) into the same + // iVersion (2 bytes) field of the SIe221FilterTable struct + // and in such a way that the OUI Subtype is in the lower memory + // address + // + TUint16 version = static_cast(KWmmParamElemVersion) << 8; + version |= static_cast(KWmmParamElemOuiSubtype); + WriteHtoUint16( &(filterTableEntry->iVersion), version ); + + mibLength += sizeof( WHA::SIe221FilterTable ); + mib->iNumofElems = 2; // at this point + + // ================================================================= + // track HT Operation element for change, if relevant + // ================================================================= + // + if ( aCtxImpl.HtSupportedByNw() ) + { + filter_table = reinterpret_cast( + filterTableEntry + 1); + + filter_table->iIe = E802Dot11HtOperationIE; + filter_table->iTreatMeant = WHA::SDefaultIeFilterTable::KTrackChange; + + mibLength += sizeof( WHA::SDefaultIeFilterTable ); + ++(mib->iNumofElems); + } + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + // align length of MIB to 4-byte boundary + mibLength = Align4( mibLength ); + + wsa_cmd.Set( + aCtxImpl, + WHA::KMibBeaconFilterIeTable, + mibLength, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureModeInit::EnableUserData( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InfrastructureModeInit::EnableUserData")); + + TBool stateChange( EFalse ); + aCtxImpl.iEnableUserData = ETrue; + OnOidComplete( aCtxImpl ); + aCtxImpl.iUmac.UserDataReEnabled(); + + if ( iState == EWAIT4USERDATAENABLE ) + { + // we shall continue travesal + stateChange = ETrue; + Fsm( aCtxImpl, EUSERDATAENABLE ); + } + + // signal global state transition event + return stateChange; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureModeInit::RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + // scanning mode requested + // set parameters + // NOTE: OID command parameters are guaranteed to be valid + // to the point a correcponding completion method is called + + // marker for Exit() method -> see it to believe it + iFlags |= KScanning; + + aCtxImpl.iStates.iInfrastructureScanningMode.Set( + aMode, aSSID, aScanRate, aChannels, + aMinChannelTime, aMaxChannelTime, aSplitScan, + // if we have not yet set the BSS parameters, we need to use + // foreground scan instead of background scan (which we normally + // use in infrastructure mode). This is to avoid a situation where the + // WLAN vendor sw would need to send a PS Poll frame, when the AID is + // not set yet + iFlags & KBssParamsSet ? WHA::EForcedBgScan : WHA::EFgScan ); + + // mark dot11 state backtrack + aCtxImpl.iStates.iInfrastructureScanningMode.Dot11StateBackTrack(); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iInfrastructureScanningMode // next state + ); + + return ETrue; // global statemachine transition will occur + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + // Start Voice over WLAN Call maintenance + aCtxImpl.StartVoiceOverWlanCallMaintenance(); + + // start to keep the WLAN connection alive + aCtxImpl.StartKeepAlive(); + + if ( aCtxImpl.CurrentDot11PwrMgmtMode() != + aCtxImpl.DesiredDot11PwrMgmtMode() ) + { + // dot11 power management mode change is needed + + // initialize the counter which we use to determine if we should + // indicate BSS lost if we continuously are unsuccessful in changing the + // power mgmt mode + aCtxImpl.InitializeSetPsModeCount(); + + ChangeState( aCtxImpl, + *this, + aCtxImpl.iStates.iPwrMgmtTransitionMode ); + } + else + { + // no power management mode change is needed + ChangeState( aCtxImpl, + *this, + aCtxImpl.iStates.iInfrastructureNormalMode ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureModeInit::CompleteConnectRequest( + WlanContextImpl& aCtxImpl, + TInt aCompletionCode ) const + { + OnOidComplete( aCtxImpl, aCompletionCode ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InitPhase1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11InitPhase1.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,672 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11InitPhase1 class +* +*/ + +/* +* %version: 34 % +*/ + +#include "config.h" +#include "UmacDot11InitPhase1.h" +#include "UmacContextImpl.h" +#include "UmacWsaInitiliaze.h" +#include "UmacWsaConfigure.h" +#include "UmacWsaReadMib.h" +#include "umacconfiguretxqueueparams.h" + +#ifndef NDEBUG +const TInt8 WlanDot11InitPhase1::iName[] = "dot11-initphase"; + +const TUint8 WlanDot11InitPhase1::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EINITILIAZE"}, + {"ECOMPLETEBOOTUP"}, + {"EWAIT4OIDCONFIGURE"}, + {"EHANDLEOIDCONFIGURE"}, + {"ECONFIGURE"}, + {"EREADSTATIONID"}, + {"ECONFTXQUEUE"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11InitPhase1::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, {"ETXCOMPLETE"}, {"EOIDCONFIGURE"}, {"EABORT"} + }; +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11InitPhase1::~WlanDot11InitPhase1() + { + iPda = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11InitPhase1::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::Entry( WlanContextImpl& aCtxImpl) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // no need to do event dispatching in here + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::Exit( WlanContextImpl& aCtxImpl) + { + // executed upon dot11 state traversal to another dot11 state + // reset local statemachine + // and set user completion code + aCtxImpl.iStates.iIdleState.Set( KErrNone ); + iState = EINIT; + + // always deallocate + OsTracePrint( KInitLevel, + (TUint8*)("UMAC * dot11-initphase * free pda memory") ); + os_free( iPda ); + iPda = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanDot11InitPhase1::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC * dot11-initphase * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*)("event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*)("state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EOIDCONFIGURE: + OnOIDConfigureEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// WlanDot11InitPhase1::OnStateEntryEvent +// Handler for state entry event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + // start the FSM traversal + ChangeInternalState( aCtxImpl, EINITILIAZE ); + break; + case EINITILIAZE: + Initialize( aCtxImpl ); + break; + case ECOMPLETEBOOTUP: + CompleteOid( aCtxImpl ); + ChangeInternalState( aCtxImpl, EWAIT4OIDCONFIGURE ); + break; + case EWAIT4OIDCONFIGURE: + // nothing + break; + case EHANDLEOIDCONFIGURE: + HandleOIDConfigure( aCtxImpl ); + ChangeInternalState( aCtxImpl, ECONFIGURE ); + break; + case ECONFIGURE: + Configure( aCtxImpl ); + break; + case EREADSTATIONID: + ReadStationID( aCtxImpl ); + break; + case ECONFTXQUEUE: + // configure just the legacy Tx queue + ConfigureQueue( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + // our dot11 transition is fixed and we shall take it + // change global dot11 state: entry procedure triggers action + // but first we shall construct a rate lookup table + aCtxImpl.MakeLookUpTable(); + + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KHtOperation ) + { + // HT supported by lower layer. As our HT capabilities can't + // change dynamically, we'll configure our HT capabilities + // element only once; and we do it here + ConfigureOurHtCapabilitiesElement( aCtxImpl ); + } + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iMibDefaultConfigure // next state + ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// WlanDot11MibDefaultConfigure::OnTxCompleteEvent +// Handler for tx complete event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINITILIAZE: + ChangeInternalState( aCtxImpl, ECOMPLETEBOOTUP ); + break; + case ECONFIGURE: + ChangeInternalState( aCtxImpl, EREADSTATIONID ); + break; + case EREADSTATIONID: + ChangeInternalState( aCtxImpl, ECONFTXQUEUE ); + break; + case ECONFTXQUEUE: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// simulate macnotresponding error +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::OnAbortEvent( WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, (TUint8*)("UMAC * dot11-initphase * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::OnOIDConfigureEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4OIDCONFIGURE: + ChangeInternalState( aCtxImpl, EHANDLEOIDCONFIGURE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC * state: %d"), iState); + OsAssert( + (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::Initialize( + WlanContextImpl& aCtxImpl ) + { + ChangeState( aCtxImpl, + *this, // previous state + aCtxImpl.WsaInitiliaze() // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::Configure( WlanContextImpl& aCtxImpl ) + { + // set dot11maxtransmitmsdulifetime + WHA::SConfigureDataBase* ptr + = reinterpret_cast(iPda); + ptr->iDot11MaxTransmitMsduLifeTime + = aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetimeDefault; + + // set context for configure + aCtxImpl.WsaConfigure().Set( aCtxImpl, iPda, iPdaLen ); + ChangeState( aCtxImpl, + *this, // previous state + aCtxImpl.WsaConfigure() // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::ReadStationID( WlanContextImpl& aCtxImpl ) + { + aCtxImpl.WsaReadMib().Set( aCtxImpl, WHA::KMibDot11StationId ); + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // previous state + aCtxImpl.WsaReadMib() // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::CompleteOid( WlanContextImpl& aCtxImpl ) const + { + // this is just an oid for us to complete... + OnOidComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::HandleOIDConfigure( WlanContextImpl& aCtxImpl ) + { + OnConfigureUmacMib( aCtxImpl, iRTSThreshold, iMaxTxMSDULifetime ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::ConfigureQueue( + WlanContextImpl& aCtxImpl ) + { + ConfigureTxQueue( aCtxImpl, WHA::ELegacy ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ) + { + if ( !aAct ) + { + // this is a response to a command that was generated + // by this dot11 state object layer + if ( aCommandId == WHA::EReadMIBResponse ) + { + // store station ID to UMAC MIB + os_memcpy( + &(aCtxImpl.iWlanMib.dot11StationId), + aCommandResponseParams.iReadMibResponse.iData, + sizeof(aCtxImpl.iWlanMib.dot11StationId) ); + + // trace the critter + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC * MAC address of the interface: "), + aCtxImpl.iWlanMib.dot11StationId ); + + // as station id has been received + // we shall configure the frame templates + ConfigureUmacFrameTemplates( aCtxImpl ); + } + else // -- aCommandId == WHA::EReadMIBResponse + { + // nothing else is no interest to us + } + } + else // -- aAct != WlanDot11State::KCompleteManagementRequest + { + // this is a response to a command that was not generated + // by this dot11 state object layer + // so lets forward it to the default handler + WlanDot11State::OnWhaCommandResponse( + aCtxImpl, + aCommandId, + aStatus, + aCommandResponseParams, + aAct ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::FinitSystem( WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InitPhase1::FinitSystem") ); + + // if the control comes here it means that we have not been able to + // initialize the system, which also means that WHA::Initialize() has not + // been called yet, but we are nevertheless instructed to stop using the + // system. As WHA::Initialize() hasn't been called, there's no need to ask + // WHA layer to release its resources (call WHA::Release()) in this + // situation. So the only thing we need to do is to complete the WLAN Mgmt + // Client request (with ok status) + OnOidComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::ConfigureUmacFrameTemplates( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11InitPhase1::ConfigureUmacFrameTemplates") ); + + // set our station id to association request, + // deauthentication, disassociation and reassociation + // frame header templates + aCtxImpl.GetAssociationRequestFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetHtAssociationRequestFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetDeauthenticateFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetHtDeauthenticateFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetDisassociationFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetHtDisassociationFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetReassociationRequestFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + aCtxImpl.GetHtReassociationRequestFrame().iHeader.iSA + = aCtxImpl.iWlanMib.dot11StationId; + + // set up NULL data frame + SNullDataFrame& null_data = aCtxImpl.NullDataFrame(); + null_data.iFrameControl.iType + = E802Dot11FrameTypeDataNull; + null_data.iAddress2 = aCtxImpl.iWlanMib.dot11StationId; + + // set up QoS NULL data frame + SHtQosNullDataFrame& qosNullData = aCtxImpl.QosNullDataFrame(); + qosNullData.iQosDataFrameHdr.iHdr.iFrameControl.iType + = E802Dot11FrameTypeQosDataNull; + qosNullData.iQosDataFrameHdr.iHdr.iAddress2 = + aCtxImpl.iWlanMib.dot11StationId; + // reset the QoS control field => normal ack requested + qosNullData.iQosDataFrameHdr.ResetQosControl(); + // clear the HT control field. Lower layer(s) will set it when applicable + qosNullData.ResetHtControl(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::ConfigureOurHtCapabilitiesElement( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11InitPhase1::ConfigureOurHtCapabilitiesElement") ); + + // configure HT capabilities info field + // + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetLdpcRx( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KLdpcRx ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetFortyMhzOperation( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::K40MhzChannel ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetSmPowerSave( + SHtCapabilitiesIeData::ESmPowerSaveDisabled ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetGreenfieldFormat( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KGreenfieldFormat ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetShortGiFor20Mhz( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KShortGiFor20Mhz ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetShortGiFor40Mhz( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KShortGiFor40Mhz ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetStbcTx( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KStbcTx ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetStbcRx( + aCtxImpl.WHASettings().iHtCapabilities.iRxStbc ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetDelayedBlockAck( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KDelayedBlockAck ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetMaxAmsduLength( + aCtxImpl.WHASettings().iHtCapabilities.iMaxAmsdu ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetDsssCckIn40Mhz( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KDsssCckIn40Mhz ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetPsmp( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KPsmp ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetLsigTxopProtection( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KLsigTxopProtection ); + + // configure A-MPDU parameters field + // + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetMaxAmpduLenExponent( + aCtxImpl.WHASettings().iHtCapabilities.iMaxAmpdu ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetMinMpduStartSpacing( + aCtxImpl.WHASettings().iHtCapabilities.iAmpduSpacing ); + + // configure supported MCS set field + // + os_memcpy( + aCtxImpl.GetOurHtCapabilitiesIe().iData.iRxMcsBitmask, + aCtxImpl.WHASettings().iHtCapabilities.iRxMcs, + sizeof( aCtxImpl.GetOurHtCapabilitiesIe().iData.iRxMcsBitmask ) ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetMaxRxDataRate( + aCtxImpl.WHASettings().iHtCapabilities.iRxMaxDataRate ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetTxMcsSetDefined( ETrue ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetTxRxMcsSetNotEqual( + os_memcmp( + aCtxImpl.WHASettings().iHtCapabilities.iRxMcs, + aCtxImpl.WHASettings().iHtCapabilities.iTxMcs, + sizeof( WHA::THtMcsSet ) ) ); + + // configure HT extended capabilities field + // + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetPco( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KPco ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetPcoTransitionTime( + aCtxImpl.WHASettings().iHtCapabilities.iPcoTransTime ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetMcsFeedback( + aCtxImpl.WHASettings().iHtCapabilities.iMcsFeedback ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetHtc( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KHtcField ); + aCtxImpl.GetOurHtCapabilitiesIe().iData.SetRdResponder( + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask & + WHA::KReverseDirectionResp ); + + // transmit beamforming capabilities; remains all zero + + // antenna selection capability; remains all zero + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InitPhase1::BootUp( + WlanContextImpl& aCtxImpl, + const TUint8* aPda, + TUint32 aPdaLength, + const TUint8* aFw, + TUint32 aFwLength ) + { + // allocate storage for pda + // pda must remain valid longer as we get dot11maxtransmitmsdulifetime + // from oid-configure + OsTracePrint( KInitLevel, + (TUint8*)("UMAC * dot11-initphase * FSM EVENT") ); + + iPda = static_cast(os_alloc( aPdaLength )); + if ( iPda ) + { + OsTracePrint( KInitLevel, + (TUint8*)("UMAC * dot11-initphase * allocate pda memory") ); + OsTracePrint( KInitLevel, (TUint8*)("length: %d"), aPdaLength ); + + iPdaLen = aPdaLength; + os_memcpy( iPda, aPda, iPdaLen ); + // set ctx for fw upload + aCtxImpl.WsaInitiliaze().Set( aCtxImpl, aFw, aFwLength ); + } + else + { + // allocation failure -> abort + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC * dot11-initphase * pda memory allocation failure") ); + Fsm( aCtxImpl, EABORT ); + } + + // manually start the fsm + Entry( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11InitPhase1::Configure( + WlanContextImpl& aCtxImpl, + TUint32 aRTSThreshold, + TUint32 aMaxTxMSDULifetime, + TUint32 aVoiceCallEntryTimeout, + TUint32 aVoiceCallEntryTxThreshold, + TUint32 aVoiceNullTimeout, + TUint32 aNoVoiceTimeout, + TUint32 aKeepAliveTimeout, + TUint32 aSpRcpiIndicationLevel, + TUint32 aSpTimeToCountPrediction, + TUint32 aSpMinIndicationInterval ) + { + // store parameters and feed an event to the fsm + iRTSThreshold = aRTSThreshold; + iMaxTxMSDULifetime = aMaxTxMSDULifetime; + aCtxImpl.SetNullSendControllerParameters( + aVoiceCallEntryTimeout, + aVoiceCallEntryTxThreshold, + aVoiceNullTimeout, + aNoVoiceTimeout, + aKeepAliveTimeout ); + + aCtxImpl.ConfigureWlanSignalPredictor( + aSpTimeToCountPrediction, + aSpMinIndicationInterval, + static_cast(aSpRcpiIndicationLevel) ); + + Fsm( aCtxImpl, EOIDCONFIGURE ); + + // state transition will occur upon this + return ETrue; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MacError.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MacError.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,513 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11MacError class. +* +*/ + +/* +* %version: 22 % +*/ + +#include "config.h" +#include "UmacDot11MacError.h" +#include "UmacContextImpl.h" +#include "umacwharelease.h" + +#ifndef NDEBUG +const TInt8 WlanDot11MacError::iName[] = "dot11-macerror"; +#endif // !NDEBUG + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11MacError::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( !(iFlags & KEntryExecuted) ) + { + iFlags |= KEntryExecuted; + + // cancel posssible pending timeouts... + aCtxImpl.CancelTimer(); + aCtxImpl.iUmac.CancelTimeout( EWlanVoiceCallEntryTimer ); + aCtxImpl.iUmac.CancelTimeout( EWlanNullTimer ); + aCtxImpl.iUmac.CancelTimeout( EWlanNoVoiceTimer ); + aCtxImpl.iUmac.CancelTimeout( EWlanKeepAliveTimer ); + aCtxImpl.iUmac.CancelTimeout( EWlanActiveToLightPsTimer ); + aCtxImpl.iUmac.CancelTimeout( EWlanLightPsToActiveTimer ); + aCtxImpl.iUmac.CancelTimeout( EWlanLightPsToDeepPsTimer ); + + // ... and indicate mac error + OnInDicationEvent( aCtxImpl, EHWFailed ); + + // we also + // mark WHA cmd inactive + aCtxImpl.DeActivateWsaCmd(); + // ... and enable oid requests + aCtxImpl.Enable( WlanEventDispatcher::KOidChannel ); + // ... to give some slack to the mgmt client to try to complete + // whatever it was doing when the error occurred, and then finally + // reset the system + + // complete possibly pending request with an error code + OnOidComplete( aCtxImpl, KErrGeneral ); + // complete possibly pending mgmt client Tx request + OnMgmtPathWriteComplete( aCtxImpl ); + } + else if ( iFlags & KCompleteOid ) + { + iFlags &= ~KCompleteOid; + OnOidComplete( aCtxImpl ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11MacError::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // nothing to do here + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11MacError::FinitSystem( + WlanContextImpl& aCtxImpl ) + { + // mark oid completion + iFlags |= KCompleteOid; + // execute transition + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WlanWhaRelease() // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11MacError::Indication( + WlanContextImpl& /*aCtxImpl*/, + WHA::TIndicationId /*aIndicationId*/, + const WHA::UIndicationParams& /*aIndicationParams*/ ) + { + // silently discard WHA indications as we are in error state + // there is no point of forwarding them to the layer above + } + +// we have defined handlers for the methods below as it is possible that they +// still get called after we have sent the HW Failure indication + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::Configure( + WlanContextImpl& aCtxImpl, + TUint32 /*aRTSThreshold*/, + TUint32 /*aMaxTxMSDULifetime*/, + TUint32 /*aVoiceCallEntryTimeout*/, + TUint32 /*aVoiceCallEntryTxThreshold*/, + TUint32 /*aVoiceNullTimeout*/, + TUint32 /*aNoVoiceTimeout*/, + TUint32 /*aKeepAliveTimeout*/, + TUint32 /*aSpRcpiIndicationLevel*/, + TUint32 /*aSpTimeToCountPrediction*/, + TUint32 /*aSpMinIndicationInterval*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::Connect( + WlanContextImpl& aCtxImpl, + const TSSID& /*aSSID*/, + const TMacAddress& /*aBSSID*/, + TUint16 /*aAuthAlgorithmNbr*/, + TEncryptionStatus /*aEncryptionStatus*/, + TBool /*aIsInfra*/, + TUint16 /*aScanResponseFrameBodyLength*/, + const TUint8* /*aScanResponseFrameBody*/, + const TUint8* /*aIeData*/, + TUint16 /*aIeDataLength*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::StartIBSS( + WlanContextImpl& aCtxImpl, + const TSSID& /*aSSID*/, + TUint32 /*aBeaconInterval*/, + TUint32 /*aAtim*/, + TUint32 /*aChannel*/, + TEncryptionStatus /*aEncryptionStatus*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::Scan( + WlanContextImpl& aCtxImpl, + TScanMode /*aMode*/, + const TSSID& /*aSSID*/, + TRate /*aScanRate*/, + SChannels& /*aChannels*/, + TUint32 /*aMinChannelTime*/, + TUint32 /*aMaxChannelTime*/, + TBool /*aSplitScan*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::StopScan( WlanContextImpl& aCtxImpl ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::Disconnect( WlanContextImpl& aCtxImpl ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode /*aPowerMode*/, + TBool /*aDisableDynamicPowerModeManagement*/, + TWlanWakeUpInterval /*aWakeupModeInLightPs*/, + TUint8 /*aListenIntervalInLightPs*/, + TWlanWakeUpInterval /*aWakeupModeInDeepPs*/, + TUint8 /*aListenIntervalInDeepPs*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::SetRcpiTriggerLevel( + WlanContextImpl& aCtxImpl, + TUint32 /*aRcpiTrigger*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::GetLastRcpi( + WlanContextImpl& aCtxImpl ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddTkIPKey( + WlanContextImpl& aCtxImpl, + const TUint8* /*aData*/, + TUint32 /*aLength*/, + T802Dot11WepKeyId /*aKeyIndex*/, + const TMacAddress& /*aMacAddr*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddMulticastTKIPKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId /*aKeyIndex*/, + TUint32 /*aLength*/, + const TUint8* /*aData*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddAesKey( + WlanContextImpl& aCtxImpl, + const TUint8* /*aData*/, + TUint32 /*aLength*/, + const TMacAddress& /*aMacAddr*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddMulticastAesKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId /*aKeyIndex*/, + TUint32 /*aLength*/, + const TUint8* /*aData*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 /*aKeyIndex*/, + TBool /*aUseAsDefaulKey*/, + TUint32 /*aKeyLength*/, + const TUint8 /*aKey*/[KMaxWEPKeyLength], + const TMacAddress& /*aMac*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& /*aMacAddr*/, + TUint32 /*aKeyLength*/, + const TUint8 /*aKey*/[KMaxWEPKeyLength] ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddMulticastWapiKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId /*aKeyIndex*/, + TUint32 /*aLength*/, + const TUint8* /*aData*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddUnicastWapiKey( + WlanContextImpl& aCtxImpl, + const TUint8* /*aData*/, + TUint32 /*aLength*/, + T802Dot11WepKeyId /*aKeyIndex*/, + const TMacAddress& /*aMacAddr*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::SetTxPowerLevel( + WlanContextImpl& aCtxImpl, + TUint32 /*aLevel*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::AddMulticastAddr( + WlanContextImpl& aCtxImpl, + const TMacAddress& /*aMacAddr*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::RemoveMulticastAddr( + WlanContextImpl& aCtxImpl, + TBool /*aRemoveAll*/, + const TMacAddress& /*aMacAddr*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::ConfigureBssLost( + WlanContextImpl& aCtxImpl, + TUint32 /*aBeaconLostCount*/, + TUint8 /*aFailedTxPacketCount*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::SetTxRateAdaptParams( + WlanContextImpl& aCtxImpl, + TUint8 /*aMinStepUpCheckpoint*/, + TUint8 /*aMaxStepUpCheckpoint*/, + TUint8 /*aStepUpCheckpointFactor*/, + TUint8 /*aStepDownCheckpoint*/, + TUint8 /*aMinStepUpThreshold*/, + TUint8 /*aMaxStepUpThreshold*/, + TUint8 /*aStepUpThresholdIncrement*/, + TUint8 /*aStepDownThreshold*/, + TBool /*aDisableProbeHandling*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& /*aRatePolicy*/, + const TQueue2RateClass& /*aQueue2RateClass*/, + const TInitialMaxTxRate4RateClass& /*aInitialMaxTxRate4RateClass*/, + const TTxAutoRatePolicy& /*aAutoRatePolicy*/, + const THtMcsPolicy& /*aHtMcsPolicy*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::GetFrameStatistics( WlanContextImpl& aCtxImpl ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::ConfigureTxQueueIfNecessary( + WlanContextImpl& aCtxImpl, + TQueueId /*aQueueId*/, + TUint16 /*aMediumTime*/, + TUint32 /*aMaxTxMSDULifetime*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::GetMacAddress( WlanContextImpl& aCtxImpl ) + { + return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::ConfigureArpIpAddressFiltering( + WlanContextImpl& aCtxImpl, + TBool /*aEnableFiltering*/, + TIpv4Address /*aIpv4Address*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::ConfigureHtBlockAck( + WlanContextImpl& aCtxImpl, + TUint8 /*aTxBlockAckUsage*/, + TUint8 /*aRxBlockAckUsage*/ ) + { + return CompleteMgmtCommand( aCtxImpl, KErrNone ); + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11MacError::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11MacError::CompleteMgmtCommand( + WlanContextImpl& aCtxImpl, + TInt aStatus ) + { + OnOidComplete( aCtxImpl, aStatus ); + // signal caller that no state transition ocurred + return EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MibDefaultConfigure.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11MibDefaultConfigure.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1142 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11MibDefaultConfigure class +* +*/ + +/* +* %version: 26 % +*/ + +#include "config.h" +#include "UmacDot11MibDefaultConfigure.h" +#include "wha_mibDefaultvalues.h" +#include "umacwhatodot11typeconverter.h" +#include "UmacWsaWriteMib.h" +#include "UmacContextImpl.h" + +const TUint KAllocLen = 512; + +#ifndef NDEBUG +const TInt8 WlanDot11MibDefaultConfigure::iName[] + = "dot11-mibdefaultconfigure"; + +const TUint8 WlanDot11MibDefaultConfigure::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETDOT11MAXRECEIVELIFETIME"}, + {"ESETDOT11SLOTTIME"}, + {"ESETDOT11GROUPADDRSTABLE"}, + {"ESETDOT11WEPDEFAULTKEY"}, + {"ESETDOT11CURRENTTXPOWERLEVEL"}, + {"ESETDOT11RTSTHRESHOLD"}, + {"ESETCTSTOSELF"}, + {"ESETARPIPADDRSTABLE"}, + {"ESETPROBEREQUESTTEMPLATE"}, + {"ESETRXFILTER"}, + {"ESETBEACONFILTERIETABLE"}, + {"ESETBEACONFILTERENABLE"}, + {"ESETWLANWAKEUPINTERVAL"}, + {"ESETBEACONLOSTCOUNT"}, + {"ESETRCPITHRESHOLD"}, + {"ESETTXRATEPOLICY"}, + {"ESETHTCAPABILITIES"}, + {"ESETHTBSSOPERATION"}, + {"ESETHTSECONDARYBEACON"}, + {"ESETHTBLOCKACKCONFIGURE"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11MibDefaultConfigure::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, {"ETXCOMPLETE"}, {"EABORT"} + }; +#endif + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11MibDefaultConfigure::~WlanDot11MibDefaultConfigure() + { + iMemory = NULL; + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11MibDefaultConfigure::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::Entry +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // we don't want to do event dispatching here as we want to set the + // mib default values without interruptions + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::Exit +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // we are traversing to a new dot11 state + // make sure we don't generate a memory leakage + os_free( iMemory ); + iState = EINIT; + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::ChangeInternalState +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// WlanDot11MibDefaultConfigure::Fsm +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::Fsm(): FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::Fsm(): event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::Fsm(): state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::Fsm(): event: %d"), aEvent); + OsAssert( + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::Fsm(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// WlanDot11MibDefaultConfigure::OnStateEntryEvent +// Handler for state entry event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + iMemory = os_alloc( KAllocLen ); + if ( iMemory ) + { + // start the FSM traversal + ChangeInternalState( aCtxImpl, + ESETDOT11MAXRECEIVELIFETIME ); + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + break; + case ESETDOT11MAXRECEIVELIFETIME: + SetDot11MaxReceiveLifeTime( aCtxImpl ); + break; + case ESETDOT11SLOTTIME: + SetDot11SlotTime( aCtxImpl ); + break; + case ESETDOT11GROUPADDRSTABLE: + SetDot11GroupAddrsTable( aCtxImpl ); + break; + case ESETDOT11WEPDEFAULTKEY: + SetDot11WepDefaultKey( aCtxImpl ); + break; + case ESETDOT11CURRENTTXPOWERLEVEL: + SetDot11CurrentTxPowerLevel( aCtxImpl ); + break; + case ESETDOT11RTSTHRESHOLD: + SetDot11RtsThreshold( aCtxImpl ); + break; + case ESETCTSTOSELF: + SetCtsToSelf( aCtxImpl ); + break; + case ESETARPIPADDRSTABLE: + SetArpIpAddrsTable( aCtxImpl ); + break; + case ESETPROBEREQUESTTEMPLATE: + SetProbeRequestTemplate( aCtxImpl ); + break; + case ESETRXFILTER: + SetRxFilter( aCtxImpl ); + break; + case ESETBEACONFILTERIETABLE: + SetBeaconFilterIeTable( aCtxImpl ); + break; + case ESETBEACONFILTERENABLE: + SetBeaconFilterEnable( aCtxImpl ); + break; + case ESETWLANWAKEUPINTERVAL: + SetWlanWakeupInterval( aCtxImpl ); + break; + case ESETBEACONLOSTCOUNT: + SetBeaconLostCount( aCtxImpl ); + break; + case ESETRCPITHRESHOLD: + SetRcpiThreshold( aCtxImpl ); + break; + case ESETTXRATEPOLICY: + SetTxRatePolicy( aCtxImpl ); + break; + case ESETHTCAPABILITIES: + SetHtCapabilities( aCtxImpl ); + break; + case ESETHTBSSOPERATION: + SetHtBssOperation( aCtxImpl ); + break; + case ESETHTSECONDARYBEACON: + SetHtSecondaryBeacon( aCtxImpl ); + break; + case ESETHTBLOCKACKCONFIGURE: + SetHtBlockAckConfigure( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + // our dot11 transition is fixed and we shall take it + // change global dot11 state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::OnStateEntryEvent(): state: %d"), + iState); + OsAssert( (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::OnStateEntryEvent(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for tx complete event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ESETDOT11MAXRECEIVELIFETIME: + if ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KDot11SlotTime ) + { + // supported + ChangeInternalState( + aCtxImpl, ESETDOT11SLOTTIME ); + } + else + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC * dot11-mibdefaultconfigure")); + OsTracePrint( KWarningLevel, (TUint8*) + ("no support for dot11slottime mib skipping")); + ChangeInternalState( aCtxImpl, + ESETDOT11GROUPADDRSTABLE ); + } + break; + case ESETDOT11SLOTTIME: + ChangeInternalState( aCtxImpl, + ESETDOT11GROUPADDRSTABLE ); + break; + case ESETDOT11GROUPADDRSTABLE: + ChangeInternalState( aCtxImpl, + ESETDOT11WEPDEFAULTKEY ); + break; + case ESETDOT11WEPDEFAULTKEY: + ChangeInternalState( aCtxImpl, + ESETDOT11CURRENTTXPOWERLEVEL ); + break; + case ESETDOT11CURRENTTXPOWERLEVEL: + ChangeInternalState( aCtxImpl, + ESETDOT11RTSTHRESHOLD ); + break; + case ESETDOT11RTSTHRESHOLD: + ChangeInternalState( aCtxImpl, + ESETCTSTOSELF ); + break; + case ESETCTSTOSELF: + ChangeInternalState( aCtxImpl, + ESETARPIPADDRSTABLE ); + break; + case ESETARPIPADDRSTABLE: + ChangeInternalState( aCtxImpl, + ESETPROBEREQUESTTEMPLATE ); + break; + case ESETPROBEREQUESTTEMPLATE: + ChangeInternalState( aCtxImpl, + ESETRXFILTER ); + break; + case ESETRXFILTER: + ChangeInternalState( aCtxImpl, + ESETBEACONFILTERIETABLE ); + break; + case ESETBEACONFILTERIETABLE: + ChangeInternalState( aCtxImpl, + ESETBEACONFILTERENABLE ); + break; + case ESETBEACONFILTERENABLE: + ChangeInternalState( aCtxImpl, + ESETWLANWAKEUPINTERVAL ); + break; + case ESETWLANWAKEUPINTERVAL: + ChangeInternalState( aCtxImpl, + ESETBEACONLOSTCOUNT ); + break; + case ESETBEACONLOSTCOUNT: + ChangeInternalState( aCtxImpl, + ESETRCPITHRESHOLD ); + break; + case ESETRCPITHRESHOLD: + ChangeInternalState( aCtxImpl, + ESETTXRATEPOLICY ); + break; + case ESETTXRATEPOLICY: + if ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KHtOperation ) + { + // supported + ChangeInternalState( + aCtxImpl, ESETHTCAPABILITIES ); + } + else + { + // HT not supported, so we will skip setting the HT related + // MIBs + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::OnTxCompleteEvent: no HT support, skipping HT related mibs")); + ChangeInternalState( aCtxImpl, + ECONTINUEDOT11TRAVERSE ); + } + break; + case ESETHTCAPABILITIES: + ChangeInternalState( aCtxImpl, + ESETHTBSSOPERATION ); + break; + case ESETHTBSSOPERATION: + ChangeInternalState( aCtxImpl, + ESETHTSECONDARYBEACON ); + break; + case ESETHTSECONDARYBEACON: + ChangeInternalState( aCtxImpl, + ESETHTBLOCKACKCONFIGURE ); + break; + case ESETHTBLOCKACKCONFIGURE: + ChangeInternalState( aCtxImpl, + ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::OnTxCompleteEvent(): state: %d"), + iState); + OsAssert( + (TUint8*)("UMAC: UMAC: WlanDot11MibDefaultConfigure::OnTxCompleteEvent(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::OnAbortEvent +// simulate macnotresponding error +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + // memory is released by Exit() method + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-mibdefaultconfigure * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetDot11MaxReceiveLifeTime +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetDot11MaxReceiveLifeTime( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetDot11MaxReceiveLifeTime()") ); + + WHA::Sdot11MaxReceiveLifeTime* mib + = static_cast(iMemory); + *mib = WHA::KDot11MaxReceiveLifeTimeMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibDot11MaxReceiveLifetime, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetDot11SlotTime +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetDot11SlotTime( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetDot11SlotTime()") ); + + WHA::Sdot11SlotTime* mib + = static_cast(iMemory); + *mib = WHA::KDot11SlotTimeMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibDot11SlotTime, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetDot11GroupAddrsTable +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetDot11GroupAddrsTable( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetDot11GroupAddrsTable()") ); + + WHA::Sdot11GroupAddressesTable* mib + = static_cast(iMemory); + *mib = WHA::KDot11GroupAddressesTableMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibDot11GroupAddressesTable, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetDot11WepDefaultKey +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetDot11WepDefaultKey( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetDot11WepDefaultKey()") ); + + WHA::Sdot11WepDefaultKeyId* mib + = static_cast(iMemory); + *mib = WHA::KDot11WepDefaultKeyIdMib; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibDot11WepDefaultKeyId, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetDot11CurrentTxPowerLevel +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetDot11CurrentTxPowerLevel( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetDot11CurrentTxPowerLevel()") ); + + WHA::Sdot11CurrentTxPowerLevel* mib + = static_cast(iMemory); + *mib = WHA::KDot11CurrentTxPowerLevelMibDefault; + + // store the new power level also to our soft mib + aCtxImpl.iWlanMib.dot11CurrentTxPowerLevel + = mib->iDot11CurrentTxPowerLevel; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibDot11CurrentTxPowerLevel, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetDot11RtsThreshold +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetDot11RtsThreshold( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetDot11RtsThreshold()") ); + + WHA::Sdot11RTSThreshold* mib + = static_cast(iMemory); + mib->iDot11RTSThreshold = aCtxImpl.iWlanMib.dot11RTSThreshold; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibDot11RTSThreshold, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetCtsToSelf +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetCtsToSelf( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetCtsToSelf()") ); + + WHA::SctsToSelf* mib + = static_cast(iMemory); + *mib = WHA::KCtsToSelfMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibCtsToSelf, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetArpIpAddrsTable +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetArpIpAddrsTable( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetArpIpAddrsTable(): ") ); + + WHA::SarpIpAddressTable* mib + = static_cast(iMemory); + *mib = WHA::KArpIpAddressTableMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibArpIpAddressTable, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetProbeRequestTemplate +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetProbeRequestTemplate( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::SetProbeRequestTemplate") ); + + SSupportedRatesIE s_ie; + const TUint8 KHtCapabilitiesIeLength( + aCtxImpl.GetOurHtCapabilitiesIe().GetIeLength() ); + + // we don't want to create this IE to stack + // as it is a big one + SExtendedSupportedRatesIE* ext_s_ie( + static_cast + (os_alloc( sizeof(SExtendedSupportedRatesIE) ))); + if ( !ext_s_ie ) + { + // alloc failue; just send abort to fsm. It takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + new (ext_s_ie) SExtendedSupportedRatesIE; + + // construct rate IEs from WHA rates this device supports... + WlanWhaToDot11TypeConverter::Convert( + aCtxImpl.WHASettings().iRates, + s_ie, + *ext_s_ie ); + + // length of the dot11 probe request frame template to be written + const TUint32 frame_template_len( + // dot11 management header + sizeof(SManagementFrameHeader) + + // an empty SSID field holds just the IE header + sizeof(SInformationElementHeader) + + // standard supported rate IE length + s_ie.GetIeLength() + + // lenght of the HT capabilities element, which is only added if lower + // layers support HT + (aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation ? + KHtCapabilitiesIeLength : 0 ) + + // if extended rate IE has any elements we shall append it + // otherwise not + ((ext_s_ie->GetElementLength()) ? ext_s_ie->GetIeLength() : 0) + + // if lower layers support DS Parameter Set IE in probe request, + // we will append it; otherwise not + (aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KDsParamSetIeInProbe ? + sizeof( SDsParameterSetIE ) : 0 ) ); + + // total length of the MIB to be written + TUint32 mib_len( + // length of the dot11 probe request frame template to be written + frame_template_len + // ...and the MIB header + + WHA::StemplateFrame::KHeaderSize ); + + // align length of MIB to 4-byte boundary + mib_len = Align4( mib_len ); + + if ( mib_len > KAllocLen ) + { + // this is a programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: mib_len %d"), mib_len); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // start of usable memory + WHA::StemplateFrame* mib_hdr( static_cast(iMemory) ); + + // --- begin: set MIB header + + mib_hdr->iFrameType = WHA::KProbeRequestTemplate; + // this field is a don't care for probe request + mib_hdr->iInitialTransmitRate = 0; + mib_hdr->iLength = frame_template_len; + + // --- end: set MIB header + + // --- begin: set dot11 frame header + + SManagementFrameHeader* frame_hdr( + reinterpret_cast(mib_hdr->iTemplateData) ); + new (frame_hdr) SManagementFrameHeader( E802Dot11FrameTypeProbeReq ); + frame_hdr->iDA = KBroadcastMacAddr; + frame_hdr->iSA = aCtxImpl.iWlanMib.dot11StationId; + frame_hdr->iBSSID = KBroadcastMacAddr; + + // --- end: set dot11 frame header + + // --- begin: set IEs + + TUint8* ptr( reinterpret_cast(++frame_hdr) ); + + // set an empty SSID + new (ptr) SSsIdIE; + // as we have an empty SSID its length only holds the + // information element header length + ptr += sizeof( SInformationElementHeader ); + + // copy supported rates IE + os_memcpy( + ptr, &s_ie, s_ie.GetIeLength() ); + ptr += s_ie.GetIeLength(); + + // add DS Parameter Set IE, if possible + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KDsParamSetIeInProbe ) + { + new (ptr) SDsParameterSetIE( 0 ); // initialize to ch zero + ptr += sizeof( SDsParameterSetIE ); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: DS Param Set IE added") ); + } + + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KHtOperation ) + { + // copy HT capabilities element + os_memcpy( + ptr, + &(aCtxImpl.GetOurHtCapabilitiesIe()), + KHtCapabilitiesIeLength ); + + ptr += KHtCapabilitiesIeLength; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: HT capabilities element added") ); + } + + // copy extended supported rates IE if present + if ( ext_s_ie->GetElementLength() ) + { + os_memcpy( ptr, ext_s_ie, ext_s_ie->GetIeLength() ); + } + + // --- end: set IEs + + // and now execute + + WlanWsaWriteMib& wsa_cmd( aCtxImpl.WsaWriteMib() ); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibTemplateFrame, mib_len, mib_hdr ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( ext_s_ie ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetRxFilter +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetRxFilter( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetRxFilter()") ); + + WHA::SrxFilter* mib + = static_cast(iMemory); + *mib = WHA::KRxFilterMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibRxFilter, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetBeaconFilterIeTable +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetBeaconFilterIeTable( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetBeaconFilterIeTable()") ); + + WHA::SbeaconFilterIeTable* mib + = static_cast(iMemory); + *mib = WHA::KBeaconFilterIeTableMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibBeaconFilterIeTable, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetBeaconFilterEnable +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetBeaconFilterEnable( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetBeaconFilterEnable()") ); + + WHA::SbeaconFilterEnable* mib + = static_cast(iMemory); + *mib = WHA::KBeaconFilterEnableMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibBeaconFilterEnable, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetWlanWakeupInterval +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetWlanWakeupInterval( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetWlanWakeupInterval()") ); + + WHA::SwlanWakeUpInterval* mib + = static_cast(iMemory); + *mib = WHA::KWlanWakeUpIntervalMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibWlanWakeUpInterval, sizeof(*mib), mib ); + + // store the new setting also locally + aCtxImpl.iWlanMib.iWlanWakeupInterval = mib->iMode; + aCtxImpl.iWlanMib.iWlanListenInterval = mib->iListenInterval; + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetBeaconLostCount +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetBeaconLostCount( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetBeaconLostCount()") ); + + WHA::SbeaconLostCount* mib + = static_cast(iMemory); + + // if the beacon lost count has been set via the management interface, + // that value is used (instead of the original default) + mib->iLostCount = aCtxImpl.iWlanMib.iBeaconLostCount; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibBeaconLostCount, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetRcpiThreshold +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetRcpiThreshold( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetRcpiThreshold()") ); + + WHA::SrcpiThreshold* mib + = static_cast(iMemory); + *mib = WHA::KRcpiThresholdMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibRcpiThreshold, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// WlanDot11MibDefaultConfigure::SetTxRatePolicy +// (other items were commented in a header). +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetTxRatePolicy( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11MibDefaultConfigure::SetTxRatePolicy()") ); + + // we define 1 global policy ... + + WHA::StxRatePolicy* mib = static_cast(iMemory); + + // ... which is our default ... + *mib = WHA::KTxRatePolicyMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, + WHA::KMibTxRatePolicy, + sizeof( *mib ), + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetHtCapabilities( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::SetHtCapabilities") ); + + WHA::ShtCapabilities* mib + = static_cast(iMemory); + *mib = WHA::KHtCapabilitiesMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibHtCapabilities, sizeof( *mib ), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetHtBssOperation( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::SetHtBssOperation") ); + + WHA::ShtBssOperation* mib + = static_cast(iMemory); + *mib = WHA::KHtBssOperationMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibHtBssOperation, sizeof( *mib ), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetHtSecondaryBeacon( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::SetHtSecondaryBeacon") ); + + WHA::ShtSecondaryBeacon* mib + = static_cast(iMemory); + *mib = WHA::KHtSecondaryBeaconMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibHtSecondaryBeacon, sizeof( *mib ), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11MibDefaultConfigure::SetHtBlockAckConfigure( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11MibDefaultConfigure::SetHtBlockAckConfigure") ); + + WHA::ShtBlockAckConfigure* mib + = static_cast(iMemory); + *mib = WHA::KHtBlockAckConfigureMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibHtBlockAckConfigure, sizeof( *mib ), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11OpenAuthPending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11OpenAuthPending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11OpenAuthPending class +* +*/ + +/* +* %version: 23 % +*/ + +#include "config.h" +#include "UmacDot11OpenAuthPending.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanDot11OpenAuthPending::iName[] = "dot11-openauthpending"; +#endif // !NDEBUG + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11OpenAuthPending::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// ----------------------------------------------------------------------------- +// +void WlanDot11OpenAuthPending::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + // do all the synchronous + // composite state entry actions + StateEntryActions( aCtxImpl ); + // continue with the state traversal + Fsm( aCtxImpl, ECONTINUE ); + break; + case ETXAUTHFRAME: + // send the authenticate frame + if ( !SendAuthSeqNbr1Frame( aCtxImpl ) ) + { + // tx of dot11-authenticate frame failed + // because packet scheduler was full + // or because we didn't get a Tx buffer + // so we enter to a wait state + Fsm( aCtxImpl, ETX_SCHEDULER_FULL ); + } + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + case EWAIT4AUTHRESPONSE: + // start a timer to wait for the response frame + StartAuthenticationFrameResponseTimer( aCtxImpl ); + break; + case EWAIT4PUSHPACKET: + // nothing to do here than wait + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for rx authentication response event. +// ----------------------------------------------------------------------------- +// +void WlanDot11OpenAuthPending::OnRxAuthResponseEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4AUTHRESPONSE: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // this means that we have recieved a valid dot11 + // authenticate response frame that we are waiting for + // but we are not internally in such a state + // only feasible situation for this is that + // someone has skipped a call to the packet xfer method + // that informs of authenticate request frame + // xfer to the WLAN device. + // other case is that our fsm is totally messed up + // so we catch this +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// set appropriate used algorithm number to authenticate request frame +// ----------------------------------------------------------------------------- +// +void WlanDot11OpenAuthPending::OnSetAlgorithmNumber( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.HtSupportedByNw() ) + { + aCtxImpl.GetHtAuthenticationFrame().SetAlgorithmNmbr( + aCtxImpl.AuthenticationAlgorithmNumber() ); + } + else + { + aCtxImpl.GetAuthenticationFrame().SetAlgorithmNmbr( + aCtxImpl.AuthenticationAlgorithmNumber() ); + } + } + +// ----------------------------------------------------------------------------- +// If we land here it means that we have received a frame of somekind +// with a status success +// ----------------------------------------------------------------------------- +// +void WlanDot11OpenAuthPending::OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 /*aLength*/, + WHA::TRcpi /*aRcpi*/, + TUint32 aFlags, + TUint8* /*aBuffer*/ ) + { + // parse frame in order to determine is it what we want + const SManagementFrameHeader* frame_hdr + = static_cast(aFrame); + + TBool type_match( EFalse ); + + if ( // can we accept this frame + // is this a management type + authentication subtype frame + IsRequestedFrameType( + frame_hdr->iFrameControl.iType, + E802Dot11FrameTypeAuthentication, type_match ) + // AND our MAC address is DA + && (frame_hdr->iDA == aCtxImpl.iWlanMib.dot11StationId) + // AND we are in correct state + && ( iState == EWAIT4AUTHRESPONSE ) + ) + { + // cancel authentication frame response timer + aCtxImpl.CancelTimer(); + + iFlags |= KAuthReceived; + + // we have got a hit...let's proceed + // store the used authentication algorithm number + // for later use + const TUint16 used_auth_algorithm = + aCtxImpl.AuthenticationAlgorithmNumber(); + + // validate the authentication frame + if ( ResolveAuthMessage( + aCtxImpl, + used_auth_algorithm, + aFrame, + aFlags ) ) + { + // authentication success + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: dot11-openauthpending * authentication success") ); + + // mark it also + iFlags |= KAuthSuccess; + } + else + { + // authentication response message was NOT ok + // lets's see why that's the case + const SAuthenticationFixedFields* auth_fields + = reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SManagementFrameHeader )); + + TInt completion_code( KErrGeneral ); + + if ( // is open mode authentication + ( auth_fields->AlgorithmNumber() == used_auth_algorithm ) + // AND is authentication transaction sequence number expected + && ( auth_fields->SequenceNumber() + == aCtxImpl.GetAuthSeqNmbrExpected()) + ) + { + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: dot11-openauthpending authentication denied") ); + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: status code from frame: %d"), + auth_fields->StatusCode() ); + + if ( auth_fields->StatusCode() == E802Dot11StatusSuccess ) + { + // catch a internal programming error + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // status code was something else than status success + completion_code = auth_fields->StatusCode(); + } + else + { + // a malformed message, but it is a failure in any case + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: dot11-openauthpending authentication failure") ); + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: auth message not valid") ); + } + + // set the completion code value returned to user mode + // as the dot11idle state does the OID completion in this case + aCtxImpl.iStates.iIdleState.Set( completion_code ); + } + } + else // can we accept this frame + { + // not a valid type of frame + // or we are not in correct state + // so we shall discard it's processing + } + + if ( iFlags & KAuthReceived ) + { + // authentication response was received + // either success or failure + // we don't really care in this state + + Fsm( aCtxImpl, ERXAUTHRESPONSE ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11PrepareForBssMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11PrepareForBssMode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,802 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UmacDot11PrepareForBssMode class +* +*/ + +/* +* %version: 31 % +*/ + +#include "config.h" +#include "UmacDot11PrepareForBssMode.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaJoin.h" +#include "umacconfiguretxqueueparams.h" +#include "UmacContextImpl.h" +#include "wha_mibDefaultvalues.h" + + +#ifndef NDEBUG +const TInt8 WlanDot11PrepareForBssMode::iName[] + = "dot11-prepareforbssmode"; + +const TUint8 WlanDot11PrepareForBssMode::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETSLEEPMODE"}, + {"ESETDOT11SLOTTIME"}, + {"ESETCTSTOSELF"}, + {"ECONFTXQUEUE"}, + {"ECONFTXQUEUEPARAMS"}, + {"ESETTXRATEPOLICY"}, + {"ESETHTCAPABILITIES"}, + {"ESETHTBSSOPERATION"}, + {"ERESETHTCAPABILITIES"}, + {"EISSUEJOIN"}, + {"ESETHTBLOCKACKCONF"}, + {"ERESETHTBLOCKACKCONF"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11PrepareForBssMode::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"EABORT"} + }; +#endif + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11PrepareForBssMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // don't want to do event dispatching here as we want + // to run this dot11 state critter in non pre-emptive mode + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::Exit()") ); + + // only thing we shall do is to reset our FSM for the next round... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::OnWhaCommandResponse( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& /*aCommandResponseParams*/, + TUint32 aAct ) + { + if ( aAct ) + { + // should not happen as we a runnng in non-pre-emptive mode + // regarding oid commands + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: aAct: %d"), aAct ); + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + + // this is a response to a command that was generated + // by this dot11 state object layer + + // we are only interested of join command response + // as it is the oly one we trigger from here that + // has a meaningfull return value + if ( aCommandId == WHA::EJoinResponse ) + { + if ( aStatus == WHA::KFailed ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode: join failed")); + // make a note of the failure and act + // accordingly when we + // soon again enter this state + iJoinFailed = ETrue; + } + else + { + OsTracePrint( KInfoLevel, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode: join success")); + } + } + else // --- aCommandId == WHA::EJoinResponse --- + { + // no action here + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): event: %d"), + aEvent); + OsAssert( + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::Fsm(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + // as we are about to join a new AP, reset BSS Loss indicators + aCtxImpl.ResetBssLossIndications(); + iJoinFailed = EFalse; + // make sure that this counter is reset; also in case the + // previous connect attempt has failed + aCtxImpl.ResetFailedTxPacketCount(); + // start the FSM traversal + ChangeInternalState( aCtxImpl, + ESETSLEEPMODE ); + break; + case ESETSLEEPMODE: + SetSleepMode( aCtxImpl ); + break; + case ESETDOT11SLOTTIME: + SetDot11SlotTime( aCtxImpl ); + break; + case ESETCTSTOSELF: + SetCtsToSelf( aCtxImpl ); + break; + case ECONFTXQUEUE: + ConfigureQueue( aCtxImpl ); + break; + case ECONFTXQUEUEPARAMS: + ConfigureTxQueueParams( aCtxImpl ); + break; + case ESETTXRATEPOLICY: + SetTxRatePolicy( aCtxImpl ); + break; + case ESETHTCAPABILITIES: + SetHtCapabilities( aCtxImpl ); + break; + case ESETHTBSSOPERATION: + SetHtBssOperation( aCtxImpl ); + break; + case ERESETHTCAPABILITIES: + ResetHtCapabilities( aCtxImpl ); + break; + case EISSUEJOIN: + IssueJoin( aCtxImpl ); + break; + case ESETHTBLOCKACKCONF: + SetHtBlockAckConfiguration( aCtxImpl ); + break; + case ERESETHTBLOCKACKCONF: + ResetHtBlockAckConfiguration( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // catch internal FSM programming error + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::OnStateEntryEvent(): state: %d"), + iState); + OsAssert( (TUint8*)("UMAC: WlanDot11PrepareForBssMode::OnStateEntryEvent(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ESETSLEEPMODE: + // depending if the WLAN vendor specific solution + // implements dot11slottime mib we will configure it + if ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KDot11SlotTime ) + { + // supported + ChangeInternalState( aCtxImpl, ESETDOT11SLOTTIME ); + } + else + { + // not supported so skip it + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::OnTxCompleteEvent")); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: no support for dot11slottime mib skipping")); + + ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); + } + break; + case ESETDOT11SLOTTIME: + // continue state traversal + ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); + break; + case ESETCTSTOSELF: + if ( aCtxImpl.QosEnabled() ) + { + // configure all the Tx queues & their AC parameters + ChangeInternalState( aCtxImpl, ECONFTXQUEUEPARAMS ); + } + else + { + // configure just the legacy Tx queue + // This is done in order to have the correct queue + // configuration also in the case that the previous connect + // attempt to a QoS AP failed (and we asked for a QoS queue + // configuration for it), and we are now about to + // connect to a non-QoS AP + ChangeInternalState( aCtxImpl, ECONFTXQUEUE ); + } + break; + case ECONFTXQUEUE: + case ECONFTXQUEUEPARAMS: + // continue state traversal + ChangeInternalState( aCtxImpl, ESETTXRATEPOLICY ); + break; + case ESETTXRATEPOLICY: + if ( aCtxImpl.HtSupportedByNw() ) + { + ChangeInternalState( aCtxImpl, ESETHTCAPABILITIES ); + } + else + { + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KHtOperation ) + { + ChangeInternalState( aCtxImpl, ERESETHTCAPABILITIES ); + } + else + { + ChangeInternalState( aCtxImpl, EISSUEJOIN ); + } + } + break; + case ESETHTCAPABILITIES: + ChangeInternalState( aCtxImpl, ESETHTBSSOPERATION ); + break; + case ESETHTBSSOPERATION: + ChangeInternalState( aCtxImpl, EISSUEJOIN ); + break; + case ERESETHTCAPABILITIES: + ChangeInternalState( aCtxImpl, EISSUEJOIN ); + break; + case EISSUEJOIN: + if ( aCtxImpl.HtSupportedByNw() ) + { + ChangeInternalState( aCtxImpl, ESETHTBLOCKACKCONF ); + } + else + { + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KHtOperation ) + { + ChangeInternalState( aCtxImpl, ERESETHTBLOCKACKCONF ); + } + else + { + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + } + break; + case ESETHTBLOCKACKCONF: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + case ERESETHTBLOCKACKCONF: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// as there's really nothing else we can do in this situation +// simulate macNotResponding error +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::OnAbortEvent()")); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetSleepMode( + WlanContextImpl& aCtxImpl ) + { + WHA::SsleepMode* mib + = static_cast(os_alloc( sizeof( WHA::SsleepMode ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + mib->iMode = WHA::KPowerDownMode; + + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::SetSleepMode(): set sleepmode: %d"), + mib->iMode ); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibSleepMode, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetDot11SlotTime( + WlanContextImpl& aCtxImpl ) + { + WHA::Sdot11SlotTime* mib + = static_cast + (os_alloc( sizeof( WHA::Sdot11SlotTime ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + if ( aCtxImpl.UseShortSlotTime() ) + { + mib->iDot11SlotTime = WHA::KSlotTime9; + } + else + { + mib->iDot11SlotTime = WHA::KSlotTime20; + } + + OsTracePrint( KUmacDetails, (TUint8*)("UMAC * set slottime: %d"), + mib->iDot11SlotTime ); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibDot11SlotTime, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetCtsToSelf( + WlanContextImpl& aCtxImpl ) + { + WHA::SctsToSelf* mib + = static_cast + (os_alloc( sizeof( WHA::SctsToSelf ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + if ( aCtxImpl.ProtectionBitSet() ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::SetCtsToSelf(): enable CTS to self") ); + + mib->iCtsToSelf = ETrue; + } + else + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::SetCtsToSelf(): disable CTS to self") ); + + mib->iCtsToSelf = EFalse; + } + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibCtsToSelf, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::ConfigureQueue( + WlanContextImpl& aCtxImpl ) + { + ConfigureTxQueue( aCtxImpl, WHA::ELegacy ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::ConfigureTxQueueParams( + WlanContextImpl& aCtxImpl ) + { + WlanConfigureTxQueueParams& complex_wsa_cmd = + aCtxImpl.ConfigureTxQueueParams(); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + complex_wsa_cmd // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetTxRatePolicy( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::SetTxRatePolicy(): rate bitmask: 0x%08x"), + aCtxImpl.RateBitMask() ); + + if ( !ConfigureTxRatePolicies( aCtxImpl ) ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetHtCapabilities( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::SetHtCapabilities") ); + + ConfigureHtCapabilities( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetHtBssOperation( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::SetHtBssOperation") ); + + ConfigureHtBssOperation( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::ResetHtCapabilities( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::ResetHtCapabilities") ); + + ResetHtCapabilitiesMib( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::ResetHtBlockAckConfiguration( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::ResetHtBlockAckConfiguration") ); + + ResetHtBlockAckConfigureMib( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::SetHtBlockAckConfiguration( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForBssMode::SetHtBlockAckConfiguration") ); + + // allocate memory for the mib to write + WHA::ShtBlockAckConfigure* mib + = static_cast + (os_alloc( sizeof( WHA::ShtBlockAckConfigure ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + // retrieve reference to the stored HT Block Ack configuration + const WHA::ShtBlockAckConfigure& blockAckConf ( + aCtxImpl.GetHtBlockAckConfigure() ); + + mib->iTxBlockAckUsage = blockAckConf.iTxBlockAckUsage; + mib->iRxBlockAckUsage = blockAckConf.iRxBlockAckUsage; + os_memset( mib->iReserved, 0, sizeof( mib->iReserved ) ); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibHtBlockAckConfigure, + sizeof( *mib ), + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd ); // next state + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::IssueJoin( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForBssMode::IssueJoin()") ); + + // make WHA types + WHA::SSSID ssid; + ssid.iSSIDLength = aCtxImpl.GetSsId().ssidLength; + os_memcpy( + ssid.iSSID, + aCtxImpl.GetSsId().ssid, + aCtxImpl.GetSsId().ssidLength ); + WHA::TMacAddress mac; + os_memcpy( + &mac, + &(aCtxImpl.GetBssId()), + WHA::TMacAddress::KMacAddressLength ); + + // feed the critter with parameters + aCtxImpl.WsaJoin().Set( + aCtxImpl, + aCtxImpl.NetworkOperationMode(), + mac, + // only 2.4 GHz band is supported for now, so we can hard + // code it should be changed as soon as our implemetation + // supports multiple bands + WHA::KBand2dot4GHzMask, + ssid, + aCtxImpl.NetworkChannelNumeber(), + aCtxImpl.NetworkBeaconInterval(), + aCtxImpl.BasicRateSet(), + 0, // ATIM + (aCtxImpl.UseShortPreamble()) + ? WHA::EShortPreamble : WHA::ELongPreamble, + ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KProbe4Join ) ? ETrue : EFalse ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaJoin() // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForBssMode::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + if ( iJoinFailed ) + { + // set the completion code value to be returned to user mode + // as the dot11idle state does the OID completion in this case + aCtxImpl.iStates.iIdleState.Set( KErrGeneral ); + + // go back to dot11Idle state + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + } + else + { + if ( aCtxImpl.AuthenticationAlgorithmNumber() != + K802Dot11AuthModeShared ) + { + // proceed with open authentication + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iOpenAuthPendingState // next state + ); + } + else + { + // proceed with shared authentication + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSharedAuthPending // next state + ); + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11PrepareForIbssMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11PrepareForIbssMode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,835 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanDot11PrepareForIbssMode class +* +*/ + +/* +* %version: 28 % +*/ + +#include "config.h" +#include "UmacDot11PrepareForIbssMode.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaJoin.h" +#include "UmacContextImpl.h" +#include "wha_mibDefaultvalues.h" + +const TUint KAllocLen( WHA::KBeaconStorageSize + WHA::StemplateFrame::KHeaderSize ); + +#ifndef NDEBUG +const TInt8 WlanDot11PrepareForIbssMode::iName[] = "dot11-prepareforibssmode"; + +const TUint8 WlanDot11PrepareForIbssMode::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETSLEEPMODE"}, + {"ESETDOT11SLOTTIME"}, + {"ESETCTSTOSELF"}, + {"ESETBEACON"}, + {"ESETPROBERESP"}, + {"ESETTXRATEPOLICY"}, + {"ESETBEACONLOSTCOUNT"}, + {"EJOIN"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11PrepareForIbssMode::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, {"ETXCOMPLETE"}, {"EABORT"} + }; +#endif + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +WlanDot11PrepareForIbssMode::~WlanDot11PrepareForIbssMode() + { + iMemory = NULL; + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::Set( TBool aStartIbss ) + { + iStartIbss = aStartIbss; + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // don't want to do event dispatching here as we want + // to run this dot11 state critter in non pre-emptive mode + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // we are traversing to a new dot11 state + // make sure we don't generate a memory leakage + os_free( iMemory ); + iMemory = NULL; + + iState = EINIT; + iStartIbss = EFalse; + } + +#ifndef NDEBUG +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +const TInt8* WlanDot11PrepareForIbssMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC * dot11-prepareforibssmode * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*)("event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*)("state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + iMemory = static_cast(os_alloc( KAllocLen )); + if ( iMemory ) + { + // as we are about to join/start a new network, reset BSS Loss + // indicators + aCtxImpl.ResetBssLossIndications(); + + // start the FSM traversal + ChangeInternalState( aCtxImpl, ESETSLEEPMODE ); + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + break; + case ESETSLEEPMODE: + SetSleepMode( aCtxImpl ); + break; + case ESETDOT11SLOTTIME: + SetDot11SlotTime( aCtxImpl ); + break; + case ESETCTSTOSELF: + SetCtsToSelf( aCtxImpl ); + break; + case ESETBEACON: + ConfigureBeaconTemplate( aCtxImpl ); + break; + case ESETPROBERESP: + ConfigureProbeResponseTemplate( aCtxImpl ); + break; + case ESETTXRATEPOLICY: + SetTxRatePolicy( aCtxImpl ); + break; + case ESETBEACONLOSTCOUNT: + SetBeaconLostCount( aCtxImpl ); + break; + case EJOIN: + Join( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ESETSLEEPMODE: + // depending if the WLAN vendor specific solution + // implements dot11slottime mib we will configure it + if ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KDot11SlotTime ) + { + // supported + ChangeInternalState( aCtxImpl, ESETDOT11SLOTTIME ); + } + else + { + // not supported so skip it + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC * dot11-prepareforibssmode")); + OsTracePrint( KWarningLevel, (TUint8*) + ("no support for dot11slottime mib skipping")); + + ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); + } + break; + case ESETDOT11SLOTTIME: + ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); + break; + case ESETCTSTOSELF: + ChangeInternalState( aCtxImpl, ESETBEACON ); + break; + case ESETBEACON: + ChangeInternalState( aCtxImpl, ESETPROBERESP ); + break; + case ESETPROBERESP: + ChangeInternalState( aCtxImpl, ESETTXRATEPOLICY ); + break; + case ESETTXRATEPOLICY: + ChangeInternalState( aCtxImpl, ESETBEACONLOSTCOUNT ); + break; + case ESETBEACONLOSTCOUNT: + ChangeInternalState( aCtxImpl, EJOIN ); + break; + case EJOIN: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::SetSleepMode( + WlanContextImpl& aCtxImpl ) + { + WHA::SsleepMode* mib + = reinterpret_cast(iMemory); + + mib->iMode = WHA::KPowerDownMode; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibSleepMode, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// --------------------------------------------------------- +// the caller of thismethod has allready checked does the +// WLAN vendor specific solution support this mib so we +// don't have to anymore check it here again +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::SetDot11SlotTime( + WlanContextImpl& aCtxImpl ) + { + WHA::Sdot11SlotTime* mib + = reinterpret_cast(iMemory); + + if ( aCtxImpl.UseShortSlotTime() ) + { + mib->iDot11SlotTime = WHA::KSlotTime9; + } + else + { + mib->iDot11SlotTime = WHA::KSlotTime20; + } + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibDot11SlotTime, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::SetCtsToSelf( + WlanContextImpl& aCtxImpl ) + { + WHA::SctsToSelf* mib + = reinterpret_cast(iMemory); + + if ( aCtxImpl.ProtectionBitSet() ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForIbssMode::SetCtsToSelf(): enable CTS to self") ); + + mib->iCtsToSelf = ETrue; + } + else + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForIbssMode::SetCtsToSelf(): disable CTS to self") ); + + mib->iCtsToSelf = EFalse; + } + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibCtsToSelf, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + // memory is released by Exit() method + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11PrepareForIbssMode::OnAbortEvent") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::ConfigureBeaconTemplate( + WlanContextImpl& aCtxImpl ) + { + TUint32 length( 0 ); + ConfigureTemplate( aCtxImpl, length ); + + // default frame configuration is done + // now set beacon frame specific configuration + SManagementFrameHeader* hdr + = reinterpret_cast + (iMemory + WHA::StemplateFrame::KHeaderSize ); + + hdr->iDA = KBroadcastMacAddr; + hdr->iFrameControl.iType = E802Dot11FrameTypeBeacon; + + // set privacy bit depending do we have a + // encryption key set or not + const WHA::TKeyType group_key = aCtxImpl.GroupKeyType(); + const WHA::TKeyType pairwise_key = aCtxImpl.PairWiseKeyType(); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForIbssMode::ConfigureBeaconTemplate: check for WEP") ); + + if ( (group_key != WHA::EKeyNone + || pairwise_key != WHA::EKeyNone) ) + { + // we have set a group or pairwise key + // enable privacy + SCapabilityInformationField* cap_ptr + = reinterpret_cast + (reinterpret_cast(hdr + 1) + + KTimeStampFixedFieldLength + + KBeaconIntervalFixedFieldLength); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForIbssMode::ConfigureBeaconTemplate: enable WEP") ); + + cap_ptr->SetWepBit(); + } + + // all done now write the MIB + + WHA::StemplateFrame* mib + = reinterpret_cast(iMemory); + + mib->iFrameType = WHA::KBeaconTemplate; + mib->iInitialTransmitRate = BeaconTxRate( aCtxImpl ); + mib->iLength = length; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + TUint32 mib_len( + // length of MIB header + WHA::StemplateFrame::KHeaderSize + // length of the frame template + + mib->iLength ); + + // align length of MIB to 4-byte boundary + mib_len = Align4( mib_len ); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibTemplateFrame, + mib_len, + mib ); + + if ( iStartIbss ) + { + // we are starting a new IBSS + // transfer our own beacon also to mgmt client as an Rx frame + + TUint8* buffer = aCtxImpl.GetRxBuffer( + mib->iLength, + // tell that this is an internally triggered buffer request + ETrue ); + + if ( buffer ) + { + // copy the beacon to the beginning of the buffer + os_memcpy( buffer, reinterpret_cast(hdr), mib->iLength ); + + XferDot11FrameToMgmtClient( + aCtxImpl, + // frame beginning + buffer, + mib->iLength, + // RCPI is not relevant in this case + 0, + // buffer beginning + buffer ); + } +#ifndef NDEBUG + else + { + // Rx buffer reservation failed. That should not happen when we are + // starting an IBSS + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: Rx buf reservation failed") ); + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); + } +#endif + } + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::ConfigureProbeResponseTemplate( + WlanContextImpl& aCtxImpl ) + { + TUint32 length( 0 ); + ConfigureTemplate( aCtxImpl, length ); + + // default frame configuration has been done allready + // now set probe response frame specific configuration + SManagementFrameHeader* hdr + = reinterpret_cast + (iMemory + WHA::StemplateFrame::KHeaderSize ); + + hdr->iFrameControl.iType = E802Dot11FrameTypeProbeResp; + + // set privacy bit depending do we have a + // encryption key set or not + const WHA::TKeyType group_key = aCtxImpl.GroupKeyType(); + const WHA::TKeyType pairwise_key = aCtxImpl.PairWiseKeyType(); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForIbssMode::ConfigureProbeResponseTemplate: check for WEP") ); + + if ( (group_key != WHA::EKeyNone + || pairwise_key != WHA::EKeyNone) ) + { + // we have set a group or pairwise key + // enable privacy + SCapabilityInformationField* cap_ptr + = reinterpret_cast + (reinterpret_cast(hdr + 1) + + KTimeStampFixedFieldLength + + KBeaconIntervalFixedFieldLength); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForIbssMode::ConfigureProbeResponseTemplate: enable WEP") ); + + cap_ptr->SetWepBit(); + } + + // all done now write the MIB + WHA::StemplateFrame* mib + = reinterpret_cast(iMemory); + mib->iFrameType = WHA::KProbeResponseTemplate; + mib->iInitialTransmitRate = ProbeResponseTxRate( aCtxImpl ); + mib->iLength = length; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + TUint32 mib_len( + // length of MIB header + WHA::StemplateFrame::KHeaderSize + // length of the frame template + + mib->iLength ); + + // align length of MIB to 4-byte boundary + mib_len = Align4( mib_len ); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibTemplateFrame, + mib_len, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::SetTxRatePolicy( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11PrepareForIbssMode::SetTxRatePolicy(): rate bitmask: 0x%08x"), + aCtxImpl.RateBitMask() ); + + if ( !ConfigureTxRatePolicies( aCtxImpl ) ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::SetBeaconLostCount( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11PrepareForIbssMode::SetBeaconLostCount()") ); + + WHA::SbeaconLostCount* mib + = reinterpret_cast(iMemory); + + // disable BSS lost (and thus also BSS regained) indications + const TUint8 KDisableIndications( 0 ); + mib->iLostCount = KDisableIndications; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibBeaconLostCount, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::Join( + WlanContextImpl& aCtxImpl ) + { + // templates are configured now do a join + + // make WHA types + WHA::SSSID ssid; + ssid.iSSIDLength = aCtxImpl.GetSsId().ssidLength; + os_memcpy( + ssid.iSSID, + aCtxImpl.GetSsId().ssid, + aCtxImpl.GetSsId().ssidLength ); + WHA::TMacAddress mac; + os_memcpy( + &mac, + &(aCtxImpl.GetBssId()), + WHA::TMacAddress::KMacAddressLength ); + + // feed the critter with parameters + aCtxImpl.WsaJoin().Set( + aCtxImpl, + aCtxImpl.NetworkOperationMode(), + mac, + // only 2.4 GHz band is supported for now, so we can hard + // code it should be changed as soon as our implemetation + // supports multiple bands + WHA::KBand2dot4GHzMask, + ssid, + aCtxImpl.NetworkChannelNumeber(), + aCtxImpl.NetworkBeaconInterval(), + aCtxImpl.BasicRateSet(), + aCtxImpl.AtimWindow(), // ATIM + (aCtxImpl.UseShortPreamble()) + ? WHA::EShortPreamble : WHA::ELongPreamble, + ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KProbe4Join ) ? ETrue : EFalse ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaJoin() // next state + ); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + // join success continue state traversal + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIbssNormalMode // next state + ); + + // there exists no valid use case for IBSS join to fail + // so assume allways success + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11PrepareForIbssMode::ConfigureTemplate( + WlanContextImpl& aCtxImpl, + TUint32& aLength) + { + // set up the template + os_memset( iMemory, 0, KAllocLen ); + + // set dot11 header + + SManagementFrameHeader* hdr + = reinterpret_cast + (iMemory + WHA::StemplateFrame::KHeaderSize ); + + hdr->iSA = aCtxImpl.iWlanMib.dot11StationId; + hdr->iBSSID = aCtxImpl.GetBssId(); + + // set beacon interval + TUint16* ptr = + (reinterpret_cast(hdr + 1)) + + (KTimeStampFixedFieldLength / (sizeof(*ptr))); + *ptr = aCtxImpl.NetworkBeaconInterval(); + + // set capability information + SCapabilityInformationField* cap_ptr + = reinterpret_cast(++ptr); + cap_ptr->SetIbss(); + if ( aCtxImpl.UseShortPreamble() ) + { + cap_ptr->SetShortPreamble(); + } + else + { + cap_ptr->ClearShortPreamble(); + } + + // set SSID + new (++cap_ptr) SSsIdIE( + aCtxImpl.GetSsId().ssid, + aCtxImpl.GetSsId().ssidLength ); + + TUint8* p = reinterpret_cast(cap_ptr); + + p += aCtxImpl.GetSsId().ssidLength + sizeof(SInformationElementHeader); + + // set supported rates IE + os_memcpy( + p, + &(aCtxImpl.GetOurSupportedRatesIE()), + aCtxImpl.GetOurSupportedRatesIE().GetIeLength() ); + + p += aCtxImpl.GetOurSupportedRatesIE().GetIeLength(); + + // set DS parameter set IE + new (p) SDsParameterSetIE( aCtxImpl.NetworkChannelNumeber() ); + p += sizeof(SDsParameterSetIE); + + // set IBSS parameter set IE + SIbssParameterSetIE ibssparam( aCtxImpl.AtimWindow() ); + + // NOTE: we use memcpy for this as there is no gurantee that + // SDsParameterSetIE ends as 16-bit aligned and iValue member is + // 16-bit long which means we could get an alignment fault + os_memcpy( p, &ibssparam, sizeof(SIbssParameterSetIE) ); + p += sizeof(SIbssParameterSetIE); + + // set extended supported rates IE if it's not empty + // + if ( aCtxImpl.GetOurExtendedSupportedRatesIE().GetElementLength() ) + { + os_memcpy( + p, + &(aCtxImpl.GetOurExtendedSupportedRatesIE()), + aCtxImpl.GetOurExtendedSupportedRatesIE().GetIeLength() ); + + p += aCtxImpl.GetOurExtendedSupportedRatesIE().GetIeLength(); + } + + // store length of the beacon + aLength = reinterpret_cast(p) - reinterpret_cast(hdr); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +WHA::TRate WlanDot11PrepareForIbssMode::BeaconTxRate( + WlanContextImpl& aCtxImpl ) const + { + return aCtxImpl.GetMinBasicRate(); + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +WHA::TRate WlanDot11PrepareForIbssMode::ProbeResponseTxRate( + WlanContextImpl& aCtxImpl ) const + { + return aCtxImpl.GetMinBasicRate(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11ReassociationPending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11ReassociationPending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,987 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UmacDot11ReassociationPending class +* +*/ + +/* +* %version: 37 % +*/ + +#include "config.h" +#include "UmacDot11ReassociationPending.h" +#include "UmacContextImpl.h" +#include "umacelementlocator.h" +#include "umacwhaconfigureac.h" +#include "802dot11DefaultValues.h" + +#ifndef NDEBUG +const TInt8 WlanDot11ReassociationPending::iName[] = "dot11-reassociationpending"; + +const TUint8 WlanDot11ReassociationPending::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ETXREASSOCIATIONFRAME"}, + {"EWAIT4REASSOCIATIONRESPONSE"}, + {"ECONFIGUREAC"}, + {"EWAIT4PUSHPACKET"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11ReassociationPending::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXREASSOCFRAMEXFER"}, + {"ERXREASSOCRESPONSE"}, + {"ETXCOMPLETE"}, + {"ETIMEOUT"}, + {"ETX_SCHEDULER_FULL"}, + {"EPUSHPACKET"} + }; +#endif + + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11ReassociationPending::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::Entry( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacProtocolState | KUmacAssoc, + (TUint8*)("UMAC * execute dot11 assoiate")); + + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // no need to do event dispatching as this + // thing is triggered by the user and + // is executed synchronously as we only do OID completion + // at the end of reassociation process + + if ( iState == EINIT ) + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + else + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + OsTracePrint( + KUmacProtocolState, + (TUint8*)("UMAC: WlanDot11ReassociationPending::Exit")); + + // we are departing this dot11state to another dot11state + // we simple reset our local FSM for the next time... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::OnPacketTransferComplete")); + + if ( aPacketId == E802Dot11FrameTypeData ) + { + OnTxProtocolStackDataComplete( aCtxImpl, aMetaHeader ); + } + else if ( aPacketId == E802Dot11FrameTypeDataEapol || + aPacketId == E802Dot11FrameTypeManagementAction || + aPacketId == E802Dot11FrameTypeTestFrame ) + { + OnMgmtPathWriteComplete( aCtxImpl ); + } + else + { + // this frame Tx request didn't come from above us (i.e. neither + // through the user data nor the management data API) but is + // related to a frame Tx we have done internally. So we need to mark + // the internal Tx buffer free again + aCtxImpl.MarkInternalTxBufFree(); + } + + if ( aPacketId == E802Dot11FrameTypeReassociationReq ) + { + // reassociation tx message has been xferred to the WLAN device + + Fsm( aCtxImpl, ETXREASSOCFRAMEXFER ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate /*aRate*/, + WHA::TRcpi aRcpi, + WHA::TChannelNumber /*aChannel*/, + TUint8* aBuffer, + TUint32 aFlags ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::ReceivePacket()")); + + if ( aStatus == WHA::KSuccess ) + { + // receive success + const Sdot11MacHeader* dot11_hdr( + static_cast(aFrame) ); + + // we accept only frames with ToDS bit cleared + if ( dot11_hdr->IsToDsBitSet() ) + { + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: associating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: rx-frame: ToDs bit set, discard frame") ); + + // release the Rx buffer & abort + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + return; + } + + const TBool class3_frame( IsClass3Frame( + dot11_hdr->iFrameControl.iType ) ); + const TBool unicast_addr( !IsGroupBitSet( dot11_hdr->iAddress1 ) ); + + if ( class3_frame && unicast_addr ) + { + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: re-associating to BSS:") ); + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("rx class3 frame with unicast DA address") ); + + // class 3 frame rx and unicast address in address1 field + + // That's not the frame we are expecting so release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + + if ( !Associated() ) + { + // we do not have a valid association with the + // BSS where the frame came from + OsTracePrint( KWarningLevel | KUmacAssoc, + (TUint8*)("UMAC: TxDisassociate") ); + + // set the BSSID of the existing network; and the DA + if ( aCtxImpl.HtSupportedByNw() ) + { + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iBSSID + = aCtxImpl.GetBssId(); + (aCtxImpl.GetHtDisassociationFrame()).iHeader.iDA + = aCtxImpl.GetBssId(); + } + else + { + (aCtxImpl.GetDisassociationFrame()).iHeader.iBSSID + = aCtxImpl.GetBssId(); + (aCtxImpl.GetDisassociationFrame()).iHeader.iDA + = aCtxImpl.GetBssId(); + } + if ( !TxDisassociate( + aCtxImpl, + E802Dot11ReasonClass3FrameWhenNotAssoc ) ) + { + // frame was not sent because either packet scheduler was + // full or because we didn't get a Tx buffer. In any case + // we won't try to send it again. + } + } + else + { + // this section is left intentionally empty + } + } + else + { + // default handler + OnReceiveFrameSuccess( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aFlags, + aBuffer ); + } + } + else // --- aStatus == WHA::KSuccess --- + { + // receive failed, so discard and release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 aLength, + WHA::TRcpi aRcpi, + TUint32 aFlags, + TUint8* aBuffer ) + { + // receive success + // parse frame in order to determine if it is what we are expecting + const SManagementFrameHeader* frame_hdr( + static_cast(aFrame) ); + + TBool type_match( EFalse ); + + if ( // is this reassociation response frame + IsRequestedFrameType( + frame_hdr->iFrameControl.iType, + E802Dot11FrameTypeReassociationResp, type_match ) + // AND our MAC address is DA + && ( frame_hdr->iDA == aCtxImpl.iWlanMib.dot11StationId ) + // AND we haven't received the reassoc response yet + && ( !( iFlags & KReassocReceived ) ) ) + { + T802Dot11ManagementStatusCode status( + IsRxReassociationSuccess( aCtxImpl, aFrame, aFlags ) ); + + if ( status == E802Dot11StatusSuccess ) + { + // --- begin WMM + if ( aCtxImpl.QosEnabled() ) + { + WlanElementLocator elementLocator( + reinterpret_cast( aFrame ) + + sizeof( SManagementFrameHeader ) + + sizeof( SReassociationResponseFixedFields ), + aLength - + sizeof( SManagementFrameHeader ) + + sizeof( SReassociationResponseFixedFields ) ); + + TUint8 length( 0 ); + const TUint8* data( NULL ); + + // is WMM Parameter Element present + if ( elementLocator.InformationElement( + E802Dot11VendorSpecificIE, + KWmmElemOui, + KWmmElemOuiType, + KWmmParamElemOuiSubtype, + length, + &data ) + == WlanElementLocator::EWlanLocateOk ) + { + // WMM Parameter Element found + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::ReceivePacket(): WMM param set cnt: %d"), + (reinterpret_cast(data))->ParameterSetCount() ); + + if ( (reinterpret_cast + (data))->ParameterSetCount() != + aCtxImpl.WmmParameterSetCount() ) + { + // AC parameters have changed => parse again + ParseAcParameters( aCtxImpl, + reinterpret_cast(*data ) ); + // in this case we need to re-issue configure AC wha cmd + // so make a note of that + iFlags |= KConfigureAc; + } + } + else + { + // protocol error from AP; just try to continue with + // current WMM parameters + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11AssociationPending::ReceivePacket(): PROTOCOL ERROR from AP side") ); + } + } + // --- end WMM + } + else + { + // reassociation failed + OsTracePrint( KUmacAssoc | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::ReceivePacket(): reassociation denied, status %d"), + status ); + + // in this case we will go back to idle state + // where the connect oid will be completed. + // So set the completion code value to be returned to user mode + aCtxImpl.iStates.iIdleState.Set( status ); + } + + // forward the re-association response frame to Wlan Mgmt client + if ( XferDot11FrameToMgmtClient( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aBuffer ) ) + { + // forwarding succeeded. Now we can say that we have received + // the Reassoc response successfully + + iFlags |= KReassocReceived; + aCtxImpl.CancelTimer(); + + if ( status == E802Dot11StatusSuccess ) + { + iFlags |= KReassocSuccess; + + OsTracePrint( KUmacAssoc, + (TUint8*)("UMAC: reassociation success") ); + } + + Fsm( aCtxImpl, ERXREASSOCRESPONSE ); + } + else + { + // forwarding the frame to WLAN Mgmt client failed, which + // won't happen in this situation under the normal circumstances. + // Anyhow, it has happened now, so we have no other choice than to + // discard the frame. The Rx buffer has already been + // released. So no action here + } + } + else + { + // not a valid frame in this situation; we just silently discard it + OsTracePrint( KUmacAssoc | KUmacDetails, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::OnReceiveFrameSuccess: " + "not relevant frame; ignore")); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11ReassociationPending::OnTimeout( + WlanContextImpl& aCtxImpl ) + { + TBool stateChange ( ETrue ); + + switch ( iState ) + { + case EWAIT4REASSOCIATIONRESPONSE: + // reassociation timeout + + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::OnTimeout: timeout => reassociation failed!") ); + + Fsm( aCtxImpl, ETIMEOUT ); + + // in this case we return ETrue, i.e. signal the caller that a + // state change occurred + + break; + default: + // a timeout occurred when we weren't expecting it (yet). This + // means that a timeout callback had already been registered when + // we tried to cancel this timer the previous time (regarding + // authentication). So this callback is not relevant for + // reassociation and can be ignored. + + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::OnTimeout: irrelevant timeout; ignored") ); + + // Signal the caller that no state change occurred + stateChange = EFalse; + } + + return stateChange; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11ReassociationPending::Fsm(): event: ")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11ReassociationPending::Fsm(): state: ")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXREASSOCFRAMEXFER: + OnTxReassocFrameXferEvent( aCtxImpl ); + break; + case ERXREASSOCRESPONSE: + OnRxReassocResponseEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ETIMEOUT: + OnTimeoutEvent( aCtxImpl ); + break; + case ETX_SCHEDULER_FULL: + OnTxSchedulerFullEvent( aCtxImpl ); + break; + case EPUSHPACKET: + OnPushPacketEvent( aCtxImpl ); + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: event: %d"), aEvent); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11ReassociationPending::OnStateEntryEvent()")); + + switch ( iState ) + { + case EINIT: + iFlags = 0; + ChangeInternalState( aCtxImpl, ETXREASSOCIATIONFRAME ); + break; + case ETXREASSOCIATIONFRAME: + if ( !SendReassociationRequest( aCtxImpl ) ) + { + // tx of dot11-reassociate frame failed + // because packet scheduler was full + // or because we didn't get a Tx buffer + // so we enter to a wait state + Fsm( aCtxImpl, ETX_SCHEDULER_FULL ); + } + break; + case EWAIT4REASSOCIATIONRESPONSE: + // start a timer to wait for the response frame + StartReassociationResponseTimer( aCtxImpl ); + break; + case ECONFIGUREAC: + ConfigureAc( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + case EWAIT4PUSHPACKET: + // nothing to do here than wait + break; + default: + // programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + if ( iFlags & KReassocSuccess ) + { + // reassociation was a success + // so we proceed to next state + // + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iInfrastructureModeInit // next state + ); + } + else + { + // reassociation was a failure + // either due AP denial or timeout. + // The reason does not really intrest us here + // as the procedure is the same... + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { +#ifndef NDEBUG + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11ReassociationPending::ChangeInternalState(): old state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11ReassociationPending::ChangeInternalState(): new state:")); + OsTracePrint( KUmacDetails, iStateName[aNewState] ); +#endif + + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11ReassociationPending::SendReassociationRequest( WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::SendReassociationRequest")); + + TBool status ( EFalse ); + TUint8* startOfFrame ( NULL ); + + const TUint32 length_of_frame + = ConstructReassociationRequestFrame( aCtxImpl, startOfFrame ); + + if ( length_of_frame ) + { + // frame is ready for delivery in the tx buffer + // send reassociation request message to the AP + // + + const WHA::TQueueId queue_id + = QueueId( aCtxImpl, startOfFrame ); + + // push the frame to packet scheduler for transmission + status = aCtxImpl.PushPacketToPacketScheduler( + startOfFrame, + length_of_frame, + queue_id, + E802Dot11FrameTypeReassociationReq, + NULL, + EFalse, + EFalse, + ETrue ); + + if ( !status ) + { + // as we came here we did get an internal Tx buffer for the frame + // but packet push to scheduler failed. In this case we need cancel + // the internal Tx buffer reservation as we will request it again + // when the Packet Scheduler is again ready for packet push + aCtxImpl.MarkInternalTxBufFree(); + } + } + else + { + // frame not ready for delivery. EFalse will be returned + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TUint32 WlanDot11ReassociationPending::ConstructReassociationRequestFrame( + WlanContextImpl& aCtxImpl, + TUint8*& aStartOfFrame ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::ConstructReassociationRequestFrame") ); + + TUint32 lengthOfFrame ( 0 ); + + // client doesn't have to take care of the tx buffer header space + // as the method below does that by itself + aStartOfFrame = aCtxImpl.TxBuffer( ETrue ); + + if ( aStartOfFrame ) + { + // construct reassociation request frame + // Note that we don't need to set SA because we have already set it + // in the initialization phase of the state machine. + // Also capabilty information field is already set to frame template + // in AreNetworkRequirementsMet() method. + // Also the address of the old AP has already been set in the + // reassociation request frame + + TUint8* buffer_ptr = aStartOfFrame; + + if ( aCtxImpl.HtSupportedByNw() && aCtxImpl.QosEnabled() ) + { + // set the BSSID field + (aCtxImpl.GetHtReassociationRequestFrame()).iHeader.iBSSID = + aCtxImpl.GetBssId(); + // set the DA field + (aCtxImpl.GetHtReassociationRequestFrame()).iHeader.iDA = + aCtxImpl.GetBssId(); + + // set listen interval (in units of beacon interval) + (aCtxImpl.GetHtReassociationRequestFrame()).iFixedFields.iListenInterval + = KDot11ListenIntervalInMs / aCtxImpl.NetworkBeaconInterval(); + + // copy frame to tx-buffer to correct offset + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetHtReassociationRequestFrame()), + sizeof( SHtReassociationRequestFrame ) ); + + buffer_ptr += sizeof( SHtReassociationRequestFrame ); + } + else + { + // set the BSSID field + (aCtxImpl.GetReassociationRequestFrame()).iHeader.iBSSID = + aCtxImpl.GetBssId(); + // set the DA field + (aCtxImpl.GetReassociationRequestFrame()).iHeader.iDA = + aCtxImpl.GetBssId(); + + // set listen interval (in units of beacon interval) + (aCtxImpl.GetReassociationRequestFrame()).iFixedFields.iListenInterval + = KDot11ListenIntervalInMs / aCtxImpl.NetworkBeaconInterval(); + + // copy frame to tx-buffer to correct offset + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetReassociationRequestFrame()), + sizeof( SReassociationRequestFrame ) ); + + buffer_ptr += sizeof( SReassociationRequestFrame ); + } + + // set SSID IE + + SSsIdIE ssid_ie( (aCtxImpl.GetSsId()).ssid, + (aCtxImpl.GetSsId()).ssidLength ); + + const TUint8 ssidIeLength( ssid_ie.GetIeLength() ); + + os_memcpy( + buffer_ptr, + &ssid_ie, + ssidIeLength ); + + buffer_ptr += ssidIeLength; + + // set supported rates IE + + const TUint8 supportedRatesIeLength( + aCtxImpl.GetOurSupportedRatesIE().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetOurSupportedRatesIE()), + supportedRatesIeLength ); + + buffer_ptr += supportedRatesIeLength; + + if ( aCtxImpl.HtSupportedByNw() ) + { + // set HT capabilities element + + const TUint8 htCapabilitiesIeLength( + aCtxImpl.GetOurHtCapabilitiesIe().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetOurHtCapabilitiesIe()), + htCapabilitiesIeLength ); + + buffer_ptr += htCapabilitiesIeLength; + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: HT capabilities element added") ); + } + + // set extended supported rates IE if it's not empty + if ( aCtxImpl.GetOurExtendedSupportedRatesIE().GetElementLength() ) + { + const TUint8 extSupportedRatesIeLength( + aCtxImpl.GetOurExtendedSupportedRatesIE().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.GetOurExtendedSupportedRatesIE()), + extSupportedRatesIeLength ); + + buffer_ptr += extSupportedRatesIeLength; + } + + // set any IEs possibly provided by management client + const TUint8* ieData( aCtxImpl.IeData() ); + if ( ieData ) + { + const TUint16 ieDataLength( aCtxImpl.IeDataLength()); + + os_memcpy( buffer_ptr, ieData, ieDataLength ); + buffer_ptr += ieDataLength; + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: management client supplied IE(s) added") ); + } + + // set WMM IE if needed + if ( aCtxImpl.QosEnabled() ) + { + const TUint8 wmmIeLength( aCtxImpl.OurWmmIe().GetIeLength() ); + + os_memcpy( + buffer_ptr, + &(aCtxImpl.OurWmmIe()), + wmmIeLength); + + buffer_ptr += wmmIeLength; + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WMM IE added") ); + } + + // length of frame + lengthOfFrame = buffer_ptr - aStartOfFrame; + } + else + { + // we didn't get a Tx buffer. Zero will be returned as the frame length + // to indicate that + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::ConstructReassociationRequestFrame: no internal Tx buffer available") ); + } + + return lengthOfFrame; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::StartReassociationResponseTimer( + WlanContextImpl& aCtxImpl ) const + { + // start association response timeout timer + const TUint32 timeout( dot11AssociateResponseTimeout * KTU ); + + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::StartReassociationResponseTimer: timeout in %d microseconds"), + timeout ); + + aCtxImpl.iUmac.RegisterTimeout( timeout ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnRxReassocResponseEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4REASSOCIATIONRESPONSE: + if ( iFlags & KConfigureAc ) + { + ChangeInternalState( aCtxImpl, ECONFIGUREAC ); + } + else + { + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + break; + default: + // this means that we have recieved a valid dot11 + // reassociation response frame + // but we are not internally in the correct state + // Either someone has skipped to call the packet xfer method + // that informs of associate request frame + // xfer to the WLAN device or + // we have an internal error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +T802Dot11ManagementStatusCode +WlanDot11ReassociationPending::IsRxReassociationSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint32 aFlags ) + { + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::IsRxReassociationSuccess")); + + // get the fixed fields from association response + const SReassociationResponseFixedFields* fields = + HtcFieldPresent( aCtxImpl, aFrame, aFlags ) ? + reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SHtManagementFrameHeader )) : + reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SManagementFrameHeader )); + + // store AID + OsTracePrint( KUmacAssoc, (TUint8*) + ("UMAC: WlanDot11ReassociationPending::IsRxReassociationSuccess: AID extracted from reassociation response: 0x%04x"), + fields->Aid() ); + aCtxImpl.Aid( fields->Aid() ); + + return static_cast( + fields->StatusCode() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ECONFIGUREAC: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnTimeoutEvent( + WlanContextImpl& aCtxImpl ) + { + // set completion code + // as dot11idle state does the OID completion + aCtxImpl.iStates.iIdleState.Set( KErrTimedOut ); + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// ----------------------------------------------------------------------------- +// Handler for scheduler full event upon trying to tx dot11-associate frame +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnTxSchedulerFullEvent( + WlanContextImpl& aCtxImpl ) + { + // change state + OsTracePrint( KWarningLevel | KUmacAssoc, (TUint8*) + ("UMAC: packet scheduler full during association process") ); + + ChangeInternalState( aCtxImpl, EWAIT4PUSHPACKET ); + } + +// ----------------------------------------------------------------------------- +// packet sceduler notification that a packet push is guaranteed to succeed +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + // feed a critter to the fsm + Fsm( aCtxImpl, EPUSHPACKET ); + } + +// ----------------------------------------------------------------------------- +// Handler for push packet to packet scheduler possible event +// ----------------------------------------------------------------------------- +// +void WlanDot11ReassociationPending::OnPushPacketEvent( + WlanContextImpl& aCtxImpl ) + { + if ( iState == EWAIT4PUSHPACKET ) + { + ChangeInternalState( aCtxImpl, ETXREASSOCIATIONFRAME ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Roam.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Roam.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UmacDot11Roam class +* +*/ + +/* +* %version: 8 % +*/ + +#include "config.h" +#include "UmacDot11Roam.h" + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11Roam::WlanDot11Roam() + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11Roam::~WlanDot11Roam() + { + } + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SharedAuthPending.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SharedAuthPending.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,490 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11SharedAuthPending class +* +*/ + +/* +* %version: 27 % +*/ + +#include "config.h" +#include "UmacDot11SharedAuthPending.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanDot11SharedAuthPending::iName[] + = "dot11-sharedauthpending"; +#endif // !NDEBUG + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11SharedAuthPending::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// set appropriate used algorithm number to authenticate request frame +// ----------------------------------------------------------------------------- +// +void WlanDot11SharedAuthPending::OnSetAlgorithmNumber( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.HtSupportedByNw() ) + { + aCtxImpl.GetHtAuthenticationFrame().SetAlgorithmNmbr( + K802Dot11AuthModeShared ); + } + else + { + aCtxImpl.GetAuthenticationFrame().SetAlgorithmNmbr( + K802Dot11AuthModeShared ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// ----------------------------------------------------------------------------- +// +void WlanDot11SharedAuthPending::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + TBool ret( ETrue ); + + switch ( iState ) + { + case EINIT: + // do all the synchronous + // composite state entry actions + StateEntryActions( aCtxImpl ); + // continue with the state traversal + Fsm( aCtxImpl, ECONTINUE ); + break; + case ETXAUTHFRAME: + // send correct authenticate frame + if ( aCtxImpl.GetAuthSeqNmbrExpected() + == E802Dot11AuthenticationSeqNmbr2 ) + { + ret = SendAuthSeqNbr1Frame( aCtxImpl ); + } + else + { + ret = SendAuthSeqNbr3Frame( aCtxImpl ); + } + + if (!ret ) + { + // tx of dot11-authenticate frame failed + // because packet scheduler was full + // or because we didn't get a Tx buffer + // so we enter to a wait state + Fsm( aCtxImpl, ETX_SCHEDULER_FULL ); + } + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + case EWAIT4AUTHRESPONSE: + StartAuthenticationFrameResponseTimer( aCtxImpl ); + break; + case EWAIT4PUSHPACKET: + // nothing to do here than wait + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for rx authentication response event. +// ----------------------------------------------------------------------------- +// +void WlanDot11SharedAuthPending::OnRxAuthResponseEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EWAIT4AUTHRESPONSE: + // check do we need to send an another authenticate frame or not + if ( // current authentication frame exchange was a success + ((iFlags & KAuthSuccess) + // AND authentication frame exchange is complete + && ( aCtxImpl.GetAuthSeqNmbrExpected() + == E802Dot11AuthenticationSeqNmbr4 )) + // OR current authentication frame exchange was a failure + || !(iFlags & KAuthSuccess) + ) + { + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + else + { + // current authentication frame exchange was a success + // but authentication frame exchange is NOT complete + + // incerement the seq.nmbr expected from AP counter + aCtxImpl.IncrementAuthSeqNmbrExpected(); + ChangeInternalState( aCtxImpl, ETXAUTHFRAME ); + } + break; + default: + // this means that we have recieved a valid dot11 + // authenticate response frame that we are waiting for + // but we are not internally in such a state + // only feasible situation for this is that + // someone has skipped a call to the packet xfer method + // that informs of authenticate request frame + // xfer to the WLAN device. + // other case is that our fsm is totally messed up + // so we catch this +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Send authenticate seq. number 3 message +// ----------------------------------------------------------------------------- +// +TBool WlanDot11SharedAuthPending::SendAuthSeqNbr3Frame( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11SharedAuthPending::SendAuthSeqNbr3Frame") ); + + TBool status ( EFalse ); + + // client doesn't have to take care of the tx buffer header space + // as the method below does that by itself + TUint8* frame_ptr = aCtxImpl.TxBuffer( ETrue ); + + if ( frame_ptr ) + { + // store start of frame + const TUint8* start_of_frame = frame_ptr; + TUint32 txFrameHdrAndFixedPartLen ( 0 ); + // construct auth message seq. number 3 + + if ( aCtxImpl.HtSupportedByNw() && aCtxImpl.QosEnabled() ) + { + // set our seq. nbr in next authenticate Tx-frame + aCtxImpl.GetHtAuthenticationFrame().IncrementSeqNmbr(); + + // set the WEP bit, as that is the only thing that triggers + // the ecryption engine. Don't worry about clearing it here + // because we do it in WlanDot11AuthenticatePending::Entry() + aCtxImpl.GetHtAuthenticationFrame().SetWepBit(); + + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: Algorithm number: %d"), + aCtxImpl.GetHtAuthenticationFrame().GetAlgorithmNumber()); + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: Sequence number: %d"), + aCtxImpl.GetHtAuthenticationFrame().GetSeqNmbr()); + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: Status code: %d"), + aCtxImpl.GetHtAuthenticationFrame().GetStatusCode()); + + // copy the dot11 authentication frame header to tx buffer + os_memcpy( frame_ptr, + &(aCtxImpl.GetHtAuthenticationFrame().iHeader), + sizeof( aCtxImpl.GetHtAuthenticationFrame().iHeader) ); + + // adjust to end of copy + frame_ptr + += sizeof( aCtxImpl.GetHtAuthenticationFrame().iHeader ); + + txFrameHdrAndFixedPartLen = sizeof( SHtAuthenticationFrame ); + } + else + { + // set our seq. nbr in next authenticate Tx-frame + aCtxImpl.GetAuthenticationFrame().IncrementSeqNmbr(); + + // set the WEP bit, as that is the only thing that triggers + // the ecryption engine. Don't worry about clearing it here + // because we do it in WlanDot11AuthenticatePending::Entry() + aCtxImpl.GetAuthenticationFrame().SetWepBit(); + + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: Algorithm number: %d"), + aCtxImpl.GetAuthenticationFrame().GetAlgorithmNumber()); + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: Sequence number: %d"), + aCtxImpl.GetAuthenticationFrame().GetSeqNmbr()); + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: Status code: %d"), + aCtxImpl.GetAuthenticationFrame().GetStatusCode()); + + // copy the dot11 authentication frame header to tx buffer + os_memcpy( frame_ptr, + &(aCtxImpl.GetAuthenticationFrame().iHeader), + sizeof( aCtxImpl.GetAuthenticationFrame().iHeader) ); + + // adjust to end of copy + frame_ptr + += sizeof( aCtxImpl.GetAuthenticationFrame().iHeader ); + + txFrameHdrAndFixedPartLen = sizeof( SAuthenticationFrame ); + } + + // set the WEP IV field + // do a 16-bit fill + const TUint16 fill_value( 0 ); + fill( + reinterpret_cast(frame_ptr), + ( reinterpret_cast(frame_ptr) ) + + ( KWepIVLength / sizeof( fill_value ) ), + fill_value ); + + // adjust to begin of the authentication frame fixed fields + frame_ptr += KWepIVLength; + + if ( aCtxImpl.HtSupportedByNw() ) + { + // copy authentication frame fixed fields after WEP IV + os_memcpy( + frame_ptr, + &(aCtxImpl.GetHtAuthenticationFrame().iAuthenticationFields), + sizeof( + aCtxImpl.GetHtAuthenticationFrame().iAuthenticationFields) ); + + // adjust to end of copy + frame_ptr += sizeof( + aCtxImpl.GetHtAuthenticationFrame().iAuthenticationFields ); + + // copy challenge text from Rx-buffer to Tx-buffer + + const TUint KRxFramehdrAndFixedPartLen = + HtcFieldPresent( + aCtxImpl, + iLatestRxAuthRespPtr, + iLatestRxAuthRespFlags ) ? + sizeof( SHtAuthenticationFrame ) : + sizeof( SAuthenticationFrame ); + os_memcpy( frame_ptr, + iLatestRxAuthRespPtr + KRxFramehdrAndFixedPartLen, + KChallengeTextLength + KInfoElementHeaderLength ); + } + else + { + // copy authentication frame fixed fields after WEP IV + os_memcpy( + frame_ptr, + &(aCtxImpl.GetAuthenticationFrame().iAuthenticationFields), + sizeof( + aCtxImpl.GetAuthenticationFrame().iAuthenticationFields) ); + + // adjust to end of copy + frame_ptr += sizeof( + aCtxImpl.GetAuthenticationFrame().iAuthenticationFields ); + + // copy challenge text from Rx-buffer to Tx-buffer + os_memcpy( frame_ptr, + iLatestRxAuthRespPtr + sizeof( SAuthenticationFrame ), + KChallengeTextLength + KInfoElementHeaderLength ); + } + + // trace the frame critter + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: dot11 authenticate frame tx:"), + *(reinterpret_cast(start_of_frame)) ); + + const WHA::TQueueId queue_id + = QueueId( aCtxImpl, start_of_frame ); + + // push the frame to packet scheduler for transmission + status = aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + txFrameHdrAndFixedPartLen + + KChallengeTextLength + + KInfoElementHeaderLength + + KWepIVLength + + KWEPICVLength, + queue_id, + E802Dot11FrameTypeAuthSeqNmbr3, + NULL, + EFalse, + EFalse, + ETrue ); + + if ( !status ) + { + // as we came here we did get an internal Tx buffer for the frame + // but packet push to scheduler failed. In this case we need to + // cancel the internal Tx buffer reservation as we will request it + // again when the Packet Scheduler is again ready for packet push + aCtxImpl.MarkInternalTxBufFree(); + } + } + else + { + // we didn't get a Tx buffer => frame not sent. EFalse will be returned + // to indicate that + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: WlanDot11SharedAuthPending::SendAuthSeqNbr3Frame: no internal Tx buffer available") ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// If we land here it means that we have received a frame of somekind +// with a success status +// ----------------------------------------------------------------------------- +// +void WlanDot11SharedAuthPending::OnReceiveFrameSuccess( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint16 /*aLength*/, + WHA::TRcpi /*aRcpi*/, + TUint32 aFlags, + TUint8* /*aBuffer*/ ) + { + // receive success + // parse frame in order to determine is it what we desire + const SManagementFrameHeader* frame_hdr + = static_cast(aFrame); + + TBool type_match( EFalse ); + + iFlags &= ~KAuthReceived; + iFlags &= ~KAuthSuccess; + + if (// can we accept this frame + // is this a management type + authentication subtype frame + IsRequestedFrameType( + frame_hdr->iFrameControl.iType, + E802Dot11FrameTypeAuthentication, type_match ) + // AND our MAC address is DA + && (frame_hdr->iDA == aCtxImpl.iWlanMib.dot11StationId) + // AND we are in correct state + && ( iState == EWAIT4AUTHRESPONSE ) + ) + { + + // this is a valid authentication frame targeted to us + // mark it so + iFlags |= KAuthReceived; + + // cancel authentication timer + aCtxImpl.CancelTimer(); + + // at this point we don't know is this a authentication success + // or failure scenario for this frame exchange + + if ( ResolveAuthMessage( + aCtxImpl, + K802Dot11AuthModeShared, + aFrame, + aFlags ) ) + { + // authentication frame exchange was a success + // mark it also + iFlags |= KAuthSuccess; + // store pointer to the received frame. We need it to extract + // the challenge text from the frame + iLatestRxAuthRespPtr = reinterpret_cast(aFrame); + // store also its receive flags for the same purpose + iLatestRxAuthRespFlags = aFlags; + + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: dot11-sharedauthpending * authentication frame exchange success")); + OsTracePrint( KUmacAuth, (TUint8*)("UMAC: sequence number expected: %d"), + aCtxImpl.GetAuthSeqNmbrExpected()); + + if ( !((aCtxImpl.GetAuthSeqNmbrExpected() + == E802Dot11AuthenticationSeqNmbr2) + || (aCtxImpl.GetAuthSeqNmbrExpected() + == E802Dot11AuthenticationSeqNmbr4 )) + ) + { + // catch a programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: sequence number expected"), + aCtxImpl.GetAuthSeqNmbrExpected()); + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { + // authentication frame exchange was a failure + + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: dot11-sharedauthpending * authentication failure")); + OsTracePrint( KUmacAuth, (TUint8*) + ("UMAC: sequence number expected: %d"), + aCtxImpl.GetAuthSeqNmbrExpected()); + + // authentication response message was NOT valid + // lets's see why that's the case + const SAuthenticationFixedFields* auth_fields + = reinterpret_cast + (reinterpret_cast(aFrame) + + sizeof( SManagementFrameHeader )); + + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: dot11-sharedauthpending * authentication failure") ); + OsTracePrint( KWarningLevel | KUmacAuth, (TUint8*) + ("UMAC: authentication status code: %d"), + auth_fields->StatusCode() ); + + // set the completion (error) code value returned to user mode + // as the dot11idle state does the OID completion in this case + if ( auth_fields->StatusCode() == E802Dot11StatusSuccess ) + { + // network returned success code but still an error in the + // authentication sequence has occurred. + // Either an authentication frame was received out of + // sequence or the algorithm number wasn't the expected one + aCtxImpl.iStates.iIdleState.Set( KErrGeneral ); + } + else + { + // complete with the network returned error code + aCtxImpl.iStates.iIdleState.Set( auth_fields->StatusCode() ); + } + } + } + else + { + // incorrect frame type + // or we are not in correct state + // so we shall discard its processing + } + + if ( iFlags & KAuthReceived ) + { + // authentication response was received + // either success or failure + // we don't really care in this state + + Fsm( aCtxImpl, ERXAUTHRESPONSE ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SoftReset.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11SoftReset.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,414 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11SoftReset class +* +*/ + +/* +* %version: 28 % +*/ + +#include "config.h" +#include "UmacDot11SoftReset.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaDisconnect.h" +#include "umacconfiguretxqueueparams.h" + +#ifndef NDEBUG +const TInt8 WlanDot11SoftReset::iName[] = "dot11-softreset"; + +const TUint8 WlanDot11SoftReset::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EISSUEDISCONNECT"}, + {"ECONFTXQUEUE"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11SoftReset::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"EABORT"} + }; +#endif +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11SoftReset::Fsm(): event: ")); + OsTracePrint( + KUmacDetails, + iEventName[aEvent] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11SoftReset::Fsm(): state: ")); + OsTracePrint( + KUmacDetails, + iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11SoftReset::Fsm(): event: %d"), + aEvent); + OsAssert( + (TUint8*)("UMAC: WlanDot11SoftReset::Fsm(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11SoftReset::OnStateEntryEvent()")); + + switch ( iState ) + { + case EINIT: + InitActions( aCtxImpl ); + ChangeInternalState( aCtxImpl, EISSUEDISCONNECT ); + break; + case EISSUEDISCONNECT: + IssueDisconnect( aCtxImpl ); + break; + case ECONFTXQUEUE: + // configure just the legacy Tx queue + ConfigureQueue( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::InitActions( WlanContextImpl& aCtxImpl ) + { + // we are breaking an existing join so we have to reset some + // state variables and settings + aCtxImpl.CurrentDot11PwrMgmtMode( WHA::KPsDisable ); + aCtxImpl.Reassociate( EFalse ); + aCtxImpl.QosEnabled( EFalse ); + aCtxImpl.UapsdEnabled( EFalse ); + DetermineAcUapsdUsage( aCtxImpl ); + aCtxImpl.TerminateVoiceOverWlanCallMaintenance(); + aCtxImpl.MulticastFilteringDisAllowed( EFalse ); + aCtxImpl.ResetMulticastAddresses(); + aCtxImpl.ResetFailedTxPacketCount(); + aCtxImpl.IeData( NULL ); + aCtxImpl.DisassociatedByAp( EFalse ); + aCtxImpl.ResetTxRateAdaptation(); + os_memset( + reinterpret_cast(&(aCtxImpl.GetNwHtCapabilitiesIe().iData)), + 0, + K802Dot11HtCapabilitiesIeDataLen ); + + for ( TUint i = 0; i < WHA::EQueueIdMax; ++i ) + { + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[i] = + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetimeDefault; + aCtxImpl.iWlanMib.iMediumTime[i] = KDot11MediumTimeDefault; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11SoftReset::OnTxCompleteEvent()")); + + switch ( iState ) + { + case EISSUEDISCONNECT: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONFTXQUEUE ); + break; + case ECONFTXQUEUE: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state: %d"), iState); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11SoftReset::OnAbortEvent()") ); + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal()")); + +#ifndef NDEBUG + + // trace current frame statistics + + const TStatisticsResponse& frameStatistics ( aCtxImpl.FrameStatistics() ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: *** current frame statistics ***:") ); + + for ( TUint i = 0; i < EQueueIdMax; ++i ) + { + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: * Access Category: %d *"), + i ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: successfully received unicast data frames: %d"), + frameStatistics.acSpecific[i].rxUnicastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: successfully transmitted unicast data frames: %d"), + frameStatistics.acSpecific[i].txUnicastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: successfully received multicast data frames: %d"), + frameStatistics.acSpecific[i].rxMulticastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: successfully transmitted multicast data frames: %d"), + frameStatistics.acSpecific[i].txMulticastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: nbr of data frame transmit retries: %d"), + frameStatistics.acSpecific[i].txRetryCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: nbr of data frame WLAN delivery failures: %d"), + frameStatistics.acSpecific[i].txErrorCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: average data frame Tx media delay in microsecs: %d"), + aCtxImpl.AverageTxMediaDelay( static_cast(i) ) ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: average data frame total Tx delay in microsecs: %d"), + aCtxImpl.AverageTotalTxDelay( static_cast(i) ) ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: data frame total Tx delay bin 0 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin0 ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: data frame total Tx delay bin 1 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin1 ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: data frame total Tx delay bin 2 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin2 ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: data frame total Tx delay bin 3 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin3 ); + } + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11SoftReset::ContinueDot11StateTraversal: all ACs: nbr of FCS errors in received MPDUs: %d"), + frameStatistics.fcsErrorCount ); +#endif + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iMibDefaultConfigure // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11SoftReset::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11SoftReset::ChangeInternalState(): old state:")); + OsTracePrint( + KUmacDetails, + iStateName[iState] ); + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11SoftReset::ChangeInternalState(): new state:")); + OsTracePrint( + KUmacDetails, + iStateName[aNewState] ); +#endif + + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11SoftReset::IssueDisconnect( + WlanContextImpl& aCtxImpl ) + { + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaDisconnect() // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11SoftReset::ConfigureQueue( + WlanContextImpl& aCtxImpl ) + { + ConfigureTxQueue( aCtxImpl, WHA::ELegacy ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11SoftReset::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11SoftReset::Entry( WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // don't want to do event dispatching here as we want + // to run this dot11 state critter in non pre-emptive mode + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11SoftReset::Exit( WlanContextImpl& /*aCtxImpl*/ ) + { + OsTracePrint( + KUmacProtocolState, + (TUint8*)("UMAC: WlanDot11SoftReset::Exit()")); + + // reset our local FSM for the next time... + iState = EINIT; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,4758 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11State class. +* +*/ + +/* +* %version: 85 % +*/ + +#include "config.h" +#include "UmacDot11State.h" +#include "UmacWsaAddKey.h" +#include "UmacWsaKeyIndexMapper.h" +#include "umacaddbroadcastwepkey.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaReadMib.h" +#include "umacwhaconfigurequeue.h" +#include "umacwhaconfigureac.h" +#include "umacconfiguretxautoratepolicy.h" +#include "UmacContextImpl.h" +#include "wha_mibDefaultvalues.h" +#include "FrameXferBlock.h" +#include "umacelementlocator.h" + +struct TRate2NwsaRate + { + TRate iTrate; + WHA::TRate iNwsaRate; + }; + +const TRate2NwsaRate KTRate2NwsaRateTable[] = + { + { E1Mbps, WHA::KRate1Mbits }, + { E2Mbps, WHA::KRate2Mbits }, + { E5_5Mbps, WHA::KRate5_5Mbits }, + { E11Mbps, WHA::KRate11Mbits }, + { E22Mbps, WHA::KRate22Mbits }, + }; + +class TRate2NwsaRatePredicate + { +public: + + explicit TRate2NwsaRatePredicate( const TRate aRate ) + : iKey( aRate ) {}; + + TBool operator() ( const TRate2NwsaRate& aEntry ) const + { + return aEntry.iTrate == iKey; + } + +private: + + // Prohibit copy constructor. + TRate2NwsaRatePredicate ( const TRate2NwsaRatePredicate & ); + // Prohibit assigment operator. + TRate2NwsaRatePredicate& operator= ( const TRate2NwsaRatePredicate & ); + + const TRate iKey; + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::Scan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TRate aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + + WHA::TRate rate( 0 ); + ResolveScanRate( aCtxImpl, aScanRate, rate ); + + // call the "real scan" + return RealScan( aCtxImpl, aMode, aSSID, rate, aChannels, + aMinChannelTime, aMaxChannelTime, aSplitScan ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::StopScan( WlanContextImpl& aCtxImpl ) + { + // as we are here it means that we have received a stop scan request + // even though there is no scan ongoing. This should only happen if the + // mgmt client has been in the process of making a stop scan request and + // hasn't noticed that the scan has already completed. Anyhow in this + // case we just complete the request + OnOidComplete( aCtxImpl, KErrNone ); + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDot11State::SetPowerMode: aPowerMode: %d"), aPowerMode ); + + TBool ret( EFalse ); + + // store desired new dot11 power management mode by WLAN Mgmt Client + aCtxImpl.ClientDot11PwrMgmtMode( aPowerMode ); + + aCtxImpl.DynamicPwrModeMgtDisabled( aDisableDynamicPowerModeManagement ); + if ( aDisableDynamicPowerModeManagement ) + { + aCtxImpl.StopPowerModeManagement(); + } + + aCtxImpl.SetClientLightPsModeConfig( + aWakeupModeInLightPs, + aListenIntervalInLightPs ); + + aCtxImpl.SetClientDeepPsModeConfig( + aWakeupModeInDeepPs, + aListenIntervalInDeepPs ); + + // in case WLAN Mgmt Client wishes to use PS mode, Light PS is the initial + // desired PS mode configuration + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientLightPsModeConfig() ); + + if ( aCtxImpl.CurrentDot11PwrMgmtMode() != + aCtxImpl.ClientDot11PwrMgmtMode() ) + { + // there is a difference in current dot11 power management mode and + // WLAN Mgmt Client's desired dot11 power management mode + + // So, WLAN Mgmt Client's desired dot11 power management mode becomes + // our new desired mode + aCtxImpl.DesiredDot11PwrMgmtMode( aCtxImpl.ClientDot11PwrMgmtMode() ); + + // callee will complete the mgmt command + ret = OnDot11PwrMgmtTransitRequired( aCtxImpl ); + } + else + { + // no dot11 power management mode transition required. + + // See if there is difference in desired vs. current wake-up setting, + // which we only need to worry about if the requested pwr mgmt + // mode is PS + if ( aPowerMode == EPowerModePs && + DifferenceInPsModeWakeupSettings( aCtxImpl ) ) + { + // callee shall complete the request + ret = OnWlanWakeUpIntervalChange( aCtxImpl ); + } + else + { + // no action required regarding the wake-up setting, either + + // one possibility is that the following has happened: WLAN Mgmt + // client has requested us to use PS mode when possible, but we + // have dynamically changed to CAM mode because of data traffic. + // If that is the case and now the WLAN Mgmt client wants us + // to stay in CAM mode, make sure that the dynamic power mode + // management is deactivated + if ( aPowerMode == EPowerModeCam ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDot11State::SetPowerMode: CAM requested when we already are in CAM. Make sure that dynamic pwr mode mgmt is not active") ); + + aCtxImpl.StopPowerModeManagement(); + } + else + { + if ( !aDisableDynamicPowerModeManagement ) + { + // in case the only change is that now dynamic pwr + // mode mgmt is again allowed, make sure it is active + aCtxImpl.StartPowerModeManagement(); + } + } + } + + // complete the mgmt command + OnOidComplete( aCtxImpl ); + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::EnableUserData( + WlanContextImpl& aCtxImpl ) + { + TBool stateChange( EFalse ); + aCtxImpl.iEnableUserData = ETrue; + OnOidComplete( aCtxImpl, KErrNone ); + aCtxImpl.iUmac.UserDataReEnabled(); + + // signal global state transition event + return stateChange; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::DisableUserData( + WlanContextImpl& aCtxImpl ) + { + aCtxImpl.iEnableUserData = EFalse; + OnOidComplete( aCtxImpl, KErrNone ); + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::OnConfigureUmacMib( + WlanContextImpl& aCtxImpl, + TUint16 aRTSThreshold, + TUint32 aMaxTxMSDULifetime ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnConfigureUmacMib") ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnConfigureUmacMib: RTSThreshold: %d"), + aRTSThreshold ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnConfigureUmacMib: maxTxMSDULifetime: %d"), + aMaxTxMSDULifetime ); + + aCtxImpl.iWlanMib.dot11RTSThreshold = aRTSThreshold; + + for ( TUint i = 0; i < WHA::EQueueIdMax; ++i ) + { + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[i] = aMaxTxMSDULifetime; + } + + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetimeDefault = aMaxTxMSDULifetime; + + for ( TUint i = 0; i < WHA::EQueueIdMax; ++i ) + { + aCtxImpl.iWlanMib.iMediumTime[i] = KDot11MediumTimeDefault; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::AddDefaultBroadcastWepKeyComplete( + WlanContextImpl& aCtxImpl ) const + { + OnOidComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ResolveScanRate( + WlanContextImpl& /*aCtxImpl*/, + const TRate aRate, + WHA::TRate& aScanRate ) + { + const TRate2NwsaRatePredicate unary_predicate( aRate ); + + const TRate2NwsaRate* const end + = KTRate2NwsaRateTable + + (sizeof(KTRate2NwsaRateTable) / sizeof(TRate2NwsaRate)); + const TRate2NwsaRate* pos + = find_if( KTRate2NwsaRateTable, end, unary_predicate ); + + if ( pos == end ) + { + // not found; an implementation error + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + + aScanRate = pos->iNwsaRate; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::NetworkCapabilityInformationMet( + WlanContextImpl& aCtxImpl) + { + if ( // do this if channel agility bit is not set + ( !aCtxImpl.GetCapabilityInformation().IsChannelAgilityBitSet() )) + { + // mimic the preamble bit from AP + // as some APs might not let us in if not matched + if ( aCtxImpl.GetCapabilityInformation().IsShortPreambleBitSet() ) + { + (aCtxImpl.GetAssociationRequestFrame()) + .SetCapabilityShortPreamble(); + (aCtxImpl.GetHtAssociationRequestFrame()) + .SetCapabilityShortPreamble(); + (aCtxImpl.GetReassociationRequestFrame()) + .SetCapabilityShortPreamble(); + (aCtxImpl.GetHtReassociationRequestFrame()) + .SetCapabilityShortPreamble(); + + aCtxImpl.UseShortPreamble( ETrue ); + } + else + { + (aCtxImpl.GetAssociationRequestFrame()) + .ClearCapabilityShortPreamble(); + (aCtxImpl.GetHtAssociationRequestFrame()) + .ClearCapabilityShortPreamble(); + (aCtxImpl.GetReassociationRequestFrame()) + .ClearCapabilityShortPreamble(); + (aCtxImpl.GetHtReassociationRequestFrame()) + .ClearCapabilityShortPreamble(); + + aCtxImpl.UseShortPreamble( EFalse ); + } + + // clear both CF fields as we don't support PCF + aCtxImpl.GetAssociationRequestFrame().ClearCFfields(); + aCtxImpl.GetHtAssociationRequestFrame().ClearCFfields(); + aCtxImpl.GetReassociationRequestFrame().ClearCFfields(); + aCtxImpl.GetHtReassociationRequestFrame().ClearCFfields(); + + // clear also all the fields we don't understand + aCtxImpl.GetAssociationRequestFrame().ClearReservedFields(); + aCtxImpl.GetHtAssociationRequestFrame().ClearReservedFields(); + aCtxImpl.GetReassociationRequestFrame().ClearReservedFields(); + aCtxImpl.GetHtReassociationRequestFrame().ClearReservedFields(); + + // we don't do PBCC + aCtxImpl.GetAssociationRequestFrame().ClearCapabilityPbcc(); + aCtxImpl.GetHtAssociationRequestFrame().ClearCapabilityPbcc(); + aCtxImpl.GetReassociationRequestFrame().ClearCapabilityPbcc(); + aCtxImpl.GetHtReassociationRequestFrame().ClearCapabilityPbcc(); + + if ( aCtxImpl.EncryptionStatus() != EEncryptionDisabled ) + { + // privacy desired + aCtxImpl.GetAssociationRequestFrame().SetWepBit(); + aCtxImpl.GetHtAssociationRequestFrame().SetWepBit(); + aCtxImpl.GetReassociationRequestFrame().SetWepBit(); + aCtxImpl.GetHtReassociationRequestFrame().SetWepBit(); + } + else + { + aCtxImpl.GetAssociationRequestFrame().ClearWepBit(); + aCtxImpl.GetHtAssociationRequestFrame().ClearWepBit(); + aCtxImpl.GetReassociationRequestFrame().ClearWepBit(); + aCtxImpl.GetHtReassociationRequestFrame().ClearWepBit(); + } + if ( aCtxImpl.RadioMeasurement() != EFalse ) + { + // Radio measurements desired + OsTracePrint (KInfoLevel, (TUint8 *)("UMAC: Radio measurements enabled")); + aCtxImpl.GetAssociationRequestFrame().SetRMBit(); + aCtxImpl.GetHtAssociationRequestFrame().SetRMBit(); + aCtxImpl.GetReassociationRequestFrame().SetRMBit(); + aCtxImpl.GetHtReassociationRequestFrame().SetRMBit(); + } + else + { + OsTracePrint (KInfoLevel, (TUint8 *)("UMAC: Radio measurements disabled")); + aCtxImpl.GetAssociationRequestFrame().ClearRMBit(); + aCtxImpl.GetHtAssociationRequestFrame().ClearRMBit(); + aCtxImpl.GetReassociationRequestFrame().ClearRMBit(); + aCtxImpl.GetHtReassociationRequestFrame().ClearRMBit(); + } + return ETrue; + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AreSupportedRatesMet( + WlanContextImpl& aCtxImpl, + TBool aCheckAlsoExtendedRates ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::AreSupportedRatesMet") ); + + // make sure these critters are zeroed at the beginning + + aCtxImpl.GetMinBasicRate() = 0; + aCtxImpl.GetMaxBasicRate() = 0; + aCtxImpl.ClearBasicRateSet(); + + // clear our existing supported rates IE + aCtxImpl.GetOurSupportedRatesIE().Clear(); + // ... and our existing extended supported rates IE + aCtxImpl.GetOurExtendedSupportedRatesIE().Clear(); + + TUint32 tx_rates( 0 ); + TUint8 nwRate( 0 ); + + // go through all supported rate elements in the supported rates IE + // ( max 8 ). + // Remenber that basic rates are also always part of supported rates + // when building supported rates bitmask + for ( TUint32 outer_idx = 0 + // loop until element count in the IE is reached + ; ( outer_idx != aCtxImpl.GetApSupportedRatesIE().GetElementLength() ) + // OR maximum length allowed for the IE is reached + // NOTE! The 802.11 standard specifies that the max length of the + // information part of this IE is eight rates (eight bytes). + // However at least some APs seem to put all their supported rates + // into this element. In order to be able to associate with those + // APs we have allocated enough space for all 802.11b/g rates in this + // IE and hence the following constant in the loop end condition + && outer_idx < KMaxNumberOfDot11bAndgRates + ; ++outer_idx ) + { + nwRate = (aCtxImpl.GetApSupportedRatesIE())[outer_idx]; + + if ( !ProcessSingleSupportedRateElement( aCtxImpl, nwRate, tx_rates ) ) + { + // unknown supported rates element encountered + if ( nwRate & KBasicRateMask ) + { + // it is part of BSS Basic Rate Set + if ( aCtxImpl.BssMembershipFeatureSupported( nwRate ) ) + { + // it is a WLAN feature which we support, + // so we can continue. No action required here + } + else + { + // we can't cope with it and shall abort + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: network has unsupported mandatory rate/feature -> abort") ); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: rate: 0x%02x"), + nwRate); + + return EFalse; + } + } + else + { + // unknown element is not part of BSS Basic Rate Set + // we can cope with that + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: init network connect") ); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: network has unsupported supported rate -> continue") ); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: rate: 0x%02x"), + nwRate); + } + } + } // end outer for + + if ( aCheckAlsoExtendedRates ) + { + // go through all supported rate elements in the extended supported + // rates IE ( max 255 ). + // Remember that basic rates are also always part of supported rates + // when building supported rates bitmask + for ( TUint32 outer_idx = 0; + // loop until max element count in the IE is reached + ( outer_idx != aCtxImpl.GetApExtendedSupportedRatesIE().GetElementLength() ) + // OR maximum length allowed for the IE is reached + && outer_idx < KMaxNumberOfExtendedRates; + ++outer_idx ) + { + nwRate = (aCtxImpl.GetApExtendedSupportedRatesIE())[outer_idx]; + + if ( !ProcessSingleSupportedRateElement( + aCtxImpl, + nwRate, + tx_rates ) ) + { + // unknown supported rates element encountered + + if ( nwRate & KBasicRateMask ) + { + // it is part of BSS Basic Rate Set + + if ( aCtxImpl.BssMembershipFeatureSupported( nwRate ) ) + { + // it is a WLAN feature which we support, + // so we can continue. No action required here + } + else + { + // we can't cope with it and shall abort + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: network has unsupported mandatory rate/feature -> abort") ); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: rate: 0x%02x"), + nwRate); + + return EFalse; + } + } + else + { + // unknown element is not part of BSS Basic Rate Set + // we can cope with that + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: init network connect") ); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: network has unsupported supported rate -> continue") ); + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AreSupportedRatesMet: rate: 0x%02x"), + nwRate); + } + } + } // for + } // if + + if ( tx_rates ) + { + // store common rates (between us & the nw) in our connection context + aCtxImpl.RateBitMask( tx_rates ); + + return ETrue; + } + else + { + // we ended up with an empty rate mask, i.e. the intersection + // of network's supported rates and our supported rates is empty. + // We are not able to join the network under these circumstances + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ProcessSingleSupportedRateElement( + WlanContextImpl& aCtxImpl, + const TUint8 aApRate, + TUint32& aRateBitmask ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11State::ProcessSingleSupportedRateElement: processing AP rate: 0x%02x"), aApRate); + + // match 4 elements in our rates lookup table + const TUint num_of_elems = + sizeof(aCtxImpl.iSupportedRatesLookUpTable) + / sizeof(WlanContextImpl::SupportedRateLookUp); + + for ( TUint32 inner_idx = 0; + inner_idx != ( num_of_elems + 1 ); + ++inner_idx ) + { + if ( inner_idx == num_of_elems) + { + // if this block is reached it means that we have encountered + // a supported rates element that is not in our lookup table + OsTracePrint( KWarningLevel | KUmacDetails , (TUint8*) + ("UMAC: unknown AP rate element found: 0x%02x"), aApRate); + + return EFalse; + } + if ( ( aApRate & (~KBasicRateMask) ) == + ( aCtxImpl.iSupportedRatesLookUpTable[inner_idx].iSupportedRate & + ( ~KBasicRateMask ) ) ) + { + // make a rate for the tx rate adaptation object + aRateBitmask |= + (aCtxImpl.iSupportedRatesLookUpTable[inner_idx].iWsaRate); + + // check if this critter is part of a mandatory rate set + if ( aApRate & KBasicRateMask ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: rate is part of Basic Rate Set") ); + + // yes it is + // construct basic rate set mask for Join NWSA command + aCtxImpl.BasicRateSetBitSet( + aCtxImpl.iSupportedRatesLookUpTable[inner_idx].iWsaRate ); + + // store min basic rate + if ( aCtxImpl.GetMinBasicRate() == 0 ) + { + aCtxImpl.GetMinBasicRate() = + (aCtxImpl.iSupportedRatesLookUpTable[inner_idx]).iWsaRate; + } + // and store max basic rate + if ( aCtxImpl.GetMaxBasicRate() < + (aCtxImpl.iSupportedRatesLookUpTable[inner_idx]).iWsaRate ) + { + aCtxImpl.GetMaxBasicRate() + = (aCtxImpl.iSupportedRatesLookUpTable[inner_idx]) + .iWsaRate; + } + } + + // set this rate to our supported rates IE + // which we will send in assoc-request frame. If there's no space any + // more in supported rates IE use the extended supported rates IE + // + if (aCtxImpl.GetOurSupportedRatesIE().GetElementLength() < KMaxNumberOfRates ) + { + aCtxImpl.GetOurSupportedRatesIE().Append( aApRate ); + } + else + { + aCtxImpl.GetOurExtendedSupportedRatesIE().Append( aApRate ); + } + + // break out of for loop, + // we got a match no need to traverse any longer + break; + } + } // end for + + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::SetArpIpAddressTableMib( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ) + { + const TUint32 KMibLength( sizeof( WHA::SarpIpAddressTable ) ); + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: WlanDot11State::SetArpIpAddressTableMib: mibLength: %d"), + KMibLength ); + + // allocate memory for the mib to write + WHA::SarpIpAddressTable* mib + = static_cast + (os_alloc( KMibLength )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::SetArpIpAddressTableMib: memory allocating failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + if ( aEnableFiltering ) + { + mib->iEnable = ETrue; + mib->iIpV4Addr = aIpv4Address; + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: WlanDot11State::SetArpIpAddressTableMib: enable filtering using address: 0x%08x"), + aIpv4Address ); + } + else + { + mib->iEnable = EFalse; + mib->iIpV4Addr = aIpv4Address; // value not relevant in this case + + OsTracePrint( KWlmCmdDetails, (TUint8*) + ("UMAC: WlanDot11State::SetArpIpAddressTableMib: disable filtering") ); + } + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibArpIpAddressTable, + KMibLength, + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( mib ); // release the allocated memory + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::OnDot11PwrMgmtTransitRequired( + WlanContextImpl& aCtxImpl ) + { + // the specified power state will be taken into use later + // So nothing more to do at this point than completing the oid + OnOidComplete( aCtxImpl ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::TQueueId WlanDot11State::QueueId( + const WlanContextImpl& aCtxImpl, + const TUint8* aDot11MacHeader ) const + { + // this initial value is always returned if we have a non-QoS connection + WHA::TQueueId queue_id( WHA::ELegacy ); + + if ( aCtxImpl.QosEnabled() ) + { + // a QOS connection + SQosDataMpduHeader* dot11_hdr + = reinterpret_cast( + const_cast(aDot11MacHeader)); + + // determine frame type + const TUint8 KFrameType( dot11_hdr->iHdr.iHdr.GetFrameControl().iType ); + + if ( KFrameType == E802Dot11FrameTypeQosData ) + { + // this is a QoS data frame so assign it to + // the correct queue according to the priority + + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::QueueId: 802.1d priority: %d"), + dot11_hdr->iHdr.UserPriority() ); + + queue_id = Queue( dot11_hdr->iHdr.UserPriority() ); + } + else + { + // a non data type frame is put to voice queue + queue_id = WHA::EVoice; + } + } + + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::QueueId: use queue: %d"), + queue_id ); + + return queue_id; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::TxDeauthenticate( + WlanContextImpl& aCtxImpl, + T802Dot11ManagementReasonCode aReason, + TBool aWaitIfIntTxBufNotFree ) const + { + OsTracePrint( KUmacProtocolState | KUmacAuth, + (TUint8*)("UMAC: WlanDot11State::TxDeauthenticate") ); + + TBool status ( EFalse ); + + // client doesn't have to take care of the tx buffer header space + // as the method below does that by itself + TUint8* start_of_frame = aCtxImpl.TxBuffer( aWaitIfIntTxBufNotFree ); + + if ( start_of_frame ) + { + TUint32 frameLength ( 0 ); + + // construct deauthenticate frame + // note that we don't have to set SA because we have already set it + // in the initialize phase of the state machine + + if ( aCtxImpl.HtSupportedByNw() ) + { + // set the BSSID + (aCtxImpl.GetHtDeauthenticateFrame()).iHeader.iBSSID = aCtxImpl.GetBssId(); + // set the DA + (aCtxImpl.GetHtDeauthenticateFrame()).iHeader.iDA = aCtxImpl.GetBssId(); + // set the reason code + (aCtxImpl.GetHtDeauthenticateFrame()).iReasonCode.SetReasonCode( + aReason ); + + frameLength = sizeof( SHtDeauthenticateFrame ); + + // copy deauthentication frame to tx-buffer to correct offset + os_memcpy( + start_of_frame, + &(aCtxImpl.GetHtDeauthenticateFrame()), + frameLength ); + } + else + { + // set the BSSID + (aCtxImpl.GetDeauthenticateFrame()).iHeader.iBSSID = aCtxImpl.GetBssId(); + // set the DA + (aCtxImpl.GetDeauthenticateFrame()).iHeader.iDA = aCtxImpl.GetBssId(); + // set the reason code + (aCtxImpl.GetDeauthenticateFrame()).iReasonCode.SetReasonCode( + aReason ); + + frameLength = sizeof( SDeauthenticateFrame ); + + // copy deauthentication frame to tx-buffer to correct offset + os_memcpy( + start_of_frame, + &(aCtxImpl.GetDeauthenticateFrame()), + frameLength ); + } + + const WHA::TQueueId queue_id( QueueId( aCtxImpl, start_of_frame ) ); + + // send deauthentication frame by pushing it to the packet scheduler + status = aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + frameLength, + queue_id, + E802Dot11FrameTypeDeauthentication, + NULL, + EFalse, + EFalse, + ETrue ); + } + else + { + // we didn't get a Tx buffer => frame not sent. EFalse will be returned + // to indicate that + + OsTracePrint( KUmacProtocolState | KUmacAuth, (TUint8*) + ("UMAC: no free internal tx buf => frame not sent") ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::TxDisassociate( + WlanContextImpl& aCtxImpl, + T802Dot11ManagementReasonCode aReason, + TBool aWaitIfIntTxBufNotFree ) const + { + OsTracePrint( KUmacProtocolState | KUmacAssoc, + (TUint8*)("UMAC: WlanDot11State::TxDisassociate") ); + + TBool status ( EFalse ); + + // client doesn't have to take care of the tx buffer header space + // as the method below does that by itself + TUint8* start_of_frame = aCtxImpl.TxBuffer( aWaitIfIntTxBufNotFree ); + + if ( start_of_frame ) + { + TUint32 frameLength ( 0 ); + + // NOTE: We don't set the address fields to frame here like + // in the case of dot11-deauthenticate frame, because in the case of + // roaming we would use that BSS's information where we are roaming + // to - instead of the existing one + + if ( aCtxImpl.HtSupportedByNw() ) + { + (aCtxImpl.GetHtDisassociationFrame()).iReasonCode.SetReasonCode( + aReason ); + + frameLength = sizeof( SHtDisassociateFrame ); + + // copy disassociation frame to tx-buffer to correct offset + os_memcpy( + start_of_frame, + &(aCtxImpl.GetHtDisassociationFrame()), + frameLength ); + } + else + { + (aCtxImpl.GetDisassociationFrame()).iReasonCode.SetReasonCode( + aReason ); + + frameLength = sizeof( SDisassociateFrame ); + + // copy disassociation frame to tx-buffer to correct offset + os_memcpy( + start_of_frame, + &(aCtxImpl.GetDisassociationFrame()), + frameLength ); + } + + const WHA::TQueueId queue_id + = QueueId( aCtxImpl, start_of_frame ); + + // send disassociation frame to the current AP by pushing it to the packet + // scheduler + status = aCtxImpl.PushPacketToPacketScheduler( + start_of_frame, + frameLength, + queue_id, + E802Dot11FrameTypeDisassociation, + NULL, + EFalse, + EFalse, + ETrue ); + } + else + { + // we didn't get a Tx buffer => frame not sent. EFalse will be returned + // to indicate that + + OsTracePrint( KUmacProtocolState | KUmacAuth, (TUint8*) + ("UMAC: no free internal tx buf => frame not sent") ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::SAesPairwiseKey* WlanDot11State::CreateAesPtkCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TUint8* aData, + const TMacAddress& aMacAddr ) + { + // store info of AES PTK insertion + aCtxImpl.PairWiseKeyType( WHA::EAesPairWiseKey ); + + // allocate memory for the key structure + WHA::SAesPairwiseKey* key = static_cast + ( os_alloc( sizeof( WHA::SAesPairwiseKey ) ) ); + + if ( key ) + { + os_memcpy( + key->iMacAddr.iMacAddress, + aMacAddr.iMacAddress, + WHA::TMacAddress::KMacAddressLength ); + os_memcpy( key->iAesKey, aData, WHA::KAesKeyLength ); + + aWhaAddKey.Set( + aCtxImpl, + WHA::EAesPairWiseKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EAesPairWiseKey ) ); + } + else + { + // left intentionally empty + } + + return key; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::STkipPairwiseKey* WlanDot11State::CreateTkipPtkCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TUint8* aData, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ) + { + // store info of TKIP PTK insertion + aCtxImpl.PairWiseKeyType( WHA::ETkipPairWiseKey ); + + // allocate memory for the key structure + // the caller of this method will deallocate the memory + WHA::STkipPairwiseKey* key = static_cast + (os_alloc( sizeof( WHA::STkipPairwiseKey ) )); + + if ( key ) + { + os_memcpy( + key->iMacAddr.iMacAddress, + aMacAddr.iMacAddress, + WHA::TMacAddress::KMacAddressLength ); + os_memcpy( key->iTkipKey, aData, WHA::KTKIPKeyLength ); + os_memcpy( + key->iRxMicKey, + aData + WHA::KTKIPKeyLength, + WHA::KMicLength ); + os_memcpy( + key->iTxMicKey, + aData + WHA::KTKIPKeyLength + WHA::KMicLength, + WHA::KMicLength); + key->iKeyId = static_cast(aKeyIndex); + + aWhaAddKey.Set( aCtxImpl, + WHA::ETkipPairWiseKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::ETkipPairWiseKey ) ); + } + else + { + // left intentionally empty + } + + return key; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::SWepPairwiseKey* WlanDot11State::CreateUnicastWepKeyCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8* aKey ) + { + // store info of WEP PTK insertion + aCtxImpl.PairWiseKeyType( WHA::EWepPairWiseKey ); + + // allocate memory for the key structure + WHA::SWepPairwiseKey* key = static_cast + (os_alloc( WHA::SWepPairwiseKey::KHeaderSize + aKeyLength )); + + if ( key ) + { + os_memcpy( + &(key->iMacAddr), + aMacAddr.iMacAddress, + sizeof(key->iMacAddr) ); + key->iKeyLengthInBytes = static_cast(aKeyLength); + os_memcpy( key->iKey, aKey, key->iKeyLengthInBytes ); + + aWhaAddKey.Set( aCtxImpl, + WHA::EWepPairWiseKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EWepPairWiseKey ) ); + } + else + { + // intentionally left empty + } + + return key; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::SWapiPairwiseKey* WlanDot11State::CreateWapiPtkCtx( + WlanContextImpl& aCtxImpl, + WlanWsaAddKey& aWhaAddKey, + const TUint8* aData, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ) + { + // store info of WAPI pairwise key insertion + aCtxImpl.PairWiseKeyType( WHA::EWapiPairWiseKey ); + + // allocate memory for the key structure + // the caller of this method will deallocate the memory + WHA::SWapiPairwiseKey* key = static_cast + (os_alloc( sizeof( WHA::SWapiPairwiseKey ) )); + + if ( key ) + { + os_memcpy( + key->iMacAddr.iMacAddress, + aMacAddr.iMacAddress, + WHA::TMacAddress::KMacAddressLength ); + + key->iKeyId = static_cast(aKeyIndex); + + os_memcpy( key->iWapiKey, aData, WHA::KWapiKeyLength ); + + os_memcpy( + key->iMicKey, + aData + WHA::KWapiKeyLength, + WHA::KWapiMicKeyLength ); + + aWhaAddKey.Set( aCtxImpl, + WHA::EWapiPairWiseKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EWapiPairWiseKey ) ); + } + else + { + // left intentionally empty + } + + return key; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::TRate WlanDot11State::InitialSpecialFrameTxRate( + const WlanContextImpl& aCtxImpl ) const + { + WHA::TRate rateToUse ( WHA::KRate1Mbits ); + + const TUint32 basicRateSet = aCtxImpl.BasicRateSet(); + + if ( basicRateSet ) + { + // there is at least one supported basic rate (which is the way things + // are supposed to be if the network is correctly configured) + + if ( basicRateSet & WHA::KRate1Mbits ) + { + rateToUse = WHA::KRate1Mbits; + } + else if ( basicRateSet & WHA::KRate6Mbits ) + { + rateToUse = WHA::KRate6Mbits; + } + else if ( basicRateSet & WHA::KRate2Mbits ) + { + rateToUse = WHA::KRate2Mbits; + } + else if ( basicRateSet & WHA::KRate9Mbits ) + { + rateToUse = WHA::KRate9Mbits; + } + else + { + // none of the rates above is a supported basic rate, which is + // rather odd. + // Anyhow, figure out the lowest supported basic rate and use that + + WHA::TRate rateCandidate = WHA::KRate1Mbits; + + do + { + if ( basicRateSet & rateCandidate ) + { + rateToUse = rateCandidate; + // break the loop as we found what we are looking for + break; + } + else + { + rateCandidate <<= 1; + } + + } while ( rateCandidate <= WHA::KRate54Mbits ); + } + } + else + { + // there are no supported basic rates; which is actually a network + // configuration error. + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::InitialSpecialFrameTxRate: Warning: no basic rates configured in nw")); + + // But as we don't absolutely have to find a + // basic rate here, just stay with 1Mbps (set above) + } + + OsTracePrint( KWsaTxDetails, + (TUint8*)("UMAC: WlanDot11State::InitialSpecialFrameTxRate: use rate: 0x%08x"), + rateToUse ); + + return rateToUse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::DoErrorIndication( + WlanContextImpl& aCtxImpl, + WHA::TStatus /*aStatus*/ ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * handle an error indication!") ); + + // this is the one and only global error handler + ChangeState( aCtxImpl, *this, aCtxImpl.iStates.iMacError ); + + // signal with return value that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::DoConsecutiveBeaconsLostIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::DoRegainedBSSIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::DoRadarIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::DoRcpiIndication( + WlanContextImpl& /*aCtxImpl*/, + WHA::TRcpi /*aRcpi*/ ) + { + // not supported in default handler + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11State::DoPsModeErrorIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool /*aMore*/ ) + { + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: Tx attempted when it's not allowed; frame ignored") ); + + aCtxImpl.iUmac.OnTxProtocolStackDataComplete( + KErrNone, + &aDataBuffer ); + + // no state change occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& /*aDataBuffer*/ ) + { + // as we are not connected to network, this frame cannot be sent. + // Just complete the frame send request without error status; as + // the WLAN Mgmt Client doesn't care about the status + OnMgmtPathWriteComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TAny* WlanDot11State::RequestForBuffer( + WlanContextImpl& /*aCtxImpl*/, + TUint16 /*aLength*/ ) + { + // no functionality in default handler + return NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus /*aStatus*/, + const void* /*aFrame*/, + TUint16 /*aLength*/, + WHA::TRate /*aRate*/, + WHA::TRcpi /*aRcpi*/, + WHA::TChannelNumber /*aChannel*/, + TUint8* aBuffer, + TUint32 /*aFlags*/ ) + { + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ) + { + // this command response method is supposed to be called + // when a concrete dot11 state object does not care about + // the command response parameters + + if ( aAct == KCompleteManagementRequest ) + { + // this must be a response to a command that was generated + // by this this dot11 state object default layer + if ( aCommandId != WHA::EReadMIBResponse ) + { + OnOidComplete( aCtxImpl ); + } + else + { + // as this is a MIB read request, we must supply the + // response to the Mgmt Client + if ( aCommandResponseParams.iReadMibResponse.iMib + == WHA::KMibStatisticsTable ) + { + // convert to a 32bit value before forwarding + TInt32 rcpi = reinterpret_cast + + (aCommandResponseParams.iReadMibResponse.iData)->iRcpi; + + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse(): last rcpi: %d"), + rcpi ); + + OnOidComplete( aCtxImpl, + KErrNone, + reinterpret_cast(&rcpi), + sizeof(rcpi) ); + } + else if ( aCommandResponseParams.iReadMibResponse.iMib + == WHA::KMibCountersTable ) + { + const WHA::ScountersTable* countersTable = reinterpret_cast + + (aCommandResponseParams.iReadMibResponse.iData); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: countersTableMib: nbr of FCS errors in received MPDUs: %d"), + countersTable->iFcsError ); + + aCtxImpl.StoreFcsErrorCount( countersTable->iFcsError ); + + // as we are about to report the frame statistics results, + // it's the time to perform also the necessary calculations + + aCtxImpl.CalculateAverageTxMediaDelays(); + aCtxImpl.CalculateAverageTotalTxDelays(); + + const TStatisticsResponse& frameStatistics ( aCtxImpl.FrameStatistics() ); + +#ifndef NDEBUG + // trace frame statistics + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: *** reported frame statistics ***:") ); + + for ( TUint i = 0; i < EQueueIdMax; ++i ) + { + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: * Access Category: %d *"), + i ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: successfully received unicast data frames: %d"), + frameStatistics.acSpecific[i].rxUnicastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: successfully transmitted unicast data frames: %d"), + frameStatistics.acSpecific[i].txUnicastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: successfully received multicast data frames: %d"), + frameStatistics.acSpecific[i].rxMulticastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: successfully transmitted multicast data frames: %d"), + frameStatistics.acSpecific[i].txMulticastDataFrameCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: nbr of data frame transmit retries: %d"), + frameStatistics.acSpecific[i].txRetryCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: nbr of data frame WLAN delivery failures: %d"), + frameStatistics.acSpecific[i].txErrorCount ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: average data frame Tx media delay in microsecs: %d"), + frameStatistics.acSpecific[i].txMediaDelay ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: average data frame total Tx delay in microsecs: %d"), + frameStatistics.acSpecific[i].totalTxDelay ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: data frame total Tx delay bin 0 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin0 ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: data frame total Tx delay bin 1 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin1 ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: data frame total Tx delay bin 2 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin2 ); + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: data frame total Tx delay bin 3 count: %d"), + frameStatistics.acSpecific[i].totalTxDelayBin3 ); + } + + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::OnWhaCommandResponse: all ACs: nbr of FCS errors in received MPDUs: %d"), + frameStatistics.fcsErrorCount ); + +#endif + + OnOidComplete( aCtxImpl, + KErrNone, + reinterpret_cast(&frameStatistics), + sizeof( frameStatistics ) ); + + // the statistics are cleared after reporting them. It is safe + // to do it here as the information has already been copied + aCtxImpl.ResetFrameStatistics(); + } + // -- == WHA::KMibStatisticsTable -- + else + { + // this thing should never happen as we are not reading any + // other MIBs; an implementation error + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + // well exclusion to this is the dot11stationId MIB that + // is read by dot11initphase object, but it overrides this + // method so this code is not executed in that case. + } + } + } + // -- aAct == KCompleteManagementRequest -- + else + { + // this is not a response to a command that was generated by this + // dot11 state object. + // which means that the originator of this command does not care + // about the response parameters. + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::OnWlanWakeUpIntervalChange( + WlanContextImpl& aCtxImpl ) + { + OnOidComplete( aCtxImpl ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WHA::TQueueId WlanDot11State::Queue( TUint8 aPriority ) + { + // Mapping of 802.1d priorities to WMM Access Categories, and hence to + // WHA queue (id)s, as specified in WiFi WMM Specification v1.1 + const WHA::TQueueId K802Dot1dPriority2WhaQueueTable[] = + { WHA::ELegacy, // for priority 0 + WHA::EBackGround, // for priority 1 + WHA::EBackGround, // for priority 2 + WHA::ELegacy, // for priority 3 + WHA::EVideo, // for priority 4 + WHA::EVideo, // for priority 5 + WHA::EVoice, // for priority 6 + WHA::EVoice }; // for priority 7 + + return ( aPriority > 7 ) ? + WHA::ELegacy : + K802Dot1dPriority2WhaQueueTable[aPriority]; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::UapsdEnabledInNetwork( const SRxWmmIeData& aRxWmmIE ) + { + return ( aRxWmmIE.IsUapsdBitSet() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::UapsdEnabledInNetwork( const SWmmParamElemData& aWmmParamElem ) + { + return ( aWmmParamElem.IsUapsdBitSet() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::EnableQos( WlanContextImpl& aCtxImpl, + TBool aUapsdEnabledInNw ) + { + // enable QoS + aCtxImpl.QosEnabled( ETrue ); + + // first clear our WMM IE so that U-APSD flags will be set only when + // they are supposed to be set + aCtxImpl.OurWmmIe().Clear(); + + if ( aUapsdEnabledInNw ) + { + OsTracePrint( + KQos, (TUint8*) + ("UMAC: WlanDot11State::EnableQos(): u-apsd is supported by nw")); + + // make a note that U-APSD is supported/enabled in the nw + aCtxImpl.UapsdEnabled( ETrue ); + + // make a WMM AC both trigger & delivery enabled + // if U-APSD is supported by the nw (this we already know to be true) + // and + // if U-APSD usage has been requested by WLAN mgmt client for the AC + // in question + aCtxImpl.OurWmmIe().SetUapsdFlags( static_cast( + ( aCtxImpl.UapsdRequestedForVoice() ? EAcVoUapsdFlag : 0 ) | + ( aCtxImpl.UapsdRequestedForVideo() ? EAcViUapsdFlag : 0 ) | + ( aCtxImpl.UapsdRequestedForBackground() ? EAcBkUapsdFlag : 0 ) | + ( aCtxImpl.UapsdRequestedForBestEffort() ? EAcBeUapsdFlag : 0 )) ); + + // set max service period length for the ACs as requested by WLAN + // mgmt client + aCtxImpl.OurWmmIe().SetMaxSpLen( aCtxImpl.UapsdMaxSpLen() ); + } + else + { + OsTracePrint( + KQos, (TUint8*) + ("UMAC: WlanDot11State::EnableQos(): u-apsd not supported in nw")); + + aCtxImpl.UapsdEnabled( EFalse ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::DetermineAcUapsdUsage( WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.UapsdEnabled() ) + { + if ( aCtxImpl.UapsdRequestedForVoice() ) + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd used for Voice")); + aCtxImpl.UapsdUsedForVoice( ETrue ); + } + else + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd NOT used for Voice")); + aCtxImpl.UapsdUsedForVoice( EFalse ); + } + + if ( aCtxImpl.UapsdRequestedForVideo() ) + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd used for Video")); + aCtxImpl.UapsdUsedForVideo( ETrue ); + } + else + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd NOT used for Video")); + aCtxImpl.UapsdUsedForVideo( EFalse ); + } + + if ( aCtxImpl.UapsdRequestedForBestEffort() ) + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd used for Best Effort")); + aCtxImpl.UapsdUsedForBestEffort( ETrue ); + } + else + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd NOT used for Best Effort")); + aCtxImpl.UapsdUsedForBestEffort( EFalse ); + } + + if ( aCtxImpl.UapsdRequestedForBackground() ) + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd used for Background")); + aCtxImpl.UapsdUsedForBackground( ETrue ); + } + else + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd NOT used for Background")); + aCtxImpl.UapsdUsedForBackground( EFalse ); + } + } + else + { + OsTracePrint( KQos, (TUint8*) + ("UMAC: WlanDot11State::DetermineAcUapsdUsage: u-apsd NOT used for any AC")); + aCtxImpl.UapsdUsedForVoice( EFalse ); + aCtxImpl.UapsdUsedForVideo( EFalse ); + aCtxImpl.UapsdUsedForBestEffort( EFalse ); + aCtxImpl.UapsdUsedForBackground( EFalse ); + } + + // now when U-APSD usage per AC has been determined, freeze the dynamic + // power mode mgmt traffic override/ignoration settings + aCtxImpl.FreezePwrModeMgmtTrafficOverride(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ResetAcParameters( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TBool aUseAandGvalues ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ResetAcParameters: Reset parameters of AC: %d"), + aAccessCategory ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ResetAcParameters: aUseAandGvalues: %d"), + aUseAandGvalues ); + + switch ( aAccessCategory ) + { + case WHA::ELegacy: + aCtxImpl.CwMinVector()[WHA::ELegacy] = + aUseAandGvalues ? KDot11BeCwMinAandG : KDot11BeCwMinB; + aCtxImpl.CwMaxVector()[WHA::ELegacy] = KDot11BeCwMax; + aCtxImpl.AifsVector()[WHA::ELegacy] = KDot11BeAifsn; + aCtxImpl.TxOplimitVector()[WHA::ELegacy] = KDot11BeTxopLimit; + break; + case WHA::EBackGround: + aCtxImpl.CwMinVector()[WHA::EBackGround] = + aUseAandGvalues ? KDot11BgCwMinAandG : KDot11BgCwMinB; + aCtxImpl.CwMaxVector()[WHA::EBackGround] = KDot11BgCwMax; + aCtxImpl.AifsVector()[WHA::EBackGround] = KDot11BgAifsn; + aCtxImpl.TxOplimitVector()[WHA::EBackGround] = KDot11BgTxopLimit; + break; + case WHA::EVideo: + aCtxImpl.CwMinVector()[WHA::EVideo] = + aUseAandGvalues ? KDot11ViCwMinAandG : KDot11ViCwMinB; + aCtxImpl.CwMaxVector()[WHA::EVideo] = + aUseAandGvalues ? KDot11ViCwMaxAandG : KDot11ViCwMaxB; + aCtxImpl.AifsVector()[WHA::EVideo] = KDot11ViAifsn; + aCtxImpl.TxOplimitVector()[WHA::EVideo] = + aUseAandGvalues ? KDot11ViTxopLimitAandG : KDot11ViTxopLimitB; + break; + case WHA::EVoice: + aCtxImpl.CwMinVector()[WHA::EVoice] = + aUseAandGvalues ? KDot11VoCwMinAandG : KDot11VoCwMinB; + aCtxImpl.CwMaxVector()[WHA::EVoice] = + aUseAandGvalues ? KDot11VoCwMaxAandG : KDot11VoCwMaxB; + aCtxImpl.AifsVector()[WHA::EVoice] = KDot11VoAifsn; + aCtxImpl.TxOplimitVector()[WHA::EVoice] = + aUseAandGvalues ? KDot11VoTxopLimitAandG : KDot11VoTxopLimitB; + break; + default: + { + // catch implementation error + + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: WlanDot11State::ResetAcParameters: unsupported access category: %d"), + aAccessCategory ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ResetAcParameters( + WlanContextImpl& aCtxImpl, + TBool aUseAandGvalues ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ResetAcParameters: Reset parameters of all ACs. aUseAandGvalues: %d"), + aUseAandGvalues ); + + // Set the default values for a QoS connection for every AC + + ResetAcParameters( aCtxImpl, WHA::ELegacy, aUseAandGvalues ); + ResetAcParameters( aCtxImpl, WHA::EBackGround, aUseAandGvalues ); + ResetAcParameters( aCtxImpl, WHA::EVideo, aUseAandGvalues ); + ResetAcParameters( aCtxImpl, WHA::EVoice, aUseAandGvalues ); + + // reset also the WMM Parameter Set Count to initial (not defined) value + aCtxImpl.WmmParameterSetCount( KWmmParamSetNotDefined ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AcParametersValid( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory ) + { + TBool status ( ETrue ); + + if ( aAccessCategory < WHA::EHcca ) + { + if ( // AIFSN validity per the WMM specification + (aCtxImpl.AifsVector())[aAccessCategory] < KDot11AifsnMin || + // CwMin & CwMax sanity check + (aCtxImpl.CwMinVector())[aAccessCategory] >= + (aCtxImpl.CwMaxVector())[aAccessCategory] ) + { + status = EFalse; + } + else + { + // parameters are reasonable. No action needed + } + } + else + { + // catch implementation error + + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: WlanDot11State::AcParametersValid: unsupported aAccessCategory: %d"), + aAccessCategory ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ParseAcParameters( + WlanContextImpl& aCtxImpl, + const SWmmParamElemData& aWmmParamElem ) + { + for( TUint8 i = 0; i < KNumOfWmmACs; i++ ) + { + switch ( aWmmParamElem.iAcParams[i].AccessCategory() ) + { + case EAcBestEffort: + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: parsing best effort AC parameters")); + (aCtxImpl.CwMinVector())[WHA::ELegacy] = + aWmmParamElem.iAcParams[i].CwMin(); + (aCtxImpl.CwMaxVector())[WHA::ELegacy] = + aWmmParamElem.iAcParams[i].CwMax(); + (aCtxImpl.AifsVector())[WHA::ELegacy] = + aWmmParamElem.iAcParams[i].Aifsn(); + (aCtxImpl.TxOplimitVector())[WHA::ELegacy] = + aWmmParamElem.iAcParams[i].TxOpLimit(); + (aCtxImpl.AcmVector())[WHA::ELegacy] = + ( aWmmParamElem.iAcParams[i].AdmissionControlMandatory() )? + ETrue : EFalse; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aCntrl mandatory: %d"), + aWmmParamElem.iAcParams[i].AdmissionControlMandatory()); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmin: %d"), (aCtxImpl.CwMinVector())[WHA::ELegacy]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmax: %d"), (aCtxImpl.CwMaxVector())[WHA::ELegacy]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aifsn: %d"), (aCtxImpl.AifsVector())[WHA::ELegacy]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: txOpLimit: %d"), (aCtxImpl.TxOplimitVector())[WHA::ELegacy]); + + if ( !AcParametersValid( aCtxImpl, WHA::ELegacy ) ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: BE parameters not reasonble. Resetting to defaults") ); + ResetAcParameters( + aCtxImpl, + WHA::ELegacy, + aCtxImpl.ErpIePresent() ); + } + break; + case EAcBackground: + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: parsing background AC parameters")); + (aCtxImpl.CwMinVector())[WHA::EBackGround] = + aWmmParamElem.iAcParams[i].CwMin(); + (aCtxImpl.CwMaxVector())[WHA::EBackGround] = + aWmmParamElem.iAcParams[i].CwMax(); + (aCtxImpl.AifsVector())[WHA::EBackGround] = + aWmmParamElem.iAcParams[i].Aifsn(); + (aCtxImpl.TxOplimitVector())[WHA::EBackGround] = + aWmmParamElem.iAcParams[i].TxOpLimit(); + (aCtxImpl.AcmVector())[WHA::EBackGround] = + ( aWmmParamElem.iAcParams[i].AdmissionControlMandatory() )? + ETrue : EFalse; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aCntrl mandatory: %d"), + aWmmParamElem.iAcParams[i].AdmissionControlMandatory()); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmin: %d"), (aCtxImpl.CwMinVector())[WHA::EBackGround]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmax: %d"), (aCtxImpl.CwMaxVector())[WHA::EBackGround]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aifsn: %d"), (aCtxImpl.AifsVector())[WHA::EBackGround]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: txOpLimit: %d"), (aCtxImpl.TxOplimitVector())[WHA::EBackGround]); + + if ( !AcParametersValid( aCtxImpl, WHA::EBackGround ) ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: BG parameters not reasonble. Resetting to defaults") ); + ResetAcParameters( + aCtxImpl, + WHA::EBackGround, + aCtxImpl.ErpIePresent() ); + } + break; + case EAcVideo: + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: parsing video AC parameters")); + (aCtxImpl.CwMinVector())[WHA::EVideo] = + aWmmParamElem.iAcParams[i].CwMin(); + (aCtxImpl.CwMaxVector())[WHA::EVideo] = + aWmmParamElem.iAcParams[i].CwMax(); + (aCtxImpl.AifsVector())[WHA::EVideo] = + aWmmParamElem.iAcParams[i].Aifsn(); + (aCtxImpl.TxOplimitVector())[WHA::EVideo] = + aWmmParamElem.iAcParams[i].TxOpLimit(); + (aCtxImpl.AcmVector())[WHA::EVideo] = + ( aWmmParamElem.iAcParams[i].AdmissionControlMandatory() )? + ETrue : EFalse; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aCntrl mandatory: %d"), + aWmmParamElem.iAcParams[i].AdmissionControlMandatory()); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmin: %d"), (aCtxImpl.CwMinVector())[WHA::EVideo]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmax: %d"), (aCtxImpl.CwMaxVector())[WHA::EVideo]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aifsn: %d"), (aCtxImpl.AifsVector())[WHA::EVideo]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: txOpLimit: %d"), (aCtxImpl.TxOplimitVector())[WHA::EVideo]); + + if ( !AcParametersValid( aCtxImpl, WHA::EVideo ) ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: VI parameters not reasonble. Resetting to defaults") ); + ResetAcParameters( + aCtxImpl, + WHA::EVideo, + aCtxImpl.ErpIePresent() ); + } + break; + case EAcVoice: + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: parsing voice AC parameters")); + (aCtxImpl.CwMinVector())[WHA::EVoice] = + aWmmParamElem.iAcParams[i].CwMin(); + (aCtxImpl.CwMaxVector())[WHA::EVoice] = + aWmmParamElem.iAcParams[i].CwMax(); + (aCtxImpl.AifsVector())[WHA::EVoice] = + aWmmParamElem.iAcParams[i].Aifsn(); + (aCtxImpl.TxOplimitVector())[WHA::EVoice] = + aWmmParamElem.iAcParams[i].TxOpLimit(); + (aCtxImpl.AcmVector())[WHA::EVoice] = + ( aWmmParamElem.iAcParams[i].AdmissionControlMandatory() )? + ETrue : EFalse; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aCntrl mandatory: %d"), + aWmmParamElem.iAcParams[i].AdmissionControlMandatory()); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmin: %d"), (aCtxImpl.CwMinVector())[WHA::EVoice]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: cwmax: %d"), (aCtxImpl.CwMaxVector())[WHA::EVoice]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: aifsn: %d"), (aCtxImpl.AifsVector())[WHA::EVoice]); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: txOpLimit: %d"), (aCtxImpl.TxOplimitVector())[WHA::EVoice]); + + if ( !AcParametersValid( aCtxImpl, WHA::EVoice ) ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: VO parameters not reasonble. Resetting to defaults") ); + ResetAcParameters( + aCtxImpl, + WHA::EVoice, + aCtxImpl.ErpIePresent() ); + } + break; + default: + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WARNING: Unknown AC: %d => parameters ignored"), + aWmmParamElem.iAcParams[i].AccessCategory() ); + } + } + + // store the current Parameter Set Count. + aCtxImpl.WmmParameterSetCount( aWmmParamElem.ParameterSetCount() ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ParseAcParameters: param set cnt: %d"), + aCtxImpl.WmmParameterSetCount() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddTkIPKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 /*aLength*/, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ) + { + TBool ret( EFalse ); + WlanWsaAddKey& wsa_cmd( aCtxImpl.WsaAddKey() ); + WHA::STkipPairwiseKey* key( CreateTkipPtkCtx( + aCtxImpl, + wsa_cmd, + aData, + aKeyIndex, + aMacAddr ) + ); + + if ( key ) + { + ret = ETrue; + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // allways remember to release the memory + } + else + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddTkIPKey(): memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::StoreTxRatePolicyInfo( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::StoreTxRatePolicyInfo: store provided Tx rate policy configuration data for later use")); + + TTxRatePolicy& ratePolicy = aCtxImpl.RatePolicy(); + os_memcpy( &ratePolicy, &aRatePolicy, sizeof( TTxRatePolicy ) ); + + TQueue2RateClass& queue2RateClass = aCtxImpl.Queue2RateClass(); + os_memcpy( &queue2RateClass, &aQueue2RateClass, sizeof( TQueue2RateClass ) ); + + TInitialMaxTxRate4RateClass& initialMaxTxRate4RateClass = + aCtxImpl.InitialMaxTxRate4RateClass(); + os_memcpy( + &initialMaxTxRate4RateClass, + &aInitialMaxTxRate4RateClass, + sizeof( TInitialMaxTxRate4RateClass ) ); + + TTxAutoRatePolicy& autoRatePolicy = aCtxImpl.AutoRatePolicy(); + os_memcpy( &autoRatePolicy, &aAutoRatePolicy, sizeof( TTxAutoRatePolicy ) ); + + THtMcsPolicy& htMcsPolicy = aCtxImpl.HtMcsPolicy(); + os_memcpy( &htMcsPolicy, &aHtMcsPolicy, sizeof( THtMcsPolicy ) ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + TBool aCompleteMgmtRequest ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::ConfigureTxRatePolicies: rate bitmask (intersection of AP and our supported rates): 0x%08x"), + aCtxImpl.RateBitMask() ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::ConfigureTxRatePolicies: aCompleteMgmtRequest: %d"), + aCompleteMgmtRequest ); + + TBool status ( ETrue ); + // retrieve reference to the stored rate policy + TTxRatePolicy& ratePolicy ( aCtxImpl.RatePolicy() ); + // retrieve reference to the stored Tx queue 2 Rate Class mapping + TQueue2RateClass& queue2RateClass ( aCtxImpl.Queue2RateClass() ); + // retrieve reference to the stored initial max Tx rate per rate class - + // information + TInitialMaxTxRate4RateClass& initialMaxTxRate4RateClass( + aCtxImpl.InitialMaxTxRate4RateClass() ); + // retrieve reference to the stored auto rate policy + TTxAutoRatePolicy& autoRatePolicy ( aCtxImpl.AutoRatePolicy() ); + // retrieve reference to the stored HT MCS policy + THtMcsPolicy& htMcsPolicy ( aCtxImpl.HtMcsPolicy() ); + + if ( aCtxImpl.WHASettings().iNumOfTxRateClasses < + ratePolicy.numOfPolicyObjects ) + { + // WHA layer doesn't support as many rate classes as has been + // provided to us. + + ResortToSingleTxRatePolicy( + aCtxImpl, + ratePolicy, + queue2RateClass ); + } + + TWhaRateMasks rateMasks; + os_memset( rateMasks, 0, sizeof( rateMasks ) ); + + FinalizeTxRatePolicy( + aCtxImpl, + ratePolicy, + rateMasks, + initialMaxTxRate4RateClass ); + + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KAutonomousRateAdapt ) + { + //===================================================================== + // lower layer supports autonomous rate adaptation so we will let it + // handle the rate adaptation. + //===================================================================== + + FinalizeTxAutoratePolicy( + aCtxImpl, + ratePolicy, + autoRatePolicy ); + + SpecialTxAutoratePolicy( + aCtxImpl, + ratePolicy, + autoRatePolicy, + htMcsPolicy ); + + ConfigureForTxAutoratePolicy( + aCtxImpl, + ratePolicy, + queue2RateClass, + htMcsPolicy, + aCompleteMgmtRequest ); + } + else + { + //===================================================================== + // WHA layer doesn't support autonomous rate adaptation so we need to + // take care of rate adaption. Perform the relevant configuration + //===================================================================== + + status = ConfigureForTxRatePolicy( + aCtxImpl, + ratePolicy, + rateMasks, + queue2RateClass, + initialMaxTxRate4RateClass, + aCompleteMgmtRequest ); + } // else + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::DifferenceInPsModeWakeupSettings( + const WlanContextImpl& aCtxImpl ) const + { + TBool difference( EFalse ); + + // 1st determine the current PS mode wake-up setting + + const WHA::TWlanWakeUpInterval currentWakeupMode ( + aCtxImpl.iWlanMib.iWlanWakeupInterval ); + const TUint8 currentListenInterval ( + aCtxImpl.iWlanMib.iWlanListenInterval ); + + // and the desired wake-up setting + const TDot11PsModeWakeupSetting KDesiredPsModeConfig ( + aCtxImpl.DesiredPsModeConfig() ); + + if ( currentWakeupMode != + static_cast( + KDesiredPsModeConfig.iWakeupMode) ) + { + // difference in wake-up mode + difference = ETrue; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDot11State::DifferenceInPsModeWakeupSettings: difference in wake-up mode") ); + } + else + { + // wake-up mode is unchanged + + if ( KDesiredPsModeConfig.iWakeupMode + == EWakeUpIntervalEveryNthBeacon || + KDesiredPsModeConfig.iWakeupMode + == EWakeUpIntervalEveryNthDtim ) + { + // for these wake-up modes there can be a + // difference in the listen interval. Check that + if ( currentListenInterval != KDesiredPsModeConfig.iListenInterval ) + { + difference = ETrue; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDot11State::DifferenceInPsModeWakeupSettings: difference in listen interval") ); + } + else + { + // no difference in listen interval either + // (return value is already correct) + } + } + else + { + // for these wake-up modes a possible difference in listen + // interval is not meaningful => no difference (return + // value is already correct) + } + } + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDot11State::DifferenceInPsModeWakeupSettings: difference: %d"), + difference ); + + return difference; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureHtCapabilities( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigureHtCapabilities") ); + + // allocate memory for the mib to write + WHA::ShtCapabilities* mib + = static_cast + (os_alloc( sizeof( WHA::ShtCapabilities ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::ConfigureHtCapabilities: abort") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + // reset MIB before starting to set the values + os_memset( mib, 0, sizeof( WHA::ShtCapabilities ) ); + + //===================== + // Set the MIB contents + //===================== + + mib->iHtSupport = aCtxImpl.HtSupportedByNw(); + + // currently HT is supported only in infrastructure networks + mib->iPeerMac = WHA::KBroadcastMacAddr; + + mib->iRxStbc = aCtxImpl.GetNwHtCapabilitiesIe().iData.StbcRx(); + + mib->iMaxAmpduLength = + aCtxImpl.GetNwHtCapabilitiesIe().iData.MaxAmpduLenExponent(); + + // if a feature is supported by the nw, set it in the capabilities bit + // mask. Otherwise it is left unset + + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.LdpcRx() ) + { + mib->iPeerFeatures |= WHA::KLdpcRx; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.FortyMhzOperation() ) + { + mib->iPeerFeatures |= WHA::K40MhzChannel; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.GreenfieldFormat() ) + { + mib->iPeerFeatures |= WHA::KGreenfieldFormat; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.ShortGiFor20Mhz() ) + { + mib->iPeerFeatures |= WHA::KShortGiFor20Mhz; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.ShortGiFor40Mhz() ) + { + mib->iPeerFeatures |= WHA::KShortGiFor40Mhz; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.StbcTx() ) + { + mib->iPeerFeatures |= WHA::KStbcTx; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.DelayedBlockAck() ) + { + mib->iPeerFeatures |= WHA::KDelayedBlockAck; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.DsssCckIn40Mhz() ) + { + mib->iPeerFeatures |= WHA::KDsssCckIn40Mhz; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.Psmp() ) + { + mib->iPeerFeatures |= WHA::KPsmp; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.LsigTxopProtection() ) + { + mib->iPeerFeatures |= WHA::KLsigTxopProtection; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.Pco() ) + { + mib->iPeerFeatures |= WHA::KPco; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.Htc() ) + { + mib->iPeerFeatures |= WHA::KHtcField; + } + if ( aCtxImpl.GetNwHtCapabilitiesIe().iData.RdResponder() ) + { + mib->iPeerFeatures |= WHA::KReverseDirectionResp; + } + + os_memcpy( + mib->iMcsSet, + aCtxImpl.GetNwHtCapabilitiesIe().iData.iRxMcsBitmask, + sizeof( mib->iMcsSet ) ); + + mib->iAmpduSpacing = + aCtxImpl.GetNwHtCapabilitiesIe().iData.MinMpduStartSpacing(); + + mib->iMcsFeedback = aCtxImpl.GetNwHtCapabilitiesIe().iData.McsFeedback(); + + mib->iTxBeamFormingCapab = + aCtxImpl.GetNwHtCapabilitiesIe().iData.TransmitBeamformingCapabilities(); + + mib->iAntennaSelCapab = + aCtxImpl.GetNwHtCapabilitiesIe().iData.AselCapabilities(); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibHtCapabilities, + sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + os_free( mib ); // release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11State::ResetHtCapabilitiesMib( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ResetHtCapabilitiesMib") ); + + // allocate memory for the mib to write + WHA::ShtCapabilities* mib + = static_cast + (os_alloc( sizeof( WHA::ShtCapabilities ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::ResetHtCapabilitiesMib: abort") ); + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + // reset the MIB to its default value + *mib = WHA::KHtCapabilitiesMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibHtCapabilities, sizeof( *mib ), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + + os_free( mib ); // release the memory + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void WlanDot11State::ResetHtBlockAckConfigureMib( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ResetHtBlockAckConfigureMib") ); + + // allocate memory for the mib to write + WHA::ShtBlockAckConfigure* mib + = static_cast + (os_alloc( sizeof( WHA::ShtBlockAckConfigure ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::ResetHtBlockAckConfigureMib: abort") ); + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + // reset the MIB to its default value + *mib = WHA::KHtBlockAckConfigureMibDefault; + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + wsa_cmd.Set( + aCtxImpl, WHA::KMibHtBlockAckConfigure, sizeof( *mib ), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd // next state + ); + + os_free( mib ); // release the memory + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureHtBssOperation( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigureHtBssOperation") ); + + // allocate memory for the mib to write + WHA::ShtBssOperation* mib + = static_cast + (os_alloc( sizeof( WHA::ShtBssOperation ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::ConfigureHtBssOperation: abort") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + // reset MIB before starting to set the values + os_memset( mib, 0, sizeof( WHA::ShtBssOperation ) ); + + //===================== + // Set the MIB contents + //===================== + + if ( aCtxImpl.GetNwHtOperationIe().iData.NonGreenfieldPresent() ) + { + mib->iInfo |= WHA::ShtBssOperation::KNonGreenfieldPresent; + } + if ( aCtxImpl.GetNwHtOperationIe().iData.PcoActive() ) + { + mib->iInfo |= WHA::ShtBssOperation::KPcoActive; + } + if ( aCtxImpl.GetNwHtOperationIe().iData.RifsMode() ) + { + mib->iInfo |= WHA::ShtBssOperation::KRifsPermitted; + } + if ( aCtxImpl.GetNwHtOperationIe().iData.DualCtsProtection() ) + { + mib->iInfo |= WHA::ShtBssOperation::KDualCtsProtReq; + } + if ( aCtxImpl.GetNwHtOperationIe().iData.DualBeacon() ) + { + mib->iInfo |= WHA::ShtBssOperation::KSecondaryBeaconTx; + } + if ( aCtxImpl.GetNwHtOperationIe().iData.LsigTxopProtection() ) + { + mib->iInfo |= WHA::ShtBssOperation::KLsigTxopProtection; + } + + os_memcpy( + mib->iMcsSet, + aCtxImpl.GetNwHtOperationIe().iData.iBasicMcsSet, + sizeof( mib->iMcsSet ) ); + + mib->iOpMode = + aCtxImpl.GetNwHtOperationIe().iData.HtProtection(); + + mib->iSecChOffset = + aCtxImpl.GetNwHtOperationIe().iData.SecondaryChOffset(); + + mib->iApChWidth = + aCtxImpl.GetNwHtOperationIe().iData.ChWidth(); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibHtBssOperation, + sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + os_free( mib ); // release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::HtcFieldPresent( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + TUint32 aFlags ) + { + TBool status ( EFalse ); + + if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation ) + { + // we can interpret the frame to have this header even if it would + // be a 802.11 mgmt frame as the header content that is relevant in + // this method is the same + const SDataFrameHeader* frameHdr + = reinterpret_cast(aFrame); + + if ( aFlags & WHA::KHtPacket && frameHdr->IsOrderBitSet() ) + { + status = ETrue; + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11State::HtcFieldPresent: yes") ); + } + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::OutgoingMulticastDataFrame( + const SDataFrameHeader* aDataFrameHdr ) + { + if ( aDataFrameHdr->IsToDsBitSet() ) + { + // frame to infrastructure nw. Address 3 == DA + + return IsGroupBitSet( aDataFrameHdr->iAddress3 ); + } + else + { + // frame to IBSS. Address 1 == DA + + return IsGroupBitSet( aDataFrameHdr->iAddress1 ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::UpdateTxDataFrameStatistics( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + WHA::TStatus aStatus, + TBool aMulticastData, + TUint aAckFailures, + TUint32 aMediaDelay, + TUint aTotalTxDelay ) + { + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: aAccessCategory: %d"), + aAccessCategory ); + + if ( aStatus == WHA::KSuccess ) + { + if ( aMulticastData ) + { + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: inc tx mcast cnt") ); + + aCtxImpl.IncrementTxMulticastDataFrameCount( aAccessCategory ); + } + else + { + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: inc tx unicast cnt") ); + + aCtxImpl.IncrementTxUnicastDataFrameCount( aAccessCategory ); + } + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: ack failures: %d"), + aAckFailures ); + + aCtxImpl.IncrementTxRetryCount( aAccessCategory, aAckFailures ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: aMediaDelay: %d"), + aMediaDelay ); + + aCtxImpl.IncrementTxMediaDelay( aAccessCategory, aMediaDelay ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: aTotalTxDelay: %d"), + aTotalTxDelay ); + + aCtxImpl.IncrementTotalTxDelay( aAccessCategory, aTotalTxDelay ); + + aCtxImpl.UpdateTotalTxDelayHistogram( aAccessCategory, aTotalTxDelay ); + } + else + { + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanDot11State::UpdateTxDataFrameStatistics: inc tx error cnt") ); + aCtxImpl.IncrementTxErrorCount( aAccessCategory ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::XferDot11FrameToMgmtClient( + WlanContextImpl& aCtxImpl, + const void* aFrame, + TUint32 aLength, + const WHA::TRcpi aRcpi, + TUint8* aBuffer ) const + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanDot11State::XferDot11FrameToMgmtClient: aRcpi: %d"), + aRcpi); + + TBool status ( ETrue ); + + TDataBuffer* metaHdr ( aCtxImpl.GetRxFrameMetaHeader() ); + + if ( metaHdr ) + { + // set frame length + metaHdr->KeSetLength( aLength ); + + // set frame type + metaHdr->FrameType( TDataBuffer::KDot11Frame ); + + // set RCPI for every frame transferred to the mgmt client + metaHdr->KeSetRcpi( aRcpi ); + + // set the offset to the beginning of the Rx buffer from the beginning + // of the meta header. Note that this may be also negative + metaHdr->KeSetBufferOffset( + aBuffer + - reinterpret_cast(metaHdr) ); + + // set the offset to the beginning of the actual frame within the + // Rx buffer + metaHdr->KeSetOffsetToFrameBeginning( + reinterpret_cast(aFrame) // frame beginning + - aBuffer ); // buffer beginning + + // complete + const TDataBuffer* KMetaHdr ( metaHdr ); + aCtxImpl.iUmac.MgmtDataReceiveComplete( KMetaHdr, 1 ); + } + else + { + // no memory available for the meta header. In this case we have no + // other choice than to discard the received frame. + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + // inform the caller about the situation + status = EFalse; + OsTracePrint( KWarningLevel | KRxFrame, (TUint8*) + ("UMAC: WlanDot11State::XferDot11FrameToMgmtClient: WARNING: no memory for meta hdr => abort rx") ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddMulticastTKIPKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 /*aLength*/, + const TUint8* aData ) + { + // store info of TKIP GTK insertion + aCtxImpl.GroupKeyType( WHA::ETkipGroupKey ); + + // allocate memory for the key structure + WHA::STkipGroupKey* key = static_cast + (os_alloc( sizeof(WHA::STkipGroupKey) )); + + if ( !key ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::AddMulticastTKIPKey: memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + os_memcpy( key->iTkipKey, aData, WHA::KTKIPKeyLength ); + os_memcpy( key->iRxMicKey, aData + WHA::KTKIPKeyLength, KMicLength ); + key->iKeyId = static_cast(aKeyIndex); + // for now we fill this field with zeroes + os_memset( key->iRxSequenceCounter, 0, WHA::KRxSequenceCounterLength ); + + WlanWsaAddKey& wsa_cmd = aCtxImpl.WsaAddKey(); + + wsa_cmd.Set( aCtxImpl, + WHA::ETkipGroupKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::ETkipGroupKey ) ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // allways remember to release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddAesKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 /*aLength*/, + const TMacAddress& aMacAddr ) + { + TBool ret( EFalse ); + WlanWsaAddKey& wsa_cmd( aCtxImpl.WsaAddKey() ); + WHA::SAesPairwiseKey* key( CreateAesPtkCtx( + aCtxImpl, + wsa_cmd, + aData, + aMacAddr ) + ); + + if ( key ) + { + ret = ETrue; + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // allways remember to release the memory + } + else + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddAesKey(): memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddMulticastAesKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 /*aLength*/, + const TUint8* aData ) + { + // store info of AES GTK insertion + aCtxImpl.GroupKeyType( WHA::EAesGroupKey ); + + // allocate memory for the key structure + WHA::SAesGroupKey* key = static_cast + ( os_alloc( sizeof( WHA::SAesGroupKey ) ) ); + + if ( !key ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddMulticastAesKey(): memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + os_memcpy( key->iAesKey, aData, WHA::KAesKeyLength ); + key->iKeyId = static_cast(aKeyIndex); + // for now we fill this field with zeroes + os_memset( key->iRxSequenceCounter, 0, WHA::KRxSequenceCounterLength ); + + WlanWsaAddKey& wsa_cmd = aCtxImpl.WsaAddKey(); + + wsa_cmd.Set( aCtxImpl, + WHA::EAesGroupKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EAesGroupKey ) ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // allways remember to release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddUnicastWepKey( + WlanContextImpl& aCtxImpl, + const TMacAddress& aMacAddr, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength]) + { + // store info of WEP PTK insertion + aCtxImpl.PairWiseKeyType( WHA::EWepPairWiseKey ); + + // allocate memory for the key structure + WHA::SWepPairwiseKey* key = static_cast + (os_alloc( WHA::SWepPairwiseKey::KHeaderSize + aKeyLength )); + + if ( !key ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddUnicastWepKey(): memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + os_memcpy( + &(key->iMacAddr), + aMacAddr.iMacAddress, + sizeof(key->iMacAddr) ); + key->iKeyLengthInBytes = static_cast(aKeyLength); + os_memcpy( key->iKey, aKey, key->iKeyLengthInBytes ); + + WlanWsaAddKey& wsa_cmd = aCtxImpl.WsaAddKey(); + wsa_cmd.Set( aCtxImpl, + WHA::EWepPairWiseKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EWepPairWiseKey ) ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // allways remember to release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::OnAddBroadcastWepKey( + WlanContextImpl& aCtxImpl, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TBool aUseAsPairwiseKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength], + const TMacAddress& aMac ) + { + WlanAddBroadcastWepKey& complex_wha_cmd( + aCtxImpl.AddBroadcastWepKey() ); + + complex_wha_cmd.Set( aMac, aKeyIndex, aUseAsDefaulKey, + aUseAsPairwiseKey, aKeyLength, aKey ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + complex_wha_cmd // next state + ); + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddMulticastWapiKey( + WlanContextImpl& aCtxImpl, + T802Dot11WepKeyId aKeyIndex, + TUint32 /*aLength*/, + const TUint8* aData ) + { + if ( !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) ) + { + // WAPI not supported by wlanpdd => abort key setting + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddMulticastWapiKey: WAPI not supported by wlanpdd -> abort") ); + + OnOidComplete( aCtxImpl, KErrNotSupported ); + return EFalse; + } + + // store info of WAPI group key insertion + aCtxImpl.GroupKeyType( WHA::EWapiGroupKey ); + + // allocate memory for the key structure + WHA::SWapiGroupKey* key = static_cast + (os_alloc( sizeof(WHA::SWapiGroupKey) )); + + if ( !key ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::AddMulticastWapiKey: memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + os_memcpy( key->iWapiKey, aData, WHA::KWapiKeyLength ); + + os_memcpy( + key->iMicKey, + aData + WHA::KWapiKeyLength, + WHA::KWapiMicKeyLength ); + + key->iKeyId = static_cast(aKeyIndex); + + WlanWsaAddKey& wsa_cmd = aCtxImpl.WsaAddKey(); + + wsa_cmd.Set( aCtxImpl, + WHA::EWapiGroupKey, + key, + WlanWsaKeyIndexMapper::Extract( WHA::EWapiGroupKey ) ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // release the memory + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::AddUnicastWapiKey( + WlanContextImpl& aCtxImpl, + const TUint8* aData, + TUint32 /*aLength*/, + T802Dot11WepKeyId aKeyIndex, + const TMacAddress& aMacAddr ) + { + TBool ret( EFalse ); + + if ( !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) ) + { + // WAPI not supported by wlanpdd => abort key setting + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddUnicastWapiKey: WAPI not supported by wlanpdd -> abort") ); + + OnOidComplete( aCtxImpl, KErrNotSupported ); + return ret; + } + + WlanWsaAddKey& wsa_cmd( aCtxImpl.WsaAddKey() ); + + WHA::SWapiPairwiseKey* key( CreateWapiPtkCtx( + aCtxImpl, + wsa_cmd, + aData, + aKeyIndex, + aMacAddr ) + ); + + if ( key ) + { + ret = ETrue; + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( key ); // release the memory + } + else + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::AddUnicastWapiKey: memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::InitNetworkConnect( + WlanContextImpl& aCtxImpl, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody ) const + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect") ); + + const SScanResponseFixedFields* scanResponseFixedFields = + reinterpret_cast( + aScanResponseFrameBody ); + + // store capability info from scan response frame body to our context + aCtxImpl.GetCapabilityInformation() + = scanResponseFixedFields->iCapability.CapabilityInformationField(); + + // and set it also as the initial value to our association request frame + // templates + aCtxImpl.GetAssociationRequestFrame().iFixedFields.iCapabilityInfo + = aCtxImpl.GetCapabilityInformation(); + aCtxImpl.GetHtAssociationRequestFrame().iFixedFields.iCapabilityInfo + = aCtxImpl.GetCapabilityInformation(); + + // ... and to to our reassociation request frame templates + aCtxImpl.GetReassociationRequestFrame().iFixedFields.iCapabilityInfo + = aCtxImpl.GetCapabilityInformation(); + aCtxImpl.GetHtReassociationRequestFrame().iFixedFields.iCapabilityInfo + = aCtxImpl.GetCapabilityInformation(); + + // use short slot time if supported by the network + aCtxImpl.UseShortSlotTime( + aCtxImpl.GetCapabilityInformation().IsShortSlotTimeBitSet() ); + + //============================================= + // check for WAPI + //============================================= + if ( aCtxImpl.EncryptionStatus() == EEncryptionWAPI && + !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) ) + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") ); + + return EFalse; + } + + //============================================= + // do we meet network capability requirements + //============================================= + + if ( !NetworkCapabilityInformationMet( aCtxImpl ) ) + { + // requirements not met + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") ); + + return EFalse; + } + + // network capabilities are met -> proceed + + + // initialize element locator for locating IEs from the scan response + // frame body + WlanElementLocator elementLocator( + reinterpret_cast( scanResponseFixedFields + 1 ), + aScanResponseFrameBodyLength - + sizeof( SScanResponseFixedFields ) ); + + TUint8 elementDatalength( 0 ); + const TUint8* elementData( NULL ); + + //============================================= + // do we meet mandatory network rates + //============================================= + + // locate supported rates IE + if ( elementLocator.InformationElement( + E802Dot11SupportedRatesIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // ...and store it to our context + aCtxImpl.GetApSupportedRatesIE().SetIeData( + elementData, + elementDatalength ); + } + else + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") ); + + return EFalse; + } + + // locate extended supported rates information element + if ( elementLocator.InformationElement( + E802Dot11ExtendedRatesIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") ); + + // ...and store it to our context + aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength ); + + // check if we meet mandatory rates; in this case check also extended supported rates + if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) ) + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") ); + + return EFalse; + } + } + else + { + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") ); + + // check if we meet mandatory rates; in this case extended supported rates + // don't need to be checked + if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") ); + + return EFalse; + } + } + + // mandatory network rates are met -> proceed + + //============================================= + // determine the channel of the network + //============================================= + + // locate DS parameter set information element + if ( elementLocator.InformationElement( + E802Dot11DsParameterSetIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // ...and store it to our context + aCtxImpl.NetworkChannelNumeber( *elementData ); + } + else + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") ); + + return EFalse; + } + + //============================================= + // determine the beacon interval of the network + //============================================= + + const TUint32 beacon_interval = scanResponseFixedFields->BeaconInterval(); + + if ( beacon_interval ) + { + // ...and store it to our context + aCtxImpl.NetworkBeaconInterval( beacon_interval ); + } + else + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") ); + + return EFalse; + } + + //============================================= + // determine the need to use protection + //============================================= + + // locate ERP information element + if ( elementLocator.InformationElement( + E802Dot11ErpInformationIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // ERP IE present -> set the protection level according to the Use + // Protection bit + aCtxImpl.ProtectionBitSet( *elementData & KUseProtectionMask ); + // make also a note of ERP IE presence, which means that the nw in + // question is a 802.11a/g nw (instead of a 802.11b nw) + aCtxImpl.ErpIePresent( ETrue ); + } + else + { + // ERP IE not present + aCtxImpl.ProtectionBitSet( EFalse ); + } + + if ( aCtxImpl.NetworkOperationMode() == WHA::EBSS ) + { + //============================================= + // + // only for infrastructure mode connections + // + //============================================= + + //============================================= + // determine WMM / QoS information + //============================================= + + // locate WMM information element + if ( elementLocator.InformationElement( + E802Dot11VendorSpecificIE, + KWmmElemOui, + KWmmElemOuiType, + KWmmInfoElemOuiSubType, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // WMM IE present + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: WMM IE present")); + + EnableQos( aCtxImpl, UapsdEnabledInNetwork( + reinterpret_cast( *elementData ) ) ); + + // as there are no WMM parameter values available in the WMM IE + // use the default AC parameter values until we get the values + // in (re)association response + ResetAcParameters( aCtxImpl, aCtxImpl.ErpIePresent() ); + } + else + { + // WMM IE not present. Check if WMM Parameter Element exists instead + if ( elementLocator.InformationElement( + E802Dot11VendorSpecificIE, + KWmmElemOui, + KWmmElemOuiType, + KWmmParamElemOuiSubtype, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // WMM Parameter Element present + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: WMM param elem present")); + + EnableQos( aCtxImpl, UapsdEnabledInNetwork( + reinterpret_cast( *elementData ) ) ); + + // as the parameter element is present, use the opportunity to + // parse the AC (QoS) parameters. + // However, reset them 1st to their default values in case + // the nw would provide values for some AC multiple times and + // leave the parameters for some AC unspecified + // + ResetAcParameters( aCtxImpl, aCtxImpl.ErpIePresent() ); + ParseAcParameters( aCtxImpl, + reinterpret_cast( *elementData ) ); + } + else + { + // WMM Parameter Element not present either => no QoS, no U-APSD + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: neither WMM IE nor WMM param elem present")); + + aCtxImpl.QosEnabled( EFalse ); + aCtxImpl.UapsdEnabled( EFalse ); + } + } + + //================================================================= + // perform 802.11n related actions & checks if lower layer supports + // HT operation + //================================================================= + + if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation ) + { + if ( !HandleDot11n( aCtxImpl,elementLocator ) ) + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") ); + + return EFalse; + } + } + else + { + // lower layer doesn't support HT, so we must handle the network + // as a non-HT network + aCtxImpl.HtSupportedByNw( EFalse ); + } + } + else + { + //============================================= + // + // only for IBSS mode connections + // + // ============================================ + + //============================================= + // determine ATIM window + //============================================= + + // locate IBSS Parameter Set element + if ( elementLocator.InformationElement( + E802Dot11IbssParameterSetIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // store it to our context + + // note that elementData points to the IE data and not the + // preceding IE header. That's why we need to back up the pointer + // by SInformationElementHeader length before doing the cast + aCtxImpl.AtimWindow( + ( reinterpret_cast( + elementData - sizeof( SInformationElementHeader ) ) + )->AtimWindow() ); + } + else + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::InitNetworkConnect: atim not present, PS not used")); + + // as IBSS Parameter Set element is not present, power saving + // is not used in the IBSS network we are going to join. So we + // will set the ATIM window to zero (to denote that PS is not used) + aCtxImpl.AtimWindow( 0 ); + } + } + + //============================================= + // determine U-APSD usage for the ACs/Tx queues + //============================================= + DetermineAcUapsdUsage( aCtxImpl ); + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::SetTxPowerLevel( + WlanContextImpl& aCtxImpl, + TUint32 aLevel) + { + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11State::SetTxPowerLevel(): aLevel: %d"), + aLevel ); + + // allocate memory for the mib to write + WHA::Sdot11CurrentTxPowerLevel* mib + = static_cast + (os_alloc( sizeof(WHA::Sdot11CurrentTxPowerLevel) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * SetRcpiTriggerLevel * abort") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + mib->iDot11CurrentTxPowerLevel = aLevel; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibDot11CurrentTxPowerLevel, + sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( mib ); // always remember to release the memory + + // store the new power level also to our soft mib + aCtxImpl.iWlanMib.dot11CurrentTxPowerLevel = aLevel; + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::GetLastRcpi( + WlanContextImpl& aCtxImpl ) + { + TBool statechange ( EFalse ); + WHA::TRcpi whaRcpi( 0 ); + + if ( aCtxImpl.GetLatestMedianRcpiFromPredictor( os_systemTime(), whaRcpi ) ) + { + // we have a median filtered RCPI value available so we can return that + // directly to WLAN Mgmt Client + + // convert to a 32bit value before returning + const TInt32 rcpi ( whaRcpi ); + + OnOidComplete( aCtxImpl, + KErrNone, + reinterpret_cast(&rcpi), + sizeof( rcpi ) ); + } + else + { + // we need to get the RCPI from lower layers + + WlanWsaReadMib& wha_cmd = aCtxImpl.WsaReadMib(); + wha_cmd.Set( aCtxImpl, WHA::KMibStatisticsTable ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // previous state + wha_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + // signal caller that a state transition occurred + statechange = ETrue; + } + + return statechange; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + // complete the transfer + if ( aPacketId == E802Dot11FrameTypeData ) + { + OnTxProtocolStackDataComplete( aCtxImpl, aMetaHeader ); + } + else if ( aPacketId == E802Dot11FrameTypeDataEapol || + aPacketId == E802Dot11FrameTypeManagementAction || + aPacketId == E802Dot11FrameTypeTestFrame ) + { + OnMgmtPathWriteComplete( aCtxImpl ); + + aCtxImpl.iUmac.OnOtherTxDataComplete(); + } + else + { + // this frame Tx request didn't come from above us (i.e. neither + // through the user data nor the management data API) but is + // related to a frame Tx we have done internally. So, we need to + // mark the internal Tx buffer free again + aCtxImpl.MarkInternalTxBufFree(); + + aCtxImpl.iUmac.OnOtherTxDataComplete(); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 /*aPacketId*/, + WHA::TRate aRate, + TUint32 /*aPacketQueueDelay*/, + TUint32 /*aMediaDelay*/, + TUint /*aTotalTxDelay*/, + TUint8 /*aAckFailures*/, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool /*aMulticastData*/ ) + { + aCtxImpl.OnTxCompleted( aRate, + static_cast(aStatus == WHA::KSuccess), + aQueueId, + aRequestedRate ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ) + { + aCtxImpl.SchedulePackets( aMore ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::OnPacketFlushEvent( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + if ( aPacketId == E802Dot11FrameTypeData ) + { + OnTxProtocolStackDataComplete( aCtxImpl, aMetaHeader ); + } + else if ( aPacketId == E802Dot11FrameTypeDataEapol || + aPacketId == E802Dot11FrameTypeManagementAction || + aPacketId == E802Dot11FrameTypeTestFrame ) + { + // complete with an error code if WLAN Mgmt Client frame + // transmit fails + OnMgmtPathWriteComplete( aCtxImpl, KErrGeneral ); + } + else + { + // this frame Tx request didn't come from above us (i.e. neither + // through the user data nor the management data API) but is + // related to a frame Tx we have done internally. So there's + // nothing to complete upwards. But we need to mark the internal + // Tx buffer free again + aCtxImpl.MarkInternalTxBufFree(); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::OnPacketPushPossible( + WlanContextImpl& /*aCtxImpl*/ ) + { + // intentionally left empty + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ) + { + switch ( aIndicationId ) + { + case WHA::EError: + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WHA error indication received!") ); + DoErrorIndication( aCtxImpl, aIndicationParams.iError.iStatus ); + break; + case WHA::EBssLost: + DoConsecutiveBeaconsLostIndication( aCtxImpl ); + break; + case WHA::EBSSRegained: + DoRegainedBSSIndication( aCtxImpl ); + break; + case WHA::ERadar: + DoRadarIndication( aCtxImpl ); + break; + case WHA::ERcpi: + DoRcpiIndication( aCtxImpl, aIndicationParams.iRcpi.iRcpi ); + break; + case WHA::EPsModeError: + DoPsModeErrorIndication( aCtxImpl ); + break; + default: + // implementation error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aIndicationId: %d"), aIndicationId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureTxQueue( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TBool aCompleteManagementRequest ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanDot11State::ConfigureTxQueue: aQueueId: %d"), + aQueueId ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigureTxQueue: aCompleteManagementRequest: %d"), + aCompleteManagementRequest ); + + WHA::TPsScheme psScheme( WHA::ERegularPs ); + + // enable U-APSD for the AC/Queue in question when necessary. + // Otherwise stick to regular PS + switch ( aQueueId ) + { + case WHA::ELegacy: + if ( aCtxImpl.UapsdUsedForBestEffort() ) + { + psScheme = WHA::EUapsd; + } + break; + case WHA::EBackGround: + if ( aCtxImpl.UapsdUsedForBackground() ) + { + psScheme = WHA::EUapsd; + } + break; + case WHA::EVideo: + if ( aCtxImpl.UapsdUsedForVideo() ) + { + psScheme = WHA::EUapsd; + } + break; + case WHA::EVoice: + if ( aCtxImpl.UapsdUsedForVoice() ) + { + psScheme = WHA::EUapsd; + } + break; + default: + // catch programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: ERROR: unsupported queue, aQueueId: %d"), aQueueId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + WlanWhaConfigureQueue& wha_command = aCtxImpl.WhaConfigureQueue(); + + wha_command.Set( + aQueueId, + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[aQueueId], + psScheme, + WHA::ENormal, + aCtxImpl.iWlanMib.iMediumTime[aQueueId] ); + + const TUint32 KNoNeedToCompleteManagementRequest = 0; + + // change global state: entry procedure triggers action + ChangeState( + aCtxImpl, + *this, // prev state + wha_command, // next state + aCompleteManagementRequest ? KCompleteManagementRequest : + KNoNeedToCompleteManagementRequest ); + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureAcParams( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11State::ConfigureAcParams") ); + + WlanWhaConfigureAc& wha_command = aCtxImpl.WhaConfigureAc(); + + wha_command.Set( + aCtxImpl.CwMinVector(), + aCtxImpl.CwMaxVector(), + aCtxImpl.AifsVector(), + aCtxImpl.TxOplimitVector() ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_command // next state + ); + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::SetCtsToSelfMib( + WlanContextImpl& aCtxImpl ) + { + WHA::SctsToSelf* mib + = static_cast + (os_alloc( sizeof( WHA::SctsToSelf ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11State::SetCtsToSelfMib(): memory allocation failed") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + if ( aCtxImpl.ProtectionBitSet() ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11State::SetCtsToSelfMib(): enable CTS to self") ); + + mib->iCtsToSelf = ETrue; + } + else + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11State::SetCtsToSelfMib(): disable CTS to self") ); + + mib->iCtsToSelf = EFalse; + } + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibCtsToSelf, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureBssLost( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount, + TUint8 aFailedTxPacketCount ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigureBssLost") ); + + // store & take the new failed Tx packet count threshold into use + aCtxImpl.iWlanMib.iFailedTxPacketCountThreshold = aFailedTxPacketCount; + // set the beacon lost count mib + return SetBeaconLostCountMib( aCtxImpl, aBeaconLostCount ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::SetTxRateAdaptParams( + WlanContextImpl& aCtxImpl, + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ) + { + aCtxImpl.SetTxRateAdaptationAlgorithmParams( + aMinStepUpCheckpoint, + aMaxStepUpCheckpoint, + aStepUpCheckpointFactor, + aStepDownCheckpoint, + aMinStepUpThreshold, + aMaxStepUpThreshold, + aStepUpThresholdIncrement, + aStepDownThreshold, + aDisableProbeHandling ); + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// --------------------------------------------------------------------------- +// At this point we only store the provided configuration data. It will be +// taken into use when we know the nw we are going to join - i.e. just prior +// actually joining that nw +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureTxRatePolicies( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + const TTxAutoRatePolicy& aAutoRatePolicy, + const THtMcsPolicy& aHtMcsPolicy ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::ConfigureTxRatePolicies")); + + StoreTxRatePolicyInfo( + aCtxImpl, + aRatePolicy, + aQueue2RateClass, + aInitialMaxTxRate4RateClass, + aAutoRatePolicy, + aHtMcsPolicy ); + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::SetPowerModeManagementParameters( + WlanContextImpl& aCtxImpl, + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) + { + aCtxImpl.SetPowerModeManagementParameters( + aToLightPsTimeout, + aToLightPsFrameThreshold, + aToActiveTimeout, + aToActiveFrameThreshold, + aToDeepPsTimeout, + aToDeepPsFrameThreshold, + aUapsdRxFrameLengthThreshold ); + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& aCtxImpl, + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigurePwrModeMgmtTrafficOverride")); + + aCtxImpl.ConfigurePwrModeMgmtTrafficOverride( + aStayInPsDespiteUapsdVoiceTraffic, + aStayInPsDespiteUapsdVideoTraffic, + aStayInPsDespiteUapsdBestEffortTraffic, + aStayInPsDespiteUapsdBackgroundTraffic, + aStayInPsDespiteLegacyVoiceTraffic, + aStayInPsDespiteLegacyVideoTraffic, + aStayInPsDespiteLegacyBestEffortTraffic, + aStayInPsDespiteLegacyBackgroundTraffic ); + + // Note, that in this case the dynamic power mode mgmt traffic + // override/ignoration settings will be frozen later (during connect + // operation, once we know the network capabilites) so that they become + // effective + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::GetFrameStatistics( WlanContextImpl& aCtxImpl ) + { + WlanWsaReadMib& wha_cmd = aCtxImpl.WsaReadMib(); + wha_cmd.Set( aCtxImpl, WHA::KMibCountersTable ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // previous state + wha_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + // signal caller that state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// At this point we only store the values provided by WLAN mgmt client. They +// will be used later when we (re-)associate to an AP. +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureUapsd( + WlanContextImpl& aCtxImpl, + TMaxServicePeriodLength aMaxServicePeriodLength, + TBool aUapsdForVoice, + TBool aUapsdForVideo, + TBool aUapsdForBestEffort, + TBool aUapsdForBackground ) + { + // this cast is safe as the types are effectively the same + aCtxImpl.UapsdMaxSpLen() = + static_cast(aMaxServicePeriodLength); + + aCtxImpl.UapsdRequestedForVoice( aUapsdForVoice ); + aCtxImpl.UapsdRequestedForVideo( aUapsdForVideo ); + aCtxImpl.UapsdRequestedForBestEffort( aUapsdForBestEffort ); + aCtxImpl.UapsdRequestedForBackground( aUapsdForBackground ); + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::GetMacAddress( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::GetMacAddress: mac address:"), + aCtxImpl.iWlanMib.dot11StationId ); + + OnOidComplete( + aCtxImpl, + KErrNone, + &(aCtxImpl.iWlanMib.dot11StationId), + sizeof(aCtxImpl.iWlanMib.dot11StationId) ); + + // signal caller that no state transition occurred + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureArpIpAddressFiltering( + WlanContextImpl& aCtxImpl, + TBool aEnableFiltering, + TIpv4Address aIpv4Address ) + { + return SetArpIpAddressTableMib( + aCtxImpl, + aEnableFiltering, + aIpv4Address ); + } + +// ----------------------------------------------------------------------------- +// At this point we only store the provided configuration. +// It will be passed to the lower layers when connecting to a HT network +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureHtBlockAck( + WlanContextImpl& aCtxImpl, + TUint8 aTxBlockAckUsage, + TUint8 aRxBlockAckUsage ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigureHtBlockAck()") ); + + WHA::ShtBlockAckConfigure& blockAckConf ( + aCtxImpl.GetHtBlockAckConfigure() ); + blockAckConf.iTxBlockAckUsage = aTxBlockAckUsage; + blockAckConf.iRxBlockAckUsage = aRxBlockAckUsage; + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureProprietarySnapHdr( + WlanContextImpl& aCtxImpl, + const TSnapHeader& aSnapHeader ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::ConfigureProprietarySnapHdr") ); + + // store the provided SNAP header for later use + os_memcpy( + reinterpret_cast(&(aCtxImpl.GetProprietarySnapHeader())), + reinterpret_cast(&aSnapHeader), + sizeof( SSnapHeader ) ); + + OnOidComplete( aCtxImpl, KErrNone ); + + // signal caller that no state transition occurred + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::SetBeaconLostCountMib( + WlanContextImpl& aCtxImpl, + TUint32 aBeaconLostCount ) + { + OsTracePrint( + KUmacDetails, (TUint8*) + ("UMAC: WlanDot11State::SetBeaconLostCountMib(): aBeaconLostCount: %d"), + aBeaconLostCount ); + + // allocate memory for the mib to write + WHA::SbeaconLostCount* mib + = static_cast + (os_alloc( sizeof( WHA::SbeaconLostCount ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanDot11State::SetBeaconLostCountMib: abort") ); + return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + + mib->iLostCount = aBeaconLostCount; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibBeaconLostCount, + sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd, // next state + // the ACT + KCompleteManagementRequest + ); + + os_free( mib ); // always remember to release the memory + + // store the new beacon lost count also to our soft mib + aCtxImpl.iWlanMib.iBeaconLostCount = aBeaconLostCount; + + // signal caller that a state transition occurred + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ResortToSingleTxRatePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TQueue2RateClass& aQueue2RateClass ) const + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::ResortToSingleTxRatePolicy: WARNING: PDD " + "supports only %d policy objects ... "), + aCtxImpl.WHASettings().iNumOfTxRateClasses ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: ... and %d objects have been provided to us"), + aRatePolicy.numOfPolicyObjects ); + + // In this case - from the rate classes / autorate policies provided to + // us by WLAN Mgmt client - we will use only the rate class / autorate + // policy specified for legacy Tx Queue / AC, i.e. the 1st one at index 0 + + aRatePolicy.numOfPolicyObjects = 1; + for ( TUint queueId = ELegacy; queueId < EQueueIdMax; ++queueId ) + { + aQueue2RateClass[queueId] = 0; + } + +#ifndef NDEBUG + if ( (aCtxImpl.Queue2RateClass())[ELegacy] != 0 ) + { + OsTracePrint( KErrorLevel | KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::ResortToSingleTxRatePolicy: ERROR: policy " + "for legacy not specified as the 1st in the policy array") ); + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } +#endif + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::FinalizeTxRatePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TWhaRateMasks& aRateMasks, + TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass ) const + { + for ( TUint rateClassInd = 0; + rateClassInd < aRatePolicy.numOfPolicyObjects; + ++rateClassInd ) + { + // build a rate mask as an "intersection" of + // rates in the provided rate class AND + // rates supported by the nw and AND + // rates supported by WHA layer. + // Also keep the nbr of tx attempts in the rate class for a particular + // rate if that rate is supported by both the nw and WHA layer. + // Otherwise set the nbr of tx attemps to zero for that rate + + HandleRates( + aCtxImpl, + aRatePolicy.txRateClass[rateClassInd], + aRateMasks[rateClassInd] ); + + if ( !( aRateMasks[rateClassInd] ) ) + { + // the provided rate class was such that we ended up with an empty + // rate mask. To recover from this situation we will update the + // rate class definition on the fly to contain the rates which both + // the WHA layer and the nw support + RecoverRatePolicy( + aCtxImpl, + aRatePolicy, + rateClassInd, + aRateMasks[rateClassInd] ); + // adjust also the Max Tx Rate for this rate class so that the + // highest possible rate will be used initially + aInitialMaxTxRate4RateClass[rateClassInd] = WHA::KRate54Mbits; + } + } // for + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::HandleRate( + WlanContextImpl& aCtxImpl, + WHA::TRate aRate, + TUint8& aTxAttempts, + WHA::TRate& aRateMask ) const + { + if ( aCtxImpl.RateBitMask() & aRate ) + { + // rate is supported both by us and by the nw. + + if ( aTxAttempts ) + { + // non-zero Tx attempts defined => include the rate in dynamic Tx + // rate adaptation rates + aRateMask |= aRate; + } + } + else + { + // rate is not supported either by us or by the nw. Set zero Tx attempts + aTxAttempts = 0; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::HandleRates( + WlanContextImpl& aCtxImpl, + TTxRateClass& aRateClass, + WHA::TRate& aRateMask ) const + { + HandleRate( aCtxImpl, WHA::KRate54Mbits, aRateClass.txPolicy54, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate48Mbits, aRateClass.txPolicy48, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate36Mbits, aRateClass.txPolicy36, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate33Mbits, aRateClass.txPolicy33, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate24Mbits, aRateClass.txPolicy24, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate22Mbits, aRateClass.txPolicy22, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate18Mbits, aRateClass.txPolicy18, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate12Mbits, aRateClass.txPolicy12, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate11Mbits, aRateClass.txPolicy11, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate9Mbits, aRateClass.txPolicy9, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate6Mbits, aRateClass.txPolicy6, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate5_5Mbits, aRateClass.txPolicy5_5, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate2Mbits, aRateClass.txPolicy2, + aRateMask ); + + HandleRate( aCtxImpl, WHA::KRate1Mbits, aRateClass.txPolicy1, + aRateMask ); + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::HandleRates: resulting rate mask: 0x%08x"), + aRateMask ); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::RecoverRatePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TUint aRateClassInd, + WHA::TRate& aRateMask ) const + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::RecoverRatePolicy: aRateClassInd: %d"), + aRateClassInd ); + + const TUint8 KTxAttempts = 1; + + // start with Tx attempts == 1 for all Tx rates + os_memset( + &aRatePolicy.txRateClass[aRateClassInd], + KTxAttempts, + sizeof( TUint8 ) * KMaxNumberOfDot11bAndgRates ); + + HandleRates( aCtxImpl, aRatePolicy.txRateClass[aRateClassInd], aRateMask ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::FinalizeTxAutoratePolicy( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + TTxAutoRatePolicy& aAutoRatePolicy ) const + { + for ( TUint rateClassInd = 0; + rateClassInd < aRatePolicy.numOfPolicyObjects; + ++rateClassInd ) + { + // build a rate mask as an "intersection" of + // rates in the provided auto rate class AND + // rates supported by the nw and AND + // rates supported by WHA layer. + aAutoRatePolicy[rateClassInd] = + aAutoRatePolicy[rateClassInd] & aCtxImpl.RateBitMask(); + + if ( !( aAutoRatePolicy[rateClassInd] ) ) + { + // the provided rate class was such that we ended up with an + // empty rate mask. To recover from this situation we will + // update the rate class definition on the fly to contain + // the rates which both the WHA layer and the nw support + aAutoRatePolicy[rateClassInd] = aCtxImpl.RateBitMask(); + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::SpecialTxAutoratePolicy( + WlanContextImpl& aCtxImpl, + TTxRatePolicy& aRatePolicy, + TTxAutoRatePolicy& aAutoRatePolicy, + THtMcsPolicy& aHtMcsPolicy ) const + { + if ( aRatePolicy.numOfPolicyObjects >= + aCtxImpl.WHASettings().iNumOfTxRateClasses ) + { + // there's no room in the lower layers for a special policy + // disable special policy use + aCtxImpl.SpecialTxAutoRatePolicy( 0 ); + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::SpecialTxAutoratePolicy: no room") ); + + return; + } + + const TUint KMaxNbrOfItemsToPick(1); + + // start with an empty rate mask + aAutoRatePolicy[aRatePolicy.numOfPolicyObjects] = 0; + + const WHA::TRate commonRates( aCtxImpl.RateBitMask() ); + + // pick the 802.11b/g rate(s) for the special policy + + WHA::TRate rate( WHA::KRate1Mbits ); + TUint cntPicked(0); + do + { + if ( rate & commonRates ) + { + aAutoRatePolicy[aRatePolicy.numOfPolicyObjects] |= rate; + ++cntPicked; + } + + rate <<= 1; + } while ( ( cntPicked < KMaxNbrOfItemsToPick ) && + ( rate <= KRate54Mbits ) ); + + // start with an empty MCS set + for ( TUint mcsBucket = 0; + mcsBucket < WHA::KHtMcsSetLength; + ++mcsBucket ) + { + aHtMcsPolicy[aRatePolicy.numOfPolicyObjects][mcsBucket] = 0; + } + + // pick the 802.11n MCS(s) for the special policy + + const SHtCapabilitiesIE& htCapabilitiesIe( + aCtxImpl.GetNwHtCapabilitiesIe() ); + const TUint KLastMcsBucket = WHA::KHtMcsSetLength - 1; + const TUint8 KMcsCountInLastBucket( 5 ); + TUint8 mcsCount( 8 ); + + cntPicked = 0; + TUint mcsBucket = 0; + do + { + if ( mcsBucket == KLastMcsBucket ) + { + // there are only 5 MCSs in the last "bucket" per 802.11n std. + mcsCount = KMcsCountInLastBucket; + } + + TUint8 mcs(1); + TUint mcsCounter( 0 ); + do + { + if ( mcs & + ( aCtxImpl.WHASettings().iHtCapabilities.iTxMcs[mcsBucket] ) & + ( htCapabilitiesIe.iData.iRxMcsBitmask[mcsBucket] ) ) + { + aHtMcsPolicy[aRatePolicy.numOfPolicyObjects][mcsBucket] |= mcs; + ++cntPicked; + } + + mcs <<= 1; + ++mcsCounter; + } while ( ( cntPicked < KMaxNbrOfItemsToPick ) && + ( mcsCounter < mcsCount ) ); + + ++mcsBucket; + } while ( ( cntPicked < KMaxNbrOfItemsToPick ) && + ( mcsBucket < WHA::KHtMcsSetLength ) ); + + // set the retry counts + // + const TUint8 KSpecialShortRetryLimit = 10; + const TUint8 KSpecialLongRetryLimit = 4; + aRatePolicy.txRateClass[aRatePolicy.numOfPolicyObjects].shortRetryLimit = + KSpecialShortRetryLimit; + aRatePolicy.txRateClass[aRatePolicy.numOfPolicyObjects].longRetryLimit = + KSpecialLongRetryLimit; + + // now we have an additional policy + ++(aRatePolicy.numOfPolicyObjects); + // enable special policy use + aCtxImpl.SpecialTxAutoRatePolicy( aRatePolicy.numOfPolicyObjects ); + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::SpecialTxAutoratePolicy: policy id: %d"), + aRatePolicy.numOfPolicyObjects ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::ConfigureForTxAutoratePolicy( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TQueue2RateClass& aQueue2RateClass, + THtMcsPolicy& aHtMcsPolicy, + TBool aCompleteMgmtRequest ) + { + // store the Tx queue to rate class mapping + for ( TUint queueId = ELegacy; queueId < EQueueIdMax; ++queueId ) + { + aCtxImpl.SetTxRatePolicy( + static_cast(queueId), + // rate class ids start from 1, hence the + 1 + aQueue2RateClass[queueId] + 1 ); + } + + // make sure that our MCS policy contains only MCSs that both the NW + // and the lower layers support + HandleHtMcsPolicy( + aCtxImpl, + aHtMcsPolicy, + aRatePolicy.numOfPolicyObjects ); + + // change to the state which performs the rest of the configuration + + WlanConfigureTxAutoRatePolicy& complexWhaCmd( + aCtxImpl.ConfigureTxAutoRatePolicy() ); + + complexWhaCmd.Set( aCompleteMgmtRequest ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + complexWhaCmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11State::HandleHtMcsPolicy( + WlanContextImpl& aCtxImpl, + THtMcsPolicy& aHtMcsPolicy, + TUint aNbrOfMcsSets ) const + { + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::HandleHtMcsPolicy") ); + + const SHtCapabilitiesIE& htCapabilitiesIe( + aCtxImpl.GetNwHtCapabilitiesIe() ); + + for ( TUint mcsSet = 0; mcsSet < aNbrOfMcsSets; ++mcsSet ) + { + for ( TUint mcsBucket = 0; + mcsBucket < WHA::KHtMcsSetLength; + ++mcsBucket ) + { + aHtMcsPolicy[mcsSet][mcsBucket] = + aCtxImpl.WHASettings().iHtCapabilities.iTxMcs[mcsBucket] & + htCapabilitiesIe.iData.iRxMcsBitmask[mcsBucket] & + aHtMcsPolicy[mcsSet][mcsBucket]; + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11State::ConfigureForTxRatePolicy( + WlanContextImpl& aCtxImpl, + const TTxRatePolicy& aRatePolicy, + const TWhaRateMasks& aRateMasks, + const TQueue2RateClass& aQueue2RateClass, + const TInitialMaxTxRate4RateClass& aInitialMaxTxRate4RateClass, + TBool aCompleteMgmtRequest ) + { + for ( TUint rateClassInd = 0; + rateClassInd < aRatePolicy.numOfPolicyObjects; + ++rateClassInd ) + { + // provide the ratemask for this rate class to rate adaptation. + // Rate class ids start from 1, hence the + 1 + if ( !aCtxImpl.SetTxRateAdaptationRates( + rateClassInd + 1, + aRateMasks[rateClassInd] ) ) + { + // alloc failure; we cannot continue + OsTracePrint( KWarningLevel | KTxRateAdapt, (TUint8*) + ("UMAC: WlanDot11State::ConfigureForTxRatePolicy: WARNING: " + "alloc failure in rate adaptation")); + + return EFalse; // indicate fatal error + } + + // set the initial max Tx rate for this rate class + + aCtxImpl.SetCurrentMaxTxRate( + // rate class ids start from 1, hence the + 1 + rateClassInd + 1, + aInitialMaxTxRate4RateClass[rateClassInd] ); + } + + // inform rate adaptation about the Tx queue to rate class mapping + for ( TUint queueId = ELegacy; queueId < EQueueIdMax; ++queueId ) + { + aCtxImpl.SetTxRatePolicy( + static_cast(queueId), + // rate class ids start from 1, hence the + 1 + aQueue2RateClass[queueId] + 1 ); + } + + // update the Rate Policy MIB + + WlanWsaWriteMib& wsa_cmd = aCtxImpl.WsaWriteMib(); + + const TUint16 mibLength = sizeof( WHA::StxRatePolicy ) + // there is space for one policy object (rate class) in the + // StxRatePolicy struct, so space for any additional objects needs to + // be allocated in addition to that + + sizeof( WHA::StxRateClass ) * + ( aRatePolicy.numOfPolicyObjects - 1 ); + + wsa_cmd.Set( + aCtxImpl, + WHA::KMibTxRatePolicy, + mibLength, + // note that the types WHA::StxRatePolicy and TTxRatePolicy are + // effectively equivalent, so this is ok + &aRatePolicy ); + + const TUint32 KNotNecessary2Complete ( 0 ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wsa_cmd, // next state + aCompleteMgmtRequest ? KCompleteManagementRequest : + KNotNecessary2Complete + ); + + return ETrue; // indicate success & state change + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::HandleHtCapabilities( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) const + { + TBool status ( ETrue ); + TUint8 elementDatalength( 0 ); + const TUint8* elementData( NULL ); + + // try to locate HT capabilities element + if ( aElementLocator.InformationElement( + E802Dot11HtCapabilitiesIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // found, so store it to our context + aCtxImpl.GetNwHtCapabilitiesIe().SetIeData( + elementData, + elementDatalength ); + + // this also means that the target nw supports HT + aCtxImpl.HtSupportedByNw( ETrue ); + + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element present => HT supported by nw") ); + } + else + { + // not found => target nw doesn't support HT + aCtxImpl.HtSupportedByNw( EFalse ); + + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element not found") ); + } + + return status; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::HandleHtOperation( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) const + { + TBool status ( ETrue ); + TUint8 elementDatalength( 0 ); + const TUint8* elementData( NULL ); + + // try to locate HT Operation element + if ( aElementLocator.InformationElement( + E802Dot11HtOperationIE, + elementDatalength, + &elementData ) == WlanElementLocator::EWlanLocateOk ) + { + // found, so store it to our context + aCtxImpl.GetNwHtOperationIe().SetIeData( + elementData, + elementDatalength ); + + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::HandleHtOperation: element present") ); + } + else + { + // not found even though HT capabilities element is present => + // protocol error + status = EFalse; + + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::HandleHtOperation: element not found => protocol error") ); + } + + return status; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11State::HandleDot11n( + WlanContextImpl& aCtxImpl, + WlanElementLocator& aElementLocator ) const + { + TBool status ( ETrue ); + + if ( ( aCtxImpl.PairwiseCipher() == EWlanCipherSuiteTkip ) || + !( aCtxImpl.QosEnabled() ) ) + { + // as the control is here it means that + // - the WLAN vendor implementation + // supports HT AND EITHER + // - TKIP will be used as the pairwise cipher OR + // - the target nw doesn't support WMM + // In these cases we must not use HT functionality, even if the target + // nw supported it. We achieve that by handling the target nw as + // a non-HT nw + aCtxImpl.HtSupportedByNw( EFalse ); + + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanDot11State::HandleDot11n: TKIP as pairwise cipher " + "or WMM not supported => HT disabled") ); + } + else + { + status = HandleHtCapabilities( aCtxImpl, aElementLocator ) ; + + // if HT capabilities element is present and ok + if ( aCtxImpl.HtSupportedByNw() && status ) + { + // check also HT Operation element + status = HandleHtOperation( aCtxImpl, aElementLocator ); + } + } + + return status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11Synchronize.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,833 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UmacDot11Synchronize class +* +*/ + +/* +* %version: 28 % +*/ + +#include "config.h" +#include "UmacDot11Synchronize.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaJoin.h" +#include "umacconfiguretxqueueparams.h" +#include "wha_mibDefaultvalues.h" + +#ifndef NDEBUG +const TInt8 WlanDot11Synchronize::iName[] = "dot11-synchronize"; + +const TUint8 WlanDot11Synchronize::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETDOT11SLOTTIME"}, + {"ESETCTSTOSELF"}, + {"ECONFTXQUEUE"}, + {"ECONFTXQUEUEPARAMS"}, + {"ESETTXRATEPOLICY"}, + {"ESETHTCAPABILITIES"}, + {"ESETHTBSSOPERATION"}, + {"ERESETHTCAPABILITIES"}, + {"EISSUEJOIN"}, + {"ESETHTBLOCKACKCONF"}, + {"ERESETHTBLOCKACKCONF"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11Synchronize::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"EABORT"} + }; +#endif +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11Synchronize::WlanDot11Synchronize() : + iState( EINIT ), iJoinFailed ( EFalse ) + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11Synchronize::~WlanDot11Synchronize() + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11Synchronize::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::Entry( WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // don't want to do event dispatching here as we want + // to run this dot11 state critter in non pre-emptive mode + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::Exit( WlanContextImpl& /*aCtxImpl*/ ) + { + OsTracePrint( + KUmacProtocolState, + (TUint8*)("UMAC: WlanDot11Synchronize::Exit()")); + + // we are departing this dot11state to another dot11state, so + // we simple reset our local FSM for the next time... + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*)("UMAC: WlanDot11Synchronize::Fsm(): event: ")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*)("UMAC: WlanDot11Synchronize::Fsm(): state: ")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + default: + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11Synchronize::Fsm(): event: %d"), + aEvent); + OsAssert( + (TUint8*)("UMAC: WlanDot11Synchronize::Fsm(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for state entry event. +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::OnStateEntryEvent()")); + + switch ( iState ) + { + case EINIT: + if ( InitActions( aCtxImpl ) ) + { + // we meet the requirements of the network so we can continue + + // depending if the WLAN vendor specific solution + // implements dot11slottime mib we will configure it + if ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KDot11SlotTime ) + { + // supported + ChangeInternalState( aCtxImpl, ESETDOT11SLOTTIME ); + } + else + { + // not supported so skip it + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC * dot11-synchronize")); + OsTracePrint( KWarningLevel, (TUint8*) + ("no support for dot11slottime mib skipping")); + + ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); + } + } + else + { + // network requirements not met. Take the same action as + // as in the join failed case + + OsTracePrint( + KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Synchronize::OnStateEntryEvent(): network requirements not met - abort")); + + iJoinFailed = ETrue; + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + break; + case ESETDOT11SLOTTIME: + SetDot11SlotTime( aCtxImpl ); + break; + case ESETCTSTOSELF: + SetCtsToSelf( aCtxImpl ); + break; + case ECONFTXQUEUE: + ConfigureQueue( aCtxImpl ); + break; + case ECONFTXQUEUEPARAMS: + ConfigureTxQueueParams( aCtxImpl ); + break; + case ESETTXRATEPOLICY: + SetTxRatePolicy( aCtxImpl ); + break; + case ESETHTCAPABILITIES: + SetHtCapabilities( aCtxImpl ); + break; + case ESETHTBSSOPERATION: + SetHtBssOperation( aCtxImpl ); + break; + case ERESETHTCAPABILITIES: + ResetHtCapabilities( aCtxImpl ); + break; + case EISSUEJOIN: + IssueJoin( aCtxImpl ); + break; + case ESETHTBLOCKACKCONF: + SetHtBlockAckConfiguration( aCtxImpl ); + break; + case ERESETHTBLOCKACKCONF: + ResetHtBlockAckConfiguration( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // programming error + OsTracePrint( + KErrorLevel, + (TUint8*)("UMAC: WlanDot11Synchronize::OnStateEntryEvent(): state: %d"), + iState); + OsAssert( (TUint8*)("UMAC: WlanDot11Synchronize::OnStateEntryEvent(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::OnTxCompleteEvent()")); + + switch ( iState ) + { + case ESETDOT11SLOTTIME: + // continue state traversal + ChangeInternalState( aCtxImpl, ESETCTSTOSELF ); + break; + case ESETCTSTOSELF: + if ( aCtxImpl.QosEnabled() ) + { + // configure all the Tx queues & their AC parameters + ChangeInternalState( aCtxImpl, ECONFTXQUEUEPARAMS ); + } + else + { + // configure just the legacy Tx queue + ChangeInternalState( aCtxImpl, ECONFTXQUEUE ); + } + break; + case ECONFTXQUEUE: + case ECONFTXQUEUEPARAMS: + ChangeInternalState( aCtxImpl, ESETTXRATEPOLICY ); + break; + case ESETTXRATEPOLICY: + if ( aCtxImpl.HtSupportedByNw() ) + { + ChangeInternalState( aCtxImpl, ESETHTCAPABILITIES ); + } + else + { + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KHtOperation ) + { + ChangeInternalState( aCtxImpl, ERESETHTCAPABILITIES ); + } + else + { + ChangeInternalState( aCtxImpl, EISSUEJOIN ); + } + } + break; + case ESETHTCAPABILITIES: + ChangeInternalState( aCtxImpl, ESETHTBSSOPERATION ); + break; + case ESETHTBSSOPERATION: + ChangeInternalState( aCtxImpl, EISSUEJOIN ); + break; + case ERESETHTCAPABILITIES: + ChangeInternalState( aCtxImpl, EISSUEJOIN ); + break; + case EISSUEJOIN: + if ( aCtxImpl.HtSupportedByNw() ) + { + ChangeInternalState( aCtxImpl, ESETHTBLOCKACKCONF ); + } + else + { + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KHtOperation ) + { + ChangeInternalState( aCtxImpl, ERESETHTBLOCKACKCONF ); + } + else + { + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + } + break; + case ESETHTBLOCKACKCONF: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + case ERESETHTBLOCKACKCONF: + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + break; + default: + // catch internal FSM programming error + OsAssert( + (TUint8*)("UMAC: WlanDot11Synchronize::OnTxCompleteEvent(): panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// as there's really nothing else we can do in this situation, +// simulate macNotResponding error +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-synchronize * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::ContinueDot11StateTraversal()")); + + if ( iJoinFailed ) + { + // set the completion code value to be returned to user mode + // as the dot11idle state does the OID completion in this case + aCtxImpl.iStates.iIdleState.Set( KErrGeneral ); + // ... and proceed to dot11idle state + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + } + else + { + if ( aCtxImpl.AuthenticationAlgorithmNumber() != + K802Dot11AuthModeShared ) + { + // proceed with open authentication + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iOpenAuthPendingState // next state + ); + } + else + { + // proceed with shared authentication + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSharedAuthPending // next state + ); + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::ChangeInternalState(): old state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::ChangeInternalState(): new state:")); + OsTracePrint( KUmacDetails, iStateName[aNewState] ); +#endif + + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11Synchronize::InitActions( WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::InitActions()")); + + // as we are about to join a new AP, reset BSS Loss indicators + aCtxImpl.ResetBssLossIndications(); + + iJoinFailed = EFalse; + // reset counter for this new AP connection + aCtxImpl.ResetFailedTxPacketCount(); + + os_memset( + reinterpret_cast(&(aCtxImpl.GetNwHtCapabilitiesIe().iData)), + 0, + K802Dot11HtCapabilitiesIeDataLen ); + + for ( TUint i = 0; i < WHA::EQueueIdMax; ++i ) + { + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[i] = + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetimeDefault; + aCtxImpl.iWlanMib.iMediumTime[i] = KDot11MediumTimeDefault; + } + + // in case WLAN Mgmt Client has given us the permission to use PS mode, + // Light PS is the initial desired PS mode configuration + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientLightPsModeConfig() ); + + // check do we meet the requirements for the network + // and construct necessary objects for doing the connection + // + return InitNetworkConnect( + aCtxImpl, + aCtxImpl.ScanResponseFrameBodyLength(), + aCtxImpl.ScanResponseFrameBody() ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::SetDot11SlotTime( + WlanContextImpl& aCtxImpl ) + { + WHA::Sdot11SlotTime* mib + = static_cast + (os_alloc( sizeof( WHA::Sdot11SlotTime ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + if ( aCtxImpl.UseShortSlotTime() ) + { + mib->iDot11SlotTime = WHA::KSlotTime9; + } + else + { + mib->iDot11SlotTime = WHA::KSlotTime20; + } + + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanDot11Synchronize::SetDot11SlotTime(): set slottime: %d"), + mib->iDot11SlotTime ); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibDot11SlotTime, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::SetCtsToSelf( + WlanContextImpl& aCtxImpl ) + { + WHA::SctsToSelf* mib + = static_cast + (os_alloc( sizeof( WHA::SctsToSelf ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + if ( aCtxImpl.ProtectionBitSet() ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::SetCtsToSelf(): enable CTS to self") ); + + mib->iCtsToSelf = ETrue; + } + else + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanDot11Synchronize::SetCtsToSelf(): disable CTS to self") ); + + mib->iCtsToSelf = EFalse; + } + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibCtsToSelf, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::ConfigureQueue( + WlanContextImpl& aCtxImpl ) + { + ConfigureTxQueue( aCtxImpl, WHA::ELegacy ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::ConfigureTxQueueParams( + WlanContextImpl& aCtxImpl ) + { + WlanConfigureTxQueueParams& complex_wsa_cmd = + aCtxImpl.ConfigureTxQueueParams(); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + complex_wsa_cmd // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::SetTxRatePolicy( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::SetTxRatePolicy(): rate bitmask: 0x%08x"), + aCtxImpl.RateBitMask() ); + + if ( !ConfigureTxRatePolicies( aCtxImpl ) ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::SetHtCapabilities( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::SetHtCapabilities") ); + + ConfigureHtCapabilities( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::SetHtBssOperation( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::SetHtBssOperation") ); + + ConfigureHtBssOperation( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::ResetHtCapabilities( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::ResetHtCapabilities") ); + + ResetHtCapabilitiesMib( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::ResetHtBlockAckConfiguration( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::ResetHtBlockAckConfiguration") ); + + ResetHtBlockAckConfigureMib( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::IssueJoin( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::IssueJoin")); + + // make WHA types + WHA::SSSID ssid; + ssid.iSSIDLength = (aCtxImpl.GetSsId()).ssidLength; + os_memcpy( ssid.iSSID, (aCtxImpl.GetSsId()).ssid, ssid.iSSIDLength ); + + // determine the preamble to be used + + WHA::TPreamble preamble ( WHA::ELongPreamble ); + if ( aCtxImpl.HtSupportedByNw() ) + { + preamble = (aCtxImpl.GetHtAssociationRequestFrame()) + .iFixedFields.iCapabilityInfo.IsShortPreambleBitSet() ? + WHA::EShortPreamble : + WHA::ELongPreamble; + } + else + { + preamble = (aCtxImpl.GetAssociationRequestFrame()) + .iFixedFields.iCapabilityInfo.IsShortPreambleBitSet() ? + WHA::EShortPreamble : + WHA::ELongPreamble; + } + + // set context + aCtxImpl.WsaJoin().Set( + aCtxImpl, + aCtxImpl.NetworkOperationMode(), + reinterpret_cast(aCtxImpl.GetBssId()), + WHA::KBand2dot4GHzMask, + ssid, + aCtxImpl.NetworkChannelNumeber(), + aCtxImpl.NetworkBeaconInterval(), + aCtxImpl.BasicRateSet(), + 0, // ATIM + preamble, + ( aCtxImpl.WHASettings().iCapability + & WHA::SSettings::KProbe4Join ) ? ETrue : EFalse ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaJoin() // next state + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11Synchronize::SetHtBlockAckConfiguration( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDot11Synchronize::SetHtBlockAckConfiguration") ); + + // allocate memory for the mib to write + WHA::ShtBlockAckConfigure* mib + = static_cast + (os_alloc( sizeof( WHA::ShtBlockAckConfigure ) )); + + if ( !mib ) + { + // alloc failue just send abort event to fsm + // it takes care of the rest + Fsm( aCtxImpl, EABORT ); + return; + } + + // retrieve reference to the stored HT Block Ack configuration + const WHA::ShtBlockAckConfigure& blockAckConf ( + aCtxImpl.GetHtBlockAckConfigure() ); + + mib->iTxBlockAckUsage = blockAckConf.iTxBlockAckUsage; + mib->iRxBlockAckUsage = blockAckConf.iRxBlockAckUsage; + os_memset( mib->iReserved, 0, sizeof( mib->iReserved ) ); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, + WHA::KMibHtBlockAckConfigure, + sizeof( *mib ), + mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd ); // next state + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11Synchronize::OnWhaCommandResponse( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& /*aCommandResponseParams*/, + TUint32 aAct ) + { + if ( aAct ) + { + // should not happen as we a runnng in non-pre-emptive mode + // regarding oid commands + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: aAct: %d"), aAct ); + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + + // this is a response to a command that was generated + // by this dot11 state object layer + + // we are only interested of join command response + // as it is the oly one we trigger from here that + // has a meaningfull return value + if ( aCommandId == WHA::EJoinResponse ) + { + if ( aStatus == WHA::KFailed ) + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11Synchronize::OnWhaCommandResponse(): join failed")); + // make a note of the failure and act + // accordingly when we + // soon again enter this state + iJoinFailed = ETrue; + } + else + { + OsTracePrint( KInfoLevel, + (TUint8*)("UMAC: WlanDot11Synchronize::OnWhaCommandResponse(): join success")); + } + } + else // --- aCommandId == WHA::EJoinResponse --- + { + // no action here + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacMacActionState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacMacActionState.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,696 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanMacActionState class. +* +*/ + +/* +* %version: 43 % +*/ + +#include "config.h" +#include "UmacMacActionState.h" +#include "UmacDot11IbssMode.h" +#include "UmacDot11InfrastructureMode.h" +#include "UmacContextImpl.h" +#include "UmacWsaComplexCommand.h" +#include "UmacWsaCommand.h" + +// ============================ MEMBER FUNCTIONS =============================== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanWsaComplexCommand& aNewState, + TUint32 aAct ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): previous state:") ); + OsTracePrint( KUmacProtocolState, ptr2 ); + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): next state:") ); + OsTracePrint( KUmacProtocolState, ptr ); +#endif + + // set ACT + aNewState.Act( aCtxImpl, aAct ); + + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanDot11State& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, (TUint8*) + ("UMAC * dot11state to dot11state traversal") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanWsaComplexCommand& aPrevState, + WlanWsaCommand& aNewState ) + { + aNewState.History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): previous state:") ); + OsTracePrint( KUmacProtocolState, ptr2 ); + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): next state:") ); + OsTracePrint( KUmacProtocolState, ptr ); +#endif + + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanWsaCommand& aNewState, + TUint32 aAct ) + { + aNewState.History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): previous state:") ); + OsTracePrint( KUmacProtocolState, ptr2 ); + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): next state:") ); + OsTracePrint( KUmacProtocolState, ptr ); +#endif + + // set ACT + aNewState.Act( aCtxImpl, aAct ); + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanMacActionState::ChangeState(): act: %d"), aAct ); + + + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanWsaComplexCommand& aPrevState, + WlanDot11State& aNewState ) + { +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): previous state:") ); + OsTracePrint( KUmacProtocolState, ptr2 ); + OsTracePrint( KUmacProtocolState, (TUint8*)("UMAC: WlanMacActionState::ChangeState(): next state:") ); + OsTracePrint( KUmacProtocolState, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanDot11InfrastructureMode& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, (TUint8*) + ("UMAC * dot11state to dot11-infrastructuremode traversal") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + + // as we are entering dot11infrastructure mode we will + // do the network specific configuration here + OnDot11InfrastructureModeStateSpaceEntry( aCtxImpl ); + + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11InfrastructureMode& aPrevState, + WlanDot11InfrastructureMode& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, (TUint8*) + ("UMAC * dot11-infrastructuremode to dot11-infrastructuremode") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11InfrastructureMode& aPrevState, + WlanDot11State& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, (TUint8*) + ("UMAC * dot11-infrastructuremode to dot11-state traversal") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + + // as we are exiting dot11infrastructuremode state space + // we will do some magic here + OnDot11InfrastructureModeStateSpaceExit( aCtxImpl ); + + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11State& aPrevState, + WlanDot11IbssMode& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, + (TUint8*)("UMAC * dot11-state to dot11-ibssmode traversal") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + + // as we are entering dot11ibssmode mode we will + // do the network specific configuration here + OnDot11IbssModeStateSpaceEntry( aCtxImpl ); + + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11IbssMode& aPrevState, + WlanDot11IbssMode& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, + (TUint8*)("UMAC * dot11-ibssmode to dot11-ibssmode traversal") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ChangeState( + WlanContextImpl& aCtxImpl, + WlanDot11IbssMode& aPrevState, + WlanDot11State& aNewState ) + { + aNewState.Dot11History( aPrevState ); + +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KDot11StateTransit, + (TUint8*)("UMAC * dot11-ibssmode to dot11-state traversal") ); + OsTracePrint( KDot11StateTransit, (TUint8*)("previous state:") ); + OsTracePrint( KDot11StateTransit, ptr2 ); + OsTracePrint( KDot11StateTransit, (TUint8*)("next state:") ); + OsTracePrint( KDot11StateTransit, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + + // as we are exiting dot11ibssmode state space + // we will do some magic here + OnDot11IbssModeStateSpaceExit( aCtxImpl ); + + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnWhaCommandResponse( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCommandId /*aCommandId*/, + WHA::TStatus /*aStatus*/, + const WHA::UCommandResponseParams& /*aCommandResponseParams*/, + TUint32 /*aAct*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanMacActionState::TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ) + { + // only supported in dot11 state. so forward the call + return iDot11HistoryState->TxData( aCtxImpl, aDataBuffer, aMore ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->TxMgmtData( aCtxImpl, aDataBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->Indication( + aCtxImpl, + aIndicationId, + aIndicationParams ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* WlanMacActionState::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + // only supported in dot11 state. so forward + return iDot11HistoryState->RequestForBuffer( + aCtxImpl, + aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->ReceivePacket( + aCtxImpl, + aStatus, + aFrame, + aLength, + aRate, + aRcpi, + aChannel, + aBuffer, + aFlags ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->OnPacketTransferComplete( + aCtxImpl, + aPacketId, + aMetaHeader ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->OnPacketSendComplete( + aCtxImpl, + aStatus, + aPacketId, + aRate, + aPacketQueueDelay, + aMediaDelay, + aTotalTxDelay, + aAckFailures, + aQueueId, + aRequestedRate, + aMulticastData ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->CallPacketSchedule( aCtxImpl, aMore ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + // only supported in dot11 state. so forward + iDot11HistoryState->OnPacketPushPossible( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnDot11InfrastructureModeStateSpaceEntry( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KDot11StateTransit, (TUint8*) + ("UMAC: WlanMacActionState::OnDot11InfrastructureModeStateSpaceEntry()") ); + + // configure NULL data frame BSSID and DA addresses & to DS bit + SNullDataFrame& null_data = aCtxImpl.NullDataFrame(); + null_data.iAddress1 = aCtxImpl.GetBssId(); + null_data.iAddress3 = aCtxImpl.GetBssId(); + null_data.SetToDsBit(); + + // configure QoS NULL data frame BSSID and DA addresses & to DS bit + SHtQosNullDataFrame& qosNullData = aCtxImpl.QosNullDataFrame(); + qosNullData.iQosDataFrameHdr.iHdr.iAddress1 = aCtxImpl.GetBssId(); + qosNullData.iQosDataFrameHdr.iHdr.iAddress3 = aCtxImpl.GetBssId(); + qosNullData.iQosDataFrameHdr.iHdr.SetToDsBit(); + // ... and order bit + if ( aCtxImpl.HtSupportedByNw() ) + { + // HT control field needs to be present => order bit needs to be set + qosNullData.iQosDataFrameHdr.iHdr.SetOrderBit(); + } + else + { + // HT control field won't be present => order bit needs to be cleared + qosNullData.iQosDataFrameHdr.iHdr.ClearOrderBit(); + } + + // set the privacy mode filter + aCtxImpl.SetActivePrivacyModeFilter( + aCtxImpl, aCtxImpl.EncryptionStatus() ); + + // set frame Tx offsets + SetMgmtSideTxOffsets( aCtxImpl ); + SetProtocolStackTxOffset( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnDot11InfrastructureModeStateSpaceExit( + WlanContextImpl& aCtxImpl ) const + { + // we are departing from dot11infrastructuremode state space + + OsTracePrint( KDot11StateTransit, + (TUint8*)("UMAC: WlanMacActionState::OnDot11InfrastructureModeStateSpaceExit()") ); + + // reset current dot11 power management mode state. + aCtxImpl.CurrentDot11PwrMgmtMode( WHA::KPsDisable ); + + // reset the following items for the (potentially following) next roaming + // connection + aCtxImpl.ApTestOpportunitySeekStarted( EFalse ); + aCtxImpl.ApTestOpportunityIndicated( EFalse ); + + // flush packet scheduler from all pending packets + aCtxImpl.FlushPacketScheduler(); + + // make sure that Voice over WLAN Call maintenance is not active + aCtxImpl.StopVoiceOverWlanCallMaintenance(); + + // stop keeping the WLAN connection alive + aCtxImpl.StopKeepAlive(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnDot11IbssModeStateSpaceEntry( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KDot11StateTransit, + (TUint8*)("UMAC * dot11-ibssmode state space entry") ); + + // set the privacy mode filter + aCtxImpl.SetActivePrivacyModeFilter( + aCtxImpl, aCtxImpl.EncryptionStatus() ); + + // set frame Tx offsets + SetMgmtSideTxOffsets( aCtxImpl ); + SetProtocolStackTxOffset( aCtxImpl ); + + // complete the user connect request + OnOidComplete( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::OnDot11IbssModeStateSpaceExit( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KDot11StateTransit, + (TUint8*)("UMAC * dot11-ibssmode state space exit") ); + + // as we are departing dot11ibssmode state space + // flush packet scheduler from all pending packets + aCtxImpl.FlushPacketScheduler(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacActionState::SetMgmtSideTxOffsets( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanMacActionState::SetMgmtSideTxOffsets") ); + + TUint32 ethernetFrameTxOffset ( 0 ); + TUint32 dot11FrameTxOffset ( 0 ); + TUint32 snapFrameTxOffset ( 0 ); + + DetermineTxOffsets( + aCtxImpl, + ethernetFrameTxOffset, + dot11FrameTxOffset, + snapFrameTxOffset ); + + aCtxImpl.iUmac.SetMgmtSideTxOffsets( + ethernetFrameTxOffset, + dot11FrameTxOffset, + snapFrameTxOffset ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacMacState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacMacState.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1253 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanMacState class +* +*/ + +/* +* %version: 76 % +*/ + +#include "config.h" +#include "UmacWsaCommand.h" +#include "UmacDot11State.h" +#include "UmacWsaComplexCommand.h" +#include "UmacContextImpl.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureAcParams( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetCtsToSelfMib( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetRcpiTriggerLevelMib( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aRcpiTrigger*/, + TBool /*aCompleteManagementRequest*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureHtBssOperation( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ChangePowerMgmtMode( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetRcpiTriggerLevel( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aRcpiTrigger*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddBroadcastWepKey( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aKeyIndex*/, + TBool /*aUseAsDefaulKey*/, + TUint32 /*aKeyLength*/, + const TUint8 /*aKey*/[KMaxWEPKeyLength], + const TMacAddress& /*aMac*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddUnicastWepKey( + WlanContextImpl& /*aCtxImpl*/, + const ::TMacAddress& /*aMacAddr*/, + TUint32 /*aKeyLength*/, + const TUint8 /*aKey*/[KMaxWEPKeyLength]) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::DisableUserData( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::EnableUserData( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetPowerMode( + WlanContextImpl& /*aCtxImpl*/, + TPowerMode /*aPowerMode*/, + TBool /*aDisableDynamicPowerModeManagement*/, + TWlanWakeUpInterval /*aWakeupModeInLightPs*/, + TUint8 /*aListenIntervalInLightPs*/, + TWlanWakeUpInterval /*aWakeupModeInDeepPs*/, + TUint8 /*aListenIntervalInDeepPs*/ ) + { + TBool ret( EFalse ); + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnDot11PwrMgmtTransitRequired( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanMacState::Connect( + WlanContextImpl& /*aCtxImpl*/, + const TSSID& /*aSSID*/, + const TMacAddress& /*aBSSID*/, + TUint16 /*aAuthAlgorithmNbr*/, + TEncryptionStatus /*aEncryptionStatus*/, + TBool /*aIsInfra*/, + TUint16 /*aScanResponseFrameBodyLength*/, + const TUint8* /*aScanResponseFrameBody*/, + const TUint8* /*aIeData*/, + TUint16 /*aIeDataLength*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::Disconnect( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddTkIPKey( + WlanContextImpl& /*aCtxImpl*/, + const TUint8* /*aData*/, + TUint32 /*aLength*/, + T802Dot11WepKeyId /*aKeyIndex*/, + const TMacAddress& /*aMacAddr*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddMulticastTKIPKey( + WlanContextImpl& /*aCtxImpl*/, + T802Dot11WepKeyId /*aKeyIndex*/, + TUint32 /*aLength*/, + const TUint8* /*aData*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddAesKey( + WlanContextImpl& /*aCtxImpl*/, + const TUint8* /*aData*/, + TUint32 /*aLength*/, + const TMacAddress& /*aMacAddr*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddMulticastAesKey( + WlanContextImpl& /*aCtxImpl*/, + T802Dot11WepKeyId /*aKeyIndex*/, + TUint32 /*aLength*/, + const TUint8* /*aData*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddMulticastWapiKey( + WlanContextImpl& /*aCtxImpl*/, + T802Dot11WepKeyId /*aKeyIndex*/, + TUint32 /*aLength*/, + const TUint8* /*aData*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddUnicastWapiKey( + WlanContextImpl& /*aCtxImpl*/, + const TUint8* /*aData*/, + TUint32 /*aLength*/, + T802Dot11WepKeyId /*aKeyIndex*/, + const TMacAddress& /*aMacAddr*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::StartIBSS( + WlanContextImpl& /*aCtxImpl*/, + const TSSID& /*aSSID*/, + TUint32 /*aBeaconInterval*/, + TUint32 /*aAtim*/, + TUint32 /*aChannel*/, + TEncryptionStatus /*aEncryptionStatus*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::Scan( + WlanContextImpl& /*aCtxImpl*/, + TScanMode /*aMode*/, + const TSSID& /*aSSID*/, + TRate /*aScanRate*/, + SChannels& /*aChannels*/, + TUint32 /*aMinChannelTime*/, + TUint32 /*aMaxChannelTime*/, + TBool /*aSplitScan*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::RealScan( + WlanContextImpl& aCtxImpl, + TScanMode /*aMode*/, + const TSSID& /*aSSID*/, + TUint32 /*aScanRate*/, + SChannels& /*aChannels*/, + TUint32 /*aMinChannelTime*/, + TUint32 /*aMaxChannelTime*/, + TBool /*aSplitScan*/ ) + { + OnOidComplete( aCtxImpl, KErrGeneral ); + + return EFalse; // no state change + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::StopScan( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetTxPowerLevel( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aLevel*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::Configure( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aRTSThreshold*/, + TUint32 /*aMaxTxMSDULifetime*/, + TUint32 /*aVoiceCallEntryTimeout*/, + TUint32 /*aVoiceCallEntryTxThreshold*/, + TUint32 /*aVoiceNullTimeout*/, + TUint32 /*aNoVoiceTimeout*/, + TUint32 /*aKeepAliveTimeout*/, + TUint32 /*aspRcpiIndicationLevel*/, + TUint32 /*spTimetoCountPrediction*/, + TUint32 /*aSpMinIndicationInterval*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::GetLastRcpi( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::AddMulticastAddr( + WlanContextImpl& /*aCtxImpl*/, + const TMacAddress& /*aMacAddr*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::RemoveMulticastAddr( + WlanContextImpl& /*aCtxImpl*/, + TBool /*aRemoveAll*/, + const TMacAddress& /*aMacAddr*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureBssLost( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aBeaconLostCount*/, + TUint8 /*aFailedTxPacketCount*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetTxRateAdaptParams( + WlanContextImpl& /*aCtxImpl*/, + TUint8 /*aMinStepUpCheckpoint*/, + TUint8 /*aMaxStepUpCheckpoint*/, + TUint8 /*aStepUpCheckpointFactor*/, + TUint8 /*aStepDownCheckpoint*/, + TUint8 /*aMinStepUpThreshold*/, + TUint8 /*aMaxStepUpThreshold*/, + TUint8 /*aStepUpThresholdIncrement*/, + TUint8 /*aStepDownThreshold*/, + TBool /*aDisableProbeHandling*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureTxRatePolicies( + WlanContextImpl& /*aCtxImpl*/, + const TTxRatePolicy& /*aRatePolicy*/, + const TQueue2RateClass& /*aQueue2RateClass*/, + const TInitialMaxTxRate4RateClass& /*aInitialMaxTxRate4RateClass*/, + const TTxAutoRatePolicy& /*aAutoRatePolicy*/, + const THtMcsPolicy& /*aHtMcsPolicy*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::SetPowerModeManagementParameters( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aToLightPsTimeout*/, + TUint16 /*aToLightPsFrameThreshold*/, + TUint32 /*aToActiveTimeout*/, + TUint16 /*aToActiveFrameThreshold*/, + TUint32 /*aToDeepPsTimeout*/, + TUint16 /*aToDeepPsFrameThreshold*/, + TUint16 /*aUapsdRxFrameLengthThreshold*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigurePwrModeMgmtTrafficOverride( + WlanContextImpl& /*aCtxImpl*/, + TBool /*aStayInPsDespiteUapsdVoiceTraffic*/, + TBool /*aStayInPsDespiteUapsdVideoTraffic*/, + TBool /*aStayInPsDespiteUapsdBestEffortTraffic*/, + TBool /*aStayInPsDespiteUapsdBackgroundTraffic*/, + TBool /*aStayInPsDespiteLegacyVoiceTraffic*/, + TBool /*aStayInPsDespiteLegacyVideoTraffic*/, + TBool /*aStayInPsDespiteLegacyBestEffortTraffic*/, + TBool /*aStayInPsDespiteLegacyBackgroundTraffic*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::GetFrameStatistics( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureUapsd( + WlanContextImpl& /*aCtxImpl*/, + TMaxServicePeriodLength /*aMaxServicePeriodLength*/, + TBool /*aUapsdForVoice*/, + TBool /*aUapsdForVideo*/, + TBool /*aUapsdForBestEffort*/, + TBool /*aUapsdForBackground*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureTxQueueIfNecessary( + WlanContextImpl& /*aCtxImpl*/, + TQueueId /*aQueueId*/, + TUint16 /*aMediumTime*/, + TUint32 /*aMaxTxMSDULifetime*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::GetMacAddress( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::SetProtocolStackTxOffset( + WlanContextImpl& aCtxImpl ) const + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanMacState::SetProtocolStackTxOffset") ); + + TUint32 ethernetFrameTxOffset ( 0 ); + TUint32 dot11FrameTxOffsetNotRelevant ( 0 ); + TUint32 snapFrameTxOffsetNotRelevant ( 0 ); + + DetermineTxOffsets( + aCtxImpl, + ethernetFrameTxOffset, + dot11FrameTxOffsetNotRelevant, + snapFrameTxOffsetNotRelevant ); + + aCtxImpl.iUmac.SetProtocolStackTxOffset( + ethernetFrameTxOffset ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureArpIpAddressFiltering( + WlanContextImpl& /*aCtxImpl*/, + TBool /*aEnableFiltering*/, + TIpv4Address /*aIpv4Address*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureHtBlockAck( + WlanContextImpl& /*aCtxImpl*/, + TUint8 /*aTxBlockAckUsage*/, + TUint8 /*aRxBlockAckUsage*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::ConfigureProprietarySnapHdr( + WlanContextImpl& /*aCtxImpl*/, + const TSnapHeader& /*aSnapHeader*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::TxData( + WlanContextImpl& /*aCtxImpl*/, + TDataBuffer& /*aDataBuffer*/, + TBool /*aMore*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::TxMgmtData( + WlanContextImpl& /*aCtxImpl*/, + TDataBuffer& /* aDataBuffer */) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::FinitSystem( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnTimeout( WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnVoiceCallEntryTimerTimeout( + WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnVoiceCallEntryTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnNullTimerTimeout( WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnNullTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnNoVoiceTimerTimeout( WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnNoVoiceTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnKeepAliveTimerTimeout( WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnKeepAliveTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnActiveToLightPsTimerTimeout( + WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnActiveToLightPsTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnLightPsToActiveTimerTimeout( WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnLightPsToActiveTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::OnLightPsToDeepPsTimerTimeout( WlanContextImpl& /*aCtxImpl*/ ) + { + // a timeout occurred when we weren't expecting it. Because this can happen + // if a timeout callback had already been registered when we tried to cancel + // the timer, we need to ignore this event + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanMacState::OnLightPsToDeepPsTimerTimeout: unexpected timeout; ignored") ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnDfc( TAny* /*aCtx*/ ) + { + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::TxNullDataFrame( + WlanContextImpl& /*aCtxImpl*/, + TBool /*aQosNull*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnPacketTransferComplete( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aPacketId*/, + TDataBuffer* /*aMetaHeader*/ ) + { + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnPacketSendComplete( + WlanContextImpl& /*aCtxImpl*/, + WHA::TStatus /*aStatus*/, + TUint32 /*aPacketId*/, + WHA::TRate /*aRate*/, + TUint32 /*aPacketQueueDelay*/, + TUint32 /*aMediaDelay*/, + TUint /*aTotalTxDelay*/, + TUint8 /*aAckFailures*/, + WHA::TQueueId /*aQueueId*/, + WHA::TRate /*aRequestedRate*/, + TBool /*aMulticastData*/ ) + { + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::CallPacketSchedule( + WlanContextImpl& /*aCtxImpl*/, + TBool /*aMore*/ ) + { + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnPacketFlushEvent( + WlanContextImpl& /*aCtxImpl*/, + TUint32 /*aPacketId*/, + TDataBuffer* /*aMetaHeader*/ ) + { + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnPacketPushPossible( + WlanContextImpl& /*aCtxImpl*/ ) + { + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::IsRequestedFrameType( + TUint8 aLhs, + TUint8 aRhs, + TBool& aTypeMatch) + { + // do the type fields match? + aTypeMatch = + static_cast(( ( aLhs & E802Dot11FrameControlTypeMask ) + == ( aRhs & E802Dot11FrameControlTypeMask ) )); + + // we don't have to care about possible protocol version bits mismatch + + return static_cast(( aLhs == aRhs )); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::CommandResponse( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCommandId aCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandResponseParams& /*aCommandResponseParams*/ ) + { + // only supported by whacommand state + // anywhere else is a programming error + // in the underlying adaptation software + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::CommandComplete( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandCompletionParams& /*aCommandCompletionParams*/ ) + { + // not supported in default handler + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCompleteCommandId: %d"), aCompleteCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::Indication( + WlanContextImpl& /*aCtxImpl*/, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& /*aIndicationParams*/ ) + { + // not supported in default handler + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: WlanMacState::Indication: aIndicationId: %d"), + aIndicationId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TAny* WlanMacState::RequestForBuffer ( + WlanContextImpl& /*aCtxImpl*/, + TUint16 /*aLength*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::ReceivePacket( + WlanContextImpl& /*aCtxImpl*/, + WHA::TStatus /*aStatus*/, + const void* /*aFrame*/, + TUint16 /*aLength*/, + WHA::TRate /*aRate*/, + WHA::TRcpi /*aRcpi*/, + WHA::TChannelNumber /*aChannel*/, + TUint8* /*aBuffer*/, + TUint32 /*aFlags*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanMacState::DoErrorIndication( + WlanContextImpl& /*aCtxImpl*/, + WHA::TStatus /*aStatus*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::DoConsecutiveBeaconsLostIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::DoConsecutiveTxFailuresIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::DoConsecutivePwrModeSetFailuresIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::DoRegainedBSSIndication( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::DoRadarIndication( WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::DoRcpiIndication( + WlanContextImpl& /*aCtxImpl*/, + WHA::TRcpi /*aRcpi*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacState::DoPsModeErrorIndication( + WlanContextImpl& /*aCtxImpl*/ ) + { + // not supported in default handler + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnOidComplete( + WlanContextImpl& aCtxImpl, + TInt aReason, + const TAny* aData, + TUint32 aLengthInBytes ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: WlanMacState::OnOidComplete: WLM-request complete: status: %d"), + aReason ); + + aCtxImpl.iUmac.CompleteManagementCommand( + aReason, + aData, + aLengthInBytes ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnTxProtocolStackDataComplete( + WlanContextImpl& aCtxImpl, + TDataBuffer* aMetaHeader, + TInt aCompletionCode ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: WlanMacState::OnTxProtocolStackDataComplete: WLM-request complete: status: %d"), + aCompletionCode ); + aCtxImpl.iUmac.OnTxProtocolStackDataComplete( + aCompletionCode, + aMetaHeader ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnMgmtPathWriteComplete( + WlanContextImpl& aCtxImpl, + TInt aCompletionCode ) + { + OsTracePrint( KWlmCmd, (TUint8*) + ("UMAC: WlanMacState::OnMgmtPathWriteComplete: WLM-request complete: status: %d"), + aCompletionCode ); + aCtxImpl.iUmac.MgmtPathWriteComplete( + aCompletionCode ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanMacState::OnInDicationEvent( + WlanContextImpl& aCtxImpl, + TIndication aIndication ) + { + OsTracePrint( KWlmIndication, (TUint8*) + ("UMAC: WlanMacState::OnInDicationEvent: WLM-indication: %d"), + static_cast(aIndication) ); + + aCtxImpl.iUmac.OnInDicationEvent( aIndication ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanMacState::DetermineTxOffsets( + WlanContextImpl& aCtxImpl, + TUint32& aEthernetFrameTxOffset, + TUint32& aDot11FrameTxOffset, + TUint32& aSnapFrameTxOffset ) const + { + const TUint32 KVendorTxOffset ( + aCtxImpl.WHASettings().iTxFrameHeaderSpace ); + + const TUint32 KMacHdrLen ( aCtxImpl.QosEnabled() ? + sizeof( SHtQosDataFrameHeader ) : + sizeof( SDataFrameHeader ) ); + + // regarding the security header we simplify things by assuming the worst + // case (i.e. the longest security header). Doing this means that we don't + // need to update the frame Tx offsets every time a cipher key is taken + // into use + const TUint32 KMaxSecurityHdrLen ( Align4( KMaxDot11SecurityHeaderLength ) ); + + const TUint32 KSnapHdrLen ( sizeof( SSnapHeader ) ); + + const TUint32 KMacAddrLen ( sizeof( TMacAddress ) ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: KVendorTxOffset: %d"), + KVendorTxOffset ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: KMacHdrLen: %d"), + KMacHdrLen ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: KMaxSecurityHdrLen: %d"), + KMaxSecurityHdrLen ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: KSnapHdrLen: %d"), + KSnapHdrLen ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: KMacAddrLen: %d"), + KMacAddrLen ); + + aEthernetFrameTxOffset = + KVendorTxOffset + + KMacHdrLen + + KMaxSecurityHdrLen + + KSnapHdrLen - + ( 2 * KMacAddrLen ); // destination and source address + + aDot11FrameTxOffset = KVendorTxOffset; + + aSnapFrameTxOffset = + KVendorTxOffset + + KMacHdrLen + + KMaxSecurityHdrLen; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: aEthernetFrameTxOffset: %d"), + aEthernetFrameTxOffset ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: aDot11FrameTxOffset: %d"), + aDot11FrameTxOffset ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanMacState::DetermineTxOffsets: aSnapFrameTxOffset: %d"), + aSnapFrameTxOffset ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacManagementSideUmacCb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacManagementSideUmacCb.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanManagementSideUmacCb class. +* +*/ + +/* +* %version: 19 % +*/ + +#include "config.h" +#include "UmacManagementSideUmacCb.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanManagementSideUmacCb::~WlanManagementSideUmacCb() + { + iSelf = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::Attach( + WlanManagementSideUmacCb& aSelf ) + { + iSelf = &aSelf; + + OsTracePrint( KInitLevel, + (TUint8*)("UMAC: WlanManagementSideUmacCb::Attach: address: 0x%08x"), + reinterpret_cast(iSelf) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::Detach() + { + OsTracePrint( KInitLevel, + (TUint8*)("UMAC: WlanManagementSideUmacCb::Detach: address: 0x%08x"), + reinterpret_cast(iSelf) ); + + iSelf = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::OnOidCompleted( + TInt aReason, + SOidOutputData& OidOutputData ) + { + if ( iSelf ) + { + iSelf->OnOidCompleted( aReason, OidOutputData ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::SetMgmtSideTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ) + { + OsTracePrint( KWsaTxDetails, + (TUint8*)("UMAC: WlanManagementSideUmacCb::SetMgmtSideTxOffsets: iSelf address: 0x%08x"), + reinterpret_cast(iSelf) ); + + if ( iSelf ) + { + iSelf->SetMgmtSideTxOffsets( + aEthernetFrameTxOffset, + aDot11FrameTxOffset, + aSnapFrameTxOffset ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* WlanManagementSideUmacCb::GetBufferForRxData( + TUint aLengthinBytes ) + { + return (iSelf ? iSelf->GetBufferForRxData( aLengthinBytes ) : NULL); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* WlanManagementSideUmacCb::DmaPrivateTxMemory() + { + return (iSelf ? iSelf->DmaPrivateTxMemory() : NULL); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::MgmtDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + if ( iSelf ) + { + iSelf->MgmtDataReceiveComplete( aBufferStart, aNumOfBuffers ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::MgmtPathWriteComplete (TInt aErr) + { + if ( iSelf ) + { + iSelf->MgmtPathWriteComplete( aErr ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::OnInDicationEvent( + TIndication aIndication ) + { + if ( iSelf ) + { + iSelf->OnInDicationEvent( aIndication ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::MarkRxBufFree( TUint8* aBufferToFree ) + { + if ( iSelf ) + { + iSelf->MarkRxBufFree( aBufferToFree ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::RegisterTimeout( + TUint32 aTimeoutInMicroSeconds, + TWlanTimer aTimer ) + { + if ( iSelf ) + { + iSelf->RegisterTimeout( aTimeoutInMicroSeconds, aTimer ); + } + else + { + // implementation error; catch it + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::CancelTimeout( TWlanTimer aTimer ) + { + if ( iSelf ) + { + iSelf->CancelTimeout( aTimer ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::RegisterDfc( TAny* aCntx ) + { + if ( iSelf ) + { + iSelf->RegisterDfc( aCntx ); + } + else + { + // implementation error; catch it + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::CancelDfc() + { + if ( iSelf ) + { + iSelf->CancelDfc(); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* WlanManagementSideUmacCb::GetRxFrameMetaHeader() + { + return (iSelf ? iSelf->GetRxFrameMetaHeader() : NULL); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanManagementSideUmacCb::FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ) + { + if ( iSelf ) + { + iSelf->FreeRxFrameMetaHeader( aMetaHeader ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilteMixedMode1x.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilteMixedMode1x.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilterMixedMode1x class +* +*/ + +/* +* %version: 10 % +*/ + +#include "config.h" +#include "UmacPrivacyModeFilterMixedMode1x.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilterMixedMode1x::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool /* aUnicastKeyExists */, + TBool /* aAesOrTkipOrWapiEncrypted */ ) const + { + TBool ret( EFalse ); + + + if ( ( ( // allow all that have WEP bit on + aFrameheader.IsWepBitSet() + // OR have a group DA + || ( aFrameheader.iAddress1.iMacAddress[0] & KBit0 ) + ) + // AND are going to protocol stack + && aEthernetType != KEapolType + // AND user data is enabled + && aUserDataEnabled + ) + // OR are EAPOL frames + || aEthernetType == KEapolType + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedMode1x::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedMode1x::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedMode1x::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedMode1x::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + } + + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilteMixedModeWep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilteMixedModeWep.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilterMixedModeWep class +* +*/ + +/* +* %version: 10 % +*/ + +#include "config.h" +#include "UmacPrivacyModeFilterMixedModeWep.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilterMixedModeWep::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool /* aUnicastKeyExists */, + TBool /* aAesOrTkipOrWapiEncrypted */ ) const + { + TBool ret( EFalse ); + + + if ( ( ( // allow all that have WEP bit on + aFrameheader.IsWepBitSet() + // OR have a group DA + || ( aFrameheader.iAddress1.iMacAddress[0] & KBit0 ) + ) + // AND are going to protocol stack + && aEthernetType != KEapolType + // AND user data is enabled + && aUserDataEnabled + ) + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedModeWep::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedModeWep::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedModeWep::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterMixedModeWep::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + } + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilter1x.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilter1x.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilter1x class +* +*/ + +/* +* %version: 12 % +*/ + +#include "config.h" +#include "UmacPrivacyModeFilter1x.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilter1x::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool /* aUnicastKeyExists */, + TBool /* aAesOrTkipOrWapiEncrypted */ ) const + { + TBool ret( EFalse ); + + if ( ( // allow all that have WEP bit on + aFrameheader.IsWepBitSet() + // AND are going to protocol stack + && aEthernetType != KEapolType + // AND user data is enabled + && aUserDataEnabled + ) + // OR are EAPOL frames + || aEthernetType == KEapolType + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilter1x::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilter1x::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilter1x::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilter1x::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + } + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilterNone.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilterNone.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilterNone class +* +*/ + +/* +* %version: 11 % +*/ + +#include "config.h" +#include "UmacPrivacyModeFilterNone.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilterNone::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool /* aUnicastKeyExists */, + TBool /* aAesOrTkipOrWapiEncrypted */ ) const + { + TBool ret( EFalse ); + + if ( ( // allow all that have WEP bit off + !( aFrameheader.IsWepBitSet() ) + // AND are going to protocol stack + && aEthernetType != KEapolType + // AND user data is enabled + && aUserDataEnabled + ) + // OR are EAPOL frames + || aEthernetType == KEapolType + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterNone::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterNone::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterNone::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterNone::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + } + + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilterWep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilterWep.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilterWep class +* +*/ + +/* +* %version: 10 % +*/ + +#include "config.h" +#include "UmacPrivacyModeFilterWep.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilterWep::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool /* aUnicastKeyExists */, + TBool /* aAesOrTkipOrWapiEncrypted */ ) const + { + TBool ret( EFalse ); + + if ( ( // allow all that have WEP bit on + aFrameheader.IsWepBitSet() + // AND are going to protocol stack + && aEthernetType != KEapolType + // AND user data is enabled + && aUserDataEnabled + ) + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWep::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWep::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWep::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWep::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + } + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilterWpa.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacPrivacyModeFilterWpa.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilterWpa class +* +*/ + +/* +* %version: 10 % +*/ + +#include "config.h" +#include "UmacPrivacyModeFilterWpa.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilterWpa::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool aUnicastKeyExists, + TBool aAesOrTkipOrWapiEncrypted ) const + { + TBool ret( EFalse ); + + + if ( ( // allow all that have WEP bit on + aFrameheader.IsWepBitSet() + // AND are going to protocol stack + && aEthernetType != KEapolType + // AND user data is enabled + && aUserDataEnabled + ) + ||// OR + ( // are EAPOL frames + aEthernetType == KEapolType + // AND have WEP bit on + && aFrameheader.IsWepBitSet() + // AND are AES or TKIP encrypted + && aAesOrTkipOrWapiEncrypted + ) + ||// OR + ( // are EAPOL frames + aEthernetType == KEapolType + // AND have WEP bit off + && !( aFrameheader.IsWepBitSet() ) + // AND AP <-> client unicast key is NOT set + && !aUnicastKeyExists + // AND are NOT AES or TKIP encrypted + && !aAesOrTkipOrWapiEncrypted + ) + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWpa::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWpa::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWpa::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWpa::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWpa::operator: UnicastKeyExists: %d"), + aUnicastKeyExists ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWpa::operator: AES, TKIP or WAPI encrypted: %d"), + aAesOrTkipOrWapiEncrypted ); + } + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacProtocolStackSideUmacCb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacProtocolStackSideUmacCb.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of ProtocolStackSideUmacCb class +* +*/ + +/* +* %version: 12 % +*/ + +#include "config.h" +#include "UmacProtocolStackSideUmacCb.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanProtocolStackSideUmacCb::SetProtocolStackTxOffset( + TUint32 aEthernetFrameTxOffset ) + { + if ( iSelf ) + { + iSelf->SetProtocolStackTxOffset( + aEthernetFrameTxOffset ); + } + else + { + // protocol stack side client is not present so we do nothing + // (This is the case for the 1st connect and in that case the + // frame Tx offset will be set elsewhere) + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanProtocolStackSideUmacCb::OnTxProtocolStackDataComplete( + TInt aCompletionCode, + TDataBuffer* aMetaHeader ) + { + if ( iSelf ) + { + iSelf->OnTxProtocolStackDataComplete( aCompletionCode, aMetaHeader ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanProtocolStackSideUmacCb::OnOtherTxDataComplete() + { + if ( iSelf ) + { + iSelf->OnOtherTxDataComplete(); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanProtocolStackSideUmacCb::OnTxDataSent() + { + if ( iSelf ) + { + iSelf->OnTxDataSent(); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanProtocolStackSideUmacCb::ProtocolStackDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + TBool status ( EFalse ); + + if ( iSelf ) + { + status = iSelf->ProtocolStackDataReceiveComplete( aBufferStart, aNumOfBuffers ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanProtocolStackSideUmacCb::ProtocolStackSideClientReady() const + { + TBool status ( EFalse ); + + if ( iSelf ) + { + status = iSelf->ProtocolStackSideClientReady(); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanProtocolStackSideUmacCb::UserDataReEnabled() + { + if ( iSelf ) + { + iSelf->UserDataReEnabled(); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacTxRateAdaptation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacTxRateAdaptation.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,788 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanTxRateAdaptation class +* +*/ + +/* +* %version: 21 % +*/ + +#include "config.h" +#include "UmacTxRateAdaptation.h" +#include "UmacContextImpl.h" +#include "wha_mibDefaultvalues.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +WlanTxRateAdaptation::WlanTxRateAdaptation() + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::WlanTxRateAdaptation()")); + + // default values for the rate adaptation algorithm parameters + // + const TUint8 KDefaultMinStepUpCheckpoint = 10; + const TUint8 KDefaultMaxStepUpCheckpoint = 60; + const TUint8 KDefaultStepUpCheckpointFactor = 2; + const TUint8 KDefaultStepDownCheckpoint = 3; + const TUint8 KDefaultMinStepUpThreshold = 70; + const TUint8 KDefaultMaxStepUpThreshold = 90; + const TUint8 KDefaultStepUpThresholdIncrement = 10; + const TUint8 KDefaultStepDownThreshold = 50; + + iAlgorithmParam.iMinStepUpCheckpoint = + KDefaultMinStepUpCheckpoint; + + iAlgorithmParam.iMaxStepUpCheckpoint = + KDefaultMaxStepUpCheckpoint; + + iAlgorithmParam.iStepUpCheckpointFactor = + KDefaultStepUpCheckpointFactor; + + iAlgorithmParam.iStepDownCheckpoint = + KDefaultStepDownCheckpoint; + + iAlgorithmParam.iMinStepUpThreshold = + KDefaultMinStepUpThreshold; + + iAlgorithmParam.iMaxStepUpThreshold = + KDefaultMaxStepUpThreshold; + + iAlgorithmParam.iStepUpThresholdIncrement = + KDefaultStepUpThresholdIncrement; + + iAlgorithmParam.iStepDownThreshold = + KDefaultStepDownThreshold; + + iAlgorithmParam.iDisableProbeHandling = EFalse; + + for ( TUint32 j = 0; j != WHA::EQueueIdMax; ++j ) + { + // initially every Tx queue is mapped to the same (general) Tx + // policy + iQueue2Policy[j] = WHA::KDefaultTxRatePolicyId; + } + + for ( TUint32 i = 0; i != KMaxRatePolicyCount; ++i ) + { + iPolicy[i].iCurrentTxRate = NULL; + iPolicy[i].iHead = NULL; + iPolicy[i].iTail = NULL; + iPolicy[i].iNumOfRates = 0; + + iPolicy[i].iProbe = EFalse; + iPolicy[i].iTxCount = 0; + iPolicy[i].iTxFailCount = 0; + iPolicy[i].iStepUpCheckpoint = KDefaultMinStepUpCheckpoint; + iPolicy[i].iStepUpThreshold = KDefaultMinStepUpThreshold; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::RateStepDown( SPolicy& aPolicy ) const + { + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::RateStepDown(): old rate: 0x%08x"), + aPolicy.iCurrentTxRate->iBitRate); + + if ( aPolicy.iCurrentTxRate->iPrev ) + { + // descent rate + aPolicy.iCurrentTxRate = aPolicy.iCurrentTxRate->iPrev; + + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::RateStepDown(): new rate: 0x%08x"), + aPolicy.iCurrentTxRate->iBitRate); + } + else + { + // we are already using the lowest rate + // nothing to do + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::RateStepDown(): already using the lowest rate") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanTxRateAdaptation::RateStepUp( SPolicy& aPolicy ) const + { + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::RateStepUp(): old rate: 0x%08x"), + aPolicy.iCurrentTxRate->iBitRate); + + TBool status( ETrue ); + + if ( aPolicy.iCurrentTxRate->iNext ) + { + // ascend rate + aPolicy.iCurrentTxRate = aPolicy.iCurrentTxRate->iNext; + + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::RateStepUp(): new rate: 0x%08x"), + aPolicy.iCurrentTxRate->iBitRate); + } + else + { + // we are already using the highest rate. + // Indicate that to the caller + status = EFalse; + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::RateStepUp(): already using the highest rate") ); + } + + return status; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::InsertRate( + TUint8 aPolicyIndex, SBitRate* aBlock ) const + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::InsertRate(): aPolicyIndex: %d"), + aPolicyIndex); + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::InsertRate(): rate: 0x%08x"), + aBlock->iBitRate); + + // traverse our single linked list of rate entrys + // and locate the correct place for the new rate + SBitRate* ptr = iPolicy[aPolicyIndex].iHead; + SBitRate* prev = ptr; + + do + { + if ( aBlock->iBitRate < ptr->iBitRate ) + { + // rate to be inserted is smaller than + // the "current" rate + break; + } + + prev = ptr; + ptr = ptr->iNext; + } + while ( ptr ); + + if ( ptr ) + { + // correct slot found + // link the new rate + prev->iNext = aBlock; + aBlock->iPrev = prev; + aBlock->iNext = ptr; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanTxRateAdaptation::AppendRate( + TUint8 aPolicyIndex, + WHA::TRate aRate ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::AppendRate(): aPolicyIndex: %d"), + aPolicyIndex); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::AppendRate(): rate: 0x%08x"), aRate); + + // allocate a new block for the rate + SBitRate* block + = static_cast(os_alloc( sizeof(SBitRate) )); + + if ( !block ) + { + // alloc failure; we cannot continue + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: WlanTxRateAdaptation::AppendRate(): alloc failure")); + + return EFalse; + } + + block->iBitRate = aRate; + block->iNext = NULL; + block->iPrev = NULL; + + if ( !iPolicy[aPolicyIndex].iHead ) + { + // this is the first append + + iPolicy[aPolicyIndex].iHead = block; + iPolicy[aPolicyIndex].iTail = iPolicy[aPolicyIndex].iHead; + iPolicy[aPolicyIndex].iCurrentTxRate = block; + ++iPolicy[aPolicyIndex].iNumOfRates; + } + else + { + // not the first rate to append + + if ( block->iBitRate > iPolicy[aPolicyIndex].iTail->iBitRate ) + { + // new rate bigger than the last one + // append to rear + iPolicy[aPolicyIndex].iTail->iNext = block; + block->iPrev = iPolicy[aPolicyIndex].iTail; + // new tail + iPolicy[aPolicyIndex].iTail = block; + ++iPolicy[aPolicyIndex].iNumOfRates; + } + else if( block->iBitRate < iPolicy[aPolicyIndex].iTail->iBitRate ) + { + // new rate smaller than the last one + // insert the rate to the correct slot + InsertRate( aPolicyIndex, block ); + ++iPolicy[aPolicyIndex].iNumOfRates; + } + else + { + // new rate equal to the last one + // this cannot happen as we are setting the rates only once + // and from a rate bitmask + } + } + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::AppendRate(): num of existing rates: %d"), + iPolicy[aPolicyIndex].iNumOfRates); + + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::Reset( SPolicy& aPolicy ) const + { + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::Reset() a policy")); + + // dealloc all rates + SBitRate* ptr = aPolicy.iHead; + SBitRate* cache = ptr; + + while ( ptr ) + { + cache = ptr; + ptr = ptr->iNext; + + // free the previous one + os_free( cache ); + } + + aPolicy.iCurrentTxRate = NULL; + aPolicy.iHead = NULL; + aPolicy.iTail = NULL; + aPolicy.iNumOfRates = 0; + + aPolicy.iProbe = EFalse; + aPolicy.iTxCount = 0; + aPolicy.iTxFailCount = 0; + aPolicy.iStepUpCheckpoint = iAlgorithmParam.iMinStepUpCheckpoint; + aPolicy.iStepUpThreshold = iAlgorithmParam.iMinStepUpThreshold; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanTxRateAdaptation::SetRates( + TUint8 aPolicyId, + WHA::TRate aRateBitmask ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::SetRates(): aPolicyId: 0x%08x"), aPolicyId); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::SetRates(): aRateBitmask: 0x%08x"), aRateBitmask); + + // make the list of rates; but 1st clear the list + Reset( iPolicy[aPolicyId - 1] ); + + // make rates from bitmask + const TUint32 cntr_end( 32 ); + TUint32 cntr( 0 ); + + for ( TUint32 bit = 1 ; cntr != cntr_end ; (bit <<= 1) ) + { + if ( aRateBitmask & bit ) + { + // rate is to be set + if ( !AppendRate( aPolicyId - 1, aRateBitmask & bit ) ) + { + return EFalse; + } + } + + ++cntr; + } + + // if we got this far, the rates are now in the list + + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::SetPolicy( + WHA::TQueueId aQueueId, + TUint8 aPolicyId ) + { + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::SetPolicy(): aQueueId: %d"), + aQueueId); + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::SetPolicy(): aPolicyId: %d"), + aPolicyId); + + iQueue2Policy[aQueueId] = aPolicyId; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::SetCurrentMaxTxRate( + TUint8 aPolicyId, + WHA::TRate aRate ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::SetCurrentMaxTxRate(): aPolicyId: %d"), + aPolicyId ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::SetCurrentMaxTxRate(): aRate: 0x%08x"), + aRate ); + + if ( !iPolicy[aPolicyId - 1].iNumOfRates ) + { + // catch implementation error + OsAssert( (TUint8*)("UMAC: panic: no rates defined"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // traverse our single linked list of rate entrys from rear (i.e. from + // the highest) to front (i.e. to the lowest) and try to locate the + // provided rate entry, or the next lower one, so that it can be set as + // the current max tx rate + + SBitRate* ptr = iPolicy[aPolicyId - 1].iTail; + + do + { + if ( ptr->iBitRate <= aRate ) + { + // found + break; + } + else + { + ptr = ptr->iPrev; + } + } + while ( ptr ); + + if ( ptr ) + { + // usable rate was found. Set it as the current rate + iPolicy[aPolicyId - 1].iCurrentTxRate = ptr; + } + else + { + // the provided max Tx rate is lower than any of the + // rates in this rate policy. In this case we have to set the + // lowest rate in the policy as the current rate (even + // though it is higher than what was requested) + iPolicy[aPolicyId - 1].iCurrentTxRate = iPolicy[aPolicyId - 1].iHead; + } + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::SetCurrentMaxTxRate(): current rate now set to: 0x%08x"), + iPolicy[aPolicyId - 1].iCurrentTxRate->iBitRate ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::SetAlgorithmParameters( + TUint8 aMinStepUpCheckpoint, + TUint8 aMaxStepUpCheckpoint, + TUint8 aStepUpCheckpointFactor, + TUint8 aStepDownCheckpoint, + TUint8 aMinStepUpThreshold, + TUint8 aMaxStepUpThreshold, + TUint8 aStepUpThresholdIncrement, + TUint8 aStepDownThreshold, + TBool aDisableProbeHandling ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::SetAlgorithmParameters") ); + + iAlgorithmParam.iMinStepUpCheckpoint = aMinStepUpCheckpoint; + iAlgorithmParam.iMaxStepUpCheckpoint = aMaxStepUpCheckpoint; + iAlgorithmParam.iStepUpCheckpointFactor = aStepUpCheckpointFactor; + iAlgorithmParam.iStepDownCheckpoint = aStepDownCheckpoint; + iAlgorithmParam.iMinStepUpThreshold = aMinStepUpThreshold; + iAlgorithmParam.iMaxStepUpThreshold = aMaxStepUpThreshold; + iAlgorithmParam.iStepUpThresholdIncrement = aStepUpThresholdIncrement; + iAlgorithmParam.iStepDownThreshold = aStepDownThreshold; + iAlgorithmParam.iDisableProbeHandling = aDisableProbeHandling; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::RatePolicy( + const WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId, + TBool aUseSpecialRatePolicy, + WHA::TRate& aRate, + TUint8& aPolicyId ) const + { + aPolicyId = iQueue2Policy[aQueueId]; + + if ( aCtxImpl.WHASettings().iCapability & + WHA::SSettings::KAutonomousRateAdapt ) + { + // autonomous rate adaptation is being used, i.e. rate adaptation is + // handled by lower layers. In this case it's not relevant to specify + // a Max Tx Rate and the whole value is not applicable. So we return + // zero + const WHA::TRate notRelevant( 0 ); + aRate = notRelevant; + + const TUint8 KSpecialTxAutoRatePolicy = + aCtxImpl.SpecialTxAutoRatePolicy(); + + if ( aUseSpecialRatePolicy && KSpecialTxAutoRatePolicy ) + { + aPolicyId = KSpecialTxAutoRatePolicy; + } + } + else + { + // rate adaptation is handled by this object + + if ( !iPolicy[aPolicyId - 1].iNumOfRates ) + { + OsAssert( (TUint8*) + ("UMAC: WlanTxRateAdaptation::RatePolicy(): panic: no rates defined"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( !iPolicy[aPolicyId - 1].iCurrentTxRate ) + { + // catch implementation error + + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: no current rate specified for policy id: %d"), + aPolicyId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // return the current Max Tx Rate + aRate = iPolicy[aPolicyId - 1].iCurrentTxRate->iBitRate; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::OnTxCompleted( + WHA::TRate aRate, + TBool aSuccess, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate ) + { + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): aRate: 0x%08x"), + aRate); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): aSuccess: %d"), + aSuccess); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): aQueueId: %d"), + aQueueId); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): aRequestedRate: 0x%08x"), + aRequestedRate); + + TBool success( aSuccess ); + + TUint8 policyId = iQueue2Policy[aQueueId]; + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::OnTxCompleted(): policyId: %d"), + policyId); + + if ( iPolicy[policyId - 1].iCurrentTxRate ) + { + // as Current Tx Rate is defined for this policy, it means that + // this rate adaptation object is configured and we can handle this + // event + + if ( aSuccess ) + { + // the frame was successfully delivered to nw + + // from rate adaptation point of view we are interested in the + // actual Tx rate of the frame only if the current rate for the Tx + // policy in question is still the same as the originally requested Tx + // rate for this frame. + // (After we have switched the curent rate to something else, we may + // still receive Tx completions for frames which we have requested to + // be sent with the previous rate. We are not interested in their + // actual Tx rate any more.) + if ( aRequestedRate == iPolicy[policyId - 1].iCurrentTxRate->iBitRate ) + { + if ( aRate != aRequestedRate ) + { + // actual Tx rate was different than the originally requested + // rate. This is a Tx "failure" from Tx rate adaptation point + // of view + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): succeeded with a different rate than requested")); + success = EFalse; + } + } + else + { + // curent rate of the Tx policy in question not the same any more + // as the originally requested rate for this frame. The frame is + // ignored from Tx rate adaptation considerations + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): current rate for this Tx policy not same any more as originally requested rate for this frame")); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): frame ignored from Tx rate adaptation considerations")); + return; + } + } + + TRateStep rateStep = OnTxCompleted( success, iPolicy[policyId - 1] ); + + switch ( rateStep ) + { + case EStepUp: + if ( RateStepUp( iPolicy[policyId - 1] ) ) + { + // step up succeeded (i.e. there was a higher rate to switch to) + + // if probe frame handling hasn't been disabled, the next + // transmitted frame will be handled as a probe frame + if ( !iAlgorithmParam.iDisableProbeHandling ) + { + iPolicy[policyId - 1].iProbe = ETrue; + } + } + break; + case EStepDown: + RateStepDown( iPolicy[policyId - 1] ); + break; + case EKeepCurrent: + // nothing to do here + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: unkown rate step: %d"), + rateStep ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { + // Current Tx Rate is not defined for this policy, which means that + // this rate adaptation object is not configured (it has been + // reset) and cannot handle the event. So we just discard it + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): Rate adaptation not configured. Tx complete event discarded")); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTxRateAdaptation::Reset() + { + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::Reset() the whole object")); + + for ( TUint32 j = 0; j != WHA::EQueueIdMax; ++j ) + { + // every Tx queue is mapped to the same (general) Tx policy + iQueue2Policy[j] = WHA::KDefaultTxRatePolicyId; + } + + for ( TUint32 i = 0; i != KMaxRatePolicyCount; ++i ) + { + // reset the state of every individual Tx policy + Reset( iPolicy[i] ); + } + } + +// --------------------------------------------------------------------------- +// Note: The rate adaptation algorithm requires that: +// iStepDownCheckpoint <= iStepUpCheckpoint and +// iStepDownCheckpoint > 1 (or it can also be == 1 if iDisableProbeHandling +// is ETrue) +// --------------------------------------------------------------------------- +// +WlanTxRateAdaptation::TRateStep WlanTxRateAdaptation::OnTxCompleted( + TBool aSuccess, + SPolicy& aPolicy ) const + { + TRateStep rateStep( EKeepCurrent ); + + ++aPolicy.iTxCount; + + if ( !aSuccess ) + { + ++aPolicy.iTxFailCount; + } + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): iProbe (0 no/1 yes): %d"), + aPolicy.iProbe ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): iTxCount after counting this frame: %d"), + aPolicy.iTxCount ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): iTxFailCount after counting this frame: %d"), + aPolicy.iTxFailCount ); + OsTracePrint( KTxRateAdapt, + (TUint8*)("UMAC: WlanTxRateAdaptation::OnTxCompleted(): iCurrentTxRate: 0x%08x"), + aPolicy.iCurrentTxRate->iBitRate); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): iStepUpCheckpoint: %d"), + aPolicy.iStepUpCheckpoint ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): iStepUpThreshold: %d"), + aPolicy.iStepUpThreshold ); + + if ( aPolicy.iProbe ) + { + // this was a probe frame; check if a rate change is needed + + if ( !aSuccess ) + { + // either the Tx failed completely or it succeeded at a lower + // rate than requested + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): probe failure")); + + // decrement the rate + rateStep = EStepDown; + + aPolicy.iStepUpCheckpoint = + ( aPolicy.iStepUpCheckpoint * + iAlgorithmParam.iStepUpCheckpointFactor + > iAlgorithmParam.iMaxStepUpCheckpoint ) ? + iAlgorithmParam.iMaxStepUpCheckpoint : + aPolicy.iStepUpCheckpoint * + iAlgorithmParam.iStepUpCheckpointFactor; + + aPolicy.iStepUpThreshold = + ( aPolicy.iStepUpThreshold + + iAlgorithmParam.iStepUpThresholdIncrement + > iAlgorithmParam.iMaxStepUpThreshold ) ? + iAlgorithmParam.iMaxStepUpThreshold : + aPolicy.iStepUpThreshold + + iAlgorithmParam.iStepUpThresholdIncrement; + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): new iStepUpCheckpoint: %d"), + aPolicy.iStepUpCheckpoint ); + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): new iStepUpThreshold: %d"), + aPolicy.iStepUpThreshold ); + + aPolicy.iTxCount = 0; + aPolicy.iTxFailCount = 0; + } + else + { + // Tx success with requested rate; nothing more to do + } + + // in any case clear the probe flag + aPolicy.iProbe = EFalse; + } + else + { + if ( aPolicy.iTxCount % iAlgorithmParam.iStepDownCheckpoint == 0 ) + { + // check if the rate should be decremented + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): check for decrement need")); + + if ( aPolicy.iTxFailCount * 100 + >= iAlgorithmParam.iStepDownThreshold * aPolicy.iTxCount ) + { + // at least iStepDownThreshold % of iTxCount frames have + // "failed" => decrement rate + // + rateStep = EStepDown; + aPolicy.iStepUpCheckpoint = + iAlgorithmParam.iMinStepUpCheckpoint; + aPolicy.iStepUpThreshold = + iAlgorithmParam.iMinStepUpThreshold; + + aPolicy.iTxCount = 0; + aPolicy.iTxFailCount = 0; + } + } + + if ( rateStep != EStepDown && + aPolicy.iTxCount >= aPolicy.iStepUpCheckpoint ) + { + // check if the rate should be incremented + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): check for increment need")); + + if ( ( aPolicy.iTxCount - aPolicy.iTxFailCount ) * 100 + >= aPolicy.iStepUpThreshold * aPolicy.iTxCount ) + { + // at least iStepUpThreshold % of iTxCount frames have + // "succeeded" => increment rate + // + rateStep = EStepUp; + } + + aPolicy.iTxCount = 0; + aPolicy.iTxFailCount = 0; + } + } + + OsTracePrint( KTxRateAdapt, (TUint8*) + ("UMAC: WlanTxRateAdaptation::OnTxCompleted(): rateStep: %d (keep = 0, down, up)"), + rateStep ); + + return rateStep; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaAddKey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaAddKey.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaAddKey class +* +*/ + +/* +* %version: 14 % +*/ + +#include "config.h" +#include "UmacWsaAddKey.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaAddKey::iName[] = "wsa-addkey"; +#endif // !NDEBUG + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWsaAddKey::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( + KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaAddKey::Entry: KeyType: %d"), + iKeyType); + OsTracePrint( + KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaAddKey::Entry: iEntryIndex: %d"), + iEntryIndex); + +#ifndef NDEBUG + TUint keyDataLen( 0 ); + + switch ( iKeyType ) + { + case WHA::EWepGroupKey: + keyDataLen = + sizeof(WHA::SWepGroupKey) + - sizeof(reinterpret_cast(iKey)->iKey) + + (reinterpret_cast + (iKey))->iKeyLengthInBytes; + break; + case WHA::EWepPairWiseKey: + keyDataLen = + sizeof(WHA::SWepPairwiseKey) + - sizeof(reinterpret_cast + (iKey)->iKey) + + (reinterpret_cast + (iKey))->iKeyLengthInBytes; + break; + case WHA::ETkipGroupKey: + keyDataLen = sizeof( WHA::STkipGroupKey ); + break; + case WHA::ETkipPairWiseKey: + keyDataLen = sizeof( WHA::STkipPairwiseKey ); + break; + case WHA::EAesGroupKey: + keyDataLen = sizeof( WHA::SAesGroupKey ); + break; + case WHA::EAesPairWiseKey: + keyDataLen = sizeof( WHA::SAesPairwiseKey ); + break; + case WHA::EWapiGroupKey: + keyDataLen = sizeof( WHA::SWapiGroupKey ); + break; + case WHA::EWapiPairWiseKey: + keyDataLen = sizeof( WHA::SWapiPairwiseKey ); + break; + default: + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: iKeyType: %d"), iKeyType ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaAddKey::Entry: complete key data contents:"), + reinterpret_cast(iKey), + reinterpret_cast(iKey) + keyDataLen ); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-AddKey") ); + +#endif // !NDEBUG + + // execute the command + aCtxImpl.Wha().AddKey( iKeyType, iKey, iEntryIndex ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWsaAddKey::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId != WHA::EAddKeyResponse ) + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaAddKey::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaCommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaCommand.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,256 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaCommand class. +* +*/ + +/* +* %version: 25 % +*/ + +#include "config.h" +#include "UmacWsaCommand.h" +#include "UmacContextImpl.h" + + +// ============================ MEMBER FUNCTIONS =============================== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaCommand::~WlanWsaCommand() + { + iMacActionHistoryState = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::Exit( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd inactive + aCtxImpl.DeActivateWsaCmd(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::ChangeState( + WlanContextImpl& aCtxImpl, + WlanWsaCommand& aPrevState, + WlanMacActionState& aNewState ) const + { +#ifndef NDEBUG + TUint8 length; + const TUint8* ptr = reinterpret_cast + (aNewState.GetStateName( length )); + const TUint8* ptr2 = reinterpret_cast + (aCtxImpl.iCurrentMacState->GetStateName( length )); + + OsTracePrint( KUmacProtocolState, + (TUint8*)("UMAC: WlanWsaCommand::ChangeState(): previous state:") ); + OsTracePrint( KUmacProtocolState, ptr2 ); + OsTracePrint( KUmacProtocolState, + (TUint8*)("UMAC: WlanWsaCommand::ChangeState(): next state:") ); + OsTracePrint( KUmacProtocolState, ptr ); +#endif + + aPrevState.Exit( aCtxImpl ); + aCtxImpl.iCurrentMacState = &aNewState; + aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::TraverseToHistoryState( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( + KUmacDetails, + (TUint8*) + ("UMAC: WlanWsaCommand::TraverseToHistoryState(): act: %d"), + aCtxImpl.WhaCommandAct() ); + + History().OnWhaCommandResponse( + aCtxImpl, + aCommandId, + aStatus, + aCommandResponseParams, + aCtxImpl.WhaCommandAct() ); + + ChangeState( aCtxImpl, + *this, // previous state + History() // recall history state (new state) + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::Act( WlanContextImpl& aCtxImpl, TUint32 aAct ) const + { + aCtxImpl.WhaCommandAct( aAct ); + } + +// from wha side + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::Indication( + WlanContextImpl& aCtxImpl, + WHA::TIndicationId aIndicationId, + const WHA::UIndicationParams& aIndicationParams ) + { + return History().Indication( aCtxImpl, aIndicationId, aIndicationParams ); + } + +// Frame receive + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* WlanWsaCommand::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + return History().RequestForBuffer( aCtxImpl, aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate aRate, + WHA::TRcpi aRcpi, + WHA::TChannelNumber aChannel, + TUint8* aBuffer, + TUint32 aFlags ) + { + return History().ReceivePacket( + aCtxImpl, + aStatus, + aFrame, + aLength, + aRate, + aRcpi, + aChannel, + aBuffer, + aFlags + ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanWsaCommand::TxData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer, + TBool aMore ) + { + return History().TxData( aCtxImpl, aDataBuffer, aMore ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::TxMgmtData( + WlanContextImpl& aCtxImpl, + TDataBuffer& aDataBuffer ) + { + History().TxMgmtData( aCtxImpl, aDataBuffer ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::OnPacketTransferComplete( + WlanContextImpl& aCtxImpl, + TUint32 aPacketId, + TDataBuffer* aMetaHeader ) + { + History().OnPacketTransferComplete( aCtxImpl, aPacketId, aMetaHeader ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::OnPacketSendComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + TUint32 aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint aTotalTxDelay, + TUint8 aAckFailures, + WHA::TQueueId aQueueId, + WHA::TRate aRequestedRate, + TBool aMulticastData ) + { + History().OnPacketSendComplete( + aCtxImpl, + aStatus, + aPacketId, + aRate, + aPacketQueueDelay, + aMediaDelay, + aTotalTxDelay, + aAckFailures, + aQueueId, + aRequestedRate, + aMulticastData ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::CallPacketSchedule( + WlanContextImpl& aCtxImpl, + TBool aMore ) + { + History().CallPacketSchedule( aCtxImpl, aMore ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaCommand::OnPacketPushPossible( + WlanContextImpl& aCtxImpl ) + { + History().OnPacketPushPossible( aCtxImpl ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaConfigure.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaConfigure.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaConfigure class +* +*/ + +/* +* %version: 23 % +*/ + +#include "config.h" +#include "UmacWsaConfigure.h" +#include "UmacContextImpl.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif // RD_WLAN_DDK + +#ifndef NDEBUG +const TInt8 WlanWsaConfigure::iName[] = "wsa-configure"; +#endif // !NDEBUG + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWsaConfigure::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: pda size: %d"), iLength); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: pda start address: 0x%08x"), + reinterpret_cast(iData)); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-Configure") ); + + // execute the command + aCtxImpl.Wha().Configure( + *(static_cast(iData)), + aCtxImpl.WHASettings() ); + +#ifndef NDEBUG + // WHA settings object should be set + // trace it + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: WSASettings object:") ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iNumOfSSIDs: %d"), + aCtxImpl.WHASettings().iNumOfSSIDs ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iRxBufAlignment (DEPRECATED): %d"), + aCtxImpl.WHASettings().iRxBufAlignment ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iNumOfBytesForSsid: %d"), + aCtxImpl.WHASettings().iNumOfBytesForSsid ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iRates: 0x%08x"), + aCtxImpl.WHASettings().iRates ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iBand: %d"), + aCtxImpl.WHASettings().iBand ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iRxoffset: %d"), + aCtxImpl.WHASettings().iRxoffset ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iNumOfGroupTableEntrys: %d"), + aCtxImpl.WHASettings().iNumOfGroupTableEntrys ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iNumOfTxRateClasses: %d"), + aCtxImpl.WHASettings().iNumOfTxRateClasses ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iTxFrameTrailerSpace: %d"), + aCtxImpl.WHASettings().iTxFrameTrailerSpace ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iTxFrameHeaderSpace: %d"), + aCtxImpl.WHASettings().iTxFrameHeaderSpace ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iFlagsMask: 0x%04x"), + aCtxImpl.WHASettings().iFlagsMask ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: power levels per band (from lowest to highest):") ); + + for ( TUint i = 0; i < WHA::SSettings::KNumOfBandsSupported; ++i ) + { + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iMinPowerLevel: %d"), + aCtxImpl.WHASettings().iTxPowerRange[i].iMinPowerLevel ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iMaxPowerLevel: %d"), + aCtxImpl.WHASettings().iTxPowerRange[i].iMaxPowerLevel ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iStepping: %d"), + aCtxImpl.WHASettings().iTxPowerRange[i].iStepping ); + } + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iCapability: 0x%08x"), + aCtxImpl.WHASettings().iCapability ); + + if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation ) + { + // trace HT related information + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iHTCapabilitiesBitMask: 0x%08x"), + aCtxImpl.WHASettings().iHtCapabilities.iHTCapabilitiesBitMask ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iRxMaxDataRate: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iRxMaxDataRate ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iChannelWidth: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iChannelWidth ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iRxStbc: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iRxStbc ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iMaxAmsdu: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iMaxAmsdu ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iMaxAmpdu: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iMaxAmpdu ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iAmpduSpacing: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iAmpduSpacing ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iRxMcs:"), + aCtxImpl.WHASettings().iHtCapabilities.iRxMcs, + aCtxImpl.WHASettings().iHtCapabilities.iRxMcs + + WHA::KHtMcsSetLength ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iTxMcs:"), + aCtxImpl.WHASettings().iHtCapabilities.iTxMcs, + aCtxImpl.WHASettings().iHtCapabilities.iTxMcs + + WHA::KHtMcsSetLength ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iPcoTransTime: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iPcoTransTime ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaConfigure::Entry: iMcsFeedback: %d"), + aCtxImpl.WHASettings().iHtCapabilities.iMcsFeedback ); + } +#endif + + if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation ) + { + // wlanpdd indicates HT support. Record that in our BSS Membership + // features + aCtxImpl.AddBssMembershipFeature( E802Dot11HtPhy ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWsaConfigure::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EConfigureResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, + aStatus, + aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWsaConfigure::Set( + WlanContextImpl& /*aCtxImpl*/, + const TAny* aData, + TUint32 aLength ) + { + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaConfigure::Set: user space PDA address: 0x%08x"), + reinterpret_cast(aData) ); + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaConfigure::Set: length of PDA: %d"), aLength ); + + iData = aData; + iLength = aLength; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaConfigure::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaDisconnect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaDisconnect.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaDisconnect class +* +*/ + +/* +* %version: 11 % +*/ + +#include "config.h" +#include "UmacWsaDisconnect.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaDisconnect::iName[] = "wsa-disconnect"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaDisconnect::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaDisconnect::Entry")); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-Reset") ); + + // execute the disconnect command + aCtxImpl.Wha().Reset(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaDisconnect::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EResetResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +#ifndef NDEBUG +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const TInt8* WlanWsaDisconnect::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaInitiliaze.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaInitiliaze.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaInitiliaze class +* +*/ + +/* +* %version: 13 % +*/ + +#include "config.h" +#include "UmacWsaInitiliaze.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaInitiliaze::iName[] = "wha-initiliaze"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaInitiliaze::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaInitiliaze::Entry: firmware size: %d"), iLength); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaInitiliaze::Entry: firmware start address 0x%08x"), + reinterpret_cast(iData)); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-Initialize") ); + + aCtxImpl.Wha().Initialize( iData, iLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaInitiliaze::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EInitializeResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaInitiliaze::Set( + WlanContextImpl& /*aCtxImpl*/, + const TAny* aData, + TUint32 aLength ) + { + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaInitiliaze::Set: user space fw address: 0x%08x"), + reinterpret_cast(aData) ); + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaInitiliaze::Set: length of fw: %d"), aLength ); + + iData = aData; + iLength = aLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaInitiliaze::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaJoin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaJoin.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaJoin class +* +*/ + +/* +* %version: 14 % +*/ + +#include "config.h" +#include "UmacWsaJoin.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaJoin::iName[] = "wsa-join"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaJoin::WlanWsaJoin() : + iMode( static_cast(0) ), + iBSSID ( WHA::KZeroMacAddr), iBand( 0 ), + iChannel( 0 ), iBeaconInterval( 0 ), + iBasicRateSet( 0 ), iAtimWindow( 0 ), + iPreambleType( static_cast(0) ), + iProbeForJoin( EFalse ) + { + iSSID.iSSIDLength = 0; + os_memset( &iSSID.iSSID, 0, sizeof( iSSID.iSSID ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaJoin::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + +#ifndef NDEBUG + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry") ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry: iMode: %d"), + iMode ); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaJoin::Entry(): BSSID:"), + reinterpret_cast(iBSSID) ); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaJoin::Entry: SSID:") ); + TUint8 ssidTraceBuf[KMaxSSIDLength + 1]; // + 1 for NULL termination + os_memset( ssidTraceBuf, 0, sizeof( ssidTraceBuf ) ); + os_memcpy( ssidTraceBuf, iSSID.iSSID, iSSID.iSSIDLength ); + OsTracePrint( KWsaCmdStateDetails, ssidTraceBuf ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry: iChannel: %d"), + iChannel ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry: iBeaconInterval: %d"), + iBeaconInterval ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry: iBasicRateSet: 0x%08x"), + iBasicRateSet ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry: iAtimWindow: %d"), + iAtimWindow ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaJoin::Entry: iPreambleType: %d"), + iPreambleType ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*)("UMAC: WlanWsaJoin::Entry(): iProbeForJoin: %d"), + iProbeForJoin ); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-Join") ); +#endif // !NDEBUG + + // execute the command + aCtxImpl.Wha().Join( + iMode, iBSSID, iSSID, iBand, iChannel, + iBeaconInterval, iBasicRateSet, iAtimWindow, + iPreambleType, iProbeForJoin ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaJoin::Set( + WlanContextImpl& /*aCtxImpl*/, + WHA::TOperationMode aMode, + WHA::TMacAddress& aBSSID, + WHA::TBand aBand, + WHA::SSSID& aSSID, + WHA::TChannelNumber aChannel, + TUint32 aBeaconInterval, + WHA::TRate aBasicRateSet, + TUint16 aAtimWindow, + WHA::TPreamble aPreambleType, + TBool aProbeForJoin ) + { + iMode = aMode; + iBSSID = aBSSID; + iSSID = aSSID; + iBand = aBand; + iChannel = aChannel; + iBeaconInterval = aBeaconInterval; + iBasicRateSet = aBasicRateSet; + iAtimWindow = aAtimWindow; + iPreambleType = aPreambleType; + iProbeForJoin = aProbeForJoin; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaJoin::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaJoin::CommandResponse") ); + + if ( aCommandId == WHA::EJoinResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaJoin::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaKeyIndexMapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaKeyIndexMapper.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaKeyIndexMapper class +* +*/ + +/* +* %version: 11 % +*/ + +#include "config.h" +#include "UmacWsaKeyIndexMapper.h" + +// ============================ MEMBER FUNCTIONS =============================== + + +inline TUint32 WlanWsaKeyIndexMapper::HandleWepPairwiseKey() + { + return KWepPairWiseKey; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleWepGroupKey( + TUint32 aDefaultKeyNumber ) + { + return aDefaultKeyNumber; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleTkipGroupKey() + { + return KTkipGroupKey; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleTkipPairWiseKey() + { + return KTkipPairWiseKey; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleAesPairwiseKey() + { + return KAesPairWiseKey; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleAesGroupKey() + { + return KAesGroupKey; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleWapiPairwiseKey() + { + return KWapiPairWiseKey; + } + +inline TUint32 WlanWsaKeyIndexMapper::HandleWapiGroupKey() + { + return KWapiGroupKey; + } + +TUint8 WlanWsaKeyIndexMapper::Extract( + WHA::TKeyType aKeyType, + TUint32 aDefaultKeyNumber ) + { + TUint32 ret(0); + + if ( aKeyType == WHA::EWepGroupKey ) + { + ret = HandleWepGroupKey( aDefaultKeyNumber ); + } + else if ( aKeyType == WHA::EWepPairWiseKey ) + { + ret = HandleWepPairwiseKey(); + } + else if ( aKeyType == WHA::ETkipGroupKey ) + { + ret = HandleTkipGroupKey(); + } + else if ( aKeyType == WHA::ETkipPairWiseKey ) + { + ret = HandleTkipPairWiseKey(); + } + else if ( aKeyType == WHA::EAesGroupKey ) + { + ret = HandleAesGroupKey(); + } + else if ( aKeyType == WHA::EAesPairWiseKey ) + { + ret = HandleAesPairwiseKey(); + } + else if ( aKeyType == WHA::EWapiGroupKey ) + { + ret = HandleWapiGroupKey(); + } + else if ( aKeyType == WHA::EWapiPairWiseKey ) + { + ret = HandleWapiPairwiseKey(); + } + else + { + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: WlanWsaKeyIndexMapper::Extract(): aKeyType: %d"), aKeyType ); + OsAssert( (TUint8*)("UMAC: panic"),(TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + }; diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaReadMib.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaReadMib.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaReadMib class +* +*/ + +/* +* %version: 12 % +*/ + +#include "config.h" +#include "UmacWsaReadMib.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaReadMib::iName[] = "wsa-readmib"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaReadMib::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdState, + (TUint8*)("WlanWsaReadMib::Entry: MIB ID: 0x%04x"), iMib); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-ReadMib") ); + + // execute the command + aCtxImpl.Wha().ReadMib( iMib ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaReadMib::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCmdState, + (TUint8*)("UMAC: WlanWsaReadMib::CommandResponse") ); + + if ( aCommandId == WHA::EReadMIBResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaReadMib::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaScan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaScan.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaScan class +* +*/ + +/* +* %version: 15 % +*/ + +#include "config.h" +#include "UmacWsaScan.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaScan::iName[] = "wsa-scan"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWsaScan::~WlanWsaScan() + { + iChannels = NULL; + iSsid = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaScan::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaScan::Entry: iMaxTransmitRate: 0x%08x"), + iMaxTransmitRate ); + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaScan::Entry: iScanType: %d"), iScanType ); + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaScan::Entry: iNumOfProbeRequests: %d"), + iNumOfProbeRequests ); + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaScan::Entry: iSplitScan: %d"), iSplitScan ); + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaScan::Entry: iNumOfSSID: %d"), iNumOfSSID ); + +#ifndef NDEBUG + if ( iNumOfSSID ) + { + TUint8 ssidTraceBuf[KMaxSSIDLength + 1]; // + 1 for NULL termination + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaScan::Entry: SSIDs:") ); + + const WHA::SSSID* ssid_end = iSsid + iNumOfSSID; + + for ( const WHA::SSSID* ssid_ptr = iSsid + ; ssid_ptr != ssid_end ; ++ssid_ptr ) + { + // trace the SSIDs + + os_memset( ssidTraceBuf, 0, sizeof( ssidTraceBuf ) ); + os_memcpy( ssidTraceBuf, ssid_ptr->iSSID, ssid_ptr->iSSIDLength ); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaScan::Entry: SSID length: %d, SSID:"), + ssid_ptr->iSSIDLength ); + OsTracePrint( KWsaCmdStateDetails, ssidTraceBuf ); + } + } +#endif // !NDEBUG + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-Scan") ); + + // execute the command + aCtxImpl.Wha().Scan( + iMaxTransmitRate, + iBand, + iNumOfChannels, + iChannels, + iScanType, + iNumOfProbeRequests, + iSplitScan, + iNumOfSSID, + iSsid ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaScan::Set( + WlanContextImpl& /*aCtxImpl*/, + TUint32 aMaxTransmitRate, + WHA::TBand aBand, + TUint8 aNumOfChannels, + const WHA::SChannels* aChannels, + WHA::TScanType aScanType, + TUint8 aNumOfProbeRequests, + TBool aSplitScan, + TUint8 aNumOfSSID, + const WHA::SSSID* aSSID ) + { + iMaxTransmitRate = aMaxTransmitRate; + iBand = aBand; + iNumOfChannels = aNumOfChannels; + iChannels = aChannels; + iScanType = aScanType; + iNumOfProbeRequests = aNumOfProbeRequests; + iSplitScan = aSplitScan; + iNumOfSSID = aNumOfSSID; + iSsid = aSSID; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaScan::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCmdState, + (TUint8*)("UMAC* WlanWsaScan::CommandResponse()") ); + + if ( aCommandId == WHA::EScanCommandResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaScan::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaSetBssParameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaSetBssParameters.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaSetBssParameters class +* +*/ + +/* +* %version: 12 % +*/ + +#include "config.h" +#include "UmacWsaSetBssParameters.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaSetBssParameters::iName[] = "wsa-setbssparameters"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaSetBssParameters::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWsaSetBssParameters::Entry") ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaSetBssParameters::Entry: iDtim: %d"), iDtim ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaSetBssParameters::Entry: iAid: %d"), iAid ); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-SetBssParameters") ); + + // execute the command + aCtxImpl.Wha().SetBssParameters( iDtim, iAid ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaSetBssParameters::Set( + WlanContextImpl& /*aCtxImpl*/, + TUint32 aDtim, + TUint32 aAid ) + { + iDtim = aDtim; + iAid = aAid; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaSetBssParameters::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCmdState, + (TUint8*)("UMAC: WlanWsaSetBssParameters::CommandResponse") ); + + if ( aCommandId == WHA::ESetBssParametersResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaSetBssParameters::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaSetPsMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaSetPsMode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaSetPsMode class +* +*/ + +/* +* %version: 11 % +*/ + +#include "config.h" +#include "UmacWsaSetPsMode.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaSetPsMode::iName[] = "wsa-setpsmode"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaSetPsMode::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("WlanWsaSetPsMode::Entry: PsMode: %d"), iPsMode); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-SetPsMode") ); + + // execute the command + aCtxImpl.Wha().SetPsMode( iPsMode ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaSetPsMode::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCmdState, + (TUint8*)("UMAC: WlanWsaSetPsMode::CommandResponse") ); + + if ( aCommandId == WHA::ESetPsModeCommandResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaSetPsMode::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaWriteMib.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaWriteMib.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaWriteMib class +* +*/ + +/* +* %version: 13 % +*/ + +#include "config.h" +#include "UmacWsaWriteMib.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWsaWriteMib::iName[] = "wsa-writemib"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaWriteMib::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaWriteMib::Entry: MIB ID: 0x%04x"), iMib); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaWriteMib::Entry: total mib length: %d"), iLength); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWsaWriteMib::Entry: complete mib contents:"), + reinterpret_cast(iData), + reinterpret_cast(iData) + iLength ); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-WriteMib") ); + + // execute the command + // for now we will always set the aMore field to false + const WHA::TStatus status( + aCtxImpl.Wha().WriteMib( iMib, iLength, iData, EFalse ) ); + + if ( status == WHA::KSuccess ) + { + // command was executed synchronously + // and no command response event is pending + // we shall request a dfc in order to break the context + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaWriteMib::Entry: command executed synchronously: request dfc: status %d"), + status); + DfcPending( ETrue ); + aCtxImpl.iUmac.RegisterDfc( &aCtxImpl ); + } + else + { + // command is executed asynchronously + // and command response event is pending + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaWriteMib::Exit( WlanContextImpl& aCtxImpl) + { + // mark WSA cmd inactive + aCtxImpl.DeActivateWsaCmd(); + + if ( DfcPending() ) + { + // dfc is pending and we are departing this state + // only valid use case for taking this path is + // that we have received an error indication + + // no we just must cancel the pending dfc so + // that it won't get executed in a wrong state + + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanWsaWriteMib::Exit: state exit while dfc pending -> canceling dfc")); + + DfcPending( EFalse ); + aCtxImpl.iUmac.CancelDfc(); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaWriteMib::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WlanWsaWriteMib::CommandResponse") ); + + if ( aCommandId != WHA::EWriteMIBResponse ) + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaWriteMib::OnDfc( TAny* aCtx ) + { + // only valid reason for us to land here is, + // that we have executed a synchronous MIB write + + OsTracePrint( KWsaCmdState, (TUint8*)("UMAC: WlanWsaWriteMib:OnDfc")); + + DfcPending( EFalse ); // mark dfc non pending + + WHA::UCommandResponseParams dont_care; + CommandResponse( *(static_cast(aCtx)), + WHA::EWriteMIBResponse, WHA::KSuccess, dont_care ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWsaWriteMib::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacactivemodepowermodemgr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacactivemodepowermodemgr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanActiveModePowerModeMgr class +* +*/ + +/* +* %version: 13 % +*/ + +#include "config.h" +#include "umacactivemodepowermodemgr.h" +#include "UmacContextImpl.h" + + +// Default Rx/Tx frame count threshold for considering change to Light PS mode. +// This value is used if another value hasn't been provided +const TUint KDefaultToLightPsFrameThreshold = 1; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanActiveModePowerModeMgr::WlanActiveModePowerModeMgr() : + iToLightPsFrameCount( 0 ), + iToLightPsFrameThreshold( KDefaultToLightPsFrameThreshold ) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanActiveModePowerModeMgr::~WlanActiveModePowerModeMgr() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanActiveModePowerModeMgr::OnFrameTx( + WlanContextImpl& /*aCtxImpl*/, + WHA::TQueueId /*aQueueId*/, + TUint16 aEtherType, + TBool aIgnoreThisFrame ) + { + if ( aEtherType == KEapolType || + aEtherType == KWaiType ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanActiveModePowerModeMgr::OnFrameTx: count this frame; eapol or WAI") ); + + ++iToLightPsFrameCount; + } + else + { + if ( aIgnoreThisFrame ) + { + // for these frames we don't increment the Tx counter + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanActiveModePowerModeMgr::OnFrameTx: do not count this frame") ); + } + else + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanActiveModePowerModeMgr::OnFrameTx: count this frame") ); + + ++iToLightPsFrameCount; + } + } + + return ENoChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanActiveModePowerModeMgr::OnFrameRx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TDaType aDaType ) + { + if ( CountThisFrame( + aCtxImpl, + aAccessCategory, + aEtherType, + aIgnoreThisFrame, + aPayloadLength, + iUapsdRxFrameLengthThreshold, + aDaType ) ) + { + ++iToLightPsFrameCount; + } + + return ENoChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanActiveModePowerModeMgr::OnActiveToLightPsTimerTimeout() + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanActiveModePowerModeMgr::OnActiveToLightPsTimerTimeout: ToLightPsFrameCount: %d"), + iToLightPsFrameCount ); + + if ( iToLightPsFrameCount < iToLightPsFrameThreshold ) + { + return ETrue; + } + else + { + iToLightPsFrameCount = 0; + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanActiveModePowerModeMgr::DoReset() + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanActiveModePowerModeMgr::DoReset()") ); + + iToLightPsFrameCount = 0; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacaddbroadcastwepkey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacaddbroadcastwepkey.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,388 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanAddBroadcastWepKey class +* +*/ + +/* +* %version: 6 % +*/ + +#include "config.h" +#include "umacaddbroadcastwepkey.h" +#include "UmacContextImpl.h" +#include "UmacWsaAddKey.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaKeyIndexMapper.h" + +#ifndef NDEBUG +const TInt8 WlanAddBroadcastWepKey::iName[] + = "wsacomplex-addbroadcastwepkey"; + +const TUint8 WlanAddBroadcastWepKey::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EADDGROUPKEY"}, + {"EWRITEMIB"}, + {"EADDPAIRWISEKEY"}, + {"EFINIT"} + }; + +const TUint8 WlanAddBroadcastWepKey::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, {"ETXCOMPLETE"}, {"EABORT"} + }; +#endif // !NDEBUG + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::Set( + const TMacAddress& aMac, + TUint32 aKeyIndex, + TBool aUseAsDefaulKey, + TBool aUseAsPairwiseKey, + TUint32 aKeyLength, + const TUint8 aKey[KMaxWEPKeyLength] ) + { + ((aUseAsPairwiseKey) ? (iFlags |= KUseAsPairwiseKey) + : (iFlags &= ~KUseAsPairwiseKey)); + ((aUseAsDefaulKey) ? (iFlags |= KUseAsDefaultKey) + : (iFlags &= ~KUseAsDefaultKey)); + + iMacAddr = aMac; + iKeyIndex = aKeyIndex; + iKeyLength = aKeyLength; + iKey = aKey; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::Exit( + WlanContextImpl& aCtxImpl) + { + iState = EINIT; + // make sure we don't leak memory + // don't worry about the key material as the memory associated + // to it is released at command completion time + os_free( iMemory ); + iMemory = NULL; + + // complete client request + Dot11History().AddDefaultBroadcastWepKeyComplete( aCtxImpl ); + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanAddBroadcastWepKey::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanAddBroadcastWepKey::Fsm: FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*)("UMAC: event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*)("UMAC: state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif // !NDEBUG + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif // !NDEBUG + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + const TUint KAllocLen( 100 ); + + switch ( iState ) + { + case EINIT: + iMemory = os_alloc( KAllocLen ); + if ( iMemory ) + { + // start the FSM traversal + ChangeInternalState( aCtxImpl, + EADDGROUPKEY ); + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + break; + case EADDGROUPKEY: + AddGroupKey( aCtxImpl ); + break; + case EWRITEMIB: + WriteMib( aCtxImpl ); + break; + case EADDPAIRWISEKEY: + AddPairwiseKey( aCtxImpl ); + break; + case EFINIT: + // fsm execution complete traverse back to history state + // after signalling completion in the Exit method + TraverseToHistoryState( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif // !NDEBUG + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EADDGROUPKEY: + if ( UseAsDefaultKey() ) + { + ChangeInternalState( aCtxImpl, EWRITEMIB ); + } + else if ( UseAsPairwiseKey() ) + { + ChangeInternalState( aCtxImpl, EADDPAIRWISEKEY ); + } + else + { + // not to be used as default key or PTK + // we can end this fsm + ChangeInternalState( aCtxImpl, EFINIT ); + } + break; + case EWRITEMIB: + if ( UseAsPairwiseKey() ) + { + ChangeInternalState( aCtxImpl, EADDPAIRWISEKEY ); + } + else + { + // not to be used as PTK + // we can end this fsm + ChangeInternalState( aCtxImpl, EFINIT ); + } + break; + case EADDPAIRWISEKEY: + ChangeInternalState( aCtxImpl, EFINIT ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif // !NDEBUG + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// WlanAddBroadcastWepKey::OnAbortEvent +// simulate macnotresponding error +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanAddBroadcastWepKey::OnAbortEvent") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::AddGroupKey( + WlanContextImpl& aCtxImpl ) + { + // store info of default WEP GTK insertion + aCtxImpl.GroupKeyType( WHA::EWepGroupKey ); + + WHA::SWepGroupKey* key_cnxt = static_cast(iMemory); + + key_cnxt->iKeyId = static_cast(iKeyIndex); + key_cnxt->iKeyLengthInBytes = iKeyLength; + os_memcpy( key_cnxt->iKey, iKey, key_cnxt->iKeyLengthInBytes ); + + WlanWsaAddKey& wha_cmd( aCtxImpl.WsaAddKey() ); + wha_cmd.Set( aCtxImpl, + WHA::EWepGroupKey, + key_cnxt, + WlanWsaKeyIndexMapper::Extract( + WHA::EWepGroupKey, key_cnxt->iKeyId ) + ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::AddPairwiseKey( + WlanContextImpl& aCtxImpl ) + { + WHA::SWepPairwiseKey* key_cnxt( + static_cast(iMemory) ); + + os_memcpy( + &(key_cnxt->iMacAddr), + iMacAddr.iMacAddress, + sizeof(key_cnxt->iMacAddr) ); + key_cnxt->iKeyLengthInBytes = iKeyLength; + os_memcpy( key_cnxt->iKey, iKey, key_cnxt->iKeyLengthInBytes ); + + WlanWsaAddKey& wha_cmd( aCtxImpl.WsaAddKey() ); + wha_cmd.Set( aCtxImpl, + WHA::EWepPairWiseKey, + key_cnxt, + WlanWsaKeyIndexMapper::Extract( WHA::EWepPairWiseKey ) ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanAddBroadcastWepKey::WriteMib( + WlanContextImpl& aCtxImpl ) + { + // allocate memory for the mib to write + WHA::Sdot11WepDefaultKeyId* mib( + static_cast(iMemory) ); + + mib->iDot11WepDefaultKeyId = static_cast(iKeyIndex); + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, WHA::KMibDot11WepDefaultKeyId, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacconfiguretxautoratepolicy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacconfiguretxautoratepolicy.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,356 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanConfigureTxAutoRatePolicy class +* +*/ + +/* +* %version: 6 % +*/ + +#include "config.h" +#include "umacconfiguretxautoratepolicy.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" + +#ifndef RD_WLAN_DDK +#include +#else +#include +#endif + + +#ifndef NDEBUG +const TInt8 WlanConfigureTxAutoRatePolicy::iName[] + = "whacomplex-configuretxautoratepolicy"; + +const TUint8 WlanConfigureTxAutoRatePolicy::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETAUTORATEPOLICY"}, + {"EFINIT"} + }; + +const TUint8 WlanConfigureTxAutoRatePolicy::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"EABORT"} + }; +#endif // !NDEBUG + +// length of txAutoRatePolicy MIB +const TUint16 KtxAutoRatePolicyMibLen = sizeof( WHA::StxAutoRatePolicy ); + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanConfigureTxAutoRatePolicy::WlanConfigureTxAutoRatePolicy() : + iState ( EINIT ), + iCompleteMgmtRequest ( EFalse ), + iTxAutoRatePolicyMib ( NULL ), + iNumberOfPolicyClassesToConfigure ( 0 ), + iRatePolicyClass ( 0 ) + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanConfigureTxAutoRatePolicy::~WlanConfigureTxAutoRatePolicy() + { + iTxAutoRatePolicyMib = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::Set( TBool aCompleteMgmtRequest ) + { + iCompleteMgmtRequest = aCompleteMgmtRequest; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { +#ifndef NDEBUG + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanConfigureTxAutoRatePolicy::Fsm: event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanConfigureTxAutoRatePolicy::Fsm: state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + // determine the number of rate policy classes to set + iNumberOfPolicyClassesToConfigure = + (aCtxImpl.RatePolicy()).numOfPolicyObjects; + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanConfigureTxAutoRatePolicy::OnStateEntryEvent: nbr of policy classes to configure: %d"), + iNumberOfPolicyClassesToConfigure ); + + // rate policy class IDs start from 1, so that's the 1st to + // configure + iRatePolicyClass = 1; + // allocate memory for the MIB to write + iTxAutoRatePolicyMib = + static_cast( + os_alloc( KtxAutoRatePolicyMibLen ) ); + + if ( iTxAutoRatePolicyMib ) + { + // start the FSM traversal + ChangeInternalState( aCtxImpl, ESETAUTORATEPOLICY ); + } + else + { + // allocation failure, abort processing + Fsm( aCtxImpl, EABORT ); + } + break; + case ESETAUTORATEPOLICY: + SetAutoRatePolicy( aCtxImpl ); + break; + case EFINIT: + // fsm execution complete. + + // complete WLAN Mgmt Client request, if necessary + if ( iCompleteMgmtRequest ) + { + OnOidComplete( aCtxImpl, KErrNone ); + } + + // Traverse back to history state + TraverseToHistoryState( aCtxImpl ); + break; + default: + // cath internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ESETAUTORATEPOLICY: + + // one (more) rate policy class has been set + ++iRatePolicyClass; + + if ( iRatePolicyClass <= iNumberOfPolicyClassesToConfigure ) + { + // we haven't configured all the rate policy classes, yet + // so proceed with the next one by re-entering the current + // internal state + ChangeInternalState( aCtxImpl, ESETAUTORATEPOLICY ); + } + else + { + // all rate policy classes have been set. We are done + ChangeInternalState( aCtxImpl, EFINIT ); + } + + break; + default: + // cath internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// simulate macnotresponding error +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC: WlanConfigureTxAutoRatePolicy::OnAbortEvent") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::SetAutoRatePolicy( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanConfigureTxAutoRatePolicy::SetAutoRatePolicy") ); + + // retrieve reference to the stored rate policy information + const TTxRatePolicy& ratePolicy ( aCtxImpl.RatePolicy() ); + // ... and to the stored auto rate policy + TTxAutoRatePolicy& autoRatePolicy ( aCtxImpl.AutoRatePolicy() ); + // ... and to the stored HT MCS policy information + const THtMcsPolicy& htMcsPolicy ( aCtxImpl.HtMcsPolicy() ); + + // 1st clear + os_memset( iTxAutoRatePolicyMib, 0, KtxAutoRatePolicyMibLen ); + + // set the mib contents. Note that because rate policy class IDs start from + // 1 and array indexes from 0 we need to subtract one from the rate policy + // class ID when accessing corresponding arrays + + iTxAutoRatePolicyMib->iBAndGRates = autoRatePolicy[iRatePolicyClass - 1]; + iTxAutoRatePolicyMib->iTxRateClassId = iRatePolicyClass; + iTxAutoRatePolicyMib->iShortRetryLimit = + ratePolicy.txRateClass[iRatePolicyClass - 1].shortRetryLimit; + iTxAutoRatePolicyMib->iLongRetryLimit = + ratePolicy.txRateClass[iRatePolicyClass - 1].longRetryLimit; + + os_memcpy( + iTxAutoRatePolicyMib->iMcsSet, + &(htMcsPolicy[iRatePolicyClass - 1]), + sizeof( WHA::THtMcsSet ) ); + + WlanWsaWriteMib& whaCmd = aCtxImpl.WsaWriteMib(); + whaCmd.Set( + aCtxImpl, + WHA::KMibTxAutoRatePolicy, + KtxAutoRatePolicyMibLen, + iTxAutoRatePolicyMib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + whaCmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxAutoRatePolicy::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + iState = EINIT; + os_free( iTxAutoRatePolicyMib ); + iTxAutoRatePolicyMib = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanConfigureTxAutoRatePolicy::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacconfiguretxqueueparams.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacconfiguretxqueueparams.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of WlanConfigureTxQueueParams class +* +*/ + +/* +* %version: 12 % +*/ + +#include "config.h" +#include "umacconfiguretxqueueparams.h" +#include "UmacContextImpl.h" +#include "umacwhaconfigurequeue.h" +#include "umacwhaconfigureac.h" + +#ifndef NDEBUG +const TInt8 WlanConfigureTxQueueParams::iName[] + = "wsacomplex-configuretxqueueparams"; + +const TUint8 WlanConfigureTxQueueParams::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ECONFIGUREBESTEFFORTQUEUE"}, + {"ECONFIGUREVOICEQUEUE"}, + {"ECONFIGUREVIDEOQUEUE"}, + {"ECONFIGUREBACKGROUNDQUEUE"}, + {"ECONFIGUREAC"}, + {"EFINIT"} + }; + +const TUint8 WlanConfigureTxQueueParams::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"} + }; +#endif // !NDEBUG + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KUmacDetails, + (TUint8*)("UMAC: WlanConfigureTxQueueParams::Fsm(): FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanConfigureTxQueueParams::Fsm(): event:")); + OsTracePrint( KUmacDetails, iEventName[aEvent] ); + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanConfigureTxQueueParams::Fsm(): state:")); + OsTracePrint( KUmacDetails, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + ChangeInternalState( aCtxImpl, ECONFIGUREBESTEFFORTQUEUE ); + break; + case ECONFIGUREBESTEFFORTQUEUE: + ConfigureQueue( aCtxImpl, WHA::ELegacy ); + break; + case ECONFIGUREVOICEQUEUE: + ConfigureQueue( aCtxImpl, WHA::EVoice ); + break; + case ECONFIGUREVIDEOQUEUE: + ConfigureQueue( aCtxImpl, WHA::EVideo ); + break; + case ECONFIGUREBACKGROUNDQUEUE: + ConfigureQueue( aCtxImpl, WHA::EBackGround ); + break; + case ECONFIGUREAC: + ConfigureAc( aCtxImpl ); + break; + case EFINIT: + // fsm execution complete traverse back to history state + TraverseToHistoryState( aCtxImpl ); + break; + default: + // cath internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ECONFIGUREBESTEFFORTQUEUE: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONFIGUREVOICEQUEUE ); + break; + case ECONFIGUREVOICEQUEUE: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONFIGUREVIDEOQUEUE ); + break; + case ECONFIGUREVIDEOQUEUE: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONFIGUREBACKGROUNDQUEUE ); + break; + case ECONFIGUREBACKGROUNDQUEUE: + // continue state traversal + ChangeInternalState( aCtxImpl, ECONFIGUREAC ); + break; + case ECONFIGUREAC: + // continue state traversal + ChangeInternalState( aCtxImpl, EFINIT ); + break; + default: + // cath internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::ConfigureQueue( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aQueueId ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanConfigureTxQueueParams::ConfigureQueue") ); + + WHA::TPsScheme psScheme( WHA::ERegularPs ); + + // enable U-APSD for the AC/Queue in question if necessary. + // Otherwise stick to regular PS + switch ( aQueueId ) + { + case WHA::ELegacy: + if ( aCtxImpl.UapsdUsedForBestEffort() ) + { + psScheme = WHA::EUapsd; + } + break; + case WHA::EBackGround: + if ( aCtxImpl.UapsdUsedForBackground() ) + { + psScheme = WHA::EUapsd; + } + break; + case WHA::EVideo: + if ( aCtxImpl.UapsdUsedForVideo() ) + { + psScheme = WHA::EUapsd; + } + break; + case WHA::EVoice: + if ( aCtxImpl.UapsdUsedForVoice() ) + { + psScheme = WHA::EUapsd; + } + break; + default: + // catch programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: ERROR: non-supported queue, aQueueId: %d"), aQueueId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + WlanWhaConfigureQueue& wha_command = aCtxImpl.WhaConfigureQueue(); + + wha_command.Set( + aQueueId, + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[aQueueId], + psScheme, + WHA::ENormal, + aCtxImpl.iWlanMib.iMediumTime[aQueueId] ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_command // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::ConfigureAc( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( + KUmacDetails, + (TUint8*)("UMAC: WlanConfigureTxQueueParams::ConfigureAc()") ); + + WlanWhaConfigureAc& wha_command = aCtxImpl.WhaConfigureAc(); + + wha_command.Set( + aCtxImpl.CwMinVector(), + aCtxImpl.CwMaxVector(), + aCtxImpl.AifsVector(), + aCtxImpl.TxOplimitVector() ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_command // next state + ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanConfigureTxQueueParams::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + iState = EINIT; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanConfigureTxQueueParams::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdeeppsmodepowermodemgr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdeeppsmodepowermodemgr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDeepPsModePowerModeMgr class +* +*/ + +/* +* %version: 3 % +*/ + +#include "config.h" +#include "umacdeeppsmodepowermodemgr.h" +#include "UmacContextImpl.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDeepPsModePowerModeMgr::WlanDeepPsModePowerModeMgr() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDeepPsModePowerModeMgr::~WlanDeepPsModePowerModeMgr() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanDeepPsModePowerModeMgr::OnFrameTx( + WlanContextImpl& /*aCtxImpl*/, + WHA::TQueueId /*aQueueId*/, + TUint16 aEtherType, + TBool /*aIgnoreThisFrame*/ ) + { + TPowerMgmtModeChange powerMgmtModeChange( ENoChange ); + + if ( aEtherType == KEapolType || + aEtherType == KWaiType ) + { + powerMgmtModeChange = EToActive; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameTx: EAPOL or WAI frame; change to Active") ); + } + else + { + powerMgmtModeChange = EToLightPs; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameTx: change to Light PS") ); + } + + return powerMgmtModeChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanDeepPsModePowerModeMgr::OnFrameRx( + WlanContextImpl& /*aCtxImpl*/, + WHA::TQueueId /*aAccessCategory*/, + TUint16 aEtherType, + TBool /*aIgnoreThisFrame*/, + TUint /*aPayloadLength*/, + TDaType aDaType ) + { + TPowerMgmtModeChange powerMgmtModeChange( ENoChange ); + + if ( aEtherType == KEapolType || + aEtherType == KWaiType ) + { + powerMgmtModeChange = EToActive; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: EAPOL or WAI frame; change to Active") ); + } + else if ( aDaType == EBroadcastAddress ) + { + // no action needed + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: bcast frame; no state change") ); + } + else + { + powerMgmtModeChange = EToLightPs; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDeepPsModePowerModeMgr::OnFrameRx: change to Light PS") ); + } + + return powerMgmtModeChange; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssnormalmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11IbssNormalMode class. +* +*/ + +/* +* %version: 14 % +*/ + +#include "config.h" +#include "umacdot11ibssnormalmode.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanDot11IbssNormalMode::iName[] = "dot11ibss::dot11-normalmode"; +#endif + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11IbssNormalMode::Entry( + WlanContextImpl& /*aCtxImpl*/ ) + { + // nothing here + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11IbssNormalMode::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // nothing here + } + +#ifndef NDEBUG +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const TInt8* WlanDot11IbssNormalMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11IbssNormalMode::Disconnect( + WlanContextImpl& aCtxImpl ) + { + // set completion code to idle state + // as it does the request completion + aCtxImpl.iStates.iIdleState.Set( KErrNone ); + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iSoftResetState // next state + ); + + // notify of state transition + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11IbssNormalMode::Connect( + WlanContextImpl& aCtxImpl, + const TSSID& aSSID, + const TMacAddress& aBSSID, + TUint16 /*aAuthAlgorithmNbr*/, + TEncryptionStatus aEncryptionStatus, + TBool /*aIsInfra*/, + TUint16 aScanResponseFrameBodyLength, + const TUint8* aScanResponseFrameBody, + const TUint8* aIeData, + TUint16 aIeDataLength ) + { + TBool ret( ETrue ); + + (aCtxImpl.GetBssId())= aBSSID; + (aCtxImpl.GetSsId()) = aSSID; + (aCtxImpl.EncryptionStatus()) = aEncryptionStatus; + aCtxImpl.NetworkOperationMode( WHA::EIBSS ); + + // store Tx IE data for later access + // pointers supplied are valid to the point the + // corresponding completion method is called + aCtxImpl.IeData( aIeData ); + aCtxImpl.IeDataLength( aIeDataLength ); + + + // check do we meet the requirements for the network + // and construct necessary objects for establishing the connection + if ( InitNetworkConnect( + aCtxImpl, + aScanResponseFrameBodyLength, + aScanResponseFrameBody ) ) + { + // continue + + // make WHA types + WHA::SSSID ssid; + ssid.iSSIDLength = aSSID.ssidLength; + os_memcpy( ssid.iSSID, aSSID.ssid, ssid.iSSIDLength ); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iPrepareForIbssMode // next state + ); + } + else // --- InitNetworkConnect failure --- + { + // abort + ret = EFalse; + OnOidComplete( aCtxImpl, KErrGeneral ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11IbssNormalMode::RealScan( + WlanContextImpl& aCtxImpl, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + // scanning mode requested + // set parameters + // NOTE: OID command parameters are guaranteed to be valid + // to the point a correcponding completion method is called + + aCtxImpl.iStates.iIbssScanningMode.Set( + aCtxImpl, aMode, aSSID, aScanRate, aChannels, + aMinChannelTime, aMaxChannelTime, aSplitScan ); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIbssScanningMode // next state + ); + return ETrue; // global statemachine transition will occur + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11IbssNormalMode::OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + OsTracePrint( KWlmIndication | KRxFrame, (TUint8*) + ("UMAC: WlanDot11IbssNormalMode::OnBeaconFrameRx")); + + // pass the frame to the mgmt client + XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssscanningmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssscanningmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,654 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11IbssScanningMode class. +* +*/ + +/* +* %version: 17 % +*/ + +#include "config.h" +#include "umacdot11ibssscanningmode.h" +#include "umacscanfsmcntx.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaScan.h" +#include "umacwhastopscan.h" +#include "umacwhatodot11typeconverter.h" + +#ifndef NDEBUG +const TInt8 WlanDot11IbssScanningMode::iName[] = "dot11-ibssscanningmode"; + +const TUint8 WlanDot11IbssScanningMode::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EEXECUTESCANFSM"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11IbssScanningMode::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"ESTARTSCANNINGMODE"}, + {"ESCANMODERUNNING"}, + {"ESTOPSCANNINGMODE"}, + {"ESCANNINGMODEEXIT"}, + {"EABORT"} + }; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11IbssScanningMode::~WlanDot11IbssScanningMode() + { + iCtxImpl = NULL; + iSSID = NULL; + iChannels = NULL; + iPimpl = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::Set( + WlanContextImpl& aCtxImpl ) + { + iCtxImpl = &aCtxImpl; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::Set( + WlanContextImpl& /*aCtxImpl*/, + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + // we can store pointers as oid parameters are guaranteed to be valid + // to the point the corresponding completion method is called + iMode = aMode; + iSSID = &aSSID; + iScanRate = aScanRate; + iChannels = &aChannels; + iMinChannelTime = aMinChannelTime; + iMaxChannelTime = aMaxChannelTime; + iSplitScan = aSplitScan; + } + +// ----------------------------------------------------------------------------- +// The internal state transition method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// The event dispatcher method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KScan, + (TUint8*)("UMAC * dot11-ibssscanningmode * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KScan, (TUint8*)("event:")); + OsTracePrint( KScan, iEventName[aEvent] ); + OsTracePrint( KScan, (TUint8*)("state:")); + OsTracePrint( KScan, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ESTARTSCANNINGMODE: + OnStartScanningModeEvent( aCtxImpl ); + break; + case ESCANMODERUNNING: + OnScanModeRunningEvent( aCtxImpl ); + break; + case ESTOPSCANNINGMODE: + OnStopScanningModeEvent( aCtxImpl ); + break; + case ESCANNINGMODEEXIT: + OnScanningModeExitEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + iPimpl = static_cast + (os_alloc( sizeof(WlanScanFsmCntx) )); + if ( iPimpl ) + { + // allocation success + new (iPimpl) WlanScanFsmCntx( *this ); + // start fsm traversal + ChangeInternalState( aCtxImpl, EEXECUTESCANFSM ); + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + + break; + case EEXECUTESCANFSM: + ExecuteScanFsm( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // cath internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnTxCompleteEvent( + WlanContextImpl& /*aCtxImpl*/ ) const + { + switch ( iState ) + { + case EEXECUTESCANFSM: + // we are running the scan fsm + // and we have nothing to do here + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnStartScanningModeEvent( + WlanContextImpl& aCtxImpl ) + { + // start the scanning mode + + // convert scan parameters to WHA types + // Note that we need to deallocate the memory from whaChannels + // - which is allocated in ConvertToWhaTypes() - when we are done + + WHA::SSSID* wha_ssid = + static_cast(os_alloc( sizeof(WHA::SSSID) )); + if ( !wha_ssid ) + { + // memory allocation failue; that's fatal + Fsm( aCtxImpl, EABORT ); + return; + } + + WHA::SChannels* wha_channels( NULL ); + TUint8 wha_channelcount( 0 ); + + if ( !(WlanWhaToDot11TypeConverter::ConvertToWhaTypes( + aCtxImpl, + iSSID, + *wha_ssid, + iChannels, + iMinChannelTime, + iMaxChannelTime, + wha_channels, + wha_channelcount )) ) + { + // memory allocation failue; that's fatal + os_free( wha_ssid ); + Fsm( aCtxImpl, EABORT ); + } + else + { + // start the scanning process + + const TUint8 KNbrOfProbeReqsPerCh = 2; + const TUint8 KNoProbeReqs = 0; + const TUint8 KNbrOfSsids = 1; + const TUint8 KNoSsids = 0; + + // 1st set the context + aCtxImpl.WsaScan().Set( + aCtxImpl, + iScanRate, + iChannels->iBand, + wha_channelcount, + wha_channels, + WHA::EFgScan, + (iMode == EActiveScan) ? KNbrOfProbeReqsPerCh : KNoProbeReqs, + iSplitScan, + wha_ssid->iSSIDLength ? KNbrOfSsids : KNoSsids, + wha_ssid ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaScan() // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( wha_ssid ); + os_free( wha_channels ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnScanModeRunningEvent( + WlanContextImpl& aCtxImpl ) const + { + // complete the scan request + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IbssScanningMode::OnScanModeRunningEvent: Complete scan request") ); + OnOidComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnStopScanningModeEvent( + WlanContextImpl& aCtxImpl ) + { + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WhaStopScan() // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnScanningModeExitEvent( + WlanContextImpl& aCtxImpl ) + { + // scanning mode has stopped and so can we + + // inform the mgmt client about scan completion + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IbssScanningMode::OnScanningModeExitEvent: Send scan complete indication")); + + OnInDicationEvent( aCtxImpl, EScanCompleted ); + + // continue with the dot11 state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-ibssscanningmode * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::ExecuteScanFsm( + WlanContextImpl& /*aCtxImpl*/ ) + { + // start scan fsm + iPimpl->Current().StartScanningMode( *iPimpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + // return back + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIbssNormalMode // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for WHA command response event. +// It is guaranteed by the global protocol fsm framework that no WHA command is +// pending when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ) + { + if ( aCommandId == WHA::EScanCommandResponse ) + { + OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStarted")); + + // morph event to the scan fsm + iPimpl->Current().OnScanningModeStarted( *iPimpl ); + } + else if ( aCommandId == WHA::EStopScanResponse ) + { + // complete the stop scan request + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IbssScanningMode::OnWhaCommandResponse: complete stop scan request")); + + OnOidComplete( aCtxImpl ); + } + else + { + // this is a response to a command that was not generated + // by this dot11 state object + // so let's forward it to the default handler + WlanDot11State::OnWhaCommandResponse( + aCtxImpl, + aCommandId, + aStatus, + aCommandResponseParams, + aAct ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for WHA command completion event. +// It is guaranteed by the global protocol fsm framework that no WHA command is +// pending when this method is entered +// ----------------------------------------------------------------------------- +// +TBool WlanDot11IbssScanningMode::CommandComplete( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandCompletionParams& /*aCommandCompletionParams*/ ) + { + if ( aCompleteCommandId != WHA::EScanComplete ) + { + // implementation error as this can be the only one + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStopped")); + + // morph event to scan fsm + iPimpl->Current().OnScanningModeStopped( *iPimpl ); + + // as scanning mode has ended we will change dot11 state. + // Signal it to caller + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TAny* WlanDot11IbssScanningMode::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + return aCtxImpl.GetRxBuffer( aLength ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + // as we have a beacon frame + // we will pass it to the client of the mgmt interface + XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnProbeResponseFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + // as we have a probe response frame + // we will pass it to the client of the mgmt interface + XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // we don't want to do full event dispatching here as we want + // to run this dot11 state in non pre-emptive mode. + // However, we do want to handle the scan complete event in case it has + // been registered + if ( aCtxImpl.CommandCompletionEventRegistered( WHA::EScanComplete ) ) + { + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IbssScanningMode::Entry: Scan complete event registered") ); + + aCtxImpl.DispatchCommandCompletionEvent(); + // in this case we have actually already changed to another state + // so there's nothing more for us to do here + } + else + { + // scan complete event not registered. Continue in the normal fashion + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // reset fsm + iState = EINIT; + + // get rid of scan fsm implementation + iPimpl->~WlanScanFsmCntx(); + os_free( iPimpl ); + iPimpl = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11IbssScanningMode::StopScan( WlanContextImpl& /*aCtxImpl*/ ) + { + // inform scan fsm that scanning mode stop is desired + iPimpl->Current().StopScanningMode( *iPimpl ); + // indicate that a state change has occurred + return ETrue; + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11IbssScanningMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// Handler for scan fsm event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IbssScanningMode::OnScanFsmEvent( + MWlanScanFsmCb::TEvent aEvent ) + { + OsTracePrint( KScan, (TUint8*) + ("UMAC * dot11-ibssscanningmode * SCAN FSM EVENT: %d"), aEvent ); + + // do what the scan fsm desires + switch( aEvent ) + { + case EFSMSTARTSCANNINGMODE: + // scanning mode start desired + Fsm( *iCtxImpl, ESTARTSCANNINGMODE ); + break; + case EFSMSCANMODERUNNING: + // scanning mode is running + Fsm( *iCtxImpl, ESCANMODERUNNING ); + break; + case EFSMSTOPSCANNINGMODE: + // scanning mode stop desired + Fsm( *iCtxImpl, ESTOPSCANNINGMODE ); + break; + + case EFSMSCANMODESTOPPED: + // scanning mode has stopped + Fsm( *iCtxImpl, ESCANNINGMODEEXIT ); + break; + default: + // catch scan FSM programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC* scan fsm event: :%d"), aEvent); + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11idlescanningmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11idlescanningmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,728 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11IdleScanningMode class. +* +*/ + +/* +* %version: 19 % +*/ + +#include "config.h" +#include "umacdot11idlescanningmode.h" +#include "umacscanfsmcntx.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaScan.h" +#include "umacwhastopscan.h" +#include "umacwhatodot11typeconverter.h" + +#ifndef NDEBUG +const TInt8 WlanDot11IdleScanningMode::iName[] = "dot11-idlescanningmode"; + +const TUint8 WlanDot11IdleScanningMode::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETSLEEPMODE"}, + {"EEXECUTESCANFSM"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11IdleScanningMode::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"ESTARTSCANNINGMODE"}, + {"ESCANMODERUNNING"}, + {"ESTOPSCANNINGMODE"}, + {"ESCANNINGMODEEXIT"}, + {"EABORT"} + }; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11IdleScanningMode::~WlanDot11IdleScanningMode() + { + iCtxImpl = NULL; + iChannels = NULL; + iSSID = NULL; + iPimpl = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::Set( + WlanContextImpl& aCtxImpl ) + { + iCtxImpl = &aCtxImpl; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::Set( + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan ) + { + // we can store pointers as oid parameters are guaranteed to be valid + // to the point the corresponding completion method is called + iMode = aMode; + iSSID = &aSSID; + iScanRate = aScanRate; + iChannels = &aChannels; + iMinChannelTime = aMinChannelTime; + iMaxChannelTime = aMaxChannelTime; + iSplitScan = aSplitScan; + } + +// ----------------------------------------------------------------------------- +// The internal state transition method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// The event dispatcher method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KScan, + (TUint8*)("UMAC * dot11-idlescanningmode * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KScan, (TUint8*)("event:")); + OsTracePrint( KScan, iEventName[aEvent] ); + OsTracePrint( KScan, (TUint8*)("state:")); + OsTracePrint( KScan, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ESTARTSCANNINGMODE: + OnStartScanningModeEvent( aCtxImpl ); + break; + case ESCANMODERUNNING: + OnScanModeRunningEvent( aCtxImpl ); + break; + case ESTOPSCANNINGMODE: + OnStopScanningModeEvent( aCtxImpl ); + break; + case ESCANNINGMODEEXIT: + OnScanningModeExitEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + iPimpl = static_cast + (os_alloc( sizeof(WlanScanFsmCntx) )); + if ( iPimpl ) + { + // allocation success + new (iPimpl) WlanScanFsmCntx( *this ); + // start fsm traversal + if ( aCtxImpl.Reassociate() ) + { + // a roaming case + ChangeInternalState( aCtxImpl, EEXECUTESCANFSM ); + } + else + { + // not a roaming case + ChangeInternalState( aCtxImpl, ESETSLEEPMODE ); + } + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + + break; + case ESETSLEEPMODE: + SetSleepMode( aCtxImpl ); + break; + case EEXECUTESCANFSM: + ExecuteScanFsm( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ESETSLEEPMODE: + ChangeInternalState( aCtxImpl, EEXECUTESCANFSM ); + break; + case EEXECUTESCANFSM: + // we are running the scan fsm + // and we have nothing to do here + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnStartScanningModeEvent( + WlanContextImpl& aCtxImpl ) + { + // start the scanning mode + + // convert scan parameters to WHA types + // Note that we need to deallocate the memory from whaChannels + // - which is allocated in ConvertToWhaTypes() - when we are done + + WHA::SSSID* wha_ssid = + static_cast(os_alloc( sizeof(WHA::SSSID) )); + if ( !wha_ssid ) + { + // memory allocation failue; that's fatal + Fsm( aCtxImpl, EABORT ); + return; + } + + WHA::SChannels* wha_channels( NULL ); + TUint8 wha_channelcount( 0 ); + + if ( !(WlanWhaToDot11TypeConverter::ConvertToWhaTypes( + aCtxImpl, + iSSID, + *wha_ssid, + iChannels, + iMinChannelTime, + iMaxChannelTime, + wha_channels, + wha_channelcount )) ) + { + // memory allocation failue; that's fatal + os_free( wha_ssid ); + Fsm( aCtxImpl, EABORT ); + } + else + { + // start the scanning process + + const TUint8 KNbrOfProbeReqsPerCh = 2; + const TUint8 KNoProbeReqs = 0; + const TUint8 KNbrOfSsids = 1; + const TUint8 KNoSsids = 0; + + // 1st set the context + aCtxImpl.WsaScan().Set( + aCtxImpl, + iScanRate, + iChannels->iBand, + wha_channelcount, + wha_channels, + WHA::EFgScan, + (iMode == EActiveScan) ? KNbrOfProbeReqsPerCh : KNoProbeReqs, + iSplitScan, + wha_ssid->iSSIDLength ? KNbrOfSsids : KNoSsids, + wha_ssid ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaScan() // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( wha_ssid ); + os_free( wha_channels ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnScanModeRunningEvent( + WlanContextImpl& aCtxImpl ) const + { + // complete the scan request + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IdleScanningMode::OnScanModeRunningEvent: Complete scan request") ); + OnOidComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnStopScanningModeEvent( + WlanContextImpl& aCtxImpl ) + { + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WhaStopScan() // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnScanningModeExitEvent( + WlanContextImpl& aCtxImpl ) + { + // scanning mode has stopped and so can we + + // request the next state (dot11IdleState) to inform the mgmt client about + // scan completion upon state entry + aCtxImpl.iStates.iIdleState.CompleteScanUponEntry(); + + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-idlescanningmode * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::SetSleepMode( + WlanContextImpl& aCtxImpl ) + { + WHA::SsleepMode* mib + = static_cast + (os_alloc( sizeof( WHA::SsleepMode ) )); + + if ( !mib ) + { + // this is fatal + Fsm( aCtxImpl, EABORT ); + return; + } + + mib->iMode = WHA::KPowerDownMode; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + wha_cmd.Set( + aCtxImpl, WHA::KMibSleepMode, sizeof(*mib), mib ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::ExecuteScanFsm( + WlanContextImpl& /*aCtxImpl*/ ) + { + // start scan fsm + iPimpl->Current().StartScanningMode( *iPimpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + // return back to dot11idle + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iIdleState // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for WHA command response event. +// It is guaranteed by the global protocol fsm framework that no WHA command is +// pending when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandResponseParams& /*aCommandResponseParams*/, + TUint32 /*aAct*/ ) + { + if ( aCommandId == WHA::EScanCommandResponse ) + { + OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStarted")); + + // morph event to the scan fsm + iPimpl->Current().OnScanningModeStarted( *iPimpl ); + } + else if ( aCommandId == WHA::EStopScanResponse ) + { + // complete the stop scan request + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IdleScanningMode::OnWhaCommandResponse: complete stop scan request")); + + OnOidComplete( aCtxImpl ); + } + else + { + // has to be the write mib command response. + // We have nothing to do here + } + } + +// ----------------------------------------------------------------------------- +// Handler for WHA command completion event. +// It is guaranteed by the global protocol fsm framework that no WHA command is +// pending when this method is entered +// ----------------------------------------------------------------------------- +// +TBool WlanDot11IdleScanningMode::CommandComplete( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandCompletionParams& /*aCommandCompletionParams*/ ) + { + if ( aCompleteCommandId != WHA::EScanComplete ) + { + // implementation error as this can be the only one + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStopped")); + + // morph event to scan fsm + iPimpl->Current().OnScanningModeStopped( *iPimpl ); + + // as scanning mode has ended we will change dot11 state. + // Signal it to caller + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TAny* WlanDot11IdleScanningMode::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + return aCtxImpl.GetRxBuffer( aLength ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::ReceivePacket( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + const void* aFrame, + TUint16 aLength, + WHA::TRate /*aRate*/, + WHA::TRcpi aRcpi, + WHA::TChannelNumber /*aChannel*/, + TUint8* aBuffer, + TUint32 /*aFlags*/ ) + { + if ( aStatus == WHA::KSuccess ) + { + // frame reception success + + const Sdot11MacHeader* hdr + = reinterpret_cast(const_cast(aFrame)); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: dot11-idlescanningmode * frame rx * frame type: 0x%02x"), + hdr->iFrameControl.iType ); + + if ( (hdr->iFrameControl.iType + == E802Dot11FrameTypeBeacon) + || (hdr->iFrameControl.iType + == E802Dot11FrameTypeProbeResp) ) + { + // as we have a beacon or probe response frame we will pass it to + // the client of the mgmt interface + XferDot11FrameToMgmtClient( + aCtxImpl, + aFrame, + aLength, + aRcpi, + aBuffer ); + } + else + { + // other than scan frame received. This may be legal if the frame + // was received before receiving WHA::CommandResponse for WHA::Scan + // cmd. However, in other cases it may be an implementation error + // in the underlying adaptation layer. In any case the frame is not + // applicable for us as we are doing dot11idle mode scan (we are + // not connected) and we will ignore it + OsTracePrint( KRxFrame | KWarningLevel, (TUint8*) + ("UMAC: WlanDot11IdleScanningMode::ReceivePacket: WARNING: Other than scan frame received. Frame type: 0x%02x"), + hdr->iFrameControl.iType ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + else + { + // frame reception failure + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC * dot11-idlescanningmode * frame rx failure * status: %d"), + aStatus ); + + // release the Rx buffer + aCtxImpl.iUmac.MarkRxBufFree( aBuffer ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // we don't want to do full event dispatching here as we want + // to run this dot11 state in non pre-emptive mode. + // However, we do want to handle the scan complete event in case it has + // been registered + if ( aCtxImpl.CommandCompletionEventRegistered( WHA::EScanComplete ) ) + { + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11IdleScanningMode::Entry: Scan complete event registered") ); + + aCtxImpl.DispatchCommandCompletionEvent(); + // in this case we have actually already changed to another state + // so there's nothing more for us to do here + } + else + { + // scan complete event not registered. Continue in the normal fashion + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // reset fsm + iState = EINIT; + + // get rid of scan fsm implementation + iPimpl->~WlanScanFsmCntx(); + os_free( iPimpl ); + iPimpl = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11IdleScanningMode::StopScan( WlanContextImpl& /*aCtxImpl*/ ) + { + // inform scan fsm that scanning mode stop is desired + iPimpl->Current().StopScanningMode( *iPimpl ); + // indicate that a state change has occurred + return ETrue; + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11IdleScanningMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// Handler for scan fsm event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11IdleScanningMode::OnScanFsmEvent( + MWlanScanFsmCb::TEvent aEvent ) + { + OsTracePrint( KScan, (TUint8*) + ("UMAC: * dot11-idlescanningmode * SCAN FSM EVENT: %d"), aEvent ); + + // do what the scan fsm desires + switch( aEvent ) + { + case EFSMSTARTSCANNINGMODE: + // scanning mode start desired + Fsm( *iCtxImpl, ESTARTSCANNINGMODE ); + break; + case EFSMSCANMODERUNNING: + // scanning mode is running + Fsm( *iCtxImpl, ESCANMODERUNNING ); + break; + case EFSMSTOPSCANNINGMODE: + // scanning mode stop desired + Fsm( *iCtxImpl, ESTOPSCANNINGMODE ); + break; + + case EFSMSCANMODESTOPPED: + // scanning mode has stopped + Fsm( *iCtxImpl, ESCANNINGMODEEXIT ); + break; + default: + // catch scan FSM programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: scan fsm event: :%d"), aEvent); + OsAssert( (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurenormalmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurenormalmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11InfrastructureNormalMode +* class. +* +*/ + +/* +* %version: 14 % +*/ + +#include "config.h" +#include "umacdot11infrastructurenormalmode.h" +#include "UmacContextImpl.h" +#include "umacoidmsg.h" + +#ifndef NDEBUG +const TInt8 WlanDot11InfrastructureNormalMode::iName[] + = "dot11infrastructure::dot11-normalmode"; +#endif + + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureNormalMode::ChangePowerMgmtMode( + WlanContextImpl& aCtxImpl ) + { + // initialize the counter which we use to determine if we should + // indicate BSS lost if we continuously are unsuccessful in changing the + // power mgmt mode + aCtxImpl.InitializeSetPsModeCount(); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iPwrMgmtTransitionMode // next state + ); + return ETrue; // signal caller that a state change occurred + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureNormalMode::OnActiveToLightPsTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + TBool statechange( EFalse ); + + if ( aCtxImpl.OnActiveToLightPsTimerTimeout() ) + { + // change to Light PS mode desired + + aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsEnable ); + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientLightPsModeConfig() ); + + // proceed with the mode change + statechange = ChangePowerMgmtMode( aCtxImpl ); + } + + return statechange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureNormalMode::OnLightPsToActiveTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + TBool statechange( EFalse ); + + if ( aCtxImpl.OnLightPsToActiveTimerTimeout() ) + { + // change to Active mode desired + + aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsDisable ); + + // proceed with the mode change + statechange = ChangePowerMgmtMode( aCtxImpl ); + } + + return statechange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureNormalMode::OnLightPsToDeepPsTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + TBool statechange( EFalse ); + + if ( aCtxImpl.OnLightPsToDeepPsTimerTimeout() ) + { + // change to Deep PS mode desired + + aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsEnable ); + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientDeepPsModeConfig() ); + + // proceed with the mode change + statechange = ChangePowerMgmtMode( aCtxImpl ); + } + + return statechange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureNormalMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( ( aCtxImpl.ClientDot11PwrMgmtMode() == WHA::KPsEnable ) && + ( !aCtxImpl.DisassociatedByAp() ) && + ( !aCtxImpl.DynamicPwrModeMgtDisabled() ) ) + { + // activate dynamic power mode management + aCtxImpl.StartPowerModeManagement(); + } + + // dispatch an event that might be pending as we + // can come here from dot11-pwrmgmttransitionmode state + // which has enabled oid deferring to eventdispatcher + aCtxImpl.DispatchEvent(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDot11InfrastructureNormalMode::Exit( + WlanContextImpl& aCtxImpl) + { + // deactivate dynamic power mode management + aCtxImpl.StopPowerModeManagement(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanDot11InfrastructureNormalMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureNormalMode::OnDot11PwrMgmtTransitRequired( + WlanContextImpl& aCtxImpl ) + { + // initialize the counter which we use to determine if we should + // indicate BSS lost if we continuously are unsuccessful in changing the + // power mgmt mode + aCtxImpl.InitializeSetPsModeCount(); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iPwrMgmtTransitionMode // next state + ); + + OnOidComplete( aCtxImpl ); + // global statemachine transition will occur + return ETrue; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurescanningmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11infrastructurescanningmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,732 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11InfrastructureScanningMode +* class. +* +*/ + +/* +* %version: 21 % +*/ + +#include "config.h" +#include "umacdot11infrastructurescanningmode.h" +#include "umacscanfsmcntx.h" +#include "UmacContextImpl.h" +#include "UmacWsaWriteMib.h" +#include "UmacWsaScan.h" +#include "umacwhastopscan.h" +#include "umacwhatodot11typeconverter.h" + + +#ifndef NDEBUG +const TInt8 WlanDot11InfrastructureScanningMode::iName[] + = "dot11-infrastructurescanningmode"; + +const TUint8 WlanDot11InfrastructureScanningMode::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"EEXECUTESCANFSM"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11InfrastructureScanningMode::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"ESTARTSCANNINGMODE"}, + {"ESCANMODERUNNING"}, + {"ESTOPSCANNINGMODE"}, + {"ESCANNINGMODEEXIT"}, + {"EABORT"} + }; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanDot11InfrastructureScanningMode::~WlanDot11InfrastructureScanningMode() + { + iCtxImpl = NULL; + iSSID = NULL; + iChannels = NULL; + iPimpl = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::Set( + WlanContextImpl& aCtxImpl ) + { + iCtxImpl = &aCtxImpl; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::Set( + TScanMode aMode, + const TSSID& aSSID, + TUint32 aScanRate, + SChannels& aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + TBool aSplitScan, + WHA::TScanType aScanType ) + { + // we can store pointers as oid parameters are guaranteed to be valid + // to the point the corresponding completion method is called + iMode = aMode; + iSSID = &aSSID; + iScanRate = aScanRate; + iChannels = &aChannels; + iMinChannelTime = aMinChannelTime; + iMaxChannelTime = aMaxChannelTime; + iSplitScan = aSplitScan; + iScanType = aScanType; + } + +// ----------------------------------------------------------------------------- +// The internal state transition method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// The event dispatcher method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KScan, + (TUint8*)("UMAC * dot11-infrastructurescanningmode * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KScan, (TUint8*)("event:")); + OsTracePrint( KScan, iEventName[aEvent] ); + OsTracePrint( KScan, (TUint8*)("state:")); + OsTracePrint( KScan, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case ESTARTSCANNINGMODE: + OnStartScanningModeEvent( aCtxImpl ); + break; + case ESCANMODERUNNING: + OnScanModeRunningEvent( aCtxImpl ); + break; + case ESTOPSCANNINGMODE: + OnStopScanningModeEvent( aCtxImpl ); + break; + case ESCANNINGMODEEXIT: + OnScanningModeExitEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case EINIT: + iPimpl = static_cast + (os_alloc( sizeof(WlanScanFsmCntx) )); + if ( iPimpl ) + { + // allocation success + new (iPimpl) WlanScanFsmCntx( *this ); + // start fsm traversal + ChangeInternalState( aCtxImpl, EEXECUTESCANFSM ); + } + else + { + // allocation failure + Fsm( aCtxImpl, EABORT ); + } + + break; + case EEXECUTESCANFSM: + ExecuteScanFsm( aCtxImpl ); + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnTxCompleteEvent( + WlanContextImpl& /*aCtxImpl*/ ) const + { + switch ( iState ) + { + case EEXECUTESCANFSM: + // we are running the scan fsm + // and we have nothing to do here + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnStartScanningModeEvent( + WlanContextImpl& aCtxImpl ) + { + // start the scanning mode + + // convert scan parameters to WHA types + // Note that we need to deallocate the memory from whaChannels + // - which is allocated in ConvertToWhaTypes() - when we are done + + WHA::SSSID* wha_ssid = + static_cast(os_alloc( sizeof(WHA::SSSID) )); + if ( !wha_ssid ) + { + // memory allocation failue; that's fatal + Fsm( aCtxImpl, EABORT ); + return; + } + + WHA::SChannels* wha_channels( NULL ); + TUint8 wha_channelcount( 0 ); + + if ( !(WlanWhaToDot11TypeConverter::ConvertToWhaTypes( + aCtxImpl, + iSSID, + *wha_ssid, + iChannels, + iMinChannelTime, + iMaxChannelTime, + wha_channels, + wha_channelcount )) ) + { + // memory allocation failue; that's fatal + os_free( wha_ssid ); + Fsm( aCtxImpl, EABORT ); + } + else + { + // start the scanning process + + const TUint8 KNbrOfProbeReqsPerCh = 2; + const TUint8 KNoProbeReqs = 0; + const TUint8 KNbrOfSsids = 1; + const TUint8 KNoSsids = 0; + + // in the most common case we use forced background + // scan, so that we wouldn't lose data frames while scanning. + if ( aCtxImpl.DisassociatedByAp() ) + { + if ( aCtxImpl.CurrentDot11PwrMgmtMode() == WHA::KPsDisable ) + { + // we have been disassociated by the AP and we are + // currently in Active mode => use foreground scan, so that we + // won't send the AP any more class 3 frames (to inform it + // about us moving to PS mode) + iScanType = WHA::EFgScan; + } + } + + // set the context + aCtxImpl.WsaScan().Set( + aCtxImpl, + iScanRate, + iChannels->iBand, + wha_channelcount, + wha_channels, + iScanType, + (iMode == EActiveScan) ? KNbrOfProbeReqsPerCh : KNoProbeReqs, + // in the normal case, do a split scan + iSplitScan, + wha_ssid->iSSIDLength ? KNbrOfSsids : KNoSsids, + wha_ssid ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WsaScan() // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( wha_ssid ); + os_free( wha_channels ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnScanModeRunningEvent( + WlanContextImpl& aCtxImpl ) const + { + // complete the scan request + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11InfrastructureScanningMode::OnScanModeRunningEvent: Complete scan request") ); + OnOidComplete( aCtxImpl ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnStopScanningModeEvent( + WlanContextImpl& aCtxImpl ) + { + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.WhaStopScan() // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnScanningModeExitEvent( + WlanContextImpl& aCtxImpl ) + { + // scanning mode has stopped and so can we + + // inform the mgmt client about scan completion + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11InfrastructureScanningMode::OnScanningModeExitEvent: Send scan complete indication")); + + OnInDicationEvent( aCtxImpl, EScanCompleted ); + + // continue with the dot11 state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-idlescanningmode * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::ExecuteScanFsm( + WlanContextImpl& /*aCtxImpl*/ ) + { + // start scan fsm + iPimpl->Current().StartScanningMode( *iPimpl ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + if ( iFlags & KDot11StateBackTrack ) + { + // recall previous dot11 state + ChangeState( aCtxImpl, + *this, // prev state + Dot11History() // next state + ); + } + else + { + // we go somewhere else + + if ( !(iFlags & KDot11PwrMgmtModeDifference) ) + { + // no dot11 power management mode difference + // between pre and post scanning mode detected + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iInfrastructureNormalMode // next state + ); + } + else + { + // dot11 power management mode difference + // between pre and post scanning mode detected + + // initialize the counter which we use to determine if we should + // indicate BSS lost if we continuously are unsuccessful in changing the + // power mgmt mode + aCtxImpl.InitializeSetPsModeCount(); + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iPwrMgmtTransitionMode // next state + ); + } + } + } + +// ----------------------------------------------------------------------------- +// Handler for WHA command response event. +// It is guaranteed by the global protocol fsm framework that no WHA command is +// pending when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnWhaCommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams, + TUint32 aAct ) + { + if ( aCommandId == WHA::EScanCommandResponse ) + { + OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStarted")); + + // morph event to the scan fsm + iPimpl->Current().OnScanningModeStarted( *iPimpl ); + } + else if ( aCommandId == WHA::EStopScanResponse ) + { + // complete the stop scan request + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11InfrastructureScanningMode::OnWhaCommandResponse: complete stop scan request")); + + OnOidComplete( aCtxImpl ); + } + else + { + // this is a response to a command that was not generated + // by this dot11 state object + // so let's forward it to the default handler + WlanDot11State::OnWhaCommandResponse( + aCtxImpl, + aCommandId, + aStatus, + aCommandResponseParams, + aAct ); + } + } + +// ----------------------------------------------------------------------------- +// Handler for WHA command completion event. +// It is guaranteed by the global protocol fsm framework that no WHA command is +// pending when this method is entered +// ----------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureScanningMode::CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus /*aStatus*/, + const WHA::UCommandCompletionParams& aCommandCompletionParams ) + { + if ( aCompleteCommandId != WHA::EScanComplete ) + { + // implementation error as this can be the only one + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + const WHA::TPsMode current_ps_mode( + aCommandCompletionParams.iScanComplete.iDot11PowerManagementMode ); + aCtxImpl.CurrentDot11PwrMgmtMode( current_ps_mode ); + + OsTracePrint( KPwrStateTransition | KScan, + (TUint8*)("current dot11 power managememnt mode after scanning mode: %d"), + current_ps_mode ); + + if ( current_ps_mode != aCtxImpl.DesiredDot11PwrMgmtMode() + && !(iFlags & KDot11StateBackTrack) ) + { + // difference in dot11 power management + // mode between actual and desired mode exists + // and we not in dot11 state backtrack mode + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-infrastructurescanningmode") ); + OsTracePrint( KWarningLevel, + (TUint8*)("difference in dot11 power management mode between") ); + OsTracePrint( KWarningLevel, + (TUint8*)("actual and desired mode detected") ); + OsTracePrint( KWarningLevel, (TUint8*)("post scanning mode state: %d"), + current_ps_mode ); + + iFlags |= KDot11PwrMgmtModeDifference; + } + + OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStopped")); + + // morph event to scan fsm + iPimpl->Current().OnScanningModeStopped( *iPimpl ); + + // as scanning mode has ended we will change dot11 state. + // Signal it to caller + return ETrue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TAny* WlanDot11InfrastructureScanningMode::RequestForBuffer( + WlanContextImpl& aCtxImpl, + TUint16 aLength ) + { + return aCtxImpl.GetRxBuffer( aLength ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnBeaconFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + // as we have a beacon frame + // we will pass it to the client of the mgmt interface + XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnProbeResponseFrameRx( + WlanContextImpl& aCtxImpl, + const TAny* aFrame, + const TUint32 aLength, + WHA::TRcpi aRcpi, + TUint8* aBuffer ) + { + // as we have a probe response frame + // we will pass it to the client of the mgmt interface + XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // we don't want to do full event dispatching here as we want + // to run this dot11 state in non pre-emptive mode. + // However, we do want to handle the scan complete event in case it has + // been registered + if ( aCtxImpl.CommandCompletionEventRegistered( WHA::EScanComplete ) ) + { + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanDot11InfrastructureScanningMode::Entry: Scan complete event registered") ); + + aCtxImpl.DispatchCommandCompletionEvent(); + // in this case we have actually already changed to another state + // so there's nothing more for us to do here + } + else + { + // scan complete event not registered. Continue in the normal fashion + + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::Exit( + WlanContextImpl& /*aCtxImpl*/ ) + { + // reset fsm + iFlags = 0; + iState = EINIT; + + // get rid of scan fsm implementation + iPimpl->~WlanScanFsmCntx(); + os_free( iPimpl ); + iPimpl = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11InfrastructureScanningMode::StopScan( + WlanContextImpl& /*aCtxImpl*/ ) + { + // inform scan fsm that scanning mode stop is desired + iPimpl->Current().StopScanningMode( *iPimpl ); + // indicate that a state change has occurred + return ETrue; + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11InfrastructureScanningMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// Handler for scan fsm event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11InfrastructureScanningMode::OnScanFsmEvent( + MWlanScanFsmCb::TEvent aEvent ) + { + OsTracePrint( KScan, (TUint8*) + ("UMAC * dot11-infrastructurescanningmode * SCAN FSM EVENT: %d"), aEvent ); + + // do what the scan fsm desires + switch( aEvent ) + { + case EFSMSTARTSCANNINGMODE: + // scanning mode start desired + Fsm( *iCtxImpl, ESTARTSCANNINGMODE ); + break; + case EFSMSCANMODERUNNING: + // scanning mode is running + Fsm( *iCtxImpl, ESCANMODERUNNING ); + break; + case EFSMSTOPSCANNINGMODE: + // scanning mode stop desired + Fsm( *iCtxImpl, ESTOPSCANNINGMODE ); + break; + case EFSMSCANMODESTOPPED: + // scanning mode has stopped + Fsm( *iCtxImpl, ESCANNINGMODEEXIT ); + break; + default: + // catch scan FSM programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC* scan fsm event: :%d"), aEvent); + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11pwrmgmttransitionmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11pwrmgmttransitionmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,677 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDot11PwrMgmtTransitionMode class. +* +*/ + +/* +* %version: 22 % +*/ + +#include "config.h" +#include "umacdot11pwrmgmttransitionmode.h" +#include "UmacContextImpl.h" +#include "UmacWsaSetPsMode.h" +#include "UmacWsaWriteMib.h" + +#ifndef NDEBUG +const TInt8 WlanDot11PwrMgmtTransitionMode::iName[] + = "dot11-pwrmgmttransitionmode"; + +const TUint8 WlanDot11PwrMgmtTransitionMode::iStateName + [ESTATEMAX][KMaxStateStringLength] = + { + {"EINIT"}, + {"ESETAWAKEMODE"}, + {"ESETWAKEUPINTERVAL"}, + {"ESETPSMODE"}, + {"EWAIT4PWRMGMTTRANSITCOMPLETE"}, + {"ECONTINUEDOT11TRAVERSE"} + }; + +const TUint8 WlanDot11PwrMgmtTransitionMode::iEventName + [EEVENTMAX][KMaxEventStringLength] = + { + {"ESTATEENTRY"}, + {"ETXCOMPLETE"}, + {"EPWRMGMTTRANSITCOMPLETE"}, + {"EABORT"} + }; +#endif + +// this flag is set if we only need to set the wakeup interval. +const TUint32 KOnlySetWakeupInterval = ( 1 << 0 ); +// this flag is set if the status of the latest Set Ps Mode cmd was Success +const TUint32 KSetPsModeSuccess = ( 1 << 1 ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// The internal state transition method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::ChangeInternalState( + WlanContextImpl& aCtxImpl, + TState aNewState ) + { + iState = aNewState; + Fsm( aCtxImpl, ESTATEENTRY ); + } + +// ----------------------------------------------------------------------------- +// The event dispatcher method. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::Fsm( + WlanContextImpl& aCtxImpl, + TEvent aEvent ) + { + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC * dot11-pwrmgmttransitionmode * FSM EVENT") ); +#ifndef NDEBUG + OsTracePrint( KPwrStateTransition, (TUint8*)("event:")); + OsTracePrint( KPwrStateTransition, iEventName[aEvent] ); + OsTracePrint( KPwrStateTransition, (TUint8*)("state:")); + OsTracePrint( KPwrStateTransition, iStateName[iState] ); +#endif + + switch ( aEvent ) + { + case ESTATEENTRY: + OnStateEntryEvent( aCtxImpl ); + break; + case ETXCOMPLETE: + OnTxCompleteEvent( aCtxImpl ); + break; + case EPWRMGMTTRANSITCOMPLETE: + OnPwrMgmtTransitCompleteEvent( aCtxImpl ); + break; + case EABORT: + OnAbortEvent( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("event:")); + OsTracePrint( KErrorLevel, iEventName[aEvent] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::OnStateEntryEvent( + WlanContextImpl& aCtxImpl ) + { + TState state( ESTATEMAX ); + + switch ( iState ) + { + case EINIT: + iFlags = 0; + // start of fsm traversal + // disable oid request so we run this fsm in non pre-emptive mode + // regarding oid commands + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC * dot11-pwrmgmttransitionmode * disable oid events") ); + + aCtxImpl.Disable( WlanEventDispatcher::KOidChannel ); + + if (// PS mode desired + aCtxImpl.DesiredDot11PwrMgmtMode() == WHA::KPsEnable + && // AND + // current mode is CAM + aCtxImpl.CurrentDot11PwrMgmtMode() == WHA::KPsDisable ) + { + // change to dot11 PS mode + // start by setting the wakeup interval + state = ESETWAKEUPINTERVAL; + } + else if (// CAM mode desired + aCtxImpl.DesiredDot11PwrMgmtMode() == WHA::KPsDisable + && // AND + // current mode is PS mode + aCtxImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) + { + // change to dot11 CAM mode + state = ESETAWAKEMODE; + } + else + { + // we have a dot11 power management mode match. + // We can land here e.g. if user changes desired + // dot11 power management mode when we are excuting this fsm + // as we dispacth an oid as the fsm entry action. + // We can come here also when only the wakeup interval needs + // to be changed + + // if the current mode is PS mode we have to make sure + // that we have a wakeup interval match + if ( aCtxImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) + { + // the way to do that is by re-setting (only) the wakeup + // interval - if necessary + iFlags |= KOnlySetWakeupInterval; + state = ESETWAKEUPINTERVAL; + } + else + { + // the current mode is CAM, so the wakeup interval is + // not relevant; and we are done + state = ECONTINUEDOT11TRAVERSE; + } + } + + ChangeInternalState( aCtxImpl, state ); + break; + case ESETAWAKEMODE: + ActivateDot11AwakeMode( aCtxImpl ); + break; + case ESETWAKEUPINTERVAL: + { + // first check if the wake-up setting already is what it should be. + // if that's the case, we won't set it again + + if ( DifferenceInPsModeWakeupSettings( aCtxImpl ) ) + { + // it's not what it needs to be, so set it + SetWakeUpInterval( aCtxImpl ); + } + else + { + // the wake-up setting is already correct, skip setting it again + // and simulate ETXCOMPLETE event instead + Fsm( aCtxImpl, ETXCOMPLETE ); + } + break; + } + case ESETPSMODE: + ActivateDot11PsMode( aCtxImpl ); + break; + case EWAIT4PWRMGMTTRANSITCOMPLETE: + // nothing to do here than just wait for completion + break; + case ECONTINUEDOT11TRAVERSE: + ContinueDot11StateTraversal( aCtxImpl ); + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::OnTxCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + switch ( iState ) + { + case ESETAWAKEMODE: + case ESETPSMODE: + // as transition has sterted now we just wait for it to complete + ChangeInternalState( aCtxImpl, EWAIT4PWRMGMTTRANSITCOMPLETE ); + break; + case ESETWAKEUPINTERVAL: + if ( iFlags & KOnlySetWakeupInterval ) + { + // we only needed to set the wakeup interval. So we are + // done now + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + else + { + // we also need to set the PS mode. This is the most common case + ChangeInternalState( aCtxImpl, ESETPSMODE ); + } + break; + case EWAIT4PWRMGMTTRANSITCOMPLETE: + // a re-entry to this state has occurred while waiting for the + // CommandComplete event to the SetPsMode cmd. + // This will happen when we autonomously issue a (new) WHA cmd - + // during the above mentioned wait period - to react to a change + // which has occurred in the network (e.g. in the Use Protection + // setting or in the QoS parameters). + // Anyhow, no action is required here (except to allow for this + // re-entry to happen) + break; + default: + // catch internal FSM programming error +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*)("state:")); + OsTracePrint( KErrorLevel, iStateName[iState] ); +#endif + OsAssert( (TUint8*)("* UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::OnPwrMgmtTransitCompleteEvent( + WlanContextImpl& aCtxImpl ) + { + // we can continue dot11 state traversal + ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE ); + } + +// --------------------------------------------------------- +// simulate macnotresponding error +// --------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::OnAbortEvent( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * dot11-pwrmgmttransitionmode * abort") ); + + DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::ActivateDot11AwakeMode( + WlanContextImpl& aCtxImpl ) + { + WlanWsaSetPsMode& wha_cmd( aCtxImpl.WsaSetPsMode() ); + wha_cmd.Set( aCtxImpl, WHA::KPsDisable ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::SetWakeUpInterval( + WlanContextImpl& aCtxImpl ) + { + WHA::SwlanWakeUpInterval* mib + = static_cast + (os_alloc( sizeof( WHA::SwlanWakeUpInterval ) )); + + if ( !mib ) + { + // allocation failed + // simulate macnotresponding error + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanDot11PwrMgmtTransitionMode::SetWakeUpInterval: alloc failed, abort") ); + Fsm( aCtxImpl, EABORT ); + return; + } + + // determine the desired new wake-up setting + const TDot11PsModeWakeupSetting KDesiredPsModeConfig ( + aCtxImpl.DesiredPsModeConfig() ); + + // take it into use + + mib->iMode = KDesiredPsModeConfig.iWakeupMode; + mib->iListenInterval = KDesiredPsModeConfig.iListenInterval; + + WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); + + wha_cmd.Set( + aCtxImpl, WHA::KMibWlanWakeUpInterval, sizeof(*mib), mib ); + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: UMAC: WlanDot11PwrMgmtTransitionMode::SetWakeUpInterval: desired mode: %d"), + mib->iMode ); + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC: desired listeninterval: %d"), mib->iListenInterval ); + + // store the new setting also locally + aCtxImpl.iWlanMib.iWlanWakeupInterval = mib->iMode; + aCtxImpl.iWlanMib.iWlanListenInterval = mib->iListenInterval; + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + + // as the parameters have been supplied we can now deallocate + os_free( mib ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::ActivateDot11PsMode( + WlanContextImpl& aCtxImpl ) + { + WlanWsaSetPsMode& wha_cmd( aCtxImpl.WsaSetPsMode() ); + wha_cmd.Set( aCtxImpl, WHA::KPsEnable ); + + // change global state: entry procedure triggers action + ChangeState( aCtxImpl, + *this, // prev state + wha_cmd // next state + ); + } + +// ----------------------------------------------------------------------------- +// Handler for the event. +// It is guaranteed by the FSM framework that no WHA command is pending +// when this method is entered +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::ContinueDot11StateTraversal( + WlanContextImpl& aCtxImpl ) + { + if ( !( iFlags & KOnlySetWakeupInterval ) ) + { + // we have tried to change the power mgmt mode with SetPsMode + // WHA command + + if ( iFlags & KSetPsModeSuccess ) + { + // the Set PS Mode WHA cmd was successfully executed, which means + // that we were able to communicate with the AP. + // So we can indicate BSS Regained; if necessary + DoRegainedBSSIndication( aCtxImpl ); + } + else + { + if ( !aCtxImpl.SetPsModeCount() ) + { + // the set power mgmt mode counter has counted down to zero, so + // we will indicate Consecutive Power Mode Set Failures (unless + // already indicated) to WLAN Mgmt Client + DoConsecutivePwrModeSetFailuresIndication( aCtxImpl ); + // reset the counter + aCtxImpl.SetPsModeCount(); + // it's possible that we come to this branch again shortly, + // but it really doesn't matter. In any case we will indicate + // Consecutive Power Mode Set Failures only once at maximum + } + else + { + // we have made one (more) unsuccessful attempt to set the power + // mgmt mode, so decrement the counter by one + aCtxImpl.DecrementSetPsModeCount(); + } + } + } + + TBool dot11PwrMgmtTransitComplete ( EFalse ); + const WHA::TPsMode KCurrentPwrMgmtMode( + aCtxImpl.CurrentDot11PwrMgmtMode() ); + + if ( KCurrentPwrMgmtMode == aCtxImpl.DesiredDot11PwrMgmtMode() ) + { + // current dot11 power management mode equals to desired mode + + if ( KCurrentPwrMgmtMode == WHA::KPsEnable ) + { + // as the current and desired mode is PS, we are only done + // if also the wakeup settings are as desired + if ( !DifferenceInPsModeWakeupSettings( aCtxImpl ) ) + { + dot11PwrMgmtTransitComplete = ETrue; + } + else + { + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC: wakeup settings not as desired") ); + } + } + else + { + // as the current and desired mode is CAM, we are done + dot11PwrMgmtTransitComplete = ETrue; + } + } + else + { + // current dot11 power management mode does not equal to desired mode. + // Se we are not done and will need to try to do the mode change again. + // No action here. + } + + if ( dot11PwrMgmtTransitComplete ) + { + // desired dot11 power management mode - and settings if the desired + // mode is PS - have been acquired + + ChangeState( aCtxImpl, + *this, // prev state + aCtxImpl.iStates.iInfrastructureNormalMode ); // next state + + if ( aCtxImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) + { + // as we have entered PS mode, it is time to resume QoS null + // data frame sending, if applicable + aCtxImpl.ResumeQosNullSending(); + } + } + else + { + // dot11 power management mode/settings are not as desired, yet. + // We shall repeat this process + + ChangeState( aCtxImpl, + *this, // prev state + *this // next state + ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::Entry( + WlanContextImpl& aCtxImpl ) + { + if ( aCtxImpl.WsaCmdActive() ) + { + // sanity checking code + OsAssert( + (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + if ( !(aCtxImpl.DispatchEvent()) ) + { + // no state transition occurred + // dispatcher might or might not have had an event to be dispatched + // in any case we are still in the current state and can continue... + if ( iState != EINIT ) + { + // this is NOT the start of the the FSM actions + // note that we send the ETXCOMPLETE event as the states + // that wait for it are the only ones that can be interrupted + // as they are asynchronous operations by nature + // and wait for corresponding WHA completion method + Fsm( aCtxImpl, ETXCOMPLETE ); + } + else + { + // this is the start of the the FSM actions + Fsm( aCtxImpl, ESTATEENTRY ); + } + } + else // --- !(aCtxImpl.DispatchEvent()) + { + // state transition occurred + // we are no longer in the current state, + // so we won't do anything as we might mess things up + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanDot11PwrMgmtTransitionMode::Exit( + WlanContextImpl& aCtxImpl) + { + // reset fsm + iState = EINIT; + + // enable oid requests as we are exiting this dot11 state + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC * dot11-pwrmgmttransitionmode * enable oid events") ); + + aCtxImpl.Enable( WlanEventDispatcher::KOidChannel ); + } + +#ifndef NDEBUG +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +const TInt8* WlanDot11PwrMgmtTransitionMode::GetStateName( + TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanDot11PwrMgmtTransitionMode::CommandComplete( + WlanContextImpl& aCtxImpl, + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& + aCommandCompletionParams ) + { + if ( aCompleteCommandId != WHA::ESetPsModeComplete ) + { + // implementation error + OsTracePrint( KErrorLevel, (TUint8*)("UMAC: command id: %d"), aCompleteCommandId); + OsAssert( (TUint8*)("UMAC panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC: WlanDot11PwrMgmtTransitionMode::CommandComplete")); + + const WHA::TPsMode KCurrentPwrMgmtMode( + aCommandCompletionParams.iSetPsModeComplete.iDot11PowerManagementMode ); + aCtxImpl.CurrentDot11PwrMgmtMode( KCurrentPwrMgmtMode ); + + // make a note whether the SetPsMode WHA command was executed successfully + // or not + if ( aStatus == WHA::KSuccess ) + { + iFlags |= KSetPsModeSuccess; + + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC: transition success: current mode: %d"), + KCurrentPwrMgmtMode); + } + else + { + iFlags &= ~KSetPsModeSuccess; + + OsTracePrint( KWarningLevel | KPwrStateTransition, + (TUint8*)("UMAC: transition failure: current mode: %d"), + KCurrentPwrMgmtMode); + } + + // continue fsm + Fsm( aCtxImpl, EPWRMGMTTRANSITCOMPLETE ); + + // signal global state transition + return ETrue; + } + +// ----------------------------------------------------------------------------- +// as oid reception is disbaled in this dot11 state, reception of this oid +// is a result of a manual oid dispatching +// ----------------------------------------------------------------------------- +// +TBool WlanDot11PwrMgmtTransitionMode::SetPowerMode( + WlanContextImpl& aCtxImpl, + TPowerMode aPowerMode, + TBool aDisableDynamicPowerModeManagement, + TWlanWakeUpInterval aWakeupModeInLightPs, + TUint8 aListenIntervalInLightPs, + TWlanWakeUpInterval aWakeupModeInDeepPs, + TUint8 aListenIntervalInDeepPs ) + { + OsTracePrint( KPwrStateTransition, + (TUint8*)("UMAC: WlanDot11PwrMgmtTransitionMode::SetPowerMode: desired power mode: %d"), + aPowerMode ); + + // store desired new dot11 power management mode by WLAN Mgmt Client + aCtxImpl.ClientDot11PwrMgmtMode( aPowerMode ); + + aCtxImpl.DynamicPwrModeMgtDisabled( aDisableDynamicPowerModeManagement ); + + // it is now also our desired dot11 power management mode + aCtxImpl.DesiredDot11PwrMgmtMode( aCtxImpl.ClientDot11PwrMgmtMode() ); + + aCtxImpl.SetClientLightPsModeConfig( + aWakeupModeInLightPs, + aListenIntervalInLightPs ); + + aCtxImpl.SetClientDeepPsModeConfig( + aWakeupModeInDeepPs, + aListenIntervalInDeepPs ); + + // in case WLAN Mgmt Client wishes to use PS mode, Light PS is the initial + // desired PS mode configuration + aCtxImpl.SetDesiredPsModeConfig( + aCtxImpl.ClientLightPsModeConfig() ); + + // complete the mgmt command + OnOidComplete( aCtxImpl ); + + // signal that no state transition occurred + return EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdynamicpowermodemgmtcntx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdynamicpowermodemgmtcntx.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,660 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDynamicPowerModeMgmtCntx class +* +*/ + +/* +* %version: 14 % +*/ + +#include "config.h" +#include "umacdynamicpowermodemgmtcntx.h" +#include "UmacContextImpl.h" + +// default time interval in microseconds after which transition from Active +// mode to Light PS mode is considered. +// This value is used if another value hasn't been provided +const TUint32 KDefaultToLightPsTimeout = 100000; // 100ms + +// default time interval in microseconds after which the frame counter +// used when considering transition from Light PS to Active mode is reset. +// This value is used if another value hasn't been provided +const TUint32 KDefaultToActiveTimeout = 300000; // 300ms + +// default time interval in microseconds after which transition from Light PS +// mode to Deep PS mode is considered. +// This value is used if another value hasn't been provided +const TUint32 KDefaultToDeepPsTimeout = 1000000; // 1s + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDynamicPowerModeMgmtCntx::WlanDynamicPowerModeMgmtCntx( + WlanContextImpl& aWlanCtxImpl ) : + iStateChange( EFalse ), + iFlags( 0 | KStayInPsDespiteUapsdVoiceTraffic ), + iToLightPsTimeout( KDefaultToLightPsTimeout ), + iToActiveTimeout( KDefaultToActiveTimeout ), + iToDeepPsTimeout( KDefaultToDeepPsTimeout ), + iActiveCntx( NULL ), + iWlanContextImpl( aWlanCtxImpl ) + { + os_memset( iIgnoreTraffic, 0, sizeof( iIgnoreTraffic ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDynamicPowerModeMgmtCntx::~WlanDynamicPowerModeMgmtCntx() + { + CancelTimeouts(); + iActiveCntx = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::StartPowerModeManagement() + { + if ( !iActiveCntx ) + { + const TPowerMgmtMode KCurrentPwrMgmtMode ( + iWlanContextImpl.CurrentPwrMgmtMode() ); + + switch ( KCurrentPwrMgmtMode ) + { + case EActive: + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::StartPowerModeManagement: Activating Active mode context") ); + + iActiveCntx = &iActiveModeCntx; + RegisterToLightPsTimeout(); + break; + case ELightPs: + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::StartPowerModeManagement: Activating Light PS mode context") ); + + iActiveCntx = &iLightPsModeCntx; + + if ( // we have roamed to the current AP + iWlanContextImpl.Reassociate() && + // we have not yet indicated to WLAN Mgmt Client the + // opportunity to perform tests on the current AP + !iWlanContextImpl.ApTestOpportunityIndicated() ) + { + // start to seek for the test opportunity + iWlanContextImpl.ApTestOpportunitySeekStarted( ETrue ); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::StartPowerModeManagement: Start AP test opportunity seek") ); + } + + RegisterToActiveTimeout(); + RegisterToDeepPsTimeout(); + break; + case EDeepPs: + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::StartPowerModeManagement: Activating Deep PS mode context") ); + + iActiveCntx = &iDeepPsModeCntx; + break; + default: + // implementation error + OsAssert( + (TUint8*)("UMAC: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); + } + + // reset active context prior use + iActiveCntx->Reset(); + // and also reset the state change flag + iStateChange = EFalse; + } + else + { + // we already have an active context, so no action needed + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::StopPowerModeManagement() + { + if ( iActiveCntx ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::StopPowerModeManagement: dynamic power mode mgmt stopped") ); + + CancelTimeouts(); + iStateChange = EFalse; + iActiveCntx = NULL; // no active context any more + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanDynamicPowerModeMgmtCntx::OnFrameTx( + WHA::TQueueId aQueueId, + TUint16 aEtherType ) + { + TPowerMgmtModeChange powerMgmtModeChange( ENoChange ); + + if ( iActiveCntx ) + { + // we have an active context, i.e. we are doing power mode mgmt + + if ( !iStateChange ) + { + powerMgmtModeChange = iActiveCntx->OnFrameTx( + iWlanContextImpl, + aQueueId, + aEtherType, + iIgnoreTraffic[aQueueId] ); + + if ( powerMgmtModeChange != ENoChange ) + { + // as we will do a mode change, cancel any possibly running + // power mode management timers + CancelTimeouts(); + } + } + else + { + // state change already signalled from this power mode context, + // don't do it more than once. No action needed + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnFrameTx: statechange already signalled") ); + } + } + else + { + // dynamic power mode mgmt is not active => "No change" will be + // returned. No action needed + } + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnFrameTx: statechange: %d"), + powerMgmtModeChange ); + + return powerMgmtModeChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanDynamicPowerModeMgmtCntx::OnFrameRx( + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TUint aPayloadLength, + TDaType aDaType ) + { + TPowerMgmtModeChange powerMgmtModeChange( ENoChange ); + + if ( iActiveCntx ) + { + // we have an active context, i.e. we are doing power mode mgmt + + if ( !iStateChange ) + { + powerMgmtModeChange = iActiveCntx->OnFrameRx( + iWlanContextImpl, + aAccessCategory, + aEtherType, + iIgnoreTraffic[aAccessCategory], + aPayloadLength, + aDaType ); + + if ( powerMgmtModeChange != ENoChange ) + { + // as we will do a mode change, cancel any possibly running + // power mode management timers + CancelTimeouts(); + } + } + else + { + // state change already signalled from this power mode context, + // don't do it more than once. No action needed + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnFrameRx: statechange already signalled") ); + } + } + else + { + // dynamic power mode mgmt is not active => "No change" will be + // returned. No action needed + } + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnFrameRx: statechange: %d"), + powerMgmtModeChange ); + + return powerMgmtModeChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDynamicPowerModeMgmtCntx::OnActiveToLightPsTimerTimeout() + { + if ( ( iActiveCntx == &iActiveModeCntx ) && + ( iFlags & KToLightPsTimerStarted ) && + ( !iStateChange ) ) + { + iFlags &= ~KToLightPsTimerStarted; + + iStateChange = iActiveCntx->OnActiveToLightPsTimerTimeout(); + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnActiveToLightPsTimerTimeout: change state: %d"), + iStateChange ); + + if ( !iStateChange ) + { + RegisterToLightPsTimeout(); + } + } + else + { + // either + // the timeout occurred in a wrong context or totally without an active + // context (i.e. when we are not doing dynamic power mode mgmt) OR + // the timer is not started, i.e. the timeout occurred when we weren't + // expecting it (which means that the timeout callback had already been + // registered when we tried to cancel this timer the previous time) OR + // a state change has already been signalled from this power mode + // context. + // In all these cases the timeout is not relevant and we take no action + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnActiveToLightPsTimerTimeout: not relevant timeout") ); + } + + return iStateChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDynamicPowerModeMgmtCntx::OnLightPsToActiveTimerTimeout() + { + if ( ( iActiveCntx == &iLightPsModeCntx ) && + ( iFlags & KToActiveTimerStarted ) && + ( !iStateChange ) ) + { + iFlags &= ~KToActiveTimerStarted; + + iStateChange = iActiveCntx->OnLightPsToActiveTimerTimeout( + iWlanContextImpl ); + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnLightPsToActiveTimerTimeout: change state: %d"), + iStateChange ); + + // as we currently never do a mode change when this timeout occurs, + // we arm the timer again + RegisterToActiveTimeout(); + } + else + { + // either + // the timeout occurred in a wrong context or totally without an active + // context (i.e. when we are not doing dynamic power mode mgmt) OR + // the timer is not started, i.e. the timeout occurred when we weren't + // expecting it (which means that the timeout callback had already been + // registered when we tried to cancel this timer the previous time) OR + // a state change has already been signalled from this power mode + // context. + // In all these cases the timeout is not relevant and we take no action + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnLightPsToActiveTimerTimeout: not relevant timeout") ); + } + + return iStateChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanDynamicPowerModeMgmtCntx::OnLightPsToDeepPsTimerTimeout() + { + if ( ( iActiveCntx == &iLightPsModeCntx ) && + ( iFlags & KToDeepPsTimerStarted ) && + ( !iStateChange ) ) + { + iFlags &= ~KToDeepPsTimerStarted; + + iStateChange = iActiveCntx->OnLightPsToDeepPsTimerTimeout(); + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnLightPsToDeepPsTimerTimeout: change state: %d"), + iStateChange ); + + if ( !iStateChange ) + { + RegisterToDeepPsTimeout(); + } + } + else + { + // either + // the timeout occurred in a wrong context or totally without an active + // context (i.e. when we are not doing dynamic power mode mgmt) OR + // the timer is not started, i.e. the timeout occurred when we weren't + // expecting it (which means that the timeout callback had already been + // registered when we tried to cancel this timer the previous time) OR + // a state change has already been signalled from this power mode + // context. + // In all these cases the timeout is not relevant and we take no action + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::OnLightPsToDeepPsTimerTimeout: not relevant timeout") ); + } + + return iStateChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::SetParameters( + TUint32 aToLightPsTimeout, + TUint16 aToLightPsFrameThreshold, + TUint32 aToActiveTimeout, + TUint16 aToActiveFrameThreshold, + TUint32 aToDeepPsTimeout, + TUint16 aToDeepPsFrameThreshold, + TUint16 aUapsdRxFrameLengthThreshold ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::SetParameters") ); + + iToLightPsTimeout = aToLightPsTimeout; + iActiveModeCntx.SetParameters( + aToLightPsFrameThreshold, + aUapsdRxFrameLengthThreshold ); + + iToActiveTimeout = aToActiveTimeout; + iToDeepPsTimeout = aToDeepPsTimeout; + iLightPsModeCntx.SetParameters( + aToActiveFrameThreshold, + aToDeepPsFrameThreshold, + aUapsdRxFrameLengthThreshold ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::ConfigureTrafficOverride( + TBool aStayInPsDespiteUapsdVoiceTraffic, + TBool aStayInPsDespiteUapsdVideoTraffic, + TBool aStayInPsDespiteUapsdBestEffortTraffic, + TBool aStayInPsDespiteUapsdBackgroundTraffic, + TBool aStayInPsDespiteLegacyVoiceTraffic, + TBool aStayInPsDespiteLegacyVideoTraffic, + TBool aStayInPsDespiteLegacyBestEffortTraffic, + TBool aStayInPsDespiteLegacyBackgroundTraffic ) + { + if ( aStayInPsDespiteUapsdVoiceTraffic ) + { + iFlags |= KStayInPsDespiteUapsdVoiceTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteUapsdVoiceTraffic; + } + + if ( aStayInPsDespiteUapsdVideoTraffic ) + { + iFlags |= KStayInPsDespiteUapsdVideoTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteUapsdVideoTraffic; + } + + if ( aStayInPsDespiteUapsdBestEffortTraffic ) + { + iFlags |= KStayInPsDespiteUapsdBestEffortTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteUapsdBestEffortTraffic; + } + + if ( aStayInPsDespiteUapsdBackgroundTraffic ) + { + iFlags |= KStayInPsDespiteUapsdBackgroundTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteUapsdBackgroundTraffic; + } + + if ( aStayInPsDespiteLegacyVoiceTraffic ) + { + iFlags |= KStayInPsDespiteLegacyVoiceTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteLegacyVoiceTraffic; + } + + if ( aStayInPsDespiteLegacyVideoTraffic ) + { + iFlags |= KStayInPsDespiteLegacyVideoTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteLegacyVideoTraffic; + } + + if ( aStayInPsDespiteLegacyBestEffortTraffic ) + { + iFlags |= KStayInPsDespiteLegacyBestEffortTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteLegacyBestEffortTraffic; + } + + if ( aStayInPsDespiteLegacyBackgroundTraffic ) + { + iFlags |= KStayInPsDespiteLegacyBackgroundTraffic; + } + else + { + iFlags &= ~KStayInPsDespiteLegacyBackgroundTraffic; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::FreezeTrafficOverride() + { + if ( iWlanContextImpl.UapsdUsedForBestEffort() ) + { + iIgnoreTraffic[WHA::ELegacy] = StayInPsDespiteUapsdBestEffortTraffic() ? + ETrue : EFalse; + } + else + { + iIgnoreTraffic[WHA::ELegacy] = StayInPsDespiteLegacyBestEffortTraffic() ? + ETrue : EFalse; + } + + if ( iWlanContextImpl.UapsdUsedForBackground() ) + { + iIgnoreTraffic[WHA::EBackGround] = StayInPsDespiteUapsdBackgroundTraffic() ? + ETrue : EFalse; + } + else + { + iIgnoreTraffic[WHA::EBackGround] = StayInPsDespiteLegacyBackgroundTraffic() ? + ETrue : EFalse; + } + + if ( iWlanContextImpl.UapsdUsedForVideo() ) + { + iIgnoreTraffic[WHA::EVideo] = StayInPsDespiteUapsdVideoTraffic() ? + ETrue : EFalse; + } + else + { + iIgnoreTraffic[WHA::EVideo] = StayInPsDespiteLegacyVideoTraffic() ? + ETrue : EFalse; + } + + if ( iWlanContextImpl.UapsdUsedForVoice() ) + { + iIgnoreTraffic[WHA::EVoice] = StayInPsDespiteUapsdVoiceTraffic() ? + ETrue : EFalse; + } + else + { + iIgnoreTraffic[WHA::EVoice] = StayInPsDespiteLegacyVoiceTraffic() ? + ETrue : EFalse; + } + +#ifndef NDEBUG + OsTracePrint( KPwrStateTransition | KQos, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::FreezeTrafficOverride: traffic ignoration for BE, BG, VI, VO, HCCA frozen to:") ); + + for ( TUint accessCategory = WHA::ELegacy; + accessCategory < WHA::EQueueIdMax; + ++accessCategory ) + { + OsTracePrint( KPwrStateTransition | KQos, (TUint8*) + ("UMAC: WlanDynamicPowerModeMgmtCntx::FreezeTrafficOverride: ignore traffic: %d"), + iIgnoreTraffic[accessCategory] ); + } +#endif // !NDEBUG + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::RegisterToLightPsTimeout() + { + if ( !( iFlags & KToLightPsTimerStarted ) ) + { + iFlags |= KToLightPsTimerStarted; + + iWlanContextImpl.iUmac.RegisterTimeout( + iToLightPsTimeout, + EWlanActiveToLightPsTimer ); + } + else + { + // timer already running; no action needed + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::RegisterToActiveTimeout() + { + if ( !( iFlags & KToActiveTimerStarted ) ) + { + iFlags |= KToActiveTimerStarted; + + iWlanContextImpl.iUmac.RegisterTimeout( + iToActiveTimeout, + EWlanLightPsToActiveTimer ); + } + else + { + // timer already running; no action needed + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::RegisterToDeepPsTimeout() + { + if ( !( iFlags & KToDeepPsTimerStarted ) ) + { + iFlags |= KToDeepPsTimerStarted; + + iWlanContextImpl.iUmac.RegisterTimeout( + iToDeepPsTimeout, + EWlanLightPsToDeepPsTimer ); + } + else + { + // timer already running; no action needed + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::CancelToLightPsTimeout() + { + if ( iFlags & KToLightPsTimerStarted ) + { + iFlags &= ~KToLightPsTimerStarted; + iWlanContextImpl.iUmac.CancelTimeout( EWlanActiveToLightPsTimer ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::CancelToActiveTimeout() + { + if ( iFlags & KToActiveTimerStarted ) + { + iFlags &= ~KToActiveTimerStarted; + iWlanContextImpl.iUmac.CancelTimeout( EWlanLightPsToActiveTimer ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDynamicPowerModeMgmtCntx::CancelToDeepPsTimeout() + { + if ( iFlags & KToDeepPsTimerStarted ) + { + iFlags &= ~KToDeepPsTimerStarted; + iWlanContextImpl.iUmac.CancelTimeout( EWlanLightPsToDeepPsTimer ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacelementlocator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacelementlocator.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,412 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanElementLocator class. +* +*/ + +/* +* %version: 9 % +*/ + +#include "config.h" +#include "umacelementlocator.h" + +// offset of the Length field from the beginning of element +const TUint KElemLengthOffset = 1; +// offset of the Type field from the beginning of element Information +const TUint KOuiTypeOffset = 3; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::WlanElementLocator( const TUint8* aStart, TUint16 aLength ) + : iStart ( aStart ), iLength ( aLength ), iIterator( NULL ) + { + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::InformationElement( + TUint8 aIeId, + TUint8& aIeLength, + const TUint8** aIeData, + TBool aValidateLength ) + { + // The general Information Element format is: + // Element id (1 byte) + // Length (1 byte) + // Information (Length bytes) + // + + TUint8 ie( 0 ); + TUint8 len( 0 ); + const TUint8* data( NULL ); + + if ( FirstIE( ie, len, &data ) != EWlanLocateOk ) + { + aIeLength = 0; + *aIeData = NULL; + return EWlanLocateElementNotFound; + } + + TWlanLocateStatus ret( EWlanLocateOk ); + + while ( ie != aIeId && ret == EWlanLocateOk ) + { + ret = NextIE( ie, len, &data ); + } + + if ( ret == EWlanLocateElementNotFound ) + { + aIeLength = 0; + *aIeData = NULL; + return ret; + } + else + { + aIeLength = len; + *aIeData = data; + + if ( aValidateLength ) + { + return ValidIE( aIeId, aIeLength ); + } + else + { + return EWlanLocateOk; + } + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::InformationElement( + TUint8 aIeId, + const TIeOui& aIeOui, + TUint8 aIeOuiType, + TUint8& aIeLength, + const TUint8** aIeData ) + { + // Element format is: + // ID = Element ID (1 byte) + // Len = Length (1 byte) + // OUI = OUI (3 bytes) + // OUItyp = OUI Type (1 byte) + // ... + + TUint8 ie( aIeId ); + TUint8 len( 0 ); + const TUint8* data( NULL ); + + // Find the first element with matching IE id + if ( InformationElement( aIeId, len, &data, EFalse ) != + EWlanLocateOk ) + { // there isn't one + aIeLength = 0; + *aIeData = NULL; + return EWlanLocateElementNotFound; + } + + // The ID is correct but also the OUI, OUI Type and OUI Subtype need to + // match + TWlanLocateStatus ret( EWlanLocateOk ); + + const TUint KMinAcceptableIeDataLen = + KIeOuiLength + + sizeof( KWmmElemOuiType ); + + while ( ret == EWlanLocateOk && + ( len < KMinAcceptableIeDataLen || + ie != aIeId || + !( data[0] == aIeOui[0] && data[1] == aIeOui[1] && + data[2] == aIeOui[2] + ) || + *( data + KOuiTypeOffset ) != aIeOuiType + ) + ) + { + ret = NextIE( ie, len, &data ); + } + + if ( ret == EWlanLocateElementNotFound ) + { + aIeLength = 0; + *aIeData = NULL; + return EWlanLocateElementNotFound; + } + else + { + aIeLength = len; + *aIeData = data; + return ValidIE( aIeId, aIeLength, data, aIeOuiType ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::InformationElement( + TUint8 aIeId, + const TIeOui& aIeOui, + TUint8 aIeOuiType, + TUint8 aIeOuiSubtype, + TUint8& aIeLength, + const TUint8** aIeData ) + { + // Element format is: + // ID = Element ID (1 byte) + // Len = Length (1 byte) + // OUI = OUI (3 bytes) + // OUItyp = OUI Type (1 byte) + // OUIsub = OUI Subtype (1 byte) + // ... + + TUint8 ie( aIeId ); + TUint8 len( 0 ); + const TUint8* data( NULL ); + + // Find the first element with matching IE id + if ( InformationElement( aIeId, len, &data, EFalse ) != + EWlanLocateOk ) + { // there isn't one + aIeLength = 0; + *aIeData = NULL; + return EWlanLocateElementNotFound; + } + + // The ID is correct but also the OUI, OUI Type and OUI Subtype need to + // match + TWlanLocateStatus ret( EWlanLocateOk ); + + const TUint KMinAcceptableIeDataLen = + KIeOuiLength + + sizeof( KWmmElemOuiType ) + + sizeof( KWmmInfoElemOuiSubType ); + + // offset of the Subtype field from the beginning of element Information + const TUint KOuiSubtypeOffset = 4; + + while ( ret == EWlanLocateOk && + ( len < KMinAcceptableIeDataLen || + ie != aIeId || + !( data[0] == aIeOui[0] && data[1] == aIeOui[1] && + data[2] == aIeOui[2] + ) || + *( data + KOuiTypeOffset ) != aIeOuiType || + *( data + KOuiSubtypeOffset ) != aIeOuiSubtype + ) + ) + { + ret = NextIE( ie, len, &data ); + } + + if ( ret == EWlanLocateElementNotFound ) + { + aIeLength = 0; + *aIeData = NULL; + return EWlanLocateElementNotFound; + } + else + { + aIeLength = len; + *aIeData = data; + return ValidIE( aIeId, aIeLength, data, aIeOuiType, aIeOuiSubtype ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::FirstIE( + TUint8& aIeId, + TUint8& aIeLength, + const TUint8** aIeData) + { + iIterator = iStart; + return CurrentIE( aIeId, aIeLength, aIeData ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::NextIE( + TUint8& aIeId, + TUint8& aIeLength, + const TUint8** aIeData) + { + iIterator += *( iIterator + KElemLengthOffset ) + KInfoElementHeaderLength; + return CurrentIE( aIeId, aIeLength, aIeData ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::CurrentIE( + TUint8& aIeId, + TUint8& aIeLength, + const TUint8** aIeData) const + { + if ( iIterator >= iStart + iLength ) + { + aIeId = 0; + aIeLength = 0; + *aIeData = NULL; + return EWlanLocateElementNotFound; + } + aIeId = *iIterator; + aIeLength = *( iIterator + KElemLengthOffset ); + *aIeData = iIterator + KInfoElementHeaderLength; + return EWlanLocateOk; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +WlanElementLocator::TWlanLocateStatus WlanElementLocator::ValidIE( + TUint8 aIeId, + TUint8 aIeLength, + const TUint8* aIeData, + TUint8 aIeOuiType, + TUint8 aIeOuiSubtype ) const + { + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanElementLocator::ValidIE: element id: %d"), aIeId ); + + TWlanLocateStatus status ( EWlanLocateElementNotFound ); + + switch ( aIeId ) + { + case E802Dot11SupportedRatesIE: + if ( aIeLength >= K802Dot11SupportedRatesIeDataMinLen && + // Note! This is not according to 802.11 std, but some + // implementations do not follow the standard in this respect + aIeLength <= KMaxNumberOfDot11bAndgRates ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11DsParameterSetIE: + if ( aIeLength == K802Dot11DsParameterSetIeDataLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11TimIE: + if ( aIeLength >= K802Dot11TimIeDataMinLen && + aIeLength <= K802Dot11TimIeDataMaxLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11IbssParameterSetIE: + if ( aIeLength == K802Dot11IbssParameterSetIeDataLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11ErpInformationIE: + if ( aIeLength == K802Dot11ErpInformationIeDataLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11HtCapabilitiesIE: + if ( aIeLength == K802Dot11HtCapabilitiesIeDataLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11ExtendedRatesIE: + if ( aIeLength >= K802Dot11ExtendedRatesIeDataMinLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11HtOperationIE: + if ( aIeLength == K802Dot11HtOperationIeDataLen ) + { + status = EWlanLocateOk; + } + break; + case E802Dot11VendorSpecificIE: + if ( aIeData ) + { + if ( !os_memcmp( + aIeData, + &KWmmElemOui, + KIeOuiLength ) && + aIeOuiType == KWmmElemOuiType && + aIeOuiSubtype == KWmmInfoElemOuiSubType ) + { + // WMM information element + + if ( aIeLength == KWmmInfoElemLen ) + { + status = EWlanLocateOk; + } + } + else if ( !os_memcmp( + aIeData, + &KWmmElemOui, + KIeOuiLength ) && + aIeOuiType == KWmmElemOuiType && + aIeOuiSubtype == KWmmParamElemOuiSubtype ) + { + // WMM Parameter Element + + if ( aIeLength == sizeof( SWmmParamElemData ) ) + { + status = EWlanLocateOk; + } + } + else + { + // implementation error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aIeId: %d"), aIeId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { +#ifndef NDEBUG + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: WlanElementLocator::ValidIE: ERROR: aIeData is NULL") ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); +#endif + status = EWlanLocateOk; + } + break; + default: + // implementation error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aIeId: %d"), aIeId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + OsTracePrint( KInfoLevel, (TUint8*) + ("UMAC: WlanElementLocator::ValidIE: status: %d"), status ); + + return status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umaceventdispatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umaceventdispatcher.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,314 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Event dispatcher that is used to serialize MAC prototocl +* statemachine access +* +*/ + +/* +* %version: 27 % +*/ + +#include "config.h" +#include "umaceventdispatcher.h" + +#include "umaceventdispatcherclient.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanEventDispatcher::WlanEventDispatcher( + MWlanEventDispatcherClient& aEventDispatcherClient ) + : iEventDispatcherClient( aEventDispatcherClient ), + iCommandCompletionRegistered ( EFalse ), iDisableChannelMask( 0 ), + iOid( NULL ), iInternalEvents( 0 ) + { + }; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanEventDispatcher::Dispatch() + { + TBool state_transition_event( EFalse ); + + if ( iInternalEvents ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC: WlanEventDispatcher::Dispatch(): dispatch internal event") ); + + state_transition_event = DispatchInternalEvent(); + } + if ( !state_transition_event ) + { + if ( iCommandCompletionRegistered ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC: WlanEventDispatcher::Dispatch(): dispatch WHA command completion") ); + + state_transition_event = DispatchCommandCompletionEvent(); + } + if ( !state_transition_event ) + { + if (// oid exists + iOid + // AND channel is NOT disabled + && (!(iDisableChannelMask & KOidChannel)) ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC: WlanEventDispatcher::Dispatch(): dispatch OID") ); + + state_transition_event = DispatchOidEvent(); + } + } + } + return state_transition_event; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanEventDispatcher::Register( + WHA::TCompleteCommandId aCompleteCommandId, + WHA::TStatus aStatus, + const WHA::UCommandCompletionParams& aCommandCompletionParams ) + { + if ( iCommandCompletionRegistered ) + { + OsTracePrint( KEventDispatcher, (TUint8*) + ("UMAC: WlanEventDispatcher::Register(): register cmd completion when one is already registered") ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + iWhaCommandCompletionParams.iId = aCompleteCommandId; + iWhaCommandCompletionParams.iStatus = aStatus; + iWhaCommandCompletionParams.iParams = aCommandCompletionParams; + + iCommandCompletionRegistered = ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanEventDispatcher::DispatchInternalEvent() + { + TBool ret ( EFalse ); + + if ( iInternalEvents & KAcParamUpdate ) + { + iInternalEvents &= ~KAcParamUpdate; + ret = iEventDispatcherClient.OnInternalEvent( KAcParamUpdate ); + } + else if ( iInternalEvents & KPowerMgmtTransition ) + { + iInternalEvents &= ~KPowerMgmtTransition; + ret = iEventDispatcherClient.OnInternalEvent( KPowerMgmtTransition ); + } + else if ( iInternalEvents & KTimeout) + { + iInternalEvents &= ~KTimeout; + ret = iEventDispatcherClient.OnInternalEvent( KTimeout ); + } + else if ( iInternalEvents & KVoiceCallEntryTimerTimeout) + { + iInternalEvents &= ~KVoiceCallEntryTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( + KVoiceCallEntryTimerTimeout ); + } + else if ( iInternalEvents & KNullTimerTimeout) + { + iInternalEvents &= ~KNullTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( KNullTimerTimeout ); + } + else if ( iInternalEvents & KNoVoiceTimerTimeout) + { + iInternalEvents &= ~KNoVoiceTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( KNoVoiceTimerTimeout ); + } + else if ( iInternalEvents & KKeepAliveTimerTimeout) + { + iInternalEvents &= ~KKeepAliveTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( KKeepAliveTimerTimeout ); + } + else if ( iInternalEvents & KActiveToLightPsTimerTimeout) + { + iInternalEvents &= ~KActiveToLightPsTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( + KActiveToLightPsTimerTimeout ); + } + else if ( iInternalEvents & KLightPsToActiveTimerTimeout) + { + iInternalEvents &= ~KLightPsToActiveTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( + KLightPsToActiveTimerTimeout ); + } + else if ( iInternalEvents & KLightPsToDeepPsTimerTimeout) + { + iInternalEvents &= ~KLightPsToDeepPsTimerTimeout; + ret = iEventDispatcherClient.OnInternalEvent( + KLightPsToDeepPsTimerTimeout ); + } + else if ( iInternalEvents & KSetCtsToSelf) + { + iInternalEvents &= ~KSetCtsToSelf; + ret = iEventDispatcherClient.OnInternalEvent( KSetCtsToSelf ); + } + else if ( iInternalEvents & KSetRcpiTriggerLevel ) + { + iInternalEvents &= ~KSetRcpiTriggerLevel; + ret = iEventDispatcherClient.OnInternalEvent( KSetRcpiTriggerLevel ); + } + else if ( iInternalEvents & KSetHtBssOperation ) + { + iInternalEvents &= ~KSetHtBssOperation; + ret = iEventDispatcherClient.OnInternalEvent( KSetHtBssOperation ); + } + else + { + // programming error + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: iInternalEvents"), iInternalEvents ); + OsAssert((TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanEventDispatcher::DispatchCommandCompletionEvent() + { + // make a local copy of the completion parameters + const TCommandResp resp ( iWhaCommandCompletionParams ); + // clear the event flag + iCommandCompletionRegistered = EFalse; + + // handle the event + return ( iEventDispatcherClient.OnWhaCommandComplete( + resp.iId, + resp.iStatus, + resp.iParams )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanEventDispatcher::DispatchOidEvent() + { + TBool ret ( EFalse ); + switch ( iOid->oid_id ) + { + case E802_11_CONFIGURE: + ret = iEventDispatcherClient.HandleConfigure( iOid ); + break; + case E802_11_CONNECT: + ret = iEventDispatcherClient.HandleConnect( iOid ); + break; + case E802_11_START_IBSS: + ret = iEventDispatcherClient.HandleStartIBSS( iOid ); + break; + case E802_11_SCAN: + ret = iEventDispatcherClient.HandleScan( iOid ); + break; + case E802_11_STOP_SCAN: + ret = iEventDispatcherClient.HandleStopScan(); + break; + case E802_11_DISCONNECT: + ret = iEventDispatcherClient.HandleDisconnect(); + break; + case E802_11_SET_POWER_MODE: + ret = iEventDispatcherClient.HandleSetPowerMode( iOid ); + break; + case E802_11_SET_RCPI_TRIGGER_LEVEL: + ret = iEventDispatcherClient.HandleSetRcpiTriggerLevel( iOid ); + break; + case E802_11_SET_TX_POWER_LEVEL: + ret = iEventDispatcherClient.HandleSetTxPowerLevel( iOid ); + break; + case E802_11_GET_LAST_RCPI: + ret = iEventDispatcherClient.HandleGetLastRcpi(); + break; + case E802_11_DISABLE_USER_DATA: + ret = iEventDispatcherClient.HandleDisableUserData(); + break; + case E802_11_ENABLE_USER_DATA: + ret = iEventDispatcherClient.HandleEnableUserData(); + break; + case E802_11_ADD_CIPHER_KEY: + ret = iEventDispatcherClient.HandleAddCipherKey( iOid ); + break; + case E802_11_ADD_MULTICAST_ADDR: + ret = iEventDispatcherClient.HandleAddMulticastAddr( iOid ); + break; + case E802_11_REMOVE_MULTICAST_ADDR: + ret = iEventDispatcherClient.HandleRemoveMulticastAddr( iOid ); + break; + case E802_11_CONFIGURE_BSS_LOST: + ret = iEventDispatcherClient.HandleConfigureBssLost( iOid ); + break; + case E802_11_SET_TX_RATE_ADAPT_PARAMS: + ret = iEventDispatcherClient.HandleSetTxRateAdaptParams( iOid ); + break; + case E802_11_CONFIGURE_TX_RATE_POLICIES: + ret = iEventDispatcherClient.HandleConfigureTxRatePolicies( iOid ); + break; + case E802_11_SET_POWER_MODE_MGMT_PARAMS: + ret = iEventDispatcherClient.HandleSetPowerModeMgmtParams( iOid ); + break; + case E802_11_CONFIGURE_PWR_MODE_MGMT_TRAFFIC_OVERRIDE: + ret = iEventDispatcherClient.HandleConfigurePwrModeMgmtTrafficOverride( iOid ); + break; + case E802_11_GET_FRAME_STATISTICS: + ret = iEventDispatcherClient.HandleGetFrameStatistics(); + break; + case E802_11_CONFIGURE_UAPSD: + ret = iEventDispatcherClient.HandleConfigureUapsd( iOid ); + break; + case E802_11_CONFIGURE_TX_QUEUE: + ret = iEventDispatcherClient.HandleConfigureTxQueue( iOid ); + break; + case E802_11_GET_MAC_ADDRESS: + ret = iEventDispatcherClient.HandleGetMacAddress(); + break; + case E802_11_CONFIGURE_ARP_IP_ADDRESS_FILTERING: + ret = iEventDispatcherClient.HandleConfigureArpIpAddressFiltering( iOid ); + break; + case E802_11_CONFIGURE_HT_BLOCK_ACK: + ret = iEventDispatcherClient.HandleConfigureHtBlockAck( iOid ); + break; + case E802_11_CONFIGURE_PROPRIETARY_SNAP_HDR: + ret = iEventDispatcherClient.HandleConfigureProprietarySnapHdr( + iOid ); + break; + default: + // catch programming error + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: OID: 0x%08x"), iOid->oid_id ); + OsAssert((TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + + // mark as used + iOid = NULL; + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umaclightpsmodepowermodemgr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umaclightpsmodepowermodemgr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanLightPsModePowerModeMgr class +* +*/ + +/* +* %version: 3 % +*/ + +#include "config.h" +#include "umaclightpsmodepowermodemgr.h" +#include "UmacContextImpl.h" +#include "802dot11.h" + +// Default Rx/Tx frame count threshold for considering change to Active mode. +// This value is used if another value hasn't been provided +const TUint KDefaultToActivePacketThreshold = 4; + +// Default Rx/Tx frame count threshold for considering change to Deep PS mode. +// This value is used if another value hasn't been provided +const TUint KDefaultToDeepPsPacketThreshold = 1; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanLightPsModePowerModeMgr::WlanLightPsModePowerModeMgr() : + iToActiveFrameCount( 0 ), + iToActiveFrameThreshold( KDefaultToActivePacketThreshold ), + iToDeepPsFrameCount( 0 ), + iToDeepPsFrameThreshold( KDefaultToDeepPsPacketThreshold ) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanLightPsModePowerModeMgr::~WlanLightPsModePowerModeMgr() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanLightPsModePowerModeMgr::OnFrameTx( + WlanContextImpl& /*aCtxImpl*/, + WHA::TQueueId /*aQueueId*/, + TUint16 aEtherType, + TBool aIgnoreThisFrame ) + { + TPowerMgmtModeChange powerMgmtModeChange( ENoChange ); + + if ( aEtherType == KEapolType || + aEtherType == KWaiType ) + { + powerMgmtModeChange = EToActive; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: EAPOL or WAI frame; change to Active") ); + } + else + { + if ( !aIgnoreThisFrame ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: count this frame") ); + + ++iToActiveFrameCount; + ++iToDeepPsFrameCount; + + if ( iToActiveFrameCount >= iToActiveFrameThreshold ) + { + powerMgmtModeChange = EToActive; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: threshold exceeded; change to Active") ); + } + } + else + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnFrameTx: do no count this frame") ); + + // no further action needed + } + } + + return powerMgmtModeChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TPowerMgmtModeChange WlanLightPsModePowerModeMgr::OnFrameRx( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TDaType aDaType ) + { + TPowerMgmtModeChange powerMgmtModeChange( ENoChange ); + + if ( aEtherType == KEapolType || + aEtherType == KWaiType ) + { + powerMgmtModeChange = EToActive; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnFrameRx: EAPOL or WAI frame; change to Active") ); + } + else + { + if ( CountThisFrame( + aCtxImpl, + aAccessCategory, + aEtherType, + aIgnoreThisFrame, + aPayloadLength, + iUapsdRxFrameLengthThreshold, + aDaType ) ) + { + ++iToActiveFrameCount; + ++iToDeepPsFrameCount; + + if ( iToActiveFrameCount >= iToActiveFrameThreshold ) + { + powerMgmtModeChange = EToActive; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnFrameRx: threshold exceeded; change to Active") ); + } + } + } + + return powerMgmtModeChange; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanLightPsModePowerModeMgr::OnLightPsToActiveTimerTimeout( + WlanContextImpl& aCtxImpl ) + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnLightPsToActiveTimerTimeout: ToActiveFrameCount: %d"), + iToActiveFrameCount ); + + iToActiveFrameCount = 0; + + if ( // we are seeking for the opportunity to perform tests on the + // current AP + aCtxImpl.ApTestOpportunitySeekStarted() && + // we have not yet indicated to WLAN Mgmt Client the opportunity + // to perform tests on the current AP + !aCtxImpl.ApTestOpportunityIndicated() ) + { + // Inform WLAN Mgmt Client that this would be the time to start + // the testing + aCtxImpl.iUmac.OnInDicationEvent( EApTestOpportunity ); + // make a note that AP test opportunity has been indicated to + // WLAN Mgmt Client + aCtxImpl.ApTestOpportunityIndicated( ETrue ); + } + + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanLightPsModePowerModeMgr::OnLightPsToDeepPsTimerTimeout() + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::OnLightPsToDeepPsTimerTimeout: ToDeepPsFrameCount: %d"), + iToDeepPsFrameCount ); + + if ( iToDeepPsFrameCount < iToDeepPsFrameThreshold ) + { + return ETrue; + } + else + { + iToDeepPsFrameCount = 0; + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanLightPsModePowerModeMgr::DoReset() + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanLightPsModePowerModeMgr::DoReset()") ); + + iToActiveFrameCount = 0; + iToDeepPsFrameCount = 0; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacnullsendcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacnullsendcontroller.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,608 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanNullSendController class +* +*/ + +/* +* %version: 15 % +*/ + +#include "config.h" +#include "umacnullsendcontroller.h" +#include "umacnullsender.h" +#include "UmacContextImpl.h" + + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::StartVoiceOverWlanCallMaintenance() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::StartVoiceOverWlanCallMaintenance") ); + + iFlags |= KVoiceOverWlanCallMaintenanceStarted; + + if ( iFlags & KInVoiceCallState ) + { + RegisterNoVoiceTimeout( iNoVoiceTimeout ); + + if ( ( iWlanContextImpl.UapsdUsedForVoice() ) && + ( iWlanContextImpl.CurrentDot11PwrMgmtMode() == + WHA::KPsEnable ) ) + { + // U-APSD is used for Voice and we are also in PS mode, + // so initiate QoS Null Frame sending by arming the timer + RegisterNullTimeout( iNullTimeout ); + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::ResumeQosNullSending() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::ResumeQosNullSending") ); + + if ( ( iWlanContextImpl.UapsdUsedForVoice() )&& + ( iFlags & KInVoiceCallState ) && + ( iWlanContextImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) ) + { + // U-APSD is used for Voice, we are in Voice Call state and in PS + // mode, so resume QoS null frame sending by re-arming the timer + RegisterNullTimeout( iNullTimeout ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnFrameRx( + WHA::TQueueId aQueueId, + TUint aPayloadLength ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnFrameRx entry: iFlags: 0x%08x"), + iFlags ); + + if ( iFlags & KVoiceOverWlanCallMaintenanceStarted ) + { + if ( iFlags & KInVoiceCallState ) + { + // we are already in Voice Call state + + const TInt64 KTimeNow( os_systemTime() ); + + if ( aQueueId == WHA::EVoice ) + { + // and this is a Voice priority frame. + + iLatestVoiceRxOrTxInVoiceCallState = KTimeNow; + } + else if ( ( aQueueId == WHA::ELegacy ) && + ( aPayloadLength < + iBestEffortVoiceRxLengthThreshold ) ) + { + iBestEffortVoiceRxTimeStamp[iBestEffortVoiceRxInd] = KTimeNow; + iBestEffortVoiceRxInd = + ( iBestEffortVoiceRxInd == + KBestEffortVoiceRxTimeStampCnt - 1 ) ? 0 : + ++iBestEffortVoiceRxInd; + } + else + { + // no action + } + } + else if ( iFlags & KVoiceCallEntryPending ) + { + // we are in Voice Call Entry Pending state + + if ( aQueueId == WHA::EVoice ) + { + // this is a Voice priority frame + + ++iVoiceCallEntryRxCount; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnFrameRx: iVoiceCallEntryRxCount is now: %d"), + iVoiceCallEntryRxCount ); + + if ( iVoiceCallEntryRxCount >= iVoiceCallEntryThreshold ) + { + // We will enter the Voice Call state + EnterVoiceCallState(); + } + } + } + else + { + // we are neither in Voice Call Entry Pending nor Voice Call state + + if ( aQueueId == WHA::EVoice ) + { + // this is a Voice priority frame. + + // It is the 1st Voice priority frame in the period starting + // now + iVoiceCallEntryRxCount = 1; + iVoiceCallEntryTxCount = 0; + + // We enter the Voice Call Entry Pending state by arming + // the relevant timer + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnFrameRx: Enter Voice Call Entry pending state") ); + + RegisterVoiceCallEntryTimeout(); + } + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnFrameTx( WHA::TQueueId aQueueId ) + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnFrameTx entry: iFlags: 0x%08x"), + iFlags ); + + iLatestTx = os_systemTime(); + + if ( iFlags & KVoiceOverWlanCallMaintenanceStarted ) + { + if ( iFlags & KInVoiceCallState ) + { + // we are already in Voice Call state + + if ( aQueueId == WHA::EVoice ) + { + // and this is a Voice priority frame. + + iLatestVoiceRxOrTxInVoiceCallState = iLatestTx; + } + } + else if ( iFlags & KVoiceCallEntryPending ) + { + // we are in Voice Call Entry Pending state + + if ( aQueueId == WHA::EVoice ) + { + // this is a Voice priority frame + + ++iVoiceCallEntryTxCount; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnFrameTx: iVoiceCallEntryTxCount is now: %d"), + iVoiceCallEntryTxCount ); + + if ( iVoiceCallEntryTxCount >= iVoiceCallEntryThreshold ) + { + // We will enter the Voice Call state + EnterVoiceCallState(); + } + } + } + else + { + // we are neither in Voice Call Entry Pending nor Voice Call state + + if ( aQueueId == WHA::EVoice ) + { + // this is a Voice priority frame. + + // It is the 1st Voice priority frame in the period starting + // now + iVoiceCallEntryTxCount = 1; + iVoiceCallEntryRxCount = 0; + + // We enter the Voice Call Entry Pending state by arming + // the relevant timer + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnFrameTx: Enter Voice Call Entry pending state") ); + + RegisterVoiceCallEntryTimeout(); + } + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnVoiceCallEntryTimerTimeout() + { + // as this timer expired we are no more in Voice Call Entry Pending state + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnVoiceCallEntryTimerTimeout: exit entry pending (to idle) state") ); + + iFlags &= ~KVoiceCallEntryPending; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnNullTimerTimeout() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnNullTimerTimeout") ); + + iFlags &= ~KNullTimerArmed; + + if ( iWlanContextImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) + { + // we are still in PS mode (as we were when this timer was + // armed) + + TUint32 KTimeAfterLatestTx ( + static_cast(os_systemTime() - iLatestTx) ); + + if ( KTimeAfterLatestTx >= iNullTimeout ) + { + // request a QoS Null Data frame to be sent. + // However, if there is a frame Tx (of any frame) already pending, + // we won't request a new frame to be sent. Note that it can really + // be any frame, i.e. for any AC, as we currently always set all the + // ACs as trigger enabled if U-APSD is used + if ( !iWlanContextImpl.UnsentTxPackets() ) + { + if ( !iNullSender.TxNullDataFrame( iWlanContextImpl, ETrue ) ) + { + // frame was not sent because we didn't get a Tx buffer. + // In this case we'll skip the sending + // However, we need to re-arm the timer to trigger the next + // QoS Null Data frame sending + RegisterNullTimeout( iNullTimeout ); + } + } + else + { + // frame Tx already pending, so we don't ask a QoS Null to be sent + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnNullTimerTimeout: frame Tx already pending. New QoS Null Tx request skipped") ); + + // However, we need to re-arm the timer to trigger the next + // QoS Null Data frame sending + RegisterNullTimeout( iNullTimeout ); + } + } + else + { + // No need to send QoS Null; yet. Re-arm the timer with + // a suitable timeout relative to the time of the latest Tx + // in QoS Null frame sending state + RegisterNullTimeout( iNullTimeout - KTimeAfterLatestTx ); + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnQosNullDataTxCompleted() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnQosNullDataTxCompleted entry: iFlags: 0x%08x"), + iFlags ); + + if ( iFlags & KVoiceOverWlanCallMaintenanceStarted && + iFlags & KInVoiceCallState && + iWlanContextImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) + { + // we are doing Voice over WLAN Call maintenance, in Voice Call + // state and also in PS mode + + // as the previous QoS Null Data, i.e. U-APSD Trigger, Frame has been + // transmitted, re-arm the timer for the next round + RegisterNullTimeout( iNullTimeout ); + } + + iLatestTx = os_systemTime(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnNoVoiceTimerTimeout() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnNoVoiceTimerTimeout entry: iFlags: 0x%08x"), + iFlags ); + + iFlags &= ~KNoVoiceTimerArmed; + const TInt64 KTimeNow( os_systemTime() ); + const TUint32 KTimeAfterLatestVoiceRxOrTxInVoiceCallState ( + static_cast(KTimeNow - + iLatestVoiceRxOrTxInVoiceCallState) ); + + if ( KTimeAfterLatestVoiceRxOrTxInVoiceCallState >= iNoVoiceTimeout ) + { + // no real Voice priority traffic any more. + + // check if there still is traffic which may be Voice traffic + // erroneously tagged as Best Effort priority + if ( KTimeNow - + // the oldest time stamp of these frames that we have in our + // records - or zero if such a time stamp doesn't exist + iBestEffortVoiceRxTimeStamp[iBestEffortVoiceRxInd] > + iBestEffortVoiceRxTimeWindow ) + { + // exit Voice Call state + iFlags &= ~KInVoiceCallState; + + // Send voice call state change indication to engine + iWlanContextImpl.iUmac.OnInDicationEvent( EVoiceCallOff ); + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnNoVoiceTimerTimeout: Exit Voice Call state") ); + + // stop the possibly ongoing Null frame sending by canceling the + // Null timer + CancelNullTimeout(); + } + else + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnNoVoiceTimerTimeout: Continue in Voice Call state") ); + + RegisterNoVoiceTimeout( iNoVoiceTimeout ); + } + } + else + { + // don't exit Voice Call state. Re-arm the timer instead with a + // suitable timeout relative to the latest Voice priority frame + // Rx or Tx in Voice Call state + RegisterNoVoiceTimeout( + iNoVoiceTimeout - KTimeAfterLatestVoiceRxOrTxInVoiceCallState ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::OnKeepAliveTimerTimeout() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnKeepAliveTimerTimeout") ); + + iFlags &= ~KKeepAliveTimerArmed; + + TUint32 KTimeAfterLatestTx ( + static_cast(os_systemTime() - iLatestTx) ); + + if ( KTimeAfterLatestTx >= iKeepAliveTimeout ) + { + // request a regular Null Data frame to be sent + + // however, if there is a frame Tx (of any frame) already pending, + // we won't request a new frame to be sent. + if ( !iWlanContextImpl.UnsentTxPackets() ) + { + if ( !iNullSender.TxNullDataFrame( iWlanContextImpl, EFalse ) ) + { + // frame was not sent because we didn't get a Tx buffer. + // In this case we'll skip the sending + // However, we need to re-arm the timer to trigger the next + // Null Data frame sending + RegisterKeepAliveTimeout( iKeepAliveTimeout ); + } + } + else + { + // frame Tx already pending, so we don't ask a Null Data to be sent + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::OnKeepAliveTimerTimeout: frame Tx already pending. New Null Data Tx request skipped") ); + + // However, we need to re-arm the timer to trigger the next + // Null Data frame sending + RegisterKeepAliveTimeout( iKeepAliveTimeout ); + } + } + else + { + // No need to send keep alive; yet. Re-arm the timer with + // a suitable timeout relative to the time of the latest frame Tx + RegisterKeepAliveTimeout( iKeepAliveTimeout - KTimeAfterLatestTx ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::RegisterVoiceCallEntryTimeout() + { + CancelVoiceCallEntryTimeout(); + + iWlanContextImpl.iUmac.RegisterTimeout( + iVoiceCallEntryTimeout, + EWlanVoiceCallEntryTimer ); + + iFlags |= KVoiceCallEntryPending; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::RegisterVoiceCallEntryTimeout: timer armed") ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::RegisterNullTimeout( + TUint32 aTimeoutInMicroSeconds ) + { + CancelNullTimeout(); + + iWlanContextImpl.iUmac.RegisterTimeout( + aTimeoutInMicroSeconds, + EWlanNullTimer ); + + iFlags |= KNullTimerArmed; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::RegisterNullTimeout: timer armed") ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::RegisterNoVoiceTimeout( + TUint32 aTimeoutInMicroSeconds ) + { + CancelNoVoiceTimeout(); + + iWlanContextImpl.iUmac.RegisterTimeout( aTimeoutInMicroSeconds, + EWlanNoVoiceTimer ); + iFlags |= KNoVoiceTimerArmed; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::RegisterNoVoiceTimeout: timer armed") ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::RegisterKeepAliveTimeout( + TUint32 aTimeoutInMicroSeconds ) + { + CancelKeepAliveTimeout(); + + iWlanContextImpl.iUmac.RegisterTimeout( aTimeoutInMicroSeconds, + EWlanKeepAliveTimer ); + + iFlags |= KKeepAliveTimerArmed; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::RegisterKeepAliveTimeout: timer armed") ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::CancelVoiceCallEntryTimeout() + { + if ( iFlags & KVoiceCallEntryPending ) + { + iWlanContextImpl.iUmac.CancelTimeout( EWlanVoiceCallEntryTimer ); + + iFlags &= ~KVoiceCallEntryPending; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::CancelVoiceCallEntryTimeout: timer cancelled") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::CancelNullTimeout() + { + if ( iFlags & KNullTimerArmed ) + { + iWlanContextImpl.iUmac.CancelTimeout( EWlanNullTimer ); + + iFlags &= ~KNullTimerArmed; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::CancelNullTimeout: timer cancelled") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::CancelNoVoiceTimeout() + { + if ( iFlags & KNoVoiceTimerArmed ) + { + iWlanContextImpl.iUmac.CancelTimeout( EWlanNoVoiceTimer ); + + iFlags &= ~KNoVoiceTimerArmed; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::CancelNoVoiceTimeout: timer cancelled") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::CancelKeepAliveTimeout() + { + if ( iFlags & KKeepAliveTimerArmed ) + { + iWlanContextImpl.iUmac.CancelTimeout( EWlanKeepAliveTimer ); + + iFlags &= ~KKeepAliveTimerArmed; + + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::CancelKeepAliveTimeout: timer cancelled") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanNullSendController::EnterVoiceCallState() + { + OsTracePrint( KUmacDetails, (TUint8*) + ("UMAC: WlanNullSendController::EnterVoiceCallState") ); + + CancelVoiceCallEntryTimeout(); + + iFlags |= KInVoiceCallState; + + // Send voice call state change indication to engine + iWlanContextImpl.iUmac.OnInDicationEvent( EVoiceCallOn ); + + // arm the No Voice timer so that we also exit the Voice Call + // state at some point + iLatestVoiceRxOrTxInVoiceCallState = os_systemTime(); + RegisterNoVoiceTimeout( iNoVoiceTimeout ); + + if ( ( iWlanContextImpl.UapsdUsedForVoice() ) && + ( iWlanContextImpl.CurrentDot11PwrMgmtMode() == WHA::KPsEnable ) ) + { + // U-APSD is used for Voice and we are also in PS mode, + // so initiate QoS Null Frame sending by arming the timer + RegisterNullTimeout( iNullTimeout ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpacketscheduler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpacketscheduler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,851 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The one and only packet scheduler +* +*/ + +/* +* %version: 28 % +*/ + +#include "config.h" +#include "umacpacketscheduler.h" +#include "umacpacketschedulerclient.h" +#include "UmacContextImpl.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPacketScheduler::WlanPacketScheduler( + MWlanPacketSchedulerClient& aWlanPacketSchedulerClient ) + : iPacketSchedulerClient(aWlanPacketSchedulerClient), + iCurrent( NULL ), + iTxPipelineActive( ETrue ), + iNumOfPackets( 0 ), + iNumOfNotCompletedPackets( 0 ), + iFlags( 0 ) + { + // initially mark all as free + for ( TPacketIdCntxs::iterator pos = iPacketIdCntxs.begin() + ; pos != iPacketIdCntxs.end() ; ++pos ) + { + pos->iFree = ETrue; + } + // initially mark all as free + for ( TPacketElements::iterator pos = iPacketElements.begin() + ; pos != iPacketElements.end() ; ++pos ) + { + pos->iFree = ETrue; + } + // initially mark all as free + fill( iQueueStates.begin(), iQueueStates.end(), EQueueNotFull ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanPacketScheduler::Push( + WlanContextImpl& aCtxImpl, + const TAny* aPacket, + TUint32 aLength, + WHA::TQueueId aQueueId, + TUint32 aPacketId, + const TDataBuffer* aMetaHeader, + TBool aMore, + TBool aMulticastData, + TBool aUseSpecialRatePolicy ) + { + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::Push: aMulticastData: %d"), + aMulticastData ); + + SElement* free_slot = FreeElementSlot(); + if ( !free_slot ) + { + // no free element slot was found, + // which means that all slots are in use + // we do nothing else than silently fail the operation + OsTracePrint( KPacketScheduler | KWarningLevel, (TUint8*) + ("UMAC: packetscheduler Push: no free slot found -> fail") ); + + // packet push failure we must signal + // set up a flag to signal client at later time to retry + // this operation + iFlags |= KSignalPushPacket; + + return EFalse; + } + + // one more packet to schedule + ++iNumOfPackets; + + // store packet send context + free_slot->iFree = EFalse; // context is no longer free + free_slot->iPacket = aPacket; + free_slot->iLength = aLength; + + // extract a free packet ID context + SPacketIdCntx* packet_id_cnxt = FreePacketIdCntx(); + if ( !packet_id_cnxt ) + { + // no free element was found + // we should allways enough of elements available + // so this issue means that we have either: + // 1) programming error + // 2) too small element storage + // in any case the issue must be solved at compile time not runtime + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return EFalse; + } + + ++iNumOfNotCompletedPackets; + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::Push: the nbr of packets not yet completed by WHA layer is now: %d"), + iNumOfNotCompletedPackets ); + + // store packet ID context + packet_id_cnxt->iQueueId = aQueueId; + packet_id_cnxt->iFrameId = aPacketId; + packet_id_cnxt->iMetaHeader = aMetaHeader; + packet_id_cnxt->iFree = EFalse; // this id is no longer free + packet_id_cnxt->iMulticastData = aMulticastData; + packet_id_cnxt->iUseSpecialRatePolicy = aUseSpecialRatePolicy; + + // link packet element to packet id context + free_slot->iPacketIdCntx = packet_id_cnxt; + + if ( iCurrent ) + { + if ( iTxPipelineActive ) + { + // it is not logical to have a valid current pointer + // when the tx pipeline is active + OsAssert( (TUint8*)("UMAC * panic"), + (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // we have a existing current pointer + // it means that the tx pipeline is stopped + // lets see if the pushed packet has a + // queue full status and proceed from that + + if ( iQueueStates[packet_id_cnxt->iQueueId] == EQueueNotFull ) + { + // as the pushed packet goes to non full queue let's + // set the one with highest priority as the current packet to send + if ( Priority( packet_id_cnxt->iQueueId ) > + Priority( iCurrent->iPacketIdCntx->iQueueId ) ) + { + iCurrent = free_slot; + } + else + { + // no action + } + } + else // --- != EQueueNotFull --- + { + // pushed packet queue is full -> no action + OsTracePrint( + KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::Push: queue for the pushed packet is full, queue id: %d"), + packet_id_cnxt->iQueueId ); + } + } + else // --- iCurrent --- + { + // we do not have a valid current pointer, which means that all + // the packets pending inside the scheduler have a queue full status + // tough luck, but we can live with it... + if ( iQueueStates[packet_id_cnxt->iQueueId] == EQueueNotFull ) + { + // the pushed packet queue is not full queue + // so we shall mark it as the current one + iCurrent = free_slot; + } + } + + if ( iTxPipelineActive && iCurrent ) + { + // packet scheduling feasible + // as tx pipeline is active and we have a current packet to be send + iPacketSchedulerClient.CallPacketSchedule( aCtxImpl, aMore ); + } + + if ( + // push packet signalling to client flagged + iFlags & KSignalPushPacket + // AND + && + // packet scheduler is not full + !Full() ) + { + iFlags &= ~KSignalPushPacket; + iPacketSchedulerClient.OnPacketPushPossible( aCtxImpl ); + } + + return ETrue; + } + +// --------------------------------------------------------------------------- +// make internal state as empty +// --------------------------------------------------------------------------- +// +void WlanPacketScheduler::Flush( WlanContextImpl& aCtxImpl ) + { + // remove all pending packet transmission entrys + // and call correct completion method for user plane packets + OsTracePrint( + KPacketScheduler, + (TUint8*)("UMAC: WlanPacketScheduler::Flush") ); + + for ( TPacketElements::iterator pos = iPacketElements.begin(); + pos != iPacketElements.end(); + ++pos ) + { + if ( pos->iFree == EFalse ) + // slot in use -> complete the packet and release the slot + { + pos->iFree = ETrue; + iPacketSchedulerClient.OnPacketFlushEvent( + aCtxImpl, + pos->iPacketIdCntx->iFrameId, + const_cast(pos->iPacketIdCntx->iMetaHeader) ); + + // as we won't be getting a packet tx completion for this packet + // mark also the corresponding packet context free + pos->iPacketIdCntx->iFree = ETrue; + --iNumOfNotCompletedPackets; + } + } + + // NOTE: we do not clear other packet ID contexts as there can be pending + // packet transmissions, which means we should get packet transmission + // callbacks and we must map the context then + + iCurrent = NULL; + iNumOfPackets = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanPacketScheduler::SchedulePackets( + WlanContextImpl& aCtxImpl, + TBool aMore ) + { + if ( !(iTxPipelineActive && iCurrent) ) + { + // nothing to do + return; + } + + typedef + Carray< + SPacketIdCntx*, + KNumOfElements, + EFalse, // no delete pointees + NoCopy // disallow copying + > TPacketIdCntxsPtrs; + + // this critter stores the xferred packet id contexes in case of + // synchronous xfer occurs and we must manullay call + // completion method for the frame ids + TPacketIdCntxsPtrs packetid_cntxs; + TPacketIdCntxsPtrs::iterator pos( packetid_cntxs.begin() ); + + WHA::TStatus status ( WHA::KSuccess ); + + // send all packets that are feasible for sending + // as long as the adpatation layer does not stop + // the tx pipeline + do + { + // store current packet id context + *pos = iCurrent->iPacketIdCntx; + + + // trace the frame critter + OsTracePrint( KPacketScheduler, + (TUint8*)("UMAC: scheduling dot11 packet for tx"), + *(reinterpret_cast(iCurrent->iPacket)) ); + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: queue ID: %d"), + (*pos)->iQueueId ); + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: frame ID: %d"), + (*pos)->iFrameId ); + OsTracePrint( KPacketScheduler, + (TUint8*)("UMAC: WlanPacketScheduler::SchedulePackets: packet id: 0x%08x"), + reinterpret_cast(*pos) ); + + // are multiple packets ready for sending in the same context + TBool morePackets ( aMore || MultipleReadyPacketsPending() ); + + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: more: %d"), + morePackets ); + + // determine and store the current Tx rate & rate policy to be used + // with the Tx queue in question + // + TUint8 txPolicyId ( 0 ); + aCtxImpl.TxRatePolicy( + iCurrent->iPacketIdCntx->iQueueId, + iCurrent->iPacketIdCntx->iUseSpecialRatePolicy, + iCurrent->iPacketIdCntx->iRequestedTxRate, + txPolicyId ); + + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: txRate: 0x%08x"), + iCurrent->iPacketIdCntx->iRequestedTxRate ); + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: txPolicyId: %d"), + txPolicyId ); + + const TUint8 KSizeOfTuint32 ( sizeof( TUint32 ) ); + const TUint8 KOffBy ( + reinterpret_cast(iCurrent->iPacket) % KSizeOfTuint32 ); + + if ( KOffBy ) + { + // The frame start address is not 32 bit aligned. This can + // happen e.g. if the frame was left pending during + // roaming, and we roamed from a non-QoS nw to a QoS nw, or vice + // versa. That makes the alignment to be off by 2 bytes. The only + // way to get the start address correctly aligned is to copy the + // whole frame. Note, that we always leave enough empty space at + // the end of the frame buffer to enable this + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: Frame start address 0x%08x not aligned; fixing it"), + reinterpret_cast(iCurrent->iPacket) ); + os_memcpy( + reinterpret_cast( + const_cast(iCurrent->iPacket)) + + ( KSizeOfTuint32 - KOffBy ), + reinterpret_cast(iCurrent->iPacket), + iCurrent->iLength ); + + iCurrent->iPacket = + reinterpret_cast(iCurrent->iPacket) + + ( KSizeOfTuint32 - KOffBy ); + + OsTracePrint( KWsaTxDetails, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: New frame start address: 0x%08x"), + reinterpret_cast(iCurrent->iPacket) ); + } + + status = aCtxImpl.Wha().SendPacket( + iCurrent->iPacket, + iCurrent->iLength, + iCurrent->iPacketIdCntx->iQueueId, + txPolicyId, + // note that this value is not relevant when autonomous rate + // adaptation is being used + iCurrent->iPacketIdCntx->iRequestedTxRate, + morePackets, + // packet id passed is used as an act to a complex type + reinterpret_cast(*pos), + aCtxImpl.iWlanMib.dot11CurrentTxPowerLevel, + aCtxImpl.iWlanMib.dot11MaxTransmitMSDULifetime[ + iCurrent->iPacketIdCntx->iQueueId], + NULL ); + + // store current time in packet context + iCurrent->iPacketIdCntx->iSendReqTimeStamp = os_systemTime(); + + ++pos; // next free slot + // for the possible following frame submissions within this Tx loop we + // cannot use this indication of more frames in UMAC adaptation any more + // as it is valid only for the first submission + aMore = EFalse; + + OsTracePrint( + KPacketScheduler, + (TUint8*)("UMAC: WlanPacketScheduler::SchedulePackets: SendPacket status: %d"), + status); + + if ( status == WHA::KPending ) + { + // stop the tx pipeline + StopTxPipeLine(); + // packet was accepted for delivery + --iNumOfPackets; + iCurrent->iFree = ETrue; // mark as free + } + else if ( status == WHA::KQueueFull ) + { + OsTracePrint( + KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SchedulePackets: queue for the current packet is full, queue id: %d"), + iCurrent->iPacketIdCntx->iQueueId ); + + // packet was discarded + // we may schedule from another queue + // this is done automatically as we are executing a loop + TranmsitQueueFull( iCurrent->iPacketIdCntx->iQueueId ); + + // do not clear context as this packet needs to be resend + // at some point + } + else if ( status == WHA::KSuccessXfer ) + { + // synchronous xfer occurred and no packet transfer + // method gets called for the packets send in this context, + // which means that we must manually call completion method + // for all of those packets + --iNumOfPackets; // packet was accepted for delivery + iCurrent->iFree = ETrue; // mark as free + + // call completion method for all stacked packet id contexes + // as they are part of a synchronous xfer + for ( TPacketIdCntxsPtrs::iterator beg + = packetid_cntxs.begin() + ; beg != pos + ; ++beg ) + { + iPacketSchedulerClient.OnPacketTransferComplete( + aCtxImpl, + (*beg)->iFrameId, + const_cast((*beg)->iMetaHeader) ); + } + + // now as all have been handled + // clear the stack by resetting the position + // to begin of the buffer + pos = packetid_cntxs.begin(); + } + else if ( status == WHA::KSuccess ) + { + // this is the success scenario + --iNumOfPackets; // packet was accepted for delivery + iCurrent->iFree = ETrue; // mark as free + } + else if ( status == WHA::KSuccessQueueFull ) + { + // packet was accepted + --iNumOfPackets; + // ... but the destination queue is now full + TranmsitQueueFull( iCurrent->iPacketIdCntx->iQueueId ); + // we may schedule from another queue + // this is done automatically as we are executing a loop + + iCurrent->iFree = ETrue; // mark as free + } + else + { + // adaptation programming error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // select new current packet that is to be transferred, + // if such exists + SetNextCurrent(); + + // stop packet sending if tx pipeleline is stopped or there + // is no current packet to be xferred + } while ( iCurrent && iTxPipelineActive ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanPacketScheduler::SendPacketTransfer( + WlanContextImpl& aCtxImpl, + WHA::TPacketId aPacketId ) + { + OsTracePrint( + KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SendPacketTransfer: packet id: 0x%08x"), + aPacketId); + + // tx pipeline is always activated by this method + StartTxPipeLine(); + + if ( iCurrent ) + { + // current packet to be xferred exists + // notify the client code of this + iPacketSchedulerClient.CallPacketSchedule( aCtxImpl, EFalse ); + } + + // call packet transfer completion method, + // with client supplied frame id + const SPacketIdCntx* packet_id_cnxt + = reinterpret_cast(aPacketId); + iPacketSchedulerClient.OnPacketTransferComplete( + aCtxImpl, + packet_id_cnxt->iFrameId, + const_cast(packet_id_cnxt->iMetaHeader) ); + + if ( // push packet signaling to client flagged + iFlags & KSignalPushPacket + // AND + && + // packet scheduler is not full + !Full() ) + { + iFlags &= ~KSignalPushPacket; + iPacketSchedulerClient.OnPacketPushPossible( aCtxImpl ); + } + + if ( // someone is waiting for internal Tx buffer to become available + aCtxImpl.InternalTxBufBeingWaited() + // AND + && + // packet scheduler still is not full + !Full() ) + { + aCtxImpl.ClearInternalTxBufBeingWaitedFlag(); + iPacketSchedulerClient.OnPacketPushPossible( aCtxImpl ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanPacketScheduler::SendPacketComplete( + WlanContextImpl& aCtxImpl, + WHA::TStatus aStatus, + WHA::TPacketId aPacketId, + WHA::TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint8 aAckFailures ) + { + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SendPacketComplete: packet id: 0x%08x"), + aPacketId); + + // determine the packet context related to this frame + SPacketIdCntx* packet_id_cnxt + = reinterpret_cast(aPacketId); + + // calculate Total Tx Delay for this frame. + // Using the TUint type for the result is safe + const TUint totalTxDelay = + os_systemTime() - + packet_id_cnxt->iSendReqTimeStamp; + + // as packet has been processed from device transmit queue + // mark that queue as not full + iQueueStates[packet_id_cnxt->iQueueId] = EQueueNotFull; + + // note the queue via which the packet was transmitted + const WHA::TQueueId queueId ( packet_id_cnxt->iQueueId ); + + // note the originally requested Tx rate + const WHA::TRate requestedTxRate( packet_id_cnxt->iRequestedTxRate ); + + // this context can now be reused + packet_id_cnxt->iFree = ETrue; + --iNumOfNotCompletedPackets; + + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::SendPacketComplete: the nbr of packets not yet completed by WHA layer is now: %d"), + iNumOfNotCompletedPackets ); + + // adjust current packet pointer if needed + SetCurrentPacket( *packet_id_cnxt ); + + if ( iTxPipelineActive && iCurrent ) + { + // packet scheduling feasible + // as tx pipeline is active and we have a current packet to be sent + iPacketSchedulerClient.CallPacketSchedule( aCtxImpl, EFalse ); + } + + // notify client of event + iPacketSchedulerClient.OnPacketSendComplete( + aCtxImpl, + aStatus, + packet_id_cnxt->iFrameId, + aRate, + aPacketQueueDelay, + aMediaDelay, + totalTxDelay, + aAckFailures, + queueId, + requestedTxRate, + packet_id_cnxt->iMulticastData ); + + if ( + // push packet signalling to client flagged + iFlags & KSignalPushPacket + // AND + && + // packet scheduler is not full + !Full() ) + { + iFlags &= ~KSignalPushPacket; + iPacketSchedulerClient.OnPacketPushPossible( aCtxImpl ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanPacketScheduler::GetWhaTxStatus( + const WlanContextImpl& aCtxImpl, + TWhaTxQueueState& aTxQueueState ) const + { + if ( aCtxImpl.QosEnabled() ) + { + for ( TUint queueId = 0; queueId < EQueueIdMax; ++queueId ) + { + aTxQueueState[queueId] = + static_cast(iQueueStates[queueId]); + } + } + else + { + for ( TUint queueId = 0; queueId < EQueueIdMax; ++queueId ) + { + aTxQueueState[queueId] = + static_cast(iQueueStates[ELegacy]); + } + } + + return iTxPipelineActive; + } + +// --------------------------------------------------------------------------- +// check do we have more than the current packet ready for transmit +// --------------------------------------------------------------------------- +// +TBool WlanPacketScheduler::MultipleReadyPacketsPending() + { + TUint32 cntr( 0 ); + + for ( TPacketElements::iterator pos = iPacketElements.begin() + ; pos != iPacketElements.end() + ; ++pos ) + { + if ( pos->iFree == EFalse ) + // element in use + { + if ( iQueueStates[pos->iPacketIdCntx->iQueueId] == EQueueNotFull ) + // and in non empty queue + { + if ( ++cntr > 1 ) + // multiple entries found + { + OsTracePrint( KPacketScheduler, (TUint8*) + ("UMAC: WlanPacketScheduler::MultipleReadyPacketsPending: multiple pending entries exist for non-full queue(s)") ); + + // terminate the loop + break; + } + } + } + } + + return (cntr > 1); + } + +// --------------------------------------------------------------------------- +// select new current packet to be transmitted if one exists +// --------------------------------------------------------------------------- +// +void WlanPacketScheduler::SetNextCurrent() + { + // no current exist as we setting a new one + iCurrent = NULL; + + if ( !iNumOfPackets ) + { + // as no packets exist there can not be a current one + return; + } + + TPacketElements::iterator pos( iPacketElements.begin() ); + TUint cntr( iNumOfPackets ); + while ( cntr ) + { + // process max amount of packets + // we have pending inside the scheduler + if ( pos->iFree == EFalse ) + { + // element in use -> process it + + if ( iCurrent ) + { + // a current packet exists + if ( + // packet is in non full queue + iQueueStates[pos->iPacketIdCntx->iQueueId] + == EQueueNotFull + // AND + && + // has higher prioty than the current packet + ( Priority( pos->iPacketIdCntx->iQueueId ) + > Priority( iCurrent->iPacketIdCntx->iQueueId ) ) ) + { + // which means it is the new current packet + iCurrent = pos; + } + } + else // --- iCurrent --- + { + // there is no current packet + + if ( + // packet is in non full queue + iQueueStates[pos->iPacketIdCntx->iQueueId] + == EQueueNotFull ) + { + // which means it is the new current packet + iCurrent = pos; + } + } + + --cntr; + } + ++pos; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPacketScheduler::SPacketIdCntx* WlanPacketScheduler::FreePacketIdCntx() + { + const TPacketIdCntxsPredicate unary_predicate; + + // find first free element + SPacketIdCntx* pos + = find_if( + iPacketIdCntxs.begin(), + iPacketIdCntxs.end(), + unary_predicate ); + + return (pos != iPacketIdCntxs.end() ? pos : NULL); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPacketScheduler::SElement* WlanPacketScheduler::FreeElementSlot() + { + const TElementPredicate unary_predicate; + + // find first free element + SElement* pos + = find_if( + iPacketElements.begin(), + iPacketElements.end(), + unary_predicate ); + + return (pos != iPacketElements.end() ? pos : NULL); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanPacketScheduler::SetCurrentPacket( + const SPacketIdCntx& aCompletedCntx ) + { + TBool skip_current( EFalse ); + + if ( iCurrent ) + { + // current packet to be scheduled exists + + if ( Priority( iCurrent->iPacketIdCntx->iQueueId ) >= + Priority( aCompletedCntx.iQueueId ) ) + { + // the current packet has at least equal priority as the + // processed one, which means that there is no need + // to adjust the current pointer + + // skip setting current + skip_current = ETrue; + } + else + { + // processed packet has a higher priority as the current one, + // which means that we have to check do we have packets in that + // queue as the new current packet have to be set from those + // packets (as they have higher priority) + } + } + else // --- iCurrent --- + { + // there is no current packet, which means that we have to check do we + // have packets in the same queue as the processed one + // as the current packet have to be set from those + // packets (if any exists) + } + + // check and adjust if needed the current packet pointer + // to point to the highest prioriy packet in non full transmit queue + + if ( skip_current == EFalse ) + { + TPacketElements::iterator pos( iPacketElements.begin() ); + TUint cntr( iNumOfPackets ); + while ( cntr ) + { + // process max amount of packets + // we have pending inside the scheduler + if ( pos->iFree == EFalse ) + { + // element in use -> process it + if ( iCurrent ) + { + // a current packet exists + + if ( // packet is in non full queue + iQueueStates[pos->iPacketIdCntx->iQueueId] + == EQueueNotFull + // AND + && + // has higher prioty than the current packet + ( Priority( pos->iPacketIdCntx->iQueueId ) + > Priority( iCurrent->iPacketIdCntx->iQueueId ) ) ) + { + // which means it is the new current packet + iCurrent = pos; + } + } + else // --- iCurrent --- + { + // there is no current packet + if ( // packet is in non full queue + iQueueStates[pos->iPacketIdCntx->iQueueId] + == EQueueNotFull ) + { + // which means it is the new current packet + iCurrent = pos; + } + } + + --cntr; + } + ++pos; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpowermodemgrbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacpowermodemgrbase.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPowerModeMgrBase class +* +*/ + +/* +* %version: 8 % +*/ + +#include "config.h" +#include "umacpowermodemgrbase.h" +#include "UmacContextImpl.h" + +// Default frame payload length threshold value (in bytes) for U-APSD +const TUint32 KUapsdRxFrameLengthThreshold = 400; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPowerModeMgrBase::WlanPowerModeMgrBase() : + iUapsdRxFrameLengthThreshold( KUapsdRxFrameLengthThreshold ) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPowerModeMgrBase::~WlanPowerModeMgrBase() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanPowerModeMgrBase::OnActiveToLightPsTimerTimeout() + { + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanPowerModeMgrBase::OnLightPsToActiveTimerTimeout( + WlanContextImpl& /*aCtxImpl*/ ) + { + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanPowerModeMgrBase::OnLightPsToDeepPsTimerTimeout() + { + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanPowerModeMgrBase::Reset() + { + DoReset(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanPowerModeMgrBase::CountThisFrame( + WlanContextImpl& aCtxImpl, + WHA::TQueueId aAccessCategory, + TUint16 aEtherType, + TBool aIgnoreThisFrame, + TUint aPayloadLength, + TUint16 aUapsdRxFrameLengthThreshold, + TDaType aDaType ) + { + TBool countThisFrame( ETrue ); + + if ( !( aEtherType == KEapolType || + aEtherType == KWaiType ) ) + { + if ( !aIgnoreThisFrame ) + { + // this is not a frame to be ignored based on WLAN mgmt client + // settings. However, check if it should be ignored for other + // reasons + + if ( aDaType == EBroadcastAddress ) + { + countThisFrame = EFalse; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no; a bcast frame") ); + } + else if ( aDaType == EMulticastAddress ) + { + if ( !aCtxImpl.MulticastAddressCount() ) + { + // no multicast MAC filters defined, so no downlink + // multicast data stream expected => don't count the frame + countThisFrame = EFalse; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no; a mcast frame and no mcast MAC filters defined") ); + } + else + { + // at least one multicast MAC filter defined so a downlink + // multicast data stream may be expected => count the frame + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: yes; a mcast frame and at least one mcast MAC filter defined") ); + } + } + else + { + // a unicast frame + + if ( aCtxImpl.UapsdUsedForBestEffort() && + aAccessCategory == WHA::ELegacy && + aPayloadLength < aUapsdRxFrameLengthThreshold ) + { + // U-APSD is being used for Best Effort (Legacy) AC (queue) + // and access category of this frame == WHA::ELegacy + // and payload is shorter than the defined threshold => + // don't count this frame + countThisFrame = EFalse; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no, as uapsd in use for legacy, AC == legacy and payload < thr")); + } + else + { + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: yes")); + } + } + } + else + { + // this is a frame to be ignored based on WLAN mgmt client AC settings + + countThisFrame = EFalse; + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: no, as frames are ignored for this queue/AC: %d"), + aAccessCategory ); + } + } + else + { + // EAPOL and WAI frames we always count. Not further actions needed + + OsTracePrint( KPwrStateTransition, (TUint8*) + ("UMAC: WlanPowerModeMgrBase::CountThisFrame: yes; EAPOL or WAI frame")); + } + + return countThisFrame; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacprivacymodefilters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacprivacymodefilters.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilters class. +* +*/ + +/* +* %version: 6 % +*/ + +#include "config.h" +#include "umacprivacymodefilters.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanPrivacyModeFilters::SetActiveFilter( + TEncryptionStatus aEncryptionStatus ) + { + if ( aEncryptionStatus == EEncryptionDisabled ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set none mode privacy filter") ); + iActiveFilter = &iNone; + } + else if ( aEncryptionStatus == EEncryptionWep ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set WEP mode privacy filter") ); + iActiveFilter = &iWep; + } + else if ( aEncryptionStatus == EEncryption802dot1x ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set 802dot1x mode privacy filter") ); + iActiveFilter = &i1x; + } + else if ( aEncryptionStatus == EEncryptionWpa ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set WPA mode privacy filter") ); + iActiveFilter = &iWpa; + } + else if ( aEncryptionStatus == EEncryptionWepMixed ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set WEP mixed mode privacy filter") ); + iActiveFilter = &iMixedModeWep; + } + else if ( aEncryptionStatus == EEncryption802dot1xMixed ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set 802.1x mixed mode privacy filter") ); + iActiveFilter = &iMixedMode1x; + } + else if ( aEncryptionStatus == EEncryptionWAPI ) + { + OsTracePrint( KUmacProtocolState, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: set WAPI mode privacy filter") ); + iActiveFilter = &iWapi; + } + else + { + OsTracePrint( KWarningLevel, (TUint8*) + ("UMAC: WlanPrivacyModeFilters::SetActiveFilter: no active Rx filter set; aEncryptionStatus: %d"), + aEncryptionStatus ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacprivacymodefilterwapi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacprivacymodefilterwapi.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanPrivacyModeFilterWapi class +* +*/ + +/* +* %version: 4 % +*/ + +#include "config.h" +#include "umacprivacymodefilterwapi.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanPrivacyModeFilterWapi::operator()( + const SDataFrameHeader& aFrameheader, + TBool aUserDataEnabled, + TUint16 aEthernetType, + TBool /*aUnicastKeyExists*/, + TBool /*aAesOrTkipOrWapiEncrypted*/ ) const + { + TBool ret( EFalse ); + + + if ( ( // allow all that have WEP bit on + aFrameheader.IsWepBitSet() + // AND are going to protocol stack + && aEthernetType != KWaiType + // AND user data is enabled + && aUserDataEnabled + ) + // OR are WAI frames + || + aEthernetType == KWaiType + // OR are our test frames + || aEthernetType == KBounceType + ) + { + ret = ETrue; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWapi::operator: frame filtered") ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWapi::operator: wep bit: %d"), + aFrameheader.IsWepBitSet() ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWapi::operator: ether type: 0x%04x"), + aEthernetType ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanPrivacyModeFilterWapi::operator: UserDataEnabled: %d"), + aUserDataEnabled ); + } + return ret; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacscanfsm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacscanfsm.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the TWlanScanFsm class. +* +*/ + +/* +* %version: 6 % +*/ + +#include "config.h" +#include "umacscanfsm.h" +#include "umacscanfsmcntx.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanFsm::StartScanningMode( + WlanScanFsmCntx& /*aCnxt*/ ) + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanFsm::StopScanningMode( + WlanScanFsmCntx& /*aCnxt*/ ) + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanFsm::OnScanningModeStarted( + WlanScanFsmCntx& /*aCnxt*/ ) + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanFsm::OnScanningModeStopped( + WlanScanFsmCntx& /*aCnxt*/ ) + { + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanFsm::ChangeState( + WlanScanFsmCntx& aCnxt, + TWlanScanFsm& aNewState ) const + { + aCnxt.Current( aNewState ); + aCnxt.Current().Entry( aCnxt ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacscanmoderunning.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacscanmoderunning.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the TWlanScanModeRunning class. +* +*/ + +/* +* %version: 4 % +*/ + +#include "config.h" +#include "umacscanmoderunning.h" +#include "umacscanfsmcntx.h" +#include "umacscanfsmcb.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanModeRunning::Entry( + WlanScanFsmCntx& aCnxt ) + { + aCnxt.Cb().OnScanFsmEvent( MWlanScanFsmCb::EFSMSCANMODERUNNING ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanModeRunning::StopScanningMode( + WlanScanFsmCntx& aCnxt ) + { + ChangeState( aCnxt, aCnxt.StopScanningMode() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanModeRunning::OnScanningModeStopped( + WlanScanFsmCntx& aCnxt ) + { + ChangeState( aCnxt, aCnxt.ScanModeStopped() ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacscanmodestopped.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacscanmodestopped.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the TWlanScanModeStopped class. +* +*/ + +/* +* %version: 4 % +*/ + +#include "config.h" +#include "umacscanmodestopped.h" +#include "umacscanfsmcntx.h" +#include "umacscanfsmcb.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanModeStopped::Entry( + WlanScanFsmCntx& aCnxt ) + { + aCnxt.Cb().OnScanFsmEvent( MWlanScanFsmCb::EFSMSCANMODESTOPPED ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanModeStopped::StartScanningMode( + WlanScanFsmCntx& aCnxt ) + { + ChangeState( aCnxt, aCnxt.StartScanningMode() ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanScanModeStopped::StopScanningMode( + WlanScanFsmCntx& aCnxt ) + { + ChangeState( aCnxt, *this ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacsignalpredictor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacsignalpredictor.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,589 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanSignalPredictor class. +* +*/ + +/* +* %version: 7 % +*/ + +#include "config.h" +#include "umacsignalpredictor.h" + + +static const TUint KThousand = 1000; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanSignalPredictor::WlanSignalPredictor() + : + iTimeToWarnLevel( KTimeToIndicationLevel ), + iWindowSize( KWindowSizeDefault ), + iTimeToNextInd( KTimeToNextIndication ), + iWarningLevel( KRoamLevel ), + iValueCount( 0 ), + iMedianCount( 0 ), + iLatestMedian( 0 ), + iOldestValue( 0 ), + iLatestValue( 0 ), + iLeastRcpi( 0 ), + iMaxRcpi( 0 ), + iValueCountMax( KValueCountMax ), + iMinValueCountForPrediction( KMinValueCountForPrediction ), + iRunning( ETrue ) + { + os_memset( iLevelTable, KDummy, sizeof( iLevelTable ) ); + os_memset( iMedianTable,KDummy, sizeof( iMedianTable ) ); + iRoamed.iDone = EFalse; + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::WlanSignalPredictor") ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanSignalPredictor::ConfigureSignalPredictor( + TUint32 aTimeToWarnLevel, + TUint32 aTimeToNextInd, + WHA::TRcpi aRcpiWarnLevel ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::ConfigureSignalPredictor") ); + + iTimeToWarnLevel = ( aTimeToWarnLevel ) ? aTimeToWarnLevel / KThousand : + iTimeToWarnLevel; + + iTimeToNextInd = ( aTimeToNextInd ) ? aTimeToNextInd / KThousand : + iTimeToNextInd; + + iWarningLevel = ( aRcpiWarnLevel ) ? aRcpiWarnLevel : iWarningLevel; + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::iTimeToWarnLevel: %d"), + iTimeToWarnLevel ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::iTimeToNextInd: %d"), + iTimeToNextInd ); + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::iWarningLevel: %d"), + iWarningLevel ); + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanSignalPredictor::InsertNewRcpi( + TUint32 aTimestamp, + WHA::TRcpi aRcpi ) + { + // Check all preconditions for prediction + + // Check state of module SPC Stopped + if ( EFalse == iRunning ) + { + return EFalse; + } + + // Convert the timestamp from microseconds to milliseconds + aTimestamp = aTimestamp / KThousand; + + // If new timestamp is old enough from the latest one. + if ( iValueCount && + (aTimestamp < (iLevelTable[iLatestValue].iTimestamp + KValueDelay) ) ) + { + return EFalse; + } + + // Remove too old values + if ( iValueCount ) + { + RemoveOldValues( aTimestamp ); + } + + // Insert the new value + return InsertValue( aTimestamp, aRcpi ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanSignalPredictor::GetLatestMedian( + TUint32 aTimestamp, + TUint8& aLastMedian ) const + { + // Convert the timestamp into milliseconds + aTimestamp = aTimestamp / KThousand; + + if ( iMedianCount ) + { + // Check first if the latest median is too old already. + if ( iWindowSize >= + Delay( iMedianTable[iLatestMedian].iTimestamp, aTimestamp ) ) + { + aLastMedian = iMedianTable[iLatestMedian].iRcpi; + return ETrue; + } + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanSignalPredictor::GetLatestRcpi( + TUint32 aTimestamp, + TUint8& aLatestRcpi ) + { + // Convert the timestamp into milliseconds + aTimestamp = aTimestamp / KThousand; + + RemoveOldValues( aTimestamp ); + + if ( iValueCount ) + { + aLatestRcpi = iLevelTable[iLatestValue].iRcpi; + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanSignalPredictor::RemoveOldValues( + TUint32 aTimestamp ) + { + TBool oldFound( ETrue ); + + while ( oldFound && iValueCount ) + { + TUint32 deltaTime = + Delay( iLevelTable[iOldestValue].iTimestamp, aTimestamp ); + if ( deltaTime > iWindowSize ) + { + RemoveValue( iOldestValue ); + } + else + { + oldFound = EFalse; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanSignalPredictor::RemoveValue( + TUint8 aIndex ) + { + // The only one is removed. + if ( KOneValue == iValueCount ) + { + os_memset( iLevelTable, KDummy, sizeof( iLevelTable ) ); + iValueCount = 0; + iOldestValue = 0; + iLatestValue = 0; + iLeastRcpi = 0; + iMaxRcpi = 0; + return; + } + // The biggest rcpi is removed. + else if ( aIndex == iMaxRcpi ) + { + iLevelTable[iLevelTable[aIndex].iPrev].iNext = iValueCountMax; + iMaxRcpi = iLevelTable[aIndex].iPrev; + } + // The least rcpi is removed. + else if ( aIndex == iLeastRcpi ) + { + iLevelTable[iLevelTable[aIndex].iNext].iPrev = iValueCountMax; + iLeastRcpi = iLevelTable[aIndex].iNext; + } + // The middle rcpi is removed. + else + { + iLevelTable[iLevelTable[aIndex].iPrev].iNext = iLevelTable[aIndex].iNext; + iLevelTable[iLevelTable[aIndex].iNext].iPrev = iLevelTable[aIndex].iPrev; + } + + os_memset( &iLevelTable[aIndex], KDummy, sizeof( TValue ) ); + + iOldestValue++; + if ( iOldestValue == iValueCountMax ) + { + iOldestValue = 0; + } + iValueCount--; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanSignalPredictor::InsertValue( + TUint32 aTimestamp, + WHA::TRcpi aRcpi ) + { + // If rcpi storage is full remove the oldest one to get space for new one + if ( iValueCount == iValueCountMax ) + { + RemoveValue( iOldestValue ); + } + // Insert the new value into rcpi storage + if ( !iValueCount ) + { + // First item in rcpi storage. + iOldestValue = 0; + iLatestValue = 0; + iLeastRcpi = 0; + iMaxRcpi = 0; + iLevelTable[iOldestValue].iTimestamp = aTimestamp; + iLevelTable[iOldestValue].iRcpi = aRcpi; + iLevelTable[iOldestValue].iPrev = iValueCountMax; + iLevelTable[iOldestValue].iNext = iValueCountMax; + } + else + { + // Already items in storage. + TBool biggerFound( EFalse ); + TUint8 tmpLeastIndex( iLeastRcpi ); + + iLatestValue++; + if ( iLatestValue == iValueCountMax ) + { + iLatestValue = 0; + } + iLevelTable[iLatestValue].iTimestamp = aTimestamp; + iLevelTable[iLatestValue].iRcpi = aRcpi; + + // Insert this right place in Rcpi order. + while ( !biggerFound ) + { + if ( iLevelTable[tmpLeastIndex].iRcpi > aRcpi ) + { + if ( tmpLeastIndex == iLeastRcpi ) + { + iLevelTable[iLatestValue ].iPrev = iValueCountMax; + iLevelTable[iLatestValue ].iNext = tmpLeastIndex; + iLevelTable[tmpLeastIndex].iPrev = iLatestValue; + iLeastRcpi = iLatestValue; + } + else + { + iLevelTable[iLatestValue ].iPrev = iLevelTable[tmpLeastIndex].iPrev; + iLevelTable[iLatestValue ].iNext = tmpLeastIndex; + iLevelTable[tmpLeastIndex].iPrev = iLatestValue; + iLevelTable[iLevelTable[iLatestValue].iPrev].iNext = iLatestValue; + } + biggerFound = ETrue; + } + else + { + if ( tmpLeastIndex == iMaxRcpi ) + { + // Biggest rcpi value. + iLevelTable[iMaxRcpi].iNext = iLatestValue; + iLevelTable[iLatestValue].iPrev = iMaxRcpi; + iLevelTable[iLatestValue].iNext = iValueCountMax; + iMaxRcpi = iLatestValue; + biggerFound = ETrue; + } + } + tmpLeastIndex = iLevelTable[tmpLeastIndex].iNext; + } + } + iValueCount++; + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertValue Rcpi: %d"), + aRcpi ); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertValue Timestamp: %d"), + aTimestamp ); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertValue Rcpi count: %d"), + iValueCount ); + + + // Check first if the latest filtered value is old enough so that new + // value can be added. If not, no new value is added. + TUint32 FilterDelay = Delay( iMedianTable[iLatestMedian].iTimestamp, + iLevelTable[iLatestValue].iTimestamp ); + + if ( FilterDelay < KMedianDelay ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertValue: Too small delay between medians %d, No prediction. "), + FilterDelay ); + + return EFalse; + } + + // Calculate weight to be used in mean filter. + // Median weight factor ratio 4/7 is experimental value. ratio 10/1 would + // mean in practise that NewMean = GetCurrentMedian() + // and Ratio 1/1000 NewMean = latest iLevelTable[iLatestValue].iRcpi + TUint8 WeightFactor = ( iValueCount * 4 ) / 7; + + // Get new filtered value using floating mean filter. + // Previous value (=LatestMedian at this point) is weighted using + // value above. + TUint8 NewMean = ( iMedianTable[iLatestMedian].iRcpi * WeightFactor + + GetCurrentMedian() ) / ( WeightFactor + 1 ); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertValue WeightFactor: %d"), + WeightFactor ); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertValue NewMean: %d"), + NewMean ); + + return InsertMedian( aTimestamp, NewMean ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8 WlanSignalPredictor::GetCurrentMedian() const + { + + TUint8 tempIdx( iLeastRcpi ); + + if ( KOneValue == iValueCount ) + { + return iLevelTable[tempIdx].iRcpi; + } + else if ( iValueCount % 2 ) + { + for ( TUint8 i = 1; i <= iValueCount/2; i++ ) + { + tempIdx = iLevelTable[tempIdx].iNext; + } + return iLevelTable[tempIdx].iRcpi; + } + else + { + for ( TUint8 i = 1; i < iValueCount/2; i++ ) + { + tempIdx = iLevelTable[tempIdx].iNext; + } + return ( (iLevelTable[tempIdx].iRcpi + + iLevelTable[iLevelTable[tempIdx].iNext].iRcpi)/2 ); + } + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanSignalPredictor::InsertMedian( + TUint32 aTimestamp, + TUint8 aMedian ) + { + TUint32 deltaTime( 0 ); + + if ( !iMedianCount ) + { + iMedianCount = KOneValue; + iLatestMedian = 0; + iMedianTable[iLatestMedian].iTimestamp = aTimestamp; + iMedianTable[iLatestMedian].iRcpi = aMedian; + } + else + { + deltaTime = Delay( iMedianTable[iLatestMedian].iTimestamp, aTimestamp ); + if ( deltaTime > iWindowSize ) + { + os_memset( iMedianTable,KDummy, sizeof( iMedianTable ) ); + iLatestMedian = 0; + iMedianCount = KOneValue; + iMedianTable[iLatestMedian].iTimestamp = aTimestamp; + iMedianTable[iLatestMedian].iRcpi = aMedian; + } + else + { + iLatestMedian = iLatestMedian ? 0 : 1; + iMedianCount = 2; + iMedianTable[iLatestMedian].iTimestamp = aTimestamp; + iMedianTable[iLatestMedian].iRcpi = aMedian; + } + } + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertMedian Median: %d"), + aMedian ); + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::InsertMedian MedianCount: %d"), + iMedianCount ); + + return GetPrediction(); + } + + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanSignalPredictor::GetPrediction() + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::GetPrediction") ); + + // Roaming indication delay check. + if ( iRoamed.iDone ) + { + if ( iTimeToNextInd >= + Delay(iRoamed.iTimestamp, iMedianTable[iLatestMedian].iTimestamp) ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::Latest roaming indication delay not past: No prediction") ); + + // Old indication still not enough old. + return EFalse; + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::Latest roaming indication delay past: Get prediction") ); + // Old indication old enough to send new one, clean the flag. + iRoamed.iDone = EFalse; + } + } + + // One median value, is it under warning level. + if ( iMinValueCountForPrediction > iValueCount ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor:: Count of rcpi values not enough:") ); + + // If latest filtered value is below warning level + if ( iMedianTable[iLatestMedian].iRcpi < iWarningLevel ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor:: Last median under Warning level: Send roam indication.") ); + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor:: No prediction.") ); + return EFalse; + } + } + + // Is the latest median bigger or equal than old one. + else if ( iMedianTable[iLatestMedian].iRcpi >= + iMedianTable[iLatestMedian?0:1].iRcpi ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor:: Last median above old one: No roam indication.") ); + return EFalse; + } + // Otherwise count the prediction for roaming indication. + else + { + TUint32 Drop( 0 ); + TUint32 DropPeriod( 0 ); + TUint32 DropToRoam( 0 ); + TUint32 TimeToRoam( 0 ); + + Drop = iMedianTable[iLatestMedian ? 0 : 1].iRcpi - + iMedianTable[iLatestMedian].iRcpi; + + DropToRoam = iMedianTable[iLatestMedian].iRcpi - iWarningLevel; + + DropPeriod = Delay( iMedianTable[iLatestMedian ? 0 : 1].iTimestamp, + iMedianTable[iLatestMedian].iTimestamp); + + TimeToRoam = ( DropPeriod * DropToRoam ) / Drop; + + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::GetPrediction TimeToRoam: %d ms."), + TimeToRoam ); + + // Level comparison changed to use + // filtered signal value. This significantly + // reduces amount of indications. + if ( TimeToRoam < iTimeToWarnLevel && + KDiffRoamLevel > iMedianTable[iLatestMedian].iRcpi ) + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::All conditions ok. Send roam indication.") ); + } + else + { + OsTracePrint( KRxFrame, (TUint8*) + ("UMAC: WlanSignalPredictor::Some conditions nok. No roam indication.") ); + return EFalse; + } + } + + // If we get this point, roaming indication is sent. Save the indication info. + iRoamed.iDone = ETrue; + iRoamed.iTimestamp = iMedianTable[iLatestMedian].iTimestamp; + + // Start roaming + return ETrue; + } + + + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32 WlanSignalPredictor::Delay( + TUint32 aOldTime, + TUint32 aNewTime ) const + { + TUint32 delay; + if ( aOldTime > aNewTime ) + { + delay = ~aOldTime + 1 + aNewTime; + } + else + { + delay = aNewTime - aOldTime; + } + return delay; + } + + + + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacstartscanningmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacstartscanningmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the TWlanStartScanningMode class. +* +*/ + +/* +* %version: 4 % +*/ + +#include "config.h" +#include "umacstartscanningmode.h" +#include "umacscanfsmcntx.h" +#include "umacscanfsmcb.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanStartScanningMode::Entry( + WlanScanFsmCntx& aCnxt ) + { + aCnxt.Cb().OnScanFsmEvent( MWlanScanFsmCb::EFSMSTARTSCANNINGMODE ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanStartScanningMode::OnScanningModeStarted( + WlanScanFsmCntx& aCnxt ) + { + ChangeState( aCnxt, aCnxt.ScanModeRunning() ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacstopscanningmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacstopscanningmode.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the TWlanStopScanningMode class. +* +*/ + +/* +* %version: 4 % +*/ + +#include "config.h" +#include "umacstopscanningmode.h" +#include "umacscanfsmcntx.h" +#include "umacscanfsmcb.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanStopScanningMode::Entry( + WlanScanFsmCntx& aCnxt ) + { + aCnxt.Cb().OnScanFsmEvent( MWlanScanFsmCb::EFSMSTOPSCANNINGMODE ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TWlanStopScanningMode::OnScanningModeStopped( + WlanScanFsmCntx& aCnxt ) + { + ChangeState( aCnxt, aCnxt.ScanModeStopped() ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhacomplexcommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhacomplexcommand.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWsaComplexCommand class. +* +*/ + +/* +* %version: 7 % +*/ + +#include "config.h" +#include "UmacWsaComplexCommand.h" +#include "UmacContextImpl.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaComplexCommand::Act( + WlanContextImpl& aCtxImpl, + TUint32 aAct ) const + { + aCtxImpl.WhaCommandAct( aAct ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanWsaComplexCommand::DoErrorIndication( + WlanContextImpl& aCtxImpl, + WHA::TStatus /*aStatus*/ ) + { + OsTracePrint( KWarningLevel, + (TUint8*)("UMAC * umacwhacomplexcommand * abort") ); + + // this is the one and only global error handler + ChangeState( aCtxImpl, *this, aCtxImpl.iStates.iMacError ); + + // signal with return value that a state transition occurred + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWsaComplexCommand::OnWhaCommandResponse( + WlanContextImpl& /*aCtxImpl*/, + WHA::TCommandId /*aCommandId*/, + WHA::TStatus /*aStatus*/, + const WHA::UCommandResponseParams& /*aCommandResponseParams*/, + TUint32 /*aAct*/ ) + { + // left intentionally empty + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhaconfigureac.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhaconfigureac.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWhaConfigureAc class +* +*/ + +/* +* %version: 13 % +*/ + +#include "config.h" +#include "umacwhaconfigureac.h" +#include "wha_mibDefaultvalues.h" + +#ifndef NDEBUG +const TInt8 WlanWhaConfigureAc::iName[] = "wha-configureac"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanWhaConfigureAc::WlanWhaConfigureAc() + { + os_memset( iCwMin, 0, sizeof( iCwMin ) ); + os_memset( iCwMax, 0, sizeof( iCwMax ) ); + os_memset( iAIFS, 0, sizeof( iAIFS ) ); + os_memset( iTxOplimit, 0, sizeof( iTxOplimit ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWhaConfigureAc::Set( + const TCwMinVector& aCwMin, + const TCwMaxVector& aCwMax, + const TAifsVector& aAIFS, + const TTxOplimitVector& aTxOplimit ) + { + os_memcpy( iCwMin, aCwMin, sizeof( iCwMin ) ); + os_memcpy( iCwMax, aCwMax, sizeof( iCwMax ) ); + os_memcpy( iAIFS, aAIFS, sizeof( iAIFS ) ); + os_memcpy( iTxOplimit, aTxOplimit, sizeof( iTxOplimit ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWhaConfigureAc::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWhaConfigureAc::Entry") ); + + // currently we always use the default value for maxReceiveLifeTime + // + TUint16 maxReceiveLifeTime[WHA::Wha::KNumOfEdcaQueues] = + { WHA::KDot11MaxReceiveLifeTimeDefault, + WHA::KDot11MaxReceiveLifeTimeDefault, + WHA::KDot11MaxReceiveLifeTimeDefault, + WHA::KDot11MaxReceiveLifeTimeDefault }; + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-ConfigureAC") ); + +#ifndef NDEBUG + for ( TUint i = 0; i < WHA::Wha::KNumOfEdcaQueues; ++i ) + { + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureAc::Entry: iCwMin: %d"), + iCwMin[i] ); + } + for ( TUint i = 0; i < WHA::Wha::KNumOfEdcaQueues; ++i ) + { + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureAc::Entry: iCwMax: %d"), + iCwMax[i] ); + } + for ( TUint i = 0; i < WHA::Wha::KNumOfEdcaQueues; ++i ) + { + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureAc::Entry: iAIFS: %d"), + iAIFS[i] ); + } + for ( TUint i = 0; i < WHA::Wha::KNumOfEdcaQueues; ++i ) + { + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureAc::Entry: iTxOplimit: %d"), + iTxOplimit[i] ); + } + for ( TUint i = 0; i < WHA::Wha::KNumOfEdcaQueues; ++i ) + { + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureAc::Entry: maxReceiveLifeTime: %d"), + maxReceiveLifeTime[i] ); + } +#endif + + // execute the command + aCtxImpl.Wha().ConfigureAC( + iCwMin, + iCwMax, + iAIFS, + iTxOplimit, + maxReceiveLifeTime ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWhaConfigureAc::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWhaConfigureAc::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EConfigureACResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhaconfigurequeue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhaconfigurequeue.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWhaConfigureQueue class. +* +*/ + +/* +* %version: 13 % +*/ + +#include "config.h" +#include "umacwhaconfigurequeue.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWhaConfigureQueue::iName[] = "wha-configurequeue"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanWhaConfigureQueue::Set( + WHA::TQueueId aQueueId, + TUint32 aMaxLifeTime, + WHA::TPsScheme aPsScheme, + WHA::TAckPolicy aAckPolicy, + TUint16 aMediumTime ) + { + iQueueId = aQueueId; + iMaxLifeTime = aMaxLifeTime; + iPsScheme = aPsScheme; + iAckPolicy = aAckPolicy; + iMediumTime = aMediumTime; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaConfigureQueue::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureQueue::Entry: iQueueId: %d"), + iQueueId ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureQueue::Entry: iMaxLifeTime: %d"), + iMaxLifeTime ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureQueue::Entry: iPsScheme: %d"), + iPsScheme ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureQueue::Entry: iAckPolicy: %d"), + iAckPolicy ); + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaConfigureQueue::Entry: iMediumTime: %d"), + iMediumTime ); + + const WHA::SSAPSDConfig insignificant = { 0, 0 }; + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-ConfigureQueue") ); + + // execute the command + aCtxImpl.Wha().ConfigureQueue( + iQueueId, + iMaxLifeTime, + iPsScheme, + insignificant, // deprecated + iAckPolicy, + iMediumTime ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWhaConfigureQueue::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaConfigureQueue::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EConfigureQueueResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwharelease.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwharelease.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWhaRelease class +* +*/ + +/* +* %version: 9 % +*/ + +#include "config.h" +#include "umacwharelease.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWhaRelease::iName[] = "wha-release"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaRelease::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, + (TUint8*)("UMAC: WlanWhaRelease::Entry") ); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-Release") ); + + // execute the command. As we always ask for synchronous execution for + // this command (which means that the WHA layer will not call + // CommandResponse()), we need to call CommandResponse() method by + // ourselves + + const WHA::TStatus status ( aCtxImpl.Wha().Release( ETrue ) ); + + WHA::UCommandResponseParams notRelevant; + CommandResponse( aCtxImpl, WHA::EReleaseResponse, status, notRelevant ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWhaRelease::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaRelease::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EReleaseResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhastopscan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhastopscan.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanWhaStopScan class +* +*/ + +/* +* %version: 5 % +*/ + +#include "config.h" +#include "umacwhastopscan.h" +#include "UmacContextImpl.h" + +#ifndef NDEBUG +const TInt8 WlanWhaStopScan::iName[] = "wha-stopscan"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaStopScan::Entry( WlanContextImpl& aCtxImpl ) + { + // mark WSA cmd active + aCtxImpl.ActivateWsaCmd(); + + OsTracePrint( KWsaCmdStateDetails, (TUint8*) + ("UMAC: WlanWhaStopScan::Entry") ); + + OsTracePrint( KWsaCmdState, (TUint8*) + ("UMAC: WHA-CMD-StopScan") ); + + // execute the command. + aCtxImpl.Wha().StopScan(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +#ifndef NDEBUG +const TInt8* WlanWhaStopScan::GetStateName( TUint8& aLength ) const + { + aLength = sizeof( iName ); + return iName; + } +#endif + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaStopScan::CommandResponse( + WlanContextImpl& aCtxImpl, + WHA::TCommandId aCommandId, + WHA::TStatus aStatus, + const WHA::UCommandResponseParams& aCommandResponseParams ) + { + if ( aCommandId == WHA::EStopScanResponse ) + { + TraverseToHistoryState( aCtxImpl, + aCommandId, aStatus, aCommandResponseParams ); + } + else + { + OsTracePrint( KErrorLevel, + (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhatodot11typeconverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_common/umac_common/src/umacwhatodot11typeconverter.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Converter between WHA types and dot11 types. +* +*/ + +/* +* %version: 10 % +*/ + +#include "config.h" +#include "umacwhatodot11typeconverter.h" +#include "802dot11.h" +#include "UmacContextImpl.h" + +struct TWhaRate2Dot11Rate + { + WHA::TRate iWhaRate; + T802Dot11SupportedRate iDot11Rate; + }; + +const TWhaRate2Dot11Rate KWhaRate2Dot11RateTable[] = + { + { WHA::KRate1Mbits, E802Dot11Rate1MBit }, + { WHA::KRate2Mbits, E802Dot11Rate2MBit }, + { WHA::KRate5_5Mbits, E802Dot11Rate5p5MBit }, + { WHA::KRate6Mbits, E802Dot11Rate6MBit }, + { WHA::KRate9Mbits, E802Dot11Rate9MBit }, + { WHA::KRate11Mbits, E802Dot11Rate11MBit }, + { WHA::KRate12Mbits, E802Dot11Rate12MBit }, + { WHA::KRate18Mbits, E802Dot11Rate18MBit }, + { WHA::KRate22Mbits, E802Dot11Rate22MBit }, + { WHA::KRate24Mbits, E802Dot11Rate24MBit }, + { WHA::KRate33Mbits, E802Dot11Rate33MBit }, + { WHA::KRate36Mbits, E802Dot11Rate36MBit }, + { WHA::KRate48Mbits, E802Dot11Rate48MBit }, + { WHA::KRate54Mbits, E802Dot11Rate54MBit }, + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void WlanWhaToDot11TypeConverter::Convert( + WHA::TRate aRateMask, + SSupportedRatesIE& aRateIe, + SExtendedSupportedRatesIE& aExtRateIe ) + { + aRateIe.Clear(); // make zero length + aExtRateIe.Clear(); + + const TWhaRate2Dot11Rate* pos = KWhaRate2Dot11RateTable; + const TWhaRate2Dot11Rate* end = + pos + sizeof(KWhaRate2Dot11RateTable) / sizeof( TWhaRate2Dot11Rate); + + TUint32 cntr( 0 ); + while ( pos != end ) + { + if ( aRateMask & pos->iWhaRate ) + { + // we have a hit + if ( cntr < KMaxNumberOfRates ) + { + // space left in this IE + aRateIe.Append( pos->iDot11Rate ); + } + else + { + // have to use the extended rates IE + aExtRateIe.Append( pos->iDot11Rate ); + } + ++cntr; + } + else + { + // no hit + } + + ++pos; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool WlanWhaToDot11TypeConverter::ConvertToWhaTypes( + WlanContextImpl& aCtxImpl, + const TSSID* aSsid, + WHA::SSSID& aWhaSsid, + const SChannels* aChannels, + TUint32 aMinChannelTime, + TUint32 aMaxChannelTime, + WHA::SChannels*& aWhaChannels, + TUint8& aWhaChannelCount ) + { + const TUint32 endMask2dot4 = 0x00004000; + const TUint32 endMask4dot9 = 0x00100000; + + TBool status ( ETrue ); + + // ========================================================================= + // handle SSID + // ========================================================================= + + aWhaSsid.iSSIDLength = aSsid->ssidLength; + os_memcpy( aWhaSsid.iSSID, aSsid->ssid, aWhaSsid.iSSIDLength ); + + + // ========================================================================= + // handle channels & bands + // Note that only one band is allowed to be specified at a time + // ========================================================================= + + OsTracePrint( KScan, (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: frequency band mask: 0x%02x"), + aChannels->iBand ); + + TUint32 channelMask ( 0 ); + aWhaChannelCount = 0; + + if ( aChannels->iBand & WHA::KBand2dot4GHzMask ) + { + // channels in the 2.4GHz band + // + + channelMask = aChannels->iChannels2dot4GHz[1]; // HI part + channelMask <<= 8; + channelMask |= aChannels->iChannels2dot4GHz[0]; // LO part + + // so how many channels have been specified to be scanned + for ( TUint32 bit = 1; !(bit & endMask2dot4); bit <<= 1 ) + { + if ( channelMask & bit ) + { + ++aWhaChannelCount; + } + } + } + else if ( aChannels->iBand & WHA::KBand4dot9GHzMask ) + { + // channels in the 4.9GHz band + // + + channelMask = aChannels->iChannels4dot9GHz[2]; + channelMask <<= 8; + channelMask |= aChannels->iChannels4dot9GHz[1]; + channelMask <<= 8; + channelMask |= aChannels->iChannels4dot9GHz[0]; + + // so how many channels have been specified to be scanned + for ( TUint32 bit = 1; !(bit & endMask4dot9); bit <<= 1 ) + { + if ( channelMask & bit ) + { + ++aWhaChannelCount; + } + } + } + else + { + OsTracePrint( + KErrorLevel, + (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: ERROR: neither 2.4 nor 4.9 GHz band specified")); + + // implementation error + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + OsTracePrint( + KScan, (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: channel bitmask: 0x%04x"), + channelMask ); + OsTracePrint( + KScan, (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: %d channels specified to be scanned"), + aWhaChannelCount ); + + if ( !aWhaChannelCount ) + { + // no channels specified to be scanned. That's an implementation error + + OsTracePrint( KErrorLevel, (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: ERROR: no channels specified to be scanned") ); + OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // allocate memory for the channels + aWhaChannels = + static_cast(os_alloc( + sizeof( WHA::SChannels ) * aWhaChannelCount )); + WHA::SChannels* ptr = aWhaChannels; + + if ( !aWhaChannels ) + { + // alloc failed; we can't continue + status = EFalse; + } + else // alloc success, continue + { + // convert to WHA channels + // + + WHA::TChannelNumber channelNumber( 1 ); + + if ( aChannels->iBand & WHA::KBand2dot4GHzMask ) + { + for ( TUint32 bit = 1; !(bit & endMask2dot4); bit <<= 1 ) + { + if ( channelMask & bit ) + { + ptr->iChannel = channelNumber; + ptr->iMinChannelTime = aMinChannelTime; + ptr->iMaxChannelTime = aMaxChannelTime; + ptr->iTxPowerLevel = aCtxImpl.iWlanMib.dot11CurrentTxPowerLevel; + ++ptr; + } + ++channelNumber; + } + } + else if ( aChannels->iBand & WHA::KBand4dot9GHzMask ) + { + for ( TUint32 bit = 1; !(bit & endMask4dot9); bit <<= 1 ) + { + if ( channelMask & bit ) + { + ptr->iChannel = channelNumber; + ptr->iMinChannelTime = aMinChannelTime; + ptr->iMaxChannelTime = aMaxChannelTime; + ptr->iTxPowerLevel = aCtxImpl.iWlanMib.dot11CurrentTxPowerLevel; + ++ptr; + } + ++channelNumber; + } + } + +#ifndef NDEBUG + // trace WHA channels + ptr = aWhaChannels; + OsTracePrint( + KScan, + (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: dump channels")); + + for ( TUint8 index = 0; index < aWhaChannelCount; ++index ) + { + OsTracePrint( + KScan, (TUint8*) + ("UMAC: WlanWhaToDot11TypeConverter::ConvertToWhaTypes: channelNumber: %d "), + ptr->iChannel ); + ++ptr; + } +#endif + } // else (alloc success) + + return status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osa.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osa.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,489 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanOsa implementation +* +*/ + +/* +* %version: 9 % +*/ + +#include "osa_includeme.h" + +#include + +#include "osa.h" +#include "osadfc.h" +#include "osatimer.h" + +#ifdef __WLAN_ENABLE_DMA + #include "osamemorypool.h" +#else + // allocator for general purpose memory + extern void* GpAlloc( TInt aSize, TBool aZeroStamp ); + // free for general purpose memory + extern void GpFree( void* aPtr ); +#endif // __WLAN_ENABLE_DMA + +struct WlanOsaImpl : public DBase, public WlanObject + { + + /** + * Ctor + * + * @since S60 v3.2 + */ + inline WlanOsaImpl(); + + /** + * Dtor + * + * @since S60 v3.2 + */ + virtual ~WlanOsaImpl(); + + /** + * Initializes the object instance. + * Note! Needs to be executed successfully after object instance + * construction to be able to use the instance. + * + * @param aUseCachedMemory ETrue if cached interconnect memory shall be used + * EFalse otherwise + * @param aAllocationUnit allocation unit size for interconnect memory in + * bytes + * @return ETrue when successful + * EFalse otherwise + */ + TBool Initialize( TBool aUseCachedMemory, TInt aAllocationUnit ); + + /** + * mutex + * Not Own. + */ + DMutex* iMutex; + +#ifdef __WLAN_ENABLE_DMA + /** + * memorypool + */ + WlanMemoryPool* iMemoryPool; +#endif // __WLAN_ENABLE_DMA + +private: + + // Prohibit copy constructor. + WlanOsaImpl( const WlanOsaImpl& ); + // Prohibit assigment operator. + WlanOsaImpl& operator= ( const WlanOsaImpl& ); + }; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanOsaImpl::WlanOsaImpl(): iMutex( NULL ), iMemoryPool( NULL ) + { + Validate(); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanOsaImpl::~WlanOsaImpl() + { +#ifdef __WLAN_ENABLE_DMA + if ( iMemoryPool ) + { + delete iMemoryPool; + iMemoryPool = NULL; + } +#endif // __WLAN_ENABLE_DMA + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanOsaImpl::Initialize( TBool aUseCachedMemory, TInt aAllocationUnit ) + { + TBool status( ETrue ); + +#ifdef __WLAN_ENABLE_DMA + iMemoryPool = new WlanMemoryPool( aUseCachedMemory, aAllocationUnit ); + if ( iMemoryPool ) + { + if ( !iMemoryPool->IsValid() ) + { + TraceDump(ERROR_LEVEL, + ("[WLAN] WlanOsaImpl::Initialize: ERROR: WLAN mem pool invalid")); + + status = EFalse; + // memory pool will be freed in the destructor + } + } + else + { + TraceDump(ERROR_LEVEL, + ("[WLAN] WlanOsaImpl::Initialize: ERROR: WLAN mem pool alloc failed")); + + status = EFalse; + } +#endif // __WLAN_ENABLE_DMA + + return status; + } + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanOsa::~WlanOsa() + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa dtor")); + + iDfcQueue = NULL; + + if ( IsValid() ) + { + // we are valid -> proceed + // close the mutex + TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa close mutex")); + + if ( Pimpl().iMutex ) + { + Pimpl().iMutex->Close( NULL ); + } + + if ( iPimpl ) + { + delete iPimpl; + iPimpl = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanOsa::WlanOsa() : iPimpl( NULL ), iDfcQueue( NULL ) + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa ctor")); + + iPimpl = new WlanOsaImpl(); + if ( iPimpl ) + { + if ( iPimpl->IsValid() ) + { + // allocation success & object valid -> proceed + + Validate(); + + const TUint mutex_order( KMutexOrdGeneral7 ); + TraceDump(MUTEX_LEVEL, + (("[WLAN] WlanOsa mutex create: order: %d"), mutex_order)); + + const TInt ret( Kern::MutexCreate( + Pimpl().iMutex, KNullDesC, mutex_order) ); + + if ( ret != KErrNone ) + { + delete iPimpl; + // and invalidate + InValidate(); + } + } + else + { + // osa impl is invalid. Deallocate it + delete iPimpl; + // we are invalid, too + InValidate(); + } + } + else + { + // allocation failed invalidate object + InValidate(); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool WlanOsa::Initialize( + TBool aUseCachedMemory, + TInt aAllocationUnit, + void* aDfcQueue ) + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::Initialize()")); + + TBool status( ETrue ); + + iDfcQueue = aDfcQueue; + + if ( iPimpl ) + { + status = Pimpl().Initialize( aUseCachedMemory, aAllocationUnit ); + } + else + { + status = EFalse; + } + + TraceDump(INFO_LEVEL, (("[WLAN] WlanOsa::Initialize(): status (bool): %d"), + status)); + + return status; + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// +// --------------------------------------------------------------------------- +// +void* WlanOsa::Alloc( TOsaMemoryType aOsaMemoryType, TInt aSize, TUint aFlags ) + { +#ifdef __WLAN_ENABLE_DMA + + return Pimpl().iMemoryPool->Alloc( + aOsaMemoryType, + aSize, + (aFlags & KAllocZeroStampMask) ); + +#else + + return GpAlloc( aSize, (aFlags & KAllocZeroStampMask) ); + +#endif // __WLAN_ENABLE_DMA + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// +// --------------------------------------------------------------------------- +// +void WlanOsa::Free( void* aPtr ) + { +#ifdef __WLAN_ENABLE_DMA + + Pimpl().iMemoryPool->Free( aPtr ); + +#else + + GpFree( aPtr ); + +#endif // __WLAN_ENABLE_DMA + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// +// --------------------------------------------------------------------------- +// +MWlanDfc* WlanOsa::DfcCreate() + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::DfcCreate()")); + + WlanDfc* dfc( new WlanDfc( *this, iDfcQueue ) ); + if ( dfc ) + { + if ( !(dfc->IsValid()) ) + { + // construct failure -> destroy + delete dfc; + dfc = NULL; + } + } + + TraceDump(INFO_LEVEL, (("dfc addr: 0x%08x"), dfc)); + + return dfc; + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// +// --------------------------------------------------------------------------- +// +void WlanOsa::DfcDestroy( MWlanDfc* aWlanDfc ) + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::DfcDestroy()")); + + delete aWlanDfc; + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// +// --------------------------------------------------------------------------- +// +MWlanTimer* WlanOsa::TimerCreate() + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::TimerCreate()")); + + WlanTimer* timer( new WlanTimer( *this, iDfcQueue ) ); + if ( timer ) + { + if ( !(timer->IsValid()) ) + { + // construct failure -> destroy + delete timer; + timer = NULL; + } + } + else + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::TimerCreate() no memory")); + } + + return timer; + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// +// --------------------------------------------------------------------------- +// +void WlanOsa::TimerDestroy( MWlanTimer* aWlanTimer ) + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::TimerDestroy()")); + + WlanTimer* timer = static_cast< WlanTimer* >( aWlanTimer ); + + // dequeue just in case + timer->Dequeue(); + + // remove the final reference to the timer instance - this will + // cause the object to destroy itself when it is ready to go + // (the timer DFC been completed.) + timer->RefDel(); + + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +TInt MWlanOsa::MemCmp( const void* aLhs, + const void* aRhs, + TInt aNumOfBytes ) + { + return memcompare( + static_cast(aLhs), aNumOfBytes, + static_cast(aRhs), aNumOfBytes ); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +void* MWlanOsa::MemCpy( void* aDest, + const void* aSrc, + TUint aLengthinBytes ) + { + return memcpy( aDest, aSrc, aLengthinBytes ); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +void* MWlanOsa::WordCpy( TInt* aDest, const TInt* aSrc, TUint aLengthinBytes ) + { + return wordmove( aDest, aSrc, aLengthinBytes ); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +void* MWlanOsa::MemClr( void* aDest, TUint aLengthinBytes ) + { + return memclr( aDest, aLengthinBytes ); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +void* MWlanOsa::MemSet( void* aDest, + TInt aValue, + TUint aCount ) + { + return memset( aDest, aValue, aCount ); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +TInt64 MWlanOsa::Time() + { + return Kern::SystemTime(); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsa. +// --------------------------------------------------------------------------- +// +void MWlanOsa::BusyWait( TUint aWaitTimeInMicroSeconds ) + { + const TInt KMicroSecsToNanoSecs( 1000 ); + Kern::NanoWait( aWaitTimeInMicroSeconds * KMicroSecsToNanoSecs ); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsaExt. +// --------------------------------------------------------------------------- +// +void WlanOsa::MutexAcquire() + { + TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexAcquire() +")); + TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), + (Kern::CurrentThread()).iId)); + + // acquire mutex + Kern::MutexWait( *(Pimpl().iMutex) ); + + TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexAcquire() -")); + TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), + (Kern::CurrentThread()).iId)); + } + +// --------------------------------------------------------------------------- +// From class MWlanOsaExt. +// --------------------------------------------------------------------------- +// +void WlanOsa::MutexRelease() + { + TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexRelease() +")); + TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), + (Kern::CurrentThread()).iId)); + + // release mutex + Kern::MutexSignal( *(Pimpl().iMutex) ); + + TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexRelease() -")); + TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), + (Kern::CurrentThread()).iId)); + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osadebug.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osadebug.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: osa debug library implementation +* +*/ + +/* +* %version: 4 % +*/ + +#include "osa_includeme.h" +#include +#include "osacarray.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MWlanOsa::FormattedPrint( TUint32 aLevel, + const TInt8* aFmt, + ... ) + { +#ifndef NDEBUG + + if ( DEBUG_LEVEL & aLevel ) + { + TPtrC8 format((const TText8*)aFmt); + + const TInt KTraceBufLen( 512 ); + TBuf8 msg; + + VA_LIST list; + VA_START(list,aFmt); + msg.Zero(); + Kern::AppendFormat( msg, (const char*)aFmt, list ); + msg.Append('\0'); + Kern::Printf( (const char*)&msg[0] ); + VA_END(list); + } +#endif // NDEBUG + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MWlanOsa::Assert( const TInt8* aFile, TInt aLine, TBool aExpression ) + { +#ifndef NDEBUG + + if ( !aExpression ) + { + TraceDump( MWlanOsa::KFatalLevel, + (reinterpret_cast(aFile)) ); + TraceDump( MWlanOsa::KFatalLevel, (("Line: %d"), aLine)); + + Kern::Fault(("[WLAN] Subsystem programmed fault"), 0); + } + else + { + // left intentionally empty + } + +#endif // NDEBUG + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MWlanOsa::Dump( TUint32 aLevelMask, + const TInt8* aData, + TInt aDataSize ) + { +#ifndef NDEBUG + + // Defines how many values in a row + const TInt ValuesInRow = 8; + + const TInt LineWidth = 3*ValuesInRow; + const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + + if ( DEBUG_LEVEL & aLevelMask ) + { + TBuf8< LineWidth > line; + line.Zero(); + for ( TInt i=0; i + +#include "osadfc.h" +#include "osa.h" + +// mask value to check is dfc cancel event occurred +const TUint KDfcCancelledMask( 1 << 0 ); + +struct WlanDfcImpl : public DBase + { + + /** + * Ctor + * + * @since S60 v3.2 + * @param aWlanDfc wlandfc object + * @param aOsa wlanosa object + * @param aDfcQueue Pointer to the DFC queue to use + */ + WlanDfcImpl( WlanDfc& aWlanDfc, WlanOsa& aOsa, TDfcQue* aDfcQueue ); + + /** + * Dtor + * + * @since S60 v3.2 + */ + virtual ~WlanDfcImpl(); + + /** + * OS dfc callback method + * + * @since S60 v3.2 + * @param aPtr callback context + */ + static void DfcDoToggle( TAny* aPtr ); + + /** + * osa object reference + */ + WlanOsa& iOsa; + + /** + * dfc object + */ + TDfc iDfc; + + /** + * dfc client callback interface + * Not Own. + */ + MWlanDfcClient* iDfcClient; + + /** + * callback context + */ + TInt iCtx; + + /** + * internal state flags + */ + TUint iFlags; + +private: + + // Prohibit copy constructor. + WlanDfcImpl( const WlanDfcImpl& ); + // Prohibit assigment operator. + WlanDfcImpl& operator= ( const WlanDfcImpl& ); + + }; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDfcImpl::WlanDfcImpl( + WlanDfc& aWlanDfc, + WlanOsa& aOsa, + TDfcQue* aDfcQueue ) + : iOsa( aOsa ), iDfc( DfcDoToggle, &aWlanDfc, 0 ), + iDfcClient( NULL ), iCtx( 0 ), iFlags( 0 ) + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfcImpl ctor: + this 0x%08x"), this)); + + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + aDfcQueue != NULL ); + + iDfc.SetDfcQ( aDfcQueue ); + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfcImpl ctor: - this 0x%08x"), this)); + }; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDfcImpl::~WlanDfcImpl() + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfcImpl dtor: + this 0x%08x"), this)); + + iDfc.Cancel(); + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfcImpl dtor: - this 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDfcImpl::DfcDoToggle( TAny* aPtr ) + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfcImpl::DfcDoToggle: + addr: 0x%08x"), aPtr)); + + WlanDfc* ptr( static_cast(aPtr) ); + ptr->RealDfc(); + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfcImpl::DfcDoToggle: - addr: 0x%08x"), aPtr)); + } + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDfc::~WlanDfc() + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc dtor + addr: 0x%08x"), this)); + + if ( IsValid() ) + { + delete iPimpl; + } + else + { + // left intentionally empty + } + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc dtor - addr: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanDfc::WlanDfc( + WlanOsa& aOsa, + void* aDfcQueue ) : iPimpl( NULL ) + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc ctor + addr: 0x%08x"), this)); + + iPimpl = new WlanDfcImpl( + *this, + aOsa, + reinterpret_cast(aDfcQueue) ); + + if ( iPimpl ) + { + // allocation success -> proceed + Validate(); + } + else + { + // allocation failed invalidate object + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + InValidate(); + } + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc ctor - addr: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDfc::RealDfc() + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc::RealDfc: + addr: 0x%08x"), this)); + + // acquire system lock + Pimpl().iOsa.MutexAcquire(); + + if ( !(Pimpl().iFlags & KDfcCancelledMask) ) + { + // DFC has NOT been cancelled + Pimpl().iDfcClient->OnDfc( Pimpl().iCtx ); + } + else + { + TraceDump(DFC_LEVEL, + (("[WLAN] WlanDfc::RealDfc: DFC cancelled -> skip client call"))); + // left intentionally empty + } + + // release system lock + Pimpl().iOsa.MutexRelease(); + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc::RealDfc: - addr: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// From class MWlanDfc. +// +// --------------------------------------------------------------------------- +// +void WlanDfc::Enqueue( MWlanDfcClient& aDfcClient, TInt aCtx ) + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc::Enqueue: + addr: 0x%08x"), this)); + + Pimpl().iFlags &= ~KDfcCancelledMask; + Pimpl().iDfcClient = &aDfcClient; + Pimpl().iCtx = aCtx; + + if ( NKern::CurrentContext() == NKern::EInterrupt ) + { + TraceDump(DFC_LEVEL, + ("[WLAN] WlanDfc::Enqueue: in ISR context")); + Pimpl().iDfc.Add(); + } + else + { + TraceDump(DFC_LEVEL, + ("[WLAN] WlanDfc::Enqueue: in other than ISR context")); + Pimpl().iDfc.Enque(); + } + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc::Enqueue: - addr: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// From class MWlanDfc. +// +// --------------------------------------------------------------------------- +// +void WlanDfc::Dequeue() + { + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc::Dequeue: + addr: 0x%08x"), this)); + + Pimpl().iFlags |= KDfcCancelledMask; + Pimpl().iDfc.Cancel(); + + TraceDump(INFO_LEVEL | DFC_LEVEL, + (("[WLAN] WlanDfc::Dequeue: - addr: 0x%08x"), this)); + } + + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osaplatform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osaplatform.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: certain osa platfrom specific implementations +* +*/ + +/* +* %version: 4 % +*/ + +#include "osa_includeme.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void* GpAlloc( TInt aSize, TBool /*aZeroStamp*/ ) + { + // the method below always zero stamps the memory upon alloc + return Kern::Alloc( aSize ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void GpFree( void* aPtr ) + { + Kern::Free( aPtr ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osaplatformhwchunk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osaplatformhwchunk.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanPlatformHwChunk implementation +* +*/ + +/* +* %version: 8 % +*/ + +#include "osa_includeme.h" + +#include +#include + +#include "osaplatformhwchunk.h" +#include "osachunk.h" + +struct WlanPlatformHwChunkImpl : public DBase, public WlanObject + { + + /** + * Ctor + * + * @since S60 v3.2 + * @param aStartOfBuf begin of the memory buffer + * @param aEndOfBuf 1 past end of the memory buffer + * @param aPlatChunkHw platform chunk object + * @param aPhysRamAddr physical ram address + * @param aPhysRamSize size of the physical ram + * @param aAllocationUnit size of the allocation unit in bytes + */ + WlanPlatformHwChunkImpl( + TUint8* aStartOfBuf, + TUint8* aEndOfBuf, + DPlatChunkHw** aPlatChunkHw, + TPhysAddr aPhysRamAddr, + TInt aPhysRamSize, + TInt aAllocationUnit ); + + /** + * Dtor + * + * @since S60 v3.2 + */ + virtual ~WlanPlatformHwChunkImpl(); + + /** + * Deallocate acquired resources (if any) + * + * @since S60 v3.2 + */ + inline void Dispose(); + + /** + * the one and only chunk + * Own. + */ + WlanChunk* iChunk; + + /** + * the one and only platform chunk + * Own. + */ + DPlatChunkHw* iPlatChunk; + + /** + * physical ram address + */ + TPhysAddr iPhysRamAddr; + + /** + * physical ram size + */ + TInt iPhysRamSize; + +private: + + // Prohibit copy constructor. + WlanPlatformHwChunkImpl( const WlanPlatformHwChunkImpl& ); + // Prohibit assigment operator. + WlanPlatformHwChunkImpl& operator= ( + const WlanPlatformHwChunkImpl& ); + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt WlanPlatformHwChunk::RoundToPageSize( TInt aSizeInBytes ) + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanPlatformHwChunk::RoundToPageSize +")); + + // extract MMU page size in bytes + aSizeInBytes = Kern::RoundToPageSize( aSizeInBytes ); + + TraceDump(INFO_LEVEL, ("[WLAN] WlanPlatformHwChunk::RoundToPageSize -")); + + return aSizeInBytes; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool WlanPlatformHwChunk::AllocatePhysicalRam( TInt aSizeInBytes, + TPhysAddr& aPhysAddr ) + { + TBool ret( ETrue ); + TraceDump(INFO_LEVEL, + ("[WLAN] WlanPlatformHwChunk::AllocatePhysicalRam +")); + + const TInt ret_code( Epoc::AllocPhysicalRam( aSizeInBytes, aPhysAddr ) ); + if ( ret_code != KErrNone ) + { + // this can happen if we have no memory + ret = EFalse; + TraceDump(ERROR_LEVEL, (("[WLAN] error: allocation: %d"), ret_code)); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + TraceDump(INFO_LEVEL, + ("[WLAN] WlanPlatformHwChunk::AllocatePhysicalRam -")); + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void WlanPlatformHwChunk::FreePhysicalRam( TPhysAddr aPhysRamAddr, + TInt aPhysRamSize ) + { + TraceDump(INFO_LEVEL, ("[WLAN] WlanPlatformHwChunk::FreePhysicalRam +")); + + const TInt ret = Epoc::FreePhysicalRam( aPhysRamAddr, aPhysRamSize ); + if ( ret != KErrNone ) + { + // no valid use case exists for this code path to be taken + TraceDump(CRIT_LEVEL, (("[WLAN] critical: value: %d"), ret)); + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + else + { + // left intentionally empty + } + + TraceDump(INFO_LEVEL, ("[WLAN] WlanPlatformHwChunk::FreePhysicalRam -")); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPlatformHwChunkImpl::WlanPlatformHwChunkImpl( + TUint8* aStartOfBuf, + TUint8* aEndOfBuf, + DPlatChunkHw** aPlatChunkHw, + TPhysAddr aPhysRamAddr, + TInt aPhysRamSize, + TInt aAllocationUnit ) + : iChunk( NULL ), iPlatChunk( *aPlatChunkHw ), + iPhysRamAddr( aPhysRamAddr ), iPhysRamSize( aPhysRamSize ) + { + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunkImpl ctor +: 0x%08x"), this)); + + iChunk = new WlanChunk( aStartOfBuf, aEndOfBuf, aAllocationUnit ); + if ( iChunk ) + { + if ( iChunk->IsValid() ) + { + Validate(); // mark as valid + } + else + { + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + InValidate(); // mark as invalid + + // chunk deallocated in dtor so we don't have to do it here + } + } + else + { + // allocation failure + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + InValidate(); // mark as invalid + } + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunkImpl ctor -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPlatformHwChunkImpl::~WlanPlatformHwChunkImpl() + { + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunkImpl dtor +: 0x%08x"), this)); + + Dispose(); + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunkImpl dtor +: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// only 1 call point. That's the reason for inlining +// --------------------------------------------------------------------------- +// +inline void WlanPlatformHwChunkImpl::Dispose() + { + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunkImpl::Dispose +: 0x%08x"), this)); + + // NOTE: always dellocate the chunk prior freeing the memory associated to + // it + delete iChunk; + iChunk = NULL; + + if ( iPlatChunk ) + { + // close the chunk. This also automatically deletes the object + // as its reference count goes to 0 + iPlatChunk->Close( NULL ); + // free the physical ram which was associated with the chunk + WlanPlatformHwChunk::FreePhysicalRam( iPhysRamAddr, iPhysRamSize ); + } + else + { + // left intentionally empty + } + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunkImpl::Dispose -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline WlanPlatformHwChunkImpl& WlanPlatformHwChunk::Pimpl() + { + return *iPimpl; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const WlanPlatformHwChunkImpl& WlanPlatformHwChunk::Pimpl() const + { + return *iPimpl; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPlatformHwChunk::WlanPlatformHwChunk( + TInt aSizeInBytes, + TBool aUseCachedMemory, + TInt aAllocationUnit ) + : iPimpl( NULL ), iUseCachedMemory ( aUseCachedMemory ) + { + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk ctor +: 0x%08x"), this)); + + TBool ret( EFalse ); + TPhysAddr phys_ram_addr( 0 ); // physical ram address + + TraceDump(PLAT_HW_CHUNK, + (("[WLAN] WlanPlatformHwChunk requested memory size: %d"), + aSizeInBytes)); + + // round up request to MMU page size boundary + const TInt phys_ram_size( RoundToPageSize( aSizeInBytes ) ); + + TraceDump(PLAT_HW_CHUNK, + (("[WLAN] WlanPlatformHwChunk memory size to be aquired: %d"), + phys_ram_size)); + + // allocate the physical ram + ret = AllocatePhysicalRam( phys_ram_size, phys_ram_addr ); + + if ( ret ) + { + // physical ram allocation success + // allocate hw chunk for the physical ram + ret = AllocateHardwareChunk( + phys_ram_addr, + phys_ram_size, + aAllocationUnit ); + if ( ret ) + { + // chunk creation success + Validate(); // mark as valid + } + else + { + // chunk creation failure + // free the physical ram + FreePhysicalRam( phys_ram_addr, phys_ram_size ); + InValidate(); // mark as invalid + } + } + else + { + // physical ram allocation failure + InValidate(); // mark as invalid + } + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk ctor -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanPlatformHwChunk::~WlanPlatformHwChunk() + { + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk dtor +: 0x%08x"), this)); + + delete iPimpl; + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk dtor -: 0x%08x"), this)); + } + +// --------------------------------------------------------------------------- +// only 1 call point thats the reason for inlining +// --------------------------------------------------------------------------- +// +inline TBool WlanPlatformHwChunk::AllocateHardwareChunk( + TPhysAddr aPhysRamAddr, + TInt aPhysRamSize, + TInt aAllocationUnit ) + { + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk::AllocateHardwareChunk +: 0x%08x"), + this)); + + TBool ret( EFalse ); + + // determine if cached memory shall be used + TUint cacheOption = iUseCachedMemory ? + EMapAttrCachedMax : + EMapAttrFullyBlocking; + + // lets create a hw chunk for our physical ram + DPlatChunkHw* chunk = NULL; + TInt code = DPlatChunkHw::New( + chunk, aPhysRamAddr, aPhysRamSize, + EMapAttrSupRw | cacheOption ); + + if ( KErrNone != code ) + { + // creation error -> bail out + TraceDump(ERROR_LEVEL, (("[WLAN] error: allocation %d"), code)); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk::AllocateHardwareChunk -: 0x%08x"), + this)); + + return ret; + } + else + { + TraceDump(PLAT_HW_CHUNK, + (("[WLAN] Platform Hw Chunk create success with cacheOption: 0x%08x"), + cacheOption)); + } + + // hw chunk creation success proceed + iPimpl = new WlanPlatformHwChunkImpl( + reinterpret_cast(chunk->LinearAddress()), + (reinterpret_cast(chunk->LinearAddress())) + aPhysRamSize, + &chunk, + aPhysRamAddr, + aPhysRamSize, + aAllocationUnit ); + + if ( iPimpl ) + { + // success -> validate implementation + if ( Pimpl().IsValid() ) + { + Validate(); // we are valid to go + ret = ETrue; + } + else + { + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + InValidate(); // we are invalid to go + + // allways dealloc in dtor + } + } + else + { + // allocation failed -> trace + TraceDump(ERROR_LEVEL, ("[WLAN] error: allocation")); + Trace( ERROR_LEVEL, + reinterpret_cast(WLAN_FILE), __LINE__ ); + + // we must now deallocate allocated resources + // allways close the chunk + // this also automatically deletes the object + // as its reference count goes to 0 + chunk->Close( NULL ); + } + + TraceDump(INFO_LEVEL, + (("[WLAN] WlanPlatformHwChunk::AllocateHardwareChunk -: 0x%08x"), + this)); + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +MWlanOsaChunkBase& WlanPlatformHwChunk::Chunk() + { + return *(Pimpl().iChunk); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const MWlanOsaChunkBase& WlanPlatformHwChunk::Chunk() const + { + return *(Pimpl().iChunk); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osatimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/osa_symbian/src/osatimer.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,302 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WlanTimer implementation +* +*/ + +/* +* %version: 10 % +*/ + +#include "osa_includeme.h" + +#include + +#include "osatimer.h" +#include "osa.h" + +// mask value to check is timer periodic or not +const TUint KPeriodicTimerMask( 1 << 1 ); +// mask value to check if timer is running +const TUint KTimerRunningMask( 1 << 2 ); + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanTimer::WlanTimer( WlanOsa& aOsa, void* aDfcQueue ) + : iTimerDfc( WlanTimer::TimerTrigger, this, 0 ), + iOsa( aOsa ), + iNTimer( ), + iTimerClient( NULL ), + iTimeoutInMicroSeconds( 0 ), + iCtx( 0 ), + iFlags( 0 ), + iRefCnt( 1 ) + { + TraceDump(INFO_LEVEL | TIMER_LEVEL, ("[WLAN] WlanTimer() ctor +")); + + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__, + aDfcQueue != NULL ); + + iTimerDfc.SetDfcQ( reinterpret_cast(aDfcQueue) ); + Validate(); + + TraceDump(INFO_LEVEL | TIMER_LEVEL, ("[WLAN] WlanTimer() ctor -")); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +WlanTimer::~WlanTimer() + { + TraceDump(INFO_LEVEL | TIMER_LEVEL, ("[WLAN] WlanTimer() dtor +")); + + if ( iRefCnt != 0 ) + { + TraceDump(CRIT_LEVEL, (("[WLAN] error: Timer destroyed while " + "active - delete used directly?"))); + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__ ); + } + + TraceDump(INFO_LEVEL | TIMER_LEVEL, ("[WLAN] WlanTimer() dtor -")); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTimer::TimerTrigger( TAny* aPtr ) + { + WlanTimer* timer = reinterpret_cast< WlanTimer* >( aPtr ); + timer->TimerTrigger(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTimer::TimerTrigger() + { + WlanOsa &osa = iOsa; + + TraceDump(INFO_LEVEL | TIMER_LEVEL, ("[WLAN] WlanTimer::TimerTrigger +")); + + // get hold of the global mutex + iOsa.MutexAcquire(); + + if (iFlags & KTimerRunningMask) + { + if ( iFlags & KPeriodicTimerMask ) + { + // a periodic timer was requested - re-arm the timer for the next + // run now. + const TInt ticks( + NKern::TimerTicks( iTimeoutInMicroSeconds / 1000 )); + TraceDump(TIMER_LEVEL, (("[WLAN] timer ticks: %d"), ticks)); + + // on arming the timer, add a reference to it - the reference + // shall be cleared upon the completion callback execution. + RefAdd(); + const TInt ret (iNTimer.Again( ticks )); + + if ( ret != KErrNone ) + { + TraceDump(CRIT_LEVEL, (("[WLAN] error: ret %d"), ret)); + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__ ); + RefDel(); + } + } + else + { + // clear the timer running mask + iFlags &= (~KTimerRunningMask); + } + + TraceDump(TIMER_LEVEL, + (("[WLAN] current system time: %d"), Kern::SystemTime())); + TraceDump(TIMER_LEVEL, + (("[WLAN] timer client address: 0x%08x"), iTimerClient)); + TraceDump(TIMER_LEVEL, + (("[WLAN] call timer callback with context: %d"), iCtx)); + + // execute the timer client call back function + iTimerClient->OnTimeout( iCtx ); + } + + // a reference was added for this timer instance upon arming of the + // timer - here, we must remove that reference - and possibly delete + // the object instance if we were last to hold reference to it. + // NOTE! here the reference count may become zero (if the + // TimerDestroy OSA method was called for the instance prior to this + // handler executing) and hence the instance may be deleted upon this + // call. do not touch instance data after this call. + RefDel(); + + // release the global mutex - do not use the "iOsa" as the instance + // may now have been deleted, instead use a local reference. + osa.MutexRelease(); + + TraceDump(INFO_LEVEL | TIMER_LEVEL, ("[WLAN] WlanTimer::TimerTrigger -")); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTimer::Enqueue( + MWlanTimerClient& aTimerClient, + TInt aCtx, + TInt aTimeoutInMicroSeconds, + TBool aPeriodic ) + { + + if ( iFlags & KTimerRunningMask ) + { + // ignore the call if the timer is already running + TraceDump(INFO_LEVEL | TIMER_LEVEL, + (("[WLAN] WlanTimer::Enqueue: + addr: 0x%08x: " + "Timer already enqueued, no effect."), this)); + } + else + { + TraceDump(INFO_LEVEL | TIMER_LEVEL, + (("[WLAN] WlanTimer::Enqueue: + addr: 0x%08x"), this)); + TraceDump(TIMER_LEVEL, + (("[WLAN] timeout in microseconds: %d"), aTimeoutInMicroSeconds)); + TraceDump(TIMER_LEVEL, (("[WLAN] periodic: %d"), aPeriodic)); + + // store timer parameters + iFlags = KTimerRunningMask; + iTimerClient = &aTimerClient; + iCtx = aCtx; + + if ( aPeriodic ) + { + iFlags |= KPeriodicTimerMask; + } + + const TInt KMinTimeout = 1000; + + // the timeout minimum is 1000 us + if (aTimeoutInMicroSeconds < KMinTimeout) + { + iTimeoutInMicroSeconds = KMinTimeout; + } + else + { + // adding 999 here will allow the us timeout to be rounded + // up to the next full ms, guaranteeing at least the timeout + // requested, no less. + iTimeoutInMicroSeconds = aTimeoutInMicroSeconds + 999; + } + + // arm the timer (using ms instead of us for the unit) + const TInt ticks( NKern::TimerTicks( iTimeoutInMicroSeconds / 1000 )); + + TraceDump(TIMER_LEVEL, (("[WLAN] timeout in ticks: %d"), ticks)); + TraceDump(TIMER_LEVEL, + (("[WLAN] current system time: %d"), Kern::SystemTime())); + + // add reference to the timer instance - this reference will be + // removed once the timeout event has been handled + RefAdd(); + const TInt ret( iNTimer.OneShot( ticks, iTimerDfc )); + + if ( ret != KErrNone ) + { + TraceDump(CRIT_LEVEL, (("[WLAN] error: ret %d"), ret)); + MWlanOsa::Assert( + reinterpret_cast(WLAN_FILE), __LINE__ ); + RefDel(); + } + } + + TraceDump(INFO_LEVEL | TIMER_LEVEL, + (("[WLAN] WlanTimer::Enqueue: - addr: 0x%08x: "), this)); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTimer::Dequeue() + { + TraceDump(INFO_LEVEL | TIMER_LEVEL, + (("[WLAN] WlanTimer::Dequeue: + addr: 0x%08x"), this)); + + if ( iFlags & KTimerRunningMask ) + { + iFlags = 0; + + if ( iNTimer.Cancel()) + { + // if cancellation of the timer succeeds, remove a reference from + // the timer instance - as this will not be done in the timeout + // handler now. NOTE! that here the reference count should never + // reach zero (instance exists + the timer is running == 2) + RefDel(); + + } + // if the cancellation of the timer failed above, the DFC is most + // likely already executing - attempting to cancel it here would + // be wasting of clock cycles. + // + // the most common scenario is that the timer cancel succeeds. for + // the rare cases of a failure, we just let the DFC execute, and + // do nothing (the flags are cleared.) + } + else + { + TraceDump(INFO_LEVEL | TIMER_LEVEL, + (("[WLAN] WlanTimer::Dequeue: Timer is not running."))); + } + + TraceDump(INFO_LEVEL | TIMER_LEVEL, + (("[WLAN] WlanTimer::Dequeue: - addr: 0x%08x"), this)); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTimer::RefDel(void) + { + // decrement the reference counter + iRefCnt --; + + if (iRefCnt == 0) + { + // referees have reached zero, the object is abandoned, and + // shall be deleted + WlanTimer *timer = this; + delete timer; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanTimer::RefAdd(void) + { + // increment the reference counter + iRefCnt ++; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project wlanldd +* +*/ + +/* +* %version: 28 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES + +#if !defined(WINS) +umac.mmp +wlanldd.mmp +wlantrace.mmp +wlanosa.mmp +wlanosadebug.mmp +#endif + +PRJ_EXPORTS + +// Internal interfaces + +../inc/RWlanLogicalChannel.h |../../../../inc/RWlanLogicalChannel.h +../inc/RWlanLogicalChannel.inl |../../../../inc/RWlanLogicalChannel.inl +../inc/wlanlddcommon.h |../../../../inc/wlanlddcommon.h +../inc/FrameXferBlock.h |../../../../inc/FrameXferBlock.h +../inc/wllddcircularbuffer.h |../../../../inc/wllddcircularbuffer.h +../inc/wllddcircularbuffer.inl |../../../../inc/wllddcircularbuffer.inl +../inc/EtherCardApi.h |../../../../inc/EtherCardApi.h +../inc/EtherCardApi.inl |../../../../inc/EtherCardApi.inl +../inc/wllddoidmsgstorage.h |../../../../inc/wllddoidmsgstorage.h + +../../../wlan_common/umac_common/inc/Umac.h |../../../../inc/Umac.h +../../../wlan_common/umac_common/inc/umac_types.h |../../../../inc/umac_types.h +../../../wlan_common/umac_common/inc/algorithm.h |../../../../inc/algorithm.h +../../../wlan_common/umac_common/inc/UmacProtocolStackSideUmac.h |../../../../inc/UmacProtocolStackSideUmac.h +../../../wlan_common/umac_common/inc/UmacManagementSideUmac.h |../../../../inc/UmacManagementSideUmac.h +../../../wlan_common/umac_common/inc/umacoidmsg.h |../../../../inc/umacoidmsg.h +../../../wlan_common/umac_common/inc/pack.h |../../../../inc/pack.h +../../../wlan_common/umac_common/inc/802dot11.h |../../../../inc/802dot11.h +../../../wlan_common/umac_common/inc/UmacManagementSideUmacCb.h |../../../../inc/UmacManagementSideUmacCb.h +../../../wlan_common/umac_common/inc/UmacProtocolStackSideUmacCb.h |../../../../inc/UmacProtocolStackSideUmacCb.h +../../../wlan_common/umac_common/inc/UmacProtocolStackSideUmacCb.inl |../../../../inc/UmacProtocolStackSideUmacCb.inl +../../../wlan_common/umac_common/inc/trace_util.h |../../../../inc/trace_util.h +../../../wlan_common/umac_common/inc/UmacTimerClient.h |../../../../inc/UmacTimerClient.h +../../../wlan_common/umac_common/inc/umacdfcclient.h |../../../../inc/umacdfcclient.h +../../../wlan_common/umac_common/inc/umaceventdispatcherclient.h |../../../../inc/umaceventdispatcherclient.h + +../../../wlan_common/osa_common/inc/osa.h |../../../../inc/osa.h +../../../wlan_common/osa_common/inc/osa.inl |../../../../inc/osa.inl +../../../wlan_common/osa_common/inc/wlanobject.h |../../../../inc/wlanobject.h +../../../wlan_common/osa_common/inc/wlanobject.inl |../../../../inc/wlanobject.inl + +// Iby file + +../rom/wlanldd.iby CORE_OS_LAYER_IBY_EXPORT_PATH(wlanldd.iby) diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/umac.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/umac.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project umac +* +*/ + +/* +* %version: 52 % +*/ + +#include +#include +#include "wlanldddma.mmh" + +TARGET wlanumac.lib + +TARGETTYPE klib + +USERINCLUDE ../../../wlan_common/umac_common/inc +USERINCLUDE ../../../wlan_common/osa_common/inc +USERINCLUDE ../../../../inc + +OS_LAYER_KERNEL_SYSTEMINCLUDE + +SOURCEPATH ../../../wlan_common/umac_common/src + +SOURCE Umac.cpp +SOURCE UmacManagementSideUmacCb.cpp +SOURCE UmacProtocolStackSideUmacCb.cpp + +SOURCE UmacMacState.cpp +SOURCE UmacMacActionState.cpp +SOURCE UmacDot11State.cpp +SOURCE UmacWsaCommand.cpp +SOURCE umacwhacomplexcommand.cpp +SOURCE UmacContextImpl.cpp + +SOURCE umacaddbroadcastwepkey.cpp +SOURCE umacconfiguretxqueueparams.cpp +SOURCE umacconfiguretxautoratepolicy.cpp + +SOURCE UmacWsaInitiliaze.cpp +SOURCE UmacWsaConfigure.cpp +SOURCE UmacWsaJoin.cpp +SOURCE UmacWsaScan.cpp +SOURCE umacwhastopscan.cpp +SOURCE UmacWsaDisconnect.cpp +SOURCE UmacWsaReadMib.cpp +SOURCE UmacWsaWriteMib.cpp +SOURCE UmacWsaSetBssParameters.cpp +SOURCE UmacWsaAddKey.cpp +SOURCE UmacWsaSetPsMode.cpp +SOURCE umacwhaconfigurequeue.cpp +SOURCE umacwhaconfigureac.cpp +SOURCE umacwharelease.cpp + +SOURCE UmacWsaKeyIndexMapper.cpp +SOURCE UmacTxRateAdaptation.cpp +SOURCE umaceventdispatcher.cpp +SOURCE umacpacketscheduler.cpp +SOURCE umacelementlocator.cpp +SOURCE umacnullsendcontroller.cpp +SOURCE umacsignalpredictor.cpp + +SOURCE umacprivacymodefilters.cpp +SOURCE UmacPrivacyModeFilterNone.cpp +SOURCE UmacPrivacyModeFilterWep.cpp +SOURCE UmacPrivacyModeFilterWpa.cpp +SOURCE UmacPrivacyModeFilter1x.cpp +SOURCE UmacPrivacyModeFilteMixedModeWep.cpp +SOURCE UmacPrivacyModeFilteMixedMode1x.cpp +SOURCE umacprivacymodefilterwapi.cpp + +SOURCE umacpowermodemgrbase.cpp +SOURCE umacactivemodepowermodemgr.cpp +SOURCE umaclightpsmodepowermodemgr.cpp +SOURCE umacdeeppsmodepowermodemgr.cpp +SOURCE umacdynamicpowermodemgmtcntx.cpp + +SOURCE UmacDot11Associated.cpp +SOURCE UmacDot11InfrastructureMode.cpp +SOURCE UmacDot11MacError.cpp +SOURCE UmacDot11MibDefaultConfigure.cpp +SOURCE umacwhatodot11typeconverter.cpp + +SOURCE UmacDot11PrepareForBssMode.cpp +SOURCE UmacDot11Roam.cpp +SOURCE UmacDot11Synchronize.cpp +SOURCE UmacDot11DisassociationPending.cpp +SOURCE UmacDot11ReassociationPending.cpp + +SOURCE UmacDot11InitPhase1.cpp +SOURCE UmacDot11Idle.cpp + +SOURCE UmacDot11Connecting.cpp +SOURCE UmacDot11AuthenticatePending.cpp +SOURCE UmacDot11OpenAuthPending.cpp +SOURCE UmacDot11SharedAuthPending.cpp +SOURCE UmacDot11AssociationPending.cpp + +SOURCE UmacDot11InfrastructureModeInit.cpp + +SOURCE UmacDot11DeauthPending.cpp +SOURCE UmacDot11SoftReset.cpp +SOURCE UmacDot11PrepareForIbssMode.cpp +SOURCE umacdot11ibssnormalmode.cpp +SOURCE UmacDot11IbssMode.cpp +SOURCE umacscanmoderunning.cpp +SOURCE umacscanmodestopped.cpp +SOURCE umacstartscanningmode.cpp +SOURCE umacstopscanningmode.cpp +SOURCE umacscanfsm.cpp +SOURCE umacdot11idlescanningmode.cpp +SOURCE umacdot11ibssscanningmode.cpp +SOURCE umacdot11infrastructurescanningmode.cpp +SOURCE umacdot11infrastructurenormalmode.cpp +SOURCE umacdot11pwrmgmttransitionmode.cpp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanldd.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanldd.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlanldd +* +*/ + +/* +* %version: 29 % +*/ + +#include +#include +#include "wlanldddma.mmh" +#include "wlanlddtrace.mmh" + +TARGET wlanldd.ldd + +TARGETTYPE ldd + +UID 0x100000af 0x101F8E53 + +MACRO ALWAYS_KERNEL + +// trace levels +MACRO INIT_LEVEL=0x00000020 +MACRO UMAC_PROTOCOL_STATE=0x00000040 +MACRO NWSA_CMD_STATE=0x00000080 +MACRO MUTEX=0x00000100 +MACRO NWSA_CALLBACK=0x00000200 +MACRO UMAC_MGMT_CALLBACK=0x00000400 +MACRO UMAC_PROTO_CALLBACK=0x00000800 +MACRO NWSA_CMD_STATE_DETAILS=0x00001000 +MACRO QOS=0x00002000 +MACRO WLM_CMD=0x00004000 +MACRO WLM_INDICATION=0x00008000 +MACRO WLM_CMD_DETAILS=0x00010000 +MACRO UMAC_DETAILS=0x00020000 +MACRO NWSA_TX=0x00040000 +MACRO NWSA_TX_DETAILS=0x00080000 +MACRO UMAC_AUTH=0x00100000 +MACRO UMAC_ASSOC=0x00200000 +MACRO PACKETSCHEDULER=0x00400000 +MACRO MEMORY=0x00800000 +MACRO TX_RATE_ADAPT=0x01000000 +MACRO RX_FRAME=0x02000000 +MACRO SCAN=0x04000000 +MACRO PWRSTATETRANSITION=0x08000000 +MACRO DOT11STATETRANSIT=0x10000000 +MACRO EVENTDISPATCHER=0x20000000 +MACRO CCX=0x40000000 +// for temporary trace +MACRO SCRATCH=0x80000000 + +USERINCLUDE ../inc +USERINCLUDE ../../../wlan_common/osa_common/inc +USERINCLUDE ../../../../inc + +OS_LAYER_KERNEL_SYSTEMINCLUDE + +STATICLIBRARY wlantrace.lib +STATICLIBRARY wlanumac.lib +STATICLIBRARY wlanosa.lib +STATICLIBRARY wlanosadebug.lib + +SOURCEPATH ../src + +SOURCE WLanLogicalDevice.cpp +SOURCE wllddlogicalchannelbase.cpp +SOURCE WlanLogicalChannel.cpp +SOURCE WlLddPlatfrom.cpp +SOURCE EthernetFrameMemMngr.cpp +SOURCE FrameXferBlock.cpp +SOURCE DataFrameMemMngr.cpp +SOURCE MgmtFrameMemMngr.cpp +SOURCE wllddpowerhandler.cpp +SOURCE wlldddmausablememory.cpp + +capability all diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanldddma.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanldddma.mmh Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlanldd +* +*/ + +/* +* %version: 3 % +*/ + +// This macro needs to be defined to make it possible for WLAN PDD to use DMA +// when accessing frame transfer buffers from this component. +MACRO __WLAN_ENABLE_DMA diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanlddtrace.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanlddtrace.mmh Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlanldd +* +*/ + +/* +* %version: 3 % +*/ + +// This macro defines the type(s) of trace information that is written to +// the terminal’s trace interface when a debug (udeb) version of this +// component is used. +MACRO DEBUG_LEVEL=0xFFFFFFFF diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanosa.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanosa.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlanosa +* +*/ + +/* +* %version: 11 % +*/ + +#include +#include +#include "wlanldddma.mmh" + +TARGET wlanosa.lib +TARGETTYPE klib + +MACRO ALWAYS_KERNEL +MACRO DEBUG_LEVEL=0x0000012F + +MACRO MEMCHUNK=0x00000020 +MACRO MEMCHUNK_ALLOC=0x00000040 +MACRO MEMCHUNK_FREE=0x00000080 +MACRO MEMORYPOOL=0x00000100 +MACRO PLAT_HW_CHUNK=0x00000200 +MACRO MUTEX_LEVEL=0x00000400 +MACRO TIMER_LEVEL=0x00000800 +MACRO DFC_LEVEL=0x00001000 + +SOURCEPATH ../../osa_symbian/src +SOURCE osa.cpp +SOURCE osadfc.cpp +SOURCE osatimer.cpp +SOURCE osaplatformhwchunk.cpp +SOURCE osaplatform.cpp + +SOURCEPATH ../../../wlan_common/osa_common/src +SOURCE osachunk.cpp +SOURCE osaheap.cpp +SOURCE osamemorypool.cpp + +USERINCLUDE ../../../../inc +USERINCLUDE ../../../wlan_common/osa_common/inc + +OS_LAYER_KERNEL_SYSTEMINCLUDE diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanosadebug.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlanosadebug.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlanosadebug +* +*/ + +/* +* %version: 9 % +*/ + +#include +#include + +MACRO ALWAYS_KERNEL +MACRO DEBUG_LEVEL=0xFFFFFFFF + +TARGET wlanosadebug.lib +TARGETTYPE klib + +SOURCEPATH ../../osa_symbian/src +SOURCE osadebug.cpp + +USERINCLUDE ../../../../inc +USERINCLUDE ../../../wlan_common/osa_common/inc + +OS_LAYER_KERNEL_SYSTEMINCLUDE diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlantrace.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/group/wlantrace.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project wlantrace +* +*/ + +/* +* %version: 15 % +*/ + +#include +#include +#include "wlanlddtrace.mmh" + +TARGET wlantrace.lib + +TARGETTYPE klib + +MACRO ALWAYS_KERNEL + +USERINCLUDE ../inc +USERINCLUDE ../../../../inc + +OS_LAYER_KERNEL_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE wllddtrace.cpp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/DataFrameMemMngr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/DataFrameMemMngr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the DataFrameMemMngr class. +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef DATAFRAMEMMNGR_H +#define DATAFRAMEMMNGR_H + +#include "EthernetFrameMemMngr.h" + +class WlanChunk; + +/** +* Memory manager for protocol stack side client frame Rx memory +* +* @since S60 v3.1 +*/ +class DataFrameMemMngr : public DEthernetFrameMemMngr + { +public: + + /** Ctor */ + DataFrameMemMngr( + DWlanLogicalChannel& aParent, + WlanChunk*& aRxFrameMemoryPool, + TInt aTxFrameBufAllocationUnit ) : + DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ), + iFrameXferBlockProtoStack( NULL ), + iTxDataChunk( NULL ), + iTxFrameMemoryPool( NULL ), + iTxFrameBufAllocationUnit ( aTxFrameBufAllocationUnit ) + {}; + + /** Dtor */ + virtual ~DataFrameMemMngr() + { + iFrameXferBlockProtoStack = NULL; + iTxDataChunk = NULL; + iTxFrameMemoryPool = NULL; + }; + +protected: + + /** + * From DEthernetFrameMemMngr + * Opens a handle to the allocated shared memory chunk + * + * @since S60 5.0 + * @param aThread + * @param aSharedChunkInfo + * @param aSharedMemoryChunk The shared memory chunk + * @return system wide error code, KErrNone upon success + */ + virtual TInt DoOpenHandle( + DThread& aThread, + TSharedChunkInfo& aSharedChunkInfo, + DChunk* aSharedMemoryChunk ); + + /** + * From DEthernetFrameMemMngr + * Gets called when rx frame read cycle has ended. + * + * @since S60 3.1 + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + * @return ETrue if a pending user mode frame read request exists + * and callee should complete it, + * EFalse otherwise + */ + virtual TBool DoEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * From DEthernetFrameMemMngr + * Gets start address of Rx buffers (their offset addresses) + * that are waiting for completion to user mode + * + * @since S60 3.1 + * @return see above + */ + virtual TUint32* DoGetTobeCompletedBuffersStart(); + + /** + * From DEthernetFrameMemMngr + * Gets start address of Rx buffers (their offset addresses) + * that have been completed to user mode + * + * @since S60 3.1 + * @return see above + */ + virtual TUint32* DoGetCompletedBuffersStart(); + + /** + * From DEthernetFrameMemMngr + * Gets called when user mode client issues a frame receive request + * and Rx buffers have been completed to it. The completed Rx frame + * buffers are freed. + * + * @since S60 3.1 + */ + virtual void DoFreeRxBuffers(); + + /** + * From DEthernetFrameMemMngr + * Allocates a Tx packet from the shared memory. + * + * @param aLength Length of the requested Tx buffer in bytes + * @return Pointer to the meta header attached to the allocated packet, on + * success. + * NULL, in case of failure. + */ + virtual TDataBuffer* AllocTxBuffer( TUint aLength ); + + /** + * From DEthernetFrameMemMngr + * Deallocates a Tx packet. + * + * All Tx packets allocated with AllocTxBuffer() must be deallocated using + * this method. + * + * @param aPacket Meta header of the packet to the deallocated + */ + virtual void FreeTxPacket( TDataBuffer*& aPacket ); + +private: + + /** + * From DEthernetFrameMemMngr + * Memory finalization method. + */ + virtual void OnReleaseMemory(); + + // Prohibit copy constructor. + DataFrameMemMngr( const DataFrameMemMngr& ); + // Prohibit assigment operator. + DataFrameMemMngr& operator= ( const DataFrameMemMngr& ); + +private: // Data + + /** + * array of TDataBuffer offset addresses, denoting Rx buffers, + * which are waiting here in kernel mode to be completed + * to user mode, when the next frame receive request arrives + */ + TUint32 iTobeCompletedBuffers[KMaxToBeCompletedRxBufs]; + + /** + * array of TDataBuffer offset addresses, denoting Rx buffers, that are + * currently under processing in user mode + */ + TUint32 iCompletedBuffers[KMaxCompletedRxBufs]; + + RFrameXferBlockProtocolStack* iFrameXferBlockProtoStack; + + /** + * pointer to protocol stack side Tx area start in the kernel address + * space + */ + TUint8* iTxDataChunk; + + /** + * Tx frame memory pool manager + * Own. + */ + WlanChunk* iTxFrameMemoryPool; + + /** + * size of the Tx frame buffer allocation unit in bytes + */ + TInt iTxFrameBufAllocationUnit; + }; + +#endif // DATAFRAMEMMNGR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardApi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardApi.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the RPcmNetCardIf class. +* +*/ + +/* +* %version: 12 % +*/ + +#if !defined(__ETHERAPI_H__) +#define __ETHERAPI_H__ + +#include "wlanlddcommon.h" +#include "FrameXferBlock.h" + +#ifndef __KERNEL_MODE__ +#include // for RChunk +#endif + +class TCapsPcmNetCd + { +public: + TVersion version; + }; + +/** +* User mode interface for ethernet transfer over WLAN +* +* @since S60 v3.1 +*/ +class RPcmNetCardIf : public RBusLogicalChannel + { +public: + + /** The asynchronous call types */ + enum TRequest + { + ERequestRead, + EResumeTx, + }; + + /** The synchronous call types */ + enum TControl + { + EControlGetConfig, + EControlReadCancel, + EControlResumeTxCancel, + ESvControlInitBuffers, + ESvControlFreeBuffers + }; + + /** + * Calls executed in the context of the client's thread, but in + * supervisor mode + */ + enum TControlFast + { + EControlFastAllocTxBuffer = 0x0F000000, + EControlFastAddTxFrame, + }; + +public: + + /** + * Open a channel + * + * @since S60 3.1 + */ + inline TInt Open() ; + + /** + * Get version numbering information. + * + * @since S60 3.1 + * @return version required + */ + inline TVersion VersionRequired() const; + + /** + * Cancel read request. + * + * @since S60 3.1 + */ + inline void ReadCancel() ; + + /** + * Cancel Resume Tx request. + * + * @since S60 5.2 + */ + inline void ResumeTxCancel(); + + /** + * Retrieve configuration information + * + * @since S60 3.1 + * @param aConfig buffer for configuration info + * @return KErrNone on success, any other on failure + */ + inline TInt GetConfig( TDes8& aConfig ) ; + + /** + * Allocate memory for FrameXferBlock to be used in data frame + * Tx- and Rx-operations. + * Does necessary memory allocation and maps the physical memory to + * calling process's address space so that the calling process + * is able to access the memory. + * + * @since S60 3.1 + * @param aFrameXferBlock FrameXferBlock to be initialized by + * the device driver + * @return KErrNone on success, any other on failure + */ + inline TInt InitialiseBuffers( + RFrameXferBlockProtocolStack*& aFrameXferBlock ); + + /** + * Unmap memory mapped by InitiliazeBuffers method from the client + * process's address space and deallocate it. + * Every call to InitialiseBuffers must be matched by a call to + * ReleaseBuffers. + * + * @since S60 3.1 + * @return KErrNone on success, any other on failure + */ + inline TInt ReleaseBuffers(); + + /** + * Asynchronous request to get notified once Tx from the client is + * once again allowed. + * + * @since S60 5.2 + * @param aStatus a TRequestStatus + */ + inline void ResumeTx( TRequestStatus& aStatus ); + + /** + * Asynchronous frame read function + * + * @since S60 3.1 + * @param aStatus a TRequestStatus + */ + inline void RequestFrame( TRequestStatus& aStatus ); + + /** + * Allocate a Tx buffer from the shared memory. + * + * @since S60 5.2 + * @param aLength Length of the requested Tx buffer in bytes + * @return Pointer to the allocated buffer, on success. + * NULL, in case the allocation failed. + * Note! If NULL is returned the client is not allowed to call + * AddTxFrame()(i.e. Tx flow is stopped) until the next time when + * ResumeTx asynchronous request completes. + */ + inline TDataBuffer* AllocTxBuffer( TUint aLength ); + + /** + * Add the specified Tx frame (contained in the buffer allocated from the + * shared memory) to the relevant Tx queue according to the frame's AC + * (i.e. priority). + * The frame will automatically get transmitted in its turn. + * + * @since S60 5.2 + * @param aPacket The frame to add + * @return ETrue if the client is allowed to continue calling this method + * (i.e. Tx flow is not stopped). + * EFalse if the client is not allowed to call this method again + * (i.e. Tx flow is stopped) until the next time when + * ResumeTx asynchronous request completes. + */ + inline TBool AddTxFrame( TDataBuffer* aPacket ); + +#ifndef __KERNEL_MODE__ +private: + /** handle to kernel side shared memory chunk */ + RChunk iSharedMemoryChunk; +#endif + }; + +#ifndef __KERNEL_MODE__ +#include "EtherCardApi.inl" +#endif + +#endif // __ETHERAPI_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardApi.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardApi.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,186 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of RPcmNetCardIf inline methods. +* +*/ + +/* +* %version: 9 % +*/ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt RPcmNetCardIf::Open() + { + return DoCreate( + LDD_NAME, + VersionRequired(), + KUnitEthernet, + NULL, + NULL ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TVersion RPcmNetCardIf::VersionRequired() const + { + return TVersion( + KWlanDriverMajorVersion, + KWlanDriverMinorVersion, + KWlanDriverBuildVersion ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RPcmNetCardIf::ReadCancel() + { + DoCancel( 1 << EControlReadCancel ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RPcmNetCardIf::ResumeTxCancel() + { + DoCancel( 1 << EControlResumeTxCancel ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt RPcmNetCardIf::GetConfig( TDes8& aConfig ) + { + return DoControl( + EControlGetConfig, + const_cast(aConfig.Ptr()) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt RPcmNetCardIf::InitialiseBuffers( + RFrameXferBlockProtocolStack*& aFrameXferBlock ) + { + TInt status ( KErrNone ); + + TSharedChunkInfo info; + + status = DoSvControl( + ESvControlInitBuffers, + static_cast(&info) ); + + if ( status == KErrNone ) + { + // shared memory chunk initialization success + + // Set the handle for the shared memory chunk + iSharedMemoryChunk.SetHandle( info.iChunkHandle ); + + // Set the relevant user mode + // addresses as offsets from the chunk base address + + TUint8* baseAddress ( iSharedMemoryChunk.Base() ); + + const TUint KRxDataChunkSize( + info.iSize + - ( sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize + + sizeof( RFrameXferBlock ) + + sizeof( RFrameXferBlockProtocolStack ) ) ); + + aFrameXferBlock = reinterpret_cast( + baseAddress + + KRxDataChunkSize + + sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize + + sizeof( RFrameXferBlock ) ); + + aFrameXferBlock->SetRxDataChunkField( reinterpret_cast( + baseAddress) ); + + aFrameXferBlock->SetTxDataBufferField( reinterpret_cast( + baseAddress + + KRxDataChunkSize + + sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength) ); + + aFrameXferBlock->UserInitialize( + reinterpret_cast(aFrameXferBlock) ); + } + + return status; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt RPcmNetCardIf::ReleaseBuffers() + { + // close the handle to the shared memory chunk + iSharedMemoryChunk.Close(); + + return DoSvControl( ESvControlFreeBuffers ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RPcmNetCardIf::ResumeTx( TRequestStatus& aStatus ) + { + DoRequest( EResumeTx, aStatus ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RPcmNetCardIf::RequestFrame( TRequestStatus& aStatus ) + { + DoRequest( ERequestRead, aStatus ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TDataBuffer* RPcmNetCardIf::AllocTxBuffer( TUint aLength ) + { + return reinterpret_cast(DoControl( + EControlFastAllocTxBuffer, + reinterpret_cast(aLength) )); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool RPcmNetCardIf::AddTxFrame( TDataBuffer* aPacket ) + { + return static_cast(DoControl( + EControlFastAddTxFrame, + reinterpret_cast(aPacket) )); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardIoc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardIoc.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This header provides the IO Control and Event codes. +* +*/ + +/* +* %version: 6 % +*/ + +#if !defined(__ETHERIOC_H__) +#define __ETHERIOC_H__ + +/** +IOControl options. +*/ +const TUint8 KIoControlNullCommand=0x00; //Test use only +const TUint8 KIoControlResetCard=0x01; +const TUint8 KIoControlPowerUpCard=0x02; +const TUint8 KIoControlPowerDownCard=0x03; +const TUint8 KIoControlGetStats=0x04; +const TUint8 KIoControlResetStats=0x05; +const TUint8 KIoControlGetStatus=0x06; +const TUint8 KIoControlSetParameters=0x07; +const TUint8 KIoControlSetMACAddress=0x08; + +/** +GetEvent options. +*/ + +const TUint8 KEventNull=0x00; //Test use only +const TUint8 KEventEmergencyPowerDown=0x01; +const TUint8 KEventNormalPowerDown=0x02; +const TUint8 KEventPCCardReady=0x04; +const TUint8 KEventMediaOpen=0x08; + +// Card configuration - speed settings. +const TUint8 KEthSpeedUnknown=0x00; +const TUint8 KEthSpeedAuto=0x01; +const TUint8 KEthSpeed10BaseT=0x02; +const TUint8 KEthSpeed100BaseTX=0x03; +const TUint8 KEthSpeedDefault=KEthSpeedAuto; + +// Card configuration - duplex settings. +const TUint8 KEthDuplexUnknown=0x00; +const TUint8 KEthDuplexAuto=0x01; +const TUint8 KEthDuplexFull=0x02; +const TUint8 KEthDuplexHalf=0x03; +const TUint8 KEthDuplexDefault=KEthDuplexAuto; + +// Card configuration - rx mode settings. +const TUint8 KEthRxModeUnknown=0x00; +const TUint8 KEthRxModeStation=0x01; +const TUint8 KEthRxModeBroadcast=0x02; +const TUint8 KEthRxModeMulticast=0x03; +const TUint8 KEthRxModePromisuous=0x04; +const TUint8 KEthRxModeDefault=KEthRxModeMulticast; + +// Card parameter - general no change indicator. +const TUint8 KEthNoChange=0x00; +const TUint8 KEthNoSetting=0x00; +const TUint8 KEthModeOn=0x01; +const TUint8 KEthModeOff=0x02; + +/** +Default Ethernet Address. +*/ +const TUint8 KDefEtherAddByte0=0x31; // MSB +const TUint8 KDefEtherAddByte1=0x32; +const TUint8 KDefEtherAddByte2=0x33; +const TUint8 KDefEtherAddByte3=0x34; +const TUint8 KDefEtherAddByte4=0x35; +const TUint8 KDefEtherAddByte5=0x36; // LSB + +const TUint KEthernetAddressLength=6; + +// Card configuration - status alternatives. +const TUint8 KEthCardReady=0x00; +const TUint8 KEthCardNotReady=0xFF; + +// Card configuration - precise status alternatives. +const TUint8 KIoControlCardNotPresent=0x01; +const TUint8 KIoControlCardNotReady=0x02; +const TUint8 KIoControlCardBad=0x03; +const TUint8 KIoControlCardReady=0x04; + +/** + * Ethernet card statistics class. + * + * @since S60 v3.1 + */ +class TPddPcCardStatistics + { + +public: + inline TPddPcCardStatistics() { Init(); } + inline void Init() + { + iTxErrReclaim = iTxErrStatusOverflow = iTxErrMaxCollisions = 0; + iTxErrUnderrun = iTxErrJabber = 0; + iRxErrOverflow = iRxErrLength = iRxErrFrame = 0; + iRxErrCrc = iRxErrPacketDropped = 0; + iBadSSD = iUpperBytesOK = iCarrierLost = 0; + iSqeErrors = iMultiCollFrames = iSingleCollFrames = iLateCollisions = 0; + iRxOverruns = iFramesXmittedOK = iFramesRcvdOK = iFramesDeferred = 0; + iUpperFramesOK = iBytesRcvdOK = iBytesXmittedOK = 0; + iBadSSD = iUpperBytesOK = 0; + iNumRxPackets = iNumTxPackets = iNumRxBytes = iNumTxBytes = 0; + } +public: + // Driver statistics + TUint iTxErrReclaim; + TUint iTxErrStatusOverflow; + TUint iTxErrMaxCollisions; + TUint iTxErrUnderrun; + TUint iTxErrJabber; + TUint iRxErrOverflow; + TUint iRxErrLength; + TUint iRxErrFrame; + TUint iRxErrCrc; + TUint iRxErrPacketDropped; + + // Adapter statistics + TUint iCarrierLost; + TUint iSqeErrors; + TUint iMultiCollFrames; + TUint iSingleCollFrames; + TUint iLateCollisions; + TUint iRxOverruns; + TUint iFramesXmittedOK; + TUint iFramesRcvdOK; + TUint iFramesDeferred; + TUint iUpperFramesOK; + TUint iBytesRcvdOK; + TUint iBytesXmittedOK; + TUint iBadSSD; + TUint iUpperBytesOK; + + // Derived adapter statistics + TUint iNumRxPackets; + TUint iNumTxPackets; + TUint iNumRxBytes; + TUint iNumTxBytes; + }; + +/** + * Ethernet card configuration class. + * + * @since S60 v3.1 + */ +class TEtherConfig + { + +public: + TUint8 iStatus; + TUint8 iEthSpeed; + TUint8 iEthDuplex; + TUint8 iEthAddress[KEthernetAddressLength]; + }; + +/** + * Ethernet parameters class. + * + * @since S60 v3.1 + */ +class TEtherParams + { + +public: + inline TEtherParams() + : iEthSpeed(KEthNoChange), iEthDuplex(KEthNoChange), iRxMode(KEthNoChange), + iSwFullDuplexMode(KEthNoChange), iIntLoopbackMode(KEthNoChange), + iIntAppendCRCMode(KEthNoChange), iPadFramesMode(KEthNoChange) + {} +public: + TUint8 iCommand; + TUint8 iEthSpeed; + TUint8 iEthDuplex; + TUint8 iRxMode; + TUint8 iSwFullDuplexMode; + TUint8 iIntLoopbackMode; + TUint8 iIntAppendCRCMode; + TUint8 iPadFramesMode; + }; + +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EthernetFrameMemMngr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EthernetFrameMemMngr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,455 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the DEthernetFrameMemMngr class. +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef DETHERNETFRAMEMEMMNGR_H +#define DETHERNETFRAMEMEMMNGR_H + +#include "FrameXferBlock.h" +#include "WlanLogicalChannel.h" + +class RFrameXferBlock; +class DThread; +class TDataBuffer; + +class TSharedChunkInfo; +class WlanChunk; + +/** +* Manager object for frame Tx and Rx memory +* +* Consumed count of Rx-buffers = +* nbr of Rx buffers currently under processing in user mode +* + nbr of Rx buffers given to wlanpdd +* + nbr of Rx buffers waiting for completion to user mode +* +* @since S60 v3.1 +*/ +class DEthernetFrameMemMngr + { + +public: + + /** Dtor */ + virtual ~DEthernetFrameMemMngr(); + + /** + * Memory intilisation method. + * Allocates a shared memory chunk, if relevant, and opens a handle to it + * for the user mode client. + * + * @since S60 3.1 + * @param aThread calling processes DThread object + * @param aSharedChunkInfo After successful return contains the handle to the + * chunk + * @param aVendorTxHdrLen Amount of free space (bytes) that the WLAN vendor + * implementation requires to exist in a Tx buffer before the 802.11 + * MPDU to be sent + * @param aVendorTxTrailerLen Amount of free space (bytes) that the WLAN + * vendor implementation requires to exist in a Tx buffer after the + * 802.11 MPDU to be sent + * @return system wide error code, KErrNone upon success + */ + TInt OnInitialiseMemory( + DThread& aThread, + TSharedChunkInfo* aSharedChunkInfo, + TUint aVendorTxHdrLen, + TUint aVendorTxTrailerLen ); + + /** + * Checks if the memory is in use, i.e. is it allocated and attached to the + * address space of the user mode client process + * @return the state of the memory: in use (ETrue), or not (EFalse) + */ + TBool IsMemInUse() const { return iInUse; } + + /** + * Memory finalization method. + * Deallocates the shared memory chunk, if relevant + * + * @since S60 3.1 + */ + virtual void OnReleaseMemory(); + + /** + * Gets a memory block that can be used for tx frame write + * + * @since S60 3.1 + * @return memory block that can be used for tx frame write, + * NULL upon failure + */ + TDataBuffer* OnWriteEthernetFrame() const; + + /** + * Gets a memory block that can be used as rx frame buffer + * + * @since S60 3.1 + * @param aLengthinBytes Requested buffer length + * @return memory block that can be used as rx frame buffer + * NULL upon failure + */ + TUint8* OnGetEthernetFrameRxBuffer( TUint aLengthinBytes ); + + /** + * Gets a memory block for storing Rx frame meta header + * + * @return memory block for storing Rx frame meta header on success + * NULL upon failure + */ + TDataBuffer* GetRxFrameMetaHeader(); + + /** + * Deallocates Rx frame meta header + * @param aMetaHeader Meta header to deallocate + */ + void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ); + + /** + * To be called when rx frame read cycle has ended. + * + * @since S60 3.1 + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + * @return ETrue if a pending user mode frame read request exists + * and callee should complete it, + * EFalse otherwise + */ + TBool OnEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * To be called when user mode issues a rx frame read request + * + * @since S60 3.1 + * @return ETrue if callee should complete the request immediadly + * as their exist data to be completed, EFalse otherwise + */ + TBool OnReadRequest(); + + /** + * Frees the specified Rx frame buffer + * + * @since S60 3.1 + * @param aBufferToFree The buffer to free + */ + virtual void DoMarkRxBufFree( TUint8* aBufferToFree ); + + /** + * Allocates a Tx packet from the shared memory. + * + * @param aLength Length of the requested Tx buffer in bytes + * @return Pointer to the meta header attached to the allocated packet, on + * success. + * NULL, in case of failure. + */ + virtual TDataBuffer* AllocTxBuffer( TUint aLength ); + + /** + * Adds the specified Tx frame (contained in the buffer allocated from the + * shared memory) to the relevant Tx queue according to its AC (i.e. + * priority). + * + * @param aPacketInUserSpace Meta header attached to the frame; as a user + * space pointer. + * @param aPacketInKernSpace If not NULL on return, the frame needs to be + * discarded and this is the kernel space pointer to its meta header. + * If NULL on return, the frame must not be discarded. + * @param aUserDataTxEnabled ETrue if user data Tx is enabled + * EFalse otherwise + * @return ETrue if the client is allowed to continue calling this method + * (i.e. Tx flow is not stopped). + * EFalse if the client is not allowed to call this method again + * (i.e. Tx flow is stopped) until it is re-allowed. + */ + TBool AddTxFrame( + TDataBuffer* aPacketInUserSpace, + TDataBuffer*& aPacketInKernSpace, + TBool aUserDataTxEnabled ); + + /** + * Gets the frame to be transmitted next from the Tx queues. + * + * @param aWhaTxQueueState State (full / not full) of every WHA transmit + * queue + * @param aMore On return is ETrue if another frame is also ready to be + * transmitted, EFalse otherwise + * @return Pointer to the meta header of the frame to be transmitted, on + * success + * NULL, if there's no frame that could be transmitted, given the + * current status of the WHA Tx queues + */ + TDataBuffer* GetTxFrame( + const TWhaTxQueueState& aTxQueueState, + TBool& aMore ); + + /** + * Deallocates a Tx packet. + * + * All Tx packets allocated with AllocTxBuffer() must be deallocated using + * this method. + * + * @param aPacket Meta header of the packet to the deallocated + */ + virtual void FreeTxPacket( TDataBuffer*& aPacket ); + + /** + * Determines if Tx from protocol stack side client should be resumed + * + * @param aUserDataTxEnabled ETrue if user data Tx is enabled + * EFalse otherwise + * @return ETrue if Tx should be resumed + * EFalse otherwise + */ + TBool ResumeClientTx( TBool aUserDataTxEnabled ) const; + + /** + * Determines if all protocol stack side client's Tx queues are empty + * + * @return ETrue if all Tx queues are empty + * EFalse otherwise + */ + TBool AllTxQueuesEmpty() const; + + /** + * Static creator of the class instance + * @param aUnit identifier of the type of object to be created + * @param aParent + * @param aRxFrameMemoryPool + * @param aUseCachedMemory ETrue if cached frame transfer memory shall be + * used, + * EFalse otherwise + * @param aFrameBufAllocationUnit size of the Rx/Tx frame buffer allocation + * unit in bytes + * @return DEthernetFrameMemMngr object or NULL upon failure + * + * @since S60 3.1 + */ + static DEthernetFrameMemMngr* Init( + TInt aUnit, + DWlanLogicalChannel& aParent, + WlanChunk*& aRxFrameMemoryPool, + TBool aUseCachedMemory, + TInt aFrameBufAllocationUnit ); + + /** + * Sets the Tx offset for every frame type which can be transmitted + * + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames and Ethernet + * Test frames + * @param aDot11FrameTxOffset Tx offset for 802.11 frames + * @param aSnapFrameTxOffset Tx offset for SNAP frames + */ + void SetTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ); + + +protected: + + /** Ctor */ + DEthernetFrameMemMngr( + DWlanLogicalChannel& aParent, + WlanChunk*& aRxFrameMemoryPool ) : + iReadStatus( ENotPending ), + iFrameXferBlock( NULL ), + iCountCompleted( 0 ), + iCountTobeCompleted( 0 ), + iTxDataBuffer( NULL ), + iRxDataChunk( NULL ), + iParent( aParent ), + iRxFrameMemoryPool( aRxFrameMemoryPool ), + iRxBufAlignmentPadding( 0 ), + iVendorTxHdrLen( 0 ), + iVendorTxTrailerLen( 0 ), + iInUse( EFalse ) + {}; + + /** + * Allocates a shared memory chunk for frame transfer between user + * and kernel address spaces + * + * @since S60 3.1 + * @param aSharedMemoryChunk The shared memory chunk + * @return system wide error code, KErrNone upon success + */ + virtual TInt DoAllocate( DChunk*& aSharedMemoryChunk ); + + /** + * Opens a handle for user mode client to the shared memory chunk + * allocated for frame transfer between user and kernel address spaces + * + * @since S60 3.1 + * @param aThread The user mode client thread + * @param aSharedChunkInfo After successful return contains the handle to the + * chunk + * @param aSharedMemoryChunk The shared memory chunk + * @return system wide error code, KErrNone upon success + */ + virtual TInt DoOpenHandle( + DThread& aThread, + TSharedChunkInfo& aSharedChunkInfo, + DChunk* aSharedMemoryChunk ) = 0; + + /** + * Gets a free rx buffer + * + * @since S60 3.1 + * @param aLengthinBytes Requested buffer length + * @return buffer for Rx data upon success + * NULL otherwise + */ + virtual TUint8* DoGetNextFreeRxBuffer( TUint aLengthinBytes ); + + /** + * Gets called when rx frame read cycle has ended. + * + * @since S60 3.1 + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + * @return ETrue if a pending user mode frame read request exists + * and callee should complete it, + * EFalse otherwise + */ + virtual TBool DoEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) = 0; + + /** + * Gets start address of Rx buffers (their offset addresses) + * that are waiting for completion to user mode + * + * @since S60 3.1 + * @return see above statement + */ + virtual TUint32* DoGetTobeCompletedBuffersStart() = 0; + + /** + * Gets start address of Rx buffers (their offset addresses) + * that have been completed to user mode + * + * @since S60 3.1 + * @return see above statement + */ + virtual TUint32* DoGetCompletedBuffersStart() = 0; + + /** + * Gets called when user mode client issues a frame receive request + * and Rx buffers have been completed to it. The completed Rx frame + * buffers are freed. + * + * @since S60 3.1 + */ + virtual void DoFreeRxBuffers() = 0; + + /** + * Marks memory as not in use, meaning that it is not allocated + * and attached to calling process'es address space + */ + void MarkMemFree() { iInUse = EFalse; } + +private: + + /** + * Marks memory as in use, meaning that is it allocated + * and attached to calling processes address space + */ + void MarkMemInUSe() { iInUse = ETrue; } + + // Prohibit copy constructor. + DEthernetFrameMemMngr( const DEthernetFrameMemMngr& ); + // Prohibit assigment operator. + DEthernetFrameMemMngr& operator= ( const DEthernetFrameMemMngr& ); + +protected: // Data + + enum TFrameReadState + { + /** there is no rx frame read request pending in kernel-mode */ + ENotPending, + /** + * there is rx frame read request waiting + * to be completed in kernel-mode + */ + EPending + }; + + /** state of the rx frame read request */ + TFrameReadState iReadStatus; + + /** kernel address of xfer block */ + RFrameXferBlock* iFrameXferBlock; + + /** + * amount of rx frame buffers that are + * currently under processing in user mode + */ + TUint32 iCountCompleted; + + /** + * amount of rx frame buffers waiting completion to user mode + */ + TUint32 iCountTobeCompleted; + + /** kernel address of Tx-data buffer */ + TDataBuffer* iTxDataBuffer; + + /** pointer to Rx area start in the kernel address space */ + TUint8* iRxDataChunk; + + /** + * reference to logical channel object instance owning this object + * instance + */ + DWlanLogicalChannel& iParent; + + /** + * reference to Rx frame memory pool manager + */ + WlanChunk*& iRxFrameMemoryPool; + + /** + * number of extra bytes required to align Rx buffer start address + * to be returned to WHA layer to allocation unit boundary + */ + TInt iRxBufAlignmentPadding; + + /** + * amount of free space (bytes) that the WLAN vendor implementation + * requires to exist in a Tx buffer before the 802.11 MPDU to be sent + */ + TUint iVendorTxHdrLen; + + /** + * amount of free space (bytes) that the WLAN vendor implementation + * requires to exist in a Tx buffer after the 802.11 MPDU to be sent + */ + TUint iVendorTxTrailerLen; + +private: // Data + + /** is memory in use or not */ + TBool iInUse; + }; + +#endif // DETHERNETFRAMEMEMMNGR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/FrameXferBlock.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/FrameXferBlock.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1269 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the TDataBuffer and the RFrameXferBlock class. +* +*/ + +/* +* %version: 25 % +*/ + +#ifndef FRAMEXFERBLOCK_H +#define FRAMEXFERBLOCK_H + +#include "802dot11.h" +#include "umac_types.h" +#include "pack.h" +#include "wllddcircularbuffer.h" + +/** Max number of completed Rx buffers */ +static const TUint KMaxCompletedRxBufs = 300; + +/** Max number of to be completed Rx buffers */ +static const TUint KMaxToBeCompletedRxBufs = KMaxCompletedRxBufs; + +/** +* This value (bytes) should be at least as large as the Tx offset required +* by the used WLAN vendor implementation. +* As we need to decide the max size of the Tx buffers already at compile +* time, we use this value when doing that. +* If the value is too small, WLAN Mgmt client may receive an error when trying +* to submit a close to maximum length frame for transmit +*/ +static const TUint KVendorTxHdrMax = 200; + +/** +* Extra space to enable us to align the start of a 802.11 MAC Tx frame on four +* byte boundary, if it isn't aligned already. Shall also make the total +* buffer length divisible by four +*/ +static const TUint KSpaceForAlignment = 4; + +/** +* This value (bytes) should be at least as large as the Tx trailer space +* required by the used WLAN vendor implementation. +* The other comments for KVendorTxHdrMax (above) apply also to this value. +*/ +static const TUint KVendorTxTrailerMax = 4; + +/** +* The length (in bytes) of the only WLAN Mgmt client Tx buffer +*/ +static const TUint KMgmtSideTxBufferLength = // 2576 + KVendorTxHdrMax + // 200 + KMaxDot11TxMpduLength + // 2368 + KSpaceForAlignment + // 4 + KVendorTxTrailerMax; // 4 + +/** Protocol Stack Side client's Tx queue max lengths in packets */ + +static const TUint KVoiceTxQueueLen = 4; +static const TUint KVideoTxQueueLen = 8; +static const TUint KBestEffortTxQueueLen = 24; +static const TUint KBackgroundTxQueueLen = 4; + +/** + * Estimates used for calculating the total Protocol Stack Side client Tx + * memory pool size + */ + +static const TUint KEthernetVoiceTxFrameLenEstimate = 256; +static const TUint KEthernetVideoTxFrameLenEstimate = 1024; +static const TUint KEthernetBestEffortTxFrameLenEstimate = + KMaxEthernetFrameLength; +static const TUint KEthernetBackgroundTxFrameLenEstimate = + KMaxEthernetFrameLength; + +static const TUint KVendorTxHdrLenEstimate = 64; +static const TUint KVendorTxTrailerLenEstimate = 4; + +static const TUint KProtocolStackSideFrameLenOverhead = + KVendorTxHdrLenEstimate + + KHtQoSMacHeaderLength + + KMaxDot11SecurityEncapsulationLength + + sizeof( SSnapHeader ) + + KSpaceForAlignment + + KVendorTxTrailerLenEstimate; + +/** +* Protocol stack side Tx memory pool size in packets +*/ +static const TUint KTxPoolSizeInPackets = + KVoiceTxQueueLen + + KVideoTxQueueLen + + KBestEffortTxQueueLen + + KBackgroundTxQueueLen; + +/** +* Protocol stack side Tx data chunk size in bytes +* Note! Needs to be divisible by 4 +*/ +static const TUint KProtocolStackSideTxDataChunkSize = + KVoiceTxQueueLen * ( KEthernetVoiceTxFrameLenEstimate + + KProtocolStackSideFrameLenOverhead ) + + KVideoTxQueueLen * ( KEthernetVideoTxFrameLenEstimate + + KProtocolStackSideFrameLenOverhead ) + + KBestEffortTxQueueLen * ( KEthernetBestEffortTxFrameLenEstimate + + KProtocolStackSideFrameLenOverhead ) + + KBackgroundTxQueueLen * ( KEthernetBackgroundTxFrameLenEstimate + + KProtocolStackSideFrameLenOverhead ); + +/** +* Meta header for Rx and Tx frames +* +* @since S60 v3.1 +*/ +#pragma pack( 1 ) +class TDataBuffer + { + friend class RFrameXferBlock; + friend class RFrameXferBlockProtocolStack; // because of SetLength() + +public: + + typedef TUint32 TFrameType; + + /** ethernet II frame */ + static const TFrameType KEthernetFrame = 0; + /** complete 802.11 frame */ + static const TFrameType KDot11Frame = 1; + /** frame beginning with a SNAP header */ + static const TFrameType KSnapFrame = 2; + /** ethernet II frame used to test an AP */ + static const TFrameType KEthernetTestFrame = 3; + /** upper bound, so not a real type */ + static const TFrameType KFrameTypeMax = 4; + + typedef TUint32 TFlag; + + /** + * flag indicating that the associated Rx buffer shall not be released + * when releasing this meta header + */ + static const TFlag KDontReleaseBuffer = ( 1 << 0 ); + /** + * flag indicating that the Tx frame in the associated buffer shall not + * be encrypted even if a valid encryption key existed. If not set, the + * frame may be encrypted if a valid key exists + */ + static const TFlag KTxFrameMustNotBeEncrypted = ( 1 << 1 ); + +public: + + /** + * Appends data to Tx Buffer + * @param aData data to be apended + * @param aLength length of data in bytes + * @return KErrNone on success, + * KErrOverflow if aLength is greater than the available space in + * the buffer + */ + inline TInt AppendBuffer( + const TUint8* aData, + TUint32 aLength ); + + /** + * Gets length of the data in the buffer + * + * @since S60 3.1 + * @return length of the data in the buffer + */ + inline TUint32 GetLength() const; + + /** + * Gets the begin of the buffer + * + * @since S60 3.1 + * @return beginning of the buffer + */ + inline const TUint8* GetBuffer() const; + + /** + * Gets the beginning of the buffer + * + * @since S60 3.1 + * @return begin of the buffer + */ + inline TUint8* GetBuffer(); + + /** + * Gets the frame type in the buffer + * + * @since S60 3.1 + * @return frame type in the buffer + */ + inline TFrameType FrameType() const; + + /** + * Sets the frame type in the buffer + * + * @since S60 3.1 + */ + inline void FrameType( TFrameType aFrameType ); + + /** + * Sets the 802.1D User Priority of the frame + * + * @since S60 3.2 + * @param aUp UP value to be set + */ + inline void SetUserPriority( TUint8 aUp ); + + /** + * Gets the 802.1D User Priority of the frame + * + * @since S60 3.2 + * @return UP value + */ + inline TUint8 UserPriority() const; + + /** + * Gets the RCPI value of a received frame + * + * @since S60 3.2 + * @return RCPI value + */ + inline TUint8 Rcpi() const; + + + ////////////////////////////////////////////////////////////////////////// + // Rest of the methods are meant to be used only in the device driver code + ////////////////////////////////////////////////////////////////////////// + + /** + * Gets the beginning of the data buffer + * NOTE: to be used only by the device driver + * + * @return Buffer beginning + */ + inline TUint8* KeGetBufferStart() const; + + /** + * Sets the specified flag(s) + * NOTE: to be used only by the device driver + * + * @param aFlag The flag(s) to set + */ + inline void KeSetFlags( TFlag aFlags ); + + /** + * Returns the flags set in this object + * NOTE: to be used only by the device driver + * + * @return Flags set in this object + */ + inline TFlag KeFlags() const; + + /** + * Clears the specified flag(s) + * NOTE: to be used only by the device driver + * + * @param aFlag The flag(s) to clear + */ + inline void KeClearFlags( TFlag aFlags ); + + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + + /** + * Sets the RCPI value of a received frame + * NOTE: to be used only by the device driver + * + * @since S60 3.2 + * @param aRcpi RCPI value to be set + */ + inline void KeSetRcpi( TUint8 aRcpi ); + + /** + * Gets the Destination Address of the frame to be transmitted + * NOTE: to be used only by the device driver + * + * @return Destination Address + */ + inline const TMacAddress& KeDestinationAddress() const; + + /** + * Sets the offset to actual frame beginning within the data buffer + * NOTE: to be used only by the device driver + * + * @param aOffset Offset to frame beginning + */ + inline void KeSetOffsetToFrameBeginning( TUint32 aOffset ); + + /** + * Returns the offset to actual frame beginning within the data buffer + * NOTE: to be used only by the device driver + * + * @return Offset to frame beginning + */ + inline TUint32 KeOffsetToFrameBeginning() const; + + /** + * Sets the offset from the start address of this object to the actual data + * buffer start address + * NOTE: to be used only by the device driver + * + * @param aOffset Offset to data buffer start address. May be positive or + * negative. + */ + inline void KeSetBufferOffset( TInt32 aOffset ); + + /** + * Sets the length field + * NOTE: to be used only by the device driver + * + * @since S60 3.1 + * @param aLength length to be set + */ + inline void KeSetLength( TUint32 aLength ) + { + iLength = aLength; + }; + +#endif /* Kernel mode end */ + +private: + + /** Default Ctor */ + TDataBuffer() : + iFrameType( KEthernetFrame ), + iLength( 0 ), + iUp( 0 ), + iRcpi( 0 ), + iDestinationAddress( KZeroMacAddr ), + iBufLength( 0 ), + iOffsetToFrameBeginning( 0 ), + iBufferOffsetAddr( sizeof( TDataBuffer ) ), + iFlags( 0 ) + {}; + + /** + * Adds a value to the length field + * @param aValue length to be set + */ + inline void IncrementLength( TUint32 aValue ); + + /** + * Appends data to Buffer + * @param aData data to be apended + * @param aLength length of data in BYTEs + * @param aOffsetToFrameBeginning Amount of empty space to leave in the + * beginning of the buffer, i.e. before the frame beginning + */ + inline void AppendBuffer( + const TUint8* aData, + TUint32 aLength, + TUint32 aOffsetToFrameBeginning ); + + /** + * Sets the length field + * @param aLength length to be set + */ + inline void SetLength( TUint32 aLength ); + + /** + * Sets the length of the attached data buffer + * @param aBufLength length to be set + */ + inline void SetBufLength( TUint16 aBufLength ); + + /** + * Sets the Destination Address of the frame to be transmitted + * + * @param aDa Destination Address to be set + */ + inline void SetDestinationAddress( const TMacAddress& aDa ); + + /** Prohibit copy constructor */ + TDataBuffer( const TDataBuffer& ); + /** Prohibit assigment operator */ + TDataBuffer& operator= ( const TDataBuffer& ); + +private: // Data + + /** type of the frame in buffer */ + TFrameType iFrameType; + + /** length of the data in buffer */ + TUint32 iLength; + + /** + * 802.1D User Priority of the frame + * stored as a 32-bit value to keep the length of this object 32-bit + * aligned + */ + TUint32 iUp; + + /** + * RCPI of the received frame; range: [0..250] + * stored as a 32-bit value to keep the length of this object 32-bit + * aligned + */ + TUint32 iRcpi; + + /** + * Destination address of the frame to be transmitted. Used only when + * the address cannot be determined from the frame content + */ + TMacAddress iDestinationAddress; + + /** + * Length of the attached data buffer. Currently used only for Protocol + * Stack Side client Tx frames + */ + TUint16 iBufLength; + + /** the offset to actual frame beginning within the data buffer */ + TUint32 iOffsetToFrameBeginning; + + /** + * the offset from the start address of this object to the start address + * of the data buffer. May be positive or negative. + */ + TInt32 iBufferOffsetAddr; + + /** may contain a combination of the flags defined for this class */ + TFlag iFlags; + + /** + * Note! The total length of this object needs to be divisible by four + * to enable the items following it to be correctly aligned. + */ + } __PACKED; +#pragma pack() + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt TDataBuffer::AppendBuffer( + const TUint8* aData, + TUint32 aLength ) + { + if ( aLength <= iBufLength - iLength ) + { + os_memcpy( + KeGetBufferStart() + iOffsetToFrameBeginning + iLength, + aData, + aLength ); + IncrementLength( aLength ); + + return KErrNone; + } + else + { + return KErrOverflow; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 TDataBuffer::GetLength() const + { + return iLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TUint8* TDataBuffer::GetBuffer() const + { + return KeGetBufferStart() + iOffsetToFrameBeginning; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8* TDataBuffer::GetBuffer() + { + return KeGetBufferStart() + iOffsetToFrameBeginning; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TDataBuffer::TFrameType TDataBuffer::FrameType() const + { + return iFrameType; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::FrameType( TFrameType aFrameType ) + { + iFrameType = aFrameType; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::SetLength( TUint32 aLength ) + { + iLength = aLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::SetBufLength( TUint16 aBufLength ) + { + iBufLength = aBufLength; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::IncrementLength( TUint32 aValue ) + { + iLength += aValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::AppendBuffer( + const TUint8* aData, + TUint32 aLength, + TUint32 aOffsetToFrameBeginning ) + { + iOffsetToFrameBeginning = aOffsetToFrameBeginning; + os_memcpy( + KeGetBufferStart() + aOffsetToFrameBeginning + iLength, + aData, + aLength ); + IncrementLength( aLength ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::SetUserPriority( TUint8 aUp ) + { + iUp = aUp; + } + +// --------------------------------------------------------------------------- +// return as a TUint8 value as the range of User Priority is [0..7] +// --------------------------------------------------------------------------- +// +inline TUint8 TDataBuffer::UserPriority() const + { + return static_cast(iUp); + } + +// --------------------------------------------------------------------------- +// return as a TUint8 value as the range of RCPI is [0..250] +// --------------------------------------------------------------------------- +// +inline TUint8 TDataBuffer::Rcpi() const + { + return static_cast(iRcpi); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::SetDestinationAddress( const TMacAddress& aDa ) + { + iDestinationAddress = aDa; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint8* TDataBuffer::KeGetBufferStart() const + { + return reinterpret_cast( + const_cast(this)) + + iBufferOffsetAddr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::KeSetFlags( TFlag aFlags ) + { + iFlags |= aFlags; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TDataBuffer::TFlag TDataBuffer::KeFlags() const + { + return iFlags; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::KeClearFlags( TFlag aFlags ) + { + iFlags &= ~aFlags; + } + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::KeSetRcpi( TUint8 aRcpi ) + { + iRcpi = aRcpi; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline const TMacAddress& TDataBuffer::KeDestinationAddress() const + { + return iDestinationAddress; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::KeSetOffsetToFrameBeginning( TUint32 aOffset ) + { + iOffsetToFrameBeginning = aOffset; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TUint32 TDataBuffer::KeOffsetToFrameBeginning() const + { + return iOffsetToFrameBeginning; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void TDataBuffer::KeSetBufferOffset( TInt32 aOffset ) + { + iBufferOffsetAddr = aOffset; + } + +#endif /* Kernel mode end */ + +/** +* Ethernet frame transfer context block base class between user and +* kernel space +*/ +class RFrameXferBlockBase + { + +public: + +#ifndef __KERNEL_MODE__ /* User mode */ + + /** + * Gets next Rx-data buffer that has data to be read + * + * @since S60 3.1 + * @param aBuf OUT parameter where Rx-data buffers address that is to + * be read is copied + * @return ETrue Rx-data exists after this call still to read, + * otherwise EFalse + */ + inline TBool GetNextRxDataBuffer( TDataBuffer*& aBuf ); + + ////////////////////////////////////////////////////////////////////////// + // Rest of the methods are meant to be used only in the device driver code + ////////////////////////////////////////////////////////////////////////// + + /** + * Set data chunk address + * + * Note! This method is executed in user mode context by the user mode + * client interface, i.e. not the client itself! + * @since S60 3.1 + * @param aUserAddr user address of the buffer + */ + inline void SetRxDataChunkField( TLinAddr aUserAddr ); + +#endif /* User mode end */ + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + + /** + * Completes Rx buffers to user space + * + * @since S60 3.1 + * @param aRxCompletionBuffersArray Rx buffer addresses as offsets from + * Rx memory pool beginning + * @param aNumOfCompleted number of buffers + */ + void KeRxComplete( + const TUint32* aRxCompletionBuffersArray, + TUint32 aNumOfCompleted ); + + /** + * Gets the array of Rx buffers (their offset addresses) which have already + * been handled by the user space client + * + * @since S60 5.0 + * @param aRxHandledBuffersArray Pointer to the beginning of the array + * @param aNumOfHandled Number of buffers (offset addresses) on the array + */ + void KeGetHandledRxBuffers( + const TUint32*& aRxHandledBuffersArray, + TUint32& aNumOfHandled ); + + /** + * Notes, that all Rx buffers, which were completed to user space + * the previous time, are now free. + * + * @since S60 5.0 + */ + void KeAllUserSideRxBuffersFreed(); + + /** + * Sets the Tx offset for every frame type which can be transmitted + * + * @since S60 5.0 + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames and Ethernet + * Test frames + * @param aDot11FrameTxOffset Tx offset for 802.11 frames + * @param aSnapFrameTxOffset Tx offset for SNAP frames + */ + void KeSetTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ); + +protected: + + /** + * Initialises the buffer. + * + * @since S60 3.1 + */ + void KeInitialize(); + +#endif /* Kernel mode end */ + +private: + + /** Prohibit default constructor */ + RFrameXferBlockBase(); + + /** Prohibit copy constructor */ + RFrameXferBlockBase( const RFrameXferBlockBase& ); + /** Prohibit assigment operator */ + RFrameXferBlockBase& operator= ( const RFrameXferBlockBase& ); + +protected: // Data + + /** the beginning of the Rx data area in user address space */ + TUint8* iRxDataChunk; + + /** + * number of Rx-data buffers that were completed by the device driver + */ + TUint32 iNumOfCompleted; + + /** + * index to iRxCompletedBuffers denoting the Rx buffer that is to be + * extracted next by the user application + */ + TUint32 iCurrentRxBuffer; + + /** + * index of the first Rx buffer in iRxCompletedBuffers array + * - which the user side client has already handled and + * which can therefore be freed & re-used AND + * - which hasn't been freed yet + */ + TUint32 iFirstRxBufferToFree; + + /** + * defines a Tx offset for every frame type which can be transmitted + */ + TUint32 iTxOffset[TDataBuffer::KFrameTypeMax]; + + /** + * array of TDataBuffer offset addresses from the memory pool start address, + * denoting Rx buffers which are ready to be read + */ + TUint32 iRxCompletedBuffers[KMaxCompletedRxBufs]; + + /** + * Note! The length of this object needs to be divisible by 4 to make + * the objects following it to be aligned correctly + */ + }; + +#ifndef __KERNEL_MODE__ /* User mode */ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TBool RFrameXferBlockBase::GetNextRxDataBuffer( TDataBuffer*& aBuf ) + { + TBool ret( EFalse ); + + if ( iNumOfCompleted ) + { + --iNumOfCompleted; + aBuf = reinterpret_cast( + // Rx memory pool user mode start address + iRxDataChunk + + // offset from the memory pool start address + iRxCompletedBuffers[iCurrentRxBuffer]); + + ++iCurrentRxBuffer; + ret = ETrue; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RFrameXferBlockBase::SetRxDataChunkField( TLinAddr aUserAddr ) + { + iRxDataChunk = reinterpret_cast(aUserAddr); + } + +#endif /* User mode end */ + + +/** +* Ethernet frame transfer context block between user and kernel space +* for the Management Client +*/ +class RFrameXferBlock : public RFrameXferBlockBase + { + +public: + +#ifndef __KERNEL_MODE__ /* User mode */ + + /** + * Appends data to iTxDataBuffer + * + * @since S60 3.1 + * @param aData data to be apended + * @param aLength length of data in BYTEs + * @param aFrameType frame type idenitifier + * @param aUserPriority 802.1D User Priority of the frame + * @param aMustNotBeEncrypted If EFalse it is allowed to encrypt the frame + * if a valid encryption key exists. This is the default behavior. + * If ETrue, the frame must not be encrypted even if a valid + * encryption key existed. + * @param aDestinationAddress If not NULL, specifies the destination MAC + * address for the frame to be transmitted + * @return KErrNone on success, + * KErrOverflow if aLength is greater than the available space in + * the Tx buffer + */ + inline TInt AppendTxDataBuffer( + const TUint8* aData, + TUint32 aLength, + TDataBuffer::TFrameType aFrameType = TDataBuffer::KEthernetFrame, + TUint8 aUserPriority = 0, + TBool aMustNotBeEncrypted = EFalse, + const TMacAddress* aDestinationAddress = NULL ); + + /** + * Clears TxDataBuffer, makes it zero length size + * + * @since S60 3.1 + */ + inline void ClearTxDataBuffer(); + + /** + * Set data buffer address + * + * Note! This method is executed in user mode context by the user mode + * client interface, i.e. not the client itself! + * @since S60 3.1 + * @param aUserAddr user address of the buffer + */ + inline void SetTxDataBufferField( TLinAddr aUserAddr ); + +#endif /* User mode end*/ + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + + /** + * Initialises the buffer. + * + * @param aTxBufLength + */ + inline void Initialize( TUint32 aTxBufLength ); + +#endif /* Kernel mode end */ + +private: + + /** Prohibit default constructor */ + RFrameXferBlock(); + + /** Prohibit copy constructor */ + RFrameXferBlock( const RFrameXferBlock& ); + /** Prohibit assigment operator */ + RFrameXferBlock& operator= ( const RFrameXferBlock& ); + +private: // data + + /** Tx-data buffer */ + TDataBuffer* iTxDataBuffer; + + /** + * stores the total capacity (length) of the Tx buffer (iTxDataBuffer) + * associated with this object instance + */ + TUint32 iTxBufLength; + }; + +#ifndef __KERNEL_MODE__ /* User mode */ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline TInt RFrameXferBlock::AppendTxDataBuffer( + const TUint8* aData, + TUint32 aLength, + TDataBuffer::TFrameType aFrameType, + TUint8 aUserPriority, + TBool aMustNotBeEncrypted, + const TMacAddress* aDestinationAddress ) + { + if ( aLength <= + iTxBufLength - + iTxOffset[aFrameType] - + iTxDataBuffer->GetLength() ) + { + // provided data fits into buffer + + iTxDataBuffer->FrameType( aFrameType ); + iTxDataBuffer->AppendBuffer( aData, aLength, iTxOffset[aFrameType] ); + iTxDataBuffer->SetUserPriority( aUserPriority ); + + if ( aMustNotBeEncrypted ) + { + iTxDataBuffer->KeSetFlags( + TDataBuffer::KTxFrameMustNotBeEncrypted ); + } + else + { + iTxDataBuffer->KeClearFlags( + TDataBuffer::KTxFrameMustNotBeEncrypted ); + } + + if ( aDestinationAddress ) + { + iTxDataBuffer->SetDestinationAddress( *aDestinationAddress ); + } + + return KErrNone; + } + else + { + return KErrOverflow; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RFrameXferBlock::ClearTxDataBuffer() + { + iTxDataBuffer->SetLength( 0 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RFrameXferBlock::SetTxDataBufferField( TLinAddr aUserAddr ) + { + iTxDataBuffer = reinterpret_cast(aUserAddr); + } + +#endif /* User mode end */ + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +inline void RFrameXferBlock::Initialize( TUint32 aTxBufLength ) + { + // perform base class initialization first + KeInitialize(); + + iTxDataBuffer = NULL; + iTxBufLength = aTxBufLength; + } + +#endif /* Kernel mode end */ + +/** +* Ethernet frame transfer context block between user and kernel space +* for the protocol stack side client +* +*/ +class RFrameXferBlockProtocolStack : public RFrameXferBlock + { + +public: + +#ifndef __KERNEL_MODE__ /* User mode */ + + /** + * Initializes TX Data pool, with the address of this in user space. + * + * @param aThisAddrUserSpace Address of this object in user space. + */ + inline void UserInitialize( TUint32 aThisAddrUserSpace ); + +#endif /* User mode end */ + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + + /** + * Initialises Kernel's memory interface to shared memory between User + * and Kernel Space. + */ + void Initialise(); + + /** + * Allocates a Tx buffer from the shared memory. + * + * @param aTxBuf Pointer to the pre-allocated actual Tx buffer. + * @param aBufLength Length of the Tx buffer. + * @return Pointer to the meta header attached to the allocated buffer, on + * success. + * NULL, in case of allocation failure. + */ + TDataBuffer* AllocTxBuffer( const TUint8* aTxBuf, TUint16 aBufLength ); + + /** + * Adds the specified Tx frame (contained in the buffer allocated from the + * shared memory) to the relevant Tx queue according to its AC (i.e. + * priority). + * + * @param aPacketInUserSpace Meta header attached to the frame; as a user + * space pointer. + * @param aPacketInKernSpace If not NULL on return, the frame needs to be + * discarded and this is the kernel space pointer to its meta header. + * If NULL on return, the frame must not be discarded. + * @param aUserDataTxEnabled ETrue if user data Tx is enabled + * EFalse otherwise + * @return ETrue if the client is allowed to continue calling this method + * (i.e. Tx flow is not stopped). + * EFalse if the client is not allowed to call this method again + * (i.e. Tx flow is stopped) until it is re-allowed. + */ + TBool AddTxFrame( + TDataBuffer* aPacketInUserSpace, + TDataBuffer*& aPacketInKernSpace, + TBool aUserDataTxEnabled ); + + /** + * Gets the frame to be transmitted next from the Tx queues. + * + * @param aWhaTxQueueState State (full / not full) of every WHA transmit + * queue + * @param aMore On return is ETrue if another frame is also ready to be + * transmitted, EFalse otherwise + * @return Pointer to the meta header of the frame to be transmitted, on + * success + * NULL, if there's no frame that could be transmitted, given the + * current status of the WHA Tx queues + */ + TDataBuffer* GetTxFrame( + const TWhaTxQueueState& aWhaTxQueueState, + TBool& aMore ); + + /** + * Deallocates a Tx packet. + * + * All Tx packets allocated with AllocTxBuffer() must be deallocated using + * this method. + * + * @param aPacket Meta header of the packet to the deallocated + */ + inline void FreeTxPacket( TDataBuffer*& aPacket ); + + /** + * Determines if Tx from protocol stack side client should be resumed + * + * @param aUserDataTxEnabled ETrue if user data Tx is enabled + * EFalse otherwise + * @return ETrue if Tx should be resumed + * EFalse otherwise + */ + TBool ResumeClientTx( TBool aUserDataTxEnabled ) const; + + /** + * Determines if all Tx queues are empty + * + * @return ETrue if all Tx queues are empty + * EFalse otherwise + */ + inline TBool AllTxQueuesEmpty() const; + +#endif /* Kernel mode end */ + +private: + + /** + * With the current WLAN LDD Tx queue contents and WHA queue status, is + * it possible to schedule a new Tx packet + * + * @param aWhaTxQueueState Status of all WHA Tx queues (full/not full) + * @param aQueueId Upon returning ETrue, denotes the WLAN LDD queue from + * which a packet can be scheduled + * @return ETrue if Tx packet scheduling is possible + * EFalse if Tx packet scheduling is not possible + */ + TBool TxPossible( + const TWhaTxQueueState& aWhaTxQueueState, + TQueueId& aQueueId ); + + /** + * Determines if the Tx flow from client needs to be stopped + * + * @param aTxQueue Tx queue to which the latest packet was added + * @param aUserDataTxEnabled ETrue if user data Tx is enabled + * EFalse otherwise + * return EFalse if Tx flow needs to be stopped + * ETrue otherwise + */ + TBool TxFlowControl( TQueueId aTxQueue, TBool aUserDataTxEnabled ); + + /** Prohibit default constructor */ + RFrameXferBlockProtocolStack(); + + /** Prohibit copy constructor */ + RFrameXferBlockProtocolStack( const RFrameXferBlockProtocolStack& ); + /** Prohibit assigment operator */ + RFrameXferBlockProtocolStack& operator= ( const RFrameXferBlockProtocolStack& ); + +private: // Data + + /** Tx Queue for Voice priority frames */ + RWlanCircularBuffer iVoiceTxQueue; + + /** Tx Queue for Video priority frames */ + RWlanCircularBuffer iVideoTxQueue; + + /** Tx Queue for Best Effort priority frames */ + RWlanCircularBuffer iBestEffortTxQueue; + + /** Tx Queue for Background priority frames */ + RWlanCircularBuffer iBackgroundTxQueue; + + /** Free Queue */ + RWlanCircularBuffer iFreeQueue; + + /** Tx frame meta header objects */ + TDataBuffer iDataBuffers[KTxPoolSizeInPackets]; + + /** Address of this object instance in the user mode address space */ + TUint32 iThisAddrUserSpace; + + /** Address of this object instance in the kernel mode address space */ + TUint32 iThisAddrKernelSpace; + + /** + * the offset from a User space address to the corresponding address + * in the Kernel space in the shared memory chunk. May also be negative + */ + TInt32 iUserToKernAddrOffset; + + /** + * Note! The length of this object needs to be divisible by 4 to make + * the objects following it to be aligned correctly + */ + }; + + +#ifndef __KERNEL_MODE__ /* User mode */ +#include + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RFrameXferBlockProtocolStack::UserInitialize( + TUint32 aThisAddrUserSpace) + { + iThisAddrUserSpace = aThisAddrUserSpace; + iUserToKernAddrOffset = iThisAddrKernelSpace - iThisAddrUserSpace; + } +#endif /* User mode end */ + +#ifdef __KERNEL_MODE__ /* Kernel mode */ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RFrameXferBlockProtocolStack::FreeTxPacket( TDataBuffer*& aPacket ) + { + aPacket->SetLength( 0 ); + aPacket->SetUserPriority( 0 ); + // put the packet to the Free Queue + iFreeQueue.PutPacket( aPacket ); + aPacket = NULL; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TBool RFrameXferBlockProtocolStack::AllTxQueuesEmpty() const + { + return ( iVoiceTxQueue.IsEmpty() && + iVideoTxQueue.IsEmpty() && + iBestEffortTxQueue.IsEmpty() && + iBackgroundTxQueue.IsEmpty() ) ? ETrue : EFalse; + } + +#endif /* Kernel mode end */ + +#endif // FRAMEXFERBLOCK_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/MgmtFrameMemMngr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/MgmtFrameMemMngr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MgmtFrameMemMngr class. +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef MGMTFRAMEMMNGR_H +#define MGMTFRAMEMMNGR_H + +#include "EthernetFrameMemMngr.h" + +class WlanChunk; + + +/** +* Memory manager for management client frame Rx memory +* +* @since S60 v3.1 +*/ +class MgmtFrameMemMngr : public DEthernetFrameMemMngr + { + +public: + + /** Ctor */ + MgmtFrameMemMngr( + DWlanLogicalChannel& aParent, + WlanChunk*& aRxFrameMemoryPool, + TBool aUseCachedMemory, + TInt aRxFrameBufAllocationUnit ) : + DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ), + iUseCachedMemory( aUseCachedMemory ), + iRxFrameBufAllocationUnit ( aRxFrameBufAllocationUnit ), + iChunkSize( + Kern::RoundToPageSize( + 4096 * 15 + KProtocolStackSideTxDataChunkSize ) ) // bytes + {}; + + /** Dtor */ + virtual ~MgmtFrameMemMngr() {}; + +protected: + + /** + * From DEthernetFrameMemMngr + * Allocates a shared memory chunk for frame transfer between user + * and kernel address spaces + * + * @since S60 3.1 + * @param aSharedMemoryChunk The shared memory chunk + * @return system wide error code, KErrNone upon success + */ + virtual TInt DoAllocate( DChunk*& aSharedMemoryChunk ); + + /** + * Opens a handle for user mode client to the shared memory chunk + * allocated for frame transfer between user and kernel address spaces + * + * @since S60 3.1 + * @param aThread The user mode client thread + * @param aSharedChunkInfo After successful return contains the handle to the + * chunk + * @param aSharedMemoryChunk The shared memory chunk + * @return system wide error code, KErrNone upon success + */ + virtual TInt DoOpenHandle( + DThread& aThread, + TSharedChunkInfo& aSharedChunkInfo, + DChunk* aSharedMemoryChunk ); + + /** + * From DEthernetFrameMemMngr + * Gets a free rx buffer + * + * @since S60 3.1 + * @param aLengthinBytes Requested buffer length + * @return buffer for Rx data upon success + * NULL otherwise + */ + virtual TUint8* DoGetNextFreeRxBuffer( TUint aLengthinBytes ); + + /** + * From DEthernetFrameMemMngr + * Gets called when rx frame read cycle has ended. + * + * @since S60 3.1 + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + * @return ETrue if a pending user mode frame read request exists + * and callee should complete it, + * EFalse otherwise + */ + virtual TBool DoEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * From DEthernetFrameMemMngr + * Gets start address of Rx buffers (their offset addresses) + * that are waiting for completion to user mode + * + * @since S60 3.1 + * @return see above statement + */ + virtual TUint32* DoGetTobeCompletedBuffersStart(); + + /** + * From DEthernetFrameMemMngr + * Gets start address of Rx buffers (their offset addresses) + * that have been completed to user mode + * + * @since S60 3.1 + * @return see above statement + */ + virtual TUint32* DoGetCompletedBuffersStart(); + + /** + * From DEthernetFrameMemMngr + * Gets called when user mode client issues a frame receive request + * and Rx buffers have been completed to it. The completed Rx frame + * buffers are freed. + * + * @since S60 3.1 + */ + virtual void DoFreeRxBuffers(); + + /** + * From DEthernetFrameMemMngr + * Frees the specified Rx frame buffer + * + * @since S60 3.1 + * @param aBufferToFree The buffer to free + */ + virtual void DoMarkRxBufFree( TUint8* aBufferToFree ); + +private: + + /** + * Returns the number of extra bytes required to align Rx buffer start + * address, to be returned to WHA layer, to allocation unit boundary + * @return See above + */ + TInt RxBufAlignmentPadding() const; + + /** + * From DEthernetFrameMemMngr + * Memory finalization method. + * Deallocates the shared memory chunk + * + * @since S60 3.1 + */ + virtual void OnReleaseMemory(); + + // Prohibit copy constructor. + MgmtFrameMemMngr( const MgmtFrameMemMngr& ); + // Prohibit assigment operator. + MgmtFrameMemMngr& operator= ( const MgmtFrameMemMngr & ); + +private: // Data + + /** + * kernel address of the shared memory chunk + */ + TLinAddr iChunkKernelAddr; + + /** + * array of TDataBuffer offset addresses, denoting Rx buffers, + * which are waiting here in kernel mode to be completed + * to user mode, when the next frame receive request arrives + */ + TUint32 iTobeCompletedBuffers[KMaxToBeCompletedRxBufs]; + + /** + * array of TDataBuffer offset addresses, denoting Rx buffers, that are + * currently under processing in user mode + */ + TUint32 iCompletedBuffers[KMaxCompletedRxBufs]; + + /** + * ETrue if cached frame transfer memory shall be used, + * EFalse otherwise + */ + TBool iUseCachedMemory; + + /** + * size of the Rx frame buffer allocation unit in bytes + */ + TInt iRxFrameBufAllocationUnit; + + /** size of the shared memory chunk */ + TInt iChunkSize; + }; + +#endif // MGMTFRAMEMMNGR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the RWlanLogicalChannel class. +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef RWLAN_LOGICAL_CHANNEL_H_ +#define RWLAN_LOGICAL_CHANNEL_H_ + +#include "wlanlddcommon.h" +#include "FrameXferBlock.h" + +#ifndef __KERNEL_MODE__ +#include // for RChunk +#endif + +// Enumeration values for control messages +enum TWlanControl + { + EWlanSvControlInitBuffers, // Allocate frame transfer memory for WLAN Mgmt + // client + EWlanSvControlFreeBuffers // Deallocate memory allocated by + // EWlanSvControlInitBuffers + }; + +// Open parameters +struct TOpenParam + { + TAny* iPda; // start of PDA data + // excludes the S60 specific configuration data + // in the beginning which is added by UMAC + // (pointee must be 32-bit aligned) + TUint32 iPdaLength; // length of PDA data in bytes + // excludes the S60 specific configuration data + // in the beginning + + + TAny* iFirmWare; // firmware data + // (pointee must be 32-bit aligned) + TUint32 iFirmWareLength; // length of firmware in bytes + }; + +// Enumeration values for asynchronous requests. Do not exceed KMaxRequests! +enum TWlanRequest + { + EWlanRequestNotify, // request a notification + EWlanRequestFrame, // frame Rx request + EWlanRequestSend, // frame Tx request + EWlanCommand, // WLAN management command + EWlanInitSystem, // internal init + EWlanFinitSystem, // internal finit + EWlanMaxRequest + }; + +class RWlanLogicalChannel : public RBusLogicalChannel + { + +public: + + /** + * Opens a channel to the WLAN device driver. + * + * @since S60 3.1 + * @param aUnit This parameter tells which kind of channel is opened, i.e. + * in practice identifies the client who wishes to open a channel. + * @param aOpenParam Basic initialization parameters which WLAN LDD passes + * to WLAN PDD + * @return KErrNone on success, any other on failure + */ + inline TInt Open( + TWlanUnit aUnit, + TOpenParam& aOpenParam ); + + /** + * Closes the device driver channel + * + * Last method to be called prior driver unload + * + * @since S60 3.1 + */ + inline void CloseChannel(); + + /** + * Returns the version required by the WLAN device driver. + * + * @since S60 3.1 + * @return The required version. + */ + inline TVersion VersionRequired() const; + + /** + * Submits a management command to the device driver. + * + * The command is executed either synchronously or asynchronously, + * depending on the parameters. + * + * @since S60 3.1 + * @param aInBuffer Reference to input buffer descriptor for the command + * @param aOutBuffer Pointer to output buffer, can be NULL if no output + * is expected + * @param aStatus Pointer to the status object. If aStatus is NULL, the + * command is executed synchronously, otherwise asynchronously. + * @return KErrNone, if the management command succeeded, + * any other on failure + */ + inline TInt ManagementCommand( + const TDesC8& aInBuffer, + TDes8* aOutputBuffer = NULL, + TRequestStatus* aStatus = NULL); + + /** + * Requests generic notifications from device driver. + * + * @since S60 3.1 + * @param aStatus Status parameter for request completion + * @param aBuffer Reference to indication buffer. When an indication + * appears the request completes and the buffer contains the + * indication information. + */ + inline void RequestSignal( TRequestStatus &aStatus, TIndication &aBuffer ); + + + /** + * Cancels notification request. + * + * @since S60 3.1 + */ + inline void CancelRequestSignal(); + + /** + * Allocates frame transfer memory for WLAN Mgmt client use. + * + * Does the necessary memory allocation and maps the + * physical memory to the address space of the calling process, so that + * also it can access the memory. + * Note! The channel must be open and the Configure management commmand + * must have been issued before calling this method. + * + * @since S60 3.1 + * @param aFrameXferBlock FrameXferBlock to be initialised by + * the device driver. + * @return KErrNone on success, any other on failure + */ + inline TInt InitialiseBuffers( RFrameXferBlock*& aFrameXferBlock ); + + /** + * Unmaps memory mapped by InitialiseBuffers method from the address space + * of the calling process and deallocates it. + * + * Every call to InitialiseBuffers must be matched by a call to + * ReleaseBuffers + * + * @since S60 3.1 + * @return KErrNone on success, any other on failure + */ + inline TInt ReleaseBuffers(); + + /** + * Asynchronous frame transmit request + * + * @since S60 3.1 + * @param aStatus a TRequestStatus + */ + inline void WriteFrame( TRequestStatus &aStatus ); + + /** + * Asynchronous frame receive request + * + * @since S60 3.1 + * @param aStatus a TRequestStatus + */ + inline void RequestFrame( TRequestStatus &aStatus ); + + /** + * Cancels WLAN Mgmt client frame receive request. + * + * @since S60 3.1 + * Buffers can be released after this call returns + */ + inline void CancelRxRequests(); + +private: + + inline TInt InitWlanSystem( TOpenParam& aOpenParam ); + +private: // data + + /** + * has the WLAN system been initialized + */ + TBool iWlanSystemInitialized; + + /** + * If a WLAN Management Command is executed asynchronously, this data + * member is used to store the Management Command message - thus keeping + * it valid until the asynchronous request is actually scheduled. + * Note that only a single WLAN Management Command can be under processing + * at a time. + */ + SOidMsgStorage iAsyncOidCommandMsg; + + /** + * If a WLAN Management Command is executed asynchronously, this data + * member is used to store the Management Command output buffer context - + * thus keeping it valid until the asynchronous request is actually + * scheduled. + * Note that only a single WLAN Management Command can be under processing + * at a time. + */ + SOutputBuffer iAsyncOidCommandOutput; + +#ifndef __KERNEL_MODE__ + /** handle to kernel side shared memory chunk */ + RChunk iSharedMemoryChunk; +#endif + }; + +#ifndef __KERNEL_MODE__ + #include "RWlanLogicalChannel.inl" +#endif // __KERNEL_MODE__ + +#endif// #if !defined(RWLAN_LOGICAL_CHANNEL_H_) diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/RWlanLogicalChannel.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,280 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of RWlanLogicalChannel inline methods. +* +*/ + +/* +* %version: 16 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TVersion RWlanLogicalChannel::VersionRequired() const + { + return TVersion( + KWlanDriverMajorVersion, + KWlanDriverMinorVersion, + KWlanDriverBuildVersion ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TInt RWlanLogicalChannel::Open( + TWlanUnit aUnit, + TOpenParam& aOpenParam ) + { + iWlanSystemInitialized = EFalse; + + TInt err = DoCreate( + LDD_NAME, + VersionRequired(), + aUnit, + NULL, + NULL, + EOwnerProcess); + + if ( err == KErrNone ) + { + // driver load sequence success + // do system init + err = InitWlanSystem( aOpenParam ); + + if ( err == KErrNone ) + { + // WLAN system successfully initialized + iWlanSystemInitialized = ETrue; + } + } + + return err; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RWlanLogicalChannel::CloseChannel() + { + // release WLAN system resources only if we have been able to do the + // initialization successfully. + // This check is done to prevent a release attempt in a case where the + // device driver framework has not been properly initialized to be able to + // handle requests + if ( iWlanSystemInitialized ) + { + TRequestStatus status; + DoRequest( EWlanFinitSystem, status ); + User::WaitForRequest(status); + + // not initialized any more. This is needed to handle the case + // that this method is called multiple times + iWlanSystemInitialized = EFalse; + } + // internally call close + Close(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TInt RWlanLogicalChannel::InitWlanSystem( + TOpenParam& aOpenParam ) + { + TRequestStatus status; + DoRequest( EWlanInitSystem, status, &aOpenParam ); + User::WaitForRequest(status); + return status.Int(); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TInt RWlanLogicalChannel::ManagementCommand( + const TDesC8& aInBuffer, + TDes8* aOutBuffer, + TRequestStatus* aStatus) + { + TInt ret( KErrNoMemory ); + SOidMsgStorage* pdu( new SOidMsgStorage ); + + if ( pdu ) + { + TUint32 input_param_len( aInBuffer.Length() ); + os_memcpy( pdu, aInBuffer.Ptr(), input_param_len ); + + SOutputBuffer output = { NULL, 0 }; + if ( aOutBuffer ) + { + output.iData = const_cast(aOutBuffer->Ptr()); + output.iLen = aOutBuffer->Length(); + } + + if (aStatus == NULL) + { + // Execute command synchronously + TRequestStatus status; + + DoRequest( + EWlanCommand, + status, + pdu, + (output.iData ? &output : NULL) ); + + User::WaitForRequest(status); + + ret = status.Int(); + } + else + { + // Execute command asynchronously + + iAsyncOidCommandMsg = *pdu; + iAsyncOidCommandOutput = output; + DoRequest( + EWlanCommand, + *aStatus, + &iAsyncOidCommandMsg, + (output.iData ? &iAsyncOidCommandOutput : NULL) ); + + ret = KErrNone; + } + + // always remember to deallocate + delete pdu; + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RWlanLogicalChannel::RequestSignal( + TRequestStatus &aStatus, + TIndication &aBuffer) + { + DoRequest(EWlanRequestNotify, aStatus, &aBuffer); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RWlanLogicalChannel::CancelRequestSignal() + { + // DoCancel uses mask instead of real values. + DoCancel(1<(&info) ); + + if ( status == KErrNone ) + { + // shared memory chunk initialization success + + // Set the handle for the shared memory chunk + iSharedMemoryChunk.SetHandle( info.iChunkHandle ); + + // Set the relevant user mode + // addresses as offsets from the chunk base address + + TUint8* baseAddress ( iSharedMemoryChunk.Base() ); + + const TUint KRxDataChunkSize( + info.iSize + - ( sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize + + sizeof( RFrameXferBlock ) + + sizeof( RFrameXferBlockProtocolStack ) ) ); + + aFrameXferBlock = reinterpret_cast( + baseAddress + + KRxDataChunkSize + + sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize ); + + aFrameXferBlock->SetRxDataChunkField( reinterpret_cast( + baseAddress) ); + + aFrameXferBlock->SetTxDataBufferField( reinterpret_cast( + baseAddress + + KRxDataChunkSize ) ); + } + + return status; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline TInt RWlanLogicalChannel::ReleaseBuffers() + { + // close the handle to the shared memory chunk + iSharedMemoryChunk.Close(); + + return DoSvControl( EWlanSvControlFreeBuffers ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RWlanLogicalChannel::WriteFrame( + TRequestStatus &aStatus ) + { + DoRequest( EWlanRequestSend, aStatus ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void RWlanLogicalChannel::RequestFrame( + TRequestStatus &aStatus ) + { + DoRequest( EWlanRequestFrame, aStatus ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlLddWlanLddConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlLddWlanLddConfig.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Module configuration file. +* This file is the 1st one to be included +* by every source file of this project +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WLLDDWLANLDDCONFIG_H +#define WLLDDWLANLDDCONFIG_H + +#include "umac_types.h" +#include "gendebug.h" +#include + +extern void os_assert( + const TUint8* aError, + const TUint8* aFile, + TUint32 aLine ); + +#include "trace_util.h" + +#endif // WLLDDWLANLDDCONFIG_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalChannel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalChannel.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,798 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the DWlanLogicalChannel class. +* +*/ + +/* +* %version: 31 % +*/ + +#ifndef DWLANLOGICALCHANNEL_H +#define DWLANLOGICALCHANNEL_H + +#include "UmacManagementSideUmacCb.h" +#include "UmacProtocolStackSideUmacCb.h" +#include "wllddlogicalchannelbase.h" +#include "RWlanLogicalChannel.h" + +#include "wllddoidmsgstorage.h" +#include "wlldddmausablememory.h" +#include "wllddpowerindicator.h" +#include "wllddpowerhandler.h" + +#include "EtherCardApi.h" +#include "FrameXferBlock.h" + +class DWlanLogicalDevice; +class Umac; + +#ifdef RD_WLAN_DDK +class WlanOsa; +#endif + +class DEthernetFrameMemMngr; +class RFrameXferBlock; +class WlanChunk; + +class DWlanLogicalChannel : + public DWlanLogicalChannelBase, + public WlanManagementSideUmacCb, + public WlanProtocolStackSideUmacCb, + public MWlanPowerIndicator + { + // type definitions + // linked list entry for storing indications + struct TIndicationListEntry + { + TIndication indication; + struct TIndicationListEntry *next; + }; + + /** max number of indication list entries */ + enum { KMaxIndicationListEntries = 6 }; + +public: + +#ifndef RD_WLAN_DDK + DWlanLogicalChannel( + DWlanLogicalDevice& aParent, + Umac& aUmac, + TDynamicDfcQue& aDfcQ, + DMutex& aMutex, + DChunk*& aSharedMemoryChunk, + WlanChunk*& aRxFrameMemoryPool ); +#else + DWlanLogicalChannel( + DWlanLogicalDevice& aParent, + Umac& aUmac, + TDynamicDfcQue& aDfcQ, + WlanOsa*& aOsa, + DChunk*& aSharedMemoryChunk, + WlanChunk*& aRxFrameMemoryPool ); +#endif + + virtual ~DWlanLogicalChannel(); + + /** + * Returns a reference to a pointer pointing to the only shared memory + * chunk instance + * + * @return See above + */ + DChunk*& SharedMemoryChunk(); + + /** + * Sets the number of extra bytes required to align Rx buffer start + * address, to be returned to WHA layer, to allocation unit boundary + */ + void SetRxBufAlignmentPadding( TInt aRxBufAlignmentPadding ); + + /** + * Returns the number of extra bytes required to align Rx buffer start + * address, to be returned to WHA layer, to allocation unit boundary + * @return See above + */ + TInt RxBufAlignmentPadding() const; + + /** + * Second phase constructor for DLogicalChannelBase objects. + * + * It is called in creating thread context in a critical section with + * no fast mutexes held. + * The default implementation does nothing. + * + * @since S60 3.1 + * @param aUnit Requested unit number + * @param aInfo Additional info supplied by client + * @param aVer Requested interface version + * + * @return KErrNone if construction was successful, + * otherwise one of the other system-wide error codes. + */ + virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer); + + /** + * Processes a message for this logical channel. + * This function is called in the context of a DFC thread. + * + * @since S60 3.1 + * @param aMsg The message to process. + * The iValue member of this distinguishes the message type: + * iValue==ECloseMsg, channel close message + * iValue==KMaxTInt, a 'DoCancel' message + * iValue>=0, a 'DoControl' message with function number equal to iValue + * iValue<0, a 'DoRequest' message with function number equal to ~iValue + */ + virtual void HandleMsg(TMessageBase* aMsg); + + /** + * Process a function for this logical channel. + * This function is executed in the context of client's thread in + * supervisor mode. All code executed in this mode MUST NOT + * take a lot of time and MUST NOT access the WHA layer. + * @param aFunction Defines the operation/function to be performed. + * @param param Function specific parameter + * @return function specific return value. + */ + virtual TAny* DoControlFast( TInt aFunction, TAny* param ); + +private: + + /** + * Called from statemachine when oid has been completed. + * Triggers handling of a new oid + * @param aOid OID handled + * @param aReason completion code + */ + virtual void OnOidCompleted( + TInt aReason, + SOidOutputData& OidOutputData ); + + /** + * Sets the Tx offset for every frame type which can be transmitted + * + * @since S60 5.0 + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames and Ethernet + * Test frames + * @param aDot11FrameTxOffset Tx offset for 802.11 frames + * @param aSnapFrameTxOffset Tx offset for SNAP frames + */ + virtual void SetMgmtSideTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ); + + /** + * Gets buffer for Rx data + * @param aLengthinBytes Requested buffer length + * @return buffer for Rx data upon success + * NULL otherwise + */ + virtual TUint8* GetBufferForRxData( TUint aLengthinBytes ); + + /** + * Completes a data read operation from management side + * + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + */ + virtual void MgmtDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * Completes a data write operation from management side + * @param aErr completion code + */ + virtual void MgmtPathWriteComplete ( TInt aErr ); + + /** + * Sends a indication to the management side + * @param aIndication indication code + */ + virtual void OnInDicationEvent( TIndication aIndication ); + + /** + * Frees the specified Rx frame buffer + * + * @param aBufferToFree The buffer to free + */ + virtual void MarkRxBufFree( TUint8* aBufferToFree ); + + /** + * Sets the Tx offset for every frame type which can be transmitted + * + * @since S60 5.0 + * @param aEthernetFrameTxOffset Tx offset for Ethernet frames + */ + virtual void SetProtocolStackTxOffset( + TUint32 aEthernetFrameTxOffset ); + + /** + * Called when the Tx packet in question has been trasferred to the WLAN + * device. + * + * @param aCompletionCode Status of the operation. + * @param aMetaHeader Meta header associated with the related Tx packet + */ + virtual void OnTxProtocolStackDataComplete( + TInt aCompletionCode, + TDataBuffer* aMetaHeader ); + + /** + * Called when a Tx packet - submitted by someone else than the Protocol + * Stack Side Client - has been trasferred to the WLAN device. + */ + virtual void OnOtherTxDataComplete(); + + /** + * Called when the Tx of a frame has completed (either successfully or + * unsuccessfully). + */ + virtual void OnTxDataSent(); + + virtual TUint8* DmaPrivateTxMemory(); + + /** + * Completes a data read operation from protocol stack side + * + * @param aBufferStart first element of the array that holds pointers to + * Rx frame meta headers + * @param aNumOfBuffers number of meta header pointers in the array + * @return ETrue if this event was processed successfully + * EFalse otherwise + */ + virtual TBool ProtocolStackDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ); + + /** + * Determines if the Protocol Stack Side client is ready to handle any + * callbacks from UMAC + * + * @return ETrue if the client is ready + * EFalse if the client is not ready + */ + virtual TBool ProtocolStackSideClientReady() const; + + /** + * From WlanProtocolStackSideUmacCb. + * Indicates that WLAN Mgmt Client has (re-)enabled protocol stack side + * user data Tx. + */ + virtual void UserDataReEnabled(); + + virtual void RegisterTimeout( + TUint32 aTimeoutInMicroSeconds, + TWlanTimer aTimer ); + virtual void CancelTimeout( TWlanTimer aTimer ); + + virtual void RegisterDfc( TAny* aCntx ); + virtual void CancelDfc(); + + /** + * Allocates Rx frame meta header + * @return Rx frame meta header upon success + * NULL otherwise + */ + virtual TDataBuffer* GetRxFrameMetaHeader(); + + /** + * Deallocates Rx frame meta header + * @param aMetaHeader Meta header to deallocate + */ + virtual void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ); + + void DoCancel( TInt aMask ); + + TInt DoRequest( + TInt aReqNo, + TRequestStatus* aStatus, + TAny* a1, + TAny* a2 ); + TInt OnMgmtSideDoRequest( + TInt aReqNo, + TRequestStatus* aStatus, + TAny* a1, + TAny* a2 ); + TInt OnEthernetSideRequest( + TInt aReqNo, + TRequestStatus* aStatus, + TAny* a1, + TAny* a2 ); + + TInt DoControl( TInt aFunction, TAny* a1, TAny* a2); + TInt OnMgmtSideControl( TInt aFunction, TAny* a1, TAny* a2 ); + TInt OnEthernetSideControl( TInt aFunction, TAny* a1, TAny* a2 ); + + TInt OnInitialiseEthernetFrameBuffers( + TSharedChunkInfo* aSharedChunkInfo ); + + void OnReleaseEthernetFrameBuffers(); + + void TxProtocolStackData(); + void TxManagementData(); + + TBool OnReadEthernetFrameRequest(); + + /** + * Stores a indication to indication list + * @param aIndication indication to be stored + */ + void StoreIndication( TIndication aIndication ); + + /** + * Gets first stored indication and assigns it to indication buffer + * @return ETrue a stored indication existed, otherwise EFalse + */ + TBool GetStoredIndication(); + + /** + * Calls GetStoredIndication() and after that + * completes the outstanding request + */ + void TryToCompleteIndicationRequest(); + + /** + * Relases a indication list entry + * @param entry to be relased + */ + void ReleaseIndicationListEntry( TIndicationListEntry* aEntry ); + + /** + * Gets a next free indication list entry + * @return a next free indication list entry + */ + TIndicationListEntry* GetFreeIndicationListEntry(); + + /** + * Deallocates the indication list and marks all pointers NULL + */ + void FreeIndicationList(); + + /** + * Clears all indication list entrys + */ + void PurgeIndicationList(); + + /** + * From CWlanPhy + * Registers the notification to the PDD. + * This request is used for registering indication buffer to PDD + * @param aBuffer pointer to TIndication + */ + void IndicationRequest( TIndication* aBuffer ); + + /** + * From CWlanPhy + * Releases indication buffer from PDD + */ + void CancelIndicationRequest(); + + /** + * Called by the PDD when a notification is received. + */ + void IndicationComplete(); + + TBool InitIndicationListEntries(); + + /** + * Default Timer timeout callback function + * + * @since S60 3.1 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnTimeOut( TAny *aPtr ); + + /** + * Voice Call Entry Timer timeout DFC callback method + * + * @since S60 3.2 + */ + void RealVoiceCallEntryTimerDfc(); + + /** + * Voice Call Entry Timer timeout DFC callback function + * + * @since S60 3.2 + * @param aPtr this pointer (pointer to this object instance) + */ + static void VoiceCallEntryTimerDfcDoToggle( TAny* aPtr ); + + /** + * Voice Call Entry Timer timeout callback function + * + * @since S60 3.2 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnVoiceCallEntryTimerTimeOut( TAny *aPtr ); + + /** + * Null Timer timeout DFC callback method + * + * @since S60 3.2 + */ + void RealNullTimerDfc(); + + /** + * Null Timer timeout DFC callback function + * + * @since S60 3.2 + * @param aPtr this pointer (pointer to this object instance) + */ + static void NullTimerDfcDoToggle( TAny* aPtr ); + + /** + * Null Timer timeout callback function + * + * @since S60 3.2 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnNullTimerTimeOut( TAny *aPtr ); + + /** + * No Voice Timer timeout DFC callback method + * + * @since S60 3.2 + */ + void RealNoVoiceTimerDfc(); + + /** + * No Voice Timer timeout DFC callback function + * + * @since S60 3.2 + * @param aPtr this pointer (pointer to this object instance) + */ + static void NoVoiceTimerDfcDoToggle( TAny* aPtr ); + + /** + * No Voice Timer timeout callback function + * + * @since S60 3.2 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnNoVoiceTimerTimeOut( TAny *aPtr ); + + /** + * Keep Alive Timer timeout DFC callback method + * + * @since S60 3.2 + */ + void RealKeepAliveTimerDfc(); + + /** + * Keep Alive Timer timeout DFC callback function + * + * @since S60 3.2 + * @param aPtr this pointer (pointer to this object instance) + */ + static void KeepAliveTimerDfcDoToggle( TAny* aPtr ); + + /** + * Keep Alive Timer timeout callback function + * + * @since S60 3.2 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnKeepAliveTimerTimeOut( TAny *aPtr ); + + /** + * Active to Light PS Timer timeout DFC callback method + * + * @since S60 5.1 + */ + void RealActiveToLightPsTimerDfc(); + + /** + * Active to Light PS Timer timeout DFC callback function + * + * @since S60 5.1 + * @param aPtr this pointer (pointer to this object instance) + */ + static void ActiveToLightPsTimerDfcDoToggle( TAny* aPtr ); + + /** + * Active to Light PS Timer timeout callback function + * + * @since S60 5.1 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnActiveToLightPsTimerTimeOut( TAny *aPtr ); + + /** + * Light PS to Active Timer timeout DFC callback method + * + * @since S60 5.1 + */ + void RealLightPsToActiveTimerDfc(); + + /** + * Light PS to Active Timer timeout DFC callback function + * + * @since S60 5.1 + * @param aPtr this pointer (pointer to this object instance) + */ + static void LightPsToActiveTimerDfcDoToggle( TAny* aPtr ); + + /** + * Light PS to Active Timer timeout callback function + * + * @since S60 5.1 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnLightPsToActiveTimerTimeOut( TAny *aPtr ); + + /** + * Light PS to Deep PS Timer timeout DFC callback method + * + * @since S60 5.1 + */ + void RealLightPsToDeepPsTimerDfc(); + + /** + * Light PS to Deep PS Timer timeout DFC callback function + * + * @since S60 5.1 + * @param aPtr this pointer (pointer to this object instance) + */ + static void LightPsToDeepPsTimerDfcDoToggle( TAny* aPtr ); + + /** + * Light PS to Deep PS Timer timeout callback function + * + * @since S60 5.1 + * @param aPtr A pointer passed to the callback function when called. + * This pointer was given to the timer in timer construction. + */ + static void OnLightPsToDeepPsTimerTimeOut( TAny *aPtr ); + + /** + * Default Timer timeout DFC callback method + * + * @since S60 3.1 + */ + void RealTimerDfc(); + + void RealDfc(); + + /** + * Default Timer timeout DFC callback function + * + * @since S60 3.1 + * @param aPtr this pointer (pointer to this object instance) + */ + static void TimerDfcDoToggle( TAny* aPtr ); + + static void DfcDoToggle( TAny* aPtr ); + + /** + * Protocol Stack Side Tx Trigger DFC callback method + */ + void RealTxTriggerDfc(); + + /** + * Protocol Stack Side Tx Trigger DFC callback function + * + * @param aPtr this pointer (pointer to this object instance) + */ + static void TxTriggerDfcDoToggle( TAny* aPtr ); + + void FinitSystem(); + void InitSystem( TAny* aInputBuffer, TUint aInputLength ); + + /** + * Allocates kernel mode storage for actual parameters pointed to by + * pointers in an OID command + * + * @since S60 3.1 + * @return ETrue if the operation succeeds; + * EFalse otherwise + */ + TBool HandlePointerParameters(); + + /** + * Allocates kernel mode storage for scan response frame body and copies + * it from user side to kernel side from the connect command parameters + * + * @since S60 3.2 + * @return ETrue if the operation succeeds; + * EFalse otherwise + */ + TBool HandleScanResponseFrameBodyCase(); + + /** + * Allocates kernel mode storage for IE(s) and copies it (them) from user + * side to kernel side when there is IE(s) present in the connect command + * + * @since S60 3.2 + * @return ETrue if the operation succeeds; + * EFalse otherwise + */ + TBool CheckAndHandleIeDataCase(); + + /** + * Frees kernel mode storage allocated for scan response frame body + * + * @since S60 3.2 + */ + void FreeScanResponseFramebody(); + + /** + * Frees kernel mode storage allocated for IE(s) + * + * @since S60 3.2 + */ + void FreeIeData(); + + /** + * From MWlanPowerIndicator + * Indicates that power up notification has been received from kernel + * side Power Manager. + */ + virtual void OnPowerUp(); + + /** + * From MWlanPowerIndicator + * Indicates that power down request has been received from kernel + * side Power Manager. + * + * @since S60 3.1 + */ + virtual void OnPowerDown(); + + // Prohibit copy constructor. + DWlanLogicalChannel ( const DWlanLogicalChannel & ); + // Prohibit assigment operator. + DWlanLogicalChannel & operator= ( const DWlanLogicalChannel & ); + +private: // data + + const TUint32 KFreeOpenParamsMask = ( 1 << 0 ); + const TUint32 KFreeScanResponseFramebodyMask = ( 1 << 1 ); + const TUint32 KDfcCancelledMask = ( 1 << 2 ); + const TUint32 KFreeIeDataMask = ( 1 << 3 ); + const TUint32 KPowerHandlerRegistered = ( 1 << 4 ); + const TUint32 KTxTriggerArmed = ( 1 << 5 ); + + TOpenParam iOpenParam; + + DThread* iClient; + TInt iUnit; + Umac& iUmac; + /** pointer to our DFC queue. Not own */ + TDynamicDfcQue* iDfcQ; + DWlanLogicalDevice& iParent; + + /** management side requests */ + TRequestStatus* iWlanGeneralRequestStatus; + TRequestStatus* iWlanRequestNotifyStatus; + TRequestStatus* iWlanReceiveFrameStatus; + TRequestStatus* iWlanSendFrameStatus; + + /** indication request buffer to USER mode */ + TIndication* iIndicationBuffer; + /** pointer to first stored indication */ + TIndicationListEntry* iIndicationListHead; + /** pointer to the first free indication list entry */ + TIndicationListEntry* iFreeIndicationListHead; + + /** protocol stack side requests */ + TRequestStatus* iResumeTxStatus; + TRequestStatus* iEthernetReceiveFrameStatus; + + /** Pointer to ethernet memory manager */ + DEthernetFrameMemMngr* iEthernetFrameMemMngr; + + /** Default Timer DFC object */ + TDfc iTimerDfc; + /** Default Timer object */ + NTimer iTimer; + /** Voice Call Entry Timer object */ + NTimer iVoiceCallEntryTimer; + /** Voice Call Entry Timer DFC object */ + TDfc iVoiceCallEntryTimerDfc; + /** NULL Timer object */ + NTimer iNullTimer; + /** NULL Timer DFC object */ + TDfc iNullTimerDfc; + /** No Voice Timer object */ + NTimer iNoVoiceTimer; + /** No Voice Timer DFC object */ + TDfc iNoVoiceTimerDfc; + /** Keep Alive Timer object */ + NTimer iKeepAliveTimer; + /** Keep Alive Timer DFC object */ + TDfc iKeepAliveTimerDfc; + /** Active to Light PS Timer object */ + NTimer iActiveToLightPsTimer; + /** Active to Light PS Timer DFC object */ + TDfc iActiveToLightPsTimerDfc; + /** Light PS to Active Timer object */ + NTimer iLightPsToActiveTimer; + /** Light PS to Active Timer DFC object */ + TDfc iLightPsToActiveTimerDfc; + /** Light PS to Deep PS Timer object */ + NTimer iLightPsToDeepPsTimer; + /** Light PS to Deep PS DFC object */ + TDfc iLightPsToDeepPsTimerDfc; + + TDfc iDfc; + /** Protocol Stack Side Tx Trigger DFC object */ + TDfc iTxTriggerDfc; + + SOidMsgStorage iOidMsgStorage; + TUint32 iFlags; + + /** our power handler */ + DWlanPowerHandler iPowerHandler; + /** + * ETrue if we are powering down because power manager has requested us + * to do so + */ + TBool iPoweringDown; + + TAny* iDfcCtx; + + WlanDmaUsableMemory iDmaTxMemory; + +#ifndef RD_WLAN_DDK + /** + * reference to mutex used to protect LDD from simultaneous execution + * by several different threads. + */ + DMutex& iMutex; +#else + /** + * OS abstraction object reference + */ + WlanOsa*& iOsa; +#endif + + /** + * reference to shared memory chunk for frame transfer between user and + * kernel address spaces + */ + DChunk*& iSharedMemoryChunk; + + /** + * reference to Rx frame memory pool manager + */ + WlanChunk*& iRxFrameMemoryPool; + + /** + * ETrue if the Tx packet submission loop is active. + * Is used to deny calling UMAC TxProtocolStackData() if the loop is + * already active. This prevents also recursive call stack growth. + */ + TBool iTxActive; + + /** + * ETrue if the user mode client is allowed to add new frames to Tx + * queues + */ + TBool iAddTxFrameAllowed; + }; + + +#endif // DWLANLOGICALCHANNEL_H + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/WlanLogicalDevice.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the DWlanLogicalDevice class. +* +*/ + +/* +* %version: 14 % +*/ + +#ifndef WLANLOGICALDEVICE_H +#define WLANLOGICALDEVICE_H + +#include "RWlanLogicalChannel.h" +#include "Umac.h" + +#ifdef RD_WLAN_DDK +#include "osa.h" +#endif + + +class WlanChunk; + +/** + * Device factory for logical channel + * @since S60 v3.1 + */ +class DWlanLogicalDevice : public DLogicalDevice +#ifdef RD_WLAN_DDK + , public WlanObject +#endif + { + +public: + + // Interface integrity version check class + class TCaps + { + public: + TVersion iVersion; + }; + + DWlanLogicalDevice(); + + virtual ~DWlanLogicalDevice(); + + /** + * Second stage constructor for derived objects. + * This must at least set a name for the driver object. + * + * @since S60 3.1 + * @return KErrNone or standard error code. + */ + virtual TInt Install(); + + /** + * Gets the driver's capabilities. + * This is called in the response to an RDevice::GetCaps() request. + * + * @since S60 3.1 + * @param aDes A user-side descriptor into which capabilities information is to be wriiten. + */ + virtual void GetCaps(TDes8& aDes) const; + + /** + * Called by the kernel's device driver framework to create a Logical Channel. + * This is called in the context of the user thread (client) which requested the creation of a Logical Channel + * (e.g. through a call to RBusLogicalChannel::DoCreate). + * The thread is in a critical section. + * + * @since S60 3.1 + * @param aChannel Set to point to the created Logical Channel + * @return KErrNone or standard error code. + */ + virtual TInt Create(DLogicalChannelBase*& aChannel); + + /** + * Returns ETrue if cached frame transfer memory shall be used and + * EFalse otherwise + * + * @return See above + */ + TBool UseCachedMemory() const; + + /** + * Sets the type of frame transfer memory (cached / non-cached) that shall + * be used. + * + * @param aValue If ETrue, cached frame transfer memory shall be used + * If EFalse, cached frame transfer memory shall not be used + */ + void UseCachedMemory( TBool aValue ); + + /** + * Sets the number of extra bytes required to align Rx buffer start + * address, to be returned to WHA layer, to allocation unit boundary + */ + void SetRxBufAlignmentPadding( TInt aRxBufAlignmentPadding ); + + /** + * Returns the number of extra bytes required to align Rx buffer start + * address, to be returned to WHA layer, to allocation unit boundary + * @return See above + */ + TInt RxBufAlignmentPadding() const; + +private: // Methods + + // Prohibit copy constructor. + DWlanLogicalDevice ( const DWlanLogicalDevice & ); + // Prohibit assigment operator. + DWlanLogicalDevice & operator= ( const DWlanLogicalDevice & ); + +private: // Data + + Umac iUmac; + + /** Our dynamic DFC queue. Own */ + TDynamicDfcQue* iDfcQ; + +#ifndef RD_WLAN_DDK + /** + * mutex used to protect LDD from simultaneous execution by several + * different threads. Own + */ + DMutex* iMutex; +#else + /** + * OS abstraction object + */ + WlanOsa* iOsa; +#endif + + /** + * ETrue if cached frame transfer memory shall be used, + * EFalse otherwise + */ + TBool iUseCachedMemory; + + /** + * shared memory chunk for frame transfer between user and kernel address + * spaces. Own + */ + DChunk* iSharedMemoryChunk; + + /** Rx frame memory pool manager. Own */ + WlanChunk* iRxFrameMemoryPool; + + /** + * number of extra bytes required to align Rx buffer start address + * to be returned to WHA layer to allocation unit boundary + */ + TInt iRxBufAlignmentPadding; + }; + +#endif // WLANLOGICALDEVICE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wlanlddcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wlanlddcommon.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN LDD general declarations & definitions. +* +*/ + +/* +* %version: 15 % +*/ + +#ifndef WLANLDDCOMMON_H +#define WLANLDDCOMMON_H + +#define LDD_NAME _L("wlan") +#define LDD_FILE_NAME _L("wlanldd") + +#include +#include +#include "umac_types.h" +#include "wllddoidmsgstorage.h" + +const TInt KWlanDriverMajorVersion = 1; +const TInt KWlanDriverMinorVersion = 0; +const TInt KWlanDriverBuildVersion = 0; + +// Values for the Unit parameter used in the LDD +enum TWlanUnit + { + KUnitEthernet, + KUnitWlan, + KUnitMax // not a real unit just defined for upperbound + }; + +const TUint KWlanUnitsAllowedMask = 0x0000000F; + +class TCapsWlanDriverV01 + { +public: + TVersion version; + }; + +struct SOutputBuffer + { + TUint8* iData; + TUint32 iLen; + }; + +/** +* Structure to hold information about the shared memory chunk between +* user mode and kernel mode +*/ +class TSharedChunkInfo + { +public: + TInt iChunkHandle; + TInt iSize; + }; + +typedef TBuf TExitCategory; + +inline void WlanPanic( + const TExitCategory& +#ifdef __KERNEL_MODE__ + aCategory +#endif + , TInt +#ifdef __KERNEL_MODE__ + aCode +#endif + ) + { +#ifdef __KERNEL_MODE__ + Kern::PanicCurrentThread( aCategory, aCode ); +#endif + } + +#endif // WLANLDDCOMMON diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddcircularbuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddcircularbuffer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the RWlanLddCircularBuffer class. +* +*/ + +/* +* %version: 2 % +*/ + +#ifndef R_WLANCIRCULARBUFFER_H +#define R_WLANCIRCULARBUFFER_H + +class TDataBuffer; + +/** + * Wlan LDD Shared Memory FIFO queue for Tx packets. + * + * @param size The size of the queue in packets. + */ +template +class RWlanCircularBuffer + { +public: + + /* Because this class is mapped into shared memory, it does not have + * a constructor or a desctructor. + */ + + /** + * Initialization. This method acts as a contructor. + */ + inline void DoInit(); + + /** + * Release. This method acts as a desctructor. + */ + inline void Release(); + + /** + * This method returns and removes the next packet from the queue. + * + * @return Pointer to the meta header attached to the packet on success. + * NULL if the queue is empty. + */ + inline TDataBuffer* GetPacket(); + + /** + * This method is used to put a packet to the end of the queue. + * + * @param aPacket Pointer to the meta header attached to the packet. + * @return ETrue if the Packet was added to the queue. + * EFalse if the queue was already full and the Packet could not + * be added to the queue. + */ + inline TBool PutPacket( TDataBuffer* aPacket ); + + /** + * Returns the next packet in the queue without removing it from the queue. + * + * @return Pointer to the meta header attached to the packet on the top + * of the queue. + */ + inline TDataBuffer* PeekPacket(); + + /** + * Returns the number of packets in the queue. + * + * @return number of packets in the queue. + */ + inline TUint GetLength() const; + + /** + * This method can be used to check if the queue is empty. + * + * @return ETrue, when the queue is empty. + * EFalse, when the queue is not empty. + */ + inline TBool IsEmpty() const; + + /** + * This method can be used to check if the queue is full. + * + * @return ETrue, when the queue is full. + * EFalse, when the queue is not full. + */ + inline TBool IsFull() const ; + + /** + * This method can be used to check if the queue is active. + * + * @param aTimeNow Current time as microseconds since midnight, January + * 1st, 0 AD nominal Gregorian + * @return ETrue, if the queue is active. + * EFalse, if the queue is not active. + */ + inline TBool IsActive( TInt64 aTimeNow ) const; + +private: // Data + + /** Queue as a circular buffer */ + TDataBuffer* iBuffer[size]; + + /** Index of the packet to get next. See GetPacket() */ + TUint iGetIndex; + + /** Index where to put the next packet. See PutPacket() */ + TUint iPutIndex; + + /** The number of packets currently in the queue */ + TUint iPacketAmount; + + /** The capacity of the queue */ + TUint iSize; + + /** + * Time stamp (as microseconds since midnight, January 1st, 0 AD nominal + * Gregorian) when the queue became empty. + * Valid only if the queue is empty + */ + TInt64 iBecameEmptyAt; +}; + +#ifdef __KERNEL_MODE__ + +#include "wllddcircularbuffer.inl" + +#endif + +#endif /* R_WLANCIRCULARBUFFER_H */ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddcircularbuffer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddcircularbuffer.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of RWlanCircularBuffer inline methods. +* +*/ + +/* +* %version: 2 % +*/ + +#include // for Kern::SystemTime() + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void RWlanCircularBuffer::DoInit() + { + iSize = size; + iPacketAmount = 0; + iGetIndex = 0; + iPutIndex = 0; + iBecameEmptyAt = 0; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline void RWlanCircularBuffer::Release() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TBool RWlanCircularBuffer::IsEmpty() const + { + return iPacketAmount == 0 ? ETrue : EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TBool RWlanCircularBuffer::IsFull() const + { + return iPacketAmount == iSize ? ETrue : EFalse; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TDataBuffer* RWlanCircularBuffer::GetPacket() + { + TDataBuffer* packet = NULL; + + if ( !IsEmpty() ) + { + packet = iBuffer[iGetIndex]; + + if ( ++iGetIndex == iSize ) + { + iGetIndex = 0; + } + + if ( --iPacketAmount == 0 ) + { + iBecameEmptyAt = Kern::SystemTime(); + } + } + + return packet; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TBool RWlanCircularBuffer::PutPacket( TDataBuffer* aPacket ) + { + TBool ret( EFalse ); + + if ( !IsFull() ) + { + iBuffer[iPutIndex] = aPacket; + + if ( ++iPutIndex == iSize ) + { + iPutIndex = 0; + } + + ++iPacketAmount; + ret = ETrue; + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TDataBuffer* RWlanCircularBuffer::PeekPacket() + { + TDataBuffer* packet = NULL; + + if ( !IsEmpty() ) + { + packet = iBuffer[iGetIndex]; + } + + return packet; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TUint RWlanCircularBuffer::GetLength() const + { + return iPacketAmount; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +template +inline TBool RWlanCircularBuffer::IsActive( TInt64 aTimeNow ) const + { + const TInt64 KActivityThreshold ( 25000 ); // microseconds + + if ( !IsEmpty() ) + { + return ETrue; + } + else + { + if ( aTimeNow - iBecameEmptyAt > KActivityThreshold ) + { + return EFalse; + } + else + { + return ETrue; + } + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wlldddmausablememory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wlldddmausablememory.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the WlanDmaUsableMemory class. +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef C_WLANDMAUSABLEMEMORY_H +#define C_WLANDMAUSABLEMEMORY_H + +class DPlatChunkHw; + +/** + * Encapsulates DMA usable memory + * + * @since S60 v3.1 + */ +class WlanDmaUsableMemory + { + +public: + + WlanDmaUsableMemory() : + iSizeInBytes( 0 ), iPhysicalRamAddr( 0 ), iFlags( 0 ), iChunk( NULL ) {}; + + /** + * Init method of the class + * + * @since S60 3.1 + * @param aSizeInBytes size of memory in bytes required + * @param aUseCachedMemory ETrue if cached memory shall be used + * EFalse otherwise + * @return if not 0 -> actual size of memory acquired + * (rounded to a multiple of page size). + * operation failure upon 0 + */ + TUint32 Init( TUint32 aSizeInBytes, TBool aUseCachedMemory ); + + /** + * Finit method of the class + * Can be called even when the init of the class failed + * + * @since S60 3.1 + */ + void Finit(); + + /** + * Get the linear address of the memory buffer + * + * @since S60 3.1 + * @param aSizeInBytes size of memory in bytes required + * @returns begin of the memory that can be used for DMA xfer + */ + TLinAddr Addr( TUint32 aSizeInBytes ); + + /** + * Get the linear address of the memory buffer + * + * @since S60 3.1 + * @returns begin of the memory that can be used for DMA xfer + */ + TLinAddr Addr(); + +protected: + +private: + + // Prohibit copy constructor. + WlanDmaUsableMemory ( const WlanDmaUsableMemory& ); + // Prohibit assigment operator. + WlanDmaUsableMemory& operator= ( const WlanDmaUsableMemory& ); + +private: // data + + static const TUint32 KResourceAcquired = (1 << 0); + + /** + * size of memory in bytes + */ + TInt iSizeInBytes; + + /** + * physical memory address + */ + TPhysAddr iPhysicalRamAddr; + + /** + * internal flags + */ + TUint32 iFlags; + + /** + * the actual chunk of memory + */ + DPlatChunkHw* iChunk; + + }; + + +#endif // C_WLANDMAUSABLEMEMORY_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddlogicalchannelbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddlogicalchannelbase.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the DWlanLogicalChannelBase class. +* +*/ + +/* +* %version: 2 % +*/ + +#ifndef D_WLANLOGICALCHANNELBASE_H +#define D_WLANLOGICALCHANNELBASE_H + +#include + +/** +* An abstract base class for a logical channel that provides a framework in +* which user-side client requests are executed in the context of a single +* kernel-side thread. +* +* @since S60 v5.1 +*/ +class DWlanLogicalChannelBase : public DLogicalChannel + { + +public: + + /** + * Base class constructor for DWlanLogicalChannelBase objects. + * @pre Calling thread must be in a critical section. + * @pre No fast mutex can be held. + * @pre Kernel must be unlocked + * @pre Interrupts enabled + * @pre Call in a thread context + */ + DWlanLogicalChannelBase(); + + /** + * Base class destructor for DWlanLogicalChannelBase objects. + * @pre Calling thread must be in a critical section. + * @pre No fast mutex can be held. + * @pre Kernel must be unlocked + * @pre Interrupts enabled + * @pre Call in a thread context + */ + virtual ~DWlanLogicalChannelBase(); + + /** + * Handles a client request in the client context. + * It overrides DLogicalChannel::Request() to handle Fast Control + * requests in the context of the client's thread and passes all other + * requests to the driver thread as kernel side messages. + * @param aReqNo The number of the client request + * @param a1 Arbitrary argument + * @param a2 Arbitrary argument + * @return Return value from the device driver call + * @pre Called in context of client thread. + * @pre Calling thread must not be in a critical section. + * @pre No fast mutex can be held. + */ + virtual TInt Request( TInt aReqNo, TAny* a1, TAny* a2 ); + + /** + * Process a function for this logical channel. + * This function is executed in the context of client's thread in + * supervisor mode. All code executed in this mode MUST not + * take a lot of time and MUST NOT access the WHA layer. + * @param aFunction Defines the operation/function to be performed. + * @param param Function specific parameter + * @return function specific return value. + */ + virtual TAny* DoControlFast( TInt aFunction, TAny* param ) = 0; + +private: // Methods + + // Prohibit copy constructor. + DWlanLogicalChannelBase ( const DWlanLogicalChannelBase& ); + // Prohibit assignment operator. + DWlanLogicalChannelBase& operator= ( const DWlanLogicalChannelBase& ); + +private: // definitions + + enum + { + /** + * The smallest Fast Control Function ID that DoControlFast() + * accepts. + */ + EMinControlFast = static_cast(0x0F000000), + + /** + * The largest Fast Control Function ID that DoControlFast() + * accepts. + */ + EMaxControlFast = static_cast(0x10000000) + }; + }; + +#endif // D_WLANLOGICALCHANNELBASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddoidmsgstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddoidmsgstorage.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains OID msg storage definition +* +*/ + +/* +* %version: 17 % +*/ + +#ifndef WLANOIDMSGSTORAGE_H +#define WLANOIDMSGSTORAGE_H + +#include "umacoidmsg.h" + +union WalOidMessages + { + TConnectMsg iConnectMsg; + TStartIBSSMsg iStartIBSSMsg; + TScanMsg iScanMsg; + TStopScanMsg iStopscanMsg; + TDisconnectMsg iDisconnectMsg; + TSetPowerModeMsg iSetPowerModeMsg; + TSetRcpiTriggerLevelMsg iSetRcpiTriggerLevelMsg; + TSetTxPowerLevelMsg iSetTxPowerLevelMsg; + TConfigureMsg iConfigureMsg; + TGetLastRcpiMsg iGetLastRcpiMsg; + TDisableUserDataMsg iDisableUserDataMsg; + TEnableUserDataMsg iEnableUserDataMsg; + TAddCipherKeyMsg iAddCipherKeyMsg; + TAddMulticastAddrMsg iAddMulticastAddrMsg; + TRemoveMulticastAddrMsg iRemoveMulticastAddrMsg; + TConfigureBssLostMsg iConfigureBssLostMsg; + TSetTxRateAdaptationParamsMsg iSetTxRateAdaptationParamsMsg; + TConfigureTxRatePoliciesMsg iConfigureTxRatePoliciesMsg; + TSetPowerModeMgmtParamsMsg iSetPowerModeMgmtParamsMsg; + TConfigurePwrModeMgmtTrafficOverrideMsg iConfigurePwrModeMgmtTrafficOverrideMsg; + TGetFrameStatisticsMsg iGetFrameStatisticsMsg; + TConfigureUapsdMsg iConfigureUapsdMsg; + TConfigureTxQueueMsg iConfigureTxQueueMsg; + TGetMacAddressMsg iGetMacAddressMsg; + TConfigureArpIpAddressFilteringMsg iConfigureArpIpAddressFilteringMsg; + TConfigureHtBlockAckMsg iConfigureHtBlockAckMsg; + TConfigureProprietarySnapHdrMsg iConfigureProprietarySnapHdrMsg; + }; + +struct SOidMsgStorage + { + WalOidMessages iOidMsgs; + }; + +#endif // WLANOIDMSGSTORAGE_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddpowerhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddpowerhandler.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the DWlanPowerHandler class. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef D_WLANPOWERHANDLER_H +#define D_WLANPOWERHANDLER_H + +#include + +class MWlanPowerIndicator; + +/** +* Power handler which listens to Power Manager instructions +* +* @since S60 v3.1 +*/ +class DWlanPowerHandler : public DPowerHandler + { + +public: + + /** + * Constructor. + * + * @since S60 3.1 + * @param aWlanLdd The indicator interface class + */ + explicit DWlanPowerHandler( + MWlanPowerIndicator& aWlanLdd, + TDynamicDfcQue& aDfcQ ); + + /** + * Destructor. + * + * @since S60 3.1 + */ + virtual ~DWlanPowerHandler(); + + /** + * Power Down DFC function + */ + static void PowerDownDfcFn( TAny *aPtr ); + + /** + * Power Up DFC function + */ + static void PowerUpDfcFn( TAny *aPtr ); + + /** + * Called by power manager. Requests peripheral power down. + * + * @since S60 3.1 + */ + virtual void PowerDown( TPowerState ); + + /** + * Called by power manager. Notifies of system power up. + * + * @since S60 3.1 + */ + virtual void PowerUp(); + + /** + * Called when the device has been powered down. Informs the power + * manager about that. + * + * @since S60 3.1 + */ + virtual void OnPowerDownDone(); + + /** + * Called when power up handling for the device has been done. + * Informs the power manager about that. + * + * @since S60 3.1 + */ + virtual void OnPowerUpDone(); + +private: + + /** Default C++ Ctor */ + DWlanPowerHandler(); + + /** + * Called by the Power Down DFC function. Triggers the actual + * power down handling + * + * @since S60 3.1 + */ + void PowerDownOperation(); + + /** + * Called by the Power Up DFC function. Triggers the actual + * power down handling + * + * @since S60 3.1 + */ + void PowerUpOperation(); + + // Prohibit copy constructor + DWlanPowerHandler( const DWlanPowerHandler& ); + // Prohibit assigment operator + DWlanPowerHandler& operator= ( const DWlanPowerHandler& ); + +private: // Data + + /** Pointer to the indicator interface class. Not own */ + MWlanPowerIndicator* iWlanLdd; + /** Power Up DFC object */ + TDfc iPowerUpDfc; + /** Power Down DFC object */ + TDfc iPowerDownDfc; + }; + +#endif // D_WLANPOWERHANDLER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddpowerindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/wllddpowerindicator.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the MWlanPowerIndicator class. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef M_WLANPOWERINDICATOR_H +#define M_WLANPOWERINDICATOR_H + +/** +* Interface class for DWlanPowerHandler for indicating power events to wlanldd. +* +* @since S60 v3.1 +*/ +class MWlanPowerIndicator + { + +public: + + /** + * Indicates that power up notification has been received from kernel + * side Power Manager. + * + * @since S60 3.1 + */ + virtual void OnPowerUp() = 0; + + /** + * Indicates that power down request has been received from kernel + * side Power Manager. + * + * @since S60 3.1 + */ + virtual void OnPowerDown() = 0; + }; + +#endif // M_WLANPOWERINDICATOR_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/rom/wlanldd.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/rom/wlanldd.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for WLAN LDD +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANLDD_IBY +#define WLANLDD_IBY +#include + +#ifdef __PROTOCOL_WLAN + +device[VARID]=ABI_DIR\BUILD_DIR\wlanldd.ldd SHARED_LIB_DIR\wlanldd.ldd + +#endif // __PROTOCOL_WLAN +#endif // WLANLDD_IBY + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/DataFrameMemMngr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/DataFrameMemMngr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,457 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the DataFrameMemMngr class. +* +*/ + +/* +* %version: 17 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "DataFrameMemMngr.h" +#include "osachunk.h" +#include +#include + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DataFrameMemMngr::DoOpenHandle( + DThread& aThread, + TSharedChunkInfo& aSharedChunkInfo, + DChunk* aSharedMemoryChunk ) + { + TInt ret ( KErrGeneral ); + + if ( aSharedMemoryChunk ) + { + + // Need to be in critical section while creating handles + NKern::ThreadEnterCS(); + + // Make handle to shared memory chunk for client thread + TInt r = Kern::MakeHandleAndOpen( &aThread, aSharedMemoryChunk ); + + // Leave critical section + NKern::ThreadLeaveCS(); + + // r: positive value is a handle, negative value is an error code + if( r >= 0 ) + { + // mapping success + + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: Handle create & open ok: handle: %d"), + r ) ); + + // store the handle & chunk size + aSharedChunkInfo.iChunkHandle = r; + aSharedChunkInfo.iSize = aSharedMemoryChunk->Size(); + + // store the kernel addresses + + TLinAddr start_of_mem_linear( 0 ); + aSharedMemoryChunk->Address( 0, aSharedChunkInfo.iSize, start_of_mem_linear ); + + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: chunk kernel mode start addr: 0x%08x"), + start_of_mem_linear ) ); + + TUint8* start_of_mem = reinterpret_cast(start_of_mem_linear ); + + const TUint KRxDataChunkSize( + aSharedChunkInfo.iSize + - ( sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize + + sizeof( RFrameXferBlock ) + + sizeof( RFrameXferBlockProtocolStack ) ) ); + + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: KRxDataChunkSize: %d"), + KRxDataChunkSize ) ); + + iRxDataChunk = start_of_mem; + + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: iRxDataChunk start addr: 0x%08x"), + reinterpret_cast(iRxDataChunk) ) ); + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: iRxDataChunk end addr: 0x%08x"), + reinterpret_cast(iRxDataChunk + KRxDataChunkSize) ) ); + + iTxDataChunk = + start_of_mem + + KRxDataChunkSize + + sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength; + + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: iTxDataChunk start addr: 0x%08x"), + reinterpret_cast(iTxDataChunk) ) ); + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: iTxDataChunk end addr: 0x%08x"), + reinterpret_cast( + iTxDataChunk + KProtocolStackSideTxDataChunkSize) ) ); + + // create the Tx frame memory pool manager to manage the Tx Data + // chunk + iTxFrameMemoryPool = new WlanChunk( + iTxDataChunk, + iTxDataChunk + KProtocolStackSideTxDataChunkSize, + iTxFrameBufAllocationUnit ); + + if ( iTxFrameMemoryPool && iTxFrameMemoryPool->IsValid() ) + { + TraceDump(MEMORY, (("WLANLDD: new WlanChunk: 0x%08x"), + reinterpret_cast(iTxFrameMemoryPool))); + + iFrameXferBlock = reinterpret_cast( + start_of_mem + + KRxDataChunkSize + + sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize + + sizeof( RFrameXferBlock ) ); + + iFrameXferBlockProtoStack = + static_cast(iFrameXferBlock); + + TraceDump( INIT_LEVEL, + (("WLANLDD: DataFrameMemMngr::DoOpenHandle: Nif RFrameXferBlock addr: 0x%08x"), + reinterpret_cast(iFrameXferBlockProtoStack) ) ); + + // initiliase xfer block + iFrameXferBlockProtoStack->Initialise(); + + iRxBufAlignmentPadding = iParent.RxBufAlignmentPadding(); + + ret = KErrNone; + } + else + { + // create failed + delete iTxFrameMemoryPool; + iTxFrameMemoryPool = NULL; + // error is returned + } + } + else + { + // handle creation & open failed. Error is returned + + TraceDump( INIT_LEVEL | ERROR_LEVEL, + (("WLANLDD: DataFrameMemMngr::OnInitialiseMemory: Handle create & open error: %d"), + r ) ); + } + } + else + { + // at this point the shared memory chunk should always exist. However, + // as it doesn't exist in this case, we return an error + + TraceDump( INIT_LEVEL | ERROR_LEVEL, + ("WLANLDD: DataFrameMemMngr::OnInitialiseMemory: Error aSharedMemoryChunk is NULL") ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DataFrameMemMngr::DoFreeRxBuffers() + { + for ( TUint i = 0; i < iCountCompleted; ++i ) + { + TDataBuffer* metaHdr ( reinterpret_cast( + iRxDataChunk + iCompletedBuffers[i]) ); + + // first free the actual Rx frame buffer if relevant + if ( metaHdr->KeFlags() & TDataBuffer::KDontReleaseBuffer ) + { + // this buffer shall not be freed yet, so no action here + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoFreeRxBuffers: don't free yet Rx buf at addr: 0x%08x"), + reinterpret_cast(metaHdr->KeGetBufferStart()) ) ); + } + else + { + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoFreeRxBuffers: free Rx buf at addr: 0x%08x"), + reinterpret_cast(metaHdr->KeGetBufferStart()) ) ); + + iRxFrameMemoryPool->Free( + metaHdr->KeGetBufferStart() + // take into account the alignment padding + - iRxBufAlignmentPadding ); + } + + // free the Rx frame meta header + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoFreeRxBuffers: free Rx meta header at addr: 0x%08x"), + reinterpret_cast(metaHdr)) ); + + iRxFrameMemoryPool->Free( metaHdr ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DataFrameMemMngr::DoEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: aNumOfBuffers: %d"), + aNumOfBuffers) ); + + if ( aNumOfBuffers + iCountTobeCompleted > KMaxToBeCompletedRxBufs ) + { + // too little space reserved for Rx buffer handles + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + TBool ret( EFalse ); + + if ( iReadStatus == EPending ) + { + // read pending + if ( !iCountTobeCompleted ) + { + // no existing Rx buffers to complete in queue + // we may complete these ones on the fly + + // note the completed Rx buffers first so that we can change + // their addresses to offsets + assign( + reinterpret_cast(&aBufferStart), + iCompletedBuffers, + aNumOfBuffers ); + + // update the new Rx buffer start addresses added above to be + // offsets from the Rx memory pool beginning + for( TUint i = 0; i < aNumOfBuffers; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: supplied Rx buf addr: 0x%08x"), + iCompletedBuffers[i]) ); + + iCompletedBuffers[i] + -= reinterpret_cast(iRxDataChunk); + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: Rx buf offset addr: 0x%08x"), + iCompletedBuffers[i]) ); + } + + iCountCompleted = aNumOfBuffers; + + iFrameXferBlock->KeRxComplete( iCompletedBuffers, iCountCompleted); + } + else + { + // existing rx buffers to complete in queue. + // We must append these at the rear and after that + // complete the existing read request + assign( + reinterpret_cast(&aBufferStart), + iTobeCompletedBuffers + iCountTobeCompleted, + aNumOfBuffers ); + + // update the new Rx buffer start addresses added above to be + // offsets from the Rx memory pool beginning + for( TUint i = 0; i < aNumOfBuffers; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: supplied Rx buf addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + + iTobeCompletedBuffers[iCountTobeCompleted + i] + -= reinterpret_cast(iRxDataChunk); + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: Rx buf offset addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + } + + iCountCompleted = iCountTobeCompleted + aNumOfBuffers; + + iFrameXferBlock->KeRxComplete( + iTobeCompletedBuffers, + iCountCompleted ); + + // note the completed Rx buffers + assign( iTobeCompletedBuffers, iCompletedBuffers, iCountCompleted ); + iCountTobeCompleted = 0; + } + + ret = ETrue; + } + else + { + // no read pending + // append at the rear + assign( + reinterpret_cast(&aBufferStart), + iTobeCompletedBuffers + iCountTobeCompleted, + aNumOfBuffers ); + + // update the new Rx buffer start addresses added above to be + // offsets from the Rx memory pool beginning + for( TUint i = 0; i < aNumOfBuffers; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: supplied Rx buf addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + + iTobeCompletedBuffers[iCountTobeCompleted + i] + -= reinterpret_cast(iRxDataChunk); + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: Rx buf offset addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + } + + iCountTobeCompleted += aNumOfBuffers; + } + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: end: iCountCompleted: %d"), + iCountCompleted) ); + + TraceDump( RX_FRAME, + (("WLANLDD: DataFrameMemMngr::DoEthernetFrameRxComplete: end: iCountTobeCompleted: %d"), + iCountTobeCompleted) ); + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32* DataFrameMemMngr::DoGetTobeCompletedBuffersStart() + { + return iTobeCompletedBuffers; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32* DataFrameMemMngr::DoGetCompletedBuffersStart() + { + return iCompletedBuffers; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* DataFrameMemMngr::AllocTxBuffer( TUint aLength ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: DataFrameMemMngr::AllocTxBuffer: aLength: %d"), + aLength) ); + + TDataBuffer* metaHdr ( NULL ); + + if ( aLength > KMaxEthernetFrameLength ) + { +#ifndef NDEBUG + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: DataFrameMemMngr::AllocTxBuffer: WARNING: max size exceeded; req. denied") ); + os_assert( + (TUint8*)("WLANLDD: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); +#endif + + return metaHdr; + } + + const TUint bufLen ( Align4( + iVendorTxHdrLen + + KHtQoSMacHeaderLength + + KMaxDot11SecurityEncapsulationLength + + sizeof( SSnapHeader ) + + aLength + + KSpaceForAlignment + + iVendorTxTrailerLen ) ); + + TUint8* buf = reinterpret_cast( + iTxFrameMemoryPool->Alloc( bufLen, EFalse )); + + if ( buf ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: DataFrameMemMngr::AllocTxBuffer: tx buf kern addr: 0x%08x"), + reinterpret_cast(buf) ) ); + + metaHdr = iFrameXferBlockProtoStack->AllocTxBuffer( + buf, + static_cast(aLength) ); + + if ( !metaHdr ) + { + iTxFrameMemoryPool->Free( buf ); + } + } + + return metaHdr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DataFrameMemMngr::FreeTxPacket( TDataBuffer*& aPacket ) + { + if ( IsMemInUse() ) + { + // free the actual Tx buffer + iTxFrameMemoryPool->Free( aPacket->KeGetBufferStart() ); + // free the meta header + iFrameXferBlockProtoStack->FreeTxPacket( aPacket ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DataFrameMemMngr::OnReleaseMemory() + { + TraceDump(INIT_LEVEL, ("WLANLDD: DataFrameMemMngr::OnReleaseMemory")); + + if ( iTxFrameMemoryPool ) + { + TraceDump(MEMORY, (("WLANLDD: delete WlanChunk: 0x%08x"), + reinterpret_cast(iTxFrameMemoryPool))); + + delete iTxFrameMemoryPool; + iTxFrameMemoryPool = NULL; + iTxDataChunk = NULL; + + MarkMemFree(); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/EthernetFrameMemMngr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/EthernetFrameMemMngr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,475 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the DEthernetFrameMemMngr class. +* +*/ + +/* +* %version: 23 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "DataFrameMemMngr.h" +#include "MgmtFrameMemMngr.h" +#include "osachunk.h" +#include +#include + +#include "EtherCardApi.h" + +extern void os_free( const TAny* ); + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DEthernetFrameMemMngr* DEthernetFrameMemMngr::Init( + TInt aUnit, + DWlanLogicalChannel& aParent, + WlanChunk*& aRxFrameMemoryPool, + TBool aUseCachedMemory, + TInt aFrameBufAllocationUnit ) + { + DEthernetFrameMemMngr* ret = NULL; + + if ( aUnit == KUnitEthernet ) + { + ret = new DataFrameMemMngr( + aParent, + aRxFrameMemoryPool, + aFrameBufAllocationUnit ); + } + else if ( aUnit == KUnitWlan ) + { + ret = new MgmtFrameMemMngr( + aParent, + aRxFrameMemoryPool, + aUseCachedMemory, + aFrameBufAllocationUnit ); + } + else + { + TraceDump(ERROR_LEVEL, + (("WLANLDD: DEthernetFrameMemMngr::Init: ERROR: unknown unit: %d"), + aUnit)); + // No action. NULL is returned + } + + if ( ret ) + { + TraceDump(MEMORY, (("WLANLDD: new FrameMemMngr: 0x%08x"), + reinterpret_cast(ret))); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DEthernetFrameMemMngr::OnInitialiseMemory( + DThread& aThread, + TSharedChunkInfo* aSharedChunkInfo, + TUint aVendorTxHdrLen, + TUint aVendorTxTrailerLen ) + { + TraceDump( INIT_LEVEL, + (("WLANLDD: DEthernetFrameMemMngr::OnInitialiseMemory: aVendorTxHdrLen: %d"), + aVendorTxHdrLen ) ); + TraceDump( INIT_LEVEL, + (("WLANLDD: aVendorTxTrailerLen: %d"), + aVendorTxTrailerLen ) ); + + TInt ret( KErrGeneral ); + + iVendorTxHdrLen = aVendorTxHdrLen; + iVendorTxTrailerLen = aVendorTxTrailerLen; + + // Local info structure we will fill in + TSharedChunkInfo info; + + if( !IsMemInUse() ) + { + ret = DoAllocate( iParent.SharedMemoryChunk() ); + + if ( ret == KErrNone ) + { + ret = DoOpenHandle( aThread, info, iParent.SharedMemoryChunk() ); + + if ( ret == KErrNone ) + { + MarkMemInUSe(); // mark as in use + ret = KErrNone; + } + else + { + // handle creation & open failed + + TraceDump( INIT_LEVEL, + (("WLANLDD: DEthernetFrameMemMngr::OnInitialiseMemory: Handle create & open error: status: %d"), + ret ) ); + + // zero contents of info structure. + // (Zero is usually a safe value to return on error for most data types, + // and for object handles this is same as KNullHandle) + memclr( &info, sizeof( info ) ); + + // need to enter critical section for chunk closing + NKern::ThreadEnterCS(); + + // schedule the shared memory chunk for destruction + Kern::ChunkClose( iParent.SharedMemoryChunk() ); + + // leave critical section + NKern::ThreadLeaveCS(); + } + + // write handle info to client memory + ret = Kern::ThreadRawWrite( + &aThread, + aSharedChunkInfo, + &info, + sizeof( info ) ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { + // allocation failed; error code will be returned + } + } + else + { + ret = KErrAlreadyExists; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DEthernetFrameMemMngr::~DEthernetFrameMemMngr() + { + OnReleaseMemory(); + + iFrameXferBlock = NULL; + iTxDataBuffer = NULL; + iRxDataChunk = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DEthernetFrameMemMngr::OnReleaseMemory() + { + MarkMemFree(); // mark as free + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* DEthernetFrameMemMngr::OnWriteEthernetFrame() const + { + if ( iTxDataBuffer->GetLength() >= sizeof( SEthernetHeader ) ) + { + return iTxDataBuffer; + } + else + { + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return NULL; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DEthernetFrameMemMngr::OnReadRequest() + { + TBool ret( EFalse ); + + if ( IsMemInUse() ) + { + if ( iCountCompleted ) + { + // free relevant buffers + DoFreeRxBuffers(); + iCountCompleted = 0; // no buffers anymore in process in user mode + + // make sure that the same buffers are not tried to be + // freed again thru the incremental freeing method + iFrameXferBlock->KeAllUserSideRxBuffersFreed(); + } + + if ( iCountTobeCompleted ) + { + // there are Rx buffers to be completed + + iFrameXferBlock->KeRxComplete( DoGetTobeCompletedBuffersStart(), + iCountTobeCompleted ); + // mark the completed buffers + assign( DoGetTobeCompletedBuffersStart(), + DoGetCompletedBuffersStart(), + iCountTobeCompleted ); + iCountCompleted = iCountTobeCompleted; + iCountTobeCompleted = 0; + + ret = ETrue; + // the frame Rx request won't be pending as the callee shall + // complete it + iReadStatus = ENotPending; + } + else + { + // there are no Rx buffers to be completed. The Rx request is + // left pending + iReadStatus = EPending; + } + } + else + { + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DEthernetFrameMemMngr::DoMarkRxBufFree( TUint8* /*aBufferToFree*/ ) + { + // not supported in default handler + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DEthernetFrameMemMngr::SetTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ) + { + if ( IsMemInUse() ) + { + iFrameXferBlock->KeSetTxOffsets( + aEthernetFrameTxOffset, + aDot11FrameTxOffset, + aSnapFrameTxOffset ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* DEthernetFrameMemMngr::OnGetEthernetFrameRxBuffer( + TUint aLengthinBytes ) + { + TUint8* buffer ( NULL ); + + if ( IsMemInUse() ) + { + buffer = DoGetNextFreeRxBuffer( aLengthinBytes ); + } + else + { + // we are trying to acquire an Rx buffer but our user mode client + // has not asked for the memorybuffer pool to be initialized. In this + // case NULL is returned, as no buffers are available + TraceDump(RX_FRAME, + ("WLANLDD: DEthernetFrameMemMngr::OnGetEthernetFrameRxBuffer: not initialized => failed")); + } + + return buffer; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* DEthernetFrameMemMngr::GetRxFrameMetaHeader() + { + TDataBuffer* buffer ( NULL ); + + if ( IsMemInUse() ) + { + buffer = reinterpret_cast( + iRxFrameMemoryPool->Alloc( sizeof( TDataBuffer ), ETrue ) ); + + TraceDump(RX_FRAME, + (("WLANLDD: DEthernetFrameMemMngr::GetRxFrameMetaHeader: addr: 0x%08x"), + reinterpret_cast(buffer)) ); + } + else + { + // we are trying to acquire memory for Rx frame meta header but our + // user mode client has not asked for the memorybuffer pool to be + // initialized. In this case NULL is returned, as no memory is + // available + TraceDump(RX_FRAME, + ("WLANLDD: DEthernetFrameMemMngr::GetRxFrameMetaHeader: not initialized => failed")); + } + + return buffer; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DEthernetFrameMemMngr::FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ) + { + if ( IsMemInUse() ) + { + iRxFrameMemoryPool->Free( aMetaHeader ); + } + else + { + // the whole Rx memory pool - including aMetaHeader - has already + // been deallocated, so nothing is done in this case + TraceDump( RX_FRAME, + ("WLANLDD: MgmtFrameMemMngr::FreeRxFrameMetaHeader: Rx memory pool already deallocated; no action needed") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DEthernetFrameMemMngr::OnEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + TBool ret( EFalse ); + + if ( IsMemInUse() && + DoEthernetFrameRxComplete( aBufferStart, aNumOfBuffers ) ) + { + iReadStatus = ENotPending; + ret = ETrue; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// this default implementation always returns KErrNone +// --------------------------------------------------------------------------- +// +TInt DEthernetFrameMemMngr::DoAllocate( DChunk*& /*aSharedMemoryChunk*/ ) + { + TraceDump( INIT_LEVEL, + ("WLANLDD: DEthernetFrameMemMngr::DoAllocate") ); + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// this default implementation always returns NULL +// --------------------------------------------------------------------------- +// +TUint8* DEthernetFrameMemMngr::DoGetNextFreeRxBuffer( + TUint /*aLengthinBytes*/ ) + { + TraceDump( RX_FRAME, + ("WLANLDD: DEthernetFrameMemMngr::DoGetNextFreeRxBuffer") ); + + return NULL; + } + +// --------------------------------------------------------------------------- +// This default implementation always returns NULL +// --------------------------------------------------------------------------- +// +TDataBuffer* DEthernetFrameMemMngr::AllocTxBuffer( TUint aLength ) + { + return NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DEthernetFrameMemMngr::AddTxFrame( + TDataBuffer* aPacketInUserSpace, + TDataBuffer*& aPacketInKernSpace, + TBool aUserDataTxEnabled ) + { + return (static_cast( + iFrameXferBlock))->AddTxFrame( + aPacketInUserSpace, + aPacketInKernSpace, + aUserDataTxEnabled ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* DEthernetFrameMemMngr::GetTxFrame( + const TWhaTxQueueState& aTxQueueState, + TBool& aMore ) + { + if ( IsMemInUse() ) + { + return (static_cast( + iFrameXferBlock))->GetTxFrame( aTxQueueState, aMore ); + } + else + return NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DEthernetFrameMemMngr::FreeTxPacket( TDataBuffer*& /*aPacket*/ ) + { + // not suported in this default implementation + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DEthernetFrameMemMngr::ResumeClientTx( TBool aUserDataTxEnabled ) const + { + return (static_cast( + iFrameXferBlock))->ResumeClientTx( aUserDataTxEnabled ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DEthernetFrameMemMngr::AllTxQueuesEmpty() const + { + return (static_cast( + iFrameXferBlock))->AllTxQueuesEmpty(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/FrameXferBlock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/FrameXferBlock.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,589 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the RFrameXferBlock class. +* +*/ + +/* +* %version: 16 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "FrameXferBlock.h" +#include "wlanlddcommon.h" +#include "algorithm.h" +#include // for Kern::SystemTime() + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RFrameXferBlockBase::KeInitialize() + { + iRxDataChunk = NULL; + + for ( TUint32 i = 0; i < KMaxCompletedRxBufs; ++i ) + { + iRxCompletedBuffers[i] = 0; + } + + for ( TUint j = 0; j < TDataBuffer::KFrameTypeMax; ++j ) + { + iTxOffset[j] = 0; + } + + iNumOfCompleted = 0; + iCurrentRxBuffer = 0; + iFirstRxBufferToFree = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RFrameXferBlockBase::KeRxComplete( + const TUint32* aRxCompletionBuffersArray, + TUint32 aNumOfCompleted ) + { + if ( aNumOfCompleted > KMaxCompletedRxBufs ) + { + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + assign( aRxCompletionBuffersArray, iRxCompletedBuffers, aNumOfCompleted ); + iNumOfCompleted = aNumOfCompleted; + iCurrentRxBuffer = 0; + iFirstRxBufferToFree = 0; + + for ( TUint i = 0; i < iNumOfCompleted; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: RFrameXferBlockBase::KeRxComplete: completed offset addr: 0x%08x"), + iRxCompletedBuffers[i]) ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RFrameXferBlockBase::KeGetHandledRxBuffers( + const TUint32*& aRxHandledBuffersArray, + TUint32& aNumOfHandled ) + { + TUint32 numHandled ( iCurrentRxBuffer - iFirstRxBufferToFree ); + + // make sure that if an Rx buffer is currently being processed by the user + // side client, that buffer is not regarded as being already handled + numHandled = numHandled ? numHandled - 1 : numHandled; + + if ( numHandled ) + { + aRxHandledBuffersArray = &(iRxCompletedBuffers[iFirstRxBufferToFree]); + aNumOfHandled = numHandled; + + iFirstRxBufferToFree += numHandled; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RFrameXferBlockBase::KeAllUserSideRxBuffersFreed() + { + iFirstRxBufferToFree = 0; + // need to reset also the current index, so that the difference of these + // two indexes is zero, and it then correctly indicates, that there are no + // Rx buffers which could be freed incrementally + iCurrentRxBuffer = 0; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void RFrameXferBlockBase::KeSetTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ) + { + iTxOffset[TDataBuffer::KEthernetFrame] = aEthernetFrameTxOffset; + iTxOffset[TDataBuffer::KDot11Frame] = aDot11FrameTxOffset; + iTxOffset[TDataBuffer::KSnapFrame] = aSnapFrameTxOffset; + iTxOffset[TDataBuffer::KEthernetTestFrame] = aEthernetFrameTxOffset; + + for ( TUint i = 0; i < TDataBuffer::KFrameTypeMax ; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: RFrameXferBlockBase::KeSetTxOffsets: offset: %d"), + iTxOffset[i]) ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void RFrameXferBlockProtocolStack::Initialise() + { + // perform base class initialization + KeInitialize(); + + iThisAddrKernelSpace = reinterpret_cast(this); + + iVoiceTxQueue.DoInit(); + iVideoTxQueue.DoInit(); + iBestEffortTxQueue.DoInit(); + iBackgroundTxQueue.DoInit(); + iFreeQueue.DoInit(); + + for ( TUint i = 0; i < KTxPoolSizeInPackets; i++ ) + { + // Set the default values + + iDataBuffers[i].FrameType( TDataBuffer::KEthernetFrame ); + iDataBuffers[i].KeClearFlags( TDataBuffer::KTxFrameMustNotBeEncrypted ); + iDataBuffers[i].SetLength( 0 ); + iDataBuffers[i].SetUserPriority( 0 ); + + iFreeQueue.PutPacket( &iDataBuffers[i] ); + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TDataBuffer* RFrameXferBlockProtocolStack::AllocTxBuffer( + const TUint8* aTxBuf, + TUint16 aBufLength ) + { + TDataBuffer* packet( NULL ); + + if ( aTxBuf ) + { + // Get Packet from Free Queue + packet = iFreeQueue.GetPacket(); + + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: RFrameXferBlockProtocolStack::AllocTxBuffer: krn metahdr addr: 0x%08x"), + packet) ); + + if ( packet ) + { + packet->KeSetBufferOffset( + aTxBuf - reinterpret_cast(packet) ); + + packet->SetBufLength( aBufLength ); + + // reserve appropriate amount of empty space before the Ethernet + // frame so that there is space for all the necessary headers, including + // the 802.11 MAC header + packet->KeSetOffsetToFrameBeginning( + iTxOffset[TDataBuffer::KEthernetFrame] ); + + // return the user space address + packet = reinterpret_cast( + reinterpret_cast(packet) - iUserToKernAddrOffset); + } + } + + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: RFrameXferBlockProtocolStack::AllocTxBuffer: user metahdr addr: 0x%08x"), + packet) ); + + return packet; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool RFrameXferBlockProtocolStack::AddTxFrame( + TDataBuffer* aPacketInUserSpace, + TDataBuffer*& aPacketInKernSpace, + TBool aUserDataTxEnabled ) + { + TBool ret( ETrue ); + aPacketInKernSpace = NULL; + TDataBuffer* metaHdrInKernSpace ( reinterpret_cast( + reinterpret_cast(aPacketInUserSpace) + iUserToKernAddrOffset) ); + + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: RFrameXferBlockProtocolStack::AddTxFrame: user metahdr addr: 0x%08x"), + aPacketInUserSpace)); + + // put the packet to the correct Tx queue according to the priority to AC + // mapping defined in WiFi WMM Specification v1.1 + + if ( aPacketInUserSpace->UserPriority() == 7 || + aPacketInUserSpace->UserPriority() == 6 ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: add to VO queue; krn metahdr addr: 0x%08x"), + reinterpret_cast(metaHdrInKernSpace))); + + ret = iVoiceTxQueue.PutPacket( metaHdrInKernSpace ); + + if ( !ret ) + { + aPacketInKernSpace = metaHdrInKernSpace; + } + + ret = TxFlowControl( EVoice, aUserDataTxEnabled ); + } + else if ( aPacketInUserSpace->UserPriority() == 5 || + aPacketInUserSpace->UserPriority() == 4 ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: add to VI queue; krn metahdr addr: 0x%08x"), + reinterpret_cast(metaHdrInKernSpace))); + + ret = iVideoTxQueue.PutPacket( metaHdrInKernSpace ); + + if ( !ret ) + { + aPacketInKernSpace = metaHdrInKernSpace; + } + + ret = TxFlowControl( EVideo, aUserDataTxEnabled ); + } + else if ( aPacketInUserSpace->UserPriority() == 2 || + aPacketInUserSpace->UserPriority() == 1 ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: add to BG queue; krn metahdr addr: 0x%08x"), + reinterpret_cast(metaHdrInKernSpace))); + + ret = iBackgroundTxQueue.PutPacket( metaHdrInKernSpace ); + + if ( !ret ) + { + aPacketInKernSpace = metaHdrInKernSpace; + } + + ret = TxFlowControl( EBackGround, aUserDataTxEnabled ); + } + else + { + // user priority is 3 or 0 or invalid + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: add to BE queue; krn metahdr addr: 0x%08x"), + reinterpret_cast(metaHdrInKernSpace))); + + ret = iBestEffortTxQueue.PutPacket( metaHdrInKernSpace ); + + if ( !ret ) + { + aPacketInKernSpace = metaHdrInKernSpace; + } + + ret = TxFlowControl( ELegacy, aUserDataTxEnabled ); + } + + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: VO: %d packets"), + iVoiceTxQueue.GetLength())); + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: VI: %d packets"), + iVideoTxQueue.GetLength())); + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: BE: %d packets"), + iBestEffortTxQueue.GetLength())); + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: BG: %d packets"), + iBackgroundTxQueue.GetLength())); + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TDataBuffer* RFrameXferBlockProtocolStack::GetTxFrame( + const TWhaTxQueueState& aWhaTxQueueState, + TBool& aMore ) + { + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: RFrameXferBlockProtocolStack::GetTxFrame")); + TraceDump( NWSA_TX_DETAILS, (("WLANLDD: VO: %d packets"), + iVoiceTxQueue.GetLength())); + TraceDump( NWSA_TX_DETAILS, (("WLANLDD: VI: %d packets"), + iVideoTxQueue.GetLength())); + TraceDump( NWSA_TX_DETAILS, (("WLANLDD: BE: %d packets"), + iBestEffortTxQueue.GetLength())); + TraceDump( NWSA_TX_DETAILS, (("WLANLDD: BG: %d packets"), + iBackgroundTxQueue.GetLength())); + + TDataBuffer* packet = NULL; + TQueueId queueId ( EQueueIdMax ); + + if ( TxPossible( aWhaTxQueueState, queueId ) ) + { + switch ( queueId ) + { + case EVoice: + packet = iVoiceTxQueue.GetPacket(); + break; + case EVideo: + packet = iVideoTxQueue.GetPacket(); + break; + case ELegacy: + packet = iBestEffortTxQueue.GetPacket(); + break; + case EBackGround: + packet = iBackgroundTxQueue.GetPacket(); + break; +#ifndef NDEBUG + default: + TraceDump(ERROR_LEVEL, (("WLANLDD: queueId: %d"), queueId)); + os_assert( + (TUint8*)("WLANLDD: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); +#endif + } + + aMore = TxPossible( aWhaTxQueueState, queueId ); + } + else + { + aMore = EFalse; + } + + TraceDump( NWSA_TX_DETAILS, (("WLANLDD: krn meta hdr: 0x%08x"), + reinterpret_cast(packet))); + + return packet; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool RFrameXferBlockProtocolStack::ResumeClientTx( + TBool aUserDataTxEnabled ) const + { + TBool ret ( EFalse ); + + const TInt64 KTimeNow ( Kern::SystemTime() ); + + if ( aUserDataTxEnabled ) + { + // Note that in what follows below we want to consider resuming the + // client Tx flow only based on the highest priority queue which is + // currently active. In other words: if we find that some queue is + // currently active but we don't want to resume the Tx flow yet + // based on its situation, we must not consider resuming the Tx flow + // based on any other queue with lower priority. + + if ( iVoiceTxQueue.IsActive( KTimeNow ) ) + { + if ( iVoiceTxQueue.GetLength() < + ( KVoiceTxQueueLen / 2 ) ) + { + ret = ETrue; + } + } + else if ( iVideoTxQueue.IsActive( KTimeNow ) ) + { + if ( iVideoTxQueue.GetLength() < + ( KVideoTxQueueLen / 2 ) ) + { + ret = ETrue; + } + } + else if ( iBestEffortTxQueue.IsActive( KTimeNow ) ) + { + if ( iBestEffortTxQueue.GetLength() < + ( KBestEffortTxQueueLen / 2 ) ) + { + ret = ETrue; + } + } + else if ( iBackgroundTxQueue.IsActive( KTimeNow ) ) + { + if ( iBackgroundTxQueue.GetLength() < + ( KBackgroundTxQueueLen / 2 ) ) + { + ret = ETrue; + } + } + else + { + // none of the Tx queues is currently active (meaning also that + // they are all empty), but as this method was called, the + // client Tx flow has to be currently stopped. So now - at the + // latest - we need to resume the client Tx flow + ret = ETrue; + } + } + else + { + // as client Tx flow has been stopped and user data Tx is disabled + // (which probably means that we are roaming), its not feasible to + // resume the client Tx flow yet. So, no action needed; + // EFalse is returned + } + +#ifndef NDEBUG + if ( ret ) + { + TraceDump( NWSA_TX, + ("WLANLDD: RFrameXferBlockProtocolStack::ResumeClientTx: resume flow from protocol stack")); + } +#endif + + return ret; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool RFrameXferBlockProtocolStack::TxPossible( + const TWhaTxQueueState& aWhaTxQueueState, + TQueueId& aQueueId ) + { + TBool txPossible ( ETrue ); + + // In queue priority order, try to locate a Tx packet which is for a + // non-full WHA Tx queue + + if ( aWhaTxQueueState[EVoice] == ETxQueueNotFull && + !iVoiceTxQueue.IsEmpty() ) + { + aQueueId = EVoice; + + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from VO queue")); + } + else if ( aWhaTxQueueState[EVideo] == ETxQueueNotFull && + !iVideoTxQueue.IsEmpty() ) + { + aQueueId = EVideo; + + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from VI queue")); + } + else if ( aWhaTxQueueState[ELegacy] == ETxQueueNotFull && + !iBestEffortTxQueue.IsEmpty() ) + { + aQueueId = ELegacy; + + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from BE queue")); + } + else if ( aWhaTxQueueState[EBackGround] == ETxQueueNotFull && + !iBackgroundTxQueue.IsEmpty() ) + { + aQueueId = EBackGround; + + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from BG queue")); + } + else + { + txPossible = EFalse; + + TraceDump( NWSA_TX_DETAILS, + ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: no packet for a non-full wha queue")); + } + + return txPossible; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool RFrameXferBlockProtocolStack::TxFlowControl( + TQueueId aTxQueue, + TBool aUserDataTxEnabled ) + { + TInt status ( ETrue ); + + switch ( aTxQueue ) + { + case EVoice: + if ( iVoiceTxQueue.IsFull() ) + { + status = EFalse; + } + break; + case EVideo: + if ( iVideoTxQueue.IsFull() ) + { + if ( !aUserDataTxEnabled ) + { + status = EFalse; + } + else if ( !iVoiceTxQueue.IsActive( Kern::SystemTime() ) ) + { + status = EFalse; + } + } + break; + case ELegacy: + { + const TInt64 KTimeNow ( Kern::SystemTime() ); + + if ( iBestEffortTxQueue.IsFull() ) + { + if ( !aUserDataTxEnabled ) + { + status = EFalse; + } + else if ( !iVoiceTxQueue.IsActive( KTimeNow ) && + !iVideoTxQueue.IsActive( KTimeNow ) ) + { + status = EFalse; + } + } + break; + } + case EBackGround: + { + const TInt64 KTimeNow ( Kern::SystemTime() ); + + if ( iBackgroundTxQueue.IsFull() ) + { + if ( !aUserDataTxEnabled ) + { + status = EFalse; + } + else if ( !iVoiceTxQueue.IsActive( KTimeNow ) && + !iVideoTxQueue.IsActive( KTimeNow ) && + !iBestEffortTxQueue.IsActive( KTimeNow ) ) + { + status = EFalse; + } + } + break; + } +#ifndef NDEBUG + default: + TraceDump(ERROR_LEVEL, (("WLANLDD: aTxQueue: %d"), aTxQueue)); + os_assert( + (TUint8*)("WLANLDD: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); +#endif + } + + return status; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/MgmtFrameMemMngr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/MgmtFrameMemMngr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,622 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the MgmtFrameMemMngr class. +* +*/ + +/* +* %version: 19 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "MgmtFrameMemMngr.h" +#include "osachunk.h" +#include + +extern TAny* os_alloc( const TUint32 ); +extern void os_free( const TAny* ); + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt MgmtFrameMemMngr::DoAllocate( DChunk*& aSharedMemoryChunk ) + { + TraceDump( INIT_LEVEL, + ("WLANLDD: MgmtFrameMemMngr::DoAllocate:") ); + + // determine if cached memory shall be used + TUint cacheOption = iUseCachedMemory ? + EMapAttrCachedMax : + EMapAttrFullyBlocking; + + // Start creating the chunk + + TChunkCreateInfo info; + info.iType = TChunkCreateInfo::ESharedKernelMultiple; + info.iMaxSize = iChunkSize; + info.iMapAttr = EMapAttrReadUser | + EMapAttrWriteUser | + EMapAttrShared | + cacheOption; + info.iOwnsMemory = ETrue; + info.iDestroyedDfc = NULL; + + DChunk* chunk; + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoAllocate: create chunk of size: %d"), + iChunkSize) ); + + TUint32 chunkMapAttrNotNeeded ( 0 ); + + // Enter critical section so we can't die and leak the object we are + // creating, i.e. DChunk (shared memory chunk) + NKern::ThreadEnterCS(); + + TInt r = Kern::ChunkCreate( + info, + chunk, + iChunkKernelAddr, + chunkMapAttrNotNeeded ); + + if( r != KErrNone) + { + TraceDump( WARNING_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoAllocate: create chunk failed. Status: %d"), + r ) ); + + NKern::ThreadLeaveCS(); + return r; + } + + TraceDump(MEMORY, (("WLANLDD: new DChunk: 0x%08x"), + reinterpret_cast(chunk))); + + TraceDump(INIT_LEVEL, + (("MgmtFrameMemMngr::DoAllocate: Platform Hw Chunk create success with cacheOption: 0x%08x"), + cacheOption)); + + TUint32 physicalAddressNotNeeded ( 0 ); + + // Map our device's memory into the chunk (at offset 0) + r = Kern::ChunkCommitContiguous( chunk, 0, iChunkSize, physicalAddressNotNeeded ); + + if ( r != KErrNone) + { + TraceDump( WARNING_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoAllocate: chunk commit failed. Status: %d"), + r ) ); + + // Commit failed so tidy-up. + // Close chunk, which will then get deleted at some point + Kern::ChunkClose( chunk ); + } + else + { + TraceDump( INIT_LEVEL, + ("WLANLDD: MgmtFrameMemMngr::DoAllocate: chunk commit success") ); + + // Commit succeeded so pass back the chunk pointer + aSharedMemoryChunk = chunk; + } + + // Can leave critical section now that we have saved pointer to created object + NKern::ThreadLeaveCS(); + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoAllocate: chunk map attr: %d"), + chunkMapAttrNotNeeded ) ); + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoAllocate: iChunkKernelAddr: 0x%08x"), + static_cast(iChunkKernelAddr) ) ); + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoAllocate: chunk physical address: 0x%08x"), + physicalAddressNotNeeded ) ); + + return r; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt MgmtFrameMemMngr::DoOpenHandle( + DThread& aThread, + TSharedChunkInfo& aSharedChunkInfo, + DChunk* aSharedMemoryChunk ) + { + TInt ret ( KErrGeneral ); + + if ( aSharedMemoryChunk ) + { + + // Need to be in critical section while creating handles + NKern::ThreadEnterCS(); + + // Create handle to shared memory chunk for client thread + TInt r = Kern::MakeHandleAndOpen( &aThread, aSharedMemoryChunk ); + + // Leave critical section + NKern::ThreadLeaveCS(); + + // positive r value is a handle, negative value is an error code + if( r >= 0 ) + { + // mapping success + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::OnInitialiseMemory: Handle create & open ok: handle: %d"), + r ) ); + + // store the handle & the chunk size + aSharedChunkInfo.iChunkHandle = r; + aSharedChunkInfo.iSize = iChunkSize; + + // store the kernel addresses + + TUint8* start_of_mem = reinterpret_cast(iChunkKernelAddr ); + + const TUint KRxDataChunkSize( + iChunkSize + - ( sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize + + sizeof( RFrameXferBlock ) + + sizeof( RFrameXferBlockProtocolStack ) ) ); + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoOpenHandle: KRxDataChunkSize: %d"), + KRxDataChunkSize ) ); + + iRxDataChunk = start_of_mem; + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoOpenHandle: iRxDataChunk start addr: 0x%08x"), + reinterpret_cast(iRxDataChunk) ) ); + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoOpenHandle: iRxDataChunk end addr: 0x%08x"), + reinterpret_cast(iRxDataChunk + KRxDataChunkSize) ) ); + + // create the Rx frame memory pool manager + iRxFrameMemoryPool = new WlanChunk( + iRxDataChunk, + iRxDataChunk + KRxDataChunkSize, + iRxFrameBufAllocationUnit ); + + if ( iRxFrameMemoryPool && iRxFrameMemoryPool->IsValid() ) + { + ret = KErrNone; + + TraceDump(MEMORY, (("WLANLDD: new WlanChunk: 0x%08x"), + reinterpret_cast(iRxFrameMemoryPool))); + + iTxDataBuffer = reinterpret_cast( + start_of_mem + + KRxDataChunkSize ); + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoOpenHandle: Engine TxDataBuf start addr: 0x%08x"), + reinterpret_cast(iTxDataBuffer) ) ); + + // for the single Tx buffer the actual buffer memory immediately + // follows the Tx frame meta header + iTxDataBuffer->KeSetBufferOffset( sizeof( TDataBuffer ) ); + + iFrameXferBlock = reinterpret_cast( + start_of_mem + + KRxDataChunkSize + + sizeof( TDataBuffer ) + + KMgmtSideTxBufferLength + + KProtocolStackSideTxDataChunkSize ); + + TraceDump( INIT_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::DoOpenHandle: Engine RFrameXferBlock addr: 0x%08x"), + reinterpret_cast(iFrameXferBlock) ) ); + + // initiliase xfer block + iFrameXferBlock->Initialize( KMgmtSideTxBufferLength ); + + iRxBufAlignmentPadding = RxBufAlignmentPadding(); + + iParent.SetRxBufAlignmentPadding( iRxBufAlignmentPadding ); + } + else + { + // create failed + delete iRxFrameMemoryPool; + iRxFrameMemoryPool = NULL; + // error is returned + } + } + else + { + // handle creation & open failed. Error is returned + + TraceDump( INIT_LEVEL | ERROR_LEVEL, + (("WLANLDD: MgmtFrameMemMngr::OnInitialiseMemory: Handle create & open error: %d"), + r ) ); + } + } + else + { + // at this point the shared memory chunk should always exist. However, + // as it doesn't exist in this case, we return an error + + TraceDump( INIT_LEVEL | ERROR_LEVEL, + ("WLANLDD: MgmtFrameMemMngr::OnInitialiseMemory: Error aSharedMemoryChunk is NULL") ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* MgmtFrameMemMngr::DoGetNextFreeRxBuffer( TUint aLengthinBytes ) + { + TraceDump( RX_FRAME, + ("WLANLDD: MgmtFrameMemMngr::DoGetNextFreeRxBuffer") ); + + // if there are any Rx buffers which have been handled and + // can already be re-used, free them first + + const TUint32* rxHandledBuffersArray ( NULL ); + TUint32 numOfHandled ( 0 ); + + iFrameXferBlock->KeGetHandledRxBuffers( + rxHandledBuffersArray, + numOfHandled ); + + if ( numOfHandled ) + { + // there are buffers which can be freed, so free them + for ( TUint i = 0; i < numOfHandled; ++i ) + { + // first free the actual Rx frame buffer + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoGetNextFreeRxBuffer: free Rx buf at addr: 0x%08x"), + reinterpret_cast(reinterpret_cast( + iRxDataChunk + + rxHandledBuffersArray[i])->KeGetBufferStart()) ) ); + + iRxFrameMemoryPool->Free( + reinterpret_cast( + iRxDataChunk + rxHandledBuffersArray[i])->KeGetBufferStart() + // take into account the alignment padding + - iRxBufAlignmentPadding ); + + // then free the Rx frame meta header + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoGetNextFreeRxBuffer: free Rx meta header at addr: 0x%08x"), + reinterpret_cast( iRxDataChunk + rxHandledBuffersArray[i])) ); + + iRxFrameMemoryPool->Free( iRxDataChunk + rxHandledBuffersArray[i] ); + } + + // remove the buffers we freed above from the completed buffers of this + // object so that they are not tried to be freed again once the Mgmt + // Client issues the next Rx request + + iCountCompleted -= numOfHandled; + assign( + iCompletedBuffers + numOfHandled, + iCompletedBuffers, + iCountCompleted ); + } + + // reserve a new Rx buffer. + + TUint8* buffer ( NULL ); + + if ( iRxFrameMemoryPool ) + { + buffer = reinterpret_cast(iRxFrameMemoryPool->Alloc( + aLengthinBytes + + iRxBufAlignmentPadding, + EFalse ) ); // no need to zero stamp the buffer content + + if ( buffer ) + { + // allocation succeeded + + // the alignment padding is before the Rx buffer + buffer += iRxBufAlignmentPadding; + + TraceDump(RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoGetNextFreeRxBuffer: addr of allocated Rx buf: 0x%08x"), + reinterpret_cast(buffer)) ); + } + else + { + TraceDump(RX_FRAME | WARNING_LEVEL, + ("WLANLDD: MgmtFrameMemMngr::DoGetNextFreeRxBuffer: WARNING: not enough free memory => failed")); + } + } + else + { + TraceDump(RX_FRAME | WARNING_LEVEL, + ("WLANLDD: MgmtFrameMemMngr::DoGetNextFreeRxBuffer: WARNING: no Rx mem pool mgr => failed")); + } + + return buffer; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool MgmtFrameMemMngr::DoEthernetFrameRxComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: aNumOfBuffers: %d"), + aNumOfBuffers) ); + + if ( aNumOfBuffers + iCountTobeCompleted > KMaxToBeCompletedRxBufs ) + { + // too little space reserved for Rx buffer handles + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + TBool ret( EFalse ); + + if ( iReadStatus == EPending ) + { + // read pending + if ( !iCountTobeCompleted ) + { + // no existing Rx buffers to complete in queue + // we may complete these ones on the fly + + // note the completed Rx buffers first so that we can change + // their addresses to offsets + assign( + reinterpret_cast(&aBufferStart), + iCompletedBuffers, + aNumOfBuffers ); + + // update the new Rx buffer start addresses added above to be + // offsets from the Rx memory pool beginning + for( TUint i = 0; i < aNumOfBuffers; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: supplied Rx buf addr: 0x%08x"), + iCompletedBuffers[i]) ); + + iCompletedBuffers[i] + -= reinterpret_cast(iRxDataChunk); + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: Rx buf offset addr: 0x%08x"), + iCompletedBuffers[i]) ); + } + + iCountCompleted = aNumOfBuffers; + + iFrameXferBlock->KeRxComplete( iCompletedBuffers, iCountCompleted); + } + else + { + // existing rx buffers to complete in queue. + // We must append these at the rear and after that + // complete the existing read request + assign( + reinterpret_cast(&aBufferStart), + iTobeCompletedBuffers + iCountTobeCompleted, + aNumOfBuffers ); + + // update the new Rx buffer start addresses added above to be + // offsets from the Rx memory pool beginning + for( TUint i = 0; i < aNumOfBuffers; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: supplied Rx buf addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + + iTobeCompletedBuffers[iCountTobeCompleted + i] + -= reinterpret_cast(iRxDataChunk); + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: Rx buf offset addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + } + + iCountCompleted = iCountTobeCompleted + aNumOfBuffers; + + iFrameXferBlock->KeRxComplete( + iTobeCompletedBuffers, + iCountCompleted ); + + // note the completed Rx buffers + assign( iTobeCompletedBuffers, iCompletedBuffers, iCountCompleted ); + iCountTobeCompleted = 0; + } + + ret = ETrue; + } + else + { + // no read pending + // append at the rear + assign( + reinterpret_cast(&aBufferStart), + iTobeCompletedBuffers + iCountTobeCompleted, + aNumOfBuffers ); + + // update the new Rx buffer start addresses added above to be + // offsets from the Rx memory pool beginning + for( TUint i = 0; i < aNumOfBuffers; ++i ) + { + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: supplied Rx buf addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + + iTobeCompletedBuffers[iCountTobeCompleted + i] + -= reinterpret_cast(iRxDataChunk); + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: Rx buf offset addr: 0x%08x"), + iTobeCompletedBuffers[iCountTobeCompleted + i]) ); + } + + iCountTobeCompleted += aNumOfBuffers; + } + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: end: iCountCompleted: %d"), + iCountCompleted) ); + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoEthernetFrameRxComplete: end: iCountTobeCompleted: %d"), + iCountTobeCompleted) ); + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32* MgmtFrameMemMngr::DoGetTobeCompletedBuffersStart() + { + return iTobeCompletedBuffers; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32* MgmtFrameMemMngr::DoGetCompletedBuffersStart() + { + return iCompletedBuffers; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MgmtFrameMemMngr::DoFreeRxBuffers() + { + if ( IsMemInUse() ) + { + for ( TUint i = 0; i < iCountCompleted; ++i ) + { + TDataBuffer* metaHdr ( reinterpret_cast( + iRxDataChunk + iCompletedBuffers[i]) ); + + // first free the actual Rx frame buffer + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoFreeRxBuffers: free Rx buf at addr: 0x%08x"), + reinterpret_cast(metaHdr->KeGetBufferStart()) ) ); + + iRxFrameMemoryPool->Free( + metaHdr->KeGetBufferStart() + // take into account the alignment padding + - iRxBufAlignmentPadding ); + + // free the Rx frame meta header + + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoFreeRxBuffers: free Rx meta header at addr: 0x%08x"), + reinterpret_cast(metaHdr)) ); + + iRxFrameMemoryPool->Free( metaHdr ); + } + } + else + { + // the whole Rx memory pool has already been deallocated, so nothing + // is done in this case + TraceDump( RX_FRAME, + ("WLANLDD: MgmtFrameMemMngr::DoFreeRxBuffers: Rx memory pool already deallocated; no action needed") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MgmtFrameMemMngr::DoMarkRxBufFree( TUint8* aBufferToFree ) + { + TraceDump( RX_FRAME, + (("WLANLDD: MgmtFrameMemMngr::DoMarkRxBufFree: free Rx buf at addr: 0x%08x"), + reinterpret_cast(aBufferToFree) ) ); + + if ( IsMemInUse() ) + { + iRxFrameMemoryPool->Free( + aBufferToFree + // take into account the alignment padding + - iRxBufAlignmentPadding ); + } + else + { + // the whole Rx memory pool - including aBufferToFree - has already + // been deallocated, so nothing is done in this case + TraceDump( RX_FRAME, + ("WLANLDD: MgmtFrameMemMngr::DoMarkRxBufFree: Rx memory pool already deallocated; no action needed") ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt MgmtFrameMemMngr::RxBufAlignmentPadding() const + { + const TInt KMemMgrHdrLen = iRxFrameMemoryPool->HeaderSize(); + const TInt KRemainder ( KMemMgrHdrLen % iRxFrameBufAllocationUnit ); + TInt padding = KRemainder ? + ( iRxFrameBufAllocationUnit - KRemainder ) : KRemainder; + + TraceDump(INIT_LEVEL, (("WLANLDD: MgmtFrameMemMngr::RxBufAlignmentPadding: %d"), + padding)); + + return padding; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MgmtFrameMemMngr::OnReleaseMemory() + { + TraceDump(INIT_LEVEL, ("WLANLDD: MgmtFrameMemMngr::OnReleaseMemory")); + + TraceDump(MEMORY, (("WLANLDD: delete WlanChunk: 0x%08x"), + reinterpret_cast(iRxFrameMemoryPool))); + + delete iRxFrameMemoryPool; + iRxFrameMemoryPool = NULL; + + if ( iParent.SharedMemoryChunk() ) + { + TraceDump(MEMORY, (("WLANLDD: delete DChunk: 0x%08x"), + reinterpret_cast(iParent.SharedMemoryChunk()))); + + // schedule the shared memory chunk for destruction + Kern::ChunkClose( iParent.SharedMemoryChunk() ); + iParent.SharedMemoryChunk() = NULL; + MarkMemFree(); // mark as free + } + else + { + // nothing here + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WLanLogicalDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WLanLogicalDevice.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,321 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the DWlanLogicalDevice class. +* +*/ + +/* +* %version: 18 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "WlanLogicalDevice.h" +#include "WlanLogicalChannel.h" +#include "wlanlddcommon.h" +#include "osachunk.h" +#include + +const TUint KWlanParseMask = KDeviceAllowUnit | KDeviceAllowPhysicalDevice; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DECLARE_STANDARD_LDD() + { + TraceDump(INIT_LEVEL, ("WLANLDD: allocate logical device object")); + + // alloc the device + +#ifndef RD_WLAN_DDK + return new DWlanLogicalDevice; + +#else + DWlanLogicalDevice* logicalDevice( new DWlanLogicalDevice ); + + if ( !(logicalDevice->IsValid()) ) + { + // something went wrong + delete logicalDevice; + logicalDevice = NULL; + } + + return logicalDevice; +#endif + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanLogicalDevice::DWlanLogicalDevice() + : + iDfcQ( NULL ), +#ifndef RD_WLAN_DDK + iMutex( NULL ), +#else + iOsa( NULL ), +#endif + iUseCachedMemory( EFalse ), + iRxFrameMemoryPool( NULL ), + iRxBufAlignmentPadding( 0 ) + { + TraceDump(INIT_LEVEL, (("WLANLDD: DWlanLogicalDevice Ctor: 0x%08x"), this)); + + iParseMask = KWlanParseMask; + iUnitsMask = KWlanUnitsAllowedMask; + + TraceDump(INIT_LEVEL, (("iUnitsMask: 0x%08x"), iUnitsMask)); + TraceDump(INIT_LEVEL, (("iParseMask: 0x%08x"), iParseMask)); + + iVersion = TVersion(KWlanDriverMajorVersion,KWlanDriverMinorVersion,KWlanDriverBuildVersion); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanLogicalDevice::~DWlanLogicalDevice() + { + TraceDump(INIT_LEVEL, ("WLANLDD: DWlanLogicalDevice dtor")); + + delete iRxFrameMemoryPool; + iRxFrameMemoryPool = NULL; + +#ifndef RD_WLAN_DDK + + if ( iMutex ) + { + TraceDump(MUTEX, ("WLANLDD: DWlanLogicalDevice dtor: close the mutex")); + iMutex->Close( NULL ); + iMutex = NULL; + } + +#else + + if ( iOsa ) + { + TraceDump(MEMORY, (("WLANLDD: delete WlanOsa: 0x%08x"), + reinterpret_cast(iOsa))); + + delete iOsa; + iOsa = NULL; + } + +#endif // RD_WLAN_DDK + + if( iDfcQ ) + { + TraceDump(MEMORY, (("WLANLDD: delete DFC queue: 0x%08x"), + reinterpret_cast(iDfcQ))); + + iDfcQ->Destroy(); + } + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalDevice::Create( DLogicalChannelBase *&aChannel ) + { + TraceDump(INIT_LEVEL, ("WLANLDD: DWlanLogicalDevice::Create")); + + TInt ret = KErrNoMemory; + + // UMAC exists we may proceed + + aChannel = + +#ifndef RD_WLAN_DDK + new DWlanLogicalChannel( + *this, + iUmac, + *iDfcQ, + *iMutex, + iSharedMemoryChunk, + iRxFrameMemoryPool ); +#else + new DWlanLogicalChannel( + *this, + iUmac, + *iDfcQ, + iOsa, + iSharedMemoryChunk, + iRxFrameMemoryPool ); +#endif + + if ( aChannel ) + { + ret = KErrNone; + } + else + { + // allocation failed + TraceDump(WARNING_LEVEL, + ("WLANLDD: DWlanLogicalDevice::Create: logical channel allocation failure")); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalDevice::Install() + { + TraceDump(INIT_LEVEL, ("WLANLDD: DWlanLogicalDevice::Install")); + + _LIT(KWlanDdThreadName, "WlanDdThread"); + const TInt KWlanDdThreadPriority = 27; + TInt ret( 0 ); + + // create our own DFC queue (and thread) + ret = Kern::DynamicDfcQCreate( + iDfcQ, + KWlanDdThreadPriority, + KWlanDdThreadName ); + + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalDevice::Install: DFC queue creation failed -> aborting")); + return ret; + } + else + { + TraceDump(MEMORY, (("WLANLDD: new DFC queue: 0x%08x"), + reinterpret_cast(iDfcQ))); + } + +#ifndef RD_WLAN_DDK + ret = Kern::MutexCreate( iMutex, KNullDesC, KMutexOrdGeneral7); + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalDevice::Install: mutex create; status: %d"), + ret)); + + if ( ret ) + { + // mutex creation failed + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalDevice::Install: mutex creation failed -> aborting")); + ret = KErrGeneral; + } + +#else + + // create OSA + + iOsa = new WlanOsa(); + + if ( iOsa ) + { + TraceDump(MEMORY, (("WLANLDD: new WlanOsa: 0x%08x"), + reinterpret_cast(iOsa))); + + if ( !( iOsa->IsValid() ) ) + { + // OSA is not valid. That's fatal + // OSA object instance will be deallocated in the destructor + + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalDevice::Install: osa not valid, abort")); + + ret = KErrGeneral; + } + } + else + { + // allocation failed + + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalDevice::Install: osa alloc failed, abort")); + ret = KErrNoMemory; + } + +#endif + + if ( !ret ) + { + // init the UMac + if ( iUmac.Init() ) + { + const TPtrC name= LDD_NAME; + ret = SetName(&name); + + } + else + { + TraceDump(WARNING_LEVEL, + ("WLANLDD: DWlanLogicalDevice::Install: UMAC init failed -> aborting ")); + + ret = KErrGeneral; + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalDevice::GetCaps(TDes8& aDes) const + { + TraceDump(INIT_LEVEL, ("WLANLDD: DWlanLogicalDevice::GetCaps")); + + DWlanLogicalDevice::TCaps caps; + caps.iVersion=iVersion; + // write back to user mode + Kern::InfoCopy( aDes, reinterpret_cast(&caps), sizeof(caps) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalDevice::UseCachedMemory() const + { + return iUseCachedMemory; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalDevice::UseCachedMemory( TBool aValue ) + { + iUseCachedMemory = aValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalDevice::SetRxBufAlignmentPadding( + TInt aRxBufAlignmentPadding ) + { + iRxBufAlignmentPadding = aRxBufAlignmentPadding; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalDevice::RxBufAlignmentPadding() const + { + return iRxBufAlignmentPadding; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlLddPlatfrom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlLddPlatfrom.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements OS platform specific functions declared in some +* librarys +* +*/ + +/* +* %version: 18 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "wlanlddcommon.h" + +// ============================= LOCAL FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32 random() + { + return ( static_cast(Kern::SystemTime() / 1000) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* os_alloc( const TUint32 aLengthInBytes ) + { + TAny* ptr = new TUint8[aLengthInBytes]; + + TraceDump(MEMORY, (("WLANLDD: os_alloc: 0x%08x"), + reinterpret_cast(ptr))); + + return ptr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_free( const TAny* aPtr ) + { + TraceDump(MEMORY, (("WLANLDD: os_free: 0x%08x"), + reinterpret_cast(aPtr))); + + delete [] aPtr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* os_memset( void* aDest, TInt aValue, TUint aCount ) + { + return memset( aDest, aValue, aCount ); + } + +// --------------------------------------------------------------------------- +// returns aDest +// --------------------------------------------------------------------------- +// +TAny* os_memcpy( TAny* aDest, const TAny* aSrc, TUint32 aLengthinBytes ) + { + return memcpy( aDest, aSrc, aLengthinBytes ); + } + +// --------------------------------------------------------------------------- +// return 0 if equal +// --------------------------------------------------------------------------- +// +TInt os_memcmp( + const TAny* aLhs, + const TAny* aRhs, + TUint aNumOfBytes ) + { + return memcompare( + static_cast(aLhs), aNumOfBytes, + static_cast(aRhs), aNumOfBytes ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_assert( const TUint8* aError, const TUint8* aFile, TUint32 aLine ) + { + TraceDump( ERROR_LEVEL, (reinterpret_cast(aError)) ); + TraceDump( ERROR_LEVEL, (reinterpret_cast(aFile)) ); + TraceDump( ERROR_LEVEL, (("Line: %d"), aLine)); + + TExitCategory category; + + _LIT( KWlanLdd, "WLANLDD " ); + const TUint KWlanLddLength ( 8 ); + + category.Append( KWlanLdd ); + + TPtrC8 fileName( aFile ); + const TUint KFileNameSuffixLen = 4; // length of ".cpp" or ".inl" + + const TInt KSpaceLeft = KMaxExitCategoryName - KWlanLddLength; + + const TUint8* KCopyFrom = + aFile + + fileName.Length() - + KFileNameSuffixLen - + KSpaceLeft; + + category.Append( KCopyFrom, KSpaceLeft ); + + WlanPanic( category, aLine ); + } + +// --------------------------------------------------------------------------- +// Returns the current time as the number of microseconds since midnight, +// January 1st, 0 AD nominal Gregorian +// --------------------------------------------------------------------------- +// +TInt64 os_systemTime() + { + return Kern::SystemTime(); + } + +// --------------------------------------------------------------------------- +// In our architecture also host byte order is LSB so no byte +// re-ordering is necessary +// --------------------------------------------------------------------------- +// +TUint16 os_Hton( TUint16 aHost ) + { + return aHost; + } + +// --------------------------------------------------------------------------- +// In our architecture also host byte order is LSB so no byte +// re-ordering is necessary +// --------------------------------------------------------------------------- +// +TUint16 os_Ntoh( TUint16 aNw ) + { + return aNw; + } + +// --------------------------------------------------------------------------- +// In our architecture also host byte order is LSB so no byte +// re-ordering is necessary +// --------------------------------------------------------------------------- +// +TUint32 os_H32ton( TUint32 aHost ) + { + return aHost; + } + +// --------------------------------------------------------------------------- +// In our architecture also host byte order is LSB so no byte +// re-ordering is necessary +// --------------------------------------------------------------------------- +// +TUint32 os_N32toh( TUint32 aNw ) + { + return aNw; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,2946 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the DWlanLogicalChannel class. +* +*/ + +/* +* %version: 56 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "wlanlddcommon.h" +#include "WlanLogicalChannel.h" +#include "EthernetFrameMemMngr.h" +#include "EtherCardIoc.h" +#include "RWlanLogicalChannel.h" +#include "Umac.h" +#include "wllddoidmsgstorage.h" +#include "WlanLogicalDevice.h" +#include "osachunk.h" + +#ifdef RD_WLAN_DDK +#include "osa.h" +#include "wlanpddiface.h" +#endif + +extern TAny* os_alloc( const TUint32 ); +extern void os_free( const TAny* ); + +// Tx memory for frames created by UMAC +const TUint32 KDmaTxMemSize = 4096; // equals to 1 MMU page on most systems + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +#ifndef RD_WLAN_DDK +DWlanLogicalChannel::DWlanLogicalChannel( + DWlanLogicalDevice& aParent, + Umac& aUmac, + TDynamicDfcQue& aDfcQ, + DMutex& aMutex, + DChunk*& aSharedMemoryChunk, + WlanChunk*& aRxFrameMemoryPool ) +#else +DWlanLogicalChannel::DWlanLogicalChannel( + DWlanLogicalDevice& aParent, + Umac& aUmac, + TDynamicDfcQue& aDfcQ, + WlanOsa*& aOsa, + DChunk*& aSharedMemoryChunk, + WlanChunk*& aRxFrameMemoryPool ) +#endif + : + iClient( NULL ), + iUnit( KUnitMax ), + iUmac( aUmac ), + iDfcQ ( &aDfcQ ), + iParent( aParent ), + iWlanGeneralRequestStatus( NULL ), + iWlanRequestNotifyStatus( NULL ), + iWlanReceiveFrameStatus( NULL ), + iWlanSendFrameStatus( NULL ), + iIndicationBuffer( NULL ), + iIndicationListHead( NULL ), + iFreeIndicationListHead( NULL ), + iResumeTxStatus( NULL ), + iEthernetReceiveFrameStatus( NULL ), + iEthernetFrameMemMngr( NULL ), + iTimerDfc( TimerDfcDoToggle, this, 0 ), + iTimer( OnTimeOut, this ), + iVoiceCallEntryTimer( OnVoiceCallEntryTimerTimeOut, this ), + iVoiceCallEntryTimerDfc( VoiceCallEntryTimerDfcDoToggle, this, 0 ), + iNullTimer( OnNullTimerTimeOut, this ), + iNullTimerDfc( NullTimerDfcDoToggle, this, 0 ), + iNoVoiceTimer( OnNoVoiceTimerTimeOut, this ), + iNoVoiceTimerDfc( NoVoiceTimerDfcDoToggle, this, 0 ), + iKeepAliveTimer( OnKeepAliveTimerTimeOut, this ), + iKeepAliveTimerDfc( KeepAliveTimerDfcDoToggle, this, 0 ), + iActiveToLightPsTimer( OnActiveToLightPsTimerTimeOut, this ), + iActiveToLightPsTimerDfc( ActiveToLightPsTimerDfcDoToggle, this, 0 ), + iLightPsToActiveTimer( OnLightPsToActiveTimerTimeOut, this ), + iLightPsToActiveTimerDfc( LightPsToActiveTimerDfcDoToggle, this, 0 ), + iLightPsToDeepPsTimer( OnLightPsToDeepPsTimerTimeOut, this ), + iLightPsToDeepPsTimerDfc( LightPsToDeepPsTimerDfcDoToggle, this, 0 ), + iDfc( DfcDoToggle, this, 0 ), + iTxTriggerDfc( TxTriggerDfcDoToggle, this, 0 ), + iFlags( 0 ), + iPowerHandler( *this, aDfcQ ), + iPoweringDown( EFalse ), + iDfcCtx( NULL ), +#ifndef RD_WLAN_DDK + iMutex( aMutex ), +#else + iOsa( aOsa ), +#endif + iSharedMemoryChunk( aSharedMemoryChunk ), + iRxFrameMemoryPool( aRxFrameMemoryPool ), + iTxActive( EFalse ), + iAddTxFrameAllowed( ETrue ) + { + TraceDump(INIT_LEVEL, (("WLANLDD: DWlanLogicalChannel Ctor: 0x%08x"), this)); + + iTimerDfc.SetDfcQ( iDfcQ ); + iVoiceCallEntryTimerDfc.SetDfcQ( iDfcQ ); + iNullTimerDfc.SetDfcQ( iDfcQ ); + iNoVoiceTimerDfc.SetDfcQ( iDfcQ ); + iKeepAliveTimerDfc.SetDfcQ( iDfcQ ); + iActiveToLightPsTimerDfc.SetDfcQ( iDfcQ ); + iLightPsToActiveTimerDfc.SetDfcQ( iDfcQ ); + iLightPsToDeepPsTimerDfc.SetDfcQ( iDfcQ ); + iDfc.SetDfcQ( iDfcQ ); + iTxTriggerDfc.SetDfcQ( iDfcQ ); + + // store client thread ID + iClient = &Kern::CurrentThread(); + + TraceDump(INIT_LEVEL, (("WLANLDD: current thread 0x%08x"), iClient)); + + // open a refernce to client thread, so we don't get out of scope + ((DObject*)iClient)->Open(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanLogicalChannel::~DWlanLogicalChannel() + { + TraceDump(INIT_LEVEL, (("WLANLDD: DWlanLogicalChannel Dtor: 0x%08x"), this)); + + if ( iUnit == KUnitWlan ) + { + iTimerDfc.Cancel(); + iVoiceCallEntryTimerDfc.Cancel(); + iNullTimerDfc.Cancel(); + iNoVoiceTimerDfc.Cancel(); + iKeepAliveTimerDfc.Cancel(); + iActiveToLightPsTimerDfc.Cancel(); + iLightPsToActiveTimerDfc.Cancel(); + iLightPsToDeepPsTimerDfc.Cancel(); + iDfc.Cancel(); + + // if there are any indication items currently pending, free them by + // moving them to the free list + PurgeIndicationList(); + // delete all indication items from the free list + FreeIndicationList(); + // detach management side callback + TraceDump(INIT_LEVEL, ("WLANLDD: detach managemement side callback from UMAC")); + iUmac.Detach(); + + if ( iFlags & KPowerHandlerRegistered ) + { + // we have registered our power handler + + // if we stopping operations because of a power down request from power + // manager, acknowledge back to power manager that we are now done + if ( iPoweringDown ) + { + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::~DWlanLogicalChannel(): signalling powerDownDone"))); + iPowerHandler.OnPowerDownDone(); + } + + // de-register our power handler from the power manager + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::~DWlanLogicalChannel(): de-register our powerhandler"))); + iPowerHandler.Remove(); + + // destroy UMAC internal Tx memory buffer + iDmaTxMemory.Finit(); + } + } + else if ( iUnit == KUnitEthernet ) + { + iTxTriggerDfc.Cancel(); + + // detach protocol stack side callback + TraceDump(INIT_LEVEL, + ("WLANLDD: detach protocol stack side callback from UMAC")); + iUmac.DetachProtocolStackSideUmacCb(); + } + + if ( iEthernetFrameMemMngr ) + { + TraceDump(INIT_LEVEL, ("WLANLDD: deallocate ethernet frame memory pool")); + TraceDump(MEMORY, (("WLANLDD: delete DEthernetFrameMemMngr: 0x%08x"), + reinterpret_cast(iEthernetFrameMemMngr))); + + delete iEthernetFrameMemMngr; + iEthernetFrameMemMngr = NULL; + } + + iDfcQ = NULL; // destroyed elsewhere (by the owner) + + // close our refernce to client thread as the very last thing we do + Kern::SafeClose( reinterpret_cast(iClient), NULL); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DChunk*& DWlanLogicalChannel::SharedMemoryChunk() + { + return iSharedMemoryChunk; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::SetRxBufAlignmentPadding( + TInt aRxBufAlignmentPadding ) + { + iParent.SetRxBufAlignmentPadding( aRxBufAlignmentPadding ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::RxBufAlignmentPadding() const + { + return iParent.RxBufAlignmentPadding(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::InitIndicationListEntries() + { + // Initialize indication list entries + TBool ret( ETrue ); // true for success + + for ( TUint32 i = 0 ; i < KMaxIndicationListEntries; ++i ) + { + TIndicationListEntry* tmp = new TIndicationListEntry; + + if ( tmp ) + { + TraceDump(MEMORY, (("WLANLDD: new TIndicationListEntry: 0x%08x"), + reinterpret_cast(tmp))); + + // The ReleaseIndicationListEntry + // function can also be used for initialization + ReleaseIndicationListEntry( tmp ); + } + else + { + // alloc failed no use to continue + ret = EFalse; + break; + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// If an error occurs in this method, we set iPdd to NULL to prevent +// PDD object destruction in base class (DLogicalChannelBase) destructor. +// DLogicalChannelBase destructor gets called as this logical channel instance +// gets destoyed when this method returns with an error. +// The PDD object gets destructed elsewhere. +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::DoCreate( + TInt aUnit, + const TDesC8* /*aInfo*/, + const TVersion& /*aVer*/ ) + { + TraceDump(INIT_LEVEL, ("WLANLDD: DWlanLogicalChannel::DoCreate")); + TraceDump(INIT_LEVEL, + (("WLANLDD: current thread 0x%08x"), &Kern::CurrentThread())); + TraceDump(INIT_LEVEL, (("WLANLDD: aUnit %d"), aUnit)); + + if ( !Kern::CurrentThreadHasCapability( + ECapabilityCommDD, + __PLATSEC_DIAGNOSTIC_STRING( "Checked by wlan.ldd"))) + { + iPdd = NULL; + return KErrPermissionDenied; + } + + // enable reception of requests from user mode + SetDfcQ(iDfcQ); + iMsgQ.Receive(); + + // length of the allocation unit to be used for OSA interconnect + // (DMA capable) memory and frame Rx/Tx buffers. + // If WLAN DDK is used and the WLAN PDD capabilities query below + // returns a non-NULL response and the PDD indicates support for + // cached memory, we use the length of the processor's cache line + // - returned in that response - as the allocation unit length. + // Otherwise we use this default value + TInt allocationUnit ( 32 ); + + iUnit = aUnit; // store the unit + + // PDD has been loaded and created by the framework at this point + + if ( iUnit == KUnitWlan ) + { + if ( !InitIndicationListEntries() ) + { + iPdd = NULL; + return KErrNoMemory; + } + + // attach management side callback + TraceDump(INIT_LEVEL, ("WLANLDD: attach managemement side callback to UMAC")); + iUmac.Attach( *this ); + +#ifndef RD_WLAN_DDK + WHA::Wha* wha( reinterpret_cast(iPdd) ); + // attach the WHA object to UMAC + TraceDump(INIT_LEVEL, ("WLANLDD: attach WHA object to UMAC")); + iUmac.AttachWsa( wha ); +#else + + MWlanPddIface* pdd( reinterpret_cast(iPdd) ); + + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: wlanpdd addr: 0x%08x"), + pdd)); + + // determine PDD capabilities + + MWlanPddIface::SCapabilities* pddCapabilities ( NULL ); + + pdd->GetCapabilities( pddCapabilities ); + + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: pddCapabilities ptr: 0x%08x"), + reinterpret_cast(pddCapabilities))); + + if ( pddCapabilities ) + { + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: wlanpdd iCapabilities: 0x%08x"), + pddCapabilities->iCapabilities)); + + if ( pddCapabilities->iCapabilities & + MWlanPddIface::SCapabilities::KCachedMemory ) + { + TraceDump(INIT_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCreate: use cached memory")); + + iParent.UseCachedMemory( ETrue ); + + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: wlanpdd iCacheLineLength: %d"), + pddCapabilities->iCacheLineLength)); + + allocationUnit = pddCapabilities->iCacheLineLength; + } + delete pddCapabilities; + pddCapabilities = NULL; + } + + // initialize OSA + if ( !iOsa->Initialize( + iParent.UseCachedMemory(), + allocationUnit, + iDfcQ ) ) + { + // init failed. We cannot continue + + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCreate: osa init failed, abort")); + + iPdd = NULL; + return KErrGeneral; + } + + TraceDump(INIT_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCreate: attach osa and osaext to wlanpdd")); + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: osa and osaext addr: 0x%08x"), + reinterpret_cast(iOsa))); + + // pass interfaces to PDD + const TBool ret( pdd->Attach( *iOsa, *iOsa ) ); + if ( ret ) + { + TraceDump(INIT_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCreate: extract WHA and attach it to UMAC")); + // extract wha and attach it to UMAC + iUmac.AttachWsa( &(pdd->Extract()) ); + } + else + { + // attach failure abort + TraceDump(WARNING_LEVEL, ("WLANLDD: PDD attach failure -> abort")); + iPdd = NULL; + return KErrNoMemory; + } +#endif + +#ifndef RD_WLAN_DDK + // pass the mutex to WHA + wha->Mutex( reinterpret_cast(&iMutex) ); +#endif + + // register our power handler with the power manager + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: register our powerhandler"))); + iPowerHandler.Add(); + iFlags |= KPowerHandlerRegistered; // note that we have registered + + // create UMAC internal Tx memory buffer + if ( iDmaTxMemory.Init( KDmaTxMemSize, iParent.UseCachedMemory() ) + == KDmaTxMemSize ) + { + // success; no further action needed + } + else + { + // failure + iPdd = NULL; + return KErrNoMemory; + } + } + else if ( iUnit == KUnitEthernet ) + { + // attach protocol stack side callbac + iUmac.AttachProtocolStackSideUmacCb( *this ); + } + else + { + // unknown unit + + TraceDump(ERROR_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCreate: ERROR: unknown unit: %d"), + iUnit)); + iPdd = NULL; + return KErrPermissionDenied; + } + + // init ethernet frame memory pool manager + iEthernetFrameMemMngr = DEthernetFrameMemMngr::Init( + aUnit, + *this, + iRxFrameMemoryPool, + iParent.UseCachedMemory(), + allocationUnit ); + + if ( iEthernetFrameMemMngr ) + { + // init success -> continue + TraceDump(INIT_LEVEL, (("WLANLDD: ethernet memory pool allocated: 0x%08x"), + iEthernetFrameMemMngr)); + } + else + { + // init failure no use to continue + TraceDump(WARNING_LEVEL, + ("WLANLDD: ethernet memory pool allocation failure")); + + iPdd = NULL; + return KErrNoMemory; + } + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::HandleMsg(TMessageBase* aMsg) + { + TraceDump(WLM_CMD, ("WLANLDD: DWlanLogicalChannel::HandleMsg")); + + // we are now executing in a DFC thread context + // acquire mutex +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex acquired"))); + + TThreadMessage& m = *reinterpret_cast( aMsg ); + + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: current thread 0x%08x"), + &Kern::CurrentThread())); + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: client thread 0x%08x"), m.Client())); + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: channel creator thread 0x%08x"), + iClient)); + + // Get message type + TInt id = m.iValue; + + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: message id: %d"), id)); + + // Decode the message type and dispatch it to the relevent handler function... + + // A logical channel can be closed either explicitly by its user-side client, + // or implicitly if the client thread dies. In the latter case, the channel + // is closed in the context of the kernel supervisor thread. + if ( id == ECloseMsg ) + { + TraceDump(WLM_CMD_DETAILS, ("WLANLDD: close message")); + + if( m.Client() == iClient ) + { + // channel closed by client + + // trick to disable PDD object dealloc + // as this logical channel gets destoyed after this + // and iPdd is deallocated in DLogicalChannelBase + iPdd = NULL; + } + + // release mutex + // Note that in this case we release the mutex before completing the + // client message. Reason: When SMP is used, doing these actions in + // the reverse order could, in principle, lead to a situation where + // the channel instance has already been destroyed (by another thread) + // when the mutex is tried to be released. + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex released"))); + + m.Complete( KErrNone, EFalse ); + + return; + } + + // For all other message types, we check that the message is from the thread + // that created us. + if ( m.Client() != iClient ) + { + TraceDump(SERIOUS_LEVEL, (("WLANLDD: ERROR: requesting thread: 0x%08x"), + m.Client())); + TraceDump(SERIOUS_LEVEL, ("WLANLDD: ERROR: request from wrong thread")); + + m.Complete( KErrPermissionDenied, ETrue ); + } + else if ( id == KMaxTInt ) + { + TraceDump(WLM_CMD_DETAILS, ("WLANLDD: DoCancel")); + + // DoCancel + DoCancel( m.Int0() ); + m.Complete( KErrNone,ETrue ); + } + else if ( id < 0 ) + { + TraceDump(WLM_CMD_DETAILS, ("WLANLDD: DoRequest")); + + // DoRequest + TRequestStatus* req_status = reinterpret_cast( m.Ptr0() ); + const TInt r = DoRequest( ~id, req_status, m.Ptr1(), m.Ptr2() ); + if ( r != KErrNone) + { + // this branch means that an error of somekind has occurred + // we complete the request synchronously + Kern::RequestComplete( m.Client(), req_status, r ); + } + + m.Complete( KErrNone, ETrue ); + } + else + { + TraceDump(WLM_CMD_DETAILS, ("WLANLDD: DoControl")); + + // DoControl + const TInt r = DoControl( id, m.Ptr0(), m.Ptr1() ); + m.Complete( r, ETrue ); + } + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex released"))); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TAny* DWlanLogicalChannel::DoControlFast( TInt aFunction, TAny* param ) + { + TAny* ret( NULL ); + TBool triggerTx ( EFalse ); + + TraceDump(WLM_CMD_DETAILS, + (("WLANLDD: DWlanLogicalChannel::DoControlFast: current thread 0x%08x"), + &Kern::CurrentThread())); + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: channel creator thread: 0x%08x"), + iClient)); + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: function: 0x%x"), aFunction)); + + // Note! We are executing in the context of the client's thread, but + // in supervisor mode + + // acquire mutex +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired"))); + + switch ( aFunction ) + { + case RPcmNetCardIf::EControlFastAllocTxBuffer: + ret = iEthernetFrameMemMngr->AllocTxBuffer( + reinterpret_cast(param) ); + + if ( !ret && iAddTxFrameAllowed ) + { + iAddTxFrameAllowed = EFalse; + + TraceDump( NWSA_TX, + ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") ); + } + break; + + case RPcmNetCardIf::EControlFastAddTxFrame: + { +#ifndef NDEBUG + if ( !iAddTxFrameAllowed ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoControlFast: WARNING: AddTxFrame req. when flow ctrl is on")); + } +#endif + if ( iEthernetFrameMemMngr->AllTxQueuesEmpty() ) + { + triggerTx = ETrue; + } + + TDataBuffer* discardFrame ( NULL ); + + ret = reinterpret_cast(iEthernetFrameMemMngr->AddTxFrame( + reinterpret_cast(param), + discardFrame, + iUmac.UserDataTxEnabled() )); + + if ( discardFrame ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::DoControlFast: have to drop tx frame of UP: %d"), + reinterpret_cast(param)->UserPriority()) ); + + iEthernetFrameMemMngr->FreeTxPacket( discardFrame ); + } + + if ( !ret ) + { + iAddTxFrameAllowed = EFalse; + + TraceDump( NWSA_TX, + ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") ); + } + break; + } + default: +#ifndef NDEBUG + TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"), + aFunction)); + os_assert( + (TUint8*)("WLANLDD: panic"), + (TUint8*)(WLAN_FILE), + __LINE__ ); +#endif + break; + } + + // release mutex +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + ("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex released")); + + if ( triggerTx ) + { + // Trigger a new Tx - via a DFC. + // Note that we do this outside of mutex protection, as this block of + // code is executed by a lower priority (user side) thread, and the + // DFC by a higher priority (kernel side) thread, and the latter will + // also need to acquire the same mutex before it can proceed. So, as + // the lower priority thread will get paused and the higher priority + // thread will get scheduled (to execute the DFC), we don't want the + // higher priority thread to need to wait for the mutex. So we + // released the mutex first in this code block and after that enque + // the DFC request. + if ( !( iFlags & KTxTriggerArmed ) ) + { + iFlags |= KTxTriggerArmed; + iTxTriggerDfc.Enque(); + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::DoCancel( TInt aMask ) + { + if ( iUnit == KUnitWlan ) + { + if ( aMask & ( 1 << EWlanRequestNotify ) ) + { + TraceDump(INFO_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side notify cancel")); + + CancelIndicationRequest(); + Kern::RequestComplete( + iClient, iWlanRequestNotifyStatus, KErrServerTerminated ); + iWlanRequestNotifyStatus = NULL; + } + else if ( aMask & ( 1 << EWlanRequestFrame ) ) + { + TraceDump(INFO_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side frame read cancel")); + + Kern::RequestComplete( + iClient, iWlanReceiveFrameStatus, KErrServerTerminated ); + iWlanReceiveFrameStatus = NULL; + } + else + { + TraceDump(ERROR_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side unhandled mask panic: 0x%08x"), + aMask)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else if ( iUnit == KUnitEthernet ) + { + if ( aMask & ( 1 << RPcmNetCardIf::EControlResumeTxCancel ) ) + { + TraceDump(INFO_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCancel: user side resume Tx cancel")); + + Kern::RequestComplete( + iClient, iResumeTxStatus, KErrServerTerminated ); + iResumeTxStatus = NULL; + } + else if ( aMask & ( 1 << RPcmNetCardIf::EControlReadCancel ) ) + { + TraceDump(INFO_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoCancel: user side frame read cancel")); + + Kern::RequestComplete( + iClient, iEthernetReceiveFrameStatus, KErrServerTerminated ); + iEthernetReceiveFrameStatus = NULL; + } + else + { + TraceDump(ERROR_LEVEL, + (("WLANLDD: DWlanLogicalChannel::DoCancel: user side unhandled mask panic: 0x%08x"), + aMask)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else + { + TraceDump(ERROR_LEVEL, (("WLANLDD: DoCancel unknown unit panic: %d"), + iUnit)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::ProtocolStackDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( aBufferStart, + aNumOfBuffers ) ) + { + Kern::RequestComplete( iClient, iEthernetReceiveFrameStatus, KErrNone ); + iEthernetReceiveFrameStatus = NULL; + } + + return ETrue; // indicate always successful processing + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::ProtocolStackSideClientReady() const + { + TBool status ( EFalse ); + + if ( iEthernetFrameMemMngr && iEthernetFrameMemMngr->IsMemInUse() ) + { + status = ETrue; + } + + return status; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::UserDataReEnabled() + { + if ( !( iFlags & KTxTriggerArmed ) ) + { + iFlags |= KTxTriggerArmed; + iTxTriggerDfc.Enque(); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* DWlanLogicalChannel::DmaPrivateTxMemory() + { + return reinterpret_cast(iDmaTxMemory.Addr()); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::SetProtocolStackTxOffset( + TUint32 aEthernetFrameTxOffset ) + { + const TUint32 KNotRelevant ( 0 ); + + if ( iEthernetFrameMemMngr ) + { + TraceDump(NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::SetProtocolStackTxOffset: aEthernetFrameTxOffset: %d"), + aEthernetFrameTxOffset )); + + iEthernetFrameMemMngr->SetTxOffsets( + aEthernetFrameTxOffset, + KNotRelevant, + KNotRelevant ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnTxProtocolStackDataComplete( + TInt aCompletionCode, + TDataBuffer* aMetaHeader ) + { + TraceDump(UMAC_PROTO_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::OnTxProtocolStackDataComplete")); + TraceDump(UMAC_PROTO_CALLBACK, + (("WLANLDD: aCompletionCode: %d"), aCompletionCode)); + + iEthernetFrameMemMngr->FreeTxPacket( aMetaHeader ); + + TxProtocolStackData(); + + if ( !iAddTxFrameAllowed ) + { + if ( iResumeTxStatus && + iEthernetFrameMemMngr->ResumeClientTx( + iUmac.UserDataTxEnabled() ) ) + { + // resume Tx flow from protocol stack + + TraceDump(NWSA_TX_DETAILS, + ("WLANLDD: DWlanLogicalChannel::OnTxProtocolStackDataComplete: complete client Tx resume req")); + + // complete the pending request to user mode + Kern::RequestComplete( + iClient, iResumeTxStatus, aCompletionCode ); + // mark request as non-pending + iResumeTxStatus = NULL; + + iAddTxFrameAllowed = ETrue; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnOtherTxDataComplete() + { + TraceDump(UMAC_PROTO_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::OnOtherTxDataComplete")); + + // We try to submit Protocol Stack side frames also when this event occurs + // a) to speed up new Tx submission in the case that a frame submitted by + // someone else than the Protocol Stack Side Client unblocks the WHA Tx + // pipeline and + // b) to avoid the Tx pipe from getting stuck even temporarily + if ( !( iFlags & KTxTriggerArmed ) ) + { + iFlags |= KTxTriggerArmed; + iTxTriggerDfc.Enque(); // we do this via a DFC + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnTxDataSent() + { + TraceDump(UMAC_PROTO_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::OnTxDataSent")); + + // We try to submit Protocol Stack side frames also when this event occurs + // a) to speed up new Tx submission in the case that a frame, submitted by + // someone else than the Protocol Stack Side Client, gets transmitted & + // makes a WHA Txqueue - for which there are packets pending in our Tx + // queues - non-full + // b) to avoid the Tx pipe from getting stuck even temporarily + if ( !( iFlags & KTxTriggerArmed ) ) + { + iFlags |= KTxTriggerArmed; + iTxTriggerDfc.Enque(); // we do this via a DFC + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::TxManagementData() + { + TDataBuffer* buffer = iEthernetFrameMemMngr->OnWriteEthernetFrame(); + + if ( !buffer ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::TxManagementData: " + "panic, no buffer")); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + else + { + iUmac.WriteMgmtFrame( *buffer ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::TxProtocolStackData() + { +#ifndef NDEBUG + TUint packetsSubmitted ( 0 ); +#endif + + if ( !iTxActive ) + { + TWhaTxQueueState txQueueState; + TBool morePackets ( EFalse ); + iTxActive = ETrue; + + while ( iUmac.TxPermitted( txQueueState ) ) + { + TDataBuffer* metaHeader = + iEthernetFrameMemMngr->GetTxFrame( txQueueState, morePackets ); + + if ( metaHeader ) + { + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::TxProtocolStackData: submitting packet %d"), + ++packetsSubmitted) ); + + iUmac.TxProtocolStackData( + *metaHeader, + morePackets ); + } + else + { + TraceDump(NWSA_TX_DETAILS, + ("WLANLDD: DWlanLogicalChannel::TxProtocolStackData: no packet that could be submitted")); + + break; + } + } + + iTxActive = EFalse; + } + + TraceDump( NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::TxProtocolStackData: %d packet(s) submitted"), + packetsSubmitted) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::OnReadEthernetFrameRequest() + { + const TBool ret = iEthernetFrameMemMngr->OnReadRequest(); + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::OnEthernetSideRequest( + TInt aReqNo, + TRequestStatus* aStatus, + TAny* /*a1*/, + TAny* /*a2*/ ) + { + const TInt ret( KErrNone ); + + switch (aReqNo) + { + case RPcmNetCardIf::ERequestRead: + // Read request + if ( OnReadEthernetFrameRequest() ) + { + // rx data to be completed exists + // complete it directly + Kern::RequestComplete( + iClient, + aStatus, + KErrNone ); + } + else + { + // no rx data for completion exists + // store the pending request + iEthernetReceiveFrameStatus = aStatus; + } + break; + case RPcmNetCardIf::EResumeTx: + // request to get notified once Tx can again be resumed + iResumeTxStatus = aStatus; + break; + default: + // unknown request + + TraceDump(ERROR_LEVEL, + ("WLANLDD: unknown protocol stack request")); + TraceDump(ERROR_LEVEL, (("WLANLDD: request id: %d"), aReqNo)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::FinitSystem() + { + TraceDump(INIT_LEVEL, ("WLANLDD * finit system")); + iUmac.FinitSystem(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::InitSystem( + TAny* aInputBuffer, + TUint aInputLength ) + { + // read the USER mode parameters to internal storage + TInt ret = Kern::ThreadRawRead( + iClient, + aInputBuffer, + &iOpenParam, + aInputLength ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::InitSystem(): ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // backup pointers + const TAny* pda( iOpenParam.iPda ); + const TAny* fw( iOpenParam.iFirmWare ); + + // allocate kernel memory for the pda and firmware + iOpenParam.iPda = os_alloc( iOpenParam.iPdaLength ); + iOpenParam.iFirmWare = os_alloc( iOpenParam.iFirmWareLength ); + + if ( iOpenParam.iPda && iOpenParam.iFirmWare ) + { + // allocation success + // read the parameters to allocated storage + ret = Kern::ThreadRawRead( + iClient, + pda, + iOpenParam.iPda, + iOpenParam.iPdaLength ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::InitSystem(): ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + ret = Kern::ThreadRawRead( + iClient, + fw, + iOpenParam.iFirmWare, + iOpenParam.iFirmWareLength ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::InitSystem(): ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // check this in completion method + iFlags |= KFreeOpenParamsMask; + + iUmac.BootUp( + static_cast(iOpenParam.iPda), + iOpenParam.iPdaLength, + static_cast(iOpenParam.iFirmWare), + iOpenParam.iFirmWareLength ); + } + else + { + // allocation failure + // make sure all is released + os_free( iOpenParam.iPda ); + os_free( iOpenParam.iFirmWare ); + + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::InitSystem: ERROR: PDA and/or firmware memory allocation failure")); + + // complete the pending request with error code to user mode + Kern::RequestComplete( + iClient, + iWlanGeneralRequestStatus, + KErrNoMemory ); + // mark request as non pending + iWlanGeneralRequestStatus = NULL; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::HandlePointerParameters() + { + TraceDump(WLM_CMD_DETAILS, + (("WLANLDD: DWlanLogicalChannel::HandlePointerParameters"))); + + if ( !HandleScanResponseFrameBodyCase() ) + { + // memory allocation failure + + return EFalse; + } + + if ( !CheckAndHandleIeDataCase() ) + { + // memory allocation failure + + // free memory allocated in the previous step + FreeScanResponseFramebody(); + + return EFalse; + } + + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::HandleScanResponseFrameBodyCase() + { + TBool ret( ETrue ); + + // handle scan response frame body case + if ( (reinterpret_cast + (&iOidMsgStorage))->oid_id == E802_11_CONNECT ) + { + if ( iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ) + { + // scan response frame body exists + // we must allocate kernel storage for it here + + TraceDump(WLM_CMD_DETAILS, + (("WLANLDD: DWlanLogicalChannel::HandleScanResponseFrameBodyCase: allocate memory & copy data; length: %d"), + iOidMsgStorage.iOidMsgs + .iConnectMsg.scanResponseFrameBodyLength )); + + const TUint8* user_mode_address( + iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ); + + iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody + = static_cast(os_alloc( + iOidMsgStorage.iOidMsgs + .iConnectMsg.scanResponseFrameBodyLength )); + + if ( iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ) + { + // allocation success + // read the parameters to the allocated storage + const TInt local( Kern::ThreadRawRead( + iClient, + user_mode_address, + const_cast(iOidMsgStorage.iOidMsgs + .iConnectMsg.scanResponseFrameBody), + iOidMsgStorage.iOidMsgs + .iConnectMsg.scanResponseFrameBodyLength ) ); + + if ( local != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: local: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // mark memory deallocation event + iFlags |= KFreeScanResponseFramebodyMask; + } + else + { + // allocation failure + ret = EFalse; + } + } + else // --- scan response frame body does not exist --- + { + // this is a usage error + + TraceDump(ERROR_LEVEL, + ("WLANLDD: scan response frame body is null in connect OID")); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else // --- connect not issued --- + { + // do nothing + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::CheckAndHandleIeDataCase() + { + TBool ret( ETrue ); + + // handle Tx IE case + if ( (reinterpret_cast + (&iOidMsgStorage))->oid_id == E802_11_CONNECT ) + { + if ( iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ) + { + // Tx IE exists + // we must allocate kernel storage for it here + + TraceDump(WLM_CMD_DETAILS, + (("WLANLDD: DWlanLogicalChannel::CheckAndHandleIeDataCase: allocate memory & copy data; length: %d"), + iOidMsgStorage.iOidMsgs.iConnectMsg.ieDataLength )); + + const TUint8* user_mode_address( + iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ); + + iOidMsgStorage.iOidMsgs.iConnectMsg.ieData + = static_cast(os_alloc( + iOidMsgStorage.iOidMsgs.iConnectMsg.ieDataLength )); + + if ( iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ) + { + // allocation success + // read the parameters to the allocated storage + const TInt local( Kern::ThreadRawRead( + iClient, + user_mode_address, + const_cast(iOidMsgStorage.iOidMsgs + .iConnectMsg.ieData), + iOidMsgStorage.iOidMsgs + .iConnectMsg.ieDataLength ) ); + + if ( local != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: local: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // mark memory deallocation event + iFlags |= KFreeIeDataMask; + } + else + { + // allocation failure + ret = EFalse; + } + } + else // --- RSN IE does not exists --- + { + // do nothing + } + } + else // --- connect not issued --- + { + // do nothing + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::FreeScanResponseFramebody() + { + if ( iFlags & KFreeScanResponseFramebodyMask ) + { + // free scan response frame + + TraceDump(WLM_CMD_DETAILS, + (("WLANLDD: DWlanLogicalChannel::FreeScanResponseFramebody: freeing memory"))); + + os_free( iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ); + iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody = NULL; + iFlags &= ~KFreeScanResponseFramebodyMask; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::FreeIeData() + { + if ( iFlags & KFreeIeDataMask ) + { + // free Tx IE + + TraceDump(WLM_CMD_DETAILS, + (("WLANLDD: DWlanLogicalChannel::FreeIeData: freeing memory"))); + + os_free( iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ); + iOidMsgStorage.iOidMsgs.iConnectMsg.ieData = NULL; + iFlags &= ~KFreeIeDataMask; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::OnMgmtSideDoRequest( + TInt aReqNo, + TRequestStatus* aStatus, + TAny* a1, + TAny* a2 ) + { + TraceDump(WLM_CMD, + (("WLANLDD: DWlanLogicalChannel::OnMgmtSideDoRequest(): request: %d"), + aReqNo)); + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: a1 0x%08x"), a1)); + TraceDump(WLM_CMD_DETAILS, (("WLANLDD: a2 0x%08x"), a2)); + + TInt ret( KErrNone ); + + SOutputBuffer output_buffer = { NULL, 0 }; + if ( a2 ) + { + // read the USER mode output parameters to internal storage + ret = Kern::ThreadRawRead( + iClient, + a2, + &output_buffer, + sizeof(output_buffer) ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: OnMgmtSideDoRequest(): ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + + switch ( aReqNo ) + { + case EWlanInitSystem: + // bootup the chip and the system + iWlanGeneralRequestStatus = aStatus; + InitSystem( a1, sizeof(TOpenParam) ); + break; + case EWlanFinitSystem: + // power down the chip and the system + iWlanGeneralRequestStatus = aStatus; + FinitSystem(); + break; + case EWlanCommand: + // management command + iWlanGeneralRequestStatus = aStatus; + + // read the USER mode parameters to internal storage + ret = Kern::ThreadRawRead( + iClient, + a1, + &iOidMsgStorage, + sizeof(iOidMsgStorage) ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::OnMgmtSideDoRequest(): ThreadRawRead panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + // read also parameters pointed to by pointers from USER mode to + // internal storage; when such parameters exist + if ( !HandlePointerParameters() ) + { + // memory allocation failure + // complete the pending request with error code to user mode + Kern::RequestComplete( + iClient, + iWlanGeneralRequestStatus, + KErrNoMemory ); + // mark request as non pending + iWlanGeneralRequestStatus = NULL; + break; + } + + iUmac.HandleOid( + reinterpret_cast(&iOidMsgStorage), + // we can pass output buffer pointer as is + // because it is not accessed by UMAC and the + // actual user mode writing is done by OnOidCompleted method + output_buffer.iData, + output_buffer.iLen ); + break; + case EWlanRequestNotify: + // store the USER mode indication address; + iIndicationBuffer = static_cast(a1); + iWlanRequestNotifyStatus = aStatus; + IndicationRequest( static_cast(a1) ); + break; + case EWlanRequestFrame: + if ( OnReadEthernetFrameRequest() ) + { + // rx data to be completed exists + // complete it directly + Kern::RequestComplete( + iClient, + aStatus, + KErrNone ); + } + else + { + // no rx data for completion exists + // store the pending request + iWlanReceiveFrameStatus = aStatus; + } + break; + case EWlanRequestSend: + iWlanSendFrameStatus = aStatus; + + TxManagementData(); + break; + default: + // unknown request + TraceDump(ERROR_LEVEL, + ("WLANLDD: unhandled management request panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: request id: %d"), aReqNo)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::DoRequest( + TInt aReqNo, + TRequestStatus* aStatus, + TAny* a1, + TAny* a2 ) + { + TInt ret( KErrNone ); + if ( iUnit == KUnitWlan ) + { + ret = OnMgmtSideDoRequest( aReqNo, aStatus, a1, a2 ); + } + else if ( iUnit == KUnitEthernet ) + { + ret = OnEthernetSideRequest( aReqNo, aStatus, a1, a2 ); + } + else + { + // unknown unit + + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::DoRequest(): unknown request unit panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: request id: %d"), aReqNo)); + TraceDump(ERROR_LEVEL, (("WLANLDD: unit: %d"), iUnit)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::OnInitialiseEthernetFrameBuffers( + TSharedChunkInfo* aSharedChunkInfo ) + { + TInt ret( KErrNoMemory ); + + if ( iEthernetFrameMemMngr ) + { + TUint8 notRelevant( 0 ); + TUint8 vendorTxHdrLen ( 0 ); + TUint8 vendorTxTrailerLen ( 0 ); + + iUmac.GetFrameExtraSpaceForVendor( + notRelevant, + vendorTxHdrLen, + vendorTxTrailerLen ); + + ret = iEthernetFrameMemMngr->OnInitialiseMemory( + *iClient, + aSharedChunkInfo, + vendorTxHdrLen, + vendorTxTrailerLen ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnReleaseEthernetFrameBuffers() + { + if ( iEthernetFrameMemMngr ) + { + iEthernetFrameMemMngr->OnReleaseMemory(); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::OnEthernetSideControl( + TInt aFunction, + TAny* a1, + TAny* /*a2*/ ) + { + TInt ret(KErrNone); + + switch (aFunction) + { + case RPcmNetCardIf::EControlGetConfig: + { + const TMacAddress& mac = iUmac.StationId(); + TEtherConfig ethercfg = { NULL }; + + // 0x00 - card is ready, 0xff - card not ready. + ethercfg.iStatus = 0; + // Speed setting (0x00 to 0x03). + ethercfg.iEthSpeed = 0; + // Duplex setting (0x00 to 0x03) + ethercfg.iEthDuplex = 0; + + // set STA MAC + os_memcpy( ethercfg.iEthAddress, &mac, KMacAddressLength ); + + // write config to USER mode + ret = Kern::ThreadRawWrite( + iClient, + a1, + ðercfg, + sizeof(ethercfg) ); + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + break; + } + case RPcmNetCardIf::ESvControlInitBuffers: + // instruct initiliaze buffers for data xfer + if ( a1 ) + { + // call + TraceDump(INIT_LEVEL, + ("WLANLDD * init protocol shared IO-buffer memory pool")); + + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl: chunk info addr: 0x%08x"), + a1)); + ret = OnInitialiseEthernetFrameBuffers( + static_cast(a1) ); + + // set frame Tx offset for protocol stack side + iUmac.SetTxOffset(); + } + else + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl(): init protocol stack buffer pool panic")); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + break; + case RPcmNetCardIf::ESvControlFreeBuffers: + { + // instruct free buffers for data xfer + OnReleaseEthernetFrameBuffers(); + break; + } + default: + // unhadled panic + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl(): protocol stack side control panic")); + TraceDump(ERROR_LEVEL, (("function id: %d"), aFunction)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + break; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::OnMgmtSideControl( + TInt aFunction, + TAny* a1, + TAny* /*a2*/ ) + { + TInt ret( KErrNone ); + if ( aFunction == EWlanSvControlInitBuffers ) + { + // initiliaze buffers for wlan mgmt client data xfer + if ( a1 ) + { + TraceDump(INIT_LEVEL, + ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): init management client shared IO-buffer memory pool")); + + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl: chunk info addr: 0x%08x"), + a1)); + ret = OnInitialiseEthernetFrameBuffers( + static_cast(a1) ); + } + else + { + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): init management client buffer pool panic")); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + else if ( aFunction == EWlanSvControlFreeBuffers ) + { + // free wlan mgmt client data xfer buffers + OnReleaseEthernetFrameBuffers(); + } + else + { + // unknown request + + TraceDump(ERROR_LEVEL, + ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): management side control panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: function id: %d"), aFunction)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannel::DoControl( TInt aFunction, TAny* a1, TAny* a2) + { + TInt ret( KErrNone ); + if ( iUnit == KUnitWlan ) + { + ret = OnMgmtSideControl( aFunction, a1, a2 ); + } + else if ( iUnit == KUnitEthernet ) + { + ret = OnEthernetSideControl( aFunction, a1, a2 ); + } + else + { + // unknown unit + + TraceDump(ERROR_LEVEL, ("WLANLDD: unhandled control unit panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: function id: %d"), aFunction)); + TraceDump(ERROR_LEVEL, (("WLANLDD: unit: %d"), iUnit)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnOidCompleted( + TInt aReason, + SOidOutputData& OidOutputData ) + { + if ( iFlags & KFreeOpenParamsMask ) + { + // free open params + os_free( iOpenParam.iPda ); + iOpenParam.iPda = NULL; + os_free( iOpenParam.iFirmWare ); + iOpenParam.iFirmWare = NULL; + iFlags &= ~KFreeOpenParamsMask; + } + else + { + // check if there are other command parameter related memory blocks + // to be released + // Note! We check the flags already here to avoid unnecessary + // FreeXXX function calls + + if ( iFlags & KFreeScanResponseFramebodyMask ) + { + // free scan response frame body + FreeScanResponseFramebody(); + + // the following flags can be set only at the same time with + // KFreeScanResponseFramebodyMask + + if ( iFlags & KFreeIeDataMask ) + { + // free IE(s) + FreeIeData(); + } + } + } + + TraceDump(UMAC_MGMT_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::OnOidCompleted()")); + TraceDump(UMAC_MGMT_CALLBACK, (("WLANLDD: OID: 0x%08x"), + OidOutputData.iOidId)); + TraceDump(UMAC_MGMT_CALLBACK, (("WLANLDD: aReason: %d"), aReason)); + + if ( iWlanGeneralRequestStatus ) + { + // write data to user mode if this happened to be a read request + if ( OidOutputData.iOidData ) + { + TraceDump(UMAC_MGMT_CALLBACK, ("WLANLDD: write data to USER mode")); + TraceDump(UMAC_MGMT_CALLBACK, (("WLANLDD: length: %d"), + OidOutputData.iLengthOfDataInBytes)); + + const TInt ret + = Kern::ThreadRawWrite( + iClient, + OidOutputData.iBufferSupplied, + OidOutputData.iOidData, + OidOutputData.iLengthOfDataInBytes ); + + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + + // complete the pending request to user mode + Kern::RequestComplete( iClient, iWlanGeneralRequestStatus, aReason ); + // mark request as non pending + iWlanGeneralRequestStatus = NULL; + } + else // iReqStatus + { + // no pending request exists, so it must have been cancelled + // Nothing more to do here + TraceDump(UMAC_MGMT_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::OnOidCompleted(): no pending request")); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::SetMgmtSideTxOffsets( + TUint32 aEthernetFrameTxOffset, + TUint32 aDot11FrameTxOffset, + TUint32 aSnapFrameTxOffset ) + { + if ( iEthernetFrameMemMngr ) + { + TraceDump(NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aEthernetFrameTxOffset: %d"), + aEthernetFrameTxOffset )); + TraceDump(NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aDot11FrameTxOffset: %d"), + aDot11FrameTxOffset )); + TraceDump(NWSA_TX_DETAILS, + (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aSnapFrameTxOffset: %d"), + aSnapFrameTxOffset )); + + iEthernetFrameMemMngr->SetTxOffsets( + aEthernetFrameTxOffset, + aDot11FrameTxOffset, + aSnapFrameTxOffset ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint8* DWlanLogicalChannel::GetBufferForRxData( + TUint aLengthinBytes ) + { + TUint8* ret ( NULL ); + if ( iEthernetFrameMemMngr ) + { + ret = iEthernetFrameMemMngr->OnGetEthernetFrameRxBuffer( + aLengthinBytes ); + } + else + { + TraceDump(RX_FRAME | WARNING_LEVEL, + ("WLANLDD: DWlanLogicalChannel::GetBufferForRxData: WARNING: no frame mgr => failed")); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::MgmtDataReceiveComplete( + const TDataBuffer*& aBufferStart, + TUint32 aNumOfBuffers ) + { + if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( + aBufferStart, + aNumOfBuffers ) ) + { + Kern::RequestComplete( iClient, iWlanReceiveFrameStatus, KErrNone ); + iWlanReceiveFrameStatus = NULL; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::MgmtPathWriteComplete( TInt aErr ) + { + TraceDump(UMAC_MGMT_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::MgmtPathWriteComplete()")); + TraceDump(UMAC_MGMT_CALLBACK, + (("WLANLDD: aCompletionCode: %d"), aErr)); + + if ( iWlanSendFrameStatus ) + { + // complete the pending request to user mode + Kern::RequestComplete( + iClient, iWlanSendFrameStatus, aErr ); + // mark request as non pending + iWlanSendFrameStatus = NULL; + } + else // iReqStatus + { + // no pending request exists, so it must have been cancelled + // Nothing to do here + TraceDump(UMAC_MGMT_CALLBACK, + ("WLANLDD: DWlanLogicalChannel::MgmtPathWriteComplete(): no pending request")); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanLogicalChannel::TIndicationListEntry* +DWlanLogicalChannel::GetFreeIndicationListEntry() + { + TIndicationListEntry* newEntry = NULL; + + if ( iFreeIndicationListHead ) + { + newEntry = iFreeIndicationListHead; + iFreeIndicationListHead = newEntry->next; + newEntry->next = NULL; + } + + return newEntry; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::StoreIndication( TIndication aIndication ) + { + TIndicationListEntry* newEntry = GetFreeIndicationListEntry(); + + if ( !newEntry ) + { + return; + } + + newEntry->indication = aIndication; + newEntry->next = NULL; + + if ( !iIndicationListHead ) + { + iIndicationListHead = newEntry; + } + else + { + TIndicationListEntry *tmp = iIndicationListHead; + + while ( tmp->next ) + { + tmp = tmp->next; + } + + tmp->next = newEntry; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::IndicationComplete() + { + Kern::RequestComplete( + iClient, iWlanRequestNotifyStatus, KErrNone ); + iWlanRequestNotifyStatus = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool DWlanLogicalChannel::GetStoredIndication() + { + TIndicationListEntry *tmp = NULL; + + if ( !iIndicationListHead ) + { + return EFalse; + } + + TraceDump(WLM_INDICATION, + (("WLANLDD: DWlanLogicalChannel::GetStoredIndication(): indication complete: %d"), + iIndicationListHead->indication)); + + const TInt ret = Kern::ThreadRawWrite( iClient, iIndicationBuffer, + &( iIndicationListHead->indication ), + sizeof(iIndicationListHead->indication) ); + + if ( ret != KErrNone ) + { + TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); + TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + + tmp = iIndicationListHead; + iIndicationListHead = tmp->next; + + ReleaseIndicationListEntry( tmp ); + + return ETrue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::TryToCompleteIndicationRequest() + { + if ( iIndicationBuffer ) + { + if ( GetStoredIndication() ) + { + IndicationComplete(); + iIndicationBuffer = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnInDicationEvent( TIndication aIndication ) + { + StoreIndication( aIndication ); + TryToCompleteIndicationRequest(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::FreeIndicationList() + { + // Free the indication list entries + TIndicationListEntry *iter = iFreeIndicationListHead; + TIndicationListEntry *next = NULL; + + while ( iter ) + { + next = iter->next; + + TraceDump(MEMORY, (("WLANLDD: delete TIndicationListEntry: 0x%08x"), + reinterpret_cast(iter))); + + delete iter; + + iter = next; + } + + iFreeIndicationListHead = NULL; + iIndicationListHead = NULL; + iIndicationBuffer = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::CancelIndicationRequest() + { + iIndicationBuffer = NULL; + PurgeIndicationList(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::PurgeIndicationList() + { + TIndicationListEntry* iter = iIndicationListHead; + TIndicationListEntry* next = NULL; + + while ( iter ) + { + next = iter->next; + + ReleaseIndicationListEntry( iter ); + + iter = next; + } + + iIndicationListHead = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::IndicationRequest( TIndication* aBuffer ) + { + iIndicationBuffer = aBuffer; + TryToCompleteIndicationRequest(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::ReleaseIndicationListEntry( + TIndicationListEntry* aEntry ) + { + aEntry->next = NULL; + + if ( !iFreeIndicationListHead ) + { + iFreeIndicationListHead = aEntry; + } + else + { + TIndicationListEntry* tmp = iFreeIndicationListHead; + + while ( tmp->next ) + { + tmp = tmp->next; + } + + tmp->next = aEntry; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::MarkRxBufFree( TUint8* aBufferToFree ) + { + if ( iEthernetFrameMemMngr ) + { + iEthernetFrameMemMngr->DoMarkRxBufFree( aBufferToFree ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealTimerDfc(): mutex acquired"))); + + iUmac.OnTimeout( EWlanDefaultTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealTimerDfc(): mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::TimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealDfc: mutex acquired"))); + + if ( !(iFlags & KDfcCancelledMask) ) + { + iUmac.OnDfc( iDfcCtx ); + } + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealDfc: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::DfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr( static_cast(aPtr) ); + ptr->RealDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealVoiceCallEntryTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealVoiceCallEntryTimerDfc(): mutex acquired"))); + + iUmac.OnTimeout( EWlanVoiceCallEntryTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealVoiceCallEntryTimerDfc(): mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::VoiceCallEntryTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealVoiceCallEntryTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnVoiceCallEntryTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iVoiceCallEntryTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealNullTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealNullTimerDfc(): mutex acquired"))); + + iUmac.OnTimeout( EWlanNullTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealNullTimerDfc(): mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::NullTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealNullTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnNullTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iNullTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealNoVoiceTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealNoVoiceTimerDfc: mutex acquired"))); + + iUmac.OnTimeout( EWlanNoVoiceTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealNoVoiceTimerDfc: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::NoVoiceTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealNoVoiceTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnNoVoiceTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iNoVoiceTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealKeepAliveTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealKeepAliveTimerDfc: mutex acquired"))); + + iUmac.OnTimeout( EWlanKeepAliveTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealKeepAliveTimerDfc: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::KeepAliveTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealKeepAliveTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnKeepAliveTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iKeepAliveTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealActiveToLightPsTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealActiveToLightPsTimerDfc: mutex acquired"))); + + iUmac.OnTimeout( EWlanActiveToLightPsTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealActiveToLightPsTimerDfc: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::ActiveToLightPsTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealActiveToLightPsTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnActiveToLightPsTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iActiveToLightPsTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealLightPsToActiveTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealLightPsToActiveTimerDfc: mutex acquired"))); + + iUmac.OnTimeout( EWlanLightPsToActiveTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealLightPsToActiveTimerDfc: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::LightPsToActiveTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealLightPsToActiveTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnLightPsToActiveTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iLightPsToActiveTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealLightPsToDeepPsTimerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealLightPsToDeepPsTimerDfc: mutex acquired"))); + + iUmac.OnTimeout( EWlanLightPsToDeepPsTimer ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::RealLightPsToDeepPsTimerDfc: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::LightPsToDeepPsTimerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr = static_cast(aPtr); + ptr->RealLightPsToDeepPsTimerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnLightPsToDeepPsTimerTimeOut( TAny *aPtr ) + { + DWlanLogicalChannel* p = static_cast(aPtr); + + // queue to a DFC for completion + p->iLightPsToDeepPsTimerDfc.Add(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RegisterTimeout( + TUint32 aTimeoutInMicroSeconds, + TWlanTimer aTimer ) + { + TraceDump(INFO_LEVEL, + (("WLANLDD: DWlanLogicalChannel::RegisterTimeout: timer: %d"), + aTimer)); + TraceDump(INFO_LEVEL, + (("WLANLDD: DWlanLogicalChannel::RegisterTimeout: aTimeoutInMicroSeconds: %d"), + aTimeoutInMicroSeconds)); + + const TInt KThousand = 1000; + + switch ( aTimer ) + { + case EWlanDefaultTimer: + iTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanVoiceCallEntryTimer: + iVoiceCallEntryTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanNullTimer: + iNullTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanNoVoiceTimer: + iNoVoiceTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanKeepAliveTimer: + iKeepAliveTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanActiveToLightPsTimer: + iActiveToLightPsTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanLightPsToActiveTimer: + iLightPsToActiveTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + case EWlanLightPsToDeepPsTimer: + iLightPsToDeepPsTimer.OneShot( + // convert timeout 1st to milliseconds & then to NKern ticks + NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), + // request completion in ISR context + EFalse ); + break; + default: + TraceDump(ERROR_LEVEL, + (("WLANLDD: DWlanLogicalChannel::RegisterTimeout: panic, unknown timer: %d"), + aTimer)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::CancelTimeout( TWlanTimer aTimer ) + { + TraceDump(INFO_LEVEL, + (("WLANLDD: DWlanLogicalChannel::CancelTimeout: timer: %d"), + aTimer)); + + switch ( aTimer ) + { + case EWlanDefaultTimer: + iTimer.Cancel(); + iTimerDfc.Cancel(); + break; + case EWlanVoiceCallEntryTimer: + iVoiceCallEntryTimer.Cancel(); + iVoiceCallEntryTimerDfc.Cancel(); + break; + case EWlanNullTimer: + iNullTimer.Cancel(); + iNullTimerDfc.Cancel(); + break; + case EWlanNoVoiceTimer: + iNoVoiceTimer.Cancel(); + iNoVoiceTimerDfc.Cancel(); + break; + case EWlanKeepAliveTimer: + iKeepAliveTimer.Cancel(); + iKeepAliveTimerDfc.Cancel(); + break; + case EWlanActiveToLightPsTimer: + iActiveToLightPsTimer.Cancel(); + iActiveToLightPsTimerDfc.Cancel(); + break; + case EWlanLightPsToActiveTimer: + iLightPsToActiveTimer.Cancel(); + iLightPsToActiveTimerDfc.Cancel(); + break; + case EWlanLightPsToDeepPsTimer: + iLightPsToDeepPsTimer.Cancel(); + iLightPsToDeepPsTimerDfc.Cancel(); + break; + default: + TraceDump(ERROR_LEVEL, + (("WLANLDD: DWlanLogicalChannel::CancelTimeout: panic, unknown timer: %d"), + aTimer)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RegisterDfc( TAny* aCntx ) + { + iFlags &= ~KDfcCancelledMask; + iDfcCtx = aCntx; + iDfc.Enque(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::CancelDfc() + { + iFlags |= KDfcCancelledMask; + iDfc.Cancel(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::RealTxTriggerDfc() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + ("WLANLDD: DWlanLogicalChannel::RealTxTriggerDfc: mutex acquired")); + + iFlags &= ~KTxTriggerArmed; + TxProtocolStackData(); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + ("WLANLDD: DWlanLogicalChannel::RealTxTriggerDfc: mutex released")); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::TxTriggerDfcDoToggle( TAny* aPtr ) + { + DWlanLogicalChannel* ptr( static_cast(aPtr) ); + ptr->RealTxTriggerDfc(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TDataBuffer* DWlanLogicalChannel::GetRxFrameMetaHeader() + { + TDataBuffer* metaHdr ( NULL ); + if ( iEthernetFrameMemMngr ) + { + metaHdr = iEthernetFrameMemMngr->GetRxFrameMetaHeader(); + } + else + { + TraceDump(RX_FRAME | WARNING_LEVEL, + ("WLANLDD: DWlanLogicalChannel::GetRxFrameMetaHeader: WARNING: no frame mgr => failed")); + } + + return metaHdr; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ) + { + if ( iEthernetFrameMemMngr ) + { + iEthernetFrameMemMngr->FreeRxFrameMetaHeader( aMetaHeader ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnPowerUp() + { + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::OnPowerUp: mutex acquired"))); + + // No real action in this case; so just inform that we are done + iPowerHandler.OnPowerUpDone(); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::OnPowerUp: mutex released"))); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanLogicalChannel::OnPowerDown() + { + TraceDump(INIT_LEVEL, + (("WLANLDD: DWlanLogicalChannel::OnPowerDown"))); + + iPoweringDown = ETrue; + + // acquire mutex + +#ifndef RD_WLAN_DDK + Kern::MutexWait( iMutex ); +#else + iOsa->MutexAcquire(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::OnPowerDown: mutex acquired"))); + + // Trigger power down indication to wlanengine + iUmac.OnInDicationEvent( EOsPowerStandby ); + + // release mutex + +#ifndef RD_WLAN_DDK + Kern::MutexSignal( iMutex ); +#else + iOsa->MutexRelease(); +#endif + + TraceDump(MUTEX, + (("WLANLDD: DWlanLogicalChannel::OnPowerDown: mutex released"))); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wlldddmausablememory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wlldddmausablememory.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the WlanDmaUsableMemory class. +* +*/ + +/* +* %version: 11 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "wlldddmausablememory.h" + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint32 WlanDmaUsableMemory::Init( + TUint32 aSizeInBytes, + TBool aUseCachedMemory ) + { + TraceDump(INIT_LEVEL, (("WLANLDD: init dma usable memory"))); + TraceDump(INIT_LEVEL, (("size requested: %d"), aSizeInBytes)); + + // extract MMU page size in bytes + iSizeInBytes = Kern::RoundToPageSize( aSizeInBytes ); + + TraceDump(INIT_LEVEL, (("MMU page size: %d"), iSizeInBytes)); + + // allocate a block of physically contiguous RAM + TInt ret( Epoc::AllocPhysicalRam( iSizeInBytes, iPhysicalRamAddr ) ); + if ( ret != KErrNone ) + { + // this can happen if we have no memory + TraceDump(ERROR_LEVEL, (("WLANLDD: physical RAM alloc failure: %d"), + ret)); + iSizeInBytes = 0; + return 0; + } + + TraceDump(INIT_LEVEL, (("physical RAM address: 0x%08x"), iPhysicalRamAddr)); + + // determine if cached memory shall be used + TUint cacheOption = aUseCachedMemory ? + EMapAttrCachedMax : + EMapAttrFullyBlocking; + + // use a DPlatChunk + ret = DPlatChunkHw::New( iChunk, iPhysicalRamAddr, + iSizeInBytes, + EMapAttrUserRw | cacheOption ); + if ( ret != KErrNone ) + { + // can not fail + TraceDump(ERROR_LEVEL, (("WLANLDD: DPlatChunkHw alloc failure: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + return 0; + } + + // init success + TraceDump(INIT_LEVEL, + (("WlanDmaUsableMemory::Init: Platform Hw Chunk create success with cacheOption: 0x%08x"), + cacheOption)); + iFlags |= KResourceAcquired; + return iSizeInBytes; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void WlanDmaUsableMemory::Finit() + { + if ( iFlags & KResourceAcquired ) + { + TraceDump(INIT_LEVEL, (("WLANLDD: finit dma usable memory"))); + + iFlags &= ~KResourceAcquired; + // close the chunk. This also automatically deletes the object + // as its reference count goes to 0 + iChunk->Close( NULL ); + + // free the physical ram which was associated with the chunk + const TInt ret( Epoc::FreePhysicalRam( + iPhysicalRamAddr, iSizeInBytes ) ); + + iPhysicalRamAddr = 0; + iSizeInBytes = 0; + +#ifndef NDEBUG + if ( ret != KErrNone ) + { + // can not fail + TraceDump(ERROR_LEVEL, (("WLANLDD: physical RAM free failure: %d"), ret)); + os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); + } +#endif + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TLinAddr WlanDmaUsableMemory::Addr( + TUint32 aSizeInBytes ) + { + return (aSizeInBytes <= iSizeInBytes) + ? iChunk->LinearAddress() : NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TLinAddr WlanDmaUsableMemory::Addr() + { + return iChunk->LinearAddress(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddlogicalchannelbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddlogicalchannelbase.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the DWlanLogicalChannelBase class. +* +*/ + +/* +* %version: 2 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "wllddlogicalchannelbase.h" +#include + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanLogicalChannelBase::DWlanLogicalChannelBase() + { + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanLogicalChannelBase::~DWlanLogicalChannelBase() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt DWlanLogicalChannelBase::Request( TInt aReqNo, TAny* a1, TAny* a2 ) + { + if ( aReqNo < static_cast(EMinRequestId) ) + { + Kern::PanicCurrentThread( + _L("DWlanLogicalChannelBase::Request"), + ERequestNoInvalid ); + + return KErrGeneral; + } + else if ( aReqNo >= EMinControlFast && aReqNo < EMaxControlFast) + { + // Execute fast control commands in the context of the client's + // thread in supervisor mode. + return reinterpret_cast(DoControlFast( aReqNo , a1 )); + } + else + { + TThreadMessage& m = Kern::Message(); + m.iValue = aReqNo; + m.iArg[0] = a1; + if ( aReqNo < 0 ) + { + kumemget32( &m.iArg[1], a2, 2 * sizeof( TAny* ) ); + } + else + { + m.iArg[1] = a2; + } + return m.SendReceive( &iMsgQ ); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddpowerhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddpowerhandler.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the DWlanPowerHandler class +* +*/ + +/* +* %version: 6 % +*/ + +#include "wllddpowerhandler.h" +#include "wllddpowerindicator.h" + +_LIT(KWlanPowerHandlerName,"WLAN power handler"); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +DWlanPowerHandler::DWlanPowerHandler( + MWlanPowerIndicator& aWlanLdd , + TDynamicDfcQue& aDfcQ ): + DPowerHandler( KWlanPowerHandlerName ), + iWlanLdd( &aWlanLdd ), + iPowerUpDfc( PowerUpDfcFn, this, NULL, 0 ), + iPowerDownDfc( PowerDownDfcFn, this, NULL, 0 ) + { + iPowerUpDfc.SetDfcQ( &aDfcQ ); + iPowerDownDfc.SetDfcQ( &aDfcQ ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +DWlanPowerHandler::~DWlanPowerHandler() + { + iWlanLdd = NULL; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::PowerDownDfcFn( TAny *aPtr ) + { + DWlanPowerHandler *pwrHandler = static_cast(aPtr); + pwrHandler->PowerDownOperation(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::PowerUpDfcFn( TAny *aPtr ) + { + DWlanPowerHandler *pwrHandler = static_cast(aPtr); + pwrHandler->PowerUpOperation(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::PowerDown( TPowerState ) + { + iPowerDownDfc.Enque(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::PowerUp() + { + iPowerUpDfc.Enque(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::OnPowerDownDone() + { + // Acknowledge back to power manager that power down has been done + PowerDownDone(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::OnPowerUpDone() + { + // Acknowledge back to power manager that power up handling has been done + PowerUpDone(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::PowerDownOperation() + { + // Forward the request + iWlanLdd->OnPowerDown(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void DWlanPowerHandler::PowerUpOperation() + { + // Forward the indication + iWlanLdd->OnPowerUp(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddtrace.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddtrace.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: trace library +* +*/ + +/* +* %version: 5 % +*/ + +#include "WlLddWlanLddConfig.h" +#include "wlanlddcommon.h" + + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_traceprint( TUint32 aLevel, const TUint8* aString ) + { + TraceDump( aLevel, (reinterpret_cast(aString)) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_traceprint( TUint32 aLevel, const TUint8* aString, TUint32 aArg1 ) + { + TraceDump( aLevel, (reinterpret_cast(aString), aArg1) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + const TUint8* aBeg, + // one past last element to be traced + const TUint8* aEnd ) + { + TraceDump( aLevel, (reinterpret_cast(aString)) ); + + while ( aBeg != aEnd ) + { + TraceDump( aLevel, (("0x%02x"), *aBeg) ); + ++aBeg; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + const TMacAddress& aMac ) + { + TraceDump( aLevel, (reinterpret_cast(aString)) ); + TracePrint( aLevel, aMac ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void os_traceprint( + TUint32 aLevel, + const TUint8* aString, + const Sdot11MacHeader& aDot11Hdr ) + { + os_traceprint( aLevel, aString ); + + TraceDump( aLevel, (("frame control type: 0x%02x"), + static_cast(aDot11Hdr.iFrameControl.iType) )); + TraceDump(aLevel, (("frame control control: 0x%02x"), + static_cast(aDot11Hdr.iFrameControl.iControl) )); + os_traceprint(aLevel, (TUint8*)("address1:"), aDot11Hdr.iAddress1); + os_traceprint(aLevel, (TUint8*)("address2:"), aDot11Hdr.iAddress2); + os_traceprint(aLevel, (TUint8*)("address3:"), aDot11Hdr.iAddress3); + TraceDump(aLevel, (("sequence control: 0x%02x"), + static_cast(aDot11Hdr.iSeqCtl) )); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/bwins/wlanprotou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/bwins/wlanprotou.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +EXPORTS + ?ReceivedL@CLANLinkCommon@@UAEXABVTRuntimeCtxId@Messages@@ABVTNodeId@3@AAVTSignatureBase@3@@Z @ 1 NONAME ; void CLANLinkCommon::ReceivedL(class Messages::TRuntimeCtxId const &, class Messages::TNodeId const &, class Messages::TSignatureBase &) + ?ReadDes@CLANLinkCommon@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 2 NONAME ; int CLANLinkCommon::ReadDes(class TDesC16 const &, class TDes16 &) + ??1CWlanMetaConnectionProvider@@UAE@XZ @ 3 NONAME ; CWlanMetaConnectionProvider::~CWlanMetaConnectionProvider(void) + ?NifEvent@CLANLinkCommon@@QAEXW4TNetworkAdaptorEventType@@IABVTDesC8@@PAX@Z @ 4 NONAME ; void CLANLinkCommon::NifEvent(enum TNetworkAdaptorEventType, unsigned int, class TDesC8 const &, void *) + ?WriteDes@CLANLinkCommon@@QAEHABVTDesC16@@0@Z @ 5 NONAME ; int CLANLinkCommon::WriteDes(class TDesC16 const &, class TDesC16 const &) + ?GetControlL@CLANLinkCommon@@UAEPAVMLowerControl@ESock@@ABVTDesC8@@@Z @ 6 NONAME ; class ESock::MLowerControl * CLANLinkCommon::GetControlL(class TDesC8 const &) + ?BindL@CLANLinkCommon@@UAEPAVMLowerDataSender@ESock@@ABVTDesC8@@PAVMUpperDataReceiver@3@PAVMUpperControl@3@@Z @ 7 NONAME ; class ESock::MLowerDataSender * CLANLinkCommon::BindL(class TDesC8 const &, class ESock::MUpperDataReceiver *, class ESock::MUpperControl *) + ?WriteDes@CLANLinkCommon@@QAEHABVTDesC16@@ABVTDesC8@@@Z @ 8 NONAME ; int CLANLinkCommon::WriteDes(class TDesC16 const &, class TDesC8 const &) + ?ReadInt@CLANLinkCommon@@QAEHABVTDesC16@@AAK@Z @ 9 NONAME ; int CLANLinkCommon::ReadInt(class TDesC16 const &, unsigned long &) + ?LinkLayerUp@CLANLinkCommon@@QAEXXZ @ 10 NONAME ; void CLANLinkCommon::LinkLayerUp(void) + ?LinkLayerDown@CLANLinkCommon@@QAEXHW4TAction@1@@Z @ 11 NONAME ; void CLANLinkCommon::LinkLayerDown(int, enum CLANLinkCommon::TAction) + ?ResumeSending@CLANLinkCommon@@QAEXXZ @ 12 NONAME ; void CLANLinkCommon::ResumeSending(void) + ?NewL@CWlanMetaConnectionProvider@@SAPAV1@AAVCMetaConnectionProviderFactoryBase@ESock@@ABVTProviderInfo@3@@Z @ 13 NONAME ; class CWlanMetaConnectionProvider * CWlanMetaConnectionProvider::NewL(class ESock::CMetaConnectionProviderFactoryBase &, class ESock::TProviderInfo const &) + ?Unbind@CLANLinkCommon@@UAEXPAVMUpperDataReceiver@ESock@@PAVMUpperControl@3@@Z @ 14 NONAME ; void CLANLinkCommon::Unbind(class ESock::MUpperDataReceiver *, class ESock::MUpperControl *) + ?ConstructL@CLANLinkCommon@@QAEXXZ @ 15 NONAME ; void CLANLinkCommon::ConstructL(void) + ?IfProgress@CLANLinkCommon@@QAEXIHH@Z @ 16 NONAME ; void CLANLinkCommon::IfProgress(unsigned int, int, int) + ?WriteBool@CLANLinkCommon@@QAEHABVTDesC16@@H@Z @ 17 NONAME ; int CLANLinkCommon::WriteBool(class TDesC16 const &, int) + ?Self@stateMap@WlanMCprStates@@SAABUTNodeActivityMap@MeshMachine@@XZ @ 18 NONAME ; struct MeshMachine::TNodeActivityMap const & WlanMCprStates::stateMap::Self(void) + ??0CWlanMetaConnectionProvider@@IAE@AAVCMetaConnectionProviderFactoryBase@ESock@@ABVTProviderInfo@2@ABUTNodeActivityMap@MeshMachine@@@Z @ 19 NONAME ; CWlanMetaConnectionProvider::CWlanMetaConnectionProvider(class ESock::CMetaConnectionProviderFactoryBase &, class ESock::TProviderInfo const &, struct MeshMachine::TNodeActivityMap const &) + ??1CLANLinkCommon@@UAE@XZ @ 20 NONAME ; CLANLinkCommon::~CLANLinkCommon(void) + ?NewL@CLANLinkCommon@@SAPAV1@AAVCSubConnectionFlowFactoryBase@ESock@@ABVTNodeId@Messages@@PAVCProtocolIntfBase@3@@Z @ 21 NONAME ; class CLANLinkCommon * CLANLinkCommon::NewL(class ESock::CSubConnectionFlowFactoryBase &, class Messages::TNodeId const &, class ESock::CProtocolIntfBase *) + ??0CLANLinkCommon@@QAE@AAVCSubConnectionFlowFactoryBase@ESock@@ABVTNodeId@Messages@@PAVCProtocolIntfBase@2@@Z @ 22 NONAME ; CLANLinkCommon::CLANLinkCommon(class ESock::CSubConnectionFlowFactoryBase &, class Messages::TNodeId const &, class ESock::CProtocolIntfBase *) + ?WriteInt@CLANLinkCommon@@QAEHABVTDesC16@@K@Z @ 23 NONAME ; int CLANLinkCommon::WriteInt(class TDesC16 const &, unsigned long) + ?ConstructL@CWlanMetaConnectionProvider@@IAEXXZ @ 24 NONAME ; void CWlanMetaConnectionProvider::ConstructL(void) + ?ReadBool@CLANLinkCommon@@QAEHABVTDesC16@@AAH@Z @ 25 NONAME ; int CLANLinkCommon::ReadBool(class TDesC16 const &, int &) + ?ReceivedL@CWlanMetaConnectionProvider@@MAEXABVTRuntimeCtxId@Messages@@ABVTNodeId@3@AAVTSignatureBase@3@@Z @ 26 NONAME ; void CWlanMetaConnectionProvider::ReceivedL(class Messages::TRuntimeCtxId const &, class Messages::TNodeId const &, class Messages::TSignatureBase &) + ?IfProgress@CLANLinkCommon@@QAEXHH@Z @ 27 NONAME ; void CLANLinkCommon::IfProgress(int, int) + ?ReadDes@CLANLinkCommon@@QAEHABVTDesC16@@AAVTDes8@@@Z @ 28 NONAME ; int CLANLinkCommon::ReadDes(class TDesC16 const &, class TDes8 &) + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/eabi/wlanprotou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/eabi/wlanprotou.def Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,59 @@ +EXPORTS + _ZN14CLANLinkCommon10ConstructLEv @ 1 NONAME + _ZN14CLANLinkCommon10IfProgressEii @ 2 NONAME + _ZN14CLANLinkCommon10IfProgressEjii @ 3 NONAME + _ZN14CLANLinkCommon11GetControlLERK6TDesC8 @ 4 NONAME + _ZN14CLANLinkCommon11LinkLayerUpEv @ 5 NONAME + _ZN14CLANLinkCommon13LinkLayerDownEiNS_7TActionE @ 6 NONAME + _ZN14CLANLinkCommon13ResumeSendingEv @ 7 NONAME + _ZN14CLANLinkCommon4NewLERN5ESock29CSubConnectionFlowFactoryBaseERKN8Messages7TNodeIdEPNS0_17CProtocolIntfBaseE @ 8 NONAME + _ZN14CLANLinkCommon5BindLERK6TDesC8PN5ESock18MUpperDataReceiverEPNS3_13MUpperControlE @ 9 NONAME + _ZN14CLANLinkCommon6UnbindEPN5ESock18MUpperDataReceiverEPNS0_13MUpperControlE @ 10 NONAME + _ZN14CLANLinkCommon7ReadDesERK7TDesC16R5TDes8 @ 11 NONAME + _ZN14CLANLinkCommon7ReadDesERK7TDesC16R6TDes16 @ 12 NONAME + _ZN14CLANLinkCommon7ReadIntERK7TDesC16Rm @ 13 NONAME + _ZN14CLANLinkCommon8NifEventE24TNetworkAdaptorEventTypejRK6TDesC8Pv @ 14 NONAME + _ZN14CLANLinkCommon8ReadBoolERK7TDesC16Ri @ 15 NONAME + _ZN14CLANLinkCommon8WriteDesERK7TDesC16RK6TDesC8 @ 16 NONAME + _ZN14CLANLinkCommon8WriteDesERK7TDesC16S2_ @ 17 NONAME + _ZN14CLANLinkCommon8WriteIntERK7TDesC16m @ 18 NONAME + _ZN14CLANLinkCommon9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 19 NONAME + _ZN14CLANLinkCommon9WriteBoolERK7TDesC16i @ 20 NONAME + _ZN14CLANLinkCommonC1ERN5ESock29CSubConnectionFlowFactoryBaseERKN8Messages7TNodeIdEPNS0_17CProtocolIntfBaseE @ 21 NONAME + _ZN14CLANLinkCommonC2ERN5ESock29CSubConnectionFlowFactoryBaseERKN8Messages7TNodeIdEPNS0_17CProtocolIntfBaseE @ 22 NONAME + _ZN14CLANLinkCommonD0Ev @ 23 NONAME + _ZN14CLANLinkCommonD1Ev @ 24 NONAME + _ZN14CLANLinkCommonD2Ev @ 25 NONAME + _ZN14WlanMCprStates8stateMap4SelfEv @ 26 NONAME + _ZN27CWlanMetaConnectionProvider10ConstructLEv @ 27 NONAME + _ZN27CWlanMetaConnectionProvider4NewLERN5ESock34CMetaConnectionProviderFactoryBaseERKNS0_13TProviderInfoE @ 28 NONAME + _ZN27CWlanMetaConnectionProvider9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 29 NONAME + _ZN27CWlanMetaConnectionProviderC1ERN5ESock34CMetaConnectionProviderFactoryBaseERKNS0_13TProviderInfoERKN11MeshMachine16TNodeActivityMapE @ 30 NONAME + _ZN27CWlanMetaConnectionProviderC2ERN5ESock34CMetaConnectionProviderFactoryBaseERKNS0_13TProviderInfoERKN11MeshMachine16TNodeActivityMapE @ 31 NONAME + _ZN27CWlanMetaConnectionProviderD0Ev @ 32 NONAME + _ZN27CWlanMetaConnectionProviderD1Ev @ 33 NONAME + _ZN27CWlanMetaConnectionProviderD2Ev @ 34 NONAME + _ZTI13CPcCardPktDrv @ 35 NONAME ; ## + _ZTI14CLANLinkCommon @ 36 NONAME ; ## + _ZTI16TLanIp4Provision @ 37 NONAME ; ## + _ZTI16TLanIp6Provision @ 38 NONAME ; ## + _ZTI27CWlanMetaConnectionProvider @ 39 NONAME ; ## + _ZTI7CSender @ 40 NONAME ; ## + _ZTI9CReceiver @ 41 NONAME ; ## + _ZTV13CPcCardPktDrv @ 42 NONAME ; ## + _ZTV14CLANLinkCommon @ 43 NONAME ; ## + _ZTV16TLanIp4Provision @ 44 NONAME ; ## + _ZTV16TLanIp6Provision @ 45 NONAME ; ## + _ZTV27CWlanMetaConnectionProvider @ 46 NONAME ; ## + _ZTV7CSender @ 47 NONAME ; ## + _ZTV9CReceiver @ 48 NONAME ; ## + _ZThn12_N14CLANLinkCommonD0Ev @ 49 NONAME ; ## + _ZThn12_N14CLANLinkCommonD1Ev @ 50 NONAME ; ## + _ZThn12_N27CWlanMetaConnectionProviderD0Ev @ 51 NONAME ; ## + _ZThn12_N27CWlanMetaConnectionProviderD1Ev @ 52 NONAME ; ## + _ZThn20_N14CLANLinkCommon9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 53 NONAME ; ## + _ZThn20_N27CWlanMetaConnectionProvider9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 54 NONAME ; ## + _ZThn96_N14CLANLinkCommon11GetControlLERK6TDesC8 @ 55 NONAME ; ## + _ZThn96_N14CLANLinkCommon5BindLERK6TDesC8PN5ESock18MUpperDataReceiverEPNS3_13MUpperControlE @ 56 NONAME ; ## + _ZThn96_N14CLANLinkCommon6UnbindEPN5ESock18MUpperDataReceiverEPNS0_13MUpperControlE @ 57 NONAME ; ## + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/etherpkt/CardDll.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/etherpkt/CardDll.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements PcCardPktDrv class +* +*/ + +/* +* %version: 12 % +*/ + +#include +#include +#include "carddrv.h" +#include "EtherCardApi.h" +#include "am_debug.h" +#include "WlanProto.h" +#include "sender_hw.h" +#include "receiver_hw.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::NewDriverL() +// ----------------------------------------------------------------------------- +// +CPcCardPktDrv* CPcCardPktDrv::NewL( CLANLinkCommon* aParent ) + { + // Create the packet driver object + CPcCardPktDrv *drv = new(ELeave) CPcCardPktDrv(); + + CleanupStack::PushL(drv); + drv->ConstructL(aParent); + CleanupStack::Pop(drv); + + return drv; + } + + +// ----------------------------------------------------------------------------- +// CPcCardPktDrv::CPcCardPktDrv() +// ----------------------------------------------------------------------------- +// +// Packet Driver object +CPcCardPktDrv::CPcCardPktDrv() + :iCardOpen( EFalse ) + { + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::~CPcCardPktDrv() +// ----------------------------------------------------------------------------- +// +CPcCardPktDrv::~CPcCardPktDrv() + { + delete iReceiver; + delete iSender; + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::ConstructL() +// ----------------------------------------------------------------------------- +// +void CPcCardPktDrv::ConstructL( CLANLinkCommon* aParent ) + { + DEBUG("CPcCardPktDrv::ConstructL()"); + + iParent = aParent; + + iSender = CSender::NewL( this ); + iReceiver = CReceiver::NewL( this ); + + User::LeaveIfError( iCard.Open() ); + + User::LeaveIfError( iCard.InitialiseBuffers( iFrameXferBlock ) ); + } + + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::StartInterface() +// ----------------------------------------------------------------------------- +// +TInt CPcCardPktDrv::StartInterface() + { + DEBUG("CPcCardPktDrv::StartInterface()"); + // Opens the card and queues a read + // validates + TRAPD( err, StartL() ); + return err; + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::StopInterface() +// ----------------------------------------------------------------------------- +// +TInt CPcCardPktDrv::StopInterface() + { + DEBUG("CPcCardPktDrv::StopInterface()"); + // Closes the card + // validates + Stop(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::ResetInterface() +// ----------------------------------------------------------------------------- +// +TInt CPcCardPktDrv::ResetInterface() + { + DEBUG("CPcCardPktDrv::ResetInterface()"); + Stop(); + TRAPD( err, StartL() ); + return err; + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::Send() +// ----------------------------------------------------------------------------- +// +TInt CPcCardPktDrv::Send( RMBufChain &aPacket ) + { + if( !CardOpen() ) + { + aPacket.Free(); + return KErrNotReady; + } + + return iSender->Send( aPacket ); + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrvFactory::GetInterfaceAddress() +// ----------------------------------------------------------------------------- +// +TUint8* CPcCardPktDrv::GetInterfaceAddress() + { + DEBUG("CPcCardPktDrv::GetInterfaceAddress()"); + + iConfig.SetMax(); + iCard.GetConfig( iConfig ); + + // MAC address is located 3 bytes from the start of the buffer + return( (TUint8*)iConfig.Ptr() )+3; + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrv::StartL() +// ----------------------------------------------------------------------------- +// +void CPcCardPktDrv::StartL() + { + // Open the Card LDD + DEBUG("CPcCardPktDrv::StartL()"); + + iCardOpen = ETrue; + + // We just assume that "link layer" is always immediatedly up + iParent->LinkLayerUp(); + iReceiver->QueueRead(); + } + +// ----------------------------------------------------------------------------- +// CPcCardPktDrv::Stop() +// ----------------------------------------------------------------------------- +// +void CPcCardPktDrv::Stop() + { + DEBUG("CPcCardPktDrv::Stop()"); + + iCard.ResumeTxCancel(); + iSender->Cancel(); + + iCard.ReadCancel(); + iReceiver->Cancel(); + + iCard.ReleaseBuffers(); + + iCard.Close(); + iCardOpen = EFalse; + } + + +/** +* Implementation for methods declared in 802dot11.h +*/ + +// ----------------------------------------------------------------------------- +// os_memcpy +// ----------------------------------------------------------------------------- +// +TAny* os_memcpy( TAny* aDest, const TAny* aSrc, TUint32 aLengthinBytes ) + { + Mem::Copy( aDest, aSrc, aLengthinBytes ); + return aDest; + } + +// ----------------------------------------------------------------------------- +// os_memcmp +// ----------------------------------------------------------------------------- +// +TInt os_memcmp( const TAny* aSrc1, const TAny* aSrc2, TUint32 aLengthinBytes ) + { + return Mem::Compare( reinterpret_cast( aSrc1 ), aLengthinBytes, + reinterpret_cast( aSrc2 ), aLengthinBytes ); + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/etherpkt/receiver_hw.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/etherpkt/receiver_hw.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements receiver class for target +* +*/ + +/* +* %version: 12 % +*/ + +#include +#include "am_debug.h" +#include "receiver_hw.h" +#include "WlanProto.h" +#include "carddrv.h" + +// --------------------------------------------------------- +// CReceiver::CReceiver() +// --------------------------------------------------------- +// +CReceiver::CReceiver( CPcCardPktDrv* aParent ) : + CActive(EPriorityStandard), + iParent(aParent) + { + } + +// --------------------------------------------------------- +// CReceiver::ConstructL() +// --------------------------------------------------------- +// +void CReceiver::ConstructL() + { + DEBUG("CReceiver::ConstructL()"); + } + +// --------------------------------------------------------- +// CReceiver::NewL() +// --------------------------------------------------------- +// +CReceiver* CReceiver::NewL( CPcCardPktDrv* aParent ) + { + DEBUG("CReceiver::NewL()"); + CReceiver* self = new (ELeave) CReceiver( aParent ); + CleanupStack::PushL( self ); + self->ConstructL(); + CActiveScheduler::Add( self ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CReceiver::~CReceiver() +// --------------------------------------------------------- +// +CReceiver::~CReceiver() + { + DEBUG("CReceiver::~CReceiver()"); + Cancel(); + } + +// --------------------------------------------------------- +// CReceiver::DoCancel() +// --------------------------------------------------------- +// +void CReceiver::DoCancel() + { + DEBUG("CReceiver::DoCancel()"); + iParent->iCard.ReadCancel(); + } + +// --------------------------------------------------------- +// CReceiver::QueueRead() +// --------------------------------------------------------- +// +void CReceiver::QueueRead() + { + iParent->iCard.RequestFrame( iStatus ); + SetActive(); + } + + +// --------------------------------------------------------- +// CReceiver::RunL() +// --------------------------------------------------------- +// +void CReceiver::RunL() + { + DEBUG("CReceiver::RunL()" ); + + while( iParent->iFrameXferBlock->GetNextRxDataBuffer( iDataBuffer ) ) + { + TUint8* buf = iDataBuffer->GetBuffer(); + TUint32 len = iDataBuffer->GetLength(); + + //Save the original buf value which points + //to the beginning of the Ethernet header + TUint8* bufOrig = buf; + + DEBUG1("CReceiver::RunL() - packet length: %u", len ); + + if( buf && len > 0 && len <= KMaxEthernetFrameLength ) + { + //Now set buf point to the beginning of the Payload + buf = buf + KEtherHeaderSize; + + len = len - KEtherHeaderSize; + + TPtrC8 pkt(buf, len); + RMBufPacket pFrame; //Payload + TRAPD( ret, pFrame.CreateL( pkt ) ); + if( ret == KErrNone ) + { + pFrame.Pack(); + + iParent->iParent->Process( pFrame, bufOrig, iDataBuffer->UserPriority() ); + } + } + } + + if( iParent->CardOpen() ) + { + QueueRead(); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/etherpkt/sender_common.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/etherpkt/sender_common.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements sender class +* +*/ + +/* +* %version: 12 % +*/ + +#include "am_debug.h" +#include "carddrv.h" +#include "sender_hw.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSender::CSender() +// ----------------------------------------------------------------------------- +// +CSender::CSender() : + CActive( CActive::EPriorityHigh ) + { + } + +// ----------------------------------------------------------------------------- +// CSender::~CSender() +// ----------------------------------------------------------------------------- +// +CSender::~CSender() + { + DEBUG("CSender::~CSender()"); + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSender::NewL() +// ----------------------------------------------------------------------------- +// +CSender* CSender::NewL( CPcCardPktDrv* aParent ) + { + DEBUG("CSender::NewL()"); + + CSender *sd = new(ELeave) CSender; + CleanupStack::PushL( sd ); + sd->InitL(aParent); + CActiveScheduler::Add( sd ); + CleanupStack::Pop( sd ); + return sd; + } + +// ----------------------------------------------------------------------------- +// CSender::InitL() +// ----------------------------------------------------------------------------- +// +void CSender::InitL( CPcCardPktDrv* aParent ) + { + DEBUG("CSender::InitL()"); + + iParent = aParent; + iStopSending = EFalse; + iReqPending = EFalse; + + } + +// ----------------------------------------------------------------------------- +// CSender::DoCancel() +// ----------------------------------------------------------------------------- +// +void CSender::DoCancel() + { + DEBUG("CSender::DoCancel()"); + iParent->iCard.ResumeTxCancel(); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/etherpkt/sender_hw.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/etherpkt/sender_hw.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements sender class for target +* +*/ + +/* +* %version: 15 % +*/ + +#include "am_debug.h" +#include "sender_hw.h" +#include "WlanProto.h" +#include "carddrv.h" + +// Protocol blocks sending if it receives a return <= 0 +// This value should be propogated up through the stack +const TInt KStopSending = 0; +const TInt KContinueSending = 1; + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------- +// CSender::Send() +// --------------------------------------------------------- +// +TInt CSender::Send( RMBufChain& aPacket ) + { + + TInt ret( KContinueSending ); + + TDataBuffer* txDataBuffer = iParent->iCard.AllocTxBuffer( + aPacket.Length() + // size of the packet's UP value + - 1 ); + + if ( txDataBuffer ) + { + //First buffer contains UP value + RMBuf* rmbuf = aPacket.First(); + TInt num = aPacket.NumBufs(); + + TUint8 UPValue = rmbuf->Get(); + + txDataBuffer->SetUserPriority( UPValue ); + + //Frame starts from second buffer + rmbuf = rmbuf->Next(); + num--; + + for( TInt i(0); i < num; i++ ) + { + txDataBuffer->AppendBuffer( rmbuf->Ptr(), rmbuf->Length() ); + + rmbuf = rmbuf->Next(); + } + + if ( !iParent->iCard.AddTxFrame( txDataBuffer ) ) + { + DEBUG("CSender::Send: AddTxPacket returned false => stop flow"); + ret = KStopSending; + iStopSending = ETrue; + RequestResumeTx(); + } + } + else + { + DEBUG("CSender::Send: Tx buf could't be allocated => stop flow"); + + // in this case the Tx packet could possibly be kept - if seen + // feasible - until ResumeTx completes and then re-submitted + + ret = KStopSending; + iStopSending = ETrue; + RequestResumeTx(); + } + + aPacket.Free(); + + return ret; + } + +// --------------------------------------------------------- +// CSender::RequestResumeTx() +// --------------------------------------------------------- +// +void CSender::RequestResumeTx() + { + if ( !iReqPending ) + { + DEBUG("CSender::RequestResumeTx()"); + + iReqPending = ETrue; + SetActive(); + iParent->iCard.ResumeTx( iStatus ); + } + } + +// --------------------------------------------------------- +// CSender::RunL() +// --------------------------------------------------------- +// +void CSender::RunL() + { + // Write completion from the LDD + DEBUG("CSender::RunL()"); + + iReqPending = EFalse; + + if (iStopSending) + { + DEBUG("CSender::RunL(): resume flow"); + iStopSending = EFalse; + iParent->iParent->ResumeSending(); + } + else + { + DEBUG("CSender::RunL(): flow hasn't been stopped"); + } + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project WLAN NIF +* +*/ + +/* +* %version: 11 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// Export iby file +../rom/wlannif.iby CORE_OS_LAYER_IBY_EXPORT_PATH(wlannif.iby) + +PRJ_MMPFILES +wlanproto.mmp +wlannwif.mmp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/group/wlannwif.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/group/wlannwif.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project WLAN NIF +* +*/ + +/* +* %version: 8 % +*/ + +#include + +TARGET wlannwif.dll +TARGETTYPE PLUGIN + +UID 0x10009d8d 0x2001b2d1 +VENDORID 0x101fb657 + +SOURCEPATH ../src +SOURCE WlanCfproto.cpp +SOURCE wlanmcprfactory.cpp +SOURCE ecom_impl.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +OS_LAYER_SYSTEMINCLUDE + +START RESOURCE 2001B2D1.rss +TARGET wlannwif.rsc +END + +LIBRARY euser.lib +LIBRARY esocksvr.lib +LIBRARY wlannif.lib +LIBRARY esock.lib +LIBRARY insock.lib +LIBRARY netmeta.lib +LIBRARY commsfw.lib +LIBRARY nodemessages.lib +LIBRARY meshmachine.lib +LIBRARY netinterfaces.lib +LIBRARY factories.lib +LIBRARY serverden.lib + +#include "comms-infras/commsdebugutility.mmh" + +CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/group/wlanproto.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/group/wlanproto.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project WLAN proto +* +*/ + +/* +* %version: 8 % +*/ + +#include + + +TARGET wlannif.nif +TARGETTYPE DLL +UID 0x1000008d 0x2001b2d4 + +VENDORID 0x101fb657 + +DEFFILE wlanproto.def + +SOURCEPATH ../src +SOURCE Wlanbase.cpp +SOURCE NifWLMServerIf.cpp +SOURCE CLanxBearer.cpp +SOURCE CLanIp4Bearer.cpp +SOURCE CLanIp6Bearer.cpp +SOURCE wlanmcpr.cpp +SOURCE WlanConfig.cpp + +SOURCEPATH ../etherpkt +SOURCE CardDll.cpp +SOURCE sender_common.cpp +SOURCE sender_hw.cpp +SOURCE receiver_hw.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../etherpkt +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY esock.lib +LIBRARY esocksvr.lib +LIBRARY centralrepository.lib +LIBRARY insock.lib +LIBRARY efsrv.lib +LIBRARY mbufmgr.lib +LIBRARY netmeta.lib +LIBRARY commsfw.lib +LIBRARY commsdat.lib +LIBRARY coreproviders.lib +LIBRARY agentprcore.lib +LIBRARY wlmserver.lib +LIBRARY nodemessages.lib +LIBRARY meshmachine.lib +LIBRARY netinterfaces.lib +LIBRARY factories.lib +LIBRARY serverden.lib + +CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/CLanIp4Bearer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/CLanIp4Bearer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines LanIp4Bearer class +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef CLANIP4BEARER_H +#define CLANIP4BEARER_H + +#include "CLanxBearer.h" +#include "WlanProvision.h" + + +NONSHARABLE_CLASS(CLanIp4Bearer) : public CLanxBearer +{ +public: + CLanIp4Bearer(CLANLinkCommon* aLink); + virtual void ConstructL(); + + virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption); + virtual ESock::MLowerDataSender::TSendResult Send(RMBufChain& aPdu); + + // we need to override StartSending in CLanIp4Bearer, because of Dhcp. + virtual void StartSending(CProtocolBase* aProtocol); + + // CLanxBearer + virtual TInt GetConfig(TBinderConfig& aConfig); + + //Additional methods. + // Perhaps need different version of this + virtual TBool WantsProtocol(TUint16 aProtocolCode,const TUint8* aPayload); + virtual void Process(RMBufChain& aPdu); + + // Utilities + virtual const TDesC8& ProtocolName() const; + + // Support for provisioning + virtual void SetProvisionL(const Meta::SMetaData* aProvision); + +private: + void ReadCommDbLanSettingsL(); + + enum {KIPProtocol=0x800, KIP4Protocol=4}; + // 32-bit addresses in IPv4. + TUint32 iLocalAddr; + TUint32 iNetMask; + TUint32 iBroadcastAddr; + TUint32 iDefGateway; + TUint32 iPrimaryDns; + TUint32 iSecondaryDns; + TBool iBroadcastConfigured; + + TBool iArpMsgNext; + + const TLanIp4Provision* iProvision; +}; + +inline CLanIp4Bearer::CLanIp4Bearer(CLANLinkCommon* aLink) : + CLanxBearer(aLink) +{ +} + +#endif // CLANIP4BEARER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/CLanIp6Bearer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/CLanIp6Bearer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines LanIp6Bearer class +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef CLANIP6BEARER_H +#define CLANIP6BEARER_H + +#include "CLanxBearer.h" +#include +#include "WlanProvision.h" + +/** +@internalComponent +*/ +const TUint8 KMulticastPrefix[2] = {0x33, 0x33}; + +struct TIpv6Header +{ + TUint8 GetVersion() { return (TUint8)((iVersionClassHi>>4)&0xff);} + TUint8 GetClass() { return (TUint8)( ((iVersionClassHi<<4)| (iClassLoFlowHi>>4)) &0xff); } + TUint8 iVersionClassHi; // The Upper nybble provides version. + TUint8 iClassLoFlowHi; + TUint16 iFlowLo; // Two bytes, but it doesn't start on a word boundary. + TUint16 iPayloadLength; + TUint8 iNextHeader; + TUint8 iHopLimit; + union + { + TUint8 iSourceAddrB[16]; + TUint16 iSourceAddrW[8]; + TUint32 iSourceAddrL[4]; + }; + union + { + TUint8 iDestAddrB[16]; + TUint16 iDestAddrW[8]; + TUint32 iDestAddrL[4]; + }; +}; + + +NONSHARABLE_CLASS(CLanIp6Bearer) : public CLanxBearer +{ +public: + CLanIp6Bearer(CLANLinkCommon* aLink); + virtual void ConstructL(); + + // MLowerControl + virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption); + virtual TInt GetConfig(TBinderConfig& aConfig); + + // MLowerDataSender + virtual MLowerDataSender::TSendResult Send(RMBufChain& aPdu); + + //Additional methods. + // Perhaps need different version of this + virtual TBool WantsProtocol(TUint16 aProtocolCode,const TUint8* aPayload); + virtual void Process(RMBufChain& aPdu); + virtual void UpdateMACAddr(); + + virtual const TDesC8& ProtocolName() const; + + // Support for provisioning + virtual void SetProvisionL(const Meta::SMetaData* aProvision); + +private: + void ResolveMulticastIp6(TDes8& aDstAddr,RMBufChain& aPdu); + void ReadCommDbLanSettingsL(); + + enum {KIPProtocol=0x800, KIP6Protocol=6}; + + TEui64Addr iEuiMac; + TIp6Addr iPrimaryDns; + TIp6Addr iSecondaryDns; + + const TLanIp6Provision* iProvision; // Provisioning information from SCPR +}; + +inline CLanIp6Bearer::CLanIp6Bearer(CLANLinkCommon* aLink) : + CLanxBearer(aLink) +{ +} + + +#endif // CLANIP6BEARER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/CLanxBearer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/CLanxBearer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines LanxBearer class +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef CLANXBEARER_H +#define CLANXBEARER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class CLANLinkCommon; +class TLanProvision; + +NONSHARABLE_CLASS(CLanxBearer) : public CBase, public ESock::MLowerDataSender, public ESock::MLowerControl +{ +public: + CLanxBearer(CLANLinkCommon* aLink); + virtual void ConstructL(); + + // from MLowerControl + virtual TInt GetName(TDes& aName); + virtual TInt BlockFlow(TBlockOption aOption); + virtual TInt GetConfig(TBinderConfig& aConfig) = 0; + // + + virtual void StartSending(CProtocolBase* aProtocol); + + //Additional methods. + virtual TBool WantsProtocol(TUint16 aProtocolCode, const TUint8* aPayload ) = 0; + virtual void Process( RMBufChain& aPdu ) = 0; + + virtual void UpdateMACAddr(); + CLANLinkCommon* Link() const; + + // Support for CFProtocol based binding sequence + virtual const TDesC8& ProtocolName() const = 0; + void SetUpperPointers(ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); + TBool MatchesUpperControl(const ESock::MUpperControl* aControl) const; + + // Support for provisioning + virtual void SetProvisionL(const Meta::SMetaData* aProvision) = 0; + +protected: // Data + ESock::MUpperControl* iUpperControl; + ESock::MUpperDataReceiver* iUpperReceiver; + CLANLinkCommon* iLink; + TInterfaceName iIfName; + + // cache connection info to avoid dbms access after resume sending scenario + TSoIfConnectionInfo iSoIfConnectionInfo; + TBool iSoIfConnectionInfoCached; +}; + +inline CLANLinkCommon* CLanxBearer::Link() const +{ + return iLink; +} + +#endif // CLANXBEARER_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/NifWLMServerIf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/NifWLMServerIf.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,289 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Defines class for interaction with WLMServer for Admission control purpose +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef __NIFWLMSERVERIF_H__ +#define __NIFWLMSERVERIF_H__ + +#include "WlanProto.h" +#include "rwlmserver.h" + +/** + * This class contains the information of a single access class + * and includes methods for manipulating traffic streams of that + * particular class. + */ +NONSHARABLE_CLASS( CLANNifWLMServerPerAC ) : public CActive + { + +public: + + /** + * Definitions for possible active object states. + */ + enum TActiveObjectContext + { + /** Traffic stream create request is ongoing. */ + ETSCreateRequest, + /** Traffic stream inactivity timer is running. */ + ETSDelTimer + }; + + /** + * Factory method for creating an instance of CLANNifWLMServerPerAC. + * + * @param aAccessClass Access class definition for this instance. + * @param aInactivityTime Inactivity time in microseconds after which + * the current traffic stream will be deleted. + * @param aIsAutomaticMgmt Whether automatic stream management is allowed. + * @return Pointer to the created instance. + */ + static CLANNifWLMServerPerAC* NewL( + TWlmAccessClass aAccessClass, + TUint aInactivityTime, + TBool aIsAutomaticMgmt ); + + /** + * Destructor. + */ + virtual ~CLANNifWLMServerPerAC(); + + /** + * Whether traffic is admitted on this access class. + * + * @return ETrue if traffic is admitted, EFalse otherwise. + */ + TBool IsAdmitted(); + + /** + * Set the traffic mode for this access class. + * + * @param aMode Traffic mode to set. + */ + void SetTrafficMode( + TWlmAcTrafficMode aMode ); + + /** + * Set the traffic status for this access class. + * + * @param aStatus Traffic status to set. + */ + void SetTrafficStatus( + TWlmAcTrafficStatus aStatus ); + + /** + * Suspend the inactivity timer. + */ + void SuspendInactivityTimer(); + + /** + * Resume a suspended inactivity timer. + */ + void ResumeInactivityTimer(); + + /** + * Called by CLANLinkCommon when a packet is sent on this + * particular access class. + */ + void OnFrameSend(); + + /** + * Called by CLANLinkCommon when a packet has been received on this + * particular access class. + */ + void OnFrameReceive(); + +protected: // From CActive + + /** + * From CActive. + * Called by the active object framework when a request has been completed. + */ + void RunL(); + + /** + * From CActive. + * Called by the framework if RunL leaves. + * + * @param aError The error code RunL leaved with. + * @return KErrNone if leave was handled, one of the system-wide error codes otherwise. + */ + TInt RunError( + TInt aError ); + + /** + * From CActive. + * Called by the framework when Cancel() has been called. + */ + void DoCancel(); + +private: + + /** + * Constructor. + */ + CLANNifWLMServerPerAC( + TWlmAccessClass aAccessClass, + TUint aInactivityTime, + TBool aIsAutomaticMgmt ); + + /** + * Second phase constructor. + */ + void ConstructL(); + +private: // Data + + /** + * Handle to client API instance of WLAN Engine. + */ + RWLMServer iWlmServer; + + /** + * Contains the access class definition for this instance. + */ + const TWlmAccessClass iAccessClass; + + /** + * Current traffic mode. + */ + TWlmAcTrafficMode iTrafficMode; + + /** + * Current traffic status. + */ + TWlmAcTrafficStatus iTrafficStatus; + + /** + * Current Active Object context. + */ + TActiveObjectContext iContext; + + /** + * Whether a traffic stream has been created. + */ + TBool iIsTsCreated; + + /** + * ID of the current traffic stream. + */ + TUint iTsId; + + /** + * Traffic stream parameters. + */ + TWlanTrafficStreamParameters iTsParams; + + /** + * Status of the traffic stream. + */ + TWlanTrafficStreamStatus iTsStatus; + + /** + * Inactivity time in microseconds after which the current traffic stream + * will be deleted. + */ + const TUint iTsInactivityTime; + + /** + * TS Deletion timer related variables. + */ + TTimeIntervalMicroSeconds32 iTsDelOrigTime; + TTimeIntervalMicroSeconds32 iTsDelRemainTime; + RTimer iTsDelTimer; + TTime iTsDelStartTime; + + /** + * Whether automatic stream management is allowed. + */ + TBool iIsAutomaticMgmt; + + }; + +/** + * This class implements the callback interface for + * asynchronous notifications from WLAN engine. + */ +NONSHARABLE_CLASS ( CLANNifWLMServerCommon ) : public MWLMNotify + { + +public: + + /** + * Constructor. + */ + CLANNifWLMServerCommon( + CLANLinkCommon *aLinkCommon ); + + /** + * Destructor. + */ + ~CLANNifWLMServerCommon(); + + /** + * Second phase constructor. + */ + void ConstructL(); + + /** + * Get the current traffic status for access classes. + * + * @param aArray Traffic status for access classes. + * @return KErrNone if information is available, an error otherwise. + */ + TInt GetAcTrafficStatus( + TWlmAcTrafficStatusArray& aArray ); + +public: // From MWLMNotify + + /** + * From MWLMNotify. + * The traffic mode of an access class has changed. + * + * @param aAccessClass Access class. + * @param aMode Traffic mode of the access class. + */ + void AccessClassTrafficModeChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficMode aMode ); + + /** + * From MWLMNotify. + * The traffic status of an access class has changed. + * + * @param aAccessClass Access class. + * @param aStatus Traffic status of the access class. + */ + void AccessClassTrafficStatusChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficStatus aStatus ); + +private: // Data + + /** Handle to CLANLinkCommon object. Not owned by this pointer. */ + CLANLinkCommon* iLinkCommon; + + /** Handle to client API instance of WLAN Engine. */ + RWLMServer iWlmServer; + + }; + +#endif //__NIFWLMSERVERIF_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/WlanCfproto.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/WlanCfproto.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines WLAN CFP flow factory +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef __WLANCFPROTO_H__ +#define __WLANCFPROTO_H__ + +/** +* Header file declaring the WLAN CFProtocol ECOM factories +*/ + +#include +#include +#include +#include + +/** +Wlan SubConnFlow Implementation UID +*/ +const TInt KWlanFlowImplementationUid = 0x2001B2D3; + + +class CWlanSubConnectionFlowFactory : public ESock::CSubConnectionFlowFactoryBase +/** +Wlan Flow Factory +*/ + { +public: + static CWlanSubConnectionFlowFactory* NewL(TAny* aConstructionParameters); + virtual ESock::CSubConnectionFlowBase* DoCreateFlowL(ESock::CProtocolIntfBase* aProtocolIntf, ESock::TFactoryQueryBase& aQuery); +protected: + CWlanSubConnectionFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer); + }; + +#endif // __WLANCFPROTO_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/WlanProto.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/WlanProto.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,385 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Protocol definitions +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef __WLANPROTO_H__ +#define __WLANPROTO_H__ + + +#include "wlmclientserver.h" +#include "wlancontrolinterface.h" + +#include +#include + +#include +#include + +class TLanIp4Provision; +class TLanIp6Provision; + +const TUint KWlannifMajorVersionNumber = 0; +const TUint KWlannifMinorVersionNumber = 0; +const TUint KWlannifBuildVersionNumber = 0; + +const TInt KEtherMaxDataLen = 1500; +// This should actually be 1492, +// but we allow 8 bytes more because at least in WINS we may receive such packets... +const TInt KEtherLLCMaxDataLen = 1500; +// Allow 8 bytes more. Some sources say we should allow even more +// => change this if needed. (e.g. http://www.cisco.com/warp/public/105/encheat.html: +// max length field value 0x5EE (1518)) +const TInt KEtherLLCMaxLengthFieldValue = 1508; +// I guess this value is ok also for WLAN. +// (Ideally we should ask this from the drivers but there isn't any API for that at the moment.) +const TInt KEtherSpeedInKbps = 10000; +const TInt KMinEtherType = 0x0600; // 1536 + +/******************************************************************************* +* A quick intro to the Ethernet packet format: +* +* A plain frame looks like this: +* +* struct EtherFrame { +* TUint64 iDestAddr, iSrcAddr; +* TUint16 iType; // ether type, should be >= 1536 (0x0600) (must not conflict with IEEE 802.3 length field) +* TUint8 iData[1500]; // Payload. +* }; +* +* iType denotes the type of the payload, 0x0800 denotes IP. +* 0x0806 denotes ARP. +* <= 1500 denotes IEEE 802.3 encapsulation and is interpreted as length +* A frame may also contain an extra 'LLC' field which encapsulates the original +* payload in a 5 byte header. The LLC field is somewhat complex, but here we +* confine ourselves to the LLC-SNAP variant. +* +* struct EtherLLCFrame { +* TUint64 iDestAddr, iSrcAddr; +* TUint16 iLen; // length, must be <=1500 +* TUint8 iDSAP=0xAA; // Which denotes an LLC-SNAP frame. +* TUint8 iSSAP=0xAA; // Which denotes an LLC-SNAP frame. +* TUint8 iCTRL=3; // Which denotes an LLC-SNAP frame encapsulated by +* // Ethernet. +* TUint24 OUI=iDstAddr&0xffffff; // 0 is also a valid value. +* TUint16 iType; // The actual iType as described earlier. +* TUint8 iData[1492]; // Payload. +* }; +* +*******************************************************************************/ + +_LIT8(KWlanLog, "Wlannwif"); + +const TUint32 KMACByteLength = 6; +// Ethernet types (ref. e.g. http://www.iana.org/assignments/ethernet-numbers) +const TUint16 KIPFrameType = 0x0800; // IPv4 ether type +const TUint16 KIP6FrameType = 0x86DD; // IPv6 ether type +const TUint16 KArpFrameType = 0x0806; // ARP ether type +// 802.2 LLC constants +const TUint8 KLLC_SNAP_DSAP = 0xAA; +const TUint8 KLLC_SNAP_SSAP = 0xAA; +const TUint8 KLLC_SNAP_CTRL = 3; + +// Ethernet header types +enum TEtherHeaderType + { + EStandardEthernet, + ELLCEthernet + }; + +const TUint KEtherHeaderSize = 14; +const TUint KEtherLLCHeaderSize = KEtherHeaderSize + 8; + +struct TEtherFrame + { + TUint16 GetType() { return BigEndian::Get16((TUint8*)&iType); } + TUint16 iDestAddr[3]; + TUint16 iSrcAddr[3]; + TUint16 iType; + TUint8 iData[KEtherMaxDataLen]; + }; + +struct TEtherLLCFrame + { + TUint16 GetType() {return(TUint16)((iTypeHi<<8)|iTypeLo);} + void SetType(TUint16 aType) + { + iTypeHi=(TUint8)(aType>>8); + iTypeLo=(TUint8)(aType&0xff); + } + void SetDestAddr( TDesC8& aDest); + void SetSrcAddr( TDesC8& aSrc); + void SetOUI( TUint32 aOUI); + TUint16 iDestAddr[3]; + TUint16 iSrcAddr[3]; + union + { + TUint16 iLen; + TUint16 iType; + }; + TUint8 iDSAP; + TUint8 iSSAP; + TUint8 iCtrl; + TUint8 OUI[3]; + TUint8 iTypeHi; + TUint8 iTypeLo; + TUint8 iData[KEtherLLCMaxDataLen]; + }; + +/** + * User priority values as defined 802.1D specification. + */ +enum T8021DPriority + { + E8021DUserPriorityBE = 0, // Best Effort + E8021DUserPriorityBK1 = 1, // Background + E8021DUserPriorityBK2 = 2, // Background + E8021DUserPriorityEE = 3, // Excellent Effort + E8021DUserPriorityCL = 4, // Controlled Load + E8021DUserPriorityVI = 5, // Video + E8021DUserPriorityVO = 6, // Voice + E8021DUserPriorityNC = 7, // Network Control + E8021DUserPriorityMax = 8 // Defined as the upper bound + }; + +/** + * Mapping of access classes to the corresponding user priority values. + */ +const T8021DPriority KACtoUP[EWlmAccessClassMax] = + { + E8021DUserPriorityBE, // EWlmAccessClassBackground + E8021DUserPriorityBK2, // EWlmAccessClassBestEffort + E8021DUserPriorityCL, // EWlmAccessClassVideo + E8021DUserPriorityVO, // EWlmAccessClassVoice + }; + +//forward declaration +class CLANNifWLMServerCommon; +class CLANNifWLMServerPerAC; +class CPcCardPktDrv; +class CLanxBearer; + +typedef CArrayPtrFlat CLanxBearerPtrArray; + +/** +* CLANLinkCommon +*/ +class CLANLinkCommon : public ESock::CSubConnectionFlowBase, public ESock::MFlowBinderControl + { + friend class CPktDrvBase; + +public: + enum TAction + { + EReconnect, + EDisconnect + }; + + IMPORT_C static CLANLinkCommon* NewL(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); + IMPORT_C CLANLinkCommon(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); + IMPORT_C virtual ~CLANLinkCommon(); + IMPORT_C void ConstructL(); + + // from MFlowBinderControl + IMPORT_C virtual ESock::MLowerControl* GetControlL(const TDesC8& aProtocol); + IMPORT_C virtual ESock::MLowerDataSender* BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); + IMPORT_C virtual void Unbind(ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); + virtual ESock::CSubConnectionFlowBase* Flow() + { + return this; + } + + // from MCFNode + IMPORT_C virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); + + // Dispatch functions for messages received from SCPR. + + void StartFlowL(); + void CancelStartFlow(); + void StopFlow(TInt aError); + void SubConnectionGoingDown(); + void SubConnectionError(TInt aError); + void BindToL(Messages::TNodeId& aCommsBinder); + + void Destroy(); + + // Utility functions for sending messages to SCPR. + void PostProgressMessage(TInt aStage, TInt aError); + void PostDataClientStartedMessage(); + void PostFlowDownMessage(TInt aError); + void PostFlowGoingDownMessage(TInt aError, MNifIfNotify::TAction aAction); + void MaybePostDataClientIdle(); + + // CSubConnectionFlowBase + MFlowBinderControl* DoGetBinderControlL() + { + return this; + } + + void Process( RMBufChain& aPdu, TUint8* aEtherHeader, TUint8 aUPValue ); + IMPORT_C void ResumeSending(); // Flow Control unblocked + IMPORT_C void LinkLayerUp(); // Notify the Protocol that the line is up + IMPORT_C void LinkLayerDown(TInt aError, TAction aAction); // Notify the Protocol that the line is down + + IMPORT_C TInt ReadInt(const TDesC& aField, TUint32& aValue); + IMPORT_C TInt WriteInt(const TDesC& aField, TUint32 aValue); + IMPORT_C TInt ReadDes(const TDesC& aField, TDes8& aValue); + IMPORT_C TInt ReadDes(const TDesC& aField, TDes16& aValue); + IMPORT_C TInt WriteDes(const TDesC& aField, const TDesC8& aValue); + IMPORT_C TInt WriteDes(const TDesC& aField, const TDesC16& aValue); + IMPORT_C TInt ReadBool(const TDesC& aField, TBool& aValue); + IMPORT_C TInt WriteBool(const TDesC& aField, TBool aValue); + IMPORT_C void IfProgress(TInt aStage, TInt aError); + IMPORT_C void IfProgress(TSubConnectionUniqueId aSubConnectionUniqueId, TInt aStage, TInt aError); + IMPORT_C void NifEvent(TNetworkAdaptorEventType aEventType, TUint aEvent, const TDesC8& aEventData, TAny* aSource=0); + + + TUint Mtu() const; + TUint SpeedMetric() const {return KEtherSpeedInKbps;} + + const TBuf8& MacAddress() const; + + TInt FrameSend(RMBufChain& aPdu, TDesC8& aDestAddr, TUint16 aType ); + void SetAllowedBearer(CLanxBearer* aBearer); + TBool BearerIsActive(CLanxBearer* aBearer); + +public: // Admission control related functions + + /** + * The traffic mode of an access class has changed. + * + * @param aAccessClass Access class. + * @param aMode Traffic mode of the access class. + */ + void AcTrafficModeChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficMode aMode ); + + /** + * The traffic status of an access class has changed. + * + * @param aAccessClass Access class. + * @param aStatus Traffic status of the access class. + */ + void AcTrafficStatusChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficStatus aStatus ); + +private: + + // Configuration methods + TBool ReadMACSettings(); + void ReadEthintSettingsL(); + + TInt EtherFrame( + RMBufChain &aChain, + TDesC8& aDestAddr, + TUint16 aType, + TUint8& aDscp ); + + // checks that the packet driver has returned a valid MAC address, + TBool CheckMac( TDes8& aMacAddr ); + + + TInt GetProtocolType( + TUint8* aEtherHeader, + TUint16& aEtherType ); + + static TInt StopCb(TAny* aThisPtr); + void StopInterface(); + + /** + * DownGradePacket + * @param aUP: downgraded UP value + * @param aDrop: sets to ETrue if packet to be dropped + * Downgrades the UP value of the packet if stream is not created. Also decides if packet to be + * dropped. This can happen if ACM is set for all traffic streams and TS is not yet created + */ + void DownGradePacket(T8021DPriority& aUP, TBool& aDrop); + + + // Driver management + void LoadPacketDriverL(); + + + // Search CLanxBearer array by various keys (used in bind/unbind/provisioning) + CLanxBearer* FindBearerByProtocolName(const TDesC8& aProtocol, TInt& aIndex) const; + CLanxBearer* FindBearerByUpperControl(const ESock::MUpperControl* aUpperControl, TInt& aIndex) const; + + // Provisioning + void ProvisionConfig(const ESock::RMetaExtensionContainerC& aConfigData); + void ProvisionConfigL(); + void ProvisionBearerConfigL(const TDesC8& aName); + +protected: + + CPcCardPktDrv* iPktDrv; + + /** */ + TBuf8 iMacAddr; + + /** Handle to the NIF-WLAN engine interface class. */ + CLANNifWLMServerCommon* iWLMServerCommon; + + /** Array containing handles to per-AC instances. */ + CLANNifWLMServerPerAC* iAcArray[EWlmAccessClassMax]; + + /** indicates if iMacAddr contains a valid Mac address */ + TBool iValidMacAddr; + + enum TlanIfStatus {EIfPending, EIfUp, EIfBusy, EIfDown}; + /** */ + TlanIfStatus iState; + + /** */ + TEtherHeaderType iEtherType; + + /** Bearer List */ + CLanxBearerPtrArray *iBearers; + CLanxBearer *iOnlyThisBearer; + + /** iPeriodic and iError needed for sending DHCPRELEASE when the + * interface is being closed + */ + CPeriodic* iPeriodic; + + // Provisioning related + const TLanIp4Provision* iLanIp4Provision; // ip4 provisioning information from SCPR + const TLanIp6Provision* iLanIp6Provision; // ip6 provisioning information from SCPR + TBool iStopRequested; + + TInt iError; // Saved from StopFlow() argument + TInt iSavedError; // saved errors from processing TProvisionConfig message + + enum TMeshMashineFlowState + { + EStopped, + EStarting, + EStarted, + EStopping, + }; + TMeshMashineFlowState iMMState; +}; + +inline const TBuf8& CLANLinkCommon::MacAddress() const +{ + return iMacAddr; +} + +#endif // __WLANPROTO_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/WlanProvision.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/WlanProvision.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provisioning information for WLAN IP bearers +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef __WLANPROVISION_H__ +#define __WLANPROVISION_H__ + + +#include +#include + + +/** +Provisioning information for CLanIp4Bearer +*/ +class TLanIp4Provision : public Meta::SMetaData + { +public: + enum + { + EUid = 0x2001B2D3, ETypeId = 1 + }; + +public: + inline TUint32 LocalAddr() const; + inline TUint32 NetMask() const; + inline TUint32 BroadcastAddr() const; + inline TUint32 DefGateway() const; + inline TUint32 PrimaryDns() const; + inline TUint32 SecondaryDns() const; + inline TUint32 Order() const; + + inline void SetLocalAddr(TUint32); + inline void SetNetMask(TUint32); + inline void SetBroadcastAddr(TUint32); + inline void SetDefGateway(TUint32); + inline void SetPrimaryDns(TUint32); + inline void SetSecondaryDns(TUint32); + inline void SetOrder(TUint32); + +private: + TUint32 iLocalAddr; + TUint32 iNetMask; + TUint32 iBroadcastAddr; + TUint32 iDefGateway; + TUint32 iPrimaryDns; + TUint32 iSecondaryDns; + TUint32 iOrder; + +public: + DATA_VTABLE + }; + +/** +Provisioning information for CLanIp6Bearer +*/ +class TLanIp6Provision : public Meta::SMetaData + { +public: + enum + { + EUid = 0x2001B2D3, ETypeId = 2 + }; + +public: + inline const TIp6Addr& PrimaryDns() const; + inline const TIp6Addr& SecondaryDns() const; + inline TUint32 Order() const; + + inline void SetPrimaryDns(const TIp6Addr&); + inline void SetSecondaryDns(const TIp6Addr&); + inline void SetOrder(TUint32); + +private: + TIp6Addr iPrimaryDns; + TIp6Addr iSecondaryDns; + TUint32 iOrder; + +public: + DATA_VTABLE + }; + + +// TLanIp4Provision inline functions + +inline TUint32 TLanIp4Provision::LocalAddr() const { return iLocalAddr; } + +inline TUint32 TLanIp4Provision::NetMask() const { return iNetMask; } + +inline TUint32 TLanIp4Provision::BroadcastAddr() const { return iBroadcastAddr; } + +inline TUint32 TLanIp4Provision::DefGateway() const { return iDefGateway; } + +inline TUint32 TLanIp4Provision::PrimaryDns() const { return iPrimaryDns; } + +inline TUint32 TLanIp4Provision::SecondaryDns() const { return iSecondaryDns; } + +inline TUint32 TLanIp4Provision::Order() const { return iOrder; } + +inline void TLanIp4Provision::SetLocalAddr(TUint32 aLocalAddr) { iLocalAddr = aLocalAddr; } + +inline void TLanIp4Provision::SetNetMask(TUint32 aNetMask) { iNetMask = aNetMask; } + +inline void TLanIp4Provision::SetBroadcastAddr(TUint32 aBroadcastAddr) { iBroadcastAddr = aBroadcastAddr; } + +inline void TLanIp4Provision::SetDefGateway(TUint32 aDefGateway) { iDefGateway = aDefGateway; } + +inline void TLanIp4Provision::SetPrimaryDns(TUint32 aPrimaryDns) { iPrimaryDns = aPrimaryDns; } + +inline void TLanIp4Provision::SetSecondaryDns(TUint32 aSecondaryDns) { iSecondaryDns = aSecondaryDns; } + +inline void TLanIp4Provision::SetOrder(const TUint32 aOrder) { iOrder = aOrder; } + + +// TLanIp6Provision inline functions + +inline const TIp6Addr& TLanIp6Provision::PrimaryDns() const { return iPrimaryDns; } + +inline const TIp6Addr& TLanIp6Provision::SecondaryDns() const { return iSecondaryDns; } + +inline TUint32 TLanIp6Provision::Order() const { return iOrder; } + +inline void TLanIp6Provision::SetPrimaryDns(const TIp6Addr& aPrimaryDns) { iPrimaryDns = aPrimaryDns; } + +inline void TLanIp6Provision::SetSecondaryDns(const TIp6Addr& aSecondaryDns) { iSecondaryDns = aSecondaryDns; } + +inline void TLanIp6Provision::SetOrder(const TUint32 aOrder) { iOrder = aOrder; } + +#endif // __WLANPROVISION_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/carddrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/carddrv.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines CardPktDrv class +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef __CARDDRV_H__ +#define __CARDDRV_H__ + +#include +#include + +#include "802dot11.h" +#include "RWlanLogicalChannel.h" +#include "EtherCardApi.h" +#include + +const TUint KWlanpktDrvMajorVersionNumber = 0; +const TUint KWlanpktDrvMinorVersionNumber = 0; +const TUint KWlanpktDrvBuildVersionNumber = 0; + +const TInt KConfigBufferSize = 12; + +class CSender; +class CReceiver; +class CLANLinkCommon; + + +/** +* CPcCardPktDrv +* +*/ +class CPcCardPktDrv : public CBase + { +public: + + friend class CSender; + + friend class CReceiver; + + /** + * NewL + * @param aParent + * @return + */ + static CPcCardPktDrv* NewL( CLANLinkCommon* aParent ); + + /** + * constructor + */ + CPcCardPktDrv(); + + /** + * destructor + */ + virtual ~CPcCardPktDrv(); + + /** + * ConstructL + * @param aParent + */ + void ConstructL( CLANLinkCommon* aParent ); + + /** + * StartInterface + * @return + */ + TInt StartInterface(); + + /** + * StopInterface + * @return + */ + TInt StopInterface(); + + /** + * ResetInterface + * @return + */ + TInt ResetInterface(); + + /** + * GetInterfaceAddress + * @return + */ + TUint8* GetInterfaceAddress(); + + /** + * Send + * @param aPkt + * @return + */ + TInt Send( RMBufChain& aPkt ); + + /** + * StartL + */ + void StartL(); + + /** + * Stop + */ + void Stop(); + + /** + * CardOpen + * @return + */ + TBool CardOpen() {return iCardOpen;}; + +private: + + /** */ + CLANLinkCommon* iParent; + + /** */ + TBool iCardOpen; + + /** */ + TBuf8 iConfig; + /** */ + CSender* iSender; + /** */ + CReceiver* iReceiver; + /** */ + RPcmNetCardIf iCard; + + /** */ + RFrameXferBlockProtocolStack* iFrameXferBlock; + + }; + +#endif // __CARDDRV_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/receiver_hw.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/receiver_hw.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines receiver class for target +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef _RECEIVER_HW_H_ +#define _RECEIVER_HW_H_ + +#include + +class CLANLinkCommon; +class CPcCardPktDrv; +class TDataBuffer; + +/** +* Receiver active object +* +*/ +class CReceiver : public CActive + { +public: // Methods + + // NewL + static CReceiver* NewL( CPcCardPktDrv* aParent ); + + // destructor + virtual ~CReceiver(); + + /** + * Requests a new data frame from LDD. Calls SetActive(). + */ + void QueueRead(); + +private: // Methods + /** + * C++ constructor + * @param aParent + */ + CReceiver( CPcCardPktDrv* aParent ); + + /** + * RunL + */ + void RunL(); + + /** + * DoCancel + */ + void DoCancel(); + + /** + * Symbian second phase constructor + */ + void ConstructL(); + + // Prohibit copy constructor + CReceiver(const CReceiver&); + // Prohibit assigment operator + CReceiver& operator= (const CReceiver&); + +private: // Data + + /** */ + CPcCardPktDrv* iParent; + + /** */ + TDataBuffer* iDataBuffer; + + }; + +#endif //_RECEIVER_HW_H_ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/sender_hw.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/sender_hw.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines sender class for target +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef _SENDER_HW_H_ +#define _SENDER_HW_H_ + +#include +#include + +class CLANLinkCommon; +class CPcCardPktDrv; + +/** +* Sender active object +* +*/ +class CSender : public CActive + { + +public: + + // NewL + static CSender* NewL(CPcCardPktDrv* aParent); + + // destructor + ~CSender(); + + /** + * Send is called by upper layers to send data. + * @param aPacket data packet to be sent + * @return 0 if CSender isn't currently ready to accept more data, + * 1 if CSender is ready to accept more data immediately + */ + TInt Send( RMBufChain& aPacket ); + +private: + + /** + * C++ default constructor. + */ + CSender(); + + /** + * RunL + */ + virtual void RunL(); + + /** + * DoCancel + */ + virtual void DoCancel(); + + /** + * InitL + * Initialises CSender + * @param aParent CPcCardControlEngine parent class + */ + void InitL( CPcCardPktDrv* aParent ); + + /** + * Requests notification once Tx is once again allowed + * sets the CSender active object as active. + */ + void RequestResumeTx(); + + // Prohibit copy constructor + CSender( const CSender& ); + // Prohibit assigment operator + CSender& operator= ( const CSender& ); + +private: // Data + + /** */ + CPcCardPktDrv* iParent; + + /** */ + TBool iStopSending; + + /** */ + TBool iReqPending; + + }; + +#endif //_SENDER_HW_H_ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/wlanmcpr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/wlanmcpr.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines WLAN meta connection provider +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef __WLANMCPR_H__ +#define __WLANMCPR_H__ + +#include +#include + + +namespace WlanMCprStates + { + class TSendProvision; + DECLARE_EXPORT_ACTIVITY_MAP(stateMap) + } + +class CWlanMetaConnectionProviderFactory; + +class CWlanMetaConnectionProvider : public CAgentMetaConnectionProvider + { + friend class WlanMCprStates::TSendProvision; + +public: + typedef CWlanMetaConnectionProviderFactory FactoryType; + + IMPORT_C static CWlanMetaConnectionProvider* NewL(ESock::CMetaConnectionProviderFactoryBase& aFactory, const ESock::TProviderInfo& aProviderInfo); + IMPORT_C virtual ~CWlanMetaConnectionProvider(); + +protected: + IMPORT_C CWlanMetaConnectionProvider(ESock::CMetaConnectionProviderFactoryBase& aFactory, + const ESock::TProviderInfo& aProviderInfo, + const MeshMachine::TNodeActivityMap& aActivityMap); + + void SetAccessPointConfigFromDbL(); + IMPORT_C virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); + IMPORT_C void ConstructL(); + +private: + void ProvisionNetworkConfigL(ESock::CCommsDatIapView* aIapView, ESock::RMetaExtensionContainer& aMec); + void ProvisionIp4ConfigL(ESock::CCommsDatIapView* aIapView, TUint32 aOrder, ESock::RMetaExtensionContainer& aMec); + void ProvisionIp6ConfigL(ESock::CCommsDatIapView* aIapView, TUint32 aOrder, ESock::RMetaExtensionContainer& aMec); + }; + +#endif // __WLANMCPR_H__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/inc/wlanmcprfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/inc/wlanmcprfactory.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines WLAN meta connection provider factory +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef __WLANMCPRFACTORY_H__ +#define __WLANMCPRFACTORY_H__ + +#include + +class CWlanMetaConnectionProviderFactory : public ESock::CMetaConnectionProviderFactoryBase + { +public: + enum { iUid = 0x2001B2D2 }; + static CWlanMetaConnectionProviderFactory* NewL(TAny* aParentContainer); + +protected: + CWlanMetaConnectionProviderFactory(TUid aFactoryId, ESock::CMetaConnectionFactoryContainer& aParentContainer); + + ESock::ACommsFactoryNodeId* CWlanMetaConnectionProviderFactory::DoCreateObjectL(ESock::TFactoryQueryBase& aQuery); + }; + +#endif //__WLANMCPRFACTORY_H__ + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/rom/wlannif.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/rom/wlannif.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project WLAN NIF +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef __WLANNIF_IBY__ +#define __WLANNIF_IBY__ +#include + +#ifdef __PROTOCOL_WLAN + +file=ABI_DIR\BUILD_DIR\wlannif.nif SHARED_LIB_DIR\wlannif.nif + +ECOM_PLUGIN(wlannwif.dll,2001b2d1.rss) + +#endif // __PROTOCOL_WLAN + +#endif // __WLANNIF_IBY__ diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/2001B2D1.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/2001B2D1.rss Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registry info for Wlan CFProtocol ECOM plug-in +* +*/ + +/* +* %version: 4 % +*/ + +#include "ecom/registryinfo.rh" + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x2001B2D1; +interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10281C33; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001B2D3; + version_no = 1; + display_name = "Wlan SubConnectionFlow Factory"; + default_data = "WlanInt"; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = 0x10274546; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001B2D2; + version_no = 1; + display_name = "Wlan Meta Connection Provider Factory"; + default_data = "WlanMCprFactory"; + opaque_data = ""; + } + }; + } + }; +} diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/CLanIp4Bearer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/CLanIp4Bearer.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,338 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements IPv4 bearer +* +*/ + +/* +* %version: 12 % +*/ + +#include // Header is retained, but in_sock.h is modified for ipv6 +#include +#include +#include +#include +#include "CLanIp4Bearer.h" +#include "arp_hdr.h" +#include +#include +#include "WlanProto.h" +#include +#include "WlanProvision.h" + +// From Wlan +#include "am_debug.h" +#include "rwlmserver.h" + +// Avoiding a warning in armv5 urel +#ifdef _DEBUG +_LIT(KCLanIp4BearerName,"EthWlan4"); +#endif /* _DEBUG */ + +using namespace ESock; + +/** +Required ConstructL() method. Performs the following: +" Sets a unique name for this binder instance in the iIfName field - "wlan[0x%x]" where "%x" + is the hexadecimal address of the "this" object. +" Reads the IP Interface Settings using ReadIPInterfaceSettingsL(). +*/ +void CLanIp4Bearer::ConstructL() +{ + DEBUG("CLanIp4Bearer::ConstructL()"); + + iIfName.Format(_L("wlan[0x%08x]"), this); + iBroadcastConfigured = EFalse; + iArpMsgNext = EFalse; + // ReadCommDbLanSettingsL() moved from here to point when provisioning information received + +} + +TInt CLanIp4Bearer::Control(TUint aLevel, TUint aName, TDes8& aOption) + { + DEBUG("CLanIp4Bearer::Control()"); + + if ((aLevel==KCOLInterface) || (aLevel==KSOLInterface)) + { + switch (aName) + { + case KSoIfHardwareAddr: + { + typedef TPckgBuf THwAddr; + THwAddr& theHwAddrRef = static_cast(aOption); + theHwAddrRef().iHardwareAddr.SetFamily(1); + theHwAddrRef().iHardwareAddr.SetPort(KArpHarwareType_ETHERNET); + theHwAddrRef().iHardwareAddr.SetLength(sizeof(SSockAddr)); + theHwAddrRef().iHardwareAddr.Append(Link()->MacAddress()); + return KErrNone; + } + default: + break; + } + } + + else if (aLevel==KSolInetIp) + { + switch (aName) + { + case KSoIp6LeaveGroup: + case KSoIp6JoinGroup: + { + + // Convert multicast IPv4 address to multicast MAC address + TIp6Mreq& opt = *(TIp6Mreq*)aOption.Ptr(); + TUint8* tmp = opt.iAddr.u.iAddr8; + TMacAddress mac; + mac.iMacAddress[0] = 0x01; + mac.iMacAddress[1] = 0x00; + mac.iMacAddress[2] = 0x5E; + mac.iMacAddress[3] = tmp[13]; + mac.iMacAddress[3] &= 0x7F; // Most significant bit is set zero + mac.iMacAddress[4] = tmp[14]; + mac.iMacAddress[5] = tmp[15]; + + TIp6Addr addr6 = opt.iAddr; + TInetAddr addr(addr6, 0); + TBuf<39> aa; + addr.Output(aa); + + if(aName == KSoIp6JoinGroup) + DEBUG1("CLanIp4Bearer::Control() - joining multicast address:%S", &aa); + else + DEBUG1("CLanIp4Bearer::Control() - leaving multicast address:%S", &aa); + + TInt ret = KErrNone; + RWLMServer wlmServer; + ret = wlmServer.Connect(); + if( ret ) + { + DEBUG1("CLanIp4Bearer::Control()- ERROR connecting RWlmServer: %d", ret); + return ret; + } + else + { + ret = wlmServer.ConfigureMulticast( aName, mac ); + wlmServer.Close(); + return KErrNone; + } + } + default: + break; + } + } + + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::Send +// ----------------------------------------------------------------------------- +// +MLowerDataSender::TSendResult CLanIp4Bearer::Send(RMBufChain& aPdu) + { + DEBUG("CLanIp4Bearer::Send()"); + // Call down from the Protocol + // Real Protocol data is in the second MBuf of the RMBufChain + + RMBufPktInfo* info = RMBufPacket::PeekInfoInChain(aPdu); + TUint32 family = info->iDstAddr.Family(); + __ASSERT_DEBUG(family!=KAfInet6, User::Panic(KCLanIp4BearerName, 0)); + + TBuf8 destAddr; + const TUint8 etherBroadcastAddr[KMACByteLength] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + if(family == KAfInet) + { + // Only broadcast and multicast packets come here with address family KAfInet + TInetAddr dest(info->iDstAddr); + if( dest.IsMulticast() ) + { + // multicast + const TUint8 IpV4MulticastPrefix[KMACByteLength / 2] = {0x01, 0x00, 0x5e}; + destAddr.Copy(IpV4MulticastPrefix, KMACByteLength / 2); + + TUint32 mCastAdrrEnd = dest.Address() & 0x007fffff; + BigEndian::Put32(reinterpret_cast(&mCastAdrrEnd), mCastAdrrEnd); + destAddr.Append(reinterpret_cast(&mCastAdrrEnd) + 1, KMACByteLength / 2); + } + else + { + // broadcast + destAddr.Copy(etherBroadcastAddr, KMACByteLength); + } + } + else if(family == 1) + { + // Address family == 1, ethernet address is found from info + destAddr.Copy(info->iDstAddr.Mid(sizeof(SSockAddr), KMACByteLength)); + } + else + { + DEBUG1( "CLanIp4Bearer::Send() - unsupported family type: %u", + family ); + + aPdu.Free(); + return static_cast(1); + } + + TInt ret = Link()->FrameSend(aPdu, destAddr, (TUint)info->iProtocol == KProtocolArp ? KArpFrameType : KIPFrameType); + + return static_cast(ret); +} + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::StartSending +// ----------------------------------------------------------------------------- +// +void CLanIp4Bearer::StartSending(CProtocolBase* aProtocol) +{ + DEBUG("CLanIp4Bearer::StartSending()"); + + CLanxBearer::StartSending(aProtocol); + + if (!iBroadcastConfigured) + { + TMacAddress broadcastmac; + broadcastmac.iMacAddress[0] = 0xFF; + broadcastmac.iMacAddress[1] = 0xFF; + broadcastmac.iMacAddress[2] = 0xFF; + broadcastmac.iMacAddress[3] = 0xFF; + broadcastmac.iMacAddress[4] = 0xFF; + broadcastmac.iMacAddress[5] = 0xFF; + + RWLMServer wlmServer; + if (wlmServer.Connect() != KErrNone) + { + DEBUG("CLanIp4Bearer::StartSending(), ERROR connecting to wlan engine"); + } + else + { + DEBUG("CLanIp4Bearer::StartSending(), Configuring umac to receive Broadcast frames"); + if( wlmServer.ConfigureMulticast( KSoIp6JoinGroup, broadcastmac ) ) + { + DEBUG("CLanIp4Bearer::StartSending(),ERROR calling ConfigureMulticast"); + } + wlmServer.Close(); + iBroadcastConfigured = ETrue; + } + } +} + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::WantsProtocol +// ----------------------------------------------------------------------------- +// +TBool CLanIp4Bearer::WantsProtocol(TUint16 aProtocolCode,const TUint8* aPayload) +{ + DEBUG("CLanIp4Bearer::WantsProtocol()"); + + iArpMsgNext = (aProtocolCode == KArpFrameType); + return ((aProtocolCode==KIPProtocol && (aPayload[0]>>4)==KIP4Protocol) || (aProtocolCode==KArpFrameType)) ? ETrue:EFalse; +} + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::Process +// ----------------------------------------------------------------------------- +// +void CLanIp4Bearer::Process(RMBufChain& aPdu) +{ + DEBUG("CLanIp4Bearer::Process()"); + + if (iUpperReceiver) + { + RMBufPktInfo* info = RMBufPacket::PeekInfoInChain(aPdu); + if (info) + { + info->iProtocol = iArpMsgNext ? KProtocolArp : KProtocolInetIp; + } + iUpperReceiver->Process(aPdu); + } + else + { + aPdu.Free(); + } +} + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::ReadCommDbLanSettingsL +// ----------------------------------------------------------------------------- +// +void CLanIp4Bearer::ReadCommDbLanSettingsL() +{ + DEBUG("CLanIp4Bearer::ReadCommDbLanSettingsL()"); + + ASSERT(iProvision); + + iLocalAddr = iProvision->LocalAddr(); + iNetMask = iProvision->NetMask(); + iDefGateway = iProvision->DefGateway(); + iPrimaryDns = iProvision->PrimaryDns(); + iSecondaryDns = iProvision->SecondaryDns(); +} + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::GetConfig +// ----------------------------------------------------------------------------- +// +TInt CLanIp4Bearer::GetConfig(TBinderConfig& aConfig) + { + DEBUG("CLanIp4Bearer::GetConfig()"); + + TBinderConfig4& config = static_cast(aConfig); + + config.iFamily = KAfInet; /* KAfInet / KAfInet6 - selects TBinderConfig4/6 */ + + config.iInfo.iFeatures = KIfCanBroadcast | KIfCanMulticast | KIfNeedsND; /* Feature flags */ + config.iInfo.iMtu = Link()->Mtu(); /* Maximum transmission unit. */ + config.iInfo.iRMtu = Link()->Mtu(); /* Maximum transmission unit for receiving. */ + config.iInfo.iSpeedMetric = Link()->SpeedMetric(); /* approximation of the interface speed in Kbps. */ + + config.iAddress.SetAddress(iLocalAddr); /* Interface IP address. */ + config.iNetMask.SetAddress(iNetMask); /* IP netmask. */ + config.iBrdAddr.SetAddress(iBroadcastAddr); /* IP broadcast address. */ + config.iDefGate.SetAddress(iDefGateway); /* IP default gateway or peer address (if known). */ + config.iNameSer1.SetAddress(iPrimaryDns); /* IP primary name server (if any). */ + config.iNameSer2.SetAddress(iSecondaryDns); /* IP secondary name server (if any). */ + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::ProtocolName +// ----------------------------------------------------------------------------- +// +const TDesC8& CLanIp4Bearer::ProtocolName() const + { + DEBUG("CLanIp4Bearer::ProtocolName()"); + + _LIT8(KProtocolName, "ip"); + return KProtocolName(); + } + +// ----------------------------------------------------------------------------- +// CLanIp4Bearer::SetProvisionL +// ----------------------------------------------------------------------------- +// +void CLanIp4Bearer::SetProvisionL(const Meta::SMetaData* aProvision) + { + DEBUG("CLanIp4Bearer::SetProvisionL()"); + + if (iProvision == NULL) + { + iProvision = static_cast(aProvision); + ReadCommDbLanSettingsL(); + } + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/CLanIp6Bearer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/CLanIp6Bearer.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements IPv6 bearer +* +*/ + +/* +* %version: 11 % +*/ + +#include // Header is retained, but in_sock.h is modified for ipv6 +#include +#include +#include +#include "CLanIp6Bearer.h" +#include "WlanProto.h" +#include +#include "WlanProvision.h" + +// From Wlan +#include +#include "am_debug.h" +#include "rwlmserver.h" + +// Avoiding a warning in armv5 urel +#ifdef _DEBUG +_LIT(KCLanIp6BearerName,"EthWlan6"); +#endif /* _DEBUG */ + +using namespace ESock; + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::ConstructL +// ----------------------------------------------------------------------------- +// +void CLanIp6Bearer::ConstructL() +{ + DEBUG("CLanIp6Bearer::ConstructL()"); + + iIfName.Format(_L("wlan6[0x%08x]"), this); + UpdateMACAddr(); + // ReadCommDbLanSettingsL() moved from here to point when provisioning information received +} + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::Control +// ----------------------------------------------------------------------------- +// +TInt CLanIp6Bearer::Control(TUint aLevel,TUint aName,TDes8& aOption) +{ + DEBUG("CLanIp6Bearer::Control()"); + + if ((aLevel==KCOLInterface) || (aLevel==KSOLInterface)) + { + switch (aName) + { + case KSoIfHardwareAddr: + { + typedef TPckgBuf THwAddr; + THwAddr& theHwAddrRef = static_cast(aOption); + theHwAddrRef().iHardwareAddr.SetFamily(1); + theHwAddrRef().iHardwareAddr.SetPort(KArpHarwareType_ETHERNET); + theHwAddrRef().iHardwareAddr.SetLength(sizeof(SSockAddr)); + theHwAddrRef().iHardwareAddr.Append(Link()->MacAddress()); + return KErrNone; + } + default: + break; + } + } + + else if (aLevel==KSolInetIp) + { + switch (aName) + { + case KSoIp6LeaveGroup: + case KSoIp6JoinGroup: + { + + // Convert multicast IPv6 address to multicast MAC address + TIp6Mreq& opt = *(TIp6Mreq*)aOption.Ptr(); + TUint8* tmp = opt.iAddr.u.iAddr8; + TMacAddress mac; + mac.iMacAddress[0] = 0x33; + mac.iMacAddress[1] = 0x33; + mac.iMacAddress[2] = tmp[12]; + mac.iMacAddress[3] = tmp[13]; + mac.iMacAddress[4] = tmp[14]; + mac.iMacAddress[5] = tmp[15]; + + TIp6Addr addr6 = opt.iAddr; + TInetAddr addr(addr6, 0); + TBuf aa; + addr.Output(aa); + + if(aName == KSoIp6JoinGroup) + DEBUG1("CLanIp6Bearer::Control() - joining multicast address:%S", &aa); + else + DEBUG1("CLanIp6Bearer::Control() - leaving multicast address:%S", &aa); + + TInt ret = KErrNone; + RWLMServer wlmServer; + ret = wlmServer.Connect(); + if( ret ) + { + DEBUG1("CLanIp6Bearer::Control()- ERROR connecting RWlmServer: %d", ret); + return ret; + } + else + { + ret = wlmServer.ConfigureMulticast( aName, mac ); + wlmServer.Close(); + return KErrNone; + } + } + default: + break; + } + } + return KErrNotSupported; +} + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::ResolveMulticastIp6 +// ----------------------------------------------------------------------------- +// +void CLanIp6Bearer::ResolveMulticastIp6(TDes8& aDstAddr, RMBufChain& aPdu) + { + // We need to obtain the IPv6 header - i.e. the destination address. + // Octets 12 to 15 of the destination address, should be copied to + // Octets 2 to 5 of the aDstAddr. + // Octets 0 and 1 should be 0x3333. + + DEBUG("CLanIp6Bearer::ResolveMulticastIp6()"); + + const TUint8 KMulticastPrefix[2] = {0x33, 0x33}; + + TIpv6Header* header = (TIpv6Header*)aPdu.First()->Next()->Ptr(); + + TUint ix; + for(ix=0; ix<2; ix++) + { + aDstAddr[ix]=KMulticastPrefix[ix]; + } + for(ix=2; ix<6; ix++) + { + aDstAddr[ix]=header->iDestAddrB[ix+10]; + } + } + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::Send +// ----------------------------------------------------------------------------- +// +MLowerDataSender::TSendResult CLanIp6Bearer::Send(RMBufChain& aPdu) +{ + // Check that we are allowed to send data + if (!Link()->BearerIsActive(this)) + { + aPdu.Free(); + return ESendBlocked; + } + + RMBufPktInfo* info = RMBufPacket::PeekInfoInChain(aPdu); + TUint32 family = info->iDstAddr.Family(); + __ASSERT_DEBUG(family!=KAfInet, User::Panic(KCLanIp6BearerName, 0)); + + TBuf8 destAddr; + destAddr.SetMax(); + + if(family == KAfInet6) + { + // Only multicast packets come here with address family KAfInet6, + // generate the ethernet address as described in RFC 2464, section 7. + ResolveMulticastIp6(destAddr, aPdu); + } + else if(family == 1) + { + // Address family == 1, ethernet address is found from info + destAddr.Copy(info->iDstAddr.Mid(sizeof(SSockAddr), KMACByteLength)); + } + else + { + aPdu.Free(); + return static_cast(1); + } + + return static_cast(Link()->FrameSend(aPdu,destAddr,KIP6FrameType)); +} + + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::WantsProtocol +// ----------------------------------------------------------------------------- +// +TBool CLanIp6Bearer::WantsProtocol(TUint16 aProtocolCode,const TUint8* aPayload) +{ + DEBUG("CLanIp6Bearer::WantsProtocol()"); + + return (aProtocolCode==KIP6FrameType && (aPayload[0]>>4)==KIP6Protocol) ? ETrue:EFalse; +} + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::Process +// ----------------------------------------------------------------------------- +// +void CLanIp6Bearer::Process(RMBufChain& aPdu) +{ + DEBUG("CLanIp6Bearer::Process()"); + + if(iUpperReceiver) + { + iUpperReceiver->Process(aPdu); + } + else + { + aPdu.Free(); + } +} +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::UpdateMACAddr +// ----------------------------------------------------------------------------- +// +void CLanIp6Bearer::UpdateMACAddr() +{ + DEBUG("CLanIp6Bearer::UpdateMACAddr()"); + + TE64Addr myEuMac; + myEuMac.SetAddrFromEUI48(Link()->MacAddress().Ptr()); + iEuiMac.SetAddress(myEuMac); +} + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::ReadCommDbLanSettingsL +// ----------------------------------------------------------------------------- +// +void CLanIp6Bearer::ReadCommDbLanSettingsL() +{ + DEBUG("CLanIp6Bearer::ReadCommDbLanSettingsL()"); + + ASSERT(iProvision); + iPrimaryDns = iProvision->PrimaryDns(); + iSecondaryDns = iProvision->SecondaryDns(); +} + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::GetConfig +// ----------------------------------------------------------------------------- +// +TInt CLanIp6Bearer::GetConfig(TBinderConfig& aConfig) + { + DEBUG("CLanIp6Bearer::GetConfig()"); + + TBinderConfig6& config = static_cast(aConfig); + + config.iFamily = KAfInet6; + + config.iInfo.iFeatures = KIfNeedsND | KIfCanMulticast; + config.iInfo.iMtu = Link()->Mtu(); + config.iInfo.iRMtu = Link()->Mtu(); + config.iInfo.iSpeedMetric = Link()->SpeedMetric(); + + TEui64Addr& localId = TEui64Addr::Cast(config.iLocalId); + localId = iEuiMac; + + // If required, configure static DNS addresses + + if (!iPrimaryDns.IsUnspecified()) + { + config.iNameSer1.SetAddress(iPrimaryDns); + if (!iSecondaryDns.IsUnspecified()) + config.iNameSer2.SetAddress(iSecondaryDns); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::ProtocolName +// ----------------------------------------------------------------------------- +// +const TDesC8& CLanIp6Bearer::ProtocolName() const +/** +Return the protocol name of this bearer + +Called from CLANLinkCommon +*/ + { + DEBUG("CLanIp6Bearer::ProtocolName()"); + + _LIT8(KProtocolName, "ip6"); + return KProtocolName(); + } +// ----------------------------------------------------------------------------- +// CLanIp6Bearer::SetProvisionL +// ----------------------------------------------------------------------------- +// +void CLanIp6Bearer::SetProvisionL(const Meta::SMetaData* aProvision) + { + DEBUG("CLanIp6Bearer::SetProvisionL()"); + + if (iProvision == NULL) + { + iProvision = static_cast(aProvision); + ReadCommDbLanSettingsL(); + } + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/CLanxBearer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/CLanxBearer.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements LANx Brearer +* +*/ + +/* +* %version: 6 % +*/ + +#include // Header is retained, but in_sock.h is modified for ipv6 +#include // Gone. +#include "CLanxBearer.h" +#include "WlanProto.h" + +//For Wlan logging +#include "am_debug.h" + +using namespace ESock; + +// ----------------------------------------------------------------------------- +// CLanxBearer::CLanxBearer +// ----------------------------------------------------------------------------- +// +CLanxBearer::CLanxBearer(CLANLinkCommon* aLink):iLink(aLink), iSoIfConnectionInfoCached(false) +{ +} + +// ----------------------------------------------------------------------------- +// CLanxBearer::ConstructL +// ----------------------------------------------------------------------------- +// +void CLanxBearer::ConstructL() +{ +} + +// ----------------------------------------------------------------------------- +// CLanxBearer::StartSending +// ----------------------------------------------------------------------------- +// +void CLanxBearer::StartSending(CProtocolBase* /*aProtocol*/) + { + DEBUG("CLanxBearer::StartSending()"); + + iUpperControl->StartSending(); + } + +// ----------------------------------------------------------------------------- +// CLanxBearer::UpdateMACAddr +// ----------------------------------------------------------------------------- +// +void CLanxBearer::UpdateMACAddr() + { + } + + +// MLowerControl methods +// ----------------------------------------------------------------------------- +// CLanxBearer::GetName +// ----------------------------------------------------------------------------- +// + +TInt CLanxBearer::GetName(TDes& aName) + { + DEBUG("CLanxBearer::GetName()"); + + aName.Copy(iIfName); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLanxBearer::BlockFlow +// ----------------------------------------------------------------------------- +// +TInt CLanxBearer::BlockFlow(MLowerControl::TBlockOption /*aOption*/) + { + DEBUG("CLanxBearer::BlockFlow()"); + + return KErrNotSupported; + } + +// +// Utilities +// +// ----------------------------------------------------------------------------- +// CLanxBearer::SetUpperPointers +// ----------------------------------------------------------------------------- +// +void CLanxBearer::SetUpperPointers(MUpperDataReceiver* aReceiver, MUpperControl* aControl) + { + DEBUG("CLanxBearer::SetUpperPointers()"); + + ASSERT(iUpperReceiver == NULL && iUpperControl == NULL); + iUpperReceiver = aReceiver; + iUpperControl = aControl; + } + +// ----------------------------------------------------------------------------- +// CLanxBearer::MatchesUpperControl +// ----------------------------------------------------------------------------- +// +TBool CLanxBearer::MatchesUpperControl(const ESock::MUpperControl* aUpperControl) const +/** +Check whether the passed MUpperControl matches that associated with the current instance +*/ + { + DEBUG("CLanxBearer::MatchesUpperControl()"); + + ASSERT(iUpperControl); + return iUpperControl == aUpperControl; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/NifWLMServerIf.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/NifWLMServerIf.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,437 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements interaction with WLMServer for Admission control purpose +* +*/ + +/* +* %version: 7 % +*/ + +#include "NifWLMServerIf.h" +#include "WlanProto.h" +#include "am_debug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::NewL +// ----------------------------------------------------------------------------- +// +CLANNifWLMServerPerAC* CLANNifWLMServerPerAC::NewL( + TWlmAccessClass aAccessClass, + TUint aInactivityTime, + TBool aIsAutomaticMgmt ) + { + DEBUG( "CLANNifWLMServerPerAC::NewL()" ); + CLANNifWLMServerPerAC* self = + new (ELeave) CLANNifWLMServerPerAC( aAccessClass, aInactivityTime, aIsAutomaticMgmt ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::CLANNifWLMServerPerAC +// ----------------------------------------------------------------------------- +// +CLANNifWLMServerPerAC::CLANNifWLMServerPerAC( + TWlmAccessClass aAccessClass, + TUint aInactivityTime, + TBool aIsAutomaticMgmt ): + CActive( CActive::EPriorityStandard ), + iAccessClass( aAccessClass ), + iTrafficMode( EWlmAcTrafficModeAutomatic ), + iTrafficStatus( EWlmAcTrafficStatusAdmitted ), + iContext( ETSCreateRequest ), + iIsTsCreated( EFalse ), + iTsId( 0 ), + iTsParams( KACtoUP[iAccessClass] ), + iTsStatus( EWlanTrafficStreamStatusActive ), + iTsInactivityTime( aInactivityTime ), + iTsDelOrigTime( 0 ), + iTsDelRemainTime( 0 ), + iTsDelStartTime( 0 ), + iIsAutomaticMgmt( aIsAutomaticMgmt ) + { + DEBUG( "CLANNifWLMServerPerAC::CLANNifWLMServerPerAC()" ); + + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::~CLANNifWLMServerPerAC +// ----------------------------------------------------------------------------- +// +CLANNifWLMServerPerAC::~CLANNifWLMServerPerAC() + { + DEBUG( "CLANNifWLMServerPerAC::~CLANNifWLMServerPerAC()" ); + + Cancel(); + iTsDelTimer.Close(); + iWlmServer.Close(); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::ConstructL +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::ConstructL() + { + DEBUG( "CLANNifWLMServerPerAC::ConstructL()" ); + + User::LeaveIfError( iWlmServer.Connect() ); + User::LeaveIfError( iTsDelTimer.CreateLocal() ); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::IsAdmitted +// ----------------------------------------------------------------------------- +// +TBool CLANNifWLMServerPerAC::IsAdmitted() + { + return ( iTrafficStatus == EWlmAcTrafficStatusAdmitted ); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::SetTrafficMode +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::SetTrafficMode( + TWlmAcTrafficMode aMode ) + { + iTrafficMode = aMode; + + if( aMode == EWlmAcTrafficModeAutomatic ) + { + DEBUG1( "CLANNifWLMServerPerAC::SetTrafficMode() - traffic mode set to automatic for AC %u", + iAccessClass ); + } + else if( aMode == EWlmAcTrafficModeManual ) + { + DEBUG1( "CLANNifWLMServerPerAC::SetTrafficMode() - traffic mode set to manual for AC %u", + iAccessClass ); + + // If mode is changed from automatic to manual, it means NIF's + // traffic streams for this AC have been deleted. + + Cancel(); + iIsTsCreated = EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::SetTrafficStatus +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::SetTrafficStatus( + TWlmAcTrafficStatus aStatus ) + { + iTrafficStatus = aStatus; + + if( aStatus == EWlmAcTrafficStatusAdmitted ) + { + DEBUG1( "CLANNifWLMServerPerAC::SetTrafficStatus() - traffic admitted on AC %u", + iAccessClass ); + } + else if( aStatus == EWlmAcTrafficModeManual ) + { + DEBUG1( "CLANNifWLMServerPerAC::SetTrafficStatus() - traffic NOT admitted on AC %u", + iAccessClass ); + } + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::SuspendInactivityTimer +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::SuspendInactivityTimer() + { + if( !iIsTsCreated ) + { + DEBUG( "CLANNifWLMServerPerAC::SuspendInactivityTimer() - no traffic stream created, nothing to suspend" ); + + return; + } + + if( !IsActive() ) + { + DEBUG( "CLANNifWLMServerPerAC::SuspendInactivityTimer() - timer is already suspended" ); + + return; + } + + DEBUG1( "CLANNifWLMServerPerAC::SuspendInactivityTimer() - AC: %u", + iAccessClass ); + + //First, cancel the running timer + Cancel(); + + TTime time; + time.UniversalTime(); + TTimeIntervalMicroSeconds difference; + difference = time.MicroSecondsFrom( iTsDelStartTime ); + iTsDelRemainTime = iTsDelRemainTime.Int() - difference.Int64(); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::ResumeInactivityTimer +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::ResumeInactivityTimer() + { + if( !iIsTsCreated ) + { + DEBUG( "CLANNifWLMServerPerAC::ResumeInactivityTimer() - no traffic stream created, nothing to resume" ); + + return; + } + + if( IsActive() ) + { + DEBUG( "CLANNifWLMServerPerAC::ResumeInactivityTimer() - timer is already resumed" ); + + return; + } + + DEBUG2( "CLANNifWLMServerPerAC::ResumeInactivityTimer() - AC: %u, remaining time(us): %u", + iAccessClass, iTsDelRemainTime.Int() ); + + //Remember the time the timer is started + iTsDelStartTime.UniversalTime(); + iTsDelTimer.After(iStatus, iTsDelRemainTime); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::OnFrameSend +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::OnFrameSend() + { + DEBUG6( "CLanLinkCommon::OnFrameSend() - iAccessClass: %u, iTrafficStatus: %u, iTrafficMode: %u, iIsTsCreated: %u, iIsAutomaticMgmt: %u, IsActive(): %u", + iAccessClass, iTrafficStatus, iTrafficMode, iIsTsCreated, iIsAutomaticMgmt, IsActive() ); + + if( iIsAutomaticMgmt && + iTrafficStatus == EWlmAcTrafficStatusNotAdmitted && + iTrafficMode == EWlmAcTrafficModeAutomatic && + !iIsTsCreated && + !IsActive() ) + { + DEBUG1( "CLanLinkCommon::OnFrameSend() - requesting a virtual traffic stream for AC %u", + iAccessClass ); + + iWlmServer.CreateTrafficStream( + iStatus, + iTsParams, + ETrue, + iTsId, + iTsStatus ); + iContext = ETSCreateRequest; + SetActive(); + } + else if( iIsTsCreated ) + { + // Refresh the inactivity timer. + + Cancel(); + iTsDelRemainTime = iTsDelOrigTime; + iTsDelStartTime.UniversalTime(); + iTsDelTimer.After( iStatus, iTsDelOrigTime ); + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::OnFrameReceive +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::OnFrameReceive() + { + DEBUG6( "CLanLinkCommon::OnFrameReceive() - iAccessClass: %u, iTrafficStatus: %u, iTrafficMode: %u, iIsTsCreated: %u, iIsAutomaticMgmt: %u, IsActive(): %u", + iAccessClass, iTrafficStatus, iTrafficMode, iIsTsCreated, iIsAutomaticMgmt, IsActive() ); + + if( iIsTsCreated && + IsActive() ) + { + // Refresh the inactivity timer. + + Cancel(); + iTsDelRemainTime = iTsDelOrigTime; + iTsDelStartTime.UniversalTime(); + iTsDelTimer.After( iStatus, iTsDelOrigTime ); + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::RunL +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::RunL() + { + DEBUG1( "CLANNifWLMServerPerAC::RunL() - iStatus: %d", + iStatus.Int() ); + + if( iContext == ETSCreateRequest ) + { + if( iStatus.Int() == KErrNone ) + { + DEBUG1("CLANNifWLMServerPerAC::RunL() - virtual traffic stream successfully created for AC %u", + iAccessClass ); + + iIsTsCreated = ETrue; + + // Start the inactivity timer. + iTsDelOrigTime = iTsDelRemainTime = iTsInactivityTime; + iTsDelStartTime.UniversalTime(); + iContext = ETSDelTimer; + iTsDelTimer.After( iStatus, iTsDelOrigTime ); + SetActive(); + } + else + { + DEBUG2("CLANNifWLMServerPerAC::RunL() - virtual traffic stream creation for AC %u failed with %d", + iAccessClass, iStatus.Int() ); + + iIsTsCreated = EFalse; + } + } + else if( iContext == ETSDelTimer ) + { + DEBUG1( "CLANNifWLMServerPerAC::RunL() - inactivity timer expired for AC %u, deleting the virtual traffic stream", + iAccessClass ); + + iWlmServer.DeleteTrafficStream( iStatus, iTsId ); + User::WaitForRequest( iStatus ); + + iIsTsCreated = EFalse; + } + } + +// --------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::RunError +// --------------------------------------------------------------------------- +// +TInt CLANNifWLMServerPerAC::RunError( + TInt /* aError */ ) + { + DEBUG( "CLANNifWLMServerPerAC::RunError()" ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerPerAC::DoCancel +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerPerAC::DoCancel() + { + if( iContext == ETSCreateRequest ) + { + DEBUG1( "CLANNifWLMServerPerAC::DoCancel() - cancelling TS create request for AC %u", + iAccessClass ); + + iWlmServer.CancelCreateTrafficStream(); + } + else + { + DEBUG1( "CLANNifWLMServerPerAC::DoCancel() - cancelling TS delete timer for AC %u", + iAccessClass ); + + iTsDelTimer.Cancel(); + } + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerCommon::CLANNifWLMServerCommon +// ----------------------------------------------------------------------------- +// +CLANNifWLMServerCommon::CLANNifWLMServerCommon( + CLANLinkCommon* aLinkCommon ) : + iLinkCommon( aLinkCommon ) + { + DEBUG( "CLANNifWLMServerCommon::CLANNifWLMServerCommon()" ); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerCommon::~CLANNifWLMServerCommon +// ----------------------------------------------------------------------------- +// +CLANNifWLMServerCommon::~CLANNifWLMServerCommon() + { + DEBUG( "CLANNifWLMServerCommon::~CLANNifWLMServerCommon" ); + + iWlmServer.CancelNotifies(); + iWlmServer.Close(); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerCommon::ConstructL +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerCommon::ConstructL() + { + DEBUG( "CLANNifWLMServerCommon::ConstructL()" ); + + User::LeaveIfError( iWlmServer.Connect() ); + iWlmServer.ActivateNotifiesL( + *this, + EWlmNotifyAcTrafficModeChanged | EWlmNotifyAcTrafficStatusChanged ); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerCommon::GetAcTrafficStatus +// ----------------------------------------------------------------------------- +// +TInt CLANNifWLMServerCommon::GetAcTrafficStatus( + TWlmAcTrafficStatusArray& aArray ) + { + DEBUG( "CLANNifWLMServerCommon::GetAcTrafficStatus()" ); + + return iWlmServer.GetAcTrafficStatus( aArray ); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerCommon::AccessClassTrafficModeChanged +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerCommon::AccessClassTrafficModeChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficMode aMode ) + { + DEBUG( "CLANNifWLMServerCommon::AccessClassTrafficModeChanged()" ); + + iLinkCommon->AcTrafficModeChanged( + aAccessClass, aMode ); + } + +// ----------------------------------------------------------------------------- +// CLANNifWLMServerCommon::ConstructL +// ----------------------------------------------------------------------------- +// +void CLANNifWLMServerCommon::AccessClassTrafficStatusChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficStatus aStatus ) + { + DEBUG( "CLANNifWLMServerCommon::AccessClassTrafficStatusChanged()" ); + + iLinkCommon->AcTrafficStatusChanged( + aAccessClass, aStatus ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/WlanCfproto.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/WlanCfproto.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements WLAN CFP flow factory +* +*/ + +/* +* %version: 4 % +*/ + +#include "WlanCfproto.h" +#include "WlanProto.h" + +using namespace ESock; + +// Wlan Flow Factory + +// ----------------------------------------------------------------------------- +// CWlanSubConnectionFlowFactory::NewL +// ----------------------------------------------------------------------------- +// +CWlanSubConnectionFlowFactory* CWlanSubConnectionFlowFactory::NewL(TAny* aConstructionParameters) +/** +Constructs a Default SubConnection Flow Factory + +@param aConstructionParameters construction data passed by ECOM + +@returns pointer to a constructed factory +*/ + { + CWlanSubConnectionFlowFactory* ptr = new (ELeave) CWlanSubConnectionFlowFactory(TUid::Uid(KWlanFlowImplementationUid), *(reinterpret_cast(aConstructionParameters))); + return ptr; + } + +// ----------------------------------------------------------------------------- +// CWlanSubConnectionFlowFactory::CWlanSubConnectionFlowFactory +// ----------------------------------------------------------------------------- +// +CWlanSubConnectionFlowFactory::CWlanSubConnectionFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer) + : CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer) +/** +Default SubConnection Flow Factory Constructor + +@param aFactoryId ECOM Implementation Id +@param aParentContainer Object Owner +*/ + { + } + +// ----------------------------------------------------------------------------- +// CWlanSubConnectionFlowFactory::DoCreateL +// ----------------------------------------------------------------------------- +// +CSubConnectionFlowBase* CWlanSubConnectionFlowFactory::DoCreateFlowL(ESock::CProtocolIntfBase* aProtocolIntf, TFactoryQueryBase& aQuery) + { + const TDefaultFlowFactoryQuery& query = static_cast(aQuery); + return CLANLinkCommon::NewL(*this, query.iSCprId, aProtocolIntf); + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/WlanConfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/WlanConfig.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines attributes for provisioning structure passed to CFP +* +*/ + +/* +* %version: 5 % +*/ + +#include "wlanmcpr.h" +#include "WlanProvision.h" + +using namespace ESock; + +// +// Attribute tables for provisioning structures passed to CFProtocol +// + +START_ATTRIBUTE_TABLE(TLanIp4Provision, TLanIp4Provision::EUid, TLanIp4Provision::ETypeId) +// No attributes, even though there are data members, because the structure is +// not serialised - just passed to data side. +END_ATTRIBUTE_TABLE() + +START_ATTRIBUTE_TABLE(TLanIp6Provision, TLanIp6Provision::EUid, TLanIp6Provision::ETypeId) +// No attributes, even though there are data members, because the structure is +// not serialised - just passed to data side. +END_ATTRIBUTE_TABLE() diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/Wlanbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/Wlanbase.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1484 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements functions for LAN interface +* +*/ + +/* +* %version: 24 % +*/ + +#include +#include // for TTime +#include +#include +#include +#include +#include +#include // for KSlashChar +#include +#include "WlanProto.h" +#include "carddrv.h" +#include // Header is retained, but in_sock.h is modified for ipv6 +#include "CLanIp4Bearer.h" +#include "CLanIp6Bearer.h" +#include +#include +#include "CLanxBearer.h" +#include "WlanProvision.h" +#include // for SAccessPointConfig +#include +#include +#include + +// From old wlan implementation +#include +#include +#include +#include "am_debug.h" +#include "EtherCardApi.h" +#include "wlandevicesettingsinternalcrkeys.h" +#include "NifWLMServerIf.h" + + +using namespace ESock; +using namespace Messages; + +_LIT8(KDescIp, "ip"); +_LIT8(KDescIcmp, "icmp"); +_LIT8(KDescIp6, "ip6"); + +const TInt KLanxBearerPtrArrayGranularity = 2; +const TInt KContinueSending = 1; +const TInt KMaxDSCPValues = 64; + +/** + * Mapping of user priority values to the corresponding access classes. + */ +const TWlmAccessClass KUPtoAC[E8021DUserPriorityMax] = + { + EWlmAccessClassBestEffort, // E8021DUserPriorityBE + EWlmAccessClassBackground, // E8021DUserPriorityBK1 + EWlmAccessClassBackground, // E8021DUserPriorityBK2 + EWlmAccessClassBestEffort, // E8021DUserPriorityEE + EWlmAccessClassVideo, // E8021DUserPriorityCL + EWlmAccessClassVideo, // E8021DUserPriorityVI + EWlmAccessClassVoice, // E8021DUserPriorityVO + EWlmAccessClassVoice, // E8021DUserPriorityNC + }; + +/** + * Mapping of access class transitions on packet downgrade. + */ +const TWlmAccessClass KNextAC[EWlmAccessClassMax] = + { + EWlmAccessClassBackground, // EWlmAccessClassBestEffort -> EWlmAccessClassBackground + EWlmAccessClassMax, // EWlmAccessClassBackground -> EWlmAccessClassMax + EWlmAccessClassBestEffort, // EWlmAccessClassVideo -> EWlmAccessClassBestEffort + EWlmAccessClassVideo // EWlmAccessClassVoice -> EWlmAccessClassVideo + }; + +/** + * Mapping of IP TOS (DSCP) bits to the corresponding user priority values. + */ +const T8021DPriority KDSCPtoUP[KMaxDSCPValues] = + { + /* DSCP bits as binary format, DSCP byte in IPv4 packet as HEX */ + + /* 000000, 0x00 */E8021DUserPriorityBE, /* 000001, 0x04 */E8021DUserPriorityBE, + /* 000010, 0x08 */E8021DUserPriorityBE, /* 000011, 0x0C */E8021DUserPriorityBE, + /* 000100, 0x10 */E8021DUserPriorityBE, /* 000101, 0x14 */E8021DUserPriorityBE, + /* 000110, 0x18 */E8021DUserPriorityBE, /* 000111, 0x1C */E8021DUserPriorityBE, + /* 001000, 0x20 */E8021DUserPriorityBK1, /* 001001, 0x24 */E8021DUserPriorityBK1, + /* 001010, 0x28 */E8021DUserPriorityEE, /* 001011, 0x2C */E8021DUserPriorityEE, + /* 001100, 0x30 */E8021DUserPriorityEE, /* 001101, 0x34 */E8021DUserPriorityEE, + /* 001110, 0x38 */E8021DUserPriorityEE, /* 001111, 0x3C */E8021DUserPriorityEE, + + /* 010000, 0x40 */E8021DUserPriorityEE, /* 010001, 0x44 */E8021DUserPriorityEE, + /* 010010, 0x48 */E8021DUserPriorityEE, /* 010011, 0x4C */E8021DUserPriorityEE, + /* 010100, 0x50 */E8021DUserPriorityEE, /* 010101, 0x54 */E8021DUserPriorityEE, + /* 010110, 0x58 */E8021DUserPriorityEE, /* 010111, 0x5C */E8021DUserPriorityEE, + /* 011000, 0x60 */E8021DUserPriorityVI, /* 011001, 0x64 */E8021DUserPriorityVI, + /* 011010, 0x68 */E8021DUserPriorityVI, /* 011011, 0x6C */E8021DUserPriorityVI, + /* 011100, 0x70 */E8021DUserPriorityVI, /* 011101, 0x74 */E8021DUserPriorityVI, + /* 011110, 0x78 */E8021DUserPriorityVI, /* 011111, 0x7C */E8021DUserPriorityVI, + + /* 100000, 0x80 */E8021DUserPriorityVI, /* 100001, 0x84 */E8021DUserPriorityVI, + /* 100010, 0x88 */E8021DUserPriorityVI, /* 100011, 0x8C */E8021DUserPriorityVI, + /* 100100, 0x90 */E8021DUserPriorityVI, /* 100101, 0x94 */E8021DUserPriorityVI, + /* 100110, 0x98 */E8021DUserPriorityVI, /* 100111, 0x9C */E8021DUserPriorityVI, + /* 101000, 0xA0 */E8021DUserPriorityCL, /* 101001, 0xA4 */E8021DUserPriorityCL, + /* 101010, 0xA8 */E8021DUserPriorityCL, /* 101011, 0xAC */E8021DUserPriorityCL, + /* 101100, 0xB0 */E8021DUserPriorityCL, /* 101101, 0xB4 */E8021DUserPriorityCL, + /* 101110, 0xB8 */E8021DUserPriorityVO, /* 101111, 0xBC */E8021DUserPriorityVO, + + /* 110000, 0xC0 */E8021DUserPriorityNC, /* 110001, 0xC4 */E8021DUserPriorityNC, + /* 110010, 0xC8 */E8021DUserPriorityNC, /* 110011, 0xCC */E8021DUserPriorityNC, + /* 110100, 0xD0 */E8021DUserPriorityNC, /* 110101, 0xD4 */E8021DUserPriorityNC, + /* 110110, 0xD8 */E8021DUserPriorityNC, /* 110111, 0xDC */E8021DUserPriorityNC, + /* 111000, 0xE0 */E8021DUserPriorityNC, /* 111001, 0xE4 */E8021DUserPriorityNC, + /* 111010, 0xE8 */E8021DUserPriorityNC, /* 111011, 0xEC */E8021DUserPriorityNC, + /* 111100, 0xF0 */E8021DUserPriorityNC, /* 111101, 0xF4 */E8021DUserPriorityNC, + /* 111110, 0xF8 */E8021DUserPriorityNC, /* 111111, 0xFC */E8021DUserPriorityNC + }; + +/** + * Inactivity timeouts per access class. + */ +const TUint KTsInactivityTime[EWlmAccessClassMax] = + { + 600000000, // 600 seconds for EWlmAccessClassBestEffort + 600000000, // 600 seconds for EWlmAccessClassBackground + 120000000, // 120 seconds for EWlmAccessClassVideo + 30000000, // 30 seconds for EWlmAccessClassVoice + }; + +EXPORT_C CLANLinkCommon::CLANLinkCommon(CSubConnectionFlowFactoryBase& aFactory, const TNodeId& aSubConnId, CProtocolIntfBase* aProtocolIntf) + : CSubConnectionFlowBase(aFactory, aSubConnId, aProtocolIntf), iMMState(EStopped) + { + DEBUG("CLANLinkCommon::CLANLinkCommon()"); + LOG_NODE_CREATE(KWlanLog, CLANLinkCommon); + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::LoadPacketDriverL +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::LoadPacketDriverL() + { + DEBUG("CLANLinkCommon::LoadPacketDriverL() - Creates only new class instance"); + + iPktDrv = CPcCardPktDrv::NewL( this ); + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CLANLinkCommon* CLANLinkCommon::NewL(CSubConnectionFlowFactoryBase& aFactory, const TNodeId& aSubConnId, CProtocolIntfBase* aProtocolIntf) + { + DEBUG("CLANLinkCommon::NewL()"); + + CLANLinkCommon* s=new (ELeave) CLANLinkCommon(aFactory, aSubConnId, aProtocolIntf); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::ReadMACSettings +// ----------------------------------------------------------------------------- +// +TBool CLANLinkCommon::ReadMACSettings() + { + DEBUG("CLANLinkCommon::ReadMACSettings()"); + + TBuf8 drvMacAddr; + TUint8* config=iPktDrv->GetInterfaceAddress(); + drvMacAddr.Append(&config[0],KMACByteLength); // First 3 bytes of config not part of address + iMacAddr.Copy(drvMacAddr); // update Ethints copy of the MAC address + TUint bearerLim = iBearers->Count(); + for(TUint index=0;indexUpdateMACAddr(); + } + + // check that the macaddress has been passed and is not 0; + return CheckMac(iMacAddr); // wrong. + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::Mtu +// ----------------------------------------------------------------------------- +// +TUint CLANLinkCommon::Mtu() const + { + DEBUG("CLanLinkCommon::Mtu()"); + + TInt err = KErrNone; + CRepository* repository = NULL; + TRAP( err, repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ) ); + if( err != KErrNone ) + { + DEBUG1( "Could not access repository (%d), using default value for mtu(1500)", err ); + return KEtherMaxDataLen; + } + // No need to use CleanupStack because no possibility to leave + + TInt temp = 0; + err = repository->Get( KWlanMTU, temp ); + if( err == KErrNone ) + { + delete repository; + DEBUG1("MTU value from cenrep is:%d", temp); + if( temp > KEtherMaxDataLen || temp <= 0 ) + { + DEBUG("MTU from cenrep is out of range 1-1500, setting it to 1500"); + temp = KEtherMaxDataLen; + } + return temp; + } + else + { + DEBUG1( "Could not access repository (%d), using default value for mtu(1500)", err ); + delete repository; + return KEtherMaxDataLen; + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::ConstructL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CLANLinkCommon::ConstructL() + { + DEBUG("CLANLinkCommon::ConstructL()"); + + // Initialise class members that do not need to be read from the database + iBearers = new (ELeave) CLanxBearerPtrArray(KLanxBearerPtrArrayGranularity); + iEtherType = EStandardEthernet; + + iOnlyThisBearer = NULL; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::~CLANLinkCommon +// ----------------------------------------------------------------------------- +// +EXPORT_C CLANLinkCommon::~CLANLinkCommon() + { + DEBUG("CLANLinkCommon::~CLANLinkCommon()"); + + delete iPktDrv; + ASSERT(0 == iBearers->Count()); + delete iBearers; + delete iPeriodic; + delete iWLMServerCommon; + for( TUint idx( 0 ); idx < EWlmAccessClassMax; ++idx ) + { + delete iAcArray[idx]; + } + + LOG_NODE_DESTROY(KWlanLog, CLANLinkCommon); + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::CheckMac +// ----------------------------------------------------------------------------- +// +TBool CLANLinkCommon::CheckMac(TDes8& aMacAddr) + { + DEBUG("CLANLinkCommon::CheckMac()"); + + TUint MacBytes = 6; + for (TUint i=0;iSetTrafficMode( aMode ); + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::AcTrafficModeChanged +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::AcTrafficStatusChanged( + TWlmAccessClass aAccessClass, + TWlmAcTrafficStatus aStatus ) + { + DEBUG( "CLANLinkCommon::AcTrafficStatusChanged()" ); + + iAcArray[aAccessClass]->SetTrafficStatus( aStatus ); + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::LinkLayerUp +// ----------------------------------------------------------------------------- +// +/** +Link Layer Up +Called by the packet driver when it is happy +*/ +EXPORT_C void CLANLinkCommon::LinkLayerUp() + { + DEBUG("CLANLinkCommon::LinkLayerUp()"); + + //some drivers have a valid MAC only after negotiation finishes + iValidMacAddr = ReadMACSettings(); + PostDataClientStartedMessage(); + + /** + * With the new comms framework, this KLinkLayerOpen always sent and then will be caught and swallowed + * at the ipproto layer if a netcfgext is being used. + */ + + /** + * We are forced to signal link layer open from here even though there may not + * be a configured IP address. This is a dirty fix because of politics... + */ + PostProgressMessage(KLinkLayerOpen, KErrNone); + + TUint bearerLim = iBearers->Count(); + for(TUint index=0;indexStartSending((CProtocolBase*)this); + } + + // Get current traffic status for access classes. + TWlmAcTrafficStatusArray acArray; + TInt ret = iWLMServerCommon->GetAcTrafficStatus( acArray ); + if( ret != KErrNone ) + { + DEBUG1( "CLANLinkCommon::LinkLayerUp() - RWLMServer::GetAcTrafficStatus() failed with %d", + ret ); + + // Assume all access classes are admitted. + for( TUint idx( 0 ); idx < EWlmAccessClassMax; ++idx ) + { + iAcArray[idx]->SetTrafficStatus( EWlmAcTrafficStatusAdmitted ); + } + } + else + { + // Update access class instances with the current status. + for( TUint idx( 0 ); idx < EWlmAccessClassMax; ++idx ) + { + iAcArray[idx]->SetTrafficStatus( acArray[idx] ); + } + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::LinkLayerDown +// ----------------------------------------------------------------------------- +// +EXPORT_C void CLANLinkCommon::LinkLayerDown(TInt aError, TAction aAction) +/** +Link Layer Down +Called by the packet driver when the link has gone down + +@param aError error code +@param aAction whether a reconnect is required or not +*/ + { + DEBUG("CLANLinkCommon::LinkLayerDown()"); + + // If a stop was requested from the SCpr then this LinkLayerDown() + // was expected. This also means the SCpr has already been sent a + // TDataClientStopped and the packet driver has been stopped. + // If on the other hand the stop was not requested a TDataClientGoneDown + // message needs to be sent to the SCpr and the packet driver still + // needs a StopInterface call - usually this would mean that aAction + // is EReconnect + if (iStopRequested == EFalse && iMMState == EStarted) + { + PostProgressMessage(KLinkLayerClosed, aError); + PostFlowGoingDownMessage(aError, (aAction == EReconnect) ? MNifIfNotify::EReconnect : MNifIfNotify::EDisconnect); + iPktDrv->StopInterface(); + MaybePostDataClientIdle(); + iMMState = EStopped; + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::StopCb +// ----------------------------------------------------------------------------- +// +TInt CLANLinkCommon::StopCb(TAny* aThisPtr) + { + DEBUG("CLANLinkCommon::StopCb()"); + + CLANLinkCommon* self = static_cast(aThisPtr); + self->StopInterface(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::StopInterface +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::StopInterface() + { + DEBUG("CLANLinkCommon::StopInterface()"); + + if(iPeriodic) + { + iPeriodic->Cancel(); + delete iPeriodic; + iPeriodic = NULL; + } + + iPktDrv->StopInterface(); + PostProgressMessage(KLinkLayerClosed, iError); + PostFlowDownMessage(iError); + + MaybePostDataClientIdle(); + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::EtherFrame +// ----------------------------------------------------------------------------- +// +TInt CLANLinkCommon::EtherFrame(RMBufChain &aPdu, TDesC8& aDestAddr, TUint16 aType, TUint8& aDscp) + { + RMBufChain ethHdr; + TUint etherHeaderSize = (iEtherType==EStandardEthernet) ? + KEtherHeaderSize : KEtherLLCHeaderSize; + + TRAPD(ret, ethHdr.AllocL(etherHeaderSize)); + if(ret != KErrNone) + { + return ret; + } + + TEtherLLCFrame *hdrBuf = reinterpret_cast(ethHdr.First()->Buffer()); + + //Get the packet info: + RMBufPktInfo* info = RMBufPacket::PeekInfoInChain(aPdu); + + // Fill in the dest, src Mac addresses: + hdrBuf->SetDestAddr(aDestAddr); + hdrBuf->SetSrcAddr(iMacAddr); + + switch(iEtherType) + { + case EStandardEthernet: + BigEndian::Put16((TUint8*)&hdrBuf->iType,aType); + break; + case ELLCEthernet: + // Several fields to fill in. According to nifmbuf.h, + // info->iLength gives the actual length of the packet. + BigEndian::Put16((TUint8*)&hdrBuf->iLen,static_cast(info->iLength)); + hdrBuf->iDSAP=KLLC_SNAP_DSAP; + hdrBuf->iSSAP=KLLC_SNAP_SSAP; + hdrBuf->iCtrl=KLLC_SNAP_CTRL; + hdrBuf->SetOUI(0); + hdrBuf->SetType(aType); + break; + default: + // Can't handle any other kind of Ethernet header. + return KErrGeneral; + } + + //Remove the original first Packet - by trimming the info from the packet. + aPdu.TrimStart(aPdu.Length() - info->iLength); // At this point, info becomes invalid. + + //Extract the DSCP value as aPdu points to IP packet now + if (KIPFrameType == aType) + { + TInet6HeaderIP4 *ipv4hdr = (TInet6HeaderIP4 *)aPdu.First()->Ptr(); + TUint8 TOS = ipv4hdr->TOS(); + aDscp = (TOS >> 2) & 0xff; + DEBUG2( "CLanLinkCommon::EtherFrame() - DSCP of the IPv4 packet: 0x%02X (%u)", + aDscp, aDscp ); + } + else if (KIP6FrameType == aType) + { + TInet6HeaderIP *ipv6hdr = (TInet6HeaderIP *)aPdu.First()->Ptr(); + TUint8 TrafficClass = ipv6hdr->TrafficClass(); + aDscp = (TrafficClass >> 2) & 0xff; + DEBUG2( "CLanLinkCommon::EtherFrame() - DSCP of the IPv6 packet: 0x%02X (%u)", + aDscp, aDscp ); + } + + //Finally, add the saved packet buffer to the mac header + aPdu.Prepend(ethHdr); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::FrameSend +// ----------------------------------------------------------------------------- +// +TInt CLANLinkCommon::FrameSend( + RMBufChain& aPdu, + TDesC8& aDestAddr, + TUint16 aType ) + { + // Call down from the Protocol + // The data begins in the second MBuf - because the first one + // is the info. The upper layer must have filled in the destination + // and source Mac addresses before this method is called and must + // supply the ether header type in aType. + // EtherFrame strips off the info and replaces it by the proper + // ether header. + + TUint8 dscp( 0 ); + TInt err = EtherFrame( aPdu, aDestAddr, aType, dscp ); + if( err != KErrNone ) + { + // drop the packet but _don't_ return an error (if we return + // an error from here, the stack thinks it is fatal...) + aPdu.Free(); + return KContinueSending; + } + + // Map DSCP values to desired access class and user priority values. + T8021DPriority userPriority( KDSCPtoUP[dscp] ); + TWlmAccessClass accessClass( KUPtoAC[userPriority] ); + TBool dropPacket( EFalse ); + + // ARP packets are treated as Voice traffic. + if( aType == KArpFrameType ) + { + DEBUG( "CLanLinkCommon::FrameSend() - ARP packet" ); + + userPriority = E8021DUserPriorityNC; + accessClass = EWlmAccessClassVoice; + } + + if( iAcArray[accessClass]->IsAdmitted() ) + { + DEBUG1( "CLanLinkCommon::FrameSend() - traffic admitted on AC %u", + accessClass ); + } + else + { + DEBUG1( "CLanLinkCommon::FrameSend() - traffic NOT admitted on AC %u", + accessClass ); + + // Find an admitted access class. + DownGradePacket( userPriority, dropPacket ); + } + + if( !dropPacket ) + { + //Prepend UP value to the packet + RMBufChain UPBuf; + TRAPD( allocRet, UPBuf.AllocL( sizeof(TUint8) ) ); + if( allocRet != KErrNone ) + { + // drop the packet but _don't_ return an error (if we return + // an error from here, the stack thinks it is fatal...) + aPdu.Free(); + return KContinueSending; + } + + (UPBuf.First())->Put((TUint8)userPriority); + aPdu.Prepend( UPBuf ); + + DEBUG2( "CLanLinkCommon::FrameSend() - sending packet on AC %u with UP %u", + KUPtoAC[userPriority], + userPriority ); + TInt ret = iPktDrv->Send( aPdu ); + + // ARP packets will never triggers traffic stream creation. + if( aType == KArpFrameType ) + { + return ret; + } + + // Notify the per-AC handler. + iAcArray[accessClass]->OnFrameSend(); + + if( ret != KContinueSending ) + { + // Suspend inactivity timer for all ACs if NIF Queue is full. + for( TUint idx( 0 ); idx < EWlmAccessClassMax; ++idx ) + { + iAcArray[idx]->SuspendInactivityTimer(); + } + } + + return ret; + } + else + { + DEBUG( "CLanLinkCommon::FrameSend() - no ACs admitted, dropping packet" ); + + aPdu.Free(); + + return KContinueSending; + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::DownGradePacket +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::DownGradePacket( + T8021DPriority& aUP, + TBool& aDrop ) + { + DEBUG1( "CLanLinkCommon::DownGradePacket() - UP before downgrade: %u", + aUP ); + + /** + * This method wouldn't be called if downgrade wasn't needed, + * so we don't have to check Voice priority at all. + */ + TWlmAccessClass accessClass( KNextAC[KUPtoAC[aUP]] ); + while( accessClass != EWlmAccessClassMax ) + { + if( iAcArray[accessClass]->IsAdmitted() ) + { + aUP = KACtoUP[accessClass]; + aDrop = EFalse; + + DEBUG1( "CLanLinkCommon::DownGradePacket() - UP after downgrade: %u", + aUP ); + + return; + } + + accessClass = KNextAC[accessClass]; + } + + DEBUG( "CLanLinkCommon::DownGradePacket() - packet will be dropped" ); + + aDrop = ETrue; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::GetProtocolType +// ----------------------------------------------------------------------------- +// +TInt CLANLinkCommon::GetProtocolType( + TUint8* aEtherHeader, + TUint16& aEtherType ) + { + TEtherFrame* etherFrame = reinterpret_cast(aEtherHeader); + TUint16 etherType = etherFrame->GetType(); + + if( etherType >= KMinEtherType) + { + // type/length field >= 1536, this is Ethernet II frame + aEtherType = etherType; + } + else + { + // type/length field is something between KEtherLLCMaxLengthFieldValue + // and KMinEtherType, this shouldn't happen... + //__ASSERT_DEBUG(EFalse, User::Panic(_L("wlannif"), KErrGeneral)); + return KErrNotSupported; + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::Process +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::Process( + RMBufChain& aPdu, + TUint8* aEtherHeader, + TUint8 aUPValue ) + { + TUint16 etherCode(0); + TBool packetProcessed(EFalse); + TInt ret=GetProtocolType( aEtherHeader, etherCode ); + if( ret==KErrNone ) + { // It's an ethernet packet of some kind. + DEBUG2("CLANLinkCommon::Process() - UP: %u, ethertype: 0x%04X", + aUPValue, etherCode ); + + TUint bearerLim = iBearers->Count(); + for( TUint index=0;indexWantsProtocol( + etherCode, aPdu.First()->Next()->Buffer()) ) + { + bearer->Process( aPdu ); + packetProcessed=ETrue; + } + } + } + if( ret!=KErrNone || !packetProcessed ) + { + aPdu.Free(); // Something strange about the packet - bin it + } + else + { + // Notify the per-AC handler. + iAcArray[KUPtoAC[aUPValue]]->OnFrameReceive(); + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::ResumeSending +// ----------------------------------------------------------------------------- +// +EXPORT_C void CLANLinkCommon::ResumeSending() + { + DEBUG( "CLanLinkCommon::ResumeSending()" ); + + TUint bearerLim = iBearers->Count(); + for( TUint index=0;indexStartSending( (CProtocolBase*)this ); + } + + for( TUint idx( 0 ); idx < EWlmAccessClassMax; ++idx ) + { + iAcArray[idx]->ResumeInactivityTimer(); + } + } + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::ReadInt(const TDesC& /*aField*/, TUint32& /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::WriteInt(const TDesC& /*aField*/, TUint32 /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::ReadDes(const TDesC& /*aField*/, TDes8& /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::ReadDes(const TDesC& /*aField*/, TDes16& /*aValue*/) +{ + return KErrNotSupported; + +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::WriteDes(const TDesC& /*aField*/, const TDesC8& /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::WriteDes(const TDesC& /*aField*/, const TDesC16& /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::ReadBool(const TDesC& /*aField*/, TBool& /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C TInt CLANLinkCommon::WriteBool(const TDesC& /*aField*/, TBool /*aValue*/) +{ + return KErrNotSupported; +} + +/** + +*/ +EXPORT_C void CLANLinkCommon::IfProgress(TInt aStage, TInt aError) +{ + PostProgressMessage(aStage, aError); +} + +/** + +*/ +EXPORT_C void CLANLinkCommon::IfProgress(TSubConnectionUniqueId /*aSubConnectionUniqueId*/, TInt aStage, TInt aError) +{ + // Not quite correct - there is no subconnection id specific progress message. + IfProgress(aStage, aError); +} + +/** + +*/ +EXPORT_C void CLANLinkCommon::NifEvent(TNetworkAdaptorEventType /*aEventType*/, TUint /*aEvent*/, const TDesC8& /*aEventData*/, TAny* /*aSource*/) +{ +} + +// ====================================================================================== +// +// from MFlowBinderControl + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::GetControlL +// ----------------------------------------------------------------------------- +// +EXPORT_C MLowerControl* CLANLinkCommon::GetControlL(const TDesC8& aName) +/** +Request from upper CFProtocol to retrieve our MLowerControl class. + +@param aName Protocol Name. Presently, only "ip" and "ip6" are supported. +@return pointer to our MLowerControl class instance. We leave on an error, hence this routine should +never return NULL. +*/ + { + DEBUG("CLANLinkCommon::GetControlL()"); + + CLanxBearer* bearer=NULL; + if (aName.CompareF(KDescIp6) == 0) + { + bearer = new(ELeave) CLanIp6Bearer(this); + } + else if (aName.CompareF(KDescIp) == 0 || aName.CompareF(KDescIcmp) == 0) + { + bearer = new(ELeave) CLanIp4Bearer(this); + } + else + { + User::Leave(KErrNotSupported); + } + + CleanupStack::PushL(bearer); + bearer->ConstructL(); + + iBearers->AppendL(bearer); + ProvisionBearerConfigL(aName); + CleanupStack::Pop(); + return bearer; + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::BindL +// ----------------------------------------------------------------------------- +// +EXPORT_C MLowerDataSender* CLANLinkCommon::BindL(const TDesC8& aProtocol, MUpperDataReceiver* aReceiver, MUpperControl* aControl) +/** +Request from upper CFProtocol to bind to this module. + +@param aProtocol protocol name (e.g. "ip", "ip6" etc). +@param aReceiver pointer to MUpperDataReceiver instance of upper CFProtocol +@param aControl pointer to MUpperControl instance of upper CFProtocol +@return pointer to our MLowerDataSender instance (eventually passed to the upper CFProtocol) +*/ + { + DEBUG("CLANLinkCommon::BindL()"); + + TInt index = 0; + CLanxBearer* bearer = FindBearerByProtocolName(aProtocol, index); + if (bearer) + { + bearer->SetUpperPointers(aReceiver, aControl); + if (iValidMacAddr) + { + aControl->StartSending(); + } + } + else + { + User::Leave(KErrNotSupported); + } + iSubConnectionProvider.RNodeInterface::PostMessage(Id(), TCFControlProvider::TActive().CRef()); + return bearer; + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::Unbind +// ----------------------------------------------------------------------------- +// +EXPORT_C void CLANLinkCommon::Unbind(MUpperDataReceiver* /*aReceiver*/, MUpperControl* aControl) +/** +Request from upper CFProtocol to unbind from this module. + +@param aReceiver pointer to data receiver class of upper CFProtocol (originally passed to it in downward BindL() request) +@param aControl pointer to control class of upper CFProtocol (originally passed to it in downward BindL() request) +*/ + + { + DEBUG("CLANLinkCommon::Unbind()"); + + TInt index = 0; + CLanxBearer* bearer = FindBearerByUpperControl(aControl, index); + ASSERT(bearer); + iBearers->Delete(index); + delete bearer; + + // If no-one remains bound to us, signal data client idle to SCPR + MaybePostDataClientIdle(); + } + + +// +// Utilities +// + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::FindBearerByProtocolName +// ----------------------------------------------------------------------------- +// +CLanxBearer* CLANLinkCommon::FindBearerByProtocolName(const TDesC8& aProtocol, TInt& aIndex) const +/** +Search the iBearers array searching for a match by protocol name. + +@param aProtocol name of protocol (in) +@param aIndex on success, index of found entry (>=0), else -1. +@return pointer to CLanxBearer entry on success else NULL. +*/ + { + DEBUG("CLANLinkCommon::FindBearerByProtocolName()"); + + TInt count = iBearers->Count(); + for (TInt i = 0 ; i < count ; ++i) + { + CLanxBearer* bearer = iBearers->At(i); + if (bearer->ProtocolName() == aProtocol) + { + aIndex = i; + return bearer; + } + } + aIndex = -1; + return NULL; + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::FindBearerByUpperControl +// ----------------------------------------------------------------------------- +// +CLanxBearer* CLANLinkCommon::FindBearerByUpperControl(const MUpperControl* aUpperControl, TInt& aIndex) const +/** +Search the iBearers array searching for a match by protocol name. + +@param aProtocol name of protocol (in) +@param aIndex on success, index of found entry (>=0), else -1. +@return pointer to CLanxBearer entry on success else NULL. +*/ + { + DEBUG("CLANLinkCommon::FindBearerByUpperControl()"); + + TInt count = iBearers->Count(); + for (TInt i = 0 ; i < count ; ++i) + { + CLanxBearer* bearer = iBearers->At(i); + if (bearer->MatchesUpperControl(aUpperControl)) + { + aIndex = i; + return bearer; + } + } + aIndex = -1; + return NULL; + } + +// ===================================================================================== +// +// MCFNode + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::ReceivedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CLANLinkCommon::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) +/** +Routine called on an incoming message from SCPR + +@param aCFMessage incoming message +@return KErrNone, else a system wide error code. +*/ + { + DEBUG1("CLANLinkCommon::ReceivedL(), aCFMessage=%d", aMessage.MessageId().MessageId()); + + CSubConnectionFlowBase::ReceivedL(aSender, aRecipient, aMessage); + + if (TEBase::ERealmId == aMessage.MessageId().Realm()) + { + switch (aMessage.MessageId().MessageId()) + { + case TEBase::TError::EId : + SubConnectionError(static_cast(aMessage).iValue); + break; + case TEBase::TCancel::EId : + CancelStartFlow(); + break; + default: + ASSERT(EFalse); + } + } + else if (TEChild::ERealmId == aMessage.MessageId().Realm()) + { + switch (aMessage.MessageId().MessageId()) + { + case TEChild::TDestroy::EId : + Destroy(); + break; + default: + ASSERT(EFalse); + } + } + else if (TCFDataClient::ERealmId == aMessage.MessageId().Realm()) + { + switch (aMessage.MessageId().MessageId()) + { + case TCFDataClient::TStart::EId : + StartFlowL(); + break; + case TCFDataClient::TProvisionConfig::EId: + ProvisionConfig(static_cast(aMessage).iConfig); + break; + case TCFDataClient::TStop::EId : + StopFlow(static_cast(aMessage).iValue); + break; + case TCFDataClient::TBindTo::EId : + { + TCFDataClient::TBindTo& bindToReq = message_cast(aMessage); + if (!bindToReq.iNodeId.IsNull()) + { + User::Leave(KErrNotSupported); + } + RClientInterface::OpenPostMessageClose(Id(), aSender, TCFDataClient::TBindToComplete().CRef()); + break; + } + default: + ASSERT(EFalse); + } + } + else if (TLinkMessage::ERealmId == aMessage.MessageId().Realm()) + { + switch (aMessage.MessageId().MessageId()) + { + case TLinkMessage::TAgentToFlowNotification::EId: + { + TLinkMessage::TAgentToFlowNotification& msg = message_cast(aMessage); + if(msg.iValue != EAgentToNifEventVendorSpecific) + { + User::Leave(KErrNotSupported); + } + else //EAgentToNifEventVendorSpecific + { + //User::LeaveIfError((iPktDrv) ? iPktDrv->Notification( + // static_cast(msg.iValue), NULL) : KErrNotSupported); + DEBUG("CLANLinkCommon::ReceivedL(), rcvd disconnect notification from Agent"); + iError = KErrDisconnected; + StopInterface(); + } + } + break; + default: + ASSERT(EFalse); + }; //endswitch + } + else + { + ASSERT(EFalse); + } + } + +// +// Methods for handling incoming SCPR messages +// + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::StartFlowL +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::StartFlowL() + { + DEBUG("CLANLinkCommon::StartFlowL()"); + + if ( !iPktDrv ) + LoadPacketDriverL(); + + iStopRequested = EFalse; + + ASSERT(iMMState == EStopped); + + if (iSavedError != KErrNone) + { + // If there were errors during prior processing of the TProvisionConfig message, + // leave here and cause a TError response to TDataClientStart. + User::Leave(iSavedError); + } + + iValidMacAddr = ReadMACSettings(); + + iMMState = EStarting; + User::LeaveIfError(iPktDrv->StartInterface()); + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::CancelStartFlow +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::CancelStartFlow() + { + if (iMMState == EStarting) + { + iStopRequested = ETrue; + + iPktDrv->StopInterface(); + PostProgressMessage(KLinkLayerClosed, KErrCancel); + PostFlowDownMessage(KErrCancel); + + MaybePostDataClientIdle(); + } + } + + +// half a second should be enough for sending DHCPRELEASE +static const TInt KDhcpReleaseDelay = 500000; + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::StopFlow +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::StopFlow(TInt aError) + { + DEBUG("CLANLinkCommon::StopFlow()"); + + iStopRequested = ETrue; + + iMMState = EStopping; + + iError = aError; + + TCallBack callback(StopCb, this); + TRAPD(err, iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard)); + if(err == KErrNone) + { + // Call the callback after KDhcpReleaseDelay. This is done only once, + // but we need to put something (KMaxTInt) to CPeriodic's interval. + iPeriodic->Start(TTimeIntervalMicroSeconds32(KDhcpReleaseDelay), TTimeIntervalMicroSeconds32(KMaxTInt), callback); + } + else + { + iPeriodic = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::SubConnectionGoingDown +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::SubConnectionGoingDown() + { + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::SubConnectionError +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::SubConnectionError(TInt /*aError*/) + { + } + + +/* +Provisioning description for Ethernet CFProtocol Flow: + +- on receipt of the TProvisionConfig message, the pointer contained within is stored + in iAccessPointConfig and the provisioning information contained within the AccessPointConfig + array is validated: + - at least one of TLanIp4Provision or TLanIp6Provision must be present. They are added by the EtherMCPr and + populated from CommsDat. + +- the packet driver is loaded. + +- if any of the above steps fail, the resulting error is saved in iSaveError so that when TDataClientStart message is + subsequently received, a TError message can be sent in response (there is no response to TProvisionConfig message). +*/ + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::ProvisionConfig +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::ProvisionConfig( const RMetaExtensionContainerC& aConfigData ) + { + DEBUG("CLANLinkCommon::ProvisionConfig()"); + + iSavedError = KErrNone; + + AccessPointConfig().Close(); + AccessPointConfig().Open(aConfigData); + + iLanIp4Provision = static_cast(AccessPointConfig().FindExtension(STypeId::CreateSTypeId(TLanIp4Provision::EUid, TLanIp4Provision::ETypeId))); + if (iLanIp4Provision) + { + DEBUG("CLANLinkCommon::ProvisionConfig() - IP4 config to be provisioned"); + } + + iLanIp6Provision = static_cast(AccessPointConfig().FindExtension(STypeId::CreateSTypeId(TLanIp6Provision::EUid, TLanIp6Provision::ETypeId))); + if (iLanIp6Provision) + { + DEBUG("CLANLinkCommon::ProvisionConfig() - IP6 config to be provisioned"); + } + + if (iLanIp4Provision == NULL && iLanIp6Provision == NULL) + { + // At least one set of IP4/6 provisioning information must be present + iSavedError = KErrCorrupt; + return; + } + + TRAPD(err, ProvisionConfigL()); + if (err != KErrNone) + { + iSavedError = err; + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::ProvisionConfigL +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::ProvisionConfigL() + { + DEBUG("CLANLinkCommon::ProvisionConfigL()"); + + // Provision Bearers + if (iBearers->Count()) + { + ProvisionBearerConfigL(KDescIp()); + ProvisionBearerConfigL(KDescIp6()); + } + + iWLMServerCommon = new (ELeave) CLANNifWLMServerCommon(this); + iWLMServerCommon->ConstructL(); + + TBool isAutomaticMgmt( ETrue ); + CRepository* repository = NULL; + TRAP_IGNORE( repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ) ); + if( repository ) + { + TInt temp( 0 ); + TInt ret = repository->Get( KWlanAutomaticTrafficStreamMgmt, temp ); + if( ret == KErrNone && + !temp ) + { + isAutomaticMgmt = EFalse; + } + + delete repository; + repository = NULL; + } + + for( TUint idx( 0 ); idx < EWlmAccessClassMax; ++idx ) + { + iAcArray[idx] = CLANNifWLMServerPerAC::NewL( + static_cast( idx ), + KTsInactivityTime[idx], + isAutomaticMgmt ); + } + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::Destroy +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::Destroy() + { + DEBUG("CLANLinkCommon::Destroy()"); + + ASSERT(iMMState==EStopped); + DeleteThisFlow(); + } + +// Utility functions + +void CLANLinkCommon::ProvisionBearerConfigL(const TDesC8& aName) + { + DEBUG("CLANLinkCommon::ProvisionBearerConfigL()"); + + TInt index = -1; + CLanxBearer* bearer = FindBearerByProtocolName(aName, index); + if (bearer) + { + if (aName.CompareF(KDescIp) == 0) + { + if (iLanIp4Provision) + { + bearer->SetProvisionL(iLanIp4Provision); // CLanIp4Bearer + } + } + else if (aName.CompareF(KDescIp6) == 0) + { + if (iLanIp6Provision) + { + bearer->SetProvisionL(iLanIp6Provision); // CLanIp6Bearer + } + } + } + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::PostProgressMessage +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::PostProgressMessage(TInt aStage, TInt aError) + { + DEBUG("CLANLinkCommon::PostProgressMessage()"); + + //Be careful when sending TStateChange message as RNodeChannelInterface will override the activity id + iSubConnectionProvider.RNodeInterface::PostMessage(Id(), TCFMessage::TStateChange( Elements::TStateChange( aStage, aError) ).CRef()); + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::SetAllowedBearer +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::SetAllowedBearer(CLanxBearer* aBearer) + { + iOnlyThisBearer = aBearer; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::BearereIsActive +// ----------------------------------------------------------------------------- +// +TBool CLANLinkCommon::BearerIsActive(CLanxBearer* aBearer) + { + if (!iOnlyThisBearer || + aBearer == iOnlyThisBearer) + { + return ETrue; + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::PostFlowDownMessage +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::PostFlowDownMessage(TInt aError) + { + DEBUG("CLANLinkCommon::PostFlowDownMessage()"); + + if (iMMState == EStopping) + { + iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStopped(aError).CRef()); + } + else if (iMMState == EStarting) + { + iSubConnectionProvider.PostMessage(Id(), TEBase::TError(TCFDataClient::TStart::Id(), aError).CRef()); + } + else if (iMMState == EStarted) + { + iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TDataClientGoneDown(aError).CRef()); + } + iMMState = EStopped; + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::PostFlowGoingDownMessage +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::PostFlowGoingDownMessage(TInt aError, MNifIfNotify::TAction /*aAction*/) + { + DEBUG("CLANLinkCommon::PostFlowGoingDownMessage()"); + + // TDataClientGoneDown only makes sense if the flow was actually started + ASSERT(iMMState == EStarted); + iMMState = EStopped; + iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TDataClientGoneDown(aError).CRef()); + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::PostDataClientStartedMessage +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::PostDataClientStartedMessage() + { + DEBUG("CLANLinkCommon::PostDataClientStartedMessage()"); + + iMMState = EStarted; + iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStarted().CRef()); + } + + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::MaybePostDataClientIdle +// ----------------------------------------------------------------------------- +// +void CLANLinkCommon::MaybePostDataClientIdle() + { + DEBUG("CLANLinkCommon::MaybePostDataClientIdle()"); + + if (iBearers->Count() == 0 && iMMState == EStopped) + { + iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TIdle().CRef()); + } + } + + +void TEtherLLCFrame::SetDestAddr( TDesC8& aDest) +{ + DEBUG("TEtherLLCFrame::SetDestAddr()"); + + Mem::Copy(iDestAddr, aDest.Ptr(), KMACByteLength); +} + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::SetSrcAddr +// ----------------------------------------------------------------------------- +// +void TEtherLLCFrame::SetSrcAddr(TDesC8& aSrc) +{ + DEBUG("TEtherLLCFrame::SetSrcAddr()"); + + Mem::Copy(iSrcAddr, aSrc.Ptr(), KMACByteLength); +} + +// ----------------------------------------------------------------------------- +// CLANLinkCommon::SetOUI +// ----------------------------------------------------------------------------- +// +void TEtherLLCFrame::SetOUI(TUint32 aOUI) +{ + DEBUG("TEtherLLCFrame::SetOUI()"); + + //aOUI is in native order, but the result is + //always stored in network byte order. + //Can't use the bigendian methods, because + //they only work for 16 and 32 -bit items. + OUI[0] = (TUint8)((aOUI>>16)&0xff); + OUI[1] = (TUint8)((aOUI>>8)&0xff); + OUI[2] = (TUint8)(aOUI&0xff); +} diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/ecom_impl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/ecom_impl.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM implementation for provider factories +* +*/ + +/* +* %version: 5 % +*/ + +#include +#include + +#include "WlanCfproto.h" +#include "wlanmcprfactory.h" + + +// ---------------- ECOM Implementation ---------------- + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KWlanFlowImplementationUid, CWlanSubConnectionFlowFactory::NewL), + IMPLEMENTATION_PROXY_ENTRY(CWlanMetaConnectionProviderFactory::iUid, CWlanMetaConnectionProviderFactory::NewL) + }; + + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/wlanmcpr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/wlanmcpr.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,338 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements WLAN meta connection provider +* +*/ + +/* +* %version: 8 % +*/ + +#include +#include +#include +#include +#include +#include "wlanmcpr.h" +#include "WlanProvision.h" +#include "am_debug.h" + + +using namespace ESock; +using namespace NetStateMachine; +using namespace MCprActivities; +using namespace WlanMCprStates; +using namespace Messages; + + + +// No Bearer Activity +namespace WlanMCPRNoBearerActivity +{ +DECLARE_DEFINE_NODEACTIVITY(ECFActivityNoBearer, WlanMCPRNoBearer, TCFControlProvider::TNoBearer) + FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingNoBearer, MeshMachine::TNoTag) + LAST_NODEACTIVITY_ENTRY(MeshMachine::KNoTag, CoreNetStates::TSendBearer) +NODEACTIVITY_END() +} + + + +// Activity Map +namespace WlanMCprStates +{ +DEFINE_EXPORT_ACTIVITY_MAP(stateMap) + ACTIVITY_MAP_ENTRY(WlanMCPRNoBearerActivity, WlanMCPRNoBearer) +ACTIVITY_MAP_END_BASE(AgentMCprActivities, agentMCprActivities) +} // namespace WlanMCprStates + +//-========================================================= +// +//CWlanMetaConnectionProvider implementation +// +//-========================================================= + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CWlanMetaConnectionProvider* CWlanMetaConnectionProvider::NewL(ESock::CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo) + { + CWlanMetaConnectionProvider* self = new (ELeave) CWlanMetaConnectionProvider(aFactory, aProviderInfo, WlanMCprStates::stateMap::Self()); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::ConstructL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CWlanMetaConnectionProvider::ConstructL() + { + CAgentMetaConnectionProvider::ConstructL(); + SetAccessPointConfigFromDbL(); + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::CWlanMetaConnectionProvider +// ----------------------------------------------------------------------------- +// +EXPORT_C CWlanMetaConnectionProvider::CWlanMetaConnectionProvider(CMetaConnectionProviderFactoryBase& aFactory, + const ESock::TProviderInfo& aProviderInfo, + const MeshMachine::TNodeActivityMap& aActivityMap) +: CAgentMetaConnectionProvider(aFactory,aProviderInfo,aActivityMap) + { + + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::~CWlanMetaConnectionProvider +// ----------------------------------------------------------------------------- +// +EXPORT_C CWlanMetaConnectionProvider::~CWlanMetaConnectionProvider() + { + + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::ReceivedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CWlanMetaConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) + { + DEBUG1("CWlanMetaConnectionProvider::ReceivedL, aCFMessage=%d", aMessage.MessageId().MessageId()); + + //ESOCK_DEBUG_MESSAGE_INTERCEPT(aSender, aMessage, aRecipient); + + MeshMachine::TNodeContext ctx(*this, aMessage, aSender, aRecipient); + CCoreMetaConnectionProvider::Received(ctx); + User::LeaveIfError(ctx.iReturn); + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::SetAccessPointConfigFromDbL +// ----------------------------------------------------------------------------- +// +void CWlanMetaConnectionProvider::SetAccessPointConfigFromDbL() + { + DEBUG("CWlanMetaConnectionProvider::SetAccessPointConfigFromDbL"); + + RMetaExtensionContainer mec; + static_cast(mec.Open(AccessPointConfig())); + CleanupClosePushL(mec); + + // Open an IAP specific view on CommsDat + CCommsDatIapView* iapView = OpenIapViewLC(); + + // Presumptions: + // - none of the extensions can already exist in the AccessPointConfig array. AppendExtensionL() + // is presumed to panic if adding the same extension a second time. + // - if we have added several extensions to the AccessPointConfig array before getting a failure + // and leaving, it is presumed that the MCPr will be destroyed and AccessPointConfig destructor + // will clean up the extensions immediately afterwards. + + ProvisionNetworkConfigL(iapView, mec); + + CleanupStack::PopAndDestroy(); // CloseIapView(); + + AccessPointConfig().Close(); + AccessPointConfig().Open(mec); + CleanupStack::PopAndDestroy(&mec); + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::ProvisionNetworkConfigL +// ----------------------------------------------------------------------------- +// +void CWlanMetaConnectionProvider::ProvisionNetworkConfigL(CCommsDatIapView* aIapView, ESock::RMetaExtensionContainer& aMec) + { + HBufC* buf = NULL; + aIapView->GetTextL(KCDTIdLANIfNetworks, buf); + CleanupStack::PushL(buf); + if (buf->Length() == 0) + { + User::Leave(KErrCorrupt); + } + + TPtrC16 networks; + networks.Set(*buf); + TPtrC16 current; + TUint32 order = 0; + TInt commaPos = 0; + while (commaPos != KErrNotFound) + { + commaPos = networks.LocateF(','); + if (commaPos == KErrNotFound) + { + // take all of string + current.Set(networks); + } + else + { + current.Set(networks.Ptr(), commaPos); + } + + if (!current.CompareF(_L("ip"))) + { + ProvisionIp4ConfigL(aIapView, order, aMec); + } + else if (!current.CompareF(_L("ip6"))) + { + ProvisionIp6ConfigL(aIapView, order, aMec); + } + else + { + User::Leave(KErrCorrupt); + } + + order++; + networks.Set(networks.Mid(commaPos+1)); + } + + CleanupStack::PopAndDestroy(buf); + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::ProvisionIp4ConfigL +// ----------------------------------------------------------------------------- +// +void CWlanMetaConnectionProvider::ProvisionIp4ConfigL(CCommsDatIapView* aIapView, TUint32 aOrder, ESock::RMetaExtensionContainer& aMec) + { + TLanIp4Provision* ip4Provision = new (ELeave) TLanIp4Provision; + CleanupStack::PushL(ip4Provision); + + ip4Provision->SetOrder(aOrder); + + // Read IP address configuration parameters + TBool serverRequired; + aIapView->GetBoolL(KCDTIdLANIpAddrFromServer, serverRequired); + + TUint32 addr; + TInt err; + + ip4Provision->SetLocalAddr(KInetAddrNone); + ip4Provision->SetNetMask(KInetAddrNone); + ip4Provision->SetDefGateway(KInetAddrNone); + + if (!serverRequired) + { + GetIp4AddrL(aIapView, KCDTIdLANIpAddr, addr); + ip4Provision->SetLocalAddr(addr); + GetIp4AddrL(aIapView, KCDTIdLANIpNetMask, addr); + ip4Provision->SetNetMask(addr); + + err = GetIp4Addr(aIapView, KCDTIdLANIpGateway, addr); + if (err == KErrNone) + { + ip4Provision->SetDefGateway(addr); + } + else if (err == KErrNotFound) + { + ip4Provision->SetDefGateway(ip4Provision->LocalAddr()); + } + else + { + User::Leave(err); + } + + // Because CommDB doesn't define a Broadcast Address field, we must + // calculate the broadcast address. This is based on the localAddr + // and the netMask. + + TInetAddr localAddr(ip4Provision->LocalAddr(), 0); + TInetAddr netMask(ip4Provision->NetMask(), 0); + TInetAddr broadcast; + broadcast.SubNetBroadcast(ip4Provision->LocalAddr(), ip4Provision->NetMask()); + ip4Provision->SetBroadcastAddr(broadcast.Address()); + } + + ip4Provision->SetPrimaryDns(KInetAddrNone); + ip4Provision->SetSecondaryDns(KInetAddrNone); + + aIapView->GetBoolL(KCDTIdLANIpDNSAddrFromServer, serverRequired); + if (!serverRequired) + { + err = GetIp4Addr(aIapView, KCDTIdLANIpNameServer1, addr); + if (err == KErrNone) + { + ip4Provision->SetPrimaryDns(addr); + err = GetIp4Addr(aIapView, KCDTIdLANIpNameServer2, addr); + if (err == KErrNone) + { + ip4Provision->SetSecondaryDns(addr); + } + } + + if (err != KErrNone && err != KErrNotFound) + { + User::Leave(err); + } + } + + // Append the provisioning object to the CAccessPointConfig array + aMec.AppendExtensionL(ip4Provision); + CleanupStack::Pop(ip4Provision); + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProvider::ProvisionIp6ConfigL +// ----------------------------------------------------------------------------- +// +void CWlanMetaConnectionProvider::ProvisionIp6ConfigL(CCommsDatIapView* aIapView, TUint32 aOrder, ESock::RMetaExtensionContainer& aMec) + { + TLanIp6Provision* ip6Provision = new (ELeave) TLanIp6Provision; + CleanupStack::PushL(ip6Provision); + + ip6Provision->SetOrder(aOrder); + + // Determine whether static DNS configuration is required. + TBool dynamicDns = ETrue; + + // By default, Ensure that static DNS addresses are set as unspecified, + // so they are not used in Control(KSoIfConfig). + ip6Provision->SetPrimaryDns(KInet6AddrNone); + ip6Provision->SetSecondaryDns(KInet6AddrNone); + + // Ignore any errors from reading this field - default to dynamicDns = ETrue + (void) aIapView->GetBool(KCDTIdLANIp6DNSAddrFromServer, dynamicDns); + + if (!dynamicDns) + { + // Read static DNS addresses + TInt err; + TIp6Addr addr6; + err = GetIp6Addr(aIapView, KCDTIdLANIpNameServer1, addr6); + if (err == KErrNone) + { + ip6Provision->SetPrimaryDns(addr6); + err = GetIp6Addr(aIapView, KCDTIdLANIpNameServer2, addr6); + if (err == KErrNone) + { + ip6Provision->SetSecondaryDns(addr6); + } + } + + if (err != KErrNone && err != KErrNotFound) + { + User::Leave(err); + } + } + + // Append the provisioning object to the CAccessPointConfig array + aMec.AppendExtensionL(ip6Provision); + CleanupStack::Pop(ip6Provision); + } + + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlannwif/src/wlanmcprfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlannwif/src/wlanmcprfactory.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements WLAN meta connection provider factory +* +*/ + +/* +* %version: 4 % +*/ + +#include "wlanmcprfactory.h" +#include "wlanmcpr.h" +#include +#include "am_debug.h" + +#include + + +using namespace ESock; + +//-========================================================= +// +// CWlanMetaConnectionProviderFactory methods +// +//-========================================================= + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProviderFactory::NewL +// ----------------------------------------------------------------------------- +// +CWlanMetaConnectionProviderFactory* CWlanMetaConnectionProviderFactory::NewL(TAny* aParentContainer) + { + DEBUG("CWlanMetaConnectionProviderFactory::NewL"); + + return new (ELeave) CWlanMetaConnectionProviderFactory(TUid::Uid(CWlanMetaConnectionProviderFactory::iUid), *(reinterpret_cast(aParentContainer))); + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProviderFactory::CWlanMetaConnectionProviderFactory +// ----------------------------------------------------------------------------- +// +CWlanMetaConnectionProviderFactory::CWlanMetaConnectionProviderFactory(TUid aFactoryId, CMetaConnectionFactoryContainer& aParentContainer) + : CMetaConnectionProviderFactoryBase(aFactoryId,aParentContainer) + { + } + +// ----------------------------------------------------------------------------- +// CWlanMetaConnectionProviderFactory::DoCreateL +// ----------------------------------------------------------------------------- +// +ESock::ACommsFactoryNodeId* CWlanMetaConnectionProviderFactory::DoCreateObjectL(ESock::TFactoryQueryBase& aQuery) + { + const TMetaConnectionFactoryQuery& query = static_cast(aQuery); + CMetaConnectionProviderBase* provider = CWlanMetaConnectionProvider::NewL(*this, query.iProviderInfo); + + ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider); + + return provider; + } diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/group/101f8e44.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/group/101f8e44.xml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/group/200100C0.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/group/200100C0.xml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for WLAN PSM plug-in +* +*/ + +/* +* %version: 7 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/wlanpsmplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(wlanpsmplugin.iby) + +// PSM Config files for HW use +200100C0.xml /epoc32/data/z/private/2000b187/200100c0.xml +101f8e44.xml /epoc32/data/z/private/2000b187/cenrep/101f8e44.xml + +// PSM Config files for WINSCW use +200100C0.xml /epoc32/release/winscw/udeb/z/private/2000b187/200100c0.xml +200100C0.xml /epoc32/release/winscw/urel/z/private/2000b187/200100c0.xml +101f8e44.xml /epoc32/release/winscw/udeb/z/private/2000b187/cenrep/101f8e44.xml +101f8e44.xml /epoc32/release/winscw/urel/z/private/2000b187/cenrep/101f8e44.xml + +PRJ_MMPFILES +wlanpsmplugin.mmp diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/group/wlanpsmplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/group/wlanpsmplugin.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: project specification file for the wlanpsmplugin +* +*/ + +/* +* %version: 9 % +*/ + +#include + +TARGET wlanpsmplugin.dll +TARGETTYPE plugin +UID 0x10009d8d 0x200100c0 +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +START RESOURCE ../src/200100C0.rss +TARGET wlanpsmplugin +END + +SOURCEPATH ../src +SOURCE wlanpsmplugin.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +OS_LAYER_SYSTEMINCLUDE + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY commsdat.lib +LIBRARY commdb.lib +LIBRARY wlmserver.lib \ No newline at end of file diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/inc/am_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/inc/am_debug.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debug utilities +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef AM_DEBUG_H +#define AM_DEBUG_H + +#include + +#ifdef _DEBUG + +/** +* Class for producing debug traces +* @lib +* @since Series 60 5.0 +*/ + +#define DEBUG(a) RDebug::Print(_L(a)) +#define DEBUG1(a,b) RDebug::Print(_L(a),b) +#define DEBUG2(a,b,c) RDebug::Print(_L(a),b,c) +#define DEBUG3(a,b,c,d) RDebug::Print(_L(a),b,c,d) +#define DEBUG4(a,b,c,d,e) RDebug::Print(_L(a),b,c,d,e) +#define DEBUG5(a,b,c,d,e,f) RDebug::Print(_L(a),b,c,d,e,f) +#define DEBUG6(a,b,c,d,e,f,g) RDebug::Print(_L(a),b,c,d,e,f,g) +#define DEBUG7(a,b,c,d,e,f,g,h) RDebug::Print(_L(a),b,c,d,e,f,g,h) +#define DEBUG8(a,b,c,d,e,f,g,h,i) RDebug::Print(_L(a),b,c,d,e,f,g,h,i) + +#else // _DEBUG + +#define DEBUG(a) /* _DEBUG is not defined. */ +#define DEBUG1(a,b) /* _DEBUG is not defined. */ +#define DEBUG2(a,b,c) /* _DEBUG is not defined. */ +#define DEBUG3(a,b,c,d) /* _DEBUG is not defined. */ +#define DEBUG4(a,b,c,d,e) /* _DEBUG is not defined. */ +#define DEBUG5(a,b,c,d,e,f) /* _DEBUG is not defined. */ +#define DEBUG6(a,b,c,d,e,f,g) /* _DEBUG is not defined. */ +#define DEBUG7(a,b,c,d,e,f,g,h) /* _DEBUG is not defined. */ +#define DEBUG8(a,b,c,d,e,f,g,h,i) /* _DEBUG is not defined. */ + +#endif // _DEBUG + +#endif // AM_DEBUG_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/inc/wlanpsmplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/inc/wlanpsmplugin.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: hdr file for WLAN PSM plug-in +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANPSMPLUGIN_H +#define WLANPSMPLUGIN_H + +// INCLUDES +#include +#include + +#include + +#include "rwlmserver.h" + +class MPsmSettingsProvider; + +/** + * WLAN PSM plugin + * This class implements WLAN PSM plugin logic. + * + * @since S60 S60 v5.1 + */ +class CWlanPsmPlugin : public CPsmPluginBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return The created object. + */ + static CWlanPsmPlugin* NewL( TPsmPluginCTorParams& initParams ); + + /** + * Destructor. + */ + virtual ~CWlanPsmPlugin(); + +public: + + // From CPsmPluginBase + void NotifyModeChange( const TInt aMode ); + +private: + CWlanPsmPlugin( TPsmPluginCTorParams& aInitParams ); + void ConstructL(); + void NotifyModeChangeL( const TInt aMode ); + +private: // data + + /** + * Interface to WLAN Engine. + */ + RWLMServer iWlmServer; + + }; + +#endif // WLANPSMPLUGIN_H diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/rom/wlanpsmplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/rom/wlanpsmplugin.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANPSMPLUGIN_IBY +#define WLANPSMPLUGIN_IBY + +data=ZPRIVATE\2000b187\200100c0.xml private\2000b187\200100c0.xml +data=ZPRIVATE\2000b187\cenrep\101f8e44.xml private\2000b187\cenrep\101f8e44.xml + +ECOM_PLUGIN(wlanpsmplugin.dll, wlanpsmplugin.rsc) + +#endif // WLANPSMPLUGIN_IBY + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/src/200100C0.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/src/200100C0.rss Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom resources for the WLAN PSM plug-in +* +*/ + +/* +* %version: 5 % +*/ + +#include + +// --------------------------------------------------------- +// +// +// ECOM resource definitions for wlanpsmplugin +// +// --------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x200100C0; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2000B189; + implementations = + { + // Info for wlanpsmplugin + IMPLEMENTATION_INFO + { + implementation_uid = 0x200100C2; + version_no = 1; + display_name = "wlanpsmplugin"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r c40eb8fe8501 wlan_bearer/wlanpsmplugin/src/wlanpsmplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_bearer/wlanpsmplugin/src/wlanpsmplugin.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,284 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM plugin implementation +* +*/ + +/* +* %version: 7 % +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include "wdbifwlandefs.h" +#include +#include "wlanpsmplugin.h" +#include "am_debug.h" + +// CONSTANT DEFINITIONS +const TUint32 KWlanPsmConfigId = 0x200100C0; + +enum TPsmPluginFirstKeys + { + EWlanPsmKey1 = 1 + }; + +/** +* Pairs ECom implementation UIDs with a pointer to the instantiation +* method for that implementation. Required for all ECom implementation +* collections. +*/ +const TImplementationProxy ImplementationTable[] = + { + {{0x200100C2}, reinterpret_cast(CWlanPsmPlugin::NewL)} + }; + +// ========================== EXPORTED FUNCTIONS ========================= + +// --------------------------------------------------------- +// Returns an instance of the proxy table. +// Returns: KErrNone +// --------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// ============================ MEMBER FUNCTIONS =============================== + +// +// ---------------------------------------------------------------------------------- +// CWlanPsmPlugin::CWlanPsmPlugin() +// ---------------------------------------------------------------------------------- +// +CWlanPsmPlugin::CWlanPsmPlugin( TPsmPluginCTorParams& aInitParams ) : + CPsmPluginBase( aInitParams ) + { + DEBUG ( "CWlanPsmPlugin::CWlanPsmPlugin()" ); + } + +// ----------------------------------------------------------------------------- +// CWlanPsmPlugin::ConstructL( +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWlanPsmPlugin::ConstructL() + { + DEBUG ( "CWlanPsmPlugin::ConstructL()" ); + User::LeaveIfError( iWlmServer.Connect() ); + } + +// +// ---------------------------------------------------------------------------------- +// CWlanPsmPlugin::NewL() +// ---------------------------------------------------------------------------------- +// +// Two-phased constructor. +CWlanPsmPlugin* CWlanPsmPlugin::NewL( TPsmPluginCTorParams& aInitParams ) + { + DEBUG ( "CWlanPsmPlugin::NewL()" ); + + CWlanPsmPlugin* self = new ( ELeave ) CWlanPsmPlugin( aInitParams ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// +// ---------------------------------------------------------------------------------- +// CWlanPsmPlugin::~CWlanPsmPlugin() +// ---------------------------------------------------------------------------------- +// +// Destructor. +CWlanPsmPlugin::~CWlanPsmPlugin() + { + DEBUG ( "CWlanPsmPlugin::~CWlanPsmPlugin()" ); + iWlmServer.Close(); + } + +// +// ---------------------------------------------------------------------------------- +// CWlanPsmPlugin::NotifyModeChange() +// ---------------------------------------------------------------------------------- +// +void CWlanPsmPlugin::NotifyModeChange( const TInt aMode ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChange(), Mode:%d", aMode ); + + //call the function that can Leave + TRAPD( err, NotifyModeChangeL(aMode) ); + if (err) + { + DEBUG("CWlanPsmPlugin::NotifyModeChange(), NotifyModeChangeL Leave'd"); + } + } + + +// +// ---------------------------------------------------------------------------------- +// CWlanPsmPlugin::NotifyModeChangeL() +// ---------------------------------------------------------------------------------- +// +void CWlanPsmPlugin::NotifyModeChangeL( const TInt aMode ) + { + +#ifdef _DEBUG + if( aMode == EPsmsrvModePowerSave ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - aMode: EPsmsrvModePowerSave (%d)", aMode ); + } + else if ( aMode == EPsmsrvPartialMode ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - aMode: EPsmsrvPartialMode (%d)", aMode ); + } + else if ( aMode == EPsmsrvModeNormal ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - aMode: EPsmsrvModeNormal (%d)", aMode ); + } + else + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - unrecognised aMode: %d", aMode ); + } +#endif + + //NOTE: The plugin changes only the current BG scan interval in CommsDat. + //Updating of Default BG scan interval in CenRep is taken care by PSM Engine + //using Passive configuration file. + + RConfigInfoArray infoArray; + TPsmsrvConfigInfo info1; + TUint32 bgScanIntervalCurrentlyInCommsDat, bgScanIntervalFromPsmFramework; + TBool updateBgScanIntervalToCommsDat = EFalse; + CCommsDatabase* commDB = NULL; + CCommsDbTableView* table = NULL; + + //Read current BG interval from CommsDat + commDB = CCommsDatabase::NewL(); + CleanupStack::PushL( commDB ); + + table = commDB->OpenViewMatchingUintLC( TPtrC(WLAN_DEVICE_SETTINGS), + TPtrC(WLAN_DEVICE_SETTINGS_TYPE), + KWlanUserSettings ); + + User::LeaveIfError( table->GotoFirstRecord() ); + + table->ReadUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), bgScanIntervalCurrentlyInCommsDat ); + + // Backup and Get settings... + info1.iConfigId = EWlanPsmKey1; + info1.iConfigType = EConfigTypeInt; + info1.iIntValue = bgScanIntervalCurrentlyInCommsDat; + infoArray.Append( info1 ); + + iSettingsProvider.BackupAndGetSettingsL( infoArray, KWlanPsmConfigId ); + + bgScanIntervalFromPsmFramework = infoArray[0].iIntValue; + + DEBUG2( "CWlanPsmPlugin::NotifyModeChangeL() - current value in CommsDat: %u, PSM Framework provided value: %u", + bgScanIntervalCurrentlyInCommsDat, bgScanIntervalFromPsmFramework); + + if ( EPsmsrvModePowerSave == aMode || EPsmsrvPartialMode == aMode ) + { + DEBUG( "CWlanPsmPlugin::NotifyModeChangeL() - PSM server mode is changing to EPsmsrvModePowerSave/EPsmsrvPartialMode" ); + + // if bg scan interval is neither non-zero nor automatic... + if ( bgScanIntervalCurrentlyInCommsDat != 0 && bgScanIntervalCurrentlyInCommsDat != 0xFFFFFFFF ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - storing Automatic value to CommsDat as current CommsDat value (%u) is non-zero and non-Automatic", + bgScanIntervalCurrentlyInCommsDat ); + // set bg scan interval to automatic + updateBgScanIntervalToCommsDat = ETrue; + } +#ifdef _DEBUG + else + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - CommsDat update not needed as current value (%u) is zero or Automatic", bgScanIntervalCurrentlyInCommsDat ); + } +#endif + } + else + { + DEBUG( "CWlanPsmPlugin::NotifyModeChangeL() - PSM server mode is changing to EPsmsrvModeNormal" ); + // If backed up value is... + // * zero -> if current value in commsdat is automatic, user has set bg scan to automatic during power save, no need to change commsdat. + // -> if current value in commsdat is zero -> commsdat had setting zero before entering power save -> no need to change commsdat. + // -> UI shall prevent setting other values in commsdat during power save. + // * automatic -> if current value in commsdat is automatic, no need to change commsdat. + // -> if current value in commsdat is zero, no need to change commsdat. + // -> UI shall prevent setting other values in commsdat during power save. + // * non-zero -> if current value in commsdat is automatic, plugin set value to automatic during entering power save mode -> restore backed up setting to commsdat. + // -> if current value in commsdat is zero, user has disabled background scan -> no need to change commsdat. + // -> UI shall prevent setting other values in commsdat during power save. + if( bgScanIntervalFromPsmFramework != 0 && bgScanIntervalFromPsmFramework != 0xFFFFFFFF ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - backed up value (%u) is non-zero or non-Automatic", bgScanIntervalFromPsmFramework ); + if( bgScanIntervalCurrentlyInCommsDat == 0xFFFFFFFF ) + { + DEBUG( "CWlanPsmPlugin::NotifyModeChangeL() - current value in CommsDat is Automatic -> restoring backed up value to CommsDat" ); + // restore background scan interval from backup + updateBgScanIntervalToCommsDat = ETrue; + } +#ifdef _DEBUG + else + { + DEBUG( "CWlanPsmPlugin::NotifyModeChangeL() - no CommsDat update needed as current value in commsdat is zero" ); + if( bgScanIntervalCurrentlyInCommsDat != 0 ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - value in CommsDat is non-zero (%u) -> do assert, UI shouldn't allow setting other than 0 or Automatic", + bgScanIntervalCurrentlyInCommsDat ); + ASSERT( 0 ); + } + } +#endif + } +#ifdef _DEBUG + else + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - no CommsDat update needed as backed up value (%u) is zero or Automatic", bgScanIntervalFromPsmFramework ); + } +#endif + } + + if ( updateBgScanIntervalToCommsDat ) + { + DEBUG1( "CWlanPsmPlugin::NotifyModeChangeL() - updating CommsDat with value: %d", + bgScanIntervalFromPsmFramework); + + //update CommsDb to reflect the changed value + User::LeaveIfError( table->UpdateRecord() ); + table->WriteUintL( TPtrC(WLAN_BG_SCAN_INTERVAL), bgScanIntervalFromPsmFramework ); + User::LeaveIfError( table->PutRecordChanges() ); + + DEBUG( "CWlanPsmPlugin::NotifyModeChangeL() - informing WLAN Engine about changed value" ); + iWlmServer.NotifyChangedSettings(); + } + + DEBUG( "CWlanPsmPlugin::NotifyModeChangeL() - notifying WLAN Engine about new power save mode" ); + iWlmServer.NotifyChangedPsmSrvMode( aMode ); + + // cleanup + CleanupStack::PopAndDestroy( table ); + CleanupStack::PopAndDestroy( commDB ); + + infoArray.Reset(); + } + diff -r 000000000000 -r c40eb8fe8501 wlan_info/wlan_metadata/wlan_metadata.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_info/wlan_metadata/wlan_metadata.mrp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,6 @@ +component wlan_metadata +source \sf\os\wlan\wlan_info\wlan_metadata +source \sf\os\wlan\package_definition.xml +source \sf\os\wlan\distribution.policy.s60 +notes_source \component_defs\release.src +ipr T diff -r 000000000000 -r c40eb8fe8501 wlan_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + +/* +* %version: tr1cfwln#6 % +*/ + +#include "../wlan_dbif_api/group/bld.inf" +#include "../wlan_hal_api/group/bld.inf" +#include "../wlan_management_api/group/bld.inf" +#include "../wlan_device_settings_api/group/bld.inf" +#include "../wlan_control_api/group/bld.inf" +#include "../wlan_hw_initialization_data_api/group/bld.inf" +#include "../wlan_power_save_plugin_api/group/bld.inf" +#include "../wlan_info_api/group/bld.inf" +#include "../wlan_agent_hotspot_plugin_api/group/bld.inf" +#include "../wlan_osa_api/group/bld.inf" +#include "../wlan_spia_api/group/bld.inf" +#include "../wlan_hpa_api/group/bld.inf" +#include "../wlan_eapol_plugin_api/group/bld.inf" +#include "../wlan_generic_plugin_api/group/bld.inf" +#include "../wlan_aws_plugin_api/group/bld.inf" diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_agent_hotspot_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_agent_hotspot_plugin_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN Agent Hotspot Plug-in API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanagthotspotclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanagthotspotclient.h) +../inc/wlanagthotspotclient.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanagthotspotclient.inl) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_agent_hotspot_plugin_api/inc/wlanagthotspotclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_agent_hotspot_plugin_api/inc/wlanagthotspotclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECOM plugin for hotspot logic +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANAGTHOTSPOTCLIENT_H +#define WLANAGTHOTSPOTCLIENT_H + +#include + +/** +* Class for instantiating an implementation of CWlanHotSpotInterface via ECom. +* +* @lib wlanagt.agt +* @since Series 60 3.0 +*/ +class CWlanAgtHotSpotClient : public CBase + { + public: + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + inline static CWlanAgtHotSpotClient* NewL( ); + + /** + * Destructor. + */ + virtual ~CWlanAgtHotSpotClient(); + + // Dummy functions to interact with Hot spot frame work + // Plugin implementation will override these functions to actually interact with the HS framework + + virtual void HotSpotStart( const TUint aIapId, TRequestStatus& aStatus ) = 0; + + virtual void HotSpotStartAgain( const TUint aIapId, TRequestStatus& aStatus ) = 0; + + virtual void HotSpotCloseConnection( const TUint aIapId, TRequestStatus& aStatus ) = 0; + + virtual void HotSpotCancel( const TUint aIapId ) = 0; + + private: // Data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + }; + +#include "wlanagthotspotclient.inl" + +#endif // WLANAGTHOTSPOTCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_agent_hotspot_plugin_api/inc/wlanagthotspotclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_agent_hotspot_plugin_api/inc/wlanagthotspotclient.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of agent-hotspot interface plugin +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANAGTHOTSPOTCLIENT_INL +#define WLANAGTHOTSPOTCLIENT_INL + +// Static constructor. +inline CWlanAgtHotSpotClient* CWlanAgtHotSpotClient::NewL( ) + { + const TUid KWlanAgtHotSpotClient = { 0x1028309d }; + + TAny* interface = REComSession::CreateImplementationL( KWlanAgtHotSpotClient, + _FOFF( CWlanAgtHotSpotClient, iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// Destructor +inline CWlanAgtHotSpotClient::~CWlanAgtHotSpotClient() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +#endif // WLANAGTHOTSPOTCLIENT_INL diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_agent_hotspot_plugin_api/wlan_agent_hotspot_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_agent_hotspot_plugin_api/wlan_agent_hotspot_plugin_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN Agent Hotspot Plug-in API + A plug-in interface for HotSpot connection management + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_aws_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_aws_plugin_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN AWS Plugin API +* +*/ + +/* +* %version: 4 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/awsenginebase.h OS_LAYER_PLATFORM_EXPORT_PATH(awsenginebase.h) +../inc/awsenginebase.inl OS_LAYER_PLATFORM_EXPORT_PATH(awsenginebase.inl) +../inc/awsinterface.h OS_LAYER_PLATFORM_EXPORT_PATH(awsinterface.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_aws_plugin_api/inc/awsenginebase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_aws_plugin_api/inc/awsenginebase.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for the Adaptive WLAN Scan Engine. +* +*/ + +/* +* %version: 5 % +*/ + + +#ifndef AWSENGINEBASE_H +#define AWSENGINEBASE_H + + +#include +#include +#include "awsinterface.h" + +/** Value for expiry when background scan should expire immediately. */ +const TUint32 KWlanBgScanMaxDelayExpireImmediately = 0; +/** Value for background scan interval when background scan is off. */ +const TUint32 KWlanBgScanIntervalNever = 0; +/** Value for Automatic background scan interval. */ +const TUint32 KWlanBgScanIntervalAutomatic = 0xFFFFFFFF; +/** Value for AWS ECOM interface UID. */ +const TInt KAwsClientInterfaceUid = 0x2002700C; + +/** + * AWS Engine base class + * This class implements base class for AWS Engine. + * + * @since S60 v5.2 + */ +class CAwsEngineBase : public CBase, public MAws + { + +public: + + struct TAwsEngineConstructionParameters + { + MAwsBgScanProvider* aServiceProvider; + TUint aServiceProviderInterfaceVersion; + TUint& aAwsEngineInterfaceVersion; + }; + + /** + * Two-phased constructor. + * @param aUid UID of implementation to instantiate. + * @param aConstructionParameters Pointer to construction parameters, + * must not be NULL. + * @return Pointer to the constructed instance. + */ + inline static CAwsEngineBase* NewL( + TInt aUid, + TAwsEngineConstructionParameters* aConstructionParameters ); + + /** + * Destructor. + */ + virtual ~CAwsEngineBase(); + + /** + * List implementations for AWS Plugin interface. + * @param aImplInfoArray Array of implementation informations. + */ + inline static void CAwsEngineBase::ListImplementationsL( + RImplInfoPtrArray& aImplInfoArray); + +private: // data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + + }; + +#include "awsenginebase.inl" + +#endif // AWSENGINEBASE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_aws_plugin_api/inc/awsenginebase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_aws_plugin_api/inc/awsenginebase.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for CAwsEngineBase class. +* +*/ + +/* +* %version: 5 % +*/ + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline CAwsEngineBase* CAwsEngineBase::NewL( + TInt aUid, + TAwsEngineConstructionParameters* aConstructionParameters ) + { + if( !aConstructionParameters ) + { + User::Leave( KErrArgument ); + } + + const TUid KTMPUid = { aUid }; + + TAny* interface = REComSession::CreateImplementationL( + KTMPUid, + _FOFF( CAwsEngineBase, iInstanceIdentifier ), + aConstructionParameters ); + + return reinterpret_cast( interface ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline CAwsEngineBase::~CAwsEngineBase() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +// --------------------------------------------------------- +// CAwsEngineBase::ListImplementationsL +// --------------------------------------------------------- +inline void CAwsEngineBase::ListImplementationsL( + RImplInfoPtrArray& aImplInfoArray) + { + const TUid KInterfaceUid = { KAwsClientInterfaceUid }; + + REComSession::ListImplementationsL(KInterfaceUid, + aImplInfoArray); + } + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_aws_plugin_api/inc/awsinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_aws_plugin_api/inc/awsinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interfaces for WLAN Background Scan component and AWS component. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef AWSINTERFACE_H +#define AWSINTERFACE_H + + +#include + +/** + * The possible statuses of an AWS Power Save Mode. + */ +enum TAwsPsMode + { + /** + * No power save. + */ + EAwsPsModeOff = 0, + /** + * Deep power save. + */ + EAwsPsModeDeep, + /** + * Light power save. + */ + EAwsPsModeLight + }; + +/** + * @brief Interface definition for Adaptive WLAN Scanning component. + * + * This class defines the methods for starting and stopping AWS. + * + * @since S60 v5.2 + */ +class MAws + { + +public: + + /** + * Start AWS. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * + * @since S60 v5.2 + */ + virtual void Start( TRequestStatus& aStatus ) = 0; + + /** + * Stop AWS. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * + * @since S60 v5.2 + */ + virtual void Stop( TRequestStatus& aStatus ) = 0; + + /** + * Set Power save mode. + * + * @param aMode new mode to be taken into use + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * + * @since S60 v5.2 + */ + virtual void SetPowerSaveMode( TAwsPsMode aMode, TRequestStatus& aStatus ) = 0; + + }; + +/** + * @brief Interface definition for AWS background scan provider. + * + * This class defines the methods AWS uses to command background scan provider. + * + * @since S60 v5.2 + */ +class MAwsBgScanProvider + { + +public: + + /** + * Set new background scan interval. + * + * @since S60 v5.2 + * @param aNewInterval new interval in seconds to be taken into use + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + */ + virtual void SetInterval( TUint32 aNewInterval, TRequestStatus& aStatus ) = 0; + + }; + + +#endif // AWSINTERFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_aws_plugin_api/wlan_aws_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_aws_plugin_api/wlan_aws_plugin_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN AWS Plugin API + A plug-in interface for AWS services. + c++ + wlan_bearer + + + + + + + + no + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_control_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_control_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN Control API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlancontrolclient.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlancontrolclient.inl) +../inc/wlancontrolinterface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlancontrolinterface.h) +../inc/wlancontrolclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlancontrolclient.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_control_api/inc/wlancontrolclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_control_api/inc/wlancontrolclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper class for instantiating an implementation of +* MWlanControlInterface via ECom framework. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANCONTROLCLIENT_H +#define WLANCONTROLCLIENT_H + +#include +#include "wlancontrolinterface.h" + +/** + * @brief Class for instantiating an implementation of MWlanControlInterface via ECom. + * + * @since S60 v3.2 + */ +class CWlanControlClient : public CBase, public MWlanControlInterface + { + +public: + + /** + * Static constructor. + * @return Pointer to the constructed instance. + */ + inline static CWlanControlClient* NewL(); + + /** + * Destructor. + */ + inline virtual ~CWlanControlClient(); + +private: // data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + + }; + +#include "wlancontrolclient.inl" + +#endif // WLANCONTROLCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_control_api/inc/wlancontrolclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_control_api/inc/wlancontrolclient.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of CWlanControlClient class. +* +*/ + +/* +* %version: 3 % +*/ + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline CWlanControlClient* CWlanControlClient::NewL() + { + const TUid KCWlanControlClientUid = { 0x10282e0f }; + + TAny* interface = REComSession::CreateImplementationL( + KCWlanControlClientUid, + _FOFF( CWlanControlClient, + iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline CWlanControlClient::~CWlanControlClient() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_control_api/inc/wlancontrolinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_control_api/inc/wlancontrolinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom interface definition for WLAN Control API. +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef WLANCONTROLINTERFACE_H +#define WLANCONTROLINTERFACE_H + +#include // TWlanPowerSave +#include // TWlanBssid, TWlanSsid + +// INCLUDES +#include + + +/** Defines the possible values of maximum service period length. */ +enum TWlanMaxServicePeriodLength + { + EWlanMaxServicePeriodLengthAll, + EWlanMaxServicePeriodLengthTwo, + EWlanMaxServicePeriodLengthFour, + EWlanMaxServicePeriodLengthSix, + }; + +/** Defines the possible values of last cause for roaming. */ +enum TWlanRoamReason + { + EWlanRoamReasonLowRssi, + EWlanRoamReasonApLost, + }; + +/** + * Possible WLAN regions. + */ +enum TWlanRegion + { + /** Channels 1-11, USA */ + EFCC = 0x10, + /** Channels 1-13, Europe */ + EETSI = 0x30, + }; + +/** Possible WLAN power save modes. */ +enum TWlanPowerSaveMode + { + /** Automatic mode, wake-up mode and interval adjusted dynamically. */ + EWlanPowerSaveModeAutomatic, + /** Power save is disabled. */ + EWlanPowerSaveModeNone, + /** Power save is enabled, wake-up at every beacon. */ + EWlanPowerSaveModeBeacon, + /** Power save is enabled, wake-up at every DTIM. */ + EWlanPowerSaveModeDtim, + /** Power save is enabled, wake-up at every Nth DTIM, where N is defined by DTIM skipping interval. */ + EWlanPowerSaveModeDtimSkipping + }; + +/** Defines a structure for storing WLAN packet statistics. */ +struct TWlanPacketStatistics + { + /** Number of sent data frames. */ + TUint32 txFrames; + /** Number of successfully received data frames. */ + TUint32 rxFrames; + /** Number of sent multicast data frames. */ + TUint32 txMulticastFrames; + /** Number of successfully received multicast data frames. */ + TUint32 rxMulticastFrames; + /** Number of received frames with FCS errors. */ + TUint32 fcsErrors; + /** Total number of retransmissions done. */ + TUint32 txRetries; + /** Number of data frames that could not be to delivered. */ + TUint32 txErrors; + }; + +/** Defines the U-APSD settings for the access categories. */ +struct TWlanUapsdSettings + { + /** Defines the maximum number of frames to send during a service period. */ + TWlanMaxServicePeriodLength maxServicePeriodLength; + /** Whether U-APSD is trigger and delivery-enabled for Voice. */ + TBool uapsdForVoice; + /** Whether U-APSD is trigger and delivery-enabled for Video. */ + TBool uapsdForVideo; + /** Whether U-APSD is trigger and delivery-enabled for BestEffort. */ + TBool uapsdForBestEffort; + /** Whether U-APSD is trigger and delivery-enabled for Background. */ + TBool uapsdForBackground; + }; + +/** Defines the power save settings for the access categories. */ +struct TWlanPowerSaveSettings + { + /** Whether the terminal stays in U-APSD power save when using Voice. */ + TBool stayInUapsdPsModeForVoice; + /** Whether the terminal stays in U-APSD power save when using Video. */ + TBool stayInUapsdPsModeForVideo; + /** Whether the terminal stays in U-APSD power save when using BestEffort. */ + TBool stayInUapsdPsModeForBestEffort; + /** Whether the terminal stays in U-APSD power save when using Background. */ + TBool stayInUapsdPsModeForBackground; + /** Whether the terminal stays in legacy power save when using Voice. */ + TBool stayInLegacyPsModeForVoice; + /** Whether the terminal stays in legacy power save when using Video. */ + TBool stayInLegacyPsModeForVideo; + /** Whether the terminal stays in legacy power save when using BestEffort. */ + TBool stayInLegacyPsModeForBestEffort; + /** Whether the terminal stays in legacy power save when using Background. */ + TBool stayInLegacyPsModeForBackground; + }; + +/** + * Data structure for storing information about an AP. + */ +struct TWlanAccessPointInfo + { + /** The SSID of the AP. */ + TWlanSsid ssid; + /** The BSSID of the AP. */ + TWlanBssid bssid; + /** Capabilities of the AP. */ + TUint16 capabilities; + /** The channel AP is on. */ + TUint8 channel; + /** Received Signal Strength Indicator (RSSI). */ + TUint8 rssi; + /** Basic rates bitmap of the AP. Rates are defined in TWlanRate. */ + TUint32 basicRates; + /** Supported rates bitmap of the AP. Rates are defined in TWlanRate. */ + TUint32 supportedRates; + /** The security mode of the AP. */ + TWlanConnectionExtentedSecurityMode securityMode; + /** Whether Admission Control must be used with Voice. */ + TBool isAcRequiredForVoice; + /** Whether Admission Control must be used with Video. */ + TBool isAcRequiredForVideo; + /** Whether Admission Control must be used with BestEffort. */ + TBool isAcRequiredForBestEffort; + /** Whether Admission Control must be used with Background. */ + TBool isAcRequiredForBackground; + /** Whether the AP supports WPX. */ + TBool isWpx; + }; + + +/** + * Data structure for storing roaming metrics information. + */ +struct TWlanRoamMetrics + { + /** Connection attempt total counter. */ + TUint32 connectionAttemptTotalCount; + /** Unsuccesfull connection attempt counter. */ + TUint32 unsuccesfullConnectionAttemptCount; + /** Roaming counter. */ + TUint32 roamingCounter; + /** Coverage loss counter. */ + TUint32 coverageLossCount; + + /** The total duration (ms) of the last roaming (= data path broken time + scanning time). */ + TUint32 lastRoamTotalDuration; + /** The duration (ms) how long the data path was broken during the last roaming. */ + TUint32 lastRoamDataPathBrokenDuration; + /** The cause for the last roaming. */ + TWlanRoamReason lastRoamReason; + }; + + +/** + * @brief ECom interface definition for WLAN Control API. + * + * This class defines the methods used for... + * + * @since S60 v3.2 + */ +class MWlanControlInterface + { + +public: + + /** + * Get packet statistics of the current connection. + * + * @since S60 v3.2 + * @param aStatistics Packet statistics of the current connection. + * @return KErrNone if statistics were read successfully, an error otherwise. + */ + virtual TInt GetPacketStatistics( + TWlanPacketStatistics& aStatistics ) = 0; + + /** + * Clear packet statistics of the current connection. + * + * @since S60 v3.2 + */ + virtual void ClearPacketStatistics() = 0; + + /** + * Get the current U-APSD settings. + * + * @since S60 v3.2 + * @param aSettings Current U-APSD settings. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + virtual TInt GetUapsdSettings( + TWlanUapsdSettings& aSettings ) = 0; + + /** + * Set the U-APSD settings. + * + * @since S60 v3.2 + * @param aSettings Current U-APSD settings to be set. + * @return KErrNone if settings were set successfully, an error otherwise. + */ + virtual TInt SetUapsdSettings( + const TWlanUapsdSettings& aSettings ) = 0; + + /** + * Get the current power save settings. + * + * @since S60 v3.2 + * @param aSettings power save settings. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + virtual TInt GetPowerSaveSettings( + TWlanPowerSaveSettings& aSettings ) = 0; + + /** + * Set the power save settings. + * + * @since S60 v3.2 + * @param aSettings Current power save settings to be set. + * @return KErrNone if settings were set successfully, an error otherwise. + */ + virtual TInt SetPowerSaveSettings( + const TWlanPowerSaveSettings& aSettings ) = 0; + + + /** + * Get information about the current AP. + * + * @since S60 v3.2 + * @param aInfo Information about the current AP. + * @return KErrNone if information is available, an error otherwise. + */ + virtual TInt GetAccessPointInfo( + TWlanAccessPointInfo& aInfo ) = 0; + + /** + * Get roam metrics of the current connection. + * + * @since S60 v3.2 + * @param aRoamMetrics Roam metrics of the current connection. + * @return KErrNone if settings were read successfully, an error otherwise. + */ + virtual TInt GetRoamMetrics( + TWlanRoamMetrics& aRoamMetrics ) = 0; + + /** + * Return a list of BSSIDs on the rogue list. + * + * @since S60 v3.2 + * @param aRogueList List of BSSIDs on the rogue list. + * @return KErrNone if list were read successfully, an error otherwise. + */ + virtual TInt GetRogueList( + CArrayFixSeg& aRogueList ) = 0; + + /** + * Get the current regulatory domain. + * + * @since S60 v3.2 + * @param aRegion current region. + * @return KErrNone if value was read successfully, an error otherwise. + */ + virtual TInt GetRegulatoryDomain( + TWlanRegion& aRegion ) = 0; + + /** + * Get the current power save mode. + * + * @since S60 v3.2 + * @param aPowerSaveMode current power save mode. + * @return KErrNone if value was read successfully, an error otherwise. + */ + virtual TInt GetPowerSaveMode( + TWlanPowerSave& aPowerSaveMode ) = 0; + + /** + * Set the power save mode. + * + * @note This method is meant for overriding the dynamic power save mode selection + * for testing purposes. Overriding the power save mode may have an adverse + * effect on throughput and/or power consumption. Dynamic selection can be + * re-enabled by setting the mode to EWlanPowerSaveModeAutomatic. + * + * @since S60 v5.0.1 + * @param aMode Power save mode to be set. + * @return KErrNone if the mode was set successfully, an error otherwise. + */ + virtual TInt SetPowerSaveMode( + TWlanPowerSaveMode aMode ) = 0; + + }; + +#endif // WLANCONTROLINTERFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_control_api/wlan_control_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_control_api/wlan_control_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN Control API + API for controlling WLAN connection parameters getting statistics information. + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_dbif_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_dbif_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN DBIF API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wdbiflansettings.h OS_LAYER_PLATFORM_EXPORT_PATH(wdbiflansettings.h) +../inc/wdbifwlansettings.h OS_LAYER_PLATFORM_EXPORT_PATH(wdbifwlansettings.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_dbif_api/inc/wdbiflansettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_dbif_api/inc/wdbiflansettings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles the LANService table in CommsDat +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef LANSETTINGS_H +#define LANSETTINGS_H + +// INCLUDES +#include +#include + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + + +using namespace CommsDat; + + +// CLASS DECLARATION + +/** +* Struct for LAN table settings +*/ +struct SLanSettings +{ + TBuf Name; + TUint32 Id; + TBool AddrFromServer; + TBuf Addr; +}; + +/** +* Class for handling LAN settings in commsdat +* +* @lib wlandbif.lib +* @since +*/ +NONSHARABLE_CLASS( CLanSettings ) : public CBase +{ +public: // Constructors and destructor + /** + * Constructor + */ + IMPORT_C CLanSettings(); + + /** + * Destructor + * Also Handles disconnection + */ + IMPORT_C virtual ~CLanSettings(); + +public: // New functions + /** + * Connects to commsdat + * @param + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt Connect(); + + /** + * Disconnects from commsdat. + * @param + * @return + * @remarks + * @see + */ + IMPORT_C void Disconnect(); + + /** + * Gets LAN settings with specified ID + * @param aId is the id of lan settings row that is fetched, aSettings contains the lan settings + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt GetLanSettings(TUint32 aId,SLanSettings &aSettings); + + /** + * Writes LAN settings with specified ID, if ID is 0, new record is created + * @param aSettings contains the lan settings. if id is 0, then new id is stored in settings.Id + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt WriteLanSettings(SLanSettings &aSettings); + + /** + * deletes LAN settings with specified ID + * @param aId is the id of lan settings row that is deleted + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt DeleteLanSettings(TUint32 aId); + +private: + + void DoConnectL(); + +private: // Data + + CCDLANServiceRecord* iLANServiceRecord; + CMDBSession* iDBSession; +}; + +#endif // LANSETTINGS_H + +// end of file diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_dbif_api/inc/wdbifwlansettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_dbif_api/inc/wdbifwlansettings.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,399 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles the custom WLANServiceTable in CommsDat +* +*/ + +/* +* %version: 13 % +*/ + +#ifndef WLANSETTINGS_H +#define WLANSETTINGS_H + +#include +#include + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + + +using namespace CommsDat; + +// Should be same as KMaxWepKeyLength, but defined here to +// avoid dependency to 802dot11.h +const TUint32 KWLMMaxWEPKeyLength = 29; + +// The maximum WPA Pre-Shared Key length. +const TUint KWLMMaxWpaPskLength = 64; + +// Maximum length of a SSID in BYTES +const TUint8 KMaxSSIDLen = 32; + +// Size of Expanded EAP Type +const TUint8 KExpandedEapTypeSize = 8; //8 + +/** +* Data structure for storing a WEP key. +*/ +struct TWep + { + /** Specifies which key to add or remove. Range: 0-3 */ + TUint32 KeyIndex; + /** The length of KeyMaterial in bytes. Range: 0-29 */ + TUint32 KeyLength; + /** Array that stores the WEP key. */ + TUint8 KeyMaterial[KWLMMaxWEPKeyLength]; + }; + +/** +* Data structure for storing a WPA Pre-Shared Key. +*/ +struct TWpaPsk + { + /** The length of KeyMaterial in bytes. Range: 8-64 */ + TUint KeyLength; + /** Array of that stores the WPA Pre-Shared Key. */ + TUint8 KeyMaterial[KWLMMaxWpaPskLength]; + }; + +const TInt KWlanWpaPskLength = 64; + +enum EWepAuthenticationMode + { + EWepAuthModeOpen = 0, + EWepAuthModeShared = 1 + }; + +enum EConnectionMode + { + Adhoc =0, + Infrastructure=1 + }; + +enum EWlanSecurityMode + { + AllowUnsecure = 1, + Wep = 2, + Wlan8021x = 4, + Wpa = 8, + Wpa2Only = 16, + Wapi = 32 + }; + +/** + * Format of the preshared key (hex/ASCII) + */ +enum TWlanPresharedKeyFormat + { + EWlanPresharedKeyFormatAscii, + EWlanPresharedKeyFormatHex + }; + +/** +* struct for wlan settings data +*/ +struct SWLANSettings + { + TUint32 Id; + TBuf Name; + + TUint32 ServiceID; + TUint32 ConnectionMode; // Infrastructure / adhoc + TBuf SSID; // network name + + TBuf UsedSSID; + TBool ScanSSID; + TUint32 ChannelID; + + TUint32 SecurityMode; // SecurityMode (Allow insecure, wep, 802.1xs, wpa, wpa2only) enum EWlanSecurityMode + + TWep WepKey1; + TWep WepKey2; + TWep WepKey3; + TWep WepKey4; + TUint32 WepIndex; + TUint32 AuthenticationMode; // open / Shared + + TBuf8 WPAPreSharedKey; + TUint32 WPAKeyLength; + TBool EnableWpaPsk; + TUint32 PresharedKeyFormat; // format of the preshared key + + // there is also WLAN_EAPS, but it is a long text field, handled separately + + }; + +struct SWlanIAPId + { + TUint iWLANRecordId; + TUint iIAPId; + }; + +/** +* Struct for containing eap identifiers +*/ +typedef struct _TEap + { + TBool Enabled; + TBuf8<3> UID; // Unique ID + } TEap; + +typedef RPointerArray TEapArray; +/** +* Struct for containing expanded eap identifiers +*/ +struct SEapExpandedType + { + TBuf8 EapExpandedType; // Unique ID + }; + +typedef RPointerArray RExpandedEapTypeArray; + +/** +* Structure for storing information about a secondary SSID. +*/ +struct TWlanSecondarySsid + { + TUint32 id; + TBuf ssid; + TBuf usedSsid; + }; + +// CLASS DECLARATION + +/** +* Class for handling wlan table in commsdat +* +* @lib wlandbif.lib +*/ +NONSHARABLE_CLASS( CWLanSettings ) : public CBase + { +public: // Constructors and destructor + + /** + * Constructor + */ + IMPORT_C CWLanSettings(); + + /** + * Destructor + * Handles disconnection if needed + */ + IMPORT_C virtual ~CWLanSettings(); + +public: // New functions + + /** + * Makes a connection to CommsDat + * @param + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt Connect(); + + /** + * Disconnect function that disconnects the connection to commsdat + * @param + * @return + * @remarks + * @see + */ + IMPORT_C void Disconnect(); + + /** + * Gets WLAN settings with specified ID + * @param aId is the id of wlan settings record that is fetched, aSettings contains the wlan settings + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt GetWlanSettings(TUint32 aId,SWLANSettings &aSettings); + + /** + * Gets all the wlan settings for specified LAN service + * @param aId is the id of lan settings that uses wanted wlan settings. aSettings contains the wlan settings + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt GetWlanSettingsForService(TUint32 aId,SWLANSettings &aSettings); + + /** + * Gets WLAN settings with specified IAP ID + * @param aId is the IAP id that is fetched, aSettings contains the wlan settings + * @return KErrNone or other symbian error code + * @remarks + * @see + */ + IMPORT_C TInt GetWlanSettingsForIap(TUint32 aId,SWLANSettings &aSettings); + + /** + * + * Not supported + * + */ + IMPORT_C TInt GetFirstSettings(SWLANSettings &aSettings); + + /** + * + * Not supported + * + */ + IMPORT_C TInt GetNextSettings(SWLANSettings &aSettings); + + /** + * writes all the wlan settings to CommsDat, if settings.id is 0, new record is created + * returns KErrNone on success, other error code if failed + */ + IMPORT_C TInt WriteWlanSettings(SWLANSettings &aSettings); + + /** + * Deletes wlan settings record with specified ID + * returns KErrNone on success, other error code if failed + */ + IMPORT_C TInt DeleteWlanSettings(TUint32 aId); + + /** + * Deletes wlan settings record for specified LAN service + * returns KErrNone on success, other error code if failed + */ + IMPORT_C TInt DeleteWlanSettingsForService(TUint32 aId); + + /** + * + * Not supported + * + */ + IMPORT_C void AddWlanTableL(); + + /** + * Sets the EAP information to current wlan settings (first do a GetWlanSettings{ForService}) + * returns + */ + IMPORT_C void SetEapDataL(const TEapArray &aEaps); + + /** + * Gets the current wlan settings EAP information (first do a GetWlanSettings{ForService}) + * returns + */ + IMPORT_C void GetEapDataL(TEapArray &aEaps); + + /** + * Sets aEasyWlan to ETrue if the aServiceID service is an easy wlan + * returns + */ + IMPORT_C TInt IsEasyWlan(TUint aServiceId, TBool &aEasyWlan); + + /** + * Gets WLAN Service Id's which correspond to IAP's using WLAN + * returns found WLANServiceTable and IAP record ID's in aServices + */ + IMPORT_C void GetIAPWlanServicesL( RArray& aServices); + + /** + * Get all secondary SSIDs for the specified LAN service. + * @since Series 60 3.0 + * @param aÍd ID of the LAN service. + * @param aSsids Secondary SSIDs for the service. + * @return KErrNone if successful, a Symbian error code otherwise. + */ + IMPORT_C TInt GetSecondarySsidsForService( + TUint32 aId, + RArray& aSsids ); + + /** + * Gets the current wlan settings EAP information (first do a GetWlanSettings{ForService}) + * returns + */ + IMPORT_C void GetEapDataL( RExpandedEapTypeArray &aEapsEnabled, RExpandedEapTypeArray &aEapsDisabled ); + + /** + * Sets the EAP information to current wlan settings (first do a GetWlanSettings{ForService}) + * returns + */ + IMPORT_C void SetEapDataL( RExpandedEapTypeArray &aEapsEnabled, RExpandedEapTypeArray &aEapsDisabled ); + +private: + + enum TWlanRecIdType + { + EWlanRecordId, + EWlanServiceId, + EWlanIapId, + }; + + // prepare iWLANServiceRecord (leaves if oom) + void CreateWLANServiceRecordL( TUint32 aId, TWlanRecIdType aType); + + /** + * Gets current settings + */ + void GetDataL(SWLANSettings& aSettings); + + /** + * Writes aSettings to current record + */ + void WriteDataL(SWLANSettings& aSettings); + + /** + * Reads current Wep Keys + */ + void ReadWepKeysL(SWLANSettings &aSettings); + + /** + * If secmode is other than WEP, clear wep keys + */ + void ClearWepKeys( SWLANSettings &aSettings); + + /** + * Returns the hex value of aValue, which originally is the ascii value of a hex digit + */ + void AsciiToHexValue( TUint8& aValue); + + /** + * Writes Wep Keys to current settings + */ + void WriteWepKeysL(SWLANSettings &aSettings); + + /** + * Unpacks wep keys from CommsDat format to TWep struct + */ + void UnPackWepKey( TDesC8& aPackedKey,TWep& aInputKey, TInt aKeyIndex); + + /** + * Packs wep keys from TWep to CommsDat format + */ + void PackWepKeyL(const TWep& aInputKey, CMDBField* aPackedKey); + + void DoSetEapDataL( TDesC& aData); + + void DoSetEapDataL( TDesC8& aEnabledData, TDesC8& aDisabledData ); + HBufC* DoGetEapDataLC(); + + void DoGetEapDataLC( HBufC8*& enabledEapsData, HBufC8*& disabledEapsData ); + void DoConnectL(); + +private: // Data + + // the current "row" + TInt iCurrentRecord; + + CMDBGenericRecord* iWLANRecord; + CMDBSession* iDBSession; + }; + +#endif // WLANSETTINGS_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_dbif_api/wlan_dbif_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_dbif_api/wlan_dbif_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,18 @@ + + + WLAN DBIF API + Interface for retrieving IAP settings from ComsDat + c++ + wlan_bearer + + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_device_settings_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_device_settings_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN Device Settings API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlandevicesettingsinternalcrkeys.h OS_LAYER_PLATFORM_EXPORT_PATH(wlandevicesettingsinternalcrkeys.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_device_settings_api/inc/wlandevicesettingsinternalcrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_device_settings_api/inc/wlandevicesettingsinternalcrkeys.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,418 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal CenRep keys +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef WLANDEVICESETTINGSINTERNALCRKEYS_H +#define WLANDEVICESETTINGSINTERNALCRKEYS_H + +/** + * Repository Id + */ +const TUid KCRUidWlanDeviceSettingsRegistryId = {0x101f8e44}; + +/** + * The beacon interval in milliseconds to be used when creating an IBSS network. + */ +const TUint32 KWlanBeacon = 0x00000002; + +/** + * The data rate used for sending probe requests. The value is determined by + * multiplying the data rate by two; 1MB/s = 2, 2MB/s = 4 and so forth. + */ +const TUint32 KWlanScanRate = 0x00000004; + +/** + * The RCPI threshold after which roaming to a better AP is attempted. + */ +const TUint32 KWlanRcpiTrigger = 0x00000005; + +/** + * The minimum channel time for active scan in milliseconds. + */ +const TUint32 KWlanMinActiveChannelTime = 0x00000006; + +/** + * The maximum channel time for active scan in milliseconds. + */ +const TUint32 KWlanMaxActiveChannelTime = 0x00000007; + +/** + * The maximum amount of time allowed to transmit a packet before + * it is discarded. The value is in milliseconds. + */ +const TUint32 KWlanMaxTxMSDULifeTime = 0x00000008; + +/** + * Defines how many seconds the cached broadcast scan results are valid. + */ +const TUint32 KWlanScanExpirationTimer = 0x00000009; + +/** + * The activity timeout value after which the WLAN drivers are unloaded. + * Note that this setting applies only when the terminal is not connected + * to a network. The value is in seconds. + */ +const TUint32 KWlanUnloadDriverTimer = 0x0000000A; + +/** + * Defines how often roaming to better AP is attempted when the threshold + * set in KWlanRcpiTrigger has been crossed. The value is in microseconds. + */ +const TUint32 KWlanRoamTimer = 0x0000000B; + +/** + * Defines the how much better an AP has to be than the current AP + * before roaming is attempted. + */ +const TUint32 KWlanRcpiDifference = 0x0000000C; + +/** + * The amount of time to wait after a BSS lost indication before + * attempting to roam. The value is in microseconds. + */ +const TUint32 KWlanConnRegainTimer = 0x0000000D; + +/** + * The number of attempts to find suitable network during initial connect. + */ +const TUint32 KWlanMaxTriesToFindNw = 0x0000000E; + +/** +* KWlanDelayBetweenFindNw +* Defines the delay between attempts to find network. +* (microseconds) +*/ +const TUint32 KWlanDelayBetweenFindNw = 0x0000000F; + +/** + * Maximum transfer unit (MTU) size + */ +const TUint32 KWlanMTU = 0x00000010; + +/** +* KWlanMinPassiveChannelTime +* Minimum channel time for passive scan. +*/ +const TUint32 KWlanMinPassiveChannelTime = 0x00000011; + +/** +* KWlanMaxPassiveChannelTime +* Maximum channel time for passive scan. +*/ +const TUint32 KWlanMaxPassiveChannelTime = 0x00000012; + +/** +* KWlanMaxApFailureCount +* Maximum amount of association failures. +*/ +const TUint32 KWlanMaxApFailureCount = 0x00000013; + +/** +* KWlanLongBeaconFindCount +* Long beacon interval AP detection. +*/ +const TUint32 KWlanLongBeaconFindCount = 0x00000014; + +/** +* KWlanQosNullFrameInterval +* QoS NULL data frame send interval. +*/ +const TUint32 KWlanQosNullFrameInterval = 0x00000015; + +/** +* KWlanQosNullFrameTimeout +* QoS NULL data frame send timeout. +*/ +const TUint32 KWlanQosNullFrameTimeout = 0x00000016; + +/** + * NULL data frame sending interval when no transmission in microseconds. + */ +const TUint32 KWlanKeepAliveInterval = 0x00000017; + +/** + * RCPI threshold for direct scan stop in BSS lost. + */ +const TUint32 KWlanScanStopRcpiThreshold = 0x00000018; + +/** + * Minimum RCPI for available IAP. + */ +const TUint32 KWlanMinRcpiForIapAvailability = 0x00000019; + +/** + * Entry timeout for QoS NULL frame sending in microseconds. + */ +const TUint32 KWlanQoSNullFrameEntryTimeout = 0x0000001A; + +/** + * Deauthentications per AP before blacklisting. + */ +const TUint32 KWlanMaxApDeauthenticationCount = 0x0000001B; + +/** + * Deauthentication timeout for calculating AP's deauthentication count + * (in microseconds). + */ +const TUint32 KWlanApDeauthenticationTimeout = 0x0000001C; + +/** + * Default value in seconds for BackGround Scan Interval + */ +const TUint32 KWlanDefaultBGScanInterval = 0x0000001D; + +/** + * Whether Broken Power Save note is shown to user. + */ +const TUint32 KWlanShowBrokenPowerSaveNote = 0x0000001E; + +/** + * Maximum amount of microseconds to sleep when waking up on DTIMs. + */ +const TUint32 KWlanMaxDtimSkipInterval = 0x0000001F; + +/** + * Time interval in microseconds after which transition from Active mode + * to Light PS mode is considered. + */ +const TUint32 KWlanPsActiveToLightTimeout = 0x00000020; + +/** + * Frame count threshold used when considering transition from Active + * to Light PS mode. + */ +const TUint32 KWlanPsActiveToLightThreshold = 0x00000021; + +/** + * Time interval in microseconds after which the frame counter used when + * considering transition from Light PS to Active mode is reset. + */ +const TUint32 KWlanPsLightToActiveTimeout = 0x00000022; + +/** + * Frame count threshold used when considering transition from Light PS + * to Active mode. + */ +const TUint32 KWlanPsLightToActiveThreshold = 0x00000023; + +/** + * Time interval in microseconds after which transition from Light PS mode + * to Deep PS mode is considered. + */ +const TUint32 KWlanPsLightToDeepTimeout = 0x00000024; + +/** + * Frame count threshold used when considering transition from Light PS + * to Deep PS mode. + */ +const TUint32 KWlanPsLightToDeepThreshold = 0x00000025; + +/** + * Received frame payload length (in bytes) threshold in U-APSD network for + * Best Effort Access Category. + */ +const TUint32 KWlanPsUapsdRxFrameLengthThreshold = 0x00000026; + +/** + * The minimum delay between RCPI roam checks (in microseconds). + */ +const TUint32 KWlanRcpiRoamMinInterval = 0x00000027; + +/** + * The maximum delay between RCPI roam checks (in microseconds). + */ +const TUint32 KWlanRcpiRoamMaxInterval = 0x00000028; + +/** + * Defines how many times an RCPI roam check interval value is used + * until the next interval value is calculated. + */ +const TUint32 KWlanRcpiRoamAttemptsPerInterval = 0x00000029; + +/** + * The factor the current interval value is multiplied by to + * get the next interval value. + */ +const TUint32 KWlanRcpiRoamNextIntervalFactor = 0x0000002A; + +/** + * The value that is added to the interval value that has been + * multiplied by KWlanRcpiRoamNextIntervalFactor. + */ +const TUint32 KWlanRcpiRoamNextIntervalAddition = 0x0000002B; + +/** + * Defines how long beacons/probe responses are stored in + * the internal scan list (in microseconds). + */ +const TUint32 KWlanScanListExpirationTime = 0x0000002C; + +/** + * Defines how many Voice AC packets must be sent during a certain period + * before QoS NULL data frame sending is started. + */ +const TUint32 KWlanQoSNullFrameEntryTxCount = 0x0000002D; + +/** + * The signal predictor algorithm target RCPI value for roam indication. + */ +const TUint32 KWlanSpRcpiTarget = 0x0000002E; + +/** + * The signal predictor algorithm target time for roam indication (in microseconds). + */ +const TUint32 KWlanSpTimeTarget = 0x0000002F; + +/** + * The minimum time interval for consecutive roam indications + * from the signal predictor algorithm (in microseconds). + */ +const TUint32 KWlanSpMinIndicationInterval = 0x00000030; + +/** + * The minimum delay between BSS lost roam attempts (in microseconds). + */ +const TUint32 KWlanBssLostRoamMinInterval = 0x00000031; + +/** + * The maximum delay between BSS lost roam attempts (in microseconds). + */ +const TUint32 KWlanBssLostRoamMaxInterval = 0x00000032; + +/** + * Defines how many times a BSS lost roam interval value is used + * until the next interval value is calculated. + */ +const TUint32 KWlanBssLostRoamAttemptsPerInterval = 0x00000033; + +/** + * The factor the current interval value is multiplied by to + * get the next interval value. + */ +const TUint32 KWlanBssLostRoamNextIntervalFactor = 0x00000034; + +/** + * The value that is added to the interval value that has been + * multiplied by KWlanBssLostRoamNextIntervalFactor. + */ +const TUint32 KWlanBssLostRoamNextIntervalAddition = 0x00000035; + +/** + * Defines how many attempts are made to find a suitable AP before + * giving up during BSS lost. + */ +const TUint32 KWlanBssLostRoamMaxTriesToFindNw = 0x00000036; + +/** + * Defines how many microseconds to wait for traffic stream request response. + */ +const TUint32 KWlanTrafficStreamCreationTimeout = 0x00000037; + +/** + * The number of lost consecutive beacons after which beacon lost event + * is indicated. + */ +const TUint32 KWlanBeaconLostThreshold = 0x00000038; + +/** + * The number of lost consecutive beacons after which beacon lost event + * is indicated during an active Bluetooth connection. + */ +const TUint32 KWlanBtBeaconLostThreshold = 0x00000039; + +/** + * The number of lost consecutive packets after which TX failure event + * is indicated. + */ +const TUint32 KWlanTxFailThreshold = 0x0000003A; + +/** + * The number of lost consecutive packets after which TX failure event + * is indicated during an active Bluetooth connection. + */ +const TUint32 KWlanBtTxFailThreshold = 0x0000003B; + +/** + * The number of seconds after which power save is enabled during + * the initial association. + */ +const TUint32 KWlanPowerSaveDelay = 0x0000003C; + +/** + * The amount of seconds region information is valid. + */ +const TUint32 KWlanRegionExpirationTime = 0x0000003D; + +/** + * Minimum interval for accepting subsequent RRM Beacon Requests + * (in microseconds). + */ +const TUint32 KWlanRrmMinMeasurementInterval = 0x0000003E; + +/** + * Current PSM server mode where possible values are: + * 0 = Normal mode + * 1 = Power save + * 2 = Partial power save + */ +const TUint32 KWlanPsmSrvMode = 0x0000003F; + +/** + * Peak start time for WLAN background scan specifying hours and minutes. + * Valid range is 0 to 2359 meaning 00:00 o'clock to 23:59 o'clock. + */ +const TUint32 KWlanBgScanPeakPeriodStart = 0x00000040; + +/** + * Peak end time for WLAN background scan specifying hours and minutes. + * Valid range is 0 to 2359 meaning 00:00 o'clock to 23:59 o'clock. + */ +const TUint32 KWlanBgScanPeakPeriodEnd = 0x00000041; + +/** + * WLAN background scan interval in seconds for peak period. + */ +const TUint32 KWlanBgScanIntervalPeakPeriod = 0x00000042; + +/** + * WLAN background scan interval in seconds for off-peak period. + */ +const TUint32 KWlanBgScanIntervalOffPeakPeriod = 0x00000043; + +/** + * Whether admission control traffic stream management is done automatically. + */ +const TUint32 KWlanAutomaticTrafficStreamMgmt = 0x00000044; + +/** + * Cached WLAN region where possible values are: + * 0 = Region is unknown + * 1 = Region is ETSI + * 2 = Region is FCC. + */ +const TUint32 KWlanRegion = 0x00000050; + +/** + * Timestamp for cached WLAN region (minutes from 0AD nominal Gregorian). + */ +const TInt32 KWlanRegionTimestamp = 0x00000051; + + +#endif // WLANDEVICESETTINGSINTERNALCRKEYS_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_device_settings_api/wlan_device_settings_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_device_settings_api/wlan_device_settings_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN Device Settings API + Central Repository API for static WLAN device settings + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_eapol_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_eapol_plugin_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN EAPOL Plugin API +* +*/ + +/* +* %version: 5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlaneapolclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlaneapolclient.h) +../inc/wlaneapolclient.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlaneapolclient.inl) +../inc/wlaneapolinterface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlaneapolinterface.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_eapol_plugin_api/inc/wlaneapolclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_eapol_plugin_api/inc/wlaneapolclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper class for instantiating an implementation of +* MWlanEapolInterface via ECom framework. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANEAPOLCLIENT_H +#define WLANEAPOLCLIENT_H + +#include +#include "wlaneapolinterface.h" + +const TInt KCWlanEapolClientUid = 0x2000B05C; +const TInt KCWlanWapiClientUid = 0x200195A1; + +/** + * @brief Class for instantiating an implementation of MWlanEapolInterface via ECom. + * + * @since S60 v3.2 + */ +class CWlanEapolClient : public CBase, public MWlanEapolInterface + { + +public: + + /** + * Static constructor. + * @param aUid UID of implementation to instantiate. + * @param aPartner Pointer to callback instance. + * @return Pointer to the constructed instance. + */ + inline static CWlanEapolClient* NewL( + TInt aUid, + MWlanEapolCallbackInterface* aPartner ); + + /** + * Destructor. + */ + inline virtual ~CWlanEapolClient(); + +private: // data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + + }; + +#include "wlaneapolclient.inl" + +#endif // WLANEAPOLCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_eapol_plugin_api/inc/wlaneapolclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_eapol_plugin_api/inc/wlaneapolclient.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of CWlanEapolClient class. +* +*/ + +/* +* %version: 4 % +*/ + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline CWlanEapolClient* CWlanEapolClient::NewL( + TInt aUid, + MWlanEapolCallbackInterface * aPartner ) + { + const TUid KTMPUid = { aUid }; + + TAny* interface = REComSession::CreateImplementationL( + KTMPUid, + _FOFF( CWlanEapolClient, iInstanceIdentifier ), + aPartner ); + + return reinterpret_cast( interface ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline CWlanEapolClient::~CWlanEapolClient() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_eapol_plugin_api/inc/wlaneapolinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_eapol_plugin_api/inc/wlaneapolinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom interface definition for WLAN EAPOL interface API. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANEAPOLINTERFACE_H +#define WLANEAPOLINTERFACE_H + +// INCLUDES +#include + + +/** + * @brief ECom interface definition for WLAN EAPOL inteface API. + * + * This class defines the methods used for configuring plugin and sending data from WLAN Engine to EAPOL. + * + * @since S60 v3.2 + */ +class MWlanEapolInterface + { + +public: + + /** + * Configure plugin implementation. + * + * @since S60 v3.2 + * @param aHeaderOffset Offset of EAP-header in packet_send. + * @param aMTU Maximum transfer unit (MTU). + * @param aTrailerLength Length of trailer needed by lower levels.. + * @return Return value is specified in interface specification. + */ + virtual TInt Configure( + const TInt aHeaderOffset, + const TInt aMTU, + const TInt aTrailerLength + ) = 0; + + /** + * Shutdown plugin implementation. + * + * @since S60 v3.2 + * @return Return value is specified in interface specification. + */ + virtual TInt Shutdown() = 0; + + /** + * Send data to EAPOL. + * + * @since S60 v3.2 + * @param aData Pointer to the data to be sent. + * @param aLength Length of the data to be sent. + * @return Return value is specified in interface specification. + */ + virtual TInt ProcessData( + const void * const aData, + const TInt aLength ) = 0; + + }; + + + +/** + * @brief ECom interface definition for WLAN EAPOL inteface API. + * + * This class defines the method used for sending data from EAPOL to WLAN Engine. + * + * @since S60 v3.2 + */ +class MWlanEapolCallbackInterface + { + +public: + + /** + * Callback interface to partner. + * + * @since S60 v3.2 + * @param aData Pointer to the data to be sent. + * @param aLength Length of the data to be sent. + * @return Return value is specified in interface specification. + */ + virtual TInt SendData( + const void * const aData, + const TInt aLength ) = 0; + + }; + + +#endif // WLANEAPOLINTERFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_eapol_plugin_api/wlan_eapol_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_eapol_plugin_api/wlan_eapol_plugin_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN EAPOL Plugin API + A plug-in interface for EAPOL services. + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_generic_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_generic_plugin_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: Generic WLAN Plugin API +* +*/ + +/* +* %version: 4 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanpluginclient.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanpluginclient.inl) +../inc/wlanpluginclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanpluginclient.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_generic_plugin_api/inc/wlanpluginclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_generic_plugin_api/inc/wlanpluginclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper class for instantiating an implementation of +* Generic WLAN Plugin via ECom framework. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANPLUGINCLIENT_H +#define WLANPLUGINCLIENT_H + +#include + +/** +* Class for instantiating an implementation via ECom. +* +*/ +class CGenericWlanPluginClient : public CBase + { +public: + // Constructors and destructor + + /** + * Static constructor. + * @param aUid implementation UID to be instantiated. + * @return Pointer to the constructed object. + */ + inline static CGenericWlanPluginClient* NewL(const TUid aUid ); + + /** + * Destructor. + */ + inline virtual ~CGenericWlanPluginClient(); + + /** + * List implementations for Generic WLAN Plugin interface. + * @param aImplInfoArray Array of implementation informations. + */ + inline static void ListImplementationsL( + RImplInfoPtrArray& aImplInfoArray ); + +private: // Data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + + }; + +#include "wlanpluginclient.inl" + +#endif // WLANPLUGINCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_generic_plugin_api/inc/wlanpluginclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_generic_plugin_api/inc/wlanpluginclient.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of Generic WLAN Plugin +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANPLUGINCLIENT_INL +#define WLANPLUGINCLIENT_INL + +// --------------------------------------------------------- +// CGenericWlanPluginClient::NewL +// --------------------------------------------------------- +inline CGenericWlanPluginClient* CGenericWlanPluginClient::NewL( const TUid uid ) + { + TAny* interface = REComSession::CreateImplementationL( uid, + _FOFF( CGenericWlanPluginClient, iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// --------------------------------------------------------- +// CGenericWlanPluginClient::~CGenericWlanPluginClient +// --------------------------------------------------------- +inline CGenericWlanPluginClient::~CGenericWlanPluginClient() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +// --------------------------------------------------------- +// CGenericWlanPluginClient::ListImplementationsL +// --------------------------------------------------------- +inline void CGenericWlanPluginClient::ListImplementationsL( + RImplInfoPtrArray& aImplInfoArray) + { + const TUid KGenericWlanPluginInterfaceUid = { 0x20012484 }; + + REComSession::ListImplementationsL(KGenericWlanPluginInterfaceUid, + aImplInfoArray); + } + +#endif // WLANPLUGINCLIENT_INL diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_generic_plugin_api/wlan_generic_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_generic_plugin_api/wlan_generic_plugin_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,13 @@ + + +WLAN Generic Plugin API +API for Generic WLAN plugins. +c++ +wlan_bearer + + + +no +no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* WLAN HAL API +* +*/ + +/* +* %version: tr1cfwln#7 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +#if !defined(RD_WLAN_DDK) +../inc/wha.inl OS_LAYER_PLATFORM_EXPORT_PATH(wha.inl) +../inc/wha_types.h OS_LAYER_PLATFORM_EXPORT_PATH(wha_types.h) +../inc/wha.h OS_LAYER_PLATFORM_EXPORT_PATH(wha.h) +../inc/wha_mib.h OS_LAYER_PLATFORM_EXPORT_PATH(wha_mib.h) +../inc/whanamespace.h OS_LAYER_PLATFORM_EXPORT_PATH(whanamespace.h) +#else +../inc/wlanwha.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanwha.h) +../inc/wlanwha.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanwha.inl) +../inc/wlanwha_mib.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanwha_mib.h) +../inc/wlanwha_types.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanwha_types.h) +../inc/wlanwhanamespace.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanwhanamespace.h) +../inc/wlanpddiface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanpddiface.h) +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wha.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wha.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,609 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 18 % +*/ + +#ifndef WHA_H +#define WHA_H + +#include +#include + + +NAMESPACE_BEGIN_WHA + +typedef TUint TMutexHandle; + +struct SConfigureData; + +/** + * Defines the WHA callback interface + * + * @since S60 3.1 + */ +class MWhaCb + { + +public: // Methods + + virtual ~MWhaCb() {}; + + /** + * The WLAN PDD uses this method to give a command response event to the + * WLAN LDD. + * + * @since S60 3.1 + * @param aCommandId Event identifier. + * @param aStatus Status code. + * @param aCommandResponseParams Event specific data structure. + */ + virtual void CommandResponse( + TCommandId aCommandId, + TStatus aStatus, + const UCommandResponseParams& aCommandResponseParams ) = 0; + + /** + * The WLAN PDD uses this method to give a command completion event to the + * WLAN LDD. + * + * @since S60 3.1 + * @param aCompleteCommandId Event identifier. + * @param aStatus Status code. + * @param aCommandCompletionParams Event specific data structure. + */ + virtual void CommandComplete( + TCompleteCommandId aCompleteCommandId, + TStatus aStatus, + const UCommandCompletionParams& aCommandCompletionParams ) = 0; + + /** + * The WLAN PDD uses this method to indicate a spontaneous event to the + * WLAN LDD. + * + * @since S60 3.1 + * @param aIndicationId Event identifier. + * @param aIndicationParams Event specific data structure. + */ + virtual void Indication( + TIndicationId aIndicationId, + const UIndicationParams& aIndicationParams ) = 0; + + /** + * The WLAN PDD calls this method when it has transferred a packet to the + * WLAN device. + * + * @since S60 3.1 + * @param aPacketId The ID that the WLAN LDD gave for the packet in the + * SendPacket call. + */ + virtual void SendPacketTransfer( + TPacketId aPacketId ) = 0; + + /** + * The WLAN PDD calls method when the WLAN device has processed a packet + * from its send queue. + * + * @since S60 3.1 + * @param aStatus The result of the packet sending: + * KSuccess: The packet sending was successful. + * KErrorRetryExceeded: Packet sending failed because of exceeding + * dot11ShortRetryLimit or dot11LongRetryLimit. + * KErrorLifetimeExceeded: Packet sending failed because of exceeding + * dot11MaxTransmitMsduLifeTime. + * KErrorNoLink: Packet sending failed because of the loss of the + * network link. The WLAN flushed the packet from the queue before + * making a single transmit attempt for it. + * @param aPacketId The ID that the WLAN LDD gave for the packet in the + * SendPacket call. + * @param aRate The data rate or MCS at which the packet sending succeeded. + * (this parameter is only valid if aStatus is KSuccess.) + * If the transmission was a non-HT transmission, then this parameter + * contains the data rate in bit map format. + * If the transmission was an HT transmission, then this parameter + * contains the numeric value of the MCS. + * @param aPacketQueueDelay The time the packet spent in the WLAN device + * transmit queue before the WLAN device started transmission. + * The time is calculated from the point the WLAN device gets the + * packet from the host to the point the packet is ready for + * transmission. + * This parameter is only valid if aStatus is KSuccess. + * This value is zero if the WLAN device does not support the + * calculation. + * Unit: microseconds. + * @param aMediaDelay The total time the packet spent in the WLAN device + * before transmission was completed. + * The time is calculated from the point the WLAN device gets the + * packet from the host to the point it gets an acknowledgement for + * the packet from the peer. + * This parameter is only valid if aStatus is KSuccess. + * This value is zero if the WLAN device does not support the + * calculation. + * Unit: microseconds. + * @param aAckFailures The number of times the WLAN device transmitted the + * packet without receiving an acknowledgement. + * @param The sequence number the WLAN device used when it transmitted the + * frame. + */ + virtual void SendPacketComplete( + TStatus aStatus, + TPacketId aPacketId, + TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint8 aAckFailures, + TUint16 aSequenceNumber = 0 ) = 0; + + /** + * The WLAN PDD calls this method to request a memory buffer for packet + * reception. + * + * @since S60 3.1 + * @param aLength The length of the requested buffer in bytes. + * The upper limit for the length is the maximum length of + * an 802.11n A-MSDU. + * @return The method allocates a buffer whose length is aLength + Rx + * offset bytes and returns a pointer to the beginning of the buffer. + * If the allocation fails, the method returns a NULL pointer and the + * WLAN PDD should discard the received packet. + */ + virtual TAny* RequestForBuffer ( TUint16 aLength ) = 0; + + /** + * The WLAN PDD uses this method to deliver a received packet. + * + * @since S60 3.1 + * @param aStatus The result of the of the packet reception: + * KSuccess: The packet reception was successful. + * KDecryptFailure: The packet reception failed because of a + * decryption error. + * KMicFailure: The packet reception failed because of a MIC failure. + * KFailed: The packet reception failed because of some other reason. + * @param aFrame A pointer to the beginning of the packet content (the first + * byte of the MSDU or A-MSDU) + * If aStatus indicates a failure (KDecryptFailure, KMicFailure, + * KFailed ), the packet should contain only the MAC header (i.e., + * the frame body is omitted). + * @param aLength The length of the packet. Measured from the first byte of + * the MAC header to the last byte of the frame body. + * @param aRate The data rate or MCS at which the frame was received + * If the packet was received as a non-HT transmission, then this + * parameter contains the data rate in bit map format. + * If the packet was received as an HT transmission, then this + * parameter contains the numeric value of the MCS. + * @param aRCPI RCPI value of the received packet. + * @param aChannel The channel on which the packet was received. + * @param aBuffer A pointer to the beginning of the allocated memory buffer + * (i.e., the pointer that the WLAN PDD got with RequestForBuffer). + * This parameter is only used when operating in "multi buffer mode". + * In single buffer mode, the WLAN PDD should set it to NULL. + * @param aFlags Bit field providing status information of the received + * frame. + */ + virtual void ReceivePacket( + TStatus aStatus, + const void* aFrame, + TUint16 aLength, + TRate aRate, + TRcpi aRCPI, + TChannelNumber aChannel, + void* aBuffer, + TUint32 aFlags ) = 0; + }; + + +/** + * Defines the WHA interface + * + * @since S60 3.1 + */ +class Wha + { + +public: // constants + + enum { KNumOfEdcaQueues = 4 }; + +public: // Methods + + virtual ~Wha() {}; + + /** + * WHA callback attachment method + * + * @since S60 3.1 + * @param aWhaCb + */ + inline void Attach( MWhaCb& aWhaCb ); + + /** + * Passes down handle to the mutex which shall be used to protect driver + * code from concurrent execution by multiple threads + * + * @since S60 3.1 + * @param aMutexHandle is handle to the mutex to be used + */ + virtual void Mutex( TMutexHandle aMutexHandle ) = 0; + + /** + * This method downloads the firmware to the WLAN device and performs the + * low level initialization of the device. + * + * @since S60 3.1 + * @param aData Firmware data. The content is vendor-specific. + * The memory behind the pointer is valid to the point when the WLAN + * PDD sends the corresponding command response event. + * @param aLength The length of the data in bytes placed in the parameter + * aData. + */ + virtual void Initialize( + const void* aData, + TUint32 aLength ) = 0; + + /** + * The WLAN LDD calls this method to configure the WLAN device. + * + * @since S60 3.1 + * @param aData Configuration data. The content is vendor-specific. + * The memory behind the reference is valid to the point when the + * WLAN PDD sends the corresponding command response event. + * @param aSettings Output data that holds the capabilities of the + * WLAN device. + */ + virtual void Configure( + const SConfigureData& aData, + SSettings& aSettings ) = 0; + + /** + * WLAN LDD calls this method to prepare the WLAN PDD for unloading. + * + * @since S60 3.1 + * @param aSynchronous Should the command be executed synchronously (ETrue) + * or not (EFalse). + * @return KSuccess: The command was executed synchronously and no command + * response event is sent. + * KPending: The command is executed asynchronously and the + * corresponding command response event is sent upon command + * completion. + */ + virtual TStatus Release( TBool aSynchronous ) = 0; + + /** + * The WLAN LDD uses this method to command the WLAN device to start + * scanning the available networks. + * + * @since S60 3.1 + * @param aMaxTransmitRate The transmission rate of the probe requests + * Note: Just a single rate is selected as rate fallback is + * not to be used during the scan process. + * @param aBand The used frequency band. + * Only one band is scanned at a time and one bit is used to select + * the band to be scanned. + * @param aNumOfChannels The number of channels provided in the array + * (aChannels). + * @param aChannels A structure that specifies the scanned channels. + * @param aScanType The scan type: + * EFgScan: foreground scan. + * EBgScan: background scan. + * EForcedBgScan: forced background scan. + * @param aNumOfProbeRequests The number of probe requests (per SSID) to be + * sent to each channel. + * Value 0 means the device does not send any probe requests and the + * scan is a passive scan. + * @param aSplitScan ETrue - use split scan. + * EFalse - do not use split scan. + * @param aNumOfSSID The number of SSIDs in the SSID array (aSSID). + * Value 0 means that the array is empty and this is a broadcast + * scan. In a broadcast scan, the WLAN device puts an empty SSID in + * the probe requests. + * Value greater than 0 means that this is a directed scan. The WLAN + * device puts the SSIDs in the array to the probe requests. + * @param aSsid An array of the SSID to be scanned in a directed scan. + */ + virtual void Scan( + TRate aMaxTransmitRate, + TBand aBand, + TUint8 aNumOfChannels, + const SChannels* aChannels, + TScanType aScanType, + TUint8 aNumOfProbeRequests, + TBool aSplitScan, + TUint8 aNumOfSSID, + const SSSID* aSsid ) = 0; + + /** + * The WLAN LDD uses this method to stop an ongoing scan process. + * + * @since S60 3.1 + */ + virtual void StopScan() = 0; + + /** + * The WLAN LDD uses this method to command the WLAN device to join a BSS + * or IBSS or to start an IBSS. + * + * @since S60 3.1 + * @param aMode The operation mode of the network: + * EIBSS: IBSS mode + * EBSS: BSS mode + * @param aBSSID The BSSID of network. + * @param aSSID The SSID of the network. + * @param aBand The used frequency band. Only one bit is used to + * select the band. + * @param aChannel The channel number of the network. + * @param aBeaconInterval The time between TBTTs in TUs. + * @param aBasicRateSet The BSS basic rate set. + * @param aAtimWindow The ATIM window of the IBSS. + * Note: When the ATIM window is zero, the initiated IBSS does not + * support power save. + * @param aPreambleType The preamble type. + * Note: 1 and 2 Mbit/s transmissions always use a long preamble + * regardless of this setting. + * @param aProbeForJoin Specifies if the device should send a Probe request + * with the specified SSID when joining the network. + * [Optional] + */ + virtual void Join( + TOperationMode aMode, + const TMacAddress& aBSSID, + const SSSID& aSSID, + TBand aBand, + TChannelNumber aChannel, + TUint32 aBeaconInterval, + TRate aBasicRateSet, + TUint16 aAtimWindow, + TPreamble aPreambleType, + TBool aProbeForJoin ) = 0; + + + /** + * The WLAN LDD uses this command to reset the WLAN device and the WLAN PDD + * to their initial states (the state after the Initialize and Configure + * commands). + * + * @since S60 3.1 + */ + virtual void Reset() = 0; + + /** + * The WLAN LDD uses this method to change the WLAN device’s 802.11 power + * management mode. + * + * @since S60 3.1 + * @param aPsMode The 802.11 power management mode the WLAN device should + * enter. + */ + virtual void SetPsMode( TPsMode aPsMode ) = 0; + + /** + * The WLAN LDD uses this method to fix connection parameters after the + * initial connection setup (after the association response in the + * infrastructure mode). + * + * @since S60 3.1 + * @param aDTIM Specifies the DTIM interval in multiples of beacons. + * @param aAID Specifies the AID received during the association process. + */ + virtual void SetBssParameters( + TUint8 aDTIM, + TUint16 aAID ) = 0; + + /** deprecated */ + virtual void Measure( + TPowerLevel /*aTxPowerLevel*/, + TBand /*aBand*/, + TChannelNumber /*aChannel*/, + TUint8 /*aActivationDelay*/, + TUint8 /*aMeasurementOffset*/, + TUint8 /*aNumberOfMeasurementTypes*/, + const SParameterSet* /*aParameterSet*/ ) {}; + + /** deprecated */ + virtual void StopMeasure() {}; + + /** + * The WLAN LDD uses this method to read configuration information and + * statistics from the WLAN device. + * + * @since S60 3.1 + * @param aMib The ID of the MIB to be accessed. + */ + virtual void ReadMib( TMib aMib ) = 0; + + /** + * The WLAN LDD uses this method to write configuration information to the + * WLAN device. + * + * @since S60 3.1 + * @param aMib The ID of the MIB to be written. + * @param aLength The length of the MIB. + * @param aData A pointer to the structure specifying the MIB data according + * to the MIB ID. + * @param aMore This flag is set to ETrue if the WLAN host driver is about + * to write more MIBs after this call. + * @return KSuccess: The command was executed synchronously and no command + * response event is sent. + * KPending: The command is executed asynchronously and the + * corresponding command response event is sent upon command + * completion. + */ + virtual TStatus WriteMib( + TMib aMib, + TUint16 aLength, + const void* aData, + TBool aMore ) = 0; + + /** + * This method adds a new (or replaces an old) encryption key to the WLAN + * device. + * + * @since S60 3.1 + * @param aType The type of the key to be added: + * EWepGroupKey – WEP group key + * EWepPairWiseKey – WEP pairwise key + * ETkipGroupKey – TKIP group key + * ETkipPairWiseKey – TKIP pairwise key + * EAesGroupKey – AES group key + * EAesPairWiseKey – AES pairwise ket + * EWapiGroupKey – WAPI group key + * EWapiPairWiseKey – WAPI pairwise key + * @param aKey A pointer to the structure containing the key material. + * @param aEntryIndex The key entry index of the key to be added. + */ + virtual void AddKey( + TKeyType aType, + const void* aKey, + TUint8 aEntryIndex ) = 0; + + /** + * This method removes encryption keys from the active key set. + * + * @since S60 3.1 + * @param aEntryIndex The index of the key to remove from the set. + */ + virtual void RemoveKey( TUint8 aEntryIndex ) = 0; + + /** + * The WLAN LDD uses this method to configure QoS parameters of + * transmission queues. + * + * @since S60 3.1 + * @param aQueueId The ID for the queue. + * @param aMaxLifeTime The time (in TUs) how long the MSDU can stay in the + * transmit queue. If the timer expires before the MSDU is successfully + * transmitted, the WLAN device shall discard the packet. [Optional] + * @param aPsScheme The PS mode of the queue: + * ERegularPs - Regular PS mode. The queue is not trigger enabled. + * EUapsd - U-APSD mode. The queue is trigger enabled. + * @param aAckPolicy The ACK frame policy of the specified queue: + * ENormal - Normal ack. + * ENoaAck - No ack. + * @param aMediumTime The amount of time the queue is allowed to access the + * WLAN air interface during one second interval. + * The unit of the parameter is 32 microseconds. Value 0 + * means that the medium time is unlimited. + */ + virtual void ConfigureQueue( + TQueueId aQueueId, + TUint32 aMaxLifeTime, + TPsScheme aPsScheme, + const SSAPSDConfig& aSAPSDConfig, /** deprecated */ + TAckPolicy aAckPolicy, + TUint16 aMediumTime ) = 0; + + /** + * The WLAN LDD uses this method to configure EDCA access category + * parameters. + * + * @since S60 3.1 + * @param aCwMin CWmin (in slots) for the access class. + * @param aCwMax CWmax (in slots) for the access class. + * @param aAIFS AIFS value (in slots) for the access class. + * @param aTxOplimit Tx Op Limit (in microseconds) for the access class. + * @param aMaxReceiveLifeTime The maximum receive lifetime for the access + * class. [Optional] + */ + virtual void ConfigureAC( + TUint16 aCwMin[KNumOfEdcaQueues], + TUint16 aCwMax[KNumOfEdcaQueues], + TUint8 aAIFS[KNumOfEdcaQueues], + TUint16 aTxOplimit[KNumOfEdcaQueues], + TUint16 aMaxReceiveLifeTime[KNumOfEdcaQueues] ) = 0; + + /** + * The WLAN LDD uses this method to send packets. + * + * @since S60 3.1 + * @param aFrame A pointer to the beginning of the packet content (the first + * byte of the MSDU or A-MSDU). + * @param aLength The length of the packet. + * Measured from the first byte of the MAC header to the last + * byte of the frame body. + * @param aQueueId The transmit queue. + * @param aTxRateClassId The index of the rate policy for this transmission. + * If the WLAN device supports autonomous rate adaptation, the index + * refers to the txAutoRatePolicy MIB. + * If the WLAN device does not support autonomous rate adaptation, + * the index refers to the txRatePolicy MIB. + * In both cases, the value 1 refers to the first policy. + * @param aMaxTransmitRate The highest transmission rate to be used for this + * packet. + * This parameter is valid only when non-autonomous rate adaptation + * (txRatePolicy) is used. + * @param aMore Informs the WLAN PDD if an another packet is pending for + * transmission in the WLAN LDD: + * EFalse: No, this is it for the time being. + * ETrue: Yes, another packet is pending for transmission. + * @param aPacketId The packet identifier. + * @param aPowerLevel The transmission power level. Unit: dBm. [Optional] + * @param aExpiryTime The time (in TUs) how long the MSDU can stay in the + * transmit queue. [Optional] + * @param aReserved Reserved field. + * @return KSuccess: The WLAN PDD has buffered the packet for transfer to + * the WLAN device. + * The WLAN LDD can call SendPacket again to send a new packet. + * KSuccessXfer: The WLAN PDD has transferred the packet and all + * the previously buffered packets to the WLAN device. + * KPending: The WLAN PDD has buffered the packet for transfer to + * the WLAN device. + * The WLAN LDD can not call SendPacket until the WLAN PDD calls + * SendPacketTransfer. + * KQueueFull: The WLAN PDD has discarded the packet because the + * corresponding queue in the WLAN device is full. + * KSuccessQueueFull: The WLAN PDD has buffered the packet for + * transfer to the WLAN device. However, the corresponding queue + * in the WLAN device is now full. + */ + virtual TStatus SendPacket( + const void* aFrame, + TUint16 aLength, + TQueueId aQueueId, + TUint8 aTxRateClassId, + TRate aMaxTransmitRate, + TBool aMore, + TPacketId aPacketId, + TPowerLevel aPowerLevel, + TUint32 aExpiryTime, + void* aReserved ) = 0; + + /** + * The WLAN LDD calls this method to perform production line testing of the + * WLAN device. + * + * @since S60 5.0 + * @param aType A parameter indicating which test to perform. + * @param aParams Test specific parameters. + * An in/out parameter. + */ + virtual void Plt( TPltType aType, void* aParams ) = 0; + +protected: // methods + + Wha() : iWhaCb(NULL) {}; + explicit Wha( MWhaCb& aCb ) : iWhaCb(&aCb) {}; + +protected: // data + + MWhaCb* iWhaCb; + }; + +#include + +NAMESPACE_END_WHA + +#endif // WHA_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wha.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wha.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 7 % +*/ + +inline void Wha::Attach( MWhaCb& aWhaCb ) + { + iWhaCb = &aWhaCb; + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wha_mib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wha_mib.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,299 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 22 % +*/ + +#ifndef WHA_MIB_H +#define WHA_MIB_H + +#include +#include + +NAMESPACE_BEGIN_WHA + +struct Sdot11StationId + { + TMacAddress iAddr; + TUint8 iReserved[2]; + }; + +struct Sdot11MaxReceiveLifeTime + { + TUint32 iDot11MaxReceiveLifeTime; + }; + +struct Sdot11SlotTime + { + TUint32 iDot11SlotTime; + }; + +struct Sdot11GroupAddressesTable + { + enum { KHeaderSize = sizeof( TBool ) + sizeof( TUint32 ) }; + + TBool iEnable; + TUint32 iNumOfAddrs; + TMacAddress iAddrData[1]; // addresses start here + }; + +struct Sdot11WepDefaultKeyId + { + TPrivacyKeyId iDot11WepDefaultKeyId; + TUint8 iReserved[3]; + }; + +struct Sdot11CurrentTxPowerLevel + { + TPowerLevel iDot11CurrentTxPowerLevel; + }; + +struct Sdot11RTSThreshold + { + TUint32 iDot11RTSThreshold; + }; + +struct SctsToSelf + { + TBool iCtsToSelf; + }; + +struct SarpIpAddressTable + { + TBool iEnable; + TIpv4Address iIpV4Addr; + }; + +struct StemplateFrame + { + enum { KHeaderSize = sizeof( TTemplateType ) + sizeof( TRate ) + sizeof( TUint32 ) }; + + TTemplateType iFrameType; + TRate iInitialTransmitRate; + TUint32 iLength; + TUint8 iTemplateData[1]; // the template data starts here + }; + +struct SrxFilter + { + enum { KPromiscous = (1 << 0) }; + enum { KBssId = (1 << 1) }; /** deprecated */ + + TUint32 iRxFilter; + }; + +struct SDefaultIeFilterTable + { + enum { KTrackChange = (1 << 0) }; + enum { KTrackPresence = (1 << 1) }; + + TUint8 iIe; + TUint8 iTreatMeant; + }; + +struct SIe221FilterTable + { + enum { KTrackChange = (1 << 0) }; + enum { KTrackPresence = (1 << 1) }; + + enum { KOuiLen = 3 }; + + TUint8 iIe; + TUint8 iTreatMeant; + TUint8 iOui[KOuiLen]; + TUint8 iType; + TUint16 iVersion; + }; + +struct SbeaconFilterIeTable + { + enum { KHeaderSize = sizeof( TUint32 ) }; + + TUint32 iNumofElems; + TUint8 iIeTable[1]; // IE table details start here + }; + +struct SbeaconFilterEnable + { + TBool iEnable; + TUint32 iCount; /** deprecated */ + }; + +struct SsleepMode + { + TSleepMode iMode; + }; + +struct SwlanWakeUpInterval + { + TWlanWakeUpInterval iMode; + TUint8 iListenInterval; + TUint8 iReserved[2]; + }; + +struct SbeaconLostCount + { + TUint32 iLostCount; + }; + +struct SrcpiThreshold + { + TRcpi iThreshold; + TUint8 iReserved[3]; + }; + +struct SstatisticsTable + { + TUint8 iSnr; + TRcpi iRcpi; + TUint8 iReserved[2]; + }; + +struct SibssPsConfig /** deprecated */ + { + TIbssPsMode iMode; + }; + +struct StxRateClass + { + TUint8 iTxPolicy54; + TUint8 iTxPolicy48; + TUint8 iTxPolicy36; + TUint8 iTxPolicy33; + TUint8 iTxPolicy24; + TUint8 iTxPolicy22; + TUint8 iTxPolicy18; + TUint8 iTxPolicy12; + TUint8 iTxPolicy11; + TUint8 iTxPolicy9; + TUint8 iTxPolicy6; + TUint8 iTxPolicy5_5; + TUint8 iTxPolicy2; + TUint8 iTxPolicy1; + + TUint8 iShortRetryLimit; + TUint8 iLongRetryLimit; + + TUint32 iFlags; + }; + +struct StxRatePolicy + { + enum { KHeaderSize = sizeof( TUint32 ) }; + + TUint32 iNumOfPolicyObjects; + StxRateClass iTxRateClass[1]; // rate classes start here + }; + +struct ScountersTable + { + TUint32 iPlcpError; + TUint32 iFcsError; + }; + +struct Sdot11Preamble + { + TPreambleType iType; + TUint8 iReserved[3]; + }; + +struct ShtCapabilities + { + TBool iHtSupport; + TMacAddress iPeerMac; + THtRxStbc iRxStbc; + THtMaxAmpdu iMaxAmpduLength; + THtCapabilities iPeerFeatures; + THtMcsSet iMcsSet; + THtAmpduSpacing iAmpduSpacing; + THtMcsFeedback iMcsFeedback; + TUint32 iTxBeamFormingCapab; + TUint8 iAntennaSelCapab; + TUint8 iReserved[3]; + }; + +struct ShtBssOperation + { + enum { KNonGreenfieldPresent = ( 1 << 0 ) }; + enum { KPcoActive = ( 1 << 2 ) }; + enum { KRifsPermitted = ( 1 << 3 ) }; + enum { KDualCtsProtReq = ( 1 << 4 ) }; + enum { KSecondaryBeaconTx = ( 1 << 5 ) }; + enum { KLsigTxopProtection = ( 1 << 6 ) }; + + TUint32 iInfo; + THtMcsSet iMcsSet; + THtProtection iOpMode; + THtSecChannelOffset iSecChOffset; + THtChannelWidth iApChWidth; + TUint8 iReserved[3]; + }; + +struct ShtSecondaryBeacon + { + THtSecBeacon iSecBeacon; + TUint8 iReserved[3]; + }; + +struct ShtBlockAckConfigure + { + static const TUint8 KTid0 = ( 1 << 0 ); + static const TUint8 KTid1 = ( 1 << 1 ); + static const TUint8 KTid2 = ( 1 << 2 ); + static const TUint8 KTid3 = ( 1 << 3 ); + static const TUint8 KTid4 = ( 1 << 4 ); + static const TUint8 KTid5 = ( 1 << 5 ); + static const TUint8 KTid6 = ( 1 << 6 ); + static const TUint8 KTid7 = ( 1 << 7 ); + + TUint8 iTxBlockAckUsage; + TUint8 iRxBlockAckUsage; + TUint8 iReserved[2]; + }; + +struct StxAutoRatePolicy + { + TRate iBAndGRates; + THtMcsSet iMcsSet; + TUint8 iTxRateClassId; + TUint8 iShortRetryLimit; + TUint8 iLongRetryLimit; + TUint8 iReserved[3]; + }; + +struct SetherTypeFilter + { + enum { KHeaderSize = sizeof( TFilterMode ) + sizeof( TUint8 ) }; + + TFilterMode iFilterMode; + TUint8 iNumOfTypes; + TUint16 iTypeData[1]; // Ethernet type codes start here + }; + +struct SbroadcastUdpFilter + { + enum { KHeaderSize = sizeof( TFilterMode ) + sizeof( TUint8 ) }; + + TFilterMode iFilterMode; + TUint8 iNumOfPorts; + TUint16 iPortData[1]; // UDP port numbers start here + }; + +NAMESPACE_END_WHA + +#endif // WHA_MIB_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wha_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wha_types.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,778 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 28 % +*/ + +#ifndef WHA_TYPES_H +#define WHA_TYPES_H + +#include + +NAMESPACE_BEGIN_WHA + +typedef TUint16 TMib; +const TMib KMibDot11StationId = 0x1001; +const TMib KMibDot11MaxReceiveLifetime = 0x1002; +const TMib KMibDot11SlotTime = 0x1003; +const TMib KMibDot11GroupAddressesTable = 0x1004; +const TMib KMibDot11WepDefaultKeyId = 0x1005; +const TMib KMibDot11CurrentTxPowerLevel = 0x1006; +const TMib KMibDot11RTSThreshold = 0x1007; +const TMib KMibCtsToSelf = 0x1101; +const TMib KMibArpIpAddressTable = 0x1102; +const TMib KMibTemplateFrame = 0x1103; +const TMib KMibRxFilter = 0x1104; +const TMib KMibBeaconFilterIeTable = 0x1105; +const TMib KMibBeaconFilterEnable = 0x1106; +const TMib KMibSleepMode = 0x1107; +const TMib KMibWlanWakeUpInterval = 0x1108; +const TMib KMibBeaconLostCount = 0x1109; +const TMib KMibRcpiThreshold = 0x110A; +const TMib KMibStatisticsTable = 0x110B; +const TMib KMibIbssPsConfig = 0x110C; /** deprecated */ +const TMib KMibTxRatePolicy = 0x110D; +const TMib KMibCountersTable = 0x110E; +const TMib KMibDot11Preamble = 0x110F; +const TMib KMibEtherTypeFilter = 0x1110; +const TMib KMibBroadcastUdpFilter = 0x1111; + +const TMib KMibHtCapabilities = 0x2000; +const TMib KMibHtBssOperation = 0x2001; +const TMib KMibHtSecondaryBeacon = 0x2002; +const TMib KMibHtBlockAckConfigure = 0x2003; +const TMib KMibTxAutoRatePolicy = 0x2004; + + +typedef TInt32 TPowerLevel; +typedef TUint8 TRcpi; +typedef TUint8 TBand; +typedef TUint32 TChannelNumber; +typedef TUint32 TPltType; +typedef TUint32 TRate; +typedef TUint32 TPacketId; + +typedef TUint8 TPsMode; +typedef TUint32 TIbssPsMode; /** deprecated */ +typedef TUint8 TPrivacyKeyId; +typedef TUint32 TTemplateType; +typedef TUint32 TSleepMode; +typedef TUint8 TWlanWakeUpInterval; +typedef TUint32 TIpv4Address; +typedef TUint32 TStatus; +typedef TUint8 TSlotTime; + +typedef TUint8 THtSecChannelOffset; +typedef TUint8 THtChannelWidth; +typedef TUint8 THtPcoPhase; + +const TUint8 KHtMcsSetLength = 10; +typedef TUint8 THtMcsSet[KHtMcsSetLength]; + +typedef TUint8 THtProtection; +typedef TUint8 THtPpduFormat; +typedef TUint8 THtRxStbc; +typedef TUint8 THtMaxAmsdu; +typedef TUint8 THtMaxAmpdu; +typedef TUint8 THtAmpduSpacing; +typedef TUint8 THtPcoTransTime; +typedef TUint8 THtSecBeacon; +typedef TUint8 THtMcsFeedback; +typedef TUint8 TPreambleType; +typedef TUint32 THtCapabilities; +typedef TUint8 TFilterMode; + +const TBand KBand2dot4GHzMask = ( 1 << 0 ); +const TBand KBand4dot9GHzMask = ( 1 << 1 ); +const TBand KBand5GHzMask = ( 1 << 2 ); + +/** +* 802.11 WEP key ID values +*/ +const TPrivacyKeyId KPrivacyKeyId0 = 0; +const TPrivacyKeyId KPrivacyKeyId1 = 1; +const TPrivacyKeyId KPrivacyKeyId2 = 2; +const TPrivacyKeyId KPrivacyKeyId3 = 3; +const TPrivacyKeyId KPrivacyKeyIdMax = 4; // defined as an upper bound + +enum TQueueId + { + ELegacy, + EBackGround, + EVideo, + EVoice, + EHcca, /** deprecated */ + EQueueIdMax // defined as upper bound + }; + +const TUint32 KSlotTime20 = 20; +const TUint32 KSlotTime9 = 9; + + +const TUint KBeaconStorageSize = 256; +const TUint KProbeRequestStorageSize = KBeaconStorageSize; +const TUint KProbeResponseStorageSize = KBeaconStorageSize; + +const TTemplateType KBeaconTemplate = 0; +const TTemplateType KProbeRequestTemplate = 1; +const TTemplateType KNullDataTemplate = 2; +const TTemplateType KProbeResponseTemplate = 3; +const TTemplateType KQosNullDataTemplate = 4; +const TTemplateType KPSPollTemplate = 5; + +const TSleepMode KAwakeMode = 0; +const TSleepMode KPowerDownMode = 1; +const TSleepMode KLowPowerMode = 2; + +const TWlanWakeUpInterval KWakeUpIntervalAllBeacons = 0; +const TWlanWakeUpInterval KWakeUpIntervalAllDtims = 1; +const TWlanWakeUpInterval KWakeUpIntervalEveryNthBeacon = 2; +const TWlanWakeUpInterval KWakeUpIntervalEveryNthDtim = 3; + +const TIbssPsMode KIbssStandardPsMode = 0; /** deprecated */ +const TIbssPsMode KIbssEnhancedPsMode = 1; /** deprecated */ + +const THtSecChannelOffset KNoSecCh = 0; +const THtSecChannelOffset KSecChAbovePrimCh = 1; +const THtSecChannelOffset KSecChBelowPrimCh = 3; + +const THtChannelWidth KHtChWidthOnly20MHz = 0; +const THtChannelWidth KHtChWidth40And20MHz = 1; + +const THtPcoPhase KHtPcoPhase20MHz = 0; +const THtPcoPhase KHtPcoPhase40MHz = 1; + +const THtProtection KHtOperationMode0 = 0; +const THtProtection KHtOperationMode1 = 1; +const THtProtection KHtOperationMode2 = 2; +const THtProtection KHtOperationMode3 = 3; + +const THtPpduFormat KHtPpduFormatNonHt = 0; +const THtPpduFormat KHtPpduFormatMixed = 1; +const THtPpduFormat KHtPpduFormatGreenfield = 2; + +const THtRxStbc KHtRxStbcNotSupported = 0; +const THtRxStbc KHtRxStbcFor1Stream = 1; +const THtRxStbc KHtRxStbcFor1And2Streams = 2; +const THtRxStbc KHtRxStbcFor1And2And3Streams = 3; + +const THtMaxAmsdu KHtMaxAmsdu3839Octets = 0; +const THtMaxAmsdu KHtMaxAmsdu7935Octets = 1; + +const THtMaxAmpdu KHtMaxAmpdu8191Octets = 0; +const THtMaxAmpdu KHtMaxAmpdu16383Octets = 1; +const THtMaxAmpdu KHtMaxAmpdu32767Octets = 2; +const THtMaxAmpdu KHtMaxAmpdu65535Octets = 3; + +const THtAmpduSpacing KHtAmpduSpacingNoRestriction = 0; +const THtAmpduSpacing KHtAmpduSpacingQuarter_us = 1; +const THtAmpduSpacing KHtAmpduSpacingHalf_us = 2; +const THtAmpduSpacing KHtAmpduSpacingOne_us = 3; +const THtAmpduSpacing KHtAmpduSpacingTwo_us = 4; +const THtAmpduSpacing KHtAmpduSpacingFour_us = 5; +const THtAmpduSpacing KHtAmpduSpacingEight_us = 6; +const THtAmpduSpacing KHtAmpduSpacingSixteen_us = 7; + +const THtPcoTransTime KHtPcoTransTimeNone = 0; +const THtPcoTransTime KHtPcoTransTime400us = 1; +const THtPcoTransTime KHtPcoTransTime1_5ms = 2; +const THtPcoTransTime KHtPcoTransTime5ms = 3; + +const THtSecBeacon KHtSecBeaconRxPrimaryOnly = 0; +const THtSecBeacon KHtSecBeaconRxEither = 1; +const THtSecBeacon KHtSecBeaconRxSecondaryOnly = 2; + +const THtMcsFeedback KHtMcsFeedbackNone = 0; +const THtMcsFeedback KHtMcsFeedbackUnsolicitedOnly = 2; +const THtMcsFeedback KHtMcsFeedbackUnsolicitedAndSolicited = 3; + +const TPreambleType KLongPreamble = 0; +const TPreambleType KShortPreamble = 1; + +const THtCapabilities KLdpcRx = ( 1 << 0 ); +const THtCapabilities K40MhzChannel = ( 1 << 1 ); +const THtCapabilities KGreenfieldFormat = ( 1 << 2 ); +const THtCapabilities KShortGiFor20Mhz = ( 1 << 3 ); +const THtCapabilities KShortGiFor40Mhz = ( 1 << 4 ); +const THtCapabilities KStbcTx = ( 1 << 5 ); +const THtCapabilities KDelayedBlockAck = ( 1 << 6 ); +const THtCapabilities KDsssCckIn40Mhz = ( 1 << 7 ); +const THtCapabilities KPsmp = ( 1 << 8 ); +const THtCapabilities KLsigTxopProtection = ( 1 << 9 ); +const THtCapabilities KPco = ( 1 << 10 ); +const THtCapabilities KHtcField = ( 1 << 11 ); +const THtCapabilities KReverseDirectionResp = ( 1 << 12 ); + +const TFilterMode KFilteringDisabled = 0; +const TFilterMode KFilterIn = 1; +const TFilterMode KFilterOut = 2; + +typedef TIpv4Address TIpV4Addr; /** deprecated */ + +const TIpv4Address KZeroIpV4Addr = 0x00000000; + +/** +* rate definition masks +*/ +const TRate KRate1Mbits = 0x00000001; +const TRate KRate2Mbits = 0x00000002; +const TRate KRate5_5Mbits = 0x00000004; +const TRate KRate6Mbits = 0x00000008; +const TRate KRate9Mbits = 0x00000010; +const TRate KRate11Mbits = 0x00000020; +const TRate KRate12Mbits = 0x00000040; +const TRate KRate18Mbits = 0x00000080; +const TRate KRate22Mbits = 0x00000100; +const TRate KRate24Mbits = 0x00000200; +const TRate KRate33Mbits = 0x00000400; +const TRate KRate36Mbits = 0x00000800; +const TRate KRate48Mbits = 0x00001000; +const TRate KRate54Mbits = 0x00002000; + +const TRate KDot11gRates = + KRate1Mbits | KRate2Mbits | KRate5_5Mbits | KRate6Mbits | KRate9Mbits | + KRate11Mbits | KRate12Mbits | KRate18Mbits | KRate22Mbits | KRate24Mbits | + KRate33Mbits | KRate36Mbits | KRate48Mbits | KRate54Mbits; + +const TRate KDot11bRates = + KRate1Mbits | KRate2Mbits | KRate5_5Mbits | KRate11Mbits; + +const TRate KMaxDot11bRate = KRate11Mbits; + +/** +* bitmasks for ReceivePacket aFlags member +*/ +const TUint32 KEncryptNone = 0; +const TUint32 KEncryptWapi = (1 << 15); +const TUint32 KEncryptWep = (1 << 16); +const TUint32 KEncryptTkip = (1 << 17); +const TUint32 KEncryptAes = (3 << 16); +const TUint32 KMoreFrames = (1 << 18); +const TUint32 KDuringMeasure = (1 << 19); /** deprecated */ +const TUint32 KHtPacket = (1 << 20); +const TUint32 KPartOfAmpdu = (1 << 21); +const TUint32 KStbc = (1 << 22); + +struct STxPowerRange + { + TPowerLevel iMinPowerLevel; + TPowerLevel iMaxPowerLevel; + TUint32 iStepping; + }; + +struct SHtCapabilities + { + THtCapabilities iHTCapabilitiesBitMask; + TUint16 iRxMaxDataRate; + THtChannelWidth iChannelWidth; + THtRxStbc iRxStbc; + THtMaxAmsdu iMaxAmsdu; + THtMaxAmpdu iMaxAmpdu; + THtAmpduSpacing iAmpduSpacing; + THtMcsSet iRxMcs; + THtMcsSet iTxMcs; + THtPcoTransTime iPcoTransTime; + THtMcsFeedback iMcsFeedback; + }; + +struct SSettings + { + static const TUint KNumOfBandsSupported = 3; + + TUint8 iNumOfSSIDs; + TUint8 iRxBufAlignment; /** deprecated */ + TUint16 iNumOfBytesForSsid; + TRate iRates; + TBand iBand; + TUint8 iRxoffset; + TUint8 iNumOfGroupTableEntrys; + TUint8 iNumOfTxRateClasses; + TUint8 iTxFrameTrailerSpace; + TUint8 iTxFrameHeaderSpace; + TUint16 iFlagsMask; /** deprecated */ + STxPowerRange iTxPowerRange[KNumOfBandsSupported]; + + enum { KMaxReceiveLifeTime = ( 1 << 0 ) }; + enum { KIbssPsConfig = ( 1 << 1 ) }; /** deprecated */ + enum { KTruncate = ( 1 << 2 ) }; + enum { KPreambleOverride = ( 1 << 3 ) }; + enum { KPowerLevelParam = ( 1 << 4 ) }; + enum { KExpiryTimeParam = ( 1 << 5 ) }; + enum { KProbe4Join = ( 1 << 6 ) }; + enum { KMaxLifeTime = ( 1 << 7 ) }; + enum { KTxNoAckPolicy = ( 1 << 8 ) }; + enum { KBlockAckPolicy = ( 1 << 9 ) }; /** deprecated */ + enum { KDot11SlotTime = ( 1 << 10 ) }; + enum { KWmmSa = ( 1 << 11 ) }; /** deprecated */ + enum { KSapsd = ( 1 << 12 ) }; /** deprecated */ + enum { KRadioMeasurements = ( 1 << 13 ) }; /** deprecated */ + enum { KLegacyPsPoll = ( 1 << 14 ) }; /** deprecated */ + enum { KWep16ByteKey = ( 1 << 15 ) }; /** deprecated */ + enum { KMoreDataAck = ( 1 << 16 ) }; + enum { KScanChannelTimes = ( 1 << 17 ) }; + enum { KAutonomousRateAdapt = ( 1 << 18 ) }; + enum { KNoSecHdrAndTrailer = ( 1 << 19 ) }; + enum { KHtOperation = ( 1 << 20 ) }; + enum { KWapi = ( 1 << 21 ) }; + enum { KDsParamSetIeInProbe = ( 1 << 22 ) }; + enum { KEtherTypeFilter = ( 1 << 23 ) }; + enum { KBroadcastUdpFilter = ( 1 << 24 ) }; + enum { KMultipleRxBuffers = ( 1 << 25 ) }; + + TUint32 iCapability; + SHtCapabilities iHtCapabilities; + }; + +struct SConfigureDataBase + { + // currently this is the only one defined + TUint32 iDot11MaxTransmitMsduLifeTime; + }; + +// frequencies for 2.4 GHz band in units of KHz +const TUint32 K2dot4ChannelFrequencies[] = + { + 2412000, // Channel 1 + 2417000, // Channel 2 + 2422000, // Channel 3 + 2427000, // Channel 4 + 2432000, // Channel 5 + 2437000, // Channel 6 + 2442000, // Channel 7 + 2447000, // Channel 8 + 2452000, // Channel 9 + 2457000, // Channel 10 + 2462000, // Channel 11 + 2467000, // Channel 12 + 2472000, // Channel 13 + 2484000 // Channel 14 + }; + +struct SChannelLoadParams /** deprecated */ + { + }; + +struct SNoiseHistogramParams /** deprecated */ + { + }; + +struct SBeaconParams /** deprecated */ + { + enum { KPassive = 0 }; + enum { KPassivePilot = 1 }; + enum { KActive = 2 }; + enum { KStaSelected = 3 }; + enum { KBeaconTable = 4 }; + + TUint32 iScanMode; + }; + +union UMeasurementSpecific /** deprecated */ + { + SBeaconParams iBeaconParams; + SChannelLoadParams iChannelLoadParams; + SNoiseHistogramParams iNoiseHistogramParams; + }; + +struct SParameterSet /** deprecated */ + { + enum { KMeasTypeBasic = 0 }; + enum { KMeasTypeChannelLoad = 1 }; + enum { KMeasTypeNoiseHistogram = 2 }; + enum { KMeasTypeBeacon = 3 }; + enum { KMeasTypeFrame = 4 }; + + TUint32 iType; + TUint32 iDuration; + TUint32 iReserved; + UMeasurementSpecific iMeasurementSpecific; + }; + +struct SChannels + { + TChannelNumber iChannel; + TUint32 iMinChannelTime; + TUint32 iMaxChannelTime; + TPowerLevel iTxPowerLevel; + }; + +struct SSSID + { + enum { KMaxSSIDLength = 32 }; + + TUint32 iSSIDLength; + TUint8 iSSID[KMaxSSIDLength]; + }; + +enum TScanType + { + EFgScan, + EBgScan, + EForcedBgScan + }; + +enum TOperationMode + { + EIBSS, + EBSS + }; + +#pragma pack(1) +struct TMacAddress + { + enum { KMacAddressLength = 6 }; + + /** the MAC address */ + TUint8 iMacAddress[KMacAddressLength]; + }; // 6 bytes +#pragma pack() + +/** +* Broadcast MAC Address. +*/ +const TMacAddress KBroadcastMacAddr = + { + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +/** +* MAC address that is all zeros +*/ +const TMacAddress KZeroMacAddr = + { + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }; + +struct SWepPairwiseKey + { + enum { KHeaderSize = sizeof( TMacAddress ) + ( 2 * sizeof( TUint8 ) ) }; + + TMacAddress iMacAddr; + TUint8 iReserved; + TUint8 iKeyLengthInBytes; + TUint8 iKey[1]; + }; + +struct SWepGroupKey + { + enum { KHeaderSize = sizeof( TPrivacyKeyId ) + ( 3 * sizeof( TUint8 ) ) }; + + TPrivacyKeyId iKeyId; + TUint8 iKeyLengthInBytes; + TUint8 iReserved[2]; + TUint8 iKey[1]; + }; + +/** +* Length of TKIP key in bytes; +*/ +const TUint32 KTKIPKeyLength = 16; +/** +* Length of MIC in BYTEs +*/ +const TUint32 KMicLength = 8; + +struct STkipPairwiseKey + { + TMacAddress iMacAddr; + TUint8 iReserved[2]; + TUint8 iTkipKey[KTKIPKeyLength]; + TUint8 iRxMicKey[KMicLength]; + TUint8 iTxMicKey[KMicLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved2[3]; + }; + +/** +* Length of receive sequence counter in bytes +*/ +const TUint32 KRxSequenceCounterLength = 8; + +struct STkipGroupKey + { + TUint8 iTkipKey[KTKIPKeyLength]; + TUint8 iRxMicKey[KMicLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved[3]; + TUint8 iRxSequenceCounter[KRxSequenceCounterLength]; + }; + +/** +* Length of AES key in bytes; +*/ +const TUint32 KAesKeyLength = 16; + +struct SAesPairwiseKey + { + TMacAddress iMacAddr; + TUint8 iReserved[2]; + TUint8 iAesKey[KAesKeyLength]; + }; + +struct SAesGroupKey + { + TUint8 iAesKey[KAesKeyLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved[3]; + TUint8 iRxSequenceCounter[KRxSequenceCounterLength]; + }; + +/** +* Length of WAPI encryption key in bytes; +*/ +const TUint32 KWapiKeyLength = 16; +/** +* Length of WAPI MIC key in bytes +*/ +const TUint32 KWapiMicKeyLength = 16; + +struct SWapiPairwiseKey + { + TMacAddress iMacAddr; + TPrivacyKeyId iKeyId; + TUint8 iReserved[1]; + TUint8 iWapiKey[KWapiKeyLength]; + TUint8 iMicKey[KWapiMicKeyLength]; + }; + +struct SWapiGroupKey + { + TUint8 iWapiKey[KWapiKeyLength]; + TUint8 iMicKey[KWapiMicKeyLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved[3]; + }; + +enum TPreamble + { + ELongPreamble, + EShortPreamble + }; + +const TPsMode KPsDisable = 0; +const TPsMode KPsEnable = 1; + + +enum TParameterSet + { + EParameterSetPlaceHolder + }; + +enum TKeyType + { + EWepGroupKey, + EWepPairWiseKey, + ETkipGroupKey, + ETkipPairWiseKey, + EAesGroupKey, + EAesPairWiseKey, + EWapiGroupKey, + EWapiPairWiseKey, + EKeyNone // defined as an empty type + }; + +enum TPsScheme + { + ERegularPs, + EUapsd, + ELegacyPs, /** deprecated */ + ESapsd /** deprecated */ + }; + +struct SSAPSDConfig /** deprecated */ + { + TUint32 iServiceStartTime; // Lower order of TSF + TUint32 iServiceInterval; // In microseconds + }; + +enum TAckPolicy + { + ENormal, + ENoaAck, + EBlockAck /** deprecated */ + }; + +const TStatus KSuccess = 0; +const TStatus KFailed = 1; +const TStatus KDecryptFailure = 2; +const TStatus KMicFailure = 3; +const TStatus KSuccessXfer = 4; +const TStatus KPending = 5; +const TStatus KQueueFull = 6; +const TStatus KErrorRetryExceeded = 7; +const TStatus KErrorLifetimeExceeded = 8; +const TStatus KErrorNoLink = 9; +const TStatus KErrorMacNotResponding = 10; +const TStatus KSuccessQueueFull = 11; + + +enum TCommandId + { + EInitializeResponse, + EConfigureResponse, + EReleaseResponse, + EPLtResponse, + EResetResponse, + EMeasureCommandResponse, /** deprecated */ + EStopMeasureResponse, /** deprecated */ + EScanCommandResponse, + EStopScanResponse, + EJoinResponse, + ESetPsModeCommandResponse, + ESetBssParametersResponse, + EReadMIBResponse, + EWriteMIBResponse, + EAddKeyResponse, + ERemoveKeyResponse, + EConfigureQueueResponse, + EConfigureACResponse, + }; + +enum TCompleteCommandId + { + EMeasureComplete, /** deprecated */ + EScanComplete, + ESetPsModeComplete + }; + +struct SJoinResponse + { + TPowerLevel iMinPowerLevel; + TPowerLevel iMaxPowerLevel; + }; + +struct SReadMibResponse + { + TMib iMib; + TUint16 iLength; + const void* iData; + }; + +union UCommandResponseParams + { + SJoinResponse iJoinResponse; + SReadMibResponse iReadMibResponse; + }; + +struct SChannelLoadResult /** deprecated */ + { + TUint32 iCCABusyFraction; + }; + +struct SNoiseHistogramResult /** deprecated */ + { + enum { KResultSize = 8 }; + + TUint8 iRPIDensity[KResultSize]; + }; + +struct SFrameReport /** deprecated */ + { + TMacAddress iTransmitAddress; + TUint8 iReserved1[2]; + TMacAddress iBssId; + TUint8 iReserved2[2]; + TPowerLevel iRxSignalPower; + TUint32 iNumOfFrames; + }; + +struct SFrameResultReport /** deprecated */ + { + TUint32 iNumberOfResults; + SFrameReport iFrameReport[1]; + }; + +union UMeasurementSpecificResult /** deprecated */ + { + SChannelLoadResult iChannelLoadResult; + SNoiseHistogramResult iNoiseHistogramResult; + SFrameResultReport iFrameResultReport; + }; + +struct SResultSet /** deprecated */ + { + TUint32 iType; + TStatus iStatus; + + UMeasurementSpecificResult iMeasurementSpecificResult; + }; + +struct SMeasureComplete /** deprecated */ + { + TPsMode iDot11PowerManagementMode; + TUint8 iNumberOfMeasurementTypes; + TUint8 iReserved[2]; + SResultSet iResultSet[1]; + }; + +struct SScanComplete + { + TPsMode iDot11PowerManagementMode; + TUint8 iReserved[3]; + }; + +struct SSetPsModeComplete + { + TPsMode iDot11PowerManagementMode; + TUint8 iReserved[3]; + }; + +union UCommandCompletionParams + { + SMeasureComplete iMeasureComplete; + SScanComplete iScanComplete; + SSetPsModeComplete iSetPsModeComplete; + }; + +enum TIndicationId + { + EError, + EBssLost, + EBSSRegained, + ERadar, /** deprecated */ + ERcpi, + EPsModeError + }; + +struct SError + { + TStatus iStatus; + }; + +enum TMicKeyType + { + EPairWise, + EGroup + }; + +struct SRcpi + { + TRcpi iRcpi; + TUint8 iReserved[3]; + }; + +union UIndicationParams + { + SError iError; + SRcpi iRcpi; + }; + +NAMESPACE_END_WHA + +#endif // WHA_TYPES_H + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/whanamespace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/whanamespace.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* Defines the WHA namespace +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef WHANAMESPACE_H +#define WHANAMESPACE_H + +#define WHA WlanHalApi +#define NAMESPACE_BEGIN_WHA namespace WlanHalApi { +#define NAMESPACE_END_WHA } + +#endif // WHANAMESPACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wlanpddiface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wlanpddiface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface used by WLAN LDD for +* attaching and extracting interfaces +* and for getting WLAN PDD capabilities +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANPDDIFACE_H +#define WLANPDDIFACE_H + +#include +#include + +class MWlanOsa; +class MWlanOsaExt; + +/** + * Interface used by WLAN LDD for attaching and extracting interfaces + * and for getting WLAN PDD capabilities. + * + * @since S60 v5.0 + */ +class MWlanPddIface : public DBase + { + +public: + + typedef TUint32 TCapab; + + struct SCapabilities + { + static const TCapab KCachedMemory = ( 1 << 0 ); + + /** Capabilities bitmap */ + TCapab iCapabilities; + /** + * Host processor's cache line length. + * Relevant only when iCapabilities includes KCachedMemory + */ + TInt iCacheLineLength; + }; + +public: + + /** + * Destructor. + * + * @since S60 v5.0 + */ + virtual ~MWlanPddIface() {}; + + /** + * Attach osa and osa extension interface + * + * @since S60 v5.0 + * @param aWlanOsa osa interface object + * @param aWlanOsaExt osa extension interface object + * @return ETrue for success any other for failure + */ + virtual TBool Attach( MWlanOsa& aWlanOsa, MWlanOsaExt& aWlanOsaExt ) = 0; + + /** + * Extract wha interface + * + * @since S60 v5.0 + * @return wha interface object + */ + virtual WHA::Wha& Extract() = 0; + + /** + * Gets lower layer capabilities. + * + * Overriding method allocates dynamically an SCapabilities structure + * providing information about the capabilities of the lower layer. + * It is the caller's responsibility to deallocate the structure. + * Note! This method has a default implementation returning just a + * NULL pointer in order to maintain backwards sw compatibility with + * a WLAN PDD which doesn't implement (i.e. override) this method. + * @since S60 v5.0 + * @param aCapabilities Pointer to capabilities structure + */ + virtual void GetCapabilities( SCapabilities*& aCapabilities ) + { + aCapabilities = NULL; + }; + }; + + +#endif // WLANPDDIFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wlanwha.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wlanwha.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,618 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WHA_H +#define WHA_H + +#include +#include + +class MWlanOsa; +class WlanHpa; +class WlanSpia; + +struct SHwBusAccessLayer; + +NAMESPACE_BEGIN_WHA + +struct SConfigureData; + +/** + * Defines the WHA callback interface + * + * @since S60 3.1 + */ +class MWhaCb + { + +public: // Methods + + virtual ~MWhaCb() {}; + + /** + * The WLAN PDD uses this method to give a command response event to the + * WLAN LDD. + * + * @since S60 3.1 + * @param aCommandId Event identifier. + * @param aStatus Status code. + * @param aCommandResponseParams Event specific data structure. + */ + virtual void CommandResponse( + TCommandId aCommandId, + TStatus aStatus, + const UCommandResponseParams& aCommandResponseParams ) = 0; + + /** + * The WLAN PDD uses this method to give a command completion event to the + * WLAN LDD. + * + * @since S60 3.1 + * @param aCompleteCommandId Event identifier. + * @param aStatus Status code. + * @param aCommandCompletionParams Event specific data structure. + */ + virtual void CommandComplete( + TCompleteCommandId aCompleteCommandId, + TStatus aStatus, + const UCommandCompletionParams& aCommandCompletionParams ) = 0; + + /** + * The WLAN PDD uses this method to indicate a spontaneous event to the + * WLAN LDD. + * + * @since S60 3.1 + * @param aIndicationId Event identifier. + * @param aIndicationParams Event specific data structure. + */ + virtual void Indication( + TIndicationId aIndicationId, + const UIndicationParams& aIndicationParams ) = 0; + + /** + * The WLAN PDD calls this method when it has transferred a packet to the + * WLAN device. + * + * @since S60 3.1 + * @param aPacketId The ID that the WLAN LDD gave for the packet in the + * SendPacket call. + */ + virtual void SendPacketTransfer( + TPacketId aPacketId ) = 0; + + /** + * The WLAN PDD calls method when the WLAN device has processed a packet + * from its send queue. + * + * @since S60 3.1 + * @param aStatus The result of the packet sending: + * KSuccess: The packet sending was successful. + * KErrorRetryExceeded: Packet sending failed because of exceeding + * dot11ShortRetryLimit or dot11LongRetryLimit. + * KErrorLifetimeExceeded: Packet sending failed because of exceeding + * dot11MaxTransmitMsduLifeTime. + * KErrorNoLink: Packet sending failed because of the loss of the + * network link. The WLAN flushed the packet from the queue before + * making a single transmit attempt for it. + * @param aPacketId The ID that the WLAN LDD gave for the packet in the + * SendPacket call. + * @param aRate The data rate or MCS at which the packet sending succeeded. + * (this parameter is only valid if aStatus is KSuccess.) + * If the transmission was a non-HT transmission, then this parameter + * contains the data rate in bit map format. + * If the transmission was an HT transmission, then this parameter + * contains the numeric value of the MCS. + * @param aPacketQueueDelay The time the packet spent in the WLAN device + * transmit queue before the WLAN device started transmission. + * The time is calculated from the point the WLAN device gets the + * packet from the host to the point the packet is ready for + * transmission. + * This parameter is only valid if aStatus is KSuccess. + * This value is zero if the WLAN device does not support the + * calculation. + * Unit: microseconds. + * @param aMediaDelay The total time the packet spent in the WLAN device + * before transmission was completed. + * The time is calculated from the point the WLAN device gets the + * packet from the host to the point it gets an acknowledgement for + * the packet from the peer. + * This parameter is only valid if aStatus is KSuccess. + * This value is zero if the WLAN device does not support the + * calculation. + * Unit: microseconds. + * @param aAckFailures The number of times the WLAN device transmitted the + * packet without receiving an acknowledgement. + * @param The sequence number the WLAN device used when it transmitted the + * frame. + */ + virtual void SendPacketComplete( + TStatus aStatus, + TPacketId aPacketId, + TRate aRate, + TUint32 aPacketQueueDelay, + TUint32 aMediaDelay, + TUint8 aAckFailures, + TUint16 aSequenceNumber = 0 ) = 0; + + /** + * The WLAN PDD calls this method to request a memory buffer for packet + * reception. + * + * @since S60 3.1 + * @param aLength The length of the requested buffer in bytes. + * The upper limit for the length is the maximum length of + * an 802.11n A-MSDU. + * @return The method allocates a buffer whose length is aLength + Rx + * offset bytes and returns a pointer to the beginning of the buffer. + * If the allocation fails, the method returns a NULL pointer and the + * WLAN PDD should discard the received packet. + */ + virtual TAny* RequestForBuffer ( TUint16 aLength ) = 0; + + /** + * The WLAN PDD uses this method to deliver a received packet. + * + * @since S60 3.1 + * @param aStatus The result of the of the packet reception: + * KSuccess: The packet reception was successful. + * KDecryptFailure: The packet reception failed because of a + * decryption error. + * KMicFailure: The packet reception failed because of a MIC failure. + * KFailed: The packet reception failed because of some other reason. + * @param aFrame A pointer to the beginning of the packet content (the first + * byte of the MSDU or A-MSDU) + * If aStatus indicates a failure (KDecryptFailure, KMicFailure, + * KFailed ), the packet should contain only the MAC header (i.e., + * the frame body is omitted). + * @param aLength The length of the packet. Measured from the first byte of + * the MAC header to the last byte of the frame body. + * @param aRate The data rate or MCS at which the frame was received + * If the packet was received as a non-HT transmission, then this + * parameter contains the data rate in bit map format. + * If the packet was received as an HT transmission, then this + * parameter contains the numeric value of the MCS. + * @param aRCPI RCPI value of the received packet. + * @param aChannel The channel on which the packet was received. + * @param aBuffer A pointer to the beginning of the allocated memory buffer + * (i.e., the pointer that the WLAN PDD got with RequestForBuffer). + * This parameter is only used when operating in "multi buffer mode". + * In single buffer mode, the WLAN PDD should set it to NULL. + * @param aFlags Bit field providing status information of the received + * frame. + */ + virtual void ReceivePacket( + TStatus aStatus, + const void* aFrame, + TUint16 aLength, + TRate aRate, + TRcpi aRCPI, + TChannelNumber aChannel, + void* aBuffer, + TUint32 aFlags ) = 0; + }; + + +/** + * Defines the WHA interface + * + * @since S60 3.1 + */ +class Wha + { + +public: // constants + + enum { KNumOfEdcaQueues = 4 }; + +public: // Methods + + virtual ~Wha() {}; + + /** + * WHA callback attachment method + * + * @since S60 3.1 + * @param aWhaCb + */ + inline void Attach( MWhaCb& aWhaCb ); + + static Wha* Create( MWlanOsa& aOsa, + WlanHpa& aHpa, + const SHwBusAccessLayer& aTransPortLayer ); + + static void Destroy( Wha* aWha ); + + /** + * This method downloads the firmware to the WLAN device and performs the + * low level initialization of the device. + * + * @since S60 3.1 + * @param aData Firmware data. The content is vendor-specific. + * The memory behind the pointer is valid to the point when the WLAN + * PDD sends the corresponding command response event. + * @param aLength The length of the data in bytes placed in the parameter + * aData. + */ + virtual void Initialize( + const void* aData, + TUint32 aLength ) = 0; + + /** + * The WLAN LDD calls this method to configure the WLAN device. + * + * @since S60 3.1 + * @param aData Configuration data. The content is vendor-specific. + * The memory behind the reference is valid to the point when the + * WLAN PDD sends the corresponding command response event. + * @param aSettings Output data that holds the capabilities of the + * WLAN device. + */ + virtual void Configure( + const SConfigureData& aData, + SSettings& aSettings ) = 0; + + /** + * WLAN LDD calls this method to prepare the WLAN PDD for unloading. + * + * @since S60 3.1 + * @param aSynchronous Should the command be executed synchronously (ETrue) + * or not (EFalse). + * @return KSuccess: The command was executed synchronously and no command + * response event is sent. + * KPending: The command is executed asynchronously and the + * corresponding command response event is sent upon command + * completion. + */ + virtual TStatus Release( TBool aSynchronous ) = 0; + + /** + * The WLAN LDD uses this method to command the WLAN device to start + * scanning the available networks. + * + * @since S60 3.1 + * @param aMaxTransmitRate The transmission rate of the probe requests + * Note: Just a single rate is selected as rate fallback is + * not to be used during the scan process. + * @param aBand The used frequency band. + * Only one band is scanned at a time and one bit is used to select + * the band to be scanned. + * @param aNumOfChannels The number of channels provided in the array + * (aChannels). + * @param aChannels A structure that specifies the scanned channels. + * @param aScanType The scan type: + * EFgScan: foreground scan. + * EBgScan: background scan. + * EForcedBgScan: forced background scan. + * @param aNumOfProbeRequests The number of probe requests (per SSID) to be + * sent to each channel. + * Value 0 means the device does not send any probe requests and the + * scan is a passive scan. + * @param aSplitScan ETrue - use split scan. + * EFalse - do not use split scan. + * @param aNumOfSSID The number of SSIDs in the SSID array (aSSID). + * Value 0 means that the array is empty and this is a broadcast + * scan. In a broadcast scan, the WLAN device puts an empty SSID in + * the probe requests. + * Value greater than 0 means that this is a directed scan. The WLAN + * device puts the SSIDs in the array to the probe requests. + * @param aSsid An array of the SSID to be scanned in a directed scan. + */ + virtual void Scan( + TRate aMaxTransmitRate, + TBand aBand, + TUint8 aNumOfChannels, + const SChannels* aChannels, + TScanType aScanType, + TUint8 aNumOfProbeRequests, + TBool aSplitScan, + TUint8 aNumOfSSID, + const SSSID* aSsid ) = 0; + + /** + * The WLAN LDD uses this method to stop an ongoing scan process. + * + * @since S60 3.1 + */ + virtual void StopScan() = 0; + + /** + * The WLAN LDD uses this method to command the WLAN device to join a BSS + * or IBSS or to start an IBSS. + * + * @since S60 3.1 + * @param aMode The operation mode of the network: + * EIBSS: IBSS mode + * EBSS: BSS mode + * @param aBSSID The BSSID of network. + * @param aSSID The SSID of the network. + * @param aBand The used frequency band. Only one bit is used to + * select the band. + * @param aChannel The channel number of the network. + * @param aBeaconInterval The time between TBTTs in TUs. + * @param aBasicRateSet The BSS basic rate set. + * @param aAtimWindow The ATIM window of the IBSS. + * Note: When the ATIM window is zero, the initiated IBSS does not + * support power save. + * @param aPreambleType The preamble type. + * Note: 1 and 2 Mbit/s transmissions always use a long preamble + * regardless of this setting. + * @param aProbeForJoin Specifies if the device should send a Probe request + * with the specified SSID when joining the network. + * [Optional] + */ + virtual void Join( + TOperationMode aMode, + const TMacAddress& aBSSID, + const SSSID& aSSID, + TBand aBand, + TChannelNumber aChannel, + TUint32 aBeaconInterval, + TRate aBasicRateSet, + TUint16 aAtimWindow, + TPreamble aPreambleType, + TBool aProbeForJoin ) = 0; + + + /** + * The WLAN LDD uses this command to reset the WLAN device and the WLAN PDD + * to their initial states (the state after the Initialize and Configure + * commands). + * + * @since S60 3.1 + */ + virtual void Reset() = 0; + + /** + * The WLAN LDD uses this method to change the WLAN device’s 802.11 power + * management mode. + * + * @since S60 3.1 + * @param aPsMode The 802.11 power management mode the WLAN device should + * enter. + */ + virtual void SetPsMode( TPsMode aPsMode ) = 0; + + /** + * The WLAN LDD uses this method to fix connection parameters after the + * initial connection setup (after the association response in the + * infrastructure mode). + * + * @since S60 3.1 + * @param aDTIM Specifies the DTIM interval in multiples of beacons. + * @param aAID Specifies the AID received during the association process. + */ + virtual void SetBssParameters( + TUint8 aDTIM, + TUint16 aAID ) = 0; + + /** deprecated */ + virtual void Measure( + TPowerLevel /*aTxPowerLevel*/, + TBand /*aBand*/, + TChannelNumber /*aChannel*/, + TUint8 /*aActivationDelay*/, + TUint8 /*aMeasurementOffset*/, + TUint8 /*aNumberOfMeasurementTypes*/, + const SParameterSet* /*aParameterSet*/ ) {}; + + /** deprecated */ + virtual void StopMeasure() {}; + + /** + * The WLAN LDD uses this method to read configuration information and + * statistics from the WLAN device. + * + * @since S60 3.1 + * @param aMib The ID of the MIB to be accessed. + */ + virtual void ReadMib( TMib aMib ) = 0; + + /** + * The WLAN LDD uses this method to write configuration information to the + * WLAN device. + * + * @since S60 3.1 + * @param aMib The ID of the MIB to be written. + * @param aLength The length of the MIB. + * @param aData A pointer to the structure specifying the MIB data according + * to the MIB ID. + * @param aMore This flag is set to ETrue if the WLAN host driver is about + * to write more MIBs after this call. + * @return KSuccess: The command was executed synchronously and no command + * response event is sent. + * KPending: The command is executed asynchronously and the + * corresponding command response event is sent upon command + * completion. + */ + virtual TStatus WriteMib( + TMib aMib, + TUint16 aLength, + const void* aData, + TBool aMore ) = 0; + + /** + * This method adds a new (or replaces an old) encryption key to the WLAN + * device. + * + * @since S60 3.1 + * @param aType The type of the key to be added: + * EWepGroupKey – WEP group key + * EWepPairWiseKey – WEP pairwise key + * ETkipGroupKey – TKIP group key + * ETkipPairWiseKey – TKIP pairwise key + * EAesGroupKey – AES group key + * EAesPairWiseKey – AES pairwise ket + * EWapiGroupKey – WAPI group key + * EWapiPairWiseKey – WAPI pairwise key + * @param aKey A pointer to the structure containing the key material. + * @param aEntryIndex The key entry index of the key to be added. + */ + virtual void AddKey( + TKeyType aType, + const void* aKey, + TUint8 aEntryIndex ) = 0; + + /** + * This method removes encryption keys from the active key set. + * + * @since S60 3.1 + * @param aEntryIndex The index of the key to remove from the set. + */ + virtual void RemoveKey( TUint8 aEntryIndex ) = 0; + + /** + * The WLAN LDD uses this method to configure QoS parameters of + * transmission queues. + * + * @since S60 3.1 + * @param aQueueId The ID for the queue. + * @param aMaxLifeTime The time (in TUs) how long the MSDU can stay in the + * transmit queue. If the timer expires before the MSDU is successfully + * transmitted, the WLAN device shall discard the packet. [Optional] + * @param aPsScheme The PS mode of the queue: + * ERegularPs - Regular PS mode. The queue is not trigger enabled. + * EUapsd - U-APSD mode. The queue is trigger enabled. + * @param aAckPolicy The ACK frame policy of the specified queue: + * ENormal - Normal ack. + * ENoaAck - No ack. + * @param aMediumTime The amount of time the queue is allowed to access the + * WLAN air interface during one second interval. + * The unit of the parameter is 32 microseconds. Value 0 + * means that the medium time is unlimited. + */ + virtual void ConfigureQueue( + TQueueId aQueueId, + TUint32 aMaxLifeTime, + TPsScheme aPsScheme, + const SSAPSDConfig& aSAPSDConfig, /** deprecated */ + TAckPolicy aAckPolicy, + TUint16 aMediumTime ) = 0; + + /** + * The WLAN LDD uses this method to configure EDCA access category + * parameters. + * + * @since S60 3.1 + * @param aCwMin CWmin (in slots) for the access class. + * @param aCwMax CWmax (in slots) for the access class. + * @param aAIFS AIFS value (in slots) for the access class. + * @param aTxOplimit Tx Op Limit (in microseconds) for the access class. + * @param aMaxReceiveLifeTime The maximum receive lifetime for the access + * class. [Optional] + */ + virtual void ConfigureAC( + TUint16 aCwMin[KNumOfEdcaQueues], + TUint16 aCwMax[KNumOfEdcaQueues], + TUint8 aAIFS[KNumOfEdcaQueues], + TUint16 aTxOplimit[KNumOfEdcaQueues], + TUint16 aMaxReceiveLifeTime[KNumOfEdcaQueues] ) = 0; + + /** + * The WLAN LDD uses this method to send packets. + * + * @since S60 3.1 + * @param aFrame A pointer to the beginning of the packet content (the first + * byte of the MSDU or A-MSDU). + * @param aLength The length of the packet. + * Measured from the first byte of the MAC header to the last + * byte of the frame body. + * @param aQueueId The transmit queue. + * @param aTxRateClassId The index of the rate policy for this transmission. + * If the WLAN device supports autonomous rate adaptation, the index + * refers to the txAutoRatePolicy MIB. + * If the WLAN device does not support autonomous rate adaptation, + * the index refers to the txRatePolicy MIB. + * In both cases, the value 1 refers to the first policy. + * @param aMaxTransmitRate The highest transmission rate to be used for this + * packet. + * This parameter is valid only when non-autonomous rate adaptation + * (txRatePolicy) is used. + * @param aMore Informs the WLAN PDD if an another packet is pending for + * transmission in the WLAN LDD: + * EFalse: No, this is it for the time being. + * ETrue: Yes, another packet is pending for transmission. + * @param aPacketId The packet identifier. + * @param aPowerLevel The transmission power level. Unit: dBm. [Optional] + * @param aExpiryTime The time (in TUs) how long the MSDU can stay in the + * transmit queue. [Optional] + * @param aReserved Reserved field. + * @return KSuccess: The WLAN PDD has buffered the packet for transfer to + * the WLAN device. + * The WLAN LDD can call SendPacket again to send a new packet. + * KSuccessXfer: The WLAN PDD has transferred the packet and all + * the previously buffered packets to the WLAN device. + * KPending: The WLAN PDD has buffered the packet for transfer to + * the WLAN device. + * The WLAN LDD can not call SendPacket until the WLAN PDD calls + * SendPacketTransfer. + * KQueueFull: The WLAN PDD has discarded the packet because the + * corresponding queue in the WLAN device is full. + * KSuccessQueueFull: The WLAN PDD has buffered the packet for + * transfer to the WLAN device. However, the corresponding queue + * in the WLAN device is now full. + */ + virtual TStatus SendPacket( + const void* aFrame, + TUint16 aLength, + TQueueId aQueueId, + TUint8 aTxRateClassId, + TRate aMaxTransmitRate, + TBool aMore, + TPacketId aPacketId, + TPowerLevel aPowerLevel, + TUint32 aExpiryTime, + void* aReserved ) = 0; + + /** + * The WLAN LDD calls this method to perform production line testing of the + * WLAN device. + * + * @since S60 5.0 + * @param aType A parameter indicating which test to perform. + * @param aParams Test specific parameters. + * An in/out parameter. + */ + virtual void Plt( TPltType aType, void* aParams ) = 0; + +protected: // methods + + Wha( MWlanOsa& aOsa, WlanHpa& aHpa, WlanSpia& aSpia ) + : iWhaCb( NULL ), iOsa( aOsa ), iHpa( aHpa ), iSpia( aSpia ) {}; + + inline MWhaCb& WhaCb(); + inline WlanHpa& Hpa(); + inline MWlanOsa& OsaCb(); + inline WlanSpia& Spia(); + +protected: // data + + MWhaCb* iWhaCb; + + MWlanOsa& iOsa; + WlanHpa& iHpa; + WlanSpia& iSpia; + }; + +#include + +NAMESPACE_END_WHA + +#endif // WHA_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wlanwha.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wlanwha.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 4 % +*/ + +inline void Wha::Attach( MWhaCb& aWhaCb ) + { + iWhaCb = &aWhaCb; + } + +inline MWhaCb& Wha::WhaCb() + { + return *iWhaCb; + } + +inline WlanHpa& Wha::Hpa() + { + return iHpa; + } + +inline MWlanOsa& Wha::OsaCb() + { + return iOsa; + } + +inline WlanSpia& Wha::Spia() + { + return iSpia; + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wlanwha_mib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wlanwha_mib.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,299 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 8 % +*/ + +#ifndef WHA_MIB_H +#define WHA_MIB_H + +#include +#include + +NAMESPACE_BEGIN_WHA + +struct Sdot11StationId + { + TMacAddress iAddr; + TUint8 iReserved[2]; + }; + +struct Sdot11MaxReceiveLifeTime + { + TUint32 iDot11MaxReceiveLifeTime; + }; + +struct Sdot11SlotTime + { + TUint32 iDot11SlotTime; + }; + +struct Sdot11GroupAddressesTable + { + enum { KHeaderSize = sizeof( TBool ) + sizeof( TUint32 ) }; + + TBool iEnable; + TUint32 iNumOfAddrs; + TMacAddress iAddrData[1]; // addresses start here + }; + +struct Sdot11WepDefaultKeyId + { + TPrivacyKeyId iDot11WepDefaultKeyId; + TUint8 iReserved[3]; + }; + +struct Sdot11CurrentTxPowerLevel + { + TPowerLevel iDot11CurrentTxPowerLevel; + }; + +struct Sdot11RTSThreshold + { + TUint32 iDot11RTSThreshold; + }; + +struct SctsToSelf + { + TBool iCtsToSelf; + }; + +struct SarpIpAddressTable + { + TBool iEnable; + TIpv4Address iIpV4Addr; + }; + +struct StemplateFrame + { + enum { KHeaderSize = sizeof( TTemplateType ) + sizeof( TRate ) + sizeof( TUint32 ) }; + + TTemplateType iFrameType; + TRate iInitialTransmitRate; + TUint32 iLength; + TUint8 iTemplateData[1]; // the template data starts here + }; + +struct SrxFilter + { + enum { KPromiscous = (1 << 0) }; + enum { KBssId = (1 << 1) }; /** deprecated */ + + TUint32 iRxFilter; + }; + +struct SDefaultIeFilterTable + { + enum { KTrackChange = (1 << 0) }; + enum { KTrackPresence = (1 << 1) }; + + TUint8 iIe; + TUint8 iTreatMeant; + }; + +struct SIe221FilterTable + { + enum { KTrackChange = (1 << 0) }; + enum { KTrackPresence = (1 << 1) }; + + enum { KOuiLen = 3 }; + + TUint8 iIe; + TUint8 iTreatMeant; + TUint8 iOui[KOuiLen]; + TUint8 iType; + TUint16 iVersion; + }; + +struct SbeaconFilterIeTable + { + enum { KHeaderSize = sizeof( TUint32 ) }; + + TUint32 iNumofElems; + TUint8 iIeTable[1]; // IE table details start here + }; + +struct SbeaconFilterEnable + { + TBool iEnable; + TUint32 iCount; /** deprecated */ + }; + +struct SsleepMode + { + TSleepMode iMode; + }; + +struct SwlanWakeUpInterval + { + TWlanWakeUpInterval iMode; + TUint8 iListenInterval; + TUint8 iReserved[2]; + }; + +struct SbeaconLostCount + { + TUint32 iLostCount; + }; + +struct SrcpiThreshold + { + TRcpi iThreshold; + TUint8 iReserved[3]; + }; + +struct SstatisticsTable + { + TUint8 iSnr; + TRcpi iRcpi; + TUint8 iReserved[2]; + }; + +struct SibssPsConfig /** deprecated */ + { + TIbssPsMode iMode; + }; + +struct StxRateClass + { + TUint8 iTxPolicy54; + TUint8 iTxPolicy48; + TUint8 iTxPolicy36; + TUint8 iTxPolicy33; + TUint8 iTxPolicy24; + TUint8 iTxPolicy22; + TUint8 iTxPolicy18; + TUint8 iTxPolicy12; + TUint8 iTxPolicy11; + TUint8 iTxPolicy9; + TUint8 iTxPolicy6; + TUint8 iTxPolicy5_5; + TUint8 iTxPolicy2; + TUint8 iTxPolicy1; + + TUint8 iShortRetryLimit; + TUint8 iLongRetryLimit; + + TUint32 iFlags; + }; + +struct StxRatePolicy + { + enum { KHeaderSize = sizeof( TUint32 ) }; + + TUint32 iNumOfPolicyObjects; + StxRateClass iTxRateClass[1]; // rate classes start here + }; + +struct ScountersTable + { + TUint32 iPlcpError; + TUint32 iFcsError; + }; + +struct Sdot11Preamble + { + TPreambleType iType; + TUint8 iReserved[3]; + }; + +struct ShtCapabilities + { + TBool iHtSupport; + TMacAddress iPeerMac; + THtRxStbc iRxStbc; + THtMaxAmpdu iMaxAmpduLength; + THtCapabilities iPeerFeatures; + THtMcsSet iMcsSet; + THtAmpduSpacing iAmpduSpacing; + THtMcsFeedback iMcsFeedback; + TUint32 iTxBeamFormingCapab; + TUint8 iAntennaSelCapab; + TUint8 iReserved[3]; + }; + +struct ShtBssOperation + { + enum { KNonGreenfieldPresent = ( 1 << 0 ) }; + enum { KPcoActive = ( 1 << 2 ) }; + enum { KRifsPermitted = ( 1 << 3 ) }; + enum { KDualCtsProtReq = ( 1 << 4 ) }; + enum { KSecondaryBeaconTx = ( 1 << 5 ) }; + enum { KLsigTxopProtection = ( 1 << 6 ) }; + + TUint32 iInfo; + THtMcsSet iMcsSet; + THtProtection iOpMode; + THtSecChannelOffset iSecChOffset; + THtChannelWidth iApChWidth; + TUint8 iReserved[3]; + }; + +struct ShtSecondaryBeacon + { + THtSecBeacon iSecBeacon; + TUint8 iReserved[3]; + }; + +struct ShtBlockAckConfigure + { + static const TUint8 KTid0 = ( 1 << 0 ); + static const TUint8 KTid1 = ( 1 << 1 ); + static const TUint8 KTid2 = ( 1 << 2 ); + static const TUint8 KTid3 = ( 1 << 3 ); + static const TUint8 KTid4 = ( 1 << 4 ); + static const TUint8 KTid5 = ( 1 << 5 ); + static const TUint8 KTid6 = ( 1 << 6 ); + static const TUint8 KTid7 = ( 1 << 7 ); + + TUint8 iTxBlockAckUsage; + TUint8 iRxBlockAckUsage; + TUint8 iReserved[2]; + }; + +struct StxAutoRatePolicy + { + TRate iBAndGRates; + THtMcsSet iMcsSet; + TUint8 iTxRateClassId; + TUint8 iShortRetryLimit; + TUint8 iLongRetryLimit; + TUint8 iReserved[3]; + }; + +struct SetherTypeFilter + { + enum { KHeaderSize = sizeof( TFilterMode ) + sizeof( TUint8 ) }; + + TFilterMode iFilterMode; + TUint8 iNumOfTypes; + TUint16 iTypeData[1]; // Ethernet type codes start here + }; + +struct SbroadcastUdpFilter + { + enum { KHeaderSize = sizeof( TFilterMode ) + sizeof( TUint8 ) }; + + TFilterMode iFilterMode; + TUint8 iNumOfPorts; + TUint16 iPortData[1]; // UDP port numbers start here + }; + +NAMESPACE_END_WHA + +#endif // WHA_MIB_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wlanwha_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wlanwha_types.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,778 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WHA_TYPES_H +#define WHA_TYPES_H + +#include + +NAMESPACE_BEGIN_WHA + +typedef TUint16 TMib; +const TMib KMibDot11StationId = 0x1001; +const TMib KMibDot11MaxReceiveLifetime = 0x1002; +const TMib KMibDot11SlotTime = 0x1003; +const TMib KMibDot11GroupAddressesTable = 0x1004; +const TMib KMibDot11WepDefaultKeyId = 0x1005; +const TMib KMibDot11CurrentTxPowerLevel = 0x1006; +const TMib KMibDot11RTSThreshold = 0x1007; +const TMib KMibCtsToSelf = 0x1101; +const TMib KMibArpIpAddressTable = 0x1102; +const TMib KMibTemplateFrame = 0x1103; +const TMib KMibRxFilter = 0x1104; +const TMib KMibBeaconFilterIeTable = 0x1105; +const TMib KMibBeaconFilterEnable = 0x1106; +const TMib KMibSleepMode = 0x1107; +const TMib KMibWlanWakeUpInterval = 0x1108; +const TMib KMibBeaconLostCount = 0x1109; +const TMib KMibRcpiThreshold = 0x110A; +const TMib KMibStatisticsTable = 0x110B; +const TMib KMibIbssPsConfig = 0x110C; /** deprecated */ +const TMib KMibTxRatePolicy = 0x110D; +const TMib KMibCountersTable = 0x110E; +const TMib KMibDot11Preamble = 0x110F; +const TMib KMibEtherTypeFilter = 0x1110; +const TMib KMibBroadcastUdpFilter = 0x1111; + +const TMib KMibHtCapabilities = 0x2000; +const TMib KMibHtBssOperation = 0x2001; +const TMib KMibHtSecondaryBeacon = 0x2002; +const TMib KMibHtBlockAckConfigure = 0x2003; +const TMib KMibTxAutoRatePolicy = 0x2004; + + +typedef TInt32 TPowerLevel; +typedef TUint8 TRcpi; +typedef TUint8 TBand; +typedef TUint32 TChannelNumber; +typedef TUint32 TPltType; +typedef TUint32 TRate; +typedef TUint32 TPacketId; + +typedef TUint8 TPsMode; +typedef TUint32 TIbssPsMode; /** deprecated */ +typedef TUint8 TPrivacyKeyId; +typedef TUint32 TTemplateType; +typedef TUint32 TSleepMode; +typedef TUint8 TWlanWakeUpInterval; +typedef TUint32 TIpv4Address; +typedef TUint32 TStatus; +typedef TUint8 TSlotTime; + +typedef TUint8 THtSecChannelOffset; +typedef TUint8 THtChannelWidth; +typedef TUint8 THtPcoPhase; + +const TUint8 KHtMcsSetLength = 10; +typedef TUint8 THtMcsSet[KHtMcsSetLength]; + +typedef TUint8 THtProtection; +typedef TUint8 THtPpduFormat; +typedef TUint8 THtRxStbc; +typedef TUint8 THtMaxAmsdu; +typedef TUint8 THtMaxAmpdu; +typedef TUint8 THtAmpduSpacing; +typedef TUint8 THtPcoTransTime; +typedef TUint8 THtSecBeacon; +typedef TUint8 THtMcsFeedback; +typedef TUint8 TPreambleType; +typedef TUint32 THtCapabilities; +typedef TUint8 TFilterMode; + +const TBand KBand2dot4GHzMask = ( 1 << 0 ); +const TBand KBand4dot9GHzMask = ( 1 << 1 ); +const TBand KBand5GHzMask = ( 1 << 2 ); + +/** +* 802.11 WEP key ID values +*/ +const TPrivacyKeyId KPrivacyKeyId0 = 0; +const TPrivacyKeyId KPrivacyKeyId1 = 1; +const TPrivacyKeyId KPrivacyKeyId2 = 2; +const TPrivacyKeyId KPrivacyKeyId3 = 3; +const TPrivacyKeyId KPrivacyKeyIdMax = 4; // defined as an upper bound + +enum TQueueId + { + ELegacy, + EBackGround, + EVideo, + EVoice, + EHcca, /** deprecated */ + EQueueIdMax // defined as upper bound + }; + +const TUint32 KSlotTime20 = 20; +const TUint32 KSlotTime9 = 9; + + +const TUint KBeaconStorageSize = 256; +const TUint KProbeRequestStorageSize = KBeaconStorageSize; +const TUint KProbeResponseStorageSize = KBeaconStorageSize; + +const TTemplateType KBeaconTemplate = 0; +const TTemplateType KProbeRequestTemplate = 1; +const TTemplateType KNullDataTemplate = 2; +const TTemplateType KProbeResponseTemplate = 3; +const TTemplateType KQosNullDataTemplate = 4; +const TTemplateType KPSPollTemplate = 5; + +const TSleepMode KAwakeMode = 0; +const TSleepMode KPowerDownMode = 1; +const TSleepMode KLowPowerMode = 2; + +const TWlanWakeUpInterval KWakeUpIntervalAllBeacons = 0; +const TWlanWakeUpInterval KWakeUpIntervalAllDtims = 1; +const TWlanWakeUpInterval KWakeUpIntervalEveryNthBeacon = 2; +const TWlanWakeUpInterval KWakeUpIntervalEveryNthDtim = 3; + +const TIbssPsMode KIbssStandardPsMode = 0; /** deprecated */ +const TIbssPsMode KIbssEnhancedPsMode = 1; /** deprecated */ + +const THtSecChannelOffset KNoSecCh = 0; +const THtSecChannelOffset KSecChAbovePrimCh = 1; +const THtSecChannelOffset KSecChBelowPrimCh = 3; + +const THtChannelWidth KHtChWidthOnly20MHz = 0; +const THtChannelWidth KHtChWidth40And20MHz = 1; + +const THtPcoPhase KHtPcoPhase20MHz = 0; +const THtPcoPhase KHtPcoPhase40MHz = 1; + +const THtProtection KHtOperationMode0 = 0; +const THtProtection KHtOperationMode1 = 1; +const THtProtection KHtOperationMode2 = 2; +const THtProtection KHtOperationMode3 = 3; + +const THtPpduFormat KHtPpduFormatNonHt = 0; +const THtPpduFormat KHtPpduFormatMixed = 1; +const THtPpduFormat KHtPpduFormatGreenfield = 2; + +const THtRxStbc KHtRxStbcNotSupported = 0; +const THtRxStbc KHtRxStbcFor1Stream = 1; +const THtRxStbc KHtRxStbcFor1And2Streams = 2; +const THtRxStbc KHtRxStbcFor1And2And3Streams = 3; + +const THtMaxAmsdu KHtMaxAmsdu3839Octets = 0; +const THtMaxAmsdu KHtMaxAmsdu7935Octets = 1; + +const THtMaxAmpdu KHtMaxAmpdu8191Octets = 0; +const THtMaxAmpdu KHtMaxAmpdu16383Octets = 1; +const THtMaxAmpdu KHtMaxAmpdu32767Octets = 2; +const THtMaxAmpdu KHtMaxAmpdu65535Octets = 3; + +const THtAmpduSpacing KHtAmpduSpacingNoRestriction = 0; +const THtAmpduSpacing KHtAmpduSpacingQuarter_us = 1; +const THtAmpduSpacing KHtAmpduSpacingHalf_us = 2; +const THtAmpduSpacing KHtAmpduSpacingOne_us = 3; +const THtAmpduSpacing KHtAmpduSpacingTwo_us = 4; +const THtAmpduSpacing KHtAmpduSpacingFour_us = 5; +const THtAmpduSpacing KHtAmpduSpacingEight_us = 6; +const THtAmpduSpacing KHtAmpduSpacingSixteen_us = 7; + +const THtPcoTransTime KHtPcoTransTimeNone = 0; +const THtPcoTransTime KHtPcoTransTime400us = 1; +const THtPcoTransTime KHtPcoTransTime1_5ms = 2; +const THtPcoTransTime KHtPcoTransTime5ms = 3; + +const THtSecBeacon KHtSecBeaconRxPrimaryOnly = 0; +const THtSecBeacon KHtSecBeaconRxEither = 1; +const THtSecBeacon KHtSecBeaconRxSecondaryOnly = 2; + +const THtMcsFeedback KHtMcsFeedbackNone = 0; +const THtMcsFeedback KHtMcsFeedbackUnsolicitedOnly = 2; +const THtMcsFeedback KHtMcsFeedbackUnsolicitedAndSolicited = 3; + +const TPreambleType KLongPreamble = 0; +const TPreambleType KShortPreamble = 1; + +const THtCapabilities KLdpcRx = ( 1 << 0 ); +const THtCapabilities K40MhzChannel = ( 1 << 1 ); +const THtCapabilities KGreenfieldFormat = ( 1 << 2 ); +const THtCapabilities KShortGiFor20Mhz = ( 1 << 3 ); +const THtCapabilities KShortGiFor40Mhz = ( 1 << 4 ); +const THtCapabilities KStbcTx = ( 1 << 5 ); +const THtCapabilities KDelayedBlockAck = ( 1 << 6 ); +const THtCapabilities KDsssCckIn40Mhz = ( 1 << 7 ); +const THtCapabilities KPsmp = ( 1 << 8 ); +const THtCapabilities KLsigTxopProtection = ( 1 << 9 ); +const THtCapabilities KPco = ( 1 << 10 ); +const THtCapabilities KHtcField = ( 1 << 11 ); +const THtCapabilities KReverseDirectionResp = ( 1 << 12 ); + +const TFilterMode KFilteringDisabled = 0; +const TFilterMode KFilterIn = 1; +const TFilterMode KFilterOut = 2; + +typedef TIpv4Address TIpV4Addr; /** deprecated */ + +const TIpv4Address KZeroIpV4Addr = 0x00000000; + +/** +* rate definition masks +*/ +const TRate KRate1Mbits = 0x00000001; +const TRate KRate2Mbits = 0x00000002; +const TRate KRate5_5Mbits = 0x00000004; +const TRate KRate6Mbits = 0x00000008; +const TRate KRate9Mbits = 0x00000010; +const TRate KRate11Mbits = 0x00000020; +const TRate KRate12Mbits = 0x00000040; +const TRate KRate18Mbits = 0x00000080; +const TRate KRate22Mbits = 0x00000100; +const TRate KRate24Mbits = 0x00000200; +const TRate KRate33Mbits = 0x00000400; +const TRate KRate36Mbits = 0x00000800; +const TRate KRate48Mbits = 0x00001000; +const TRate KRate54Mbits = 0x00002000; + +const TRate KDot11gRates = + KRate1Mbits | KRate2Mbits | KRate5_5Mbits | KRate6Mbits | KRate9Mbits | + KRate11Mbits | KRate12Mbits | KRate18Mbits | KRate22Mbits | KRate24Mbits | + KRate33Mbits | KRate36Mbits | KRate48Mbits | KRate54Mbits; + +const TRate KDot11bRates = + KRate1Mbits | KRate2Mbits | KRate5_5Mbits | KRate11Mbits; + +const TRate KMaxDot11bRate = KRate11Mbits; + +/** +* bitmasks for ReceivePacket aFlags member +*/ +const TUint32 KEncryptNone = 0; +const TUint32 KEncryptWapi = (1 << 15); +const TUint32 KEncryptWep = (1 << 16); +const TUint32 KEncryptTkip = (1 << 17); +const TUint32 KEncryptAes = (3 << 16); +const TUint32 KMoreFrames = (1 << 18); +const TUint32 KDuringMeasure = (1 << 19); /** deprecated */ +const TUint32 KHtPacket = (1 << 20); +const TUint32 KPartOfAmpdu = (1 << 21); +const TUint32 KStbc = (1 << 22); + +struct STxPowerRange + { + TPowerLevel iMinPowerLevel; + TPowerLevel iMaxPowerLevel; + TUint32 iStepping; + }; + +struct SHtCapabilities + { + THtCapabilities iHTCapabilitiesBitMask; + TUint16 iRxMaxDataRate; + THtChannelWidth iChannelWidth; + THtRxStbc iRxStbc; + THtMaxAmsdu iMaxAmsdu; + THtMaxAmpdu iMaxAmpdu; + THtAmpduSpacing iAmpduSpacing; + THtMcsSet iRxMcs; + THtMcsSet iTxMcs; + THtPcoTransTime iPcoTransTime; + THtMcsFeedback iMcsFeedback; + }; + +struct SSettings + { + static const TUint KNumOfBandsSupported = 3; + + TUint8 iNumOfSSIDs; + TUint8 iRxBufAlignment; /** deprecated */ + TUint16 iNumOfBytesForSsid; + TRate iRates; + TBand iBand; + TUint8 iRxoffset; + TUint8 iNumOfGroupTableEntrys; + TUint8 iNumOfTxRateClasses; + TUint8 iTxFrameTrailerSpace; + TUint8 iTxFrameHeaderSpace; + TUint16 iFlagsMask; /** deprecated */ + STxPowerRange iTxPowerRange[KNumOfBandsSupported]; + + enum { KMaxReceiveLifeTime = ( 1 << 0 ) }; + enum { KIbssPsConfig = ( 1 << 1 ) }; /** deprecated */ + enum { KTruncate = ( 1 << 2 ) }; + enum { KPreambleOverride = ( 1 << 3 ) }; + enum { KPowerLevelParam = ( 1 << 4 ) }; + enum { KExpiryTimeParam = ( 1 << 5 ) }; + enum { KProbe4Join = ( 1 << 6 ) }; + enum { KMaxLifeTime = ( 1 << 7 ) }; + enum { KTxNoAckPolicy = ( 1 << 8 ) }; + enum { KBlockAckPolicy = ( 1 << 9 ) }; /** deprecated */ + enum { KDot11SlotTime = ( 1 << 10 ) }; + enum { KWmmSa = ( 1 << 11 ) }; /** deprecated */ + enum { KSapsd = ( 1 << 12 ) }; /** deprecated */ + enum { KRadioMeasurements = ( 1 << 13 ) }; /** deprecated */ + enum { KLegacyPsPoll = ( 1 << 14 ) }; /** deprecated */ + enum { KWep16ByteKey = ( 1 << 15 ) }; /** deprecated */ + enum { KMoreDataAck = ( 1 << 16 ) }; + enum { KScanChannelTimes = ( 1 << 17 ) }; + enum { KAutonomousRateAdapt = ( 1 << 18 ) }; + enum { KNoSecHdrAndTrailer = ( 1 << 19 ) }; + enum { KHtOperation = ( 1 << 20 ) }; + enum { KWapi = ( 1 << 21 ) }; + enum { KDsParamSetIeInProbe = ( 1 << 22 ) }; + enum { KEtherTypeFilter = ( 1 << 23 ) }; + enum { KBroadcastUdpFilter = ( 1 << 24 ) }; + enum { KMultipleRxBuffers = ( 1 << 25 ) }; + + TUint32 iCapability; + SHtCapabilities iHtCapabilities; + }; + +struct SConfigureDataBase + { + // currently this is the only one defined + TUint32 iDot11MaxTransmitMsduLifeTime; + }; + +// frequencies for 2.4 GHz band in units of KHz +const TUint32 K2dot4ChannelFrequencies[] = + { + 2412000, // Channel 1 + 2417000, // Channel 2 + 2422000, // Channel 3 + 2427000, // Channel 4 + 2432000, // Channel 5 + 2437000, // Channel 6 + 2442000, // Channel 7 + 2447000, // Channel 8 + 2452000, // Channel 9 + 2457000, // Channel 10 + 2462000, // Channel 11 + 2467000, // Channel 12 + 2472000, // Channel 13 + 2484000 // Channel 14 + }; + +struct SChannelLoadParams /** deprecated */ + { + }; + +struct SNoiseHistogramParams /** deprecated */ + { + }; + +struct SBeaconParams /** deprecated */ + { + enum { KPassive = 0 }; + enum { KPassivePilot = 1 }; + enum { KActive = 2 }; + enum { KStaSelected = 3 }; + enum { KBeaconTable = 4 }; + + TUint32 iScanMode; + }; + +union UMeasurementSpecific /** deprecated */ + { + SBeaconParams iBeaconParams; + SChannelLoadParams iChannelLoadParams; + SNoiseHistogramParams iNoiseHistogramParams; + }; + +struct SParameterSet /** deprecated */ + { + enum { KMeasTypeBasic = 0 }; + enum { KMeasTypeChannelLoad = 1 }; + enum { KMeasTypeNoiseHistogram = 2 }; + enum { KMeasTypeBeacon = 3 }; + enum { KMeasTypeFrame = 4 }; + + TUint32 iType; + TUint32 iDuration; + TUint32 iReserved; + UMeasurementSpecific iMeasurementSpecific; + }; + +struct SChannels + { + TChannelNumber iChannel; + TUint32 iMinChannelTime; + TUint32 iMaxChannelTime; + TPowerLevel iTxPowerLevel; + }; + +struct SSSID + { + enum { KMaxSSIDLength = 32 }; + + TUint32 iSSIDLength; + TUint8 iSSID[KMaxSSIDLength]; + }; + +enum TScanType + { + EFgScan, + EBgScan, + EForcedBgScan + }; + +enum TOperationMode + { + EIBSS, + EBSS + }; + +#pragma pack(1) +struct TMacAddress + { + enum { KMacAddressLength = 6 }; + + /** the MAC address */ + TUint8 iMacAddress[KMacAddressLength]; + }; // 6 bytes +#pragma pack() + +/** +* Broadcast MAC Address. +*/ +const TMacAddress KBroadcastMacAddr = + { + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + }; + +/** +* MAC address that is all zeros +*/ +const TMacAddress KZeroMacAddr = + { + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }; + +struct SWepPairwiseKey + { + enum { KHeaderSize = sizeof( TMacAddress ) + ( 2 * sizeof( TUint8 ) ) }; + + TMacAddress iMacAddr; + TUint8 iReserved; + TUint8 iKeyLengthInBytes; + TUint8 iKey[1]; + }; + +struct SWepGroupKey + { + enum { KHeaderSize = sizeof( TPrivacyKeyId ) + ( 3 * sizeof( TUint8 ) ) }; + + TPrivacyKeyId iKeyId; + TUint8 iKeyLengthInBytes; + TUint8 iReserved[2]; + TUint8 iKey[1]; + }; + +/** +* Length of TKIP key in bytes; +*/ +const TUint32 KTKIPKeyLength = 16; +/** +* Length of MIC in BYTEs +*/ +const TUint32 KMicLength = 8; + +struct STkipPairwiseKey + { + TMacAddress iMacAddr; + TUint8 iReserved[2]; + TUint8 iTkipKey[KTKIPKeyLength]; + TUint8 iRxMicKey[KMicLength]; + TUint8 iTxMicKey[KMicLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved2[3]; + }; + +/** +* Length of receive sequence counter in bytes +*/ +const TUint32 KRxSequenceCounterLength = 8; + +struct STkipGroupKey + { + TUint8 iTkipKey[KTKIPKeyLength]; + TUint8 iRxMicKey[KMicLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved[3]; + TUint8 iRxSequenceCounter[KRxSequenceCounterLength]; + }; + +/** +* Length of AES key in bytes; +*/ +const TUint32 KAesKeyLength = 16; + +struct SAesPairwiseKey + { + TMacAddress iMacAddr; + TUint8 iReserved[2]; + TUint8 iAesKey[KAesKeyLength]; + }; + +struct SAesGroupKey + { + TUint8 iAesKey[KAesKeyLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved[3]; + TUint8 iRxSequenceCounter[KRxSequenceCounterLength]; + }; + +/** +* Length of WAPI encryption key in bytes; +*/ +const TUint32 KWapiKeyLength = 16; +/** +* Length of WAPI MIC key in bytes +*/ +const TUint32 KWapiMicKeyLength = 16; + +struct SWapiPairwiseKey + { + TMacAddress iMacAddr; + TPrivacyKeyId iKeyId; + TUint8 iReserved[1]; + TUint8 iWapiKey[KWapiKeyLength]; + TUint8 iMicKey[KWapiMicKeyLength]; + }; + +struct SWapiGroupKey + { + TUint8 iWapiKey[KWapiKeyLength]; + TUint8 iMicKey[KWapiMicKeyLength]; + TPrivacyKeyId iKeyId; + TUint8 iReserved[3]; + }; + +enum TPreamble + { + ELongPreamble, + EShortPreamble + }; + +const TPsMode KPsDisable = 0; +const TPsMode KPsEnable = 1; + + +enum TParameterSet + { + EParameterSetPlaceHolder + }; + +enum TKeyType + { + EWepGroupKey, + EWepPairWiseKey, + ETkipGroupKey, + ETkipPairWiseKey, + EAesGroupKey, + EAesPairWiseKey, + EWapiGroupKey, + EWapiPairWiseKey, + EKeyNone // defined as an empty type + }; + +enum TPsScheme + { + ERegularPs, + EUapsd, + ELegacyPs, /** deprecated */ + ESapsd /** deprecated */ + }; + +struct SSAPSDConfig /** deprecated */ + { + TUint32 iServiceStartTime; // Lower order of TSF + TUint32 iServiceInterval; // In microseconds + }; + +enum TAckPolicy + { + ENormal, + ENoaAck, + EBlockAck /** deprecated */ + }; + +const TStatus KSuccess = 0; +const TStatus KFailed = 1; +const TStatus KDecryptFailure = 2; +const TStatus KMicFailure = 3; +const TStatus KSuccessXfer = 4; +const TStatus KPending = 5; +const TStatus KQueueFull = 6; +const TStatus KErrorRetryExceeded = 7; +const TStatus KErrorLifetimeExceeded = 8; +const TStatus KErrorNoLink = 9; +const TStatus KErrorMacNotResponding = 10; +const TStatus KSuccessQueueFull = 11; + + +enum TCommandId + { + EInitializeResponse, + EConfigureResponse, + EReleaseResponse, + EPLtResponse, + EResetResponse, + EMeasureCommandResponse, /** deprecated */ + EStopMeasureResponse, /** deprecated */ + EScanCommandResponse, + EStopScanResponse, + EJoinResponse, + ESetPsModeCommandResponse, + ESetBssParametersResponse, + EReadMIBResponse, + EWriteMIBResponse, + EAddKeyResponse, + ERemoveKeyResponse, + EConfigureQueueResponse, + EConfigureACResponse, + }; + +enum TCompleteCommandId + { + EMeasureComplete, /** deprecated */ + EScanComplete, + ESetPsModeComplete + }; + +struct SJoinResponse + { + TPowerLevel iMinPowerLevel; + TPowerLevel iMaxPowerLevel; + }; + +struct SReadMibResponse + { + TMib iMib; + TUint16 iLength; + const void* iData; + }; + +union UCommandResponseParams + { + SJoinResponse iJoinResponse; + SReadMibResponse iReadMibResponse; + }; + +struct SChannelLoadResult /** deprecated */ + { + TUint32 iCCABusyFraction; + }; + +struct SNoiseHistogramResult /** deprecated */ + { + enum { KResultSize = 8 }; + + TUint8 iRPIDensity[KResultSize]; + }; + +struct SFrameReport /** deprecated */ + { + TMacAddress iTransmitAddress; + TUint8 iReserved1[2]; + TMacAddress iBssId; + TUint8 iReserved2[2]; + TPowerLevel iRxSignalPower; + TUint32 iNumOfFrames; + }; + +struct SFrameResultReport /** deprecated */ + { + TUint32 iNumberOfResults; + SFrameReport iFrameReport[1]; + }; + +union UMeasurementSpecificResult /** deprecated */ + { + SChannelLoadResult iChannelLoadResult; + SNoiseHistogramResult iNoiseHistogramResult; + SFrameResultReport iFrameResultReport; + }; + +struct SResultSet /** deprecated */ + { + TUint32 iType; + TStatus iStatus; + + UMeasurementSpecificResult iMeasurementSpecificResult; + }; + +struct SMeasureComplete /** deprecated */ + { + TPsMode iDot11PowerManagementMode; + TUint8 iNumberOfMeasurementTypes; + TUint8 iReserved[2]; + SResultSet iResultSet[1]; + }; + +struct SScanComplete + { + TPsMode iDot11PowerManagementMode; + TUint8 iReserved[3]; + }; + +struct SSetPsModeComplete + { + TPsMode iDot11PowerManagementMode; + TUint8 iReserved[3]; + }; + +union UCommandCompletionParams + { + SMeasureComplete iMeasureComplete; + SScanComplete iScanComplete; + SSetPsModeComplete iSetPsModeComplete; + }; + +enum TIndicationId + { + EError, + EBssLost, + EBSSRegained, + ERadar, /** deprecated */ + ERcpi, + EPsModeError + }; + +struct SError + { + TStatus iStatus; + }; + +enum TMicKeyType + { + EPairWise, + EGroup + }; + +struct SRcpi + { + TRcpi iRcpi; + TUint8 iReserved[3]; + }; + +union UIndicationParams + { + SError iError; + SRcpi iRcpi; + }; + +NAMESPACE_END_WHA + +#endif // WHA_TYPES_H + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/inc/wlanwhanamespace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/inc/wlanwhanamespace.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Part of WLAN HAL API +* Defines the WHA namespace +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WHANAMESPACE_H +#define WHANAMESPACE_H + +#define WHA WlanHalApi +#define NAMESPACE_BEGIN_WHA namespace WlanHalApi { +#define NAMESPACE_END_WHA } + +#endif // WHANAMESPACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hal_api/wlan_hal_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hal_api/wlan_hal_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN HAL API + WLAN Hardware Abstraction Layer (HAL) adaptation interface. + c++ + wlan_bearer + + + + + + + + yes + yes + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hpa_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hpa_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* WLAN HPA API +* +*/ + +/* +* %version: 5 % +*/ + +#if defined(RD_WLAN_DDK) + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanhpa.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanhpa.h) +../inc/wlanhpa.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanhpa.inl) + +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hpa_api/inc/wlanhpa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hpa_api/inc/wlanhpa.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: hpa and its client interface declarations +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANHPA_H +#define WLANHPA_H + +#include +#include +/** + * hpa client interface declaration + * + * + * @lib wlanpdd.pdd + * @since S60 v3.2 + */ +class MWlanHpaCb + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanHpaCb() {}; + + /** + * Called in ISR DFC context to signal that peripheral + * device interrupt has occurred. + * NOTE: on systems implementing level sensitive interrupt handling + * host interrupt is disabled prior calling this method + * + * @since S60 v3.2 + */ + virtual void OnInterrupt() = 0; + + }; + +class MWlanOsaExt; + + +/** + * hpa interface declaration + * + * + * @lib wlanpdd.pdd + * @since S60 v3.2 + */ +class WlanHpa + { + +public: + /* interrupt polarity */ + enum TIsrPolarity + { + /** active high */ + EIsrPolarityHigh = 0, + /** active low */ + EIsrPolarityLow + }; + + struct TConfig + { + /* interrupt polarity */ + TIsrPolarity iIsrPolarity; + }; + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanHpa() {}; + + /** + * Create hpa layer object + * + * @since S60 v3.2 + * @param aOsaExt osa extension object + * @return hpa layer object, NULL upon failure + */ + IMPORT_C static WlanHpa* Create( MWlanOsaExt& aOsaExt, MWlanOsa& aOsa ); + + /** + * Destroy hpa layer object + * + * @since S60 v3.2 + * @param aWlanHpa hpa layer object + */ + IMPORT_C static void Destroy( WlanHpa* aWlanHpa ); + + /** + * Attach hpa layer object client + * + * @since S60 v3.2 + * @param aHpaCb hpa layer object client + */ + inline void Attach( MWlanHpaCb& aHpaCb ); + + /** + * Turns WLAN devices power on + * + * @since S60 v3.2 + */ + virtual void PowerOnDevice() = 0; + + /** + * Turns WLAN devices power off + * + * @since S60 v3.2 + */ + virtual void PowerOffDevice() = 0; + + /** + * Called by hpa layer object client when peripheral interrupt + * informed by OnInterrupt method has been serviced. + * NOTE: on systems implementing level sensitive interrupt handling + * host interrupt is enabled at this state + * + * @since S60 v3.2 + */ + virtual void InterruptServiced() = 0; + + /** + * Configures the HPA layer + * + * NOTE: usage limited to bootup sequence only + * + * @since S60 v3.2 + * @param aConfig HPA layer configuration data + */ + virtual void Configure( const TConfig& aConfig ) = 0; + + /** + * Enables Irq + * + * NOTE: usage limited to bootup sequence only. + * Untill this call the host side interrupts are disabled + * + * @since S60 v3.2 + */ + virtual void EnableIrq() = 0; + + /** + * Toggles debug GPIO + * Usage limited to R&D (debug) purpose only + * + * @since S60 v3.2 + * @param aHigh state to set (ETrue equals high state otherwise low state) + * @return ETrue equals functionality is supported in any other case not supported + */ + virtual TBool DebugGpioToggle( TBool aHigh ) = 0; + +protected: + + /** + * Constructor + * + * @since S60 v3.2 + * @param aOsaExt osa extension object + */ + explicit WlanHpa( MWlanOsaExt& aOsaExt, MWlanOsa& aOsa ) + : iHpaCb( NULL ), iOsaExt( aOsaExt ), iOsa( aOsa ) {}; + + /** + * Extract hpa layer object client + * + * @since S60 v3.2 + * @return hpa layer object client + */ + inline MWlanHpaCb& HpaCb(); + + /** + * Extract osa extension + * + * @since S60 v3.2 + * @return osa extension + */ + inline MWlanOsaExt& OsaExtCb(); + + /** + * Extract osa + * + * @since + * @return osa + */ + + inline MWlanOsa& OsaCb(); + +private: + + /** + * hpa layer object client + * Not own. + */ + MWlanHpaCb* iHpaCb; + + /** + * osa extension + */ + MWlanOsaExt& iOsaExt; + + /** + * osa + */ + MWlanOsa& iOsa; + + }; + +#include + +#endif // WLANHPA_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hpa_api/inc/wlanhpa.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hpa_api/inc/wlanhpa.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: inline implementation of WlanHpa +* +*/ + +/* +* %version: 4 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline void WlanHpa::Attach( MWlanHpaCb& aCb ) + { + iHpaCb = &aCb; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline MWlanHpaCb& WlanHpa::HpaCb() + { + return *iHpaCb; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline MWlanOsaExt& WlanHpa::OsaExtCb() + { + return iOsaExt; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline MWlanOsa& WlanHpa::OsaCb() + { + return iOsa; + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hpa_api/wlan_hpa_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hpa_api/wlan_hpa_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,13 @@ + + +WLAN HPA API +WLAN HW Platform Abstraction API +c++ +wlan_bearer + + + +no +no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hw_initialization_data_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hw_initialization_data_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN HW Initialization Data API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanhwinitinterface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanhwinitinterface.h) +../inc/wlanhwinit.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanhwinit.h) +../inc/wlanhwconfiguredata.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanhwconfiguredata.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hw_initialization_data_api/inc/wlanhwconfiguredata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hw_initialization_data_api/inc/wlanhwconfiguredata.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN HW configure data structure. +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANHWCONFIGUREDATA_H +#define WLANHWCONFIGUREDATA_H + +#include + +NAMESPACE_BEGIN_WHA +struct SConfigureData + { + SConfigureDataBase cfgDB; + unsigned int iSize; + unsigned short iPda[1]; + }; +NAMESPACE_END_WHA + +#endif // WLANHWCONFIGUREDATA_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hw_initialization_data_api/inc/wlanhwinit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hw_initialization_data_api/inc/wlanhwinit.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines the class implementing MWlanHwInitInterface interface +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANHWINIT_H +#define WLANHWINIT_H + +#include "wlanhwinitinterface.h" + +class CWlanHwInitMain; + +// CLASS DECLARATION +/** +* This class implements the MWlanHwInitInterface interface. +* +* @since Series 60 3.1 +*/ +NONSHARABLE_CLASS( CWlanHwInit ) : public CBase, public MWlanHwInitInterface + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CWlanHwInit* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CWlanHwInit(); + + // Functions from base classes + + /** + * From MWlanHwInitInterface Get pointer to hardware specific initialization data. + * @since Series 60 3.1 + * @param aInitData Pointer to initialization data, NULL if none. + * @param aInitLength Length of initialization data. + * @param aFwData Pointer to firmware data, NULL if none. + * @param aFwLength Length of firmware data. + */ + IMPORT_C void GetHwInitData( + const TUint8** aInitData, + TUint& aInitLength, + const TUint8** aFwData, + TUint& aFwLength ); + + /** + * From MWlanHwInitInterface Get device MAC address. + * @since Series 60 3.1 + * @param aMacAddress MAC address of the device. + * @return A Symbian error code. + */ + IMPORT_C TInt GetMacAddress( + TMacAddr& aMacAddress ); + + /** + * Methods for production testing. + */ + + /** + * From MWlanHwInitInterface Get pointer to hardware specific initialization data + * for production testing. + * @since Series 60 3.1 + * @param aInitData Pointer to initialization data, NULL if none. + * @param aInitLength Length of initialization data. + * @param aFwData Pointer to firmware data, NULL if none. + * @param aFwLength Length of firmware data. + */ + IMPORT_C void GetHwTestInitData( + const TUint8** aInitData, + TUint& aInitLength, + const TUint8** aFwData, + TUint& aFwLength ); + + /** + * From MWlanHwInitInterface Get hardware specific production testing data. + * @since Series 60 3.1 + * @param aId Id of the parameter to read. + * @param aData Buffer for read data. + * @return A Symbian error code. + */ + IMPORT_C TInt GetHwTestData( + TUint aId, + TDes8& aData ); + + /** + * From MWlanHwInitInterface Set hardware specific production testing data. + * @since Series 60 3.1 + * @param aId Id of the parameter to store. + * @param aData Data to be stored. + * @return A Symbian error code. + */ + IMPORT_C TInt SetHwTestData( + TUint aId, + TDesC8& aData ); + + private: + + /** + * C++ default constructor. + */ + CWlanHwInit(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + /** The main implemenation of HW specific functionality. */ + CWlanHwInitMain* iMain; + }; + +#endif // WLANHWINIT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hw_initialization_data_api/inc/wlanhwinitinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hw_initialization_data_api/inc/wlanhwinitinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines the abstract interface for HW specific initialization +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANHWINITINTERFACE_H +#define WLANHWINITINTERFACE_H + +#include + +/** +* Length of the MAC address. +*/ +const TUint8 KMacAddrLength = 6; + +/** +* Structure for storing a MAC address. +*/ +struct TMacAddr + { + /** the MAC address */ + TUint8 iMacAddress[KMacAddrLength]; + }; + +/** + * This is the abstract base class used for HW specific initialization. + * + * @since Series 60 3.1 + */ +class MWlanHwInitInterface + { + public: // Constructors and destructor + + // New functions + + /** + * Get pointer to hardware specific initialization data. + * @since Series 60 3.1 + * @param aInitData Pointer to initialization data, NULL if none. + * @param aInitLength Length of initialization data. + * @param aFwData Pointer to firmware data, NULL if none. + * @param aFwLength Length of firmware data. + */ + virtual void GetHwInitData( + const TUint8** aInitData, + TUint& aInitLength, + const TUint8** aFwData, + TUint& aFwLength ) = 0; + + /** + * Get device MAC address. + * @since Series 60 3.1 + * @param aMacAddress MAC address of the device. + * @return A Symbian error code. + * @note If a special MAC address 00:00:00:00:00:00 is returned, + * the WLAN engine assumes the device to be a variant without + * WLAN support and will not start the up. + */ + virtual TInt GetMacAddress( + TMacAddr& aMacAddress ) = 0; + + /** + * Methods for production testing. + */ + + /** + * Get pointer to hardware specific initialization data for production testing. + * @since Series 60 3.1 + * @param aInitData Pointer to initialization data, NULL if none. + * @param aInitLength Length of initialization data. + * @param aFwData Pointer to firmware data, NULL if none. + * @param aFwLength Length of firmware data. + */ + virtual void GetHwTestInitData( + const TUint8** aInitData, + TUint& aInitLength, + const TUint8** aFwData, + TUint& aFwLength ) = 0; + + /** + * Get hardware specific production testing data. + * @since Series 60 3.1 + * @param aId Id of the parameter to read. + * @param aData Buffer for read data. + * @return A Symbian error code. + */ + virtual TInt GetHwTestData( + TUint aId, + TDes8& aData ) = 0; + + /** + * Set hardware specific production testing data. + * @since Series 60 3.1 + * @param aId Id of the parameter to store. + * @param aData Data to be stored. + * @return A Symbian error code. + */ + virtual TInt SetHwTestData( + TUint aId, + TDesC8& aData ) = 0; + }; + +#endif // WLANHWINITINTERFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_hw_initialization_data_api/wlan_hw_initialization_data_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_hw_initialization_data_api/wlan_hw_initialization_data_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,18 @@ + + + WLAN HW Initialization Data API + Adaptation API for getting the WLAN device settings (tuning data, MAC address etc.) from permanent memory. + c++ + wlan_bearer + + + + + + + + + yes + yes + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_info_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_info_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN Info API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlaninternalpskeys.h OS_LAYER_PLATFORM_EXPORT_PATH(wlaninternalpskeys.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_info_api/inc/wlaninternalpskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_info_api/inc/wlaninternalpskeys.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN event enumerations and uid:s for Publish And Subscribe. +* PubSub clients can include this file and listen to these events. +* These events will be routed through Publish And Subscribe. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANINTERNALPSKEYS_H +#define WLANINTERNALPSKEYS_H + +#include "wlansdkpskeys.h" + +// LOCAL CONSTANTS +const TInt KPSWlanEnumerationFirstValue = 0; + +/** +* P&S category WLAN information defined in wlansdkpskeys.h +*/ + + +/** +* WLAN indicator +*/ +const TUint KPSWlanIndicator = 0x00000002; +const RProperty::TType KPSWlanIndicatorType = RProperty::EInt; + +/** +* The possible WLAN indicator values +* These values correspond to the WLAN icon statuses +*/ +enum TPSWlanIndicator + { + /** No WLAN connection or WLAN availability, WLAN not in use */ + EPSWlanIndicatorNone = KPSWlanEnumerationFirstValue, + /** + * The device has been set to scan for WLANs, and a WLAN is available. + * That is, the device has been set to show WLAN availability from + * Tools->Settings->Connection->Wireless LAN->Show WLAN availability and if + * WLAN is available, this indicator value is used. + */ + EPSWlanIndicatorAvailable, + /** A WLAN connection is active in a network that does not have encryption. */ + EPSWlanIndicatorActive, + /** A WLAN connection is active in a network that has encryption. */ + EPSWlanIndicatorActiveSecure + }; + +#endif // WLANINTERNALPSKEYS_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_info_api/wlan_info_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_info_api/wlan_info_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN Info API + P&S interface that provides miscellaneous WLAN information. + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN Management API +* +*/ + +/* +* %version: tr1cfwln#7 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanmgmtclient.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanmgmtclient.inl) +../inc/wlanscaninfo.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanscaninfo.inl) +../inc/wlanscaninfointerface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanscaninfointerface.h) +../inc/wlanscaninfo.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanscaninfo.h) +../inc/wlanmgmtinterface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanmgmtinterface.h) +../inc/wlanmgmtclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanmgmtclient.h) +../inc/wlanmgmtcommon.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanmgmtcommon.h) +../inc/wlanerrorcodes.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanerrorcodes.h) +../inc/wlantrafficstreamparameters.h OS_LAYER_PLATFORM_EXPORT_PATH(wlantrafficstreamparameters.h) +../inc/wlantrafficstreamparameters.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlantrafficstreamparameters.inl) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanerrorcodes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanerrorcodes.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,378 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN-specific error code definitions. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANERRORCODES_H +#define WLANERRORCODES_H + +// INCLUDES +#include + +/** + * @defgroup rconn Error codes returned via RConnection API + * @{ + */ + +/** + * @defgroup rconn_cfg Errors due to mismatching configuration + * @defgroup rconn_other Errors due to other failures + */ + +/** + * A failure inside WLAN subsystem has occurred. Typically caused by an + * unexpected WLAN HW event. + * @ingroup rconn_other + */ +const TInt KErrWlanInternalError = -30171; +/** + * WLAN AP has refused 802.11 open system authentication. + * @ingroup rconn_cfg + */ +const TInt KErrWlanOpenAuthFailed = -30172; +/** + * WLAN AP requires 802.11 shared key authentication. + * @ingroup rconn_cfg + */ +const TInt KErrWlanSharedKeyAuthRequired = -30173; +/** + * 802.11 shared key authentication has failed. + * @ingroup rconn_cfg + * @details Most likely caused by misconfigured WEP keys either in + * the IAP settings or the WLAN AP. + */ +const TInt KErrWlanSharedKeyAuthFailed = -30174; +/** + * WLAN AP requires Wi-Fi Protected Access security but + * the IAP doesn't have matching settings. + * @ingroup rconn_cfg + */ +const TInt KErrWlanWpaAuthRequired = -30175; +/** + * Wi-Fi Protected Access authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanWpaAuthFailed = -30176; +/** + * Legacy 802.1x authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlan802dot1xAuthFailed = -30177; +/** + * Wi-Fi Protected Access authentication w/ a preshared key + * has failed. + * @ingroup rconn_cfg + * @details Most likely caused by a misconfigured preshared key + * either in the IAP settings or the WLAN AP. + */ +const TInt KErrWlanIllegalWpaPskKey = -30178; +/** + * Wi-Fi Protected Access connections are not allowed as + * countermeasures are active due to MIC failures. + * @ingroup rconn_other + * @details The countermeasures are active for 60 seconds after + * having been started. + */ +const TInt KErrWlanWpaCounterMeasuresActive = -30179; +/** + * No WLAN APs matching the IAP settings have been found. + * @ingroup rconn_other + */ +const TInt KErrWlanNetworkNotFound = -30180; +/** + * The IAP has an illegal key WEP key configuration. + * @ingroup rconn_cfg + */ +const TInt KErrWlanIllegalEncryptionKeys = -30181; +/** + * Roaming between WLAN APs has failed irreversibly. + * @ingroup rconn_other + */ +const TInt KErrWlanRoamingFailed = -30182; +/** + * Connection to the WLAN network has unexpectedly been lost. + * @ingroup rconn_other + */ +const TInt KErrWlanNetworkLost = -30183; +/** + * WLAN AP requires Wi-Fi Protected Access authentication w/ a preshared key. + * @ingroup rconn_cfg + */ +const TInt KErrWlanPskModeRequired = -30184; +/** + * WLAN AP requires Wi-Fi Protected Access authentication w/ EAP. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapModeRequired = -30185; +/** + * EAP-SIM authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapSimFailed = -30186; +/** + * EAP-TLS authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapTlsFailed = -30187; +/** + * EAP-PEAP authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapPeapFailed = -30188; +/** + * EAP-MSCHAPv2 authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapMsChapv2 = -30189; +/** + * EAP-AKA authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapAkaFailed = -30190; +/** + * EAP-TTLS authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapTtlsFailed = -30191; +/** + * EAP-LEAP authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanLeapFailed = -30192; +/** + * EAP-GTC authentication has failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapGtcFailed = -30193; +/** + * EAP-SIM/EAP-AKA authentication has failed due to a missing + * SIM card. + * @ingroup rconn_cfg + */ +const TInt KErrWlanSimNotInstalled = -30194; +/** + * EAP-SIM/EAP-AKA authentication has failed due to missing + * service subscription. + * @ingroup rconn_cfg + */ +const TInt KErrWlanNotSubscribed = -30195; +/** + * EAP-SIM/EAP-AKA authentication has failed due to user being + * barred from the service. + * @ingroup rconn_cfg + */ +const TInt KErrWlanAccessBarred = -30196; +/** + * EAP-MSCHAPv2 authentication has failed due to expired password. + * @ingroup rconn_cfg + */ +const TInt KErrWlanPasswordExpired = -30197; +/** + * EAP-MSCHAPv2 authentication has failed due to permissions. + * @ingroup rconn_cfg + */ +const TInt KErrWlanNoDialinPermissions = -30198; +/** + * EAP-MSCHAPv2 authentication has failed due to disabled account. + * @ingroup rconn_cfg + */ +const TInt KErrWlanAccountDisabled = -30199; +/** + * EAP-MSCHAPv2 authentication has failed due to restricted logon hours. + * @ingroup rconn_cfg + */ +const TInt KErrWlanRestrictedLogonHours = -30200; +/** + * EAP authentication using certificates failed due to an + * expired certificate. + * @ingroup rconn_cfg + */ +const TInt KErrWlanServerCertificateExpired = -30201; +/** + * EAP authentication using certificates failed due to a + * certificate that couldn't be verified. + * @ingroup rconn_cfg + */ +const TInt KErrWlanCerficateVerifyFailed = -30202; +/** + * EAP authentication using certificates failed due to a + * missing user certificate. + * @ingroup rconn_cfg + */ +const TInt KErrWlanNoUserCertificate = -30203; +/** + * EAP authentication using certificates failed due to a + * mismatching certificate configuration. + * @ingroup rconn_cfg + */ +const TInt KErrWlanNoCipherSuite = -30204; +/** + * EAP authentication using certificates failed due to the server + * not accepting the user certificate. + * @ingroup rconn_cfg + */ +const TInt KErrWlanUserRejected = -30205; +/** + * EAP authentication using certificates failed due to an + * expired user certificate. + * @ingroup rconn_cfg + */ +const TInt KErrWlanUserCertificateExpired = -30206; +/** + * WLAN connection could not be started because one is already active. + * @ingroup rconn_other + */ +const TInt KErrWlanConnAlreadyActive = -30207; +/** + * WLAN AP doesn't support "Wi-Fi Protected Access 2"-only mode. + * @ingroup rconn_cfg + */ +const TInt KErrWlanWpa2OnlyModeNotSupported = -30228; +/** + * Phone detected some suspicious network behavior and it thinks that + * it is not safe to continue. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapFastTunnelCompromiseError = -30229; +/** + * The received message does not fit the current state of the phone. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapFastUnexpextedTlvExhanged = -30230; +/** + * No credentials found and provisioning disabled. Perform provisioning + * first. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled = -30231; +/** + * PAC store does not contain a PAC matching the current server, + * requires provisioning first. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapFastNoMatchingPacForAid = -30232; +/** + * EAP-FAST authentication failed. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapFastAuthFailed = -30233; +/** + * PAC store corrupted. Reset PAC store and perform provisioning again. + * @ingroup rconn_cfg + */ +const TInt KErrWlanEapFastPacStoreCorrupted = -30234; + +/** + * @} + */ + +/** + * @defgroup psetup Error codes returned for Wi-Fi Protected Setup + * @{ + */ + +/** + * Wi-Fi Protected Setup failed due to out-of-band configuration error. + */ +const TInt KErrWlanProtectedSetupOOBInterfaceReadError = -30208; +/** + * Wi-Fi Protected Setup failed due to decryption error during operation. + */ +const TInt KErrWlanProtectedSetupDecryptionCRCFailure = -30209; +/** + * Wi-Fi Protected Setup failed due to a invalid channel. + */ +const TInt KErrWlanProtectedSetup2_4ChannelNotSupported = -30210; +/** + * Wi-Fi Protected Setup failed due to a invalid channel. + */ +const TInt KErrWlanProtectedSetup5_0ChannelNotSupported = -30211; +/** + * Wi-Fi Protected Setup could not be completed due to low signal level. + */ +const TInt KErrWlanSignalTooWeak = -30212; +/** + * Wi-Fi Protected Setup failed due to network authentication failure. + */ +const TInt KErrWlanProtectedSetupNetworkAuthFailure = -30213; +/** + * Wi-Fi Protected Setup failed due to failed association attempt. + */ +const TInt KErrWlanProtectedSetupNetworkAssociationFailure = -30214; +/** + * Wi-Fi Protected Setup failed due to missing DHCP response. + */ +const TInt KErrWlanProtectedSetupNoDHCPResponse = -30215; +/** + * Wi-Fi Protected Setup failed due to failed DHCP configuration. + */ +const TInt KErrWlanProtectedSetupFailedDHCPConfig = -30216; +/** + * Wi-Fi Protected Setup failed due to detected IP address conflict. + */ +const TInt KErrWlanProtectedSetupIPAddressConflict = -30217; +/** + * WLAN AP was unable to connect to the registrar. + */ +const TInt KErrWlanProtectedSetupCouldNotConnectToRegistrar = -30218; +/** + * Multiple push-button sessions were detected. + */ +const TInt KErrWlanProtectedSetupMultiplePBCSessionsDetected = -30219; +/** + * Multiple overlapping session were detected. + */ +const TInt KErrWlanProtectedSetupRogueActivitySuspected = -30220; +/** + * WLAN AP was unable to respond to the Wi-Fi Protected Setup request. + */ +const TInt KErrWlanProtectedSetupDeviceBusy = -30221; +/** + * Wi-Fi Protected Setup cannot be started because WLAN AP + * configuration is locked. + */ +const TInt KErrWlanProtectedSetupSetupLocked = -30222; +/** + * Wi-Fi Protected Setup failed due to a timeout. + */ +const TInt KErrWlanProtectedSetupMessageTimeout = -30223; +/** + * Wi-Fi Protected Setup failed due to a timeout. + */ +const TInt KErrWlanProtectedSetupRegistrationSessionTimeout = -30224; +/** + * Wi-Fi Protected Setup failed password authentication failure. + */ +const TInt KErrWlanProtectedSetupDevicePasswordAuthFailure = -30225; +/** + * WLAN AP does not support PIN code mechanism. + */ +const TInt KErrWlanProtectedSetupPINMethodNotSupported = -30226; +/** + * WLAN AP does not support push-button mechanism. + */ +const TInt KErrWlanProtectedSetupPBMethodNotSupported = -30227; + + + +/** + * @} + */ + +#endif // WLANERRORCODES_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanmgmtclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper class for instantiating an implementation of +* MWlanMgmtInterface via ECom framework. +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANMGMTCLIENT_H +#define WLANMGMTCLIENT_H + +// INCLUDES +#include +#include "wlanmgmtinterface.h" + +// CLASS DECLARATION +/** + * @brief Class for instantiating an implementation of MWlanMgmtInterface via ECom. + * @since Series 60 3.0 + */ +class CWlanMgmtClient : public CBase, public MWlanMgmtInterface + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + inline static CWlanMgmtClient* NewL(); + + /** + * Destructor. + */ + inline virtual ~CWlanMgmtClient(); + + private: // Data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + }; + +#include "wlanmgmtclient.inl" + +#endif // WLANMGMTCLIENT_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanmgmtclient.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanmgmtclient.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of CWlanMgmtClient class. +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANMGMTCLIENT_INL +#define WLANMGMTCLIENT_INL + +// --------------------------------------------------------- +// CWlanScanRequest::NewL +// --------------------------------------------------------- +// +inline CWlanMgmtClient* CWlanMgmtClient::NewL() + { + const TUid KCWlanMgmtClientUid = { 0x101f8eff }; + + TAny* interface = REComSession::CreateImplementationL( + KCWlanMgmtClientUid, + _FOFF( CWlanMgmtClient, + iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// --------------------------------------------------------- +// CWlanScanRequest::~CWlanMgmtClient +// --------------------------------------------------------- +// +inline CWlanMgmtClient::~CWlanMgmtClient() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +#endif // WLANMGMTCLIENT_INL + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanmgmtcommon.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,378 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains common data structures used by WLAN management service. +* +*/ + +/* +* %version: 10 % +*/ + +#ifndef WLANMGMTCOMMON_H +#define WLANMGMTCOMMON_H + +// INCLUDES +#include + +// LOCAL CONSTANTS +/** The maximum SSID length. */ +const TUint KWlanMaxSsidLength = 32; + +/** The maximum BSSID length. */ +const TUint KWlanMaxBssidLength = 6; + +/** The maximum length of WPA preshared key data. */ +const TUint KWlanWpaPskMaxLength = 64; + +/** The maximum length of WEP key data. */ +const TUint KWlanWepKeyMaxLength = 29; + +/** Infinite max delay to be used in GetScanResults and GetAvailableIaps */ +const TUint KWlanInfiniteScanDelay = 0xFFFFFFFF; + +/** Current version of WLAN callback interface. */ +const TUint KWlanCallbackInterfaceVersion = 2; + +// DATA TYPES +/** Data structure for storing the SSID of a WLAN network. */ +typedef TBuf8 TWlanSsid; + +/** Data structure for storing the BSSID of a BSS. */ +typedef TBuf8 TWlanBssid; + +/** Data structure for storing a WEP key. */ +typedef TBuf8 TWlanWepKey; + +/** + * Data structure for storing either a WPA preshared key or passphrase. + * + * The WPA-PSK key can be represented either as a passphrase or as the + * actual preshared key. + * + * A passphrase can contain from 8 to 63 ASCII characters where each + * character MUST have a decimal encoding in the range of 32 to 126, + * inclusive. + * + * A preshared key is stored as 64 character hex string. + */ +typedef TBuf8 TWlanWpaPresharedKey; + +/** Values for possible WLAN connection states. */ +enum TWlanConnectionMode + { + /** No connection is active. */ + EWlanConnectionModeNotConnected, + /** Connection to an infrastructure network is active. */ + EWlanConnectionModeInfrastructure, + /** Connection to an ad-hoc network is active. */ + EWlanConnectionModeAdhoc, + /** Connection to a secure infrastructure network is active. */ + EWlanConnectionModeSecureInfra, + // Searching for an access point. No data flow. + EWlanConnectionModeSearching + }; + +/** Values for possible WLAN operating modes. */ +enum TWlanOperatingMode + { + /** Ad-hoc network. */ + EWlanOperatingModeAdhoc, + /** Infrastructure network. */ + EWlanOperatingModeInfrastructure + }; + +/** Values for possible WLAN connection security modes. */ +enum TWlanConnectionSecurityMode + { + /** Security mode open, i.e. no security. */ + EWlanConnectionSecurityOpen, + /** Security mode WEP. */ + EWlanConnectionSecurityWep, + /** Security mode 802d1x. */ + EWlanConnectionSecurity802d1x, + /** Security mode WPA. */ + EWlanConnectionSecurityWpa, + /** Security mode WPA PSK. */ + EWlanConnectionSecurityWpaPsk + }; + +/** + * Values for possible WLAN connection security modes. + * These are more detailed than TWlanConnectionSecurityMode. + */ +enum TWlanConnectionExtentedSecurityMode + { + /** Security mode open, i.e. no security. */ + EWlanConnectionExtentedSecurityModeOpen, + /** Security mode Open WEP. */ + EWlanConnectionExtentedSecurityModeWepOpen, + /** Security mode Shared WEP. */ + EWlanConnectionExtentedSecurityModeWepShared, + /** Security mode 802d1x. */ + EWlanConnectionExtentedSecurityMode802d1x, + /** Security mode WPA. */ + EWlanConnectionExtentedSecurityModeWpa, + /** Security mode WPA PSK. */ + EWlanConnectionExtentedSecurityModeWpaPsk, + /** Security mode WPA2. */ + EWlanConnectionExtentedSecurityModeWpa2, + /** Security mode WPA2 PSK. */ + EWlanConnectionExtentedSecurityModeWpa2Psk, + /** Security mode WAPI. */ + EWlanConnectionExtentedSecurityModeWapi, + /** Security mode WAPI PSK. */ + EWlanConnectionExtentedSecurityModeWapiPsk + }; + +/** Defines the possible values for IAP security mode. */ +enum TWlanIapSecurityMode + { + /** No encryption used. */ + EWlanIapSecurityModeAllowUnsecure, + /** Use WEP encryption with static keys. */ + EWlanIapSecurityModeWep, + /** Use WEP/TKIP/CCMP encryption, keys are negotiated by EAPOL. */ + EWlanIapSecurityMode802d1x, + /** Use TKIP/CCMP encryption, keys are negotiated by EAPOL. */ + EWlanIapSecurityModeWpa, + /** Use CCMP encryption, keys are negotiated by EAPOL. */ + EWlanIapSecurityModeWpa2Only, + }; + +/** Data values for RSS classes. */ +enum TWlanRssClass + { + /** Received signal level is 'normal'. */ + EWlanRssClassNormal, + /** Received signal level is 'weak'. */ + EWlanRssClassWeak + }; + +/** Enumeration of the possible default WEP keys. */ +enum TWlanDefaultWepKey + { + EWlanDefaultWepKey1, ///< Key number 1 + EWlanDefaultWepKey2, ///< Key number 2 + EWlanDefaultWepKey3, ///< Key number 3 + EWlanDefaultWepKey4 ///< Key number 4 + }; + +/** Enumeration of the possible authentication modes. */ +enum TWlanAuthenticationMode + { + EWlanAuthenticationModeOpen, ///< Open authentication + EWlanAuthenticationModeShared ///< Shared authentication + }; + +/** Enumaration for possible traffic stream statuses. */ +enum TWlanTrafficStreamStatus + { + /** + * The traffic stream is active in the current WLAN access point. + */ + EWlanTrafficStreamStatusActive, + /** + * The traffic stream is not active in the current WLAN access point + * because the AP doesn't require admission control. + */ + EWlanTrafficStreamStatusInactiveNotRequired, + /** + * The traffic stream is not active in the current WLAN access point + * because the AP has deleted the traffic stream. + */ + EWlanTrafficStreamStatusInactiveDeletedByAp, + /** + * The traffic stream is not active in the current WLAN access point + * because the AP has refused the traffic stream request due to + * insufficient over-the-air bandwidth. + */ + EWlanTrafficStreamStatusInactiveNoBandwidth, + /** + * The traffic stream is not active in the current WLAN access point + * because the AP has refused the traffic stream request due to + * invalid traffic stream parameters. + */ + EWlanTrafficStreamStatusInactiveInvalidParameters, + /** + * The traffic stream is not active in the current WLAN access point + * because the AP has refused the traffic stream request due to + * other reasons. + */ + EWlanTrafficStreamStatusInactiveOther + }; + +/** Enumeration for traffic stream direction. */ +enum TWlanTrafficStreamDirection + { + /** Admission is requested for uplink traffic. */ + EWlanTrafficStreamDirectionUplink, + /** Admission is requested for downlink traffic. */ + EWlanTrafficStreamDirectionDownlink, + /** Admission is requested for both uplink and downlink traffic. */ + EWlanTrafficStreamDirectionBidirectional + }; + +/** Enumeration for traffic stream traffic type. */ +enum TWlanTrafficStreamTrafficType + { + /** Traffic pattern is periodic,. */ + EWlanTrafficStreamTrafficTypePeriodic, + /** Traffic pattern is aperiodic or unspecified. */ + EWlanTrafficStreamTrafficTypeAperiodic + }; + +/** Defines the possible TX rate values. */ +enum TWlanRate + { + TWlanRateNone = 0x00000000, + TWlanRate1mbit = 0x00000001, + TWlanRate2mbit = 0x00000002, + TWlanRate5p5mbit = 0x00000004, + TWlanRate6mbit = 0x00000008, + TWlanRate9mbit = 0x00000010, + TWlanRate11mbit = 0x00000020, + TWlanRate12mbit = 0x00000040, + TWlanRate18mbit = 0x00000080, + TWlanRate22mbit = 0x00000100, + TWlanRate24mbit = 0x00000200, + TWlanRate33mbit = 0x00000400, + TWlanRate36mbit = 0x00000800, + TWlanRate48mbit = 0x00001000, + TWlanRate54mbit = 0x00002000 + }; + +/** Data structure for storing a Protected Setup credential attribute. */ +struct TWlanProtectedSetupCredentialAttribute + { + /** Operating mode of the network. */ + TWlanOperatingMode iOperatingMode; + /** Authentication mode of the network. */ + TWlanAuthenticationMode iAuthenticationMode; + /** Security mode of the network. */ + TWlanIapSecurityMode iSecurityMode; + /** Name of the network. */ + TWlanSsid iSsid; + /** WEP key number 1. */ + TWlanWepKey iWepKey1; + /** WEP key number 2. */ + TWlanWepKey iWepKey2; + /** WEP key number 3. */ + TWlanWepKey iWepKey3; + /** WEP key number 4. */ + TWlanWepKey iWepKey4; + /** The WEP key used by default. */ + TWlanDefaultWepKey iWepDefaultKey; + /** WPA preshared key. */ + TWlanWpaPresharedKey iWpaPreSharedKey; + }; + +// CLASS DECLARATION +/** + * Callback interface for WLAN management notifications. + * + * These virtual methods should be inherited and implemented by the + * client wanting to observe WLAN management events. + * + * The client has to enable notifications by calling the appropriate + * method from the management interface. + * @see MWlanMgmtInterface::ActivateNotificationsL. + * @see MWlanMgmtInterface::ActivateExtendedNotificationsL. + * @since S60 3.0 + */ +class MWlanMgmtNotifications + { + public: + + /** + * Connection state has changed. + * + * @since Callback interface v1 + * @param aNewState New connection state. + */ + virtual void ConnectionStateChanged( + TWlanConnectionMode /* aNewState */ ) {}; + + /** + * BSSID has changed (i.e. AP handover). + * + * @param aNewBSSID BSSID of the new access point. + * @since Callback interface v1 + */ + virtual void BssidChanged( + TWlanBssid& /* aNewBSSID */ ) {}; + + /** + * Connection has been lost. + * + * @since Callback interface v1 + */ + virtual void BssLost() {}; + + /** + * Connection has been regained. + * + * @since Callback interface v1 + */ + virtual void BssRegained() {}; + + /** + * New networks have been detected during scan. + * + * @since Callback interface v1 + */ + virtual void NewNetworksDetected() {}; + + /** + * One or more networks have been lost since the last scan. + * + * @since Callback interface v1 + */ + virtual void OldNetworksLost() {}; + + /** + * The used transmit power has been changed. + * + * @since Callback interface v1 + * @param aPower The transmit power in mW. + */ + virtual void TransmitPowerChanged( + TUint /* aPower */ ) {}; + + /** + * Received signal strength level has been changed. + * + * @since Callback interface v1 + * @param aRssClass specifies the current class of the received signal + * @param aRss RSS level in absolute dBm values. + */ + virtual void RssChanged( + TWlanRssClass /* aRssClass */, + TUint /* aRss */ ) {}; + + /** + * The status of a virtual traffic stream has changed. + * + * @since Callback interface v2 + * @param aStreamId ID of the traffic stream. + * @param aStreamStatus Status of the traffic stream. + */ + virtual void TrafficStreamStatusChanged( + TUint /* aStreamId */, + TWlanTrafficStreamStatus /* aStreamStatus */ ) {}; + + }; + +#endif // WLANMGMTCOMMON_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanmgmtinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,410 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom interface definition for WLAN management services. +* +*/ + +/* +* %version: 15 % +*/ + +#ifndef WLANMGMTINTERFACE_H +#define WLANMGMTINTERFACE_H + +// INCLUDES +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" +#include "wlantrafficstreamparameters.h" + +// CLASS DECLARATION +/** + * ECom interface class for WLAN management services. + * + * This class contains the methods for managing WLAN connections + * and querying the statuses of various connection variables. + * + * @since Series 60 3.0 + */ +class MWlanMgmtInterface + { + public: + + /** + * Activate the notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * + * @param aCallback The class that implements the callback interface. + * @note This method only activates notifications defined in callback interface v1. + * @see ActivateExtendedNotificationsL + */ + virtual void ActivateNotificationsL( + MWlanMgmtNotifications& aCallback ) = 0; + + /** + * Cancel the notification service. + */ + virtual void CancelNotifications() = 0; + + /** + * Perform a broadcast scan and return the detected WLAN networks. + * + * @param aResults Results of the scan. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetScanResults( + CWlanScanInfo& aResults ) = 0; + + /** + * Perform a broadcast scan and return the detected WLAN networks. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + virtual void GetScanResults( + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) = 0; + + /** + * Get the BSSID of the BSS currently connected to. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aBssid BSSID of the currently connected BSS. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionBssid( + TWlanBssid& aBssid ) = 0; + + /** + * Get the SSID of the WLAN network currently connected to. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aSsid SSID of the currently connected network. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionSsid( + TWlanSsid& aSsid ) = 0; + + /** + * Get the current Received Signal Strength Indicator (RSSI). + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aSignalQuality Current RSSI. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionSignalQuality( + TInt32& aSignalQuality ) = 0; + + /** + * Get the mode of the WLAN connection. + * + * @param aMode The current mode of the connection. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetConnectionMode( + TWlanConnectionMode& aMode ) = 0; + + /** + * Get the currently used security mode of the WLAN connection. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aMode The security mode of the connection. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + * @deprecated This method is offered for backward compatibility reasons, + * GetExtendedConnectionSecurityMode() should be used instead. + */ + virtual TInt GetConnectionSecurityMode( + TWlanConnectionSecurityMode& aMode ) = 0; + + /** + * Get the available WLAN IAPs. + * + * @param aAvailableIaps Array of IAP IDs available. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetAvailableIaps( + RArray& aAvailableIaps ) = 0; + + /** + * Get the available WLAN IAPs. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aAvailableIaps Array of IAP IDs available. + */ + virtual void GetAvailableIaps( + TRequestStatus& aStatus, + RArray& aAvailableIaps ) = 0; + + /** + * Notify the server about changed WLAN settings. + */ + virtual void NotifyChangedSettings() = 0; + + /** + * Adds a bssid to the blacklist + * + * @param aBssid The BSSID of the accesspoint. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt AddBssidToBlacklist( + const TWlanBssid& aBssid ) = 0; + + /** + * Updates the RSS notification class boundaries. + * + * @param aRssLevelBoundary Specifies the RSS level when a signal level notification + * should be given. This boundary is used when signal level + * is getting worse (see next parameter). + * @param aHysteresis Specifies the difference between RSS notification trigger levels + * of declining and improving signal quality, i.e. since aRssLevelBoundary + * specifies the level boundary for declining signal, the same boundary + * for improving signal is ( aRssLevelBoundary - aHysteresis ). + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt UpdateRssNotificationBoundary( + const TInt32 aRssLevelBoundary, + const TInt32 aHysteresis ) = 0; + + /** + * Perform a direct scan for an SSID and return the detected WLAN networks. + * If the SSID has zero length, a broadcast scan will be done. + * + * @param aSsid name of the WLAN network + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + virtual void GetScanResults( + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) = 0; + + /** + * Start Protected Setup. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aId Service ID of network which user has selected to be configured. + * @param aCredentials Results of a successful Protected Setup operation. + * @sa \link psetup Protected Setup-specific error codes \endlink. + */ + virtual void RunProtectedSetup( + TRequestStatus& aStatus, + TUint32 aId, + CArrayFixSeg& aCredentials ) = 0; + + /** + * Cancel an outstanding Protected Setup operation. + */ + virtual void CancelProtectedSetup() = 0; + + /** + * Cancel an outstanding scan request. + */ + virtual void CancelGetScanResults() = 0; + + /** + * Cancel an outstanding IAP availability request. + */ + virtual void CancelGetAvailableIaps() = 0; + + /** + * Perform a direct scan for an SSID and return the detected WLAN networks. + * If the SSID has zero length, a broadcast scan will be done. + * + * @param aCacheLifetime Defines how many seconds old cached results the client + * is willing to accept. The valid is range is from 0 to + * 60 seconds. The value of -1 means the system default will + * be used. The aCacheLifetime parameter has a meaning only + * when the aMaxDelay parameter is zero. + * Value will be changed to the actual value used by the + * system. + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the scan results. The valid range is from 0 to 1200 seconds + * or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay + * will never cause a scan, but the request will be + * completed when any other broadcast scan request is completed. + * Value will be changed to the actual value used by the system. + * @param aSsid Name of the WLAN network. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aResults Results of the scan. + */ + virtual void GetScanResults( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TWlanSsid& aSsid, + TRequestStatus& aStatus, + CWlanScanInfo& aResults ) = 0; + + /** + * Get the available WLAN IAPs. + * + * @param aCacheLifetime Defines how many seconds old cached results the client + * is willing to accept. The valid is range is from 0 to + * 60 seconds. The value of -1 means the system default will + * be used. The aCacheLifetime parameter has a meaning only + * when the aMaxDelay parameter is zero. + * Value will be changed to the actual value used by the + * system. + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the availability results. The valid range is from 0 to 1200 + * seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay + * will never cause a scan, but the request will be + * completed when any other broadcast scan request is completed. + * Value will be changed to the actual value used by the system. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aAvailableIaps Array of IAP IDs available. + */ + virtual void GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TRequestStatus& aStatus, + RArray& aAvailableIaps ) = 0; + + /** + * Add a list of SSIDs to the given IAP ID. + * + * The list of SSIDs is matched against the scan results during IAP availability + * check and the corresponding IAP marked as available if a match is found. + * + * @param aIapId IAP ID the list is attached to. + * @param aSsidList List of SSIDs. Any previous list attached will be overwritten. + * @return KErrNone if the list was successfully added, an error code otherwise. + */ + virtual TInt AddIapSsidList( + TUint aIapId, + const CArrayFixFlat& aSsidList ) = 0; + + /** + * Remove any list of SSIDs attached to the given IAP ID. + * + * @param aIapId IAP ID the list is attached to. + * @return KErrNone if the list was successfully removed, an error code otherwise. + */ + virtual TInt RemoveIapSsidList( + TUint aIapId ) = 0; + + /** + * Get the currently used security mode of the WLAN connection. + * + * @remark This method can only be used while successfully connected to + * a WLAN network. + * @param aMode The security mode of the connection. + * @return KErrNone if successful, otherwise one of the system-wide + * error codes. + */ + virtual TInt GetExtendedConnectionSecurityMode( + TWlanConnectionExtentedSecurityMode& aMode ) = 0; + + /** + * Activate the extended notification service. + * + * After the client has enabled the notification service, it can + * receive asynchronous notifications from the server. + * + * @param aCallback The class that implements the callback interface. + * @param aCallbackInterfaceVersion The callback interface version implemented by + * the client. This MUST NOT be touched. + */ + virtual void ActivateExtendedNotificationsL( + MWlanMgmtNotifications& aCallback, + TUint aCallbackInterfaceVersion = KWlanCallbackInterfaceVersion ) = 0; + + /** + * Create a virtual traffic stream. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aStreamParameters Traffic stream parameters to use. + * @param aStreamId Contains the ID assigned to this traffic stream + * on successful completion. + * @param aStreamStatus Contains the status of the traffic stream + * on successful completion. + */ + virtual void CreateTrafficStream( + TRequestStatus& aStatus, + const TWlanTrafficStreamParameters& aStreamParameters, + TUint& aStreamId, + TWlanTrafficStreamStatus& aStreamStatus ) = 0; + + /** + * Cancel an outstanding traffic stream creation request. + */ + virtual void CancelCreateTrafficStream() = 0; + + /** + * Delete a virtual traffic stream. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aStreamId ID of the traffic stream to delete. + */ + virtual void DeleteTrafficStream( + TRequestStatus& aStatus, + TUint aStreamId ) = 0; + + /** + * Cancel an outstanding traffic stream deletion request. + */ + virtual void CancelDeleteTrafficStream() = 0; + + /** + * Initiate a roam to the given BSSID. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aBssid BSSID to roam to. If set to FF:FF:FF:FF:FF:FF address, + * search for a better BSS is initiated. + */ + virtual void DirectedRoam( + TRequestStatus& aStatus, + const TWlanBssid& aBssid ) = 0; + + /** + * Cancel an outstanding directed roam request. + */ + virtual void CancelDirectedRoam() = 0; + + }; + +#endif // WLANMGMTINTERFACE_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanscaninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanscaninfo.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wrapper class for instantiating an implementation of +* MWlanScanInfoBase and MWlanScanInfoIteratorBase +* via ECom framework. +* +*/ + +/* +* %version: 9 % +*/ + +#ifndef WLANSCANINFO_H +#define WLANSCANINFO_H + +// INCLUDES +#include +#include "wlanscaninfointerface.h" + +// CLASS DECLARATION +/** + * @brief Class for instantiating an implementation of MWlanScanInfoBase + * and MWlanScanInfoIteratorBase via ECom. + * + * This class encapsulates both the WLAN scan results and methods + * needed for parsing and iterating through them. + * + * Scan results consist of a list of all the BSSs that the scan discovered + * and their parameters. Methods from MWlanScanInfoIteratorBase are used + * to iterate through list of BSSs. Parameters of an individual BSS are + * parsed with methods from MWlanScanInfoBase. + * + * An usage example: + * @code + * // scanInfo is a pointer to a CScanInfo object that contains results + * // from a scan. + * + * // Information Element ID for SSID as specified in 802.11. + * const TUint8 KWlan802Dot11SsidIE = 0; + * + * // Iterate through scan results. + * for( scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() ) + * { + * // Parse through BSS parameters. + * + * TWlanBssid bssid; + * scanInfo->Bssid( bssid ); + * // BSSID of the BSS is now stored in bssid. + * + * TUint8 ieLen( 0 ); + * const TUint8* ieData( NULL ); + * TInt ret = scanInfo->InformationElement( KWlan802Dot11SsidIE, ieLen, &ieData ); + * if ( ret == KErrNone ) + * { + * // ieData now points to the beginning of the 802.11 SSID payload data + * // (i.e. the header is bypassed). ieLen contains the length of payload + * // data. + * } + * } + * @endcode + * @see MWlanMgmtInterface::GetScanResults + * @since S60 3.0 + */ +class CWlanScanInfo : public CBase, public MWlanScanInfoBase, + public MWlanScanInfoIteratorBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + inline static CWlanScanInfo* NewL(); + + /** + * Destructor. + */ + inline virtual ~CWlanScanInfo(); + + private: // Data + + /** + * Identifies the instance of an implementation created by + * the ECOM framework. + */ + TUid iInstanceIdentifier; + }; + +#include "wlanscaninfo.inl" + +#endif // WLANSCANINFO_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanscaninfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanscaninfo.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of CWlanScanInfo class. +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef WLANSCANINFO_INL +#define WLANSCANINFO_INL + +// Static constructor. +inline CWlanScanInfo* CWlanScanInfo::NewL() + { + const TUid KCWlanScanInfoUid = { 0x101f8f01 }; + + TAny* interface = REComSession::CreateImplementationL( + KCWlanScanInfoUid, + _FOFF( CWlanScanInfo, + iInstanceIdentifier ) ); + return reinterpret_cast( interface ); + } + +// Destructor +inline CWlanScanInfo::~CWlanScanInfo() + { + REComSession::DestroyedImplementation( iInstanceIdentifier ); + } + +#endif // WLANSCANINFO_INL + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlanscaninfointerface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlanscaninfointerface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface definition for WLAN scan results. +* +*/ + +/* +* %version: 11 % +*/ + +#ifndef WLANSCANINFOINTERFACE_H +#define WLANSCANINFOINTERFACE_H + +// INCLUDES +#include "wlanmgmtcommon.h" + +// DATA TYPES +typedef TUint8 TWlanScanInfoFrame; + +// CLASS DECLARATION +/** + * @brief ECom interface class for WLAN scan results iterator. + * + * This class contains the methods for iterating through + * WLAN scan results. + * @since S60 3.0 + */ +class MWlanScanInfoIteratorBase + { + public: // Methods + + /** + * Return the size of the scan info. The size includes Status Info, + * MAC header and Frame Body. + * @return The size of the scan info in bytes. + */ + virtual TUint16 Size() const = 0; + + /** + * Find the data of the first access point. + * @return Pointer at the beginning of the first access point stored + * in the scan list. NULL if not any. + */ + virtual const TWlanScanInfoFrame* First() = 0; + + /** + * Find the data of the next access point. + * @return Pointer at the beginning of the next access point stored + * in the scan list. NULL if not any. + */ + virtual const TWlanScanInfoFrame* Next() = 0; + + /** + * Find the data of the current access point. + * @return Pointer at the beginning of the current access point stored + * in the scan list. NULL if not any. + */ + virtual const TWlanScanInfoFrame* Current() const = 0; + + /** + * Find is there any more unhandled access points. + * @return EFalse if there is access points in the list left, + * ETrue if not. + */ + virtual TBool IsDone() const = 0; + + }; + +/** + * @brief ECom interface class for WLAN scan results. + * + * This class contains the methods for parsing the scan results + * of a WLAN network. + * @since S60 3.0 + */ +class MWlanScanInfoBase + { + public: // Methods + + /** + * Return RX level of the BSS. + * @return RX level. + */ + virtual TUint8 RXLevel() const = 0; + + /** + * Return BSSID of the BSS. + * @param aBssid ID of the access point or IBSS network. + * @return Pointer to the beginning of the BSSID. Length is always 6 bytes. + */ + virtual void Bssid( + TWlanBssid& aBssid ) const = 0; + + /** + * Get beacon interval of the BSS. + * @return the beacon interval. + */ + virtual TUint16 BeaconInterval() const = 0; + + /** + * Get capability of the BSS (see IEEE 802.11 section 7.3.1.4. + * @return The capability information. + */ + virtual TUint16 Capability() const = 0; + + /** + * Get security mode of the BSS. + * @return security mode. + * @deprecated This method is offered for backward compatibility reasons, + * ExtendedSecurityMode() should be used instead. + */ + virtual TWlanConnectionSecurityMode SecurityMode() const = 0; + + /** + * Return requested information element. + * @param aIE Id of the requested IE data. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt InformationElement( + TUint8 aIE, + TUint8& aLength, + const TUint8** aData ) = 0; + + /** + * Return WPA information element. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt WpaIE( + TUint8& aLength, + const TUint8** aData ) = 0; + + /** + * Return the first information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt FirstIE( + TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) = 0; + + /** + * Return next information element. + * @param aIE Id of the IE. See IEEE 802.11 section 7.3.2. + * @param aLength Length of the IE. Zero if IE not found. + * @param aData Pointer to the beginning of the IE data. NULL if IE not found. + * @return General error message. + */ + virtual TInt NextIE( + TUint8& aIE, + TUint8& aLength, + const TUint8** aData ) = 0; + + /** + * Find whether Wi-Fi Protected Setup is supported. + * @return ETrue if AP supports Wi-Fi Protected Setup, + * EFalse if not. + */ + virtual TBool IsProtectedSetupSupported() = 0; + + /** + * Get security mode of the BSS. + * @return security mode. + */ + virtual TWlanConnectionExtentedSecurityMode ExtendedSecurityMode() const = 0; + + }; + +#endif // WLANSCANINFOINTERFACE_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlantrafficstreamparameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlantrafficstreamparameters.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parameter storage for a virtual traffic stream. +* +*/ + +/* +* %version: 1 % +*/ + +#ifndef WLANTRAFFICSTREAMPARAMETERS_H +#define WLANTRAFFICSTREAMPARAMETERS_H + +#include + +/** + * Parameter storage for a virtual traffic stream. + * + * This class is used to store the parameters of a virtual traffic stream. + * When instantiated, it sets all the parameters to the default values so + * the client application only needs to set the parameters it specifically + * wants to alter. + * + * Any parameter left to its default value means that the WLAN subsystem + * is free to select a suitable value. + */ +NONSHARABLE_CLASS( TWlanTrafficStreamParameters ) + { + +public: + + /** + * Bit definitions for parameters. + */ + enum TWlanParameter + { + EWlanParameterNone = 0x00000000, + EWlanParameterType = 0x00000001, + EWlanParameterId = 0x00000002, + EWlanParameterDirection = 0x00000004, + EWlanParameterNominalMsduSize = 0x00000008, + EWlanParameterMaximumMsduSize = 0x00000010, + EWlanParameterMinimumServiceInterval = 0x00000020, + EWlanParameterMaximumServiceInterval = 0x00000040, + EWlanParameterInactivityInterval = 0x00000080, + EWlanParameterSuspensionInterval = 0x00000100, + EWlanParameterServiceStartTime = 0x00000200, + EWlanParameterMinimumDataRate = 0x00000400, + EWlanParameterMeanDataRate = 0x00000800, + EWlanParameterPeakDataRate = 0x00001000, + EWlanParameterMaximumBurstSize = 0x00002000, + EWlanParameterDelayBound = 0x00004000, + EWlanParameterMinimumPhyRate = 0x00008000, + EWlanParameterNominalPhyRate = 0x00010000, + EWlanParameterSba = 0x00020000, + EWlanParameterIsRetryAllowed = 0x00040000 + }; + + /** + * Constructor. + * + * @param aUserPriority User Priority (0 - 7) admission is requested for. + */ + inline TWlanTrafficStreamParameters( + TUint8 aUserPriority ); + + /** + * Set the traffic pattern used. + * + * @param aType Traffic pattern used. + */ + inline void SetTrafficType( + TWlanTrafficStreamTrafficType aType ); + + /** + * Set the traffic stream ID used. + * + * @param aId Traffic Stream ID (0 - 7). + */ + inline void SetId( + TUint8 aId ); + + /** + * Set the traffic stream direction used. + * + * @param aDirection Traffic stream direction. + */ + inline void SetDirection( + TWlanTrafficStreamDirection aDirection ); + + /** + * Set the nominal MSDU size used. + * + * @param aMsduSize The nominal size of packets in bytes (0 - 0x7FFF). + * @param aIsMsduSizeFixed Whether the size of packets is fixed. + */ + inline void SetNominalMsduSize( + TUint16 aMsduSize, + TBool aIsMsduSizeFixed ); + + /** + * Set the maximum MSDU size used. + * + * @param aMsduSize The maximum size of packets in bytes (0 - 0xFFFF). + */ + inline void SetMaximumMsduSize( + TUint16 aMsduSize ); + + /** + * Set the minimum service interval used. + * + * @param aServiceInterval The minimum interval between packets in microseconds. + */ + inline void SetMinimumServiceInterval( + TUint32 aServiceInterval ); + + /** + * Set the maximum service interval used. + * + * @param aServiceInterval The maximum interval between packets in microseconds. + */ + inline void SetMaximumServiceInterval( + TUint32 aServiceInterval ); + + /** + * Set the inactivity interval used. + * + * @param aInactivityInterval The minimum amount of microseconds that may elapse + * without arrival or transfer of packets belonging + * to this traffic stream before the traffic stream + * is deleted. + */ + inline void SetInactivityInterval( + TUint32 aInactivityInterval ); + + /** + * Set the suspension interval used. + * + * @param aSuspensionInterval The minimum amount of microseconds that may elapse + * without arrival or transfer of packets belonging + * to this traffic stream before polling for the + * traffic stream is stopped. + */ + inline void SetSuspensionInterval( + TUint32 aSuspensionInterval ); + + /** + * Set the service start time used. + * + * @param aServiceStartTime The time in microseconds when the service period starts. + */ + inline void SetServiceStartTime( + TUint32 aServiceStartTime ); + + /** + * Set the minimum data rate used. + * + * @param aRate The lowest data rate in bits per second used for packets + * belonging to this traffic stream. + */ + inline void SetMinimumDataRate( + TUint32 aRate ); + + /** + * Set the average data rate used. + * + * @param aRate The average data rate in bits per second used for packets + * belonging to this traffic stream. + */ + inline void SetMeanDataRate( + TUint32 aRate ); + + /** + * Set the maximum data rate used. + * + * @param aRate The maximum data rate in bits per second used for packets + * belonging to this traffic stream. + */ + inline void SetPeakDataRate( + TUint32 aRate ); + + /** + * Set the maximum burst size used. + * + * @param aBurstSize The maximum burst in bytes that can arrive or be transmitted at + * the peak data rate. + */ + inline void SetMaximumBurstSize( + TUint32 aBurstSize ); + + /** + * Set the maximum transport delay used. + * + * @param aDelay The maximum amount of microseconds allowed to transport + * a packet belonging to this traffic stream. + */ + inline void SetDelayBound( + TUint32 aDelay ); + + /** + * Set the minimum WLAN data rate used. + * + * @param aRate The minimum WLAN data rate in bits per second used for + * this traffic stream. + */ + inline void SetMinimumPhyRate( + TWlanRate aRate ); + + /** + * Set the nominal WLAN data rate used. + * + * @param aRate The nominal WLAN data rate in bits per second used for + * this traffic stream. + */ + inline void SetNominalPhyRate( + TWlanRate aRate ); + + /** + * Set the SBA ratio used. + * + * @param aRatio The excess ratio of actual over-the-air bandwidth to + * ideal bandwidth used for transporting packets belonging + * to this traffic stream. + */ + inline void SetSba( + TUint16 aRatio ); + + /** + * Set the whether re-creation of traffic streams is allowed. + * + * @param aIsAllowed Whether re-creation of traffic streams that have been + * deleted or refused by the current WLAN access point + * can be automatically retried. + */ + inline void SetAutomaticRetry( + TBool aIsAllowed ); + +public: // data + + /** + * Bitmap of parameters that have been set. + */ + TUint32 iParameterBitmap; + + /** + * Traffic pattern used. + */ + TWlanTrafficStreamTrafficType iType; + /** + * Traffic stream ID used. + */ + TUint8 iId; + /** + * Traffic stream direction used. + */ + TWlanTrafficStreamDirection iDirection; + /** + * User Priority used. + */ + TUint8 iUserPriority; + /** + * Nominal MSDU size used. + */ + TUint16 iNominalMsduSize; + /** + * Whether the size of packets is fixed. + */ + TBool iIsMsduSizeFixed; + /** + * Maximum MSDU size used. + */ + TUint16 iMaximumMsduSize; + /** + * Minimum service interval used. + */ + TUint32 iMinimumServiceInterval; + /** + * Maximum service interval used. + */ + TUint32 iMaximumServiceInterval; + /** + * Inactivity interval used. + */ + TUint32 iInactivityInterval; + /** + * Suspension interval used. + */ + TUint32 iSuspensionInterval; + /** + * Service start time used. + */ + TUint32 iServiceStartTime; + /** + * Minimum data rate used. + */ + TUint32 iMinimumDataRate; + /** + * Average data rate used. + */ + TUint32 iMeanDataRate; + /** + * Maximum data rate used. + */ + TUint32 iPeakDataRate; + /** + * Maximum burst size used. + */ + TUint32 iMaximumBurstSize; + /** + * Maximum transport delay used. + */ + TUint32 iDelayBound; + /** + * Minimum WLAN data rate used. + */ + TWlanRate iMinimumPhyRate; + /** + * Nominal WLAN data rate used. + */ + TWlanRate iNominalPhyRate; + /** + * SBA ratio used. + */ + TUint16 iSba; + /** + * Whether re-creation of traffic streams is allowed. + */ + TBool iIsAutomaticRetryAllowed; + }; + +#include "wlantrafficstreamparameters.inl" + +#endif // WLANTRAFFICSTREAMPARAMETERS_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/inc/wlantrafficstreamparameters.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/inc/wlantrafficstreamparameters.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,242 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Parameter storage for a virtual traffic stream. +* +*/ + +/* +* %version: 1 % +*/ + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline TWlanTrafficStreamParameters::TWlanTrafficStreamParameters( + TUint8 aUserPriority ) : + iParameterBitmap( EWlanParameterNone ), + iType( EWlanTrafficStreamTrafficTypePeriodic), + iId( 0 ), + iDirection( EWlanTrafficStreamDirectionBidirectional ), + iUserPriority( aUserPriority ), + iNominalMsduSize( 0 ), + iIsMsduSizeFixed( EFalse ), + iMaximumMsduSize( 0 ), + iMinimumServiceInterval( 0 ), + iMaximumServiceInterval( 0 ), + iInactivityInterval( 0 ), + iSuspensionInterval( 0 ), + iServiceStartTime( 0 ), + iMinimumDataRate( 0 ), + iMeanDataRate( 0 ), + iPeakDataRate( 0 ), + iMaximumBurstSize( 0 ), + iDelayBound( 0 ), + iMinimumPhyRate( TWlanRateNone ), + iNominalPhyRate( TWlanRateNone ), + iSba( 0 ), + iIsAutomaticRetryAllowed( ETrue ) + { + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetTrafficType( + TWlanTrafficStreamTrafficType aType ) + { + iParameterBitmap |= EWlanParameterType; + iType = aType; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetId( + TUint8 aId ) + { + iParameterBitmap |= EWlanParameterId; + iId = aId; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetDirection( + TWlanTrafficStreamDirection aDirection ) + { + iParameterBitmap |= EWlanParameterDirection; + iDirection = aDirection; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetNominalMsduSize( + TUint16 aMsduSize, + TBool aIsMsduSizeFixed ) + { + iParameterBitmap |= EWlanParameterNominalMsduSize; + iNominalMsduSize = aMsduSize; + iIsMsduSizeFixed = aIsMsduSizeFixed; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMaximumMsduSize( + TUint16 aMsduSize ) + { + iParameterBitmap |= EWlanParameterMaximumMsduSize; + iMaximumMsduSize = aMsduSize; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMinimumServiceInterval( + TUint32 aServiceInterval ) + { + iParameterBitmap |= EWlanParameterMinimumServiceInterval; + iMinimumServiceInterval = aServiceInterval; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMaximumServiceInterval( + TUint32 aServiceInterval ) + { + iParameterBitmap |= EWlanParameterMaximumServiceInterval; + iMaximumServiceInterval = aServiceInterval; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetInactivityInterval( + TUint32 aInactivityInterval ) + { + iParameterBitmap |= EWlanParameterInactivityInterval; + iInactivityInterval = aInactivityInterval; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetSuspensionInterval( + TUint32 aSuspensionInterval ) + { + iParameterBitmap |= EWlanParameterSuspensionInterval; + iSuspensionInterval = aSuspensionInterval; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetServiceStartTime( + TUint32 aServiceStartTime ) + { + iParameterBitmap |= EWlanParameterServiceStartTime; + iServiceStartTime = aServiceStartTime; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMinimumDataRate( + TUint32 aRate ) + { + iParameterBitmap |= EWlanParameterMinimumDataRate; + iMinimumDataRate = aRate; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMeanDataRate( + TUint32 aRate ) + { + iParameterBitmap |= EWlanParameterMeanDataRate; + iMeanDataRate = aRate; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetPeakDataRate( + TUint32 aRate ) + { + iParameterBitmap |= EWlanParameterPeakDataRate; + iPeakDataRate = aRate; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMaximumBurstSize( + TUint32 aBurstSize ) + { + iParameterBitmap |= EWlanParameterMaximumBurstSize; + iMaximumBurstSize = aBurstSize; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetDelayBound( + TUint32 aDelay ) + { + iParameterBitmap |= EWlanParameterDelayBound; + iDelayBound = aDelay; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetMinimumPhyRate( + TWlanRate aRate ) + { + iParameterBitmap |= EWlanParameterMinimumPhyRate; + iMinimumPhyRate = aRate; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetNominalPhyRate( + TWlanRate aRate ) + { + iParameterBitmap |= EWlanParameterNominalPhyRate; + iNominalPhyRate = aRate; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetSba( + TUint16 aRatio ) + { + iParameterBitmap |= EWlanParameterSba; + iSba = aRatio; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +inline void TWlanTrafficStreamParameters::SetAutomaticRetry( + TBool aIsAllowed ) + { + iParameterBitmap |= EWlanParameterIsRetryAllowed; + iIsAutomaticRetryAllowed = aIsAllowed; + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_management_api/wlan_management_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_management_api/wlan_management_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN Management API + API for monitoring WLAN connections and scanning WLAN networks. + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* WLAN OSA API +* +*/ + +/* +* %version: 7 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanosaplatform.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanosaplatform.h) +../inc/wlandfc.h OS_LAYER_PLATFORM_EXPORT_PATH(wlandfc.h) +../inc/wlandfcclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlandfcclient.h) +../inc/wlanosa.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanosa.h) +../inc/wlanosaext.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanosaext.h) +../inc/wlantimer.h OS_LAYER_PLATFORM_EXPORT_PATH(wlantimer.h) +../inc/wlantimerclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlantimerclient.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlandfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlandfc.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DFC context interface declaration +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef M_WLANDFC_H +#define M_WLANDFC_H + +#include + +class MWlanDfcClient; + +/** + * DFC context interface declaration + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanDfc + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanDfc() {}; + + /** + * Enqueue a dfc for execution. + * Either succeeds or has no effect. + * Calling this method for allready queued dfc has no effect + * + * @since S60 v3.2 + * @param aDfcClient client interface + * @param aCtx context passed back in client callback + */ + virtual void Enqueue( MWlanDfcClient& aDfcClient, TInt aCtx ) = 0; + + /** + * Dequeue a queued dfc. + * Either succeeds or has no effect. + * Calling this method for non queued dfc has no effect + * + * @since S60 v3.2 + */ + virtual void Dequeue() = 0; + + }; + +#endif // M_WLANDFC_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlandfcclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlandfcclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: dfc client callback interface +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANDFCCLIENT_H +#define WLANDFCCLIENT_H + +#include + +/** + * dfc client callback interface + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanDfcClient + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanDfcClient() {}; + + /** + * dfc callback + * + * @since S60 v3.2 + * @param aCtx callback context + */ + virtual void OnDfc( TInt aCtx ) = 0; + + }; + + +#endif // WLANDFCCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlanosa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlanosa.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: osa interface declaration +* +*/ + +/* +* %version: 6 % +*/ + +#ifndef M_WLANOSA_H +#define M_WLANOSA_H + +#include + +class MWlanDfc; +class MWlanTimer; + +/** + * osa interface declaration + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanOsa + { + +public: + + /* basic trace levels masks */ + enum { KFatalLevel = 0x01 }; + enum { KErrorLevel = 0x02 }; + enum { KWarningLevel = 0x04 }; + enum { KInfoLevel = 0x08 }; + + /* masks for Alloc method */ + enum { KAllocZeroStampMask = 0x01 }; + + /* memory type identifier */ + enum TOsaMemoryType + { + /* for general purpose */ + ENormalMemory = 0, + /* DMA suitable memory to be used for accessing the WLAN device */ + EInterconnectMemory + }; + + /** + * Memory allocation. + * Correct alignment guaranteed + * + * @since S60 v3.2 + * @param aOsaMemoryType memory type to be allocated + * @param aSize size of the buffer to be allocated in bytes. Must be + * positive otherwise the allocation fails + * @param aFlags bitmask to fine-tune behavior of the allocation + * bit 0 - set: zero stamp allocated memory + * @return begin of the allocated memory, NULL upon failure + */ + virtual void* Alloc( TOsaMemoryType aOsaMemoryType, + TInt aSize, + TUint aFlags ) = 0; + + /** + * Releases memory allocated by the Alloc method + * + * @since S60 v3.2 + * @param aPtr begin of the buffer to be freed + */ + virtual void Free( void* aPtr ) = 0; + + /** + * Creates DFC context object + * + * @since S60 v3.2 + * @return DFC context object, NULL upon failure + */ + virtual MWlanDfc* DfcCreate() = 0; + + /** + * Destroys DFC context object + * + * @since S60 v3.2 + * @param aWlanDfc DFC context object to be destroyed + */ + virtual void DfcDestroy( MWlanDfc* aWlanDfc ) = 0; + + /** + * Creates timer context object + * + * @since S60 v3.2 + * @return timer context object, NULL upon failure + */ + virtual MWlanTimer* TimerCreate() = 0; + + /** + * Destroys timer context object + * + * @since S60 v3.2 + * @param aWlanTimer timer context object to be destroyed + */ + virtual void TimerDestroy( MWlanTimer* aWlanTimer ) = 0; + + /** + * Prints a formatted string to the debug port + * + * @since S60 v3.2 + * @param aLevelMask bitmask to define level of the trace + * @param aFmt a null terminated ANSI 8 bit printf format specifier. + * The format specifier dictates what arguments follow + * @param A list of arguments as defined by the aFmt specifier. + * This must not be longer than 256 characters + */ + static void FormattedPrint( TUint32 aLevelMask, + const TInt8* aFmt, + ... ); + + /** + * Dumps bytestream in hexadecimal format to the debug port + * + * @since S60 v3.2 + * @param aLevelMask bitmask to define level of the trace + * @param aData begin of the data + * @param aDataSize size of the data + */ + static void Dump( TUint32 aLevelMask, + const TInt8* aData, + TInt aDataSize ); + + /** + * Evaluates an boolean expression and executes an assertion, + * that stops the execution of the program, + * in case the evaluation yields to false + * + * @since S60 v3.2 + * @param aFile file name to be traced + * @param aLine line number to be traced + * @param aExpression expression to be evaluated + */ + static void Assert( const TInt8* aFile, + TInt aLine, + TBool aExpression = EFalse ); + + /** + * compares two memory buffers for equality + * The two buffers are considered equal only if + * the binary content of both buffers is the same. + * + * @since S60 v3.2 + * @param aLhs start address of the first buffer in the comparison + * @param aRhs start address of the second buffer in the comparison + * @param aNumOfBytes number of bytes to compare + * @return zero if both buffers are equal; non-zero, otherwise. + */ + static TInt MemCmp( const void* aLhs, const void* aRhs, TInt aNumOfBytes ); + + /** + * copies bytes in memory, target and source address can overlap + * + * @since S60 v3.2 + * @param aDest target address + * @param aSrc source address + * @param aLengthinBytes number of bytes to be moved + * @return target address + */ + static void* MemCpy( void* aDest, const void* aSrc, TUint aLengthinBytes ); + + /** + * copies bytes in memory, target and source address can overlap + * Assumes that the addresses are aligned on TInt boundaries, + * and that the aLengthinBytes value is a multiple of sizeof(TInt). + * + * @since S60 v3.2 + * @param aDest target address + * @param aSrc source address + * @param aLengthinBytes number of bytes to be moved + * @return target address + */ + static void* WordCpy( TInt* aDest, + const TInt* aSrc, + TUint aLengthinBytes ); + + /** + * sets the specified number of bytes to binary zero + * + * @since S60 v3.2 + * @param aDest target address + * @param aSrc source address + * @param aLengthinBytes number of bytes to be set + * @return target address + */ + static void* MemClr( void* aDest, TUint aLengthinBytes ); + + /** + * sets all of the specified number of bytes to the specified fill value + * + * @since S60 v3.2 + * @param aDest start address + * @param aValue fill value + * @param aCount number of bytes to be set + * @return start address + */ + static void* MemSet( void* aDest, TInt aValue, TUint aCount ); + + /** + * gets the current system time in microseconds + * + * @since S60 v3.2 + * @return current system time in microseconds + */ + static TInt64 Time(); + + /** + * busy-wait for a length of time specified by + * the param aWaitTimeInMicroSeconds + * + * @since S60 v3.2 + * @param aWaitTimeInMicroSeconds the + * length of time to wait in microseconds + */ + static void BusyWait( TUint aWaitTimeInMicroSeconds ); + + }; + +#endif // M_WLANOSA_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlanosaext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlanosaext.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: osaext interface declaration +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANOSAEXT_H +#define WLANOSAEXT_H + +#include + +/** + * wlanosa extension interface declaration + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanOsaExt + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanOsaExt() {}; + + /** + * Acquires the mutual exclusion lock of the WLAN subsystem + * + * @since S60 v3.2 + */ + virtual void MutexAcquire() = 0; + + /** + * Releases the mutual exclusion lock of the WLAN subsystem + * + * @since S60 v3.2 + */ + virtual void MutexRelease() = 0; + + }; + + +#endif // WLANOSAEXT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlanosaplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlanosaplatform.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes definitions/declarations which may be operating +* environment dependent. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANOSAPLATFORM_H +#define WLANOSAPLATFORM_H + +/** +* Note! This file includes definitions/declarations which may be +* operating environment dependent. +*/ + +/** A string literal containing the name of the source file being compiled */ +#ifndef WLAN_FILE +#define WLAN_FILE __FILE__ +#endif // WLAN_FILE + +#endif // WLANOSAPLATFORM_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlantimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlantimer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: timer context interface declaration +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef M_WLANTIMER_H +#define M_WLANTIMER_H + +#include + +class MWlanTimerClient; + +/** + * timer context interface declaration + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanTimer + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanTimer() {}; + + /** + * Enqueue a timeout for execution. + * Either succeeds or has no effect. + * Calling this method for allready queued timeout has no effect + * + * @since S60 v3.2 + * @param aTimerClient timer client + * @param aCtx context for timer client callback + * @param aTimeoutInMicroSeconds timeout in microseconds + * @param aPeriodic periodic timer or not + */ + virtual void Enqueue( + MWlanTimerClient& aTimerClient, + TInt aCtx, + TInt aTimeoutInMicroSeconds, + TBool aPeriodic ) = 0; + + /** + * Dequeue a queued timeout. + * Either succeeds or has no effect. + * Calling this method for non queued timeout has no effect + * + * @since S60 v3.2 + */ + virtual void Dequeue() = 0; + }; + +#endif // M_WLANTIMER_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/inc/wlantimerclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/inc/wlantimerclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: timer client callback interface +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANTIMERCLIENT_H +#define WLANTIMERCLIENT_H + +#include + +/** + * timer client callback interface + * + * + * @lib wlanosa.lib + * @since S60 v3.2 + */ +class MWlanTimerClient + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanTimerClient() {}; + + /** + * timer callback + * + * @since S60 v3.2 + * @param aCtx callback context + */ + virtual void OnTimeout( TInt aCtx ) = 0; + + }; + + +#endif // WLANTIMERCLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_osa_api/wlan_osa_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_osa_api/wlan_osa_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,14 @@ + + +WLAN OSA API +WLAN OS Abstraction API +c++ +wlan_bearer + + + + +no +no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_power_save_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_power_save_plugin_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN Power Save Plugin API +* +*/ + +/* +* %version: tr1cfwln#5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanpowersaveinterface.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanpowersaveinterface.h) diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_power_save_plugin_api/inc/wlanpowersaveinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_power_save_plugin_api/inc/wlanpowersaveinterface.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines the interface that powersave plugins have to implement +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANPOWERSAVEINTERFACE_H +#define WLANPOWERSAVEINTERFACE_H + +/** The possible WLAN power save modes. */ +enum TWlanPowerSave + { + /** Allow the WLAN engine to decide the mode. */ + EWlanPowerSaveAutomatic, + /** Use a light power save mode. */ + EWlanPowerSaveLight, + /** Use a deeper power save mode. */ + EWlanPowerSaveDeep, + /** Disable power save completely. */ + EWlanPowerSaveNone + }; + +/** +* Callback interface for adjusting the WLAN power save mode. +* +* This interface allows an ECom plugin implementing MWlanPowerSaveInterface +* to adjust the WLAN power save mode. These callbacks are implemented by the +* WLAN engine. +* +* @note The mode will stay until it is changed or the device is booted. +* @note If power save has been disabled from the WLAN settings, this +* setting has no effect. +* +* @lib wlmserversrv.dll +* @since Series 60 3.0 +*/ +class MWlanPowerSaveCallback + { + public: // New functions + + /** + * Set the WLAN power save mode. + * @since Series 60 3.0 + * @param aMode The power save mode to set. + * @return A Symbian error code. + */ + virtual TInt SetPowerSaveMode( + TWlanPowerSave aMode ) = 0; + }; + +#endif // WLANPOWERSAVEINTERFACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_power_save_plugin_api/wlan_power_save_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_power_save_plugin_api/wlan_power_save_plugin_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN Power Save Plugin API + An adaptation API for a WLAN power save controller plugin module. + c++ + wlan_bearer + + + + + + + + yes + no + + diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* WLAN SPIA API +* +*/ + +/* +* %version: 5 % +*/ + +#if defined(RD_WLAN_DDK) + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlanhwbusaccesslayer.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanhwbusaccesslayer.h) +../inc/wlanspia.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanspia.h) +../inc/wlanspia.inl OS_LAYER_PLATFORM_EXPORT_PATH(wlanspia.inl) +../inc/wlanspiaclient.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanspiaclient.h) +../inc/wlanspianamespace.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanspianamespace.h) +../inc/wlanspiatypes.h OS_LAYER_PLATFORM_EXPORT_PATH(wlanspiatypes.h) + +#endif diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/inc/wlanhwbusaccesslayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/inc/wlanhwbusaccesslayer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: file holds SPIA specific type definitions +* +*/ + +/* +* %version: 4 % +*/ + +#ifndef WLANHWBUSACCESSLAYER_H +#define WLANHWBUSACCESSLAYER_H + +#include + +class WlanSpia; + +/** + * + * + * + * @lib wlanpdd.pdd + * @since S60 v3.2 + */ +struct SHwBusAccessLayer + { + WlanSpia* iSpia; + + SHwBusAccessLayer() : iSpia( NULL ) {}; + +private: + + // Prohibit copy constructor. + SHwBusAccessLayer( const SHwBusAccessLayer& ); + // Prohibit assigment operator. + SHwBusAccessLayer& operator= ( const SHwBusAccessLayer& ); + }; + +#endif // WLANHWBUSACCESSLAYER_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/inc/wlanspia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/inc/wlanspia.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,326 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: spia interface declaration +* +*/ + +/* +* %version: 7 % +*/ + +#ifndef WLANSPIA_H +#define WLANSPIA_H + +class MWlanSpiaClient; +class MWlanOsaExt; + +#include + +/** + * spia interface declaration + * + * + * @lib wlanpdd.pdd + * @since S60 v3.2 + */ +class WlanSpia + { + +public: + + typedef TInt TRequestId; + + /* SPI transfer clock speed. The closest one is selected if the + * exact clock frequency cannot be achieved. + * The closest is always less than the requested frequency.*/ + enum TClockSpeed + { + EClk1_5MHz = 0, + EClk3MHz, + EClk6MHz, + EClk12MHz, + EClk24MHz, + EClk48MHz, + EClk96MHz + }; + + /* SPI clock modes used for transfer. + Next picture shows what different configuration values means. + + ,--> Sampling + | ,> Shift out + | | + high/rising ______|¯|_|¯|_|¯|_ (mode 0) + + high/falling ____|¯|_|¯|_|¯|_|¯ (mode 1) + + low/falling ¯¯¯¯¯¯|_|¯|_|¯|_|¯ (mode 2) + + low/rising ¯¯¯¯|_|¯|_|¯|_|¯|_ (mode 3) + */ + enum TClockMode + { + /* SPI clock active high, sampling occurs on the rising edge */ + EPolarityHighRisingEdge = 0, + /* SPI clock active high, sampling occurs on the falling edge */ + EPolarityHighFallingEdge, + /* SPI clock active low, sampling occurs on the falling edge */ + EPolarityLowFallingEdge, + /* SPI clock active low, sampling occurs on the rising edge */ + EPolarityLowRisingEdge + }; + + /* SPI slave select signal polarity used for transfer */ + enum TSsPolarity + { + /** SS is held \e high during the active state */ + ESsPolarityHigh = 0, + /** SS is held \e low during the active state */ + ESsPolarityLow + }; + + /* SPI read mode, used when reading is done */ + enum TReadMode + { + /* normal read from SPI slave device + * (i.e no write involved for this call) */ + ENormalRead = 0, + /* write buffer is written completely + * before the read operation is done */ + EWriteB4Read, + /* full duplex mode + * Tx and Rx are done at same time + * NOTE: Tx and Rx buffers must not overlap and must be of equal size */ + ECombinedWriteRead + }; + + struct TConfig + { + /* SPI clock mode */ + TClockMode iSpiaClockMode; + /* SPI slave select signal polarity */ + TSsPolarity iSpiaSsPolarity; + /* number of bytes per frame in tx */ + TUint8 iTxBytesPerFrame; + /* number of bytes per frame in rx */ + TUint8 iRxBytsPerFrame; + }; + + /* SPI slave select mode */ + enum TSsMode + { + /* slave select is active during the whole SPI request operation */ + EForcedActive = 0, + /* slave select is toggled on SPI frame basis during the whole SPI request */ + EFrameControlled + }; + + struct TCapabilities + { + /* bit 0 - memory config support: + * bit clear non cached memory supported, bit set cached memory supported + * default value is cleared + * bit 1 - ENormalRead support in TReadMode: bit set when supported + * bit 2 - EWriteB4Read support in TReadMode: bit set when supported + * bit 3 - ECombinedWriteRead support in TReadMode: bit set when supported + * bit 4 - EForcedActive support in TSsMode: bit set when supported + * bit 5 - EFrameControlled in TSsMode: bit set when supported */ + TUint32 iCapability; + /* Length of the memory cache line in bytes (needed for buffer alignment) */ + TUint32 iCacheLineLength; + /* DMA threshold for SPI operations */ + TUint32 iDMAThreshold; + }; + + /* SPIA request structure */ + struct TRequest + { + /* tx buffer. Buffer length must be multiple of sizeof(TInt) */ + const TUint8* iTxBuffer; + /* amount of data to transmit in the tx buffer in bytes */ + TUint iTxBufferSize; + /* rx buffer. Buffer length must be multiple of sizeof(TInt) */ + TUint8* iRxBuffer; + /* amount of data to read to the rx buffer in bytes */ + TUint iRxBufferSize; + /* read operation type */ + TReadMode iReadMode; + /* complete callback method client to be called after + * the request has completed */ + MWlanSpiaClient* iRequestClient; + /* unique request ID passed back to client as + * is in SPIA request callback */ + TRequestId iRequestId; + /* SPI transfer clock speed. + * The closest one is selected if exact clock frequency + * can not be achieved. The closest is always less + * than the requested frequency. */ + TClockSpeed iSpiaClockSpeed; + /* last request or not for a while, a hint for power management + * ETrue upon last request, any other not */ + TBool iLastRequest; + /* SPI slave select mode used */ + TSsMode iSsMode; + }; + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~WlanSpia() {}; + + /** + * Create spia layer object + * + * @since S60 v3.2 + * @param aOsaExt osa extension object + * @return spia layer object, NULL upon failure + * @deprecated Create() and Attach( MWlanOsaExt& ) should be used instead + */ + static WlanSpia* Create( MWlanOsaExt& aOsaExt ); + + /** + * Create spia layer object + * + * @since S60 v3.2 + * @return spia layer object, NULL upon failure + */ + static WlanSpia* Create(); + + /** + * Attach the OSA extension object + * + * @since S60 v3.2 + * @param aOsaExt osa extension object + */ + void Attach( MWlanOsaExt& aOsaExt ); + + /** + * Destroy spia layer object + * + * @since S60 v3.2 + * @param aWlanSpia spia layer object + */ + static void Destroy( WlanSpia* aWlanSpia ); + + /** + * Extract module capabilities + * + * @since S60 v3.2 + * @param aCapabilities capabilities of the module + */ + virtual void Capability( TCapabilities& aCapabilities ) { aCapabilities.iCapability = 0; } + + /** + * Configures the SPI HW block + * + * @since S60 v3.2 + * @param aConfig SPI configuration data + */ + virtual void Configure( const TConfig& aConfig ) = 0; + + /** + * Issues SPIA request + * + * NOTE: the request must remain valid until operation completes + * (either synchronously or asynchronously by completion callback). + * It is guaranteed by the system that no SPIA request complete callback + * gets called during this call + * + * @since S60 v3.2 + * @param aRequest request to execute + * @return status of the operation + * ESuccess - request was accepted for asynchronous + * excecution and will complete at a later time. + * Request completion is notified by + * SPIA request complete callback. + * SPIA user is allowed to issue additional + * requests + * + * EFailure - request was not accepted as it failed due + * unspecified reason. + * SPIA request complete callback is not called + * + * ESuccessXfer - request was accepted and completed + * synchronously inside the SPIA. + * SPIA request complete callback is not called. + * SPIA user is allowed to issue additional + * requests + * + * EPending - request was accepted for asynchronous + * excecution and will complete at later time. + * Request completion is notified by + * SPIA request complete callback. + * SPIA user is NOT allowed to issue additional + * requests until SPIA request complete callback is called + */ + virtual SPIA::TStatus Request( const TRequest& aRequest ) = 0; + + /** + * Cancels a pending SPIA request. Either succeeds or has no effect + * + * NOTE: it is guaranteed by the system that no SPIA request complete callback + * gets called during this call + * + * @since S60 v3.2 + * @param aRequestId request ID that identifies the SPIA request to cancel + * @return status of the operation + * ESuccess - operation success. + * SPIA request was cancelled and no SPIA request + * complete callback gets executed for the request + * that was cancelled + * + * + * EFailure - the request is in use and can not be cancelled. + */ + virtual SPIA::TStatus Cancel( TRequestId aRequestId ) = 0; + +protected: + + /** + * Constructor + * + * @since S60 v3.2 + */ + explicit WlanSpia() : iOsaExt( NULL ) {} + + /** + * Constructor + * + * @since S60 v3.2 + * @param aOsaExt osa extension object + */ + explicit WlanSpia( MWlanOsaExt& aOsaExt ) : iOsaExt( &aOsaExt ) {} + + /** + * Extract osa extension + * + * @since S60 v3.2 + * @return osa extension + */ + inline MWlanOsaExt& OsaExtCb(); + +private: + + /** + * osa extension + */ + MWlanOsaExt* iOsaExt; + + }; + +#include + +#endif // WLANSPIA_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/inc/wlanspia.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/inc/wlanspia.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: inline implementation of WlanSpia +* +*/ + +/* +* %version: 4 % +*/ + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +inline MWlanOsaExt& WlanSpia::OsaExtCb() + { + return *iOsaExt; + } + +inline void WlanSpia::Attach( MWlanOsaExt& aOsaExt ) + { + iOsaExt = &aOsaExt; + } diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/inc/wlanspiaclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/inc/wlanspiaclient.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: spia client callback interface +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANSPIACLIENT_H +#define WLANSPIACLIENT_H + +#include + +/** + * spia client callback interface + * + * + * @lib wlanpdd.pdd + * @since S60 v3.2 + */ +class MWlanSpiaClient + { + +public: + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~MWlanSpiaClient() {}; + + /** + * spia request complete callback, + * resources associated to the request can be freed in this method + * + * NOTE: the callback client may call back in the same context + * + * @since S60 v3.2 + * @param aRequestId request ID + * @param aStatus status of the operation + * ESuccess - request completed successfully + * EFailure - request failed due unspecified reason. + */ + virtual void OnRequestComplete( WlanSpia::TRequestId aRequestId, + SPIA::TStatus aStatus ) = 0; + + }; + + +#endif // WLANSPIACLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/inc/wlanspianamespace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/inc/wlanspianamespace.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: defines SPIA namespace +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef SPIANAMESPACE_H +#define SPIANAMESPACE_H + +#define SPIA WlanSpiaNameSpace +#define NAMESPACE_BEGIN_SPIA namespace WlanSpiaNameSpace { +#define NAMESPACE_END_SPIA } + +#endif // SPIANAMESPACE_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/inc/wlanspiatypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/inc/wlanspiatypes.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: file holds SPIA specific type definitions +* +*/ + +/* +* %version: 5 % +*/ + +#ifndef WLANSPIATYPES_H +#define WLANSPIATYPES_H + +#include +#include + +NAMESPACE_BEGIN_SPIA + +enum TStatus + { + ESuccess = 0, + EFailure, + ESuccessXfer, + EPending + }; + +const TUint32 KCapabilityMemoryConfig = ( 1 << 0 ); +const TUint32 KCapabilityNormalRead = ( 1 << 1 ); +const TUint32 KCapabilityWriteB4Read = ( 1 << 2 ); +const TUint32 KCapabilityCombinedWriteRead = ( 1 << 3 ); +const TUint32 KCapabilityForcedActive = ( 1 << 4 ); +const TUint32 KCapabilityFrameControlled = ( 1 << 5 ); + +NAMESPACE_END_SPIA + +#endif // WLANSPIACLIENT_H diff -r 000000000000 -r c40eb8fe8501 wlan_plat/wlan_spia_api/wlan_spia_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_plat/wlan_spia_api/wlan_spia_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,13 @@ + + +WLAN SPIA API +WLAN SPI Abstraction API +c++ +wlan_bearer + + + +no +no + + diff -r 000000000000 -r c40eb8fe8501 wlan_pub/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_pub/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes all the SDK API specific bld.inf files, which +* export files. +* +*/ + +/* +* %version: 3 % +*/ + +#include "../wlan_sdk_info_api/group/bld.inf" diff -r 000000000000 -r c40eb8fe8501 wlan_pub/wlan_sdk_info_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_pub/wlan_sdk_info_api/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: WLAN SDK Info API +* +*/ + +/* +* %version: 5 % +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/wlansdkpskeys.h OS_LAYER_PUBLIC_EXPORT_PATH(wlansdkpskeys.h) diff -r 000000000000 -r c40eb8fe8501 wlan_pub/wlan_sdk_info_api/inc/wlansdkpskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_pub/wlan_sdk_info_api/inc/wlansdkpskeys.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: WLAN event enumerations and uid:s for Publish And Subscribe. +* PubSub clients can include this file and listen to these events. +* These events will be routed through Publish And Subscribe. +* +*/ + +/* +* %version: 3 % +*/ + +#ifndef WLANSDKPSKEYS_H +#define WLANSDKPSKEYS_H + +#include + + +/** +* P&S category WLAN information +*/ +const TUid KPSUidWlan = { 0x101f8ec5 }; + + +/** +* WLAN MAC address +* The MAC address array consists of 6 consecutive bytes which can be used +* to produce the address in format XX:XX:XX:XX:XX:XX +*/ +const TUint KPSWlanMacAddress = 0x00000001; +const RProperty::TType KPSWlanMacAddressType = RProperty::EByteArray; + +/** +* Length of the MAC address array +*/ +const TUint KPSWlanMacAddressLength = 6; + +#endif // WLANSDKPSKEYS_H + +// End of File diff -r 000000000000 -r c40eb8fe8501 wlan_pub/wlan_sdk_info_api/wlan_sdk_info_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlan_pub/wlan_sdk_info_api/wlan_sdk_info_api.metaxml Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ + + + WLAN SDK Info API + P&S interface that provides miscellaneous WLAN information. + c++ + wlan_bearer + + + + + + + + no + no + + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/common/inc/DataWrapperBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/common/inc/DataWrapperBase.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef DATA_WRAPPER_BASE_H +#define DATA_WRAPPER_BASE_H + +// EPOC includes +#include +#define SECS_TO_MS(x) (x*1000000) + +_LIT(KConsname, "Test Console"); + +class CDataWrapperBase : public CDataWrapper + { +public: + class TEnumEntryTable + { + public: + const TDesC& iString; + TInt iValue; + }; + +public: + TBool GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult); + TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult); + TBool GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult); + TBool GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult); + TBool GetUintFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aResult); + TBool KeyPress(); + void Timedelay(TInt aTimeoutInSecs); + virtual void InitialiseL(); + inline RFs& FileServer() { return iFs; } + inline CConsoleBase* GetConsole() { return(Console::NewL(KConsname,TSize(KConsFullScreen,KConsFullScreen)));} + void GetValidationBool(const TDesC& aSection, TInt aValue, TBool aForceValidation, const TDesC& aErrorMessage); + void GetValidationInt(const TDesC& aSection, TInt aValue, TBool aForceValidation, const TDesC& aErrorMessage); + void GetValidationUint(const TDesC& aSection, TInt aValue, TBool aForceValidation, const TDesC& aErrorMessage); + TBool GetArrayFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray& aResult); + TBool GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult); + +protected: + CDataWrapperBase(); + virtual ~CDataWrapperBase(); + +private: + TBool GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult); + TBool KeyCheck(); + +private: + // Included ini files + RPointerArray iInclude; + RPointerArray iBuffer; + RFs iFs; + RTimer iTimer; + }; + +#endif // DATA_WRAPPER_BASE_H diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/common/src/DataWrapperBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/common/src/DataWrapperBase.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,517 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "datawrapperbase.h" + +/*@{*/ +/// Constant Literals used. +_LIT(KPrefixHex, "0x"); +_LIT(KPrefixOctal, "0"); +_LIT(KSuffixBinary, "b"); + +_LIT(KIncludeSection, "include"); +_LIT(KFile, "file%d"); +_LIT(KMatch, "*{*,*}*"); +_LIT(KStart, "{"); +_LIT(KSeparator, ","); +_LIT(KEnd, "}"); +_LIT(KDataRead, "INI READ : %S %S %S"); +_LIT(KLogMissingParameter, "Missing parameter '%S'"); +_LIT(KExpected, "expected"); +/*@}*/ + +CDataWrapperBase::CDataWrapperBase() +: CDataWrapper() + { + } + +/** + * Public destructor + */ +CDataWrapperBase::~CDataWrapperBase() + { + iInclude.ResetAndDestroy(); + iBuffer.ResetAndDestroy(); + iFs.Close(); + } + +void CDataWrapperBase::InitialiseL() + { + iTimer.CreateLocal(); + CDataWrapper::InitialiseL(); + TBuf tempStore; + TPtrC fileName; + TBool moreData=ETrue; + TBool index=0; + while ( moreData ) + { + tempStore.Format(KFile(), ++index); + moreData=GetStringFromConfig(KIncludeSection, tempStore, fileName); + + if (moreData) + { + CIniData* iniData=CIniData::NewL(fileName); + CleanupStack::PushL(iniData); + iInclude.Append(iniData); + CleanupStack::Pop(iniData); + } + } + User::LeaveIfError(iFs.Connect()); + } + +/** + * Reads the value present from the test steps ini file within the mentioned section name and key name + * Copies the value to the TBool reference passed in possible values TRUE, FALSE + * @param aSectName - Section within the test steps ini file + * @param aKeyName - Name of a key within a section + * @return aResult - The value of the boolean + * @return TBool - ETrue for found, EFalse for not found + */ +TBool CDataWrapperBase::GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult) + { + TBool ret=EFalse; + TPtrC result; + TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); + if ( err != KErrNone ) + { + ret=EFalse; + } + if ( ret ) + { + _LIT(KTrue,"true"); + aResult=(result.FindF(KTrue) != KErrNotFound); + } + + return ret; + } + +/** + * Reads the value present from the test steps ini file within the mentioned section name and key name + * Copies the value to the TInt reference passed in + * @param aSectName - Section within the test steps ini file + * @param aKeyName - Name of a key within a section + * @return aResult - The value of the integer + * @return TBool - ETrue for found, EFalse for not found + */ +TBool CDataWrapperBase::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) + { + TPtrC result; + TBool ret=EFalse; + TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); + if ( err != KErrNone ) + { + ret=EFalse; + } + if ( ret ) + { + TLex lex(result); + ret=(lex.Val(aResult)==KErrNone); + } + + return ret; + } + +/** + * Reads the value present from the test steps ini file within the mentioned section name and key name + * Copies the value to the TPtrC reference passed in + * @param aSectName - Section within the test steps ini file + * @param aKeyName - Name of a key within a section + * @return aResult - Reference to the string on the heap + * @return TBool - ETrue for found, EFalse for not found + */ +TBool CDataWrapperBase::GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) + { + TBool ret=EFalse; + TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, aResult)); + if ( err != KErrNone ) + { + ret=EFalse; + } + return ret; + } + +/** + * Reads the value present from the test steps ini file within the mentioned section name and key name + * Copies the value to the TInt reference passed in. The value can optionally be prefixed with 0x + * @param aSectName - Section within the test steps ini file + * @param aKeyName - Name of a key within a section + * @return aResult - The integer value of the Hex input + * @return TBool - ETrue for found, EFalse for not found + */ +TBool CDataWrapperBase::GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) + { + TPtrC result; + TBool ret=EFalse; + TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); + if ( err != KErrNone ) + { + ret=EFalse; + } + if ( ret ) + { + TLex lex; + if( result.FindC(KPrefixHex)==KErrNone ) + { + lex=result.Mid(KPrefixHex().Length()); + } + else + { + lex=result; + } + ret=(lex.Val((TUint &)aResult, EHex)==KErrNone); + } + + return ret; + } + +/** + * Reads the value present from the test steps ini file within the mentioned section name and key name + * Copies the value to the TUint reference passed in. + * If the value is prefixed with 0x the value is read as a hexadecimal value + * If the value is suffixed with b the value is read as a binary value + * If the value is prefixed with a 0 the value is read as an octal value + * If it does not match the above it is read in as an integer + * @param aSectName - Section within the test steps ini file + * @param aKeyName - Name of a key within a section + * @return aResult - The integer value of the Hex input + * @return TBool - ETrue for found, EFalse for not found + */ +TBool CDataWrapperBase::GetUintFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aResult) + { + TPtrC result; + TBool ret=EFalse; + TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); + if ( err != KErrNone ) + { + ret=EFalse; + } + if ( ret ) + { + TLex lex(result); + if( result.FindC(KPrefixHex)==KErrNone ) + { + lex=result.Mid(KPrefixHex().Length()); + ret=(lex.Val(aResult, EHex)==KErrNone); + } + else + { + TInt binarySuffixPosition=result.Length()-KSuffixBinary().Length(); + if ( result.FindC(KSuffixBinary)==binarySuffixPosition ) + { + lex=result.Left(binarySuffixPosition); + ret=(lex.Val(aResult, EBinary)==KErrNone); + } + else + { + if( result.FindC(KPrefixOctal)==KErrNone ) + { + ret=(lex.Val(aResult, EOctal)==KErrNone); + } + else + { + TInt intResult; + ret=(lex.Val(intResult)==KErrNone); + if ( ret ) + { + aResult=(TUint)intResult; + } + } + } + } + } + + return ret; + } + +TBool CDataWrapperBase::GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) + { + TBool ret=EFalse; + + if ( aSectName.Length()!=0 ) + { + ret=CDataWrapper::GetStringFromConfig(aSectName, aKeyName, aResult); + + for ( TInt index=iInclude.Count(); (index>0) && (!ret); ) + { + ret=iInclude[--index]->FindVar(aSectName, aKeyName, aResult); + } + } + + if ( ret ) + { + if ( aResult.Match(KMatch)!=KErrNotFound ) + { + // We have an entry of the format + // entry =*{section,entry}* + // where * is one or more characters + // We need to construct this from other data in the ini file replacing {*,*} + // with the data from + // [section] + // entry =some_value + HBufC* buffer=HBufC::NewLC(aResult.Length()); + buffer->Des().Copy(aResult); + + TInt startLength=KStart().Length(); + TInt sparatorLength=KSeparator().Length(); + TInt endLength=KEnd().Length(); + TInt bufferLength; + TInt start; + TInt sparator; + TInt end; + TPtrC remaining; + TLex lex; + do + { + bufferLength=buffer->Length(); + start=buffer->Find(KStart); + + remaining.Set(buffer->Des().Right(bufferLength-start-startLength)); + sparator=remaining.Find(KSeparator); + remaining.Set(remaining.Right(remaining.Length()-sparator-sparatorLength)); + sparator += (start + startLength); + + end=remaining.Find(KEnd) + sparator + sparatorLength; + + TPtrC sectionName(buffer->Ptr()+start+startLength, sparator-start-startLength); + TPtrC keyName(buffer->Ptr()+sparator+sparatorLength, end-sparator-sparatorLength); + sectionName.Set(TLex(sectionName).NextToken()); + keyName.Set(TLex(keyName).NextToken()); + + TInt entrySize=0; + TPtrC entryData; + TBool found=CDataWrapper::GetStringFromConfig(sectionName, keyName, entryData); + for ( TInt index=iInclude.Count(); (index>0) && (!found); ) + { + found=iInclude[--index]->FindVar(sectionName, keyName, entryData); + } + if ( found ) + { + entrySize=entryData.Length(); + } + + TInt newLength=start + bufferLength - end - endLength + entrySize; + HBufC* bufferNew=HBufC::NewLC(newLength); + bufferNew->Des().Copy(buffer->Ptr(), start); + if ( entrySize>0 ) + { + bufferNew->Des().Append(entryData); + } + bufferNew->Des().Append(buffer->Ptr() + end + endLength, bufferLength - end - endLength); + CleanupStack::Pop(bufferNew); + CleanupStack::PopAndDestroy(buffer); + buffer=bufferNew; + CleanupStack::PushL(buffer); + } + while ( buffer->Match(KMatch)!=KErrNotFound ); + iBuffer.Append(buffer); + CleanupStack::Pop(buffer); + aResult.Set(*buffer); + INFO_PRINTF4(KDataRead, &aSectName, &aKeyName , &aResult); + } + } + + return ret; + } + + +/** + *Utility function to produce time delay + * @param aTimeoutInSecs Times in micro seconds + */ +void CDataWrapperBase::Timedelay(TInt aTimeoutInSecs) + { + TRequestStatus status; + iTimer.After(status, aTimeoutInSecs); + User::WaitForRequest(status); + } + + +/** Validates the returned valua as a Bool. Compares aValue with the expected result in the ini file and Sets the block result to EFail if not equal. + * @param aSection - Section within the ini file to read the expected value + * @param aValue - The value we need to validate + * @param aForceValidation - ETrue forces validation if there's a missing parameter. + * @param aErrorMessage - Contains a descriptor with a custom error message + * @return - Print error messages to log file + * @return - Sets test block result + */ +void CDataWrapperBase::GetValidationBool(const TDesC& aSection, TInt aValue, TBool aForceValidation, const TDesC& aErrorMessage) + { + TBool expectedValue; + TBool ret=GetBoolFromConfig(aSection, KExpected(), expectedValue); + if ( !ret ) + { + if ( aForceValidation ) + { + ERR_PRINTF2(KLogMissingParameter, & KExpected); + SetBlockResult(EFail); + } + } + else + { + if ( aValue!=expectedValue ) + { + SetBlockResult(EFail); + ERR_PRINTF1(aErrorMessage); + ERR_PRINTF3(_L("Retrived Value(%d) != expectedValue(%d)"), aValue, expectedValue); + } + } + } + + +/** + * Validates the returned valua as a TInt. Compares aValue with the expected result in the ini file and Sets the block result to EFail if not equal. + * @param aSection - Section within the ini file to read the expected value + * @param aValue - The value we need to validate + * @param aForceValidation - ETrue forces validation if there's a missing parameter. + * @param aErrorMessage - Contains a descriptor with a custom error message + * @return - Print error messages to log file + * @return - Sets test block result + */ +void CDataWrapperBase::GetValidationInt(const TDesC& aSection, TInt aValue, TBool aForceValidation, const TDesC& aErrorMessage) + { + TInt expectedValue; + TBool ret=GetIntFromConfig(aSection, KExpected(), expectedValue); + if ( !ret ) + { + if ( aForceValidation ) + { + ERR_PRINTF2(KLogMissingParameter, &KExpected()); + SetBlockResult(EFail); + } + } + else + { + if ( aValue!=expectedValue ) + { + SetBlockResult(EFail); + ERR_PRINTF1(aErrorMessage); + ERR_PRINTF3(_L("Retrived Value(%d) != expectedValue(%d)"), aValue, expectedValue); + } + } + } + +/** + * Validates the returned valua as a TUint. Compares aValue with the expected result in the ini file and Sets the block result to EFail if not equal. + * @param aSection - Section within the ini file to read the expected value + * @param aValue - The value we need to validate + * @param aForceValidation - ETrue forces validation if there's a missing parameter. + * @param aErrorMessage - Contains a descriptor with a custom error message + * @return - Print error messages to log file + * @return - Sets test block result + */ +void CDataWrapperBase::GetValidationUint(const TDesC& aSection, TInt aValue, TBool aForceValidation, const TDesC& aErrorMessage) + { + TUint expectedValue; + TBool ret=GetUintFromConfig(aSection, KExpected(), expectedValue); + if ( !ret ) + { + if ( aForceValidation ) + { + ERR_PRINTF2(KLogMissingParameter, &KExpected()); + SetBlockResult(EFail); + } + } + else + { + if ( aValue!=expectedValue ) + { + SetBlockResult(EFail); + ERR_PRINTF1(aErrorMessage); + ERR_PRINTF3(_L("Retrived Value(%d) != expectedValue(%d)"), aValue, expectedValue); + } + } + } + + +/** + * Return array of string parameters i.e. key=a1,a2,a3 returns array which contains + * String a1, a2 and a3. + * @return ret - EFalse if can't get a String parameter from Config file. ETrue if KErrNone + */ +TBool CDataWrapperBase::GetArrayFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray& aResult) + { + TBool ret=EFalse; + TPtrC completeArray; + + TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, completeArray)); + if ( err != KErrNone ) + { + ret=EFalse; + } + + TLex16 lex(completeArray); // Here we have the array as a string i.e. "a1,a2,a3" + TBuf<256> buf; + TChar chr; + + while(!lex.Eos()) + { + chr = lex.Get(); + // Check if there was a list separator + if (chr == ',') + { + HBufC* param = buf.AllocLC(); + buf.Zero(); + aResult.Append(param); + CleanupStack::Pop(param); // pointer to buf is stored in RPointerArray + } + // If not separator character we can store the character into array + else + { + buf.Append(chr); + } + } + // Remember to put last token into array (,a3) + HBufC* param = buf.AllocLC(); + aResult.Append(param); + CleanupStack::Pop(param); + + return ret; + } + + +TBool CDataWrapperBase::GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult) + { + TPtrC str; + TBool ret=GetStringFromConfig(aSectName, aKeyName, str); + + if ( ret ) + { + TBool found=EFalse; + TInt index=0; + while ( (aTable[index].iValue!=-1) && !found ) + { + if ( aTable[index].iString==str ) + { + found=ETrue; + aResult=aTable[index].iValue; + } + else + { + ++index; + } + } + + if ( !found ) + { + ret=GetIntFromConfig(aSectName, aKeyName, aResult); + } + } + + return ret; + } + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,18 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +#include "../wlan/group/bld.inf" diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/group/device.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/group/device.cfg Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,23 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + + +// Used within the build process to export the correct files for the supported devices +// Uncomment only one of the devices definied in listed below + +#define TEST_DEVICE_DEVLON52 +//#define TEST_DEVICE_TUBE diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/group/release.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/group/release.txt Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,5 @@ +NOTESRC_RELEASER +Nokia Corporation + +NOTESRC_RELEASE_REASON +WLAN SALT diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/group/testdriversetup.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/group/testdriversetup.bat Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,17 @@ +@rem +@rem Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +perl testdriversetup.pl diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/group/testdriversetup.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/group/testdriversetup.pl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,47 @@ +# +# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +use Cwd; + +my $theEpocRoot=$ENV{EPOCROOT}; +my $epoc32Location="$theEpocRoot.\\epoc32"; + +my $currentDirectory=cwd; +$currentDirectory =~ s/Group//i; +$currentDirectory =~ s/\//\\/g; + +my $currentDrive = substr($currentDirectory,0,2); + +my $cmd="TestDriver config"; +my $suite="file:/$currentDrive$epoc32Location\\testdriver\\salt\\wlanhai.driver"; +$suite =~ s.\\./.g; +$suite =~ s\/./\/\g; + +$cmd .= " --bldclean OFF"; +$cmd .= " --bldmake OFF"; +$cmd .= " -e $currentDrive$theEpocRoot"; +$cmd .= " -x $currentDrive$epoc32Location\\testdriver\\salt"; +$cmd .= " --repos $currentDrive$epoc32Location\\testdriver\\Repository"; +$cmd .= " -c $currentDrive$epoc32Location\\testdriver\\Results"; +$cmd .= " -i $currentDirectory"; +$cmd .= " -s $suite"; +$cmd .= " --source $currentDirectory"; +$cmd .= " --tp $currentDirectory"; +$cmd .= " --testexec auto"; +$cmd .= " --statlite false"; +$cmd .= " --teflite true"; +$cmd .= " --commdb overwrite"; +system("$cmd"); diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/group/wlanhaitest.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/group/wlanhaitest.mrp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +component wlanhaitest +source \sf\os\wlan\wlanapitest\wlanhaitest +notes_source \sf\os\wlan\wlanapitest\wlanhaitest\group\release.txt +ipr T diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/testsuites/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/testsuites/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,19 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +PRJ_TESTEXPORTS +../wlan/wlanhai.driver /epoc32/testdriver/salt/wlanhai.driver \ No newline at end of file diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/testsuites/wlan/wlanhai.driver --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/testsuites/wlan/wlanhai.driver Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,78 @@ + + + + + + + + + t_wlan + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/group/T_Wlan.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/group/T_Wlan.mmp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +TARGET t_wlan.exe +TARGETTYPE exe +UID 0x102863E6 0xA00041CB +VENDORID 0x70000001 + +capability All -Tcb + +SOURCEPATH ../src + +SOURCE ../../common/src/datawrapperbase.cpp +SOURCE t_wlandriverserver.cpp +SOURCE t_wlanmgmtclientdata.cpp +SOURCE t_wlanscaninfodata.cpp +SOURCE t_rsocketservdata.cpp +SOURCE t_rconnectiondata.cpp +SOURCE t_ccommsdatabasedata.cpp +SOURCE t_ccommsdbtableviewdata.cpp +SOURCE t_rsocketdata.cpp +SOURCE t_rfiledata.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../common/inc + + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/test +SYSTEMINCLUDE /epoc32/include/kernel +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mw + +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib +LIBRARY iniparser.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY flogger.lib +LIBRARY commdb.lib +LIBRARY esock.lib +LIBRARY insock.lib +LIBRARY wlandbif.lib +LIBRARY efsrv.lib +LIBRARY eikcore.lib +LIBRARY apengine.lib + +SMPSAFE diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/group/bld.inf Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,47 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +#include "../../group/device.cfg" +#include "../../testsuites/group/bld.inf" + +PRJ_TESTEXPORTS +t_wlan.iby /epoc32/rom/haitests/t_wlan.iby +t_wlan_binaries.iby /epoc32/rom/haitests/t_wlan_binaries.iby +t_wlan_testdata.iby /epoc32/rom/haitests/t_wlan_testdata.iby + +../pkg/t_wlan.bat c:/nt/wlan/t_wlan.bat + +../scripts/networking-wlan-validation-automated-connection.script c:/nt/wlan/networking-wlan-validation-automated-connection.script +../scripts/networking-wlan-validation-automated-instantiate.script c:/nt/wlan/networking-wlan-validation-automated-instantiate.script +../scripts/networking-wlan-validation-automated-transfer.script c:/nt/wlan/networking-wlan-validation-automated-transfer.script +../testdata/networking-wlan-validation-automated-connection.ini c:/nt/wlan/networking-wlan-validation-automated-connection.ini +../testdata/networking-wlan-validation-automated-instantiate.ini c:/nt/wlan/networking-wlan-validation-automated-instantiate.ini +../testdata/networking-wlan-validation-automated-transfer.ini c:/nt/wlan/networking-wlan-validation-automated-transfer.ini +../testdata/t_wlan_environment.ini c:/nt/wlan/t_wlan_environment.ini + +#if defined(TEST_DEVICE_DEVLON52) +../testdata/devlon52/t_wlan.ini c:/nt/wlan/t_wlan.ini +../testdata/devlon52/t_wlan.tcs c:/nt/wlan/t_wlan.tcs +#endif + +#if defined(TEST_DEVICE_TUBE) +../testdata/tube/t_wlan.ini c:/nt/wlan/t_wlan.ini +../testdata/tube/t_wlan.tcs c:/nt/wlan/t_wlan.tcs +#endif + +PRJ_TESTMMPFILES +t_wlan.mmp diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/group/t_wlan.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/group/t_wlan.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,25 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +#if (!defined __T_WLAN_IBY__) +#define __T_WLAN_IBY__ + +//Test Includes +#include <..\haitests\t_wlan_binaries.iby> +#include <..\haitests\t_wlan_testdata.iby> + +#endif diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/group/t_wlan_binaries.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/group/t_wlan_binaries.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,27 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +#if (!defined __T_WLAN_BINARIES_IBY__) +#define __T_WLAN_BINARIES_IBY__ + +#if (!defined EKA2) +file=\Epoc32\Release\armv5\urel\t_wlan.exe \sys\bin\t_wlan.exe +#else +file=\Epoc32\Release\armv5\urel\t_wlan.exe \sys\bin\t_wlan.exe +#endif + +#endif diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/group/t_wlan_testdata.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/group/t_wlan_testdata.iby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +#if (!defined __T_WLAN_TESTDATA_IBY__) +#define __T_WLAN_TESTDATA_IBY__ + +data=EPOCROOT##Epoc32\data\c\nt\wlan\t_wlan.bat nt\wlan\t_wlan.bat +data=EPOCROOT##Epoc32\data\c\nt\wlan\networking-wlan-validation-automated-connection.script nt\wlan\networking-wlan-validation-automated-connection.script +data=EPOCROOT##Epoc32\data\c\nt\wlan\networking-wlan-validation-automated-instantiate.script nt\wlan\networking-wlan-validation-automated-instantiate.script +data=EPOCROOT##Epoc32\data\c\nt\wlan\networking-wlan-validation-automated-transfer.script nt\wlan\networking-wlan-validation-automated-transfer.script +data=EPOCROOT##Epoc32\data\c\nt\wlan\networking-wlan-validation-automated-connection.ini nt\wlan\networking-wlan-validation-automated-connection.ini +data=EPOCROOT##Epoc32\data\c\nt\wlan\networking-wlan-validation-automated-instantiate.ini nt\wlan\networking-wlan-validation-automated-instantiate.ini +data=EPOCROOT##Epoc32\data\c\nt\wlan\networking-wlan-validation-automated-transfer.ini nt\wlan\networking-wlan-validation-automated-transfer.ini +data=EPOCROOT##Epoc32\data\c\nt\wlan\t_wlan_environment.ini nt\wlan\t_wlan_environment.ini +data=EPOCROOT##Epoc32\data\c\nt\wlan\t_wlan.ini nt\wlan\t_wlan.ini +data=EPOCROOT##Epoc32\data\c\nt\wlan\t_wlan.tcs nt\wlan\t_wlan.tcs + +#endif diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/group/user_input.oby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/group/user_input.oby Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,28 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +file=\Epoc32\Release\armv5\urel\testexecutelogclient.dll \sys\bin\testexecutelogclient.dll +file=\Epoc32\Release\armv5\urel\testexecutelogengine.exe \sys\bin\testexecutelogengine.exe +file=\Epoc32\Release\armv5\urel\cinidata.dll \sys\bin\cinidata.dll +file=\Epoc32\Release\armv5\urel\RFileLoggerClient.dll \sys\bin\RFileLoggerClient.dll +file=\Epoc32\Release\armv5\urel\RFileLoggerServer.exe \sys\bin\RFileLoggerServer.exe +file=\Epoc32\Release\armv5\urel\testexecute.exe \sys\bin\testexecute.exe +file=\Epoc32\Release\armv5\urel\testexecuteutils.dll \sys\bin\testexecuteutils.dll +data=\Epoc32\data\c\system\data\testexecute.ini \system\data\testexecute.ini + +file=\Epoc32\Release\armv5\urel\statapi.exe \sys\bin\statapi.exe +data=\Epoc32\data\c\system\data\stat.ini \system\data\stat.ini diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_CCommsDatabaseData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_CCommsDatabaseData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef T_CCOMMSDATABASEDATA_H_ +#define T_CCOMMSDATABASEDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//Epoc includes +#include + +class CT_CCommsDatabaseData: public CDataWrapperBase + { +public: + static CT_CCommsDatabaseData* NewL(); + virtual ~CT_CCommsDatabaseData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_CCommsDatabaseData(); + void ConstructL(); + +private: + void DoCmdNewL(); + void DoCmdDestructor(); + void DestroyData(); + +private: + /** + * Wrapped object + */ + CCommsDatabase* iCommsDat; + + }; + +#endif /*T_CCOMMSDATABASEDATA_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_CCommsDbTableViewData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_CCommsDbTableViewData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef T_CCOMMSDBTABLEVIEWDATA_H_ +#define T_CCOMMSDBTABLEVIEWDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//Epoc includes +#include + +class CT_CCommsDbTableViewData: public CDataWrapperBase + { +public: + static CT_CCommsDbTableViewData* NewL(); + virtual ~CT_CCommsDbTableViewData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_CCommsDbTableViewData(); + void ConstructL(); + +private: + void DoCmdNewL(const TTEFSectionName& aSection); + void DoCmdDestructor(); + void DestroyData(); + +private: + /** + * Wrapped object + */ + CCommsDbTableView* iSearchView; + + }; + +#endif /*T_CCOMMSDBTABLEVIEW_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_RConnectionData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_RConnectionData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#ifndef T_RCONNECTIONDATA_H_ +#define T_RCONNECTIONDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//Epoc includes +#include //RConnection + +class CT_RConnectionData: public CDataWrapperBase + { + public: + static CT_RConnectionData* NewL(); + virtual ~CT_RConnectionData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_RConnectionData(); + void ConstructL(); + +private: + void DoCmdOpen(const TTEFSectionName& aSection); + void DoCmdStart(const TTEFSectionName& aSection); + void DoCmdClose(); + void Close(); + +private: + /** + * Wrapped object + */ + RConnection* iConnection; + }; +#endif /*T_RCONNECTIONDATA_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_RFileData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_RFileData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#ifndef T_RFILEDATA_H_ +#define T_RFILEDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +class CT_RFileData: public CDataWrapperBase + { +public: + static CT_RFileData* NewL(); + virtual ~CT_RFileData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_RFileData(); + void ConstructL(); + +private: + void DoCmdGenerateFile(const TTEFSectionName& aSection); + +private: + /** + * For create a file + */ + RFile* iFile; + + /** + * Handle for file server session + */ + RFs iFs; + }; + +#endif /*T_RFILEDATA_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_RSocketData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_RSocketData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef T_RSOCKETDATA_H_ +#define T_RSOCKETDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//Epoc includes +#include // RSocketServ, RConnection +#include // KAfInet +#include +#include + + +class CT_RSocketData: public CDataWrapperBase + { +public: + static CT_RSocketData* NewL(); + void RunL(CActive* aActive, TInt aIndex); + virtual ~CT_RSocketData(); + +public: + virtual TAny* GetObject(); + void ErrorMessage(const TInt aMessage); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_RSocketData(); + void ConstructL(); + +private: + void DoCmdOpen(const TTEFSectionName& aSection); + void DoCmdConnect(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + void DoCmdShutdown(const TInt aAsyncErrorIndex); + void DoCmdClose(); + void DoCmdHttpGet(); + void DoCmdCheckSupportedRates(const TTEFSectionName& aSection); + void DoCmdUploadSendHTTPPost(const TTEFSectionName& aSection); + void CreateHTTPHeaderStart(TDes8& aRequest, TInt aDataSize, TDesC& aFileServer,TDesC& clientID,TDesC& serverScript); + void SendFileToSocketL(const TDesC& aFilename); + TInt ReadFileSizeL(const TDesC& aFilename); + void CreateHTTPHeaderEnd(TDes8& aRequest); + TBool CheckSupportedRates(const TDesC8& aSupportedRates, const TUint8 aRate); + void Shutdown(); + void DoCmdDownloadSendHTTPGet(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex ); + void DoCmdRecvOneOrMore(const TTEFSectionName& aSection); + void Close(); + TReal ThroughputInMegaBits( TTimeIntervalMicroSeconds aDuration, TInt aTotalTransferred ); + void RecvOneOrMore(TRequestStatus& status); + +private: + /** + * Wrapped object + */ + RSocket* iSocket; + /** + * Used in the command DoCmdDownloadSendHTTPGet for RSocket::Write + */ + CActiveCallback* iActiveCallback; + /** + * Used in the command DoCmdConnect for RSocket::Connect + */ + CActiveCallback* iActCallConnectSocket; + /** + * Used in the command DoCmdConnectSocket for RSocket::Connect + */ + CActiveCallback* iActCallShutDownSocket; + /** + * Flag to review if the Socket is Open with RSocket::Connect + */ + TBool iSocketOpened; + /** + * flag to review if the Socket was shutdown + */ + TBool iSocketStarted; + /** + * Async data + */ + TInt iAsyncErrorIndex; + /** + * Buffer for Download in DoCmdReceiveHTTPResponse command + */ + HBufC8* iDownloadBuffer; + /** + * Buffer for Upload in SendFileToSocket + */ + HBufC8* iUploadBuffer; + /** + * Header for response HTPP + */ + RBuf8 iHttpResponseHeader; + /** + * Download throughput + */ + TReal iDownloadThroughput; + /** + * Handle for Filse server session + */ + RFs iFs; + /** + * Upload throughput + */ + TReal iUploadThroughput; + /** + * Bytes received in DoCmdHttpGet + */ + TInt itotalReceived; + }; + +#endif /*T_RSOCKETDATA_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_RSocketServData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_RSocketServData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef T_RSOCKETSERVDATA_H_ +#define T_RSOCKETSERVDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//Epoc includes +#include // RSocketServ, RConnection + +class CT_RSocketServData: public CDataWrapperBase + { +public: + static CT_RSocketServData* NewL(); + virtual ~CT_RSocketServData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + void SetIapID(TUint32 ); + TUint32 GetIapID(){return iIapID;} + +protected: + CT_RSocketServData(); + void ConstructL(); + +private: + void DoCmdSetOutgoingIap(const TTEFSectionName& aSection); + void DoCmdConnect(); + void DoCmdClose(); + void Close(); + +private: + /** + * Wrapped object + */ + RSocketServ* iSocketServ; + /** + * Flag to review RSocketServ is in Connected state + */ + TBool iSocketServConnected; + /** + * Store de ID of the IAP + */ + TUint32 iIapID; + + }; +#endif /*T_RSOCKETSERVDATA_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_WlanDriverServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_WlanDriverServer.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef T_WLAN_DRIVER_SERVER_H +#define T_WLAN_DRIVER_SERVER_H + +//Epoc includes +#include + +/** + * This wrapper class extends the test server and creates test server for Wlan driver + */ +class CT_WlanDriverServer : public CTestServer2 + { +private: + class CT_WlanDriverBlock : public CTestBlockController + { + public: + inline CT_WlanDriverBlock(); + inline ~CT_WlanDriverBlock(); + + CDataWrapper* CreateDataL( const TDesC& aData ); + }; + +public: + static CT_WlanDriverServer* NewL(); + inline CTestBlockController* CreateTestBlock(); + }; + +#include "t_wlandriverserver.inl" + +#endif // T_WLAN_DRIVER_SERVER_H diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_WlanDriverServer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_WlanDriverServer.inl Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +CT_WlanDriverServer::CT_WlanDriverBlock::CT_WlanDriverBlock() +: CTestBlockController() + { + } + +CT_WlanDriverServer::CT_WlanDriverBlock::~CT_WlanDriverBlock() + { + } + +CTestBlockController* CT_WlanDriverServer::CreateTestBlock() + { + return new CT_WlanDriverBlock(); + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_WlanMgmtClientData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_WlanMgmtClientData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef T_WLANMGMTCLIENTDATA_H_ +#define T_WLANMGMTCLIENTDATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//forward +class CWlanMgmtClient; + +class CT_WlanMgmtClientData: public CDataWrapperBase + { +public: + static CT_WlanMgmtClientData* NewL(); + ~CT_WlanMgmtClientData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_WlanMgmtClientData(); + void ConstructL(); + +private: + void DoCmdNewL(); + void DoCmdGetScanResults(const TTEFSectionName& aSection); + void DoCmdDestructor(); + void DestroyData(); + +private: + /** + * Wrapped object + */ + CWlanMgmtClient* iData; + +}; + + +#endif /*T_WLANMGMTCLIENTDATA_H_*/ diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/inc/T_WlanScanInfoData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/inc/T_WlanScanInfoData.h Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#ifndef T_WLANSCANINFODATA_H_ +#define T_WLANSCANINFODATA_H_ + +//User Includes +#include "datawrapperbase.h" + +//forward class +class CWlanScanInfo; + +class CT_WlanScanInfoData: public CDataWrapperBase + { +public: + static CT_WlanScanInfoData* NewL(); + ~CT_WlanScanInfoData(); + +public: + virtual TAny* GetObject(); + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); + +protected: + CT_WlanScanInfoData(); + void ConstructL(); + +private: + void DoCmdNewL(const TTEFSectionName& aSection); + void DoCmdDestructor(); + void DestroyData(); + void DoCmdInformationElement(const TTEFSectionName& aSection); + +private: + /** + * Wrapped object + */ + CWlanScanInfo* iData; + /** + * For storing ECom instance UID (needed when destroying the instance) + */ + TUid iScanInfoInstanceIdentifier; + }; + +#endif /*T_WLANSCANINFODATA_H_*/ + + \ No newline at end of file diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/pkg/t_wlan.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/pkg/t_wlan.bat Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +testexecute c:\nt\wlan\networking-wlan-validation-automated-connection.script -tcx c:\nt\wlan\t_wlan.tcs +testexecute c:\nt\wlan\networking-wlan-validation-automated-instantiate.script -tcx c:\nt\wlan\t_wlan.tcs +testexecute c:\nt\wlan\networking-wlan-validation-automated-transfer.script -tcx c:\nt\wlan\t_wlan.tcs \ No newline at end of file diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/scripts/networking-wlan-validation-automated-connection.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/scripts/networking-wlan-validation-automated-connection.script Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,357 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// +//! @file +//! @SYMTestSuiteName networking-wlan-validation-automated-connection +//! @SYMScriptTestEnvironment This test script requires a basic ROM. +// +// Tests all public elements of the RConnection, RSocket, RSocketServ, CWLanMgmtClient, CWLanScanInfo, CComsDataBase, CComsDbTableView +// classes as a means of confidence that the APIs work as expected. +// +// The purpose is to provide a regression test suite of PublishedAll +// APIs for: RConnection, RSocket, RSocketServ, CWLanMgmtClient, CWLanScanInfo, CComsDataBase, CComsDbTableView +// The tests are fully automated. +// + + + +LOAD_SUITE T_Wlan + + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0001 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0001 +//!@SYMAPI +//! CWlanMgmtClient::NewL(); +//! REComSession::CreateImplementationL(TUid, TUid{ref}); +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement( TUint8, TUint8{ref}, const TUint8{ptr}{ptr} ) ; +//! REComSession::DestroyedImplementation(TUid); +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan scan +//!@SYMTestActions +//! 1.- Instantiate management client. Scan for broadcasted Wireless network names; SSIDs: NewL +//! 2.- Instantiate Scan Info. Check that the given SSIDs were found:NewL ( WlanScanUid = {UID, Uid} ) +//! 3.- GetScanResults ( scaninfo = wlansinf ) +//! 4.- SelectScanInfo ( DEFAULT_SSID_Ssid = {IAP,Iap} ) +//! 5.- Destroy Scan information: ~ +//! 6.- Destroy management client: ~ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! TEF reports the test case passed. +//!@SYMTestType CIT + + START_TEST_BLOCK 100 T_Wlan \nt\wlan\networking-wlan-validation-automated-connection.ini + CREATE_OBJECT WlanMgmtClient wmgmtcnt + CREATE_OBJECT WlanScanInfo wlansinf + COMMAND wmgmtcnt NewL + COMMAND wlansinf NewL NETWORKING-Wlan-Connection-0001-0001-NewL_command02 + COMMAND wmgmtcnt GetScanResults NETWORKING-Wlan-Connection-0001-0001-GetScanResults_command03 + COMMAND wlansinf InformationElement NETWORKING-Wlan-Connection-0001-0001-InformationElement_command04 + COMMAND wlansinf ~ + COMMAND wmgmtcnt ~ + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0001 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0002 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0002 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL(); +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement( TUint8, TUint8{ref}, const TUint8{ptr}{ptr} ) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RSocket::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! RConnection::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! Shutdown(TShutdown,TRequestStatus{ref}); +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan connect +//!@SYMTestActions +//! 1.- Instantiate a CCOMMSDB : NewL +//! 2.- instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb ) +//! 3.- SetOutgoingIap ( WLANIAP = {IAP,Iap}; DEFAULT_SSID = {IAP,Ssid}; commsdbtableview = comsdbtblview ) +//! 4.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 5.- Destroy a CCOMMSDB object: ~ +//! 6.- ConnectSocketServ +//! 7.- OpenRConnection ( socketserv = scktserv ) +//! 8.- StartRConnection ( socketserv = scktserv ) +//! 9.- OpenSocket ( socketserv = scktserv; connection = rcntion ) +//! 10.- ConnectSocket ( Ip = {DownloadServer,Ip}; Port = {DownloadServer,Port} ) +//! 11.- HttpGet +//! 12.- ShutDownSocket +//! 13.- CloseSocket +//! 14.- CloseConnection +//! 15.- CloseSocketServ +//! + +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Connect to a WLAN with no errors +//!@SYMTestType CIT + + START_TEST_BLOCK 600 T_Wlan \nt\wlan\networking-wlan-validation-automated-connection.ini + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Connection-0002-0001-NewL_command02 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Connection-0002-0001-SetOutgoingIap_command03 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Connection-0002-0001-Open_command07 + COMMAND rcntion Start NETWORKING-Wlan-Connection-0002-0001-Start_command08 + COMMAND rsckt Open NETWORKING-Wlan-Connection-0002-0001-Open_command09 + COMMAND rsckt Connect NETWORKING-Wlan-Connection-0002-0001-Connect_command10 + OUTSTANDING + COMMAND rsckt HttpGet + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0002 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0003 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0003 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL(); +//! REComSession::CreateImplementationL(TUid, TUid{ref}); +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement( TUint8, TUint8{ref}, const TUint8{ptr}{ptr} ) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RConnection::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! REComSession::DestroyedImplementation(TUid); +//! RSocket::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! RSocket::Shutdown(TShutdown,TRequestStatus{ref}); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan Connection to 802.11b Router +//!@SYMTestActions +//! 1.- InstantiateMgmtClient: NewL +//! 2.- InstantiateScanInfo: NewL ( WlanScanUid = {UID, Uid} ) +//! 3.- Instantiate a CCOMMSDB: NewL +//! 4.- Instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb ) +//! 5.- GetScanResultsL ( scaninfo = wlansinf ) +//! 6.- SelectScanInfo ( DEFAULT_SSID_Ssid = {IAP80211b,Iap} ) +//! 7.- CheckSupportedRates ( rate = 2; scaninfo = wlansinf ) +//! 8.- CheckSupportedRates ( rate = 4; scaninfo = wlansinf ) +//! 9.- CheckSupportedRates ( rate = 11; scaninfo = wlansinf ) +//! 10.- CheckSupportedRates ( rate = 22; scaninfo = wlansinf ) +//! 11.- SetOutgoingIap ( WLANIAP = {IAP,Iap};DEFAULT_SSID = {IAP80211b,Iap}; commsdbtableview = comsdbtblview ) +//! 12.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 13.- Destroy a CCOMMSDB object: ~ +//! 14.- ConnectSocketServ +//! 15.- OpenRConnection ( socketserv = scktserv ) +//! 16.- StartRConnection ( socketserv = scktserv ) +//! 17.- OpenSocket ( socketserv = scktserv;connection = rcntion ) +//! 18.- ConnectSocket ( Ip = {DownloadServer,Ip}; Port = {DownloadServer,Port} ) +//! 19.- HttpGet +//! 20.- ShutDownSocket +//! 21.- CloseSocket +//! 22.- CloseConnection +//! 23.- CloseSocketServ +//! 24.- DestroyScanInfo: ~ +//! 25.- DestroyMgmtClient: ~ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Test case passes if the DUT can connect to the WLAN 802.11b router broadcasting the defined SSID. +//!@SYMTestType CIT + + START_TEST_BLOCK 600 T_Wlan \nt\wlan\networking-wlan-validation-automated-connection.ini + CREATE_OBJECT WlanMgmtClient wmgmtcnt + CREATE_OBJECT WlanScanInfo wlansinf + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + COMMAND wmgmtcnt NewL + COMMAND wlansinf NewL NETWORKING-Wlan-Connection-0003-0001-NewL_command02 + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Connection-0003-0001-NewL_command04 + COMMAND wmgmtcnt GetScanResults NETWORKING-Wlan-Connection-0003-0001-GetScanResults_command05 + COMMAND wlansinf InformationElement NETWORKING-Wlan-Connection-0003-0001-InformationElement_command06 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command07 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command08 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command09 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command10 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Connection-0003-0001-SetOutgoingIap_command12 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Connection-0003-0001-Open_command16 + COMMAND rcntion Start NETWORKING-Wlan-Connection-0003-0001-Start_command17 + COMMAND rsckt Open NETWORKING-Wlan-Connection-0003-0001-Open_command18 + COMMAND rsckt Connect NETWORKING-Wlan-Connection-0003-0001-Connect_command19 + OUTSTANDING + COMMAND rsckt HttpGet + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + COMMAND wlansinf ~ + COMMAND wmgmtcnt ~ + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0003 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0004 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0004 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL(); +//! REComSession::CreateImplementationL(TUid, TUid{ref}); +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement( TUint8, TUint8{ref}, const TUint8{ptr}{ptr} ) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RConnection::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! REComSession::DestroyedImplementation(TUid); +//! RSocket::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! RSocket::Shutdown(TShutdown,TRequestStatus{ref}); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan Connection to 802.11g Router +//!@SYMTestActions +//! 1.- InstantiateMgmtClient: NewL +//! 2.- InstantiateScanInfo: NewL ( WlanScanUid = {UID, Uid} ) +//! 3.- Instantiate a CCOMMSDB: NewL +//! 4.- Instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb) +//! 5.- GetScanResultsL ( scaninfo = wlansinf ) +//! 6.- SelectScanInfo ( DEFAULT_SSID_Ssid = {IAP80211g,Iap} ) +//! 7.- CheckSupportedRates ( rate = 2;scaninfo = wlansinf ) +//! 8.- CheckSupportedRates ( rate = 4;scaninfo = wlansinf ) +//! 9.- CheckSupportedRates ( rate = 11;scaninfo = wlansinf ) +//! 10.- CheckSupportedRates ( rate = 22;scaninfo = wlansinf ) +//! 11.- SetOutgoingIap ( WLANIAP = {IAP,Iap}; DEFAULT_SSID = {IAP80211g,Iap}; commsdbtableview = comsdbtblview ) +//! 12.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 13.- Destroy a CCOMMSDB object: ~ +//! 14.- ConnectSocketServ +//! 15.- OpenRConnection ( socketserv = scktserv ) +//! 16.- StartRConnection ( socketserv = scktserv ) +//! 17.- OpenSocket ( socketserv = scktserv; connection = rcntion) +//! 18.- ConnectSocket ( Ip = {DownloadServer,Ip}; Port ={DownloadServer,Port} ) +//! 19.- HttpGet +//! 20.- ShutDownSocket +//! 21.- CloseSocket +//! 22.- CloseConnection +//! 23.- CloseSocketServ +//! 24.- DestroyScanInfo: ~ +//! 25.- DestroyMgmtClient: ~ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Test case passes if the DUT can connect to the WLAN 802.11g router broadcasting the defined SSID. +//!@SYMTestType CIT + + START_TEST_BLOCK 600 T_Wlan \nt\wlan\networking-wlan-validation-automated-connection.ini + CREATE_OBJECT WlanMgmtClient wmgmtcnt + CREATE_OBJECT WlanScanInfo wlansinf + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + COMMAND wmgmtcnt NewL + COMMAND wlansinf NewL NETWORKING-Wlan-Connection-0004-0001-NewL_command02 + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Connection-0004-0001-NewL_command04 + COMMAND wmgmtcnt GetScanResults NETWORKING-Wlan-Connection-0004-0001-GetScanResults_command05 + COMMAND wlansinf InformationElement NETWORKING-Wlan-Connection-0004-0001-InformationElement_command06 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command07 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command08 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command09 + COMMAND rsckt CheckSupportedRates NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command10 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Connection-0004-0001-SetOutgoingIap_command12 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Connection-0004-0001-Open_command16 + COMMAND rcntion Start NETWORKING-Wlan-Connection-0004-0001-Start_command17 + COMMAND rsckt Open NETWORKING-Wlan-Connection-0004-0001-Open_command18 + COMMAND rsckt Connect NETWORKING-Wlan-Connection-0004-0001-Connect_command19 + OUTSTANDING + COMMAND rsckt HttpGet + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + COMMAND wlansinf ~ + COMMAND wmgmtcnt ~ + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-CONNECTION-0004 + +DELAY 10000 diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/scripts/networking-wlan-validation-automated-instantiate.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/scripts/networking-wlan-validation-automated-instantiate.script Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,90 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// +//! @file +//! @SYMTestSuiteName networking-wlan-validation-automated-instantiate +//! @SYMScriptTestEnvironment This test script requires a basic ROM. +// +// Tests all public elements of the RConnection, RSocket, RSocketServ, CWLanMgmtClient, CWLanScanInfo, CComsDataBase, CComsDbTableView +// classes as a means of confidence that the APIs work as expected. +// +// The purpose is to provide a regression test suite of PublishedAll +// APIs for: RConnection, RSocket, RSocketServ, CWLanMgmtClient, CWLanScanInfo, CComsDataBase, CComsDbTableView +// The tests are fully automated. +// + + + +LOAD_SUITE T_Wlan + + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-INSTANTIATE-0001 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-INSTANTIATE-0001 +//!@SYMAPI +//! REComSession::CreateImplementationL(TUid, TUid{ref}); +//! REComSession::DestroyedImplementation(TUid); +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Instantiate ScanInfo +//!@SYMTestActions +//! 1.- Instantiate WLAN Scan Info: NewL ( WlanScanUid = {UID, Uid} ) +//! 2.- Destroy Scan Info: ~ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Instantiate WLAN Scan Info with no errors +//!@SYMTestType CIT + + START_TEST_BLOCK 100 T_Wlan \nt\wlan\networking-wlan-validation-automated-instantiate.ini + CREATE_OBJECT WlanScanInfo wlansinf + COMMAND wlansinf NewL NETWORKING-Wlan-Instantiate-0001-0001-NewL_command01 + COMMAND wlansinf ~ + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-INSTANTIATE-0001 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-INSTANTIATE-0002 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-INSTANTIATE-0002 +//!@SYMAPI +//! CWlanMgmtClient::NewL(); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Instantiate WlanMgmtClient +//!@SYMTestActions +//! 1.- Instantiate WLAN Mgmt Client: NewL +//! 2.- Destroy Mgmt Client: ~ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Instantiate WLAN Management Client with no errors +//!@SYMTestType CIT + + START_TEST_BLOCK 100 T_Wlan \nt\wlan\networking-wlan-validation-automated-instantiate.ini + CREATE_OBJECT WlanMgmtClient wmgmtcnt + COMMAND wmgmtcnt NewL + COMMAND wmgmtcnt ~ + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-INSTANTIATE-0002 + +DELAY 10000 diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/scripts/networking-wlan-validation-automated-transfer.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/scripts/networking-wlan-validation-automated-transfer.script Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,361 @@ +// +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// +//! @file +//! @SYMTestSuiteName networking-wlan-validation-automated-transfer +//! @SYMScriptTestEnvironment This test script requires a basic ROM. +// +// Tests all public elements of the RConnection, RSocket, RSocketServ, CWLanMgmtClient, CWLanScanInfo, CComsDataBase, CComsDbTableView +// classes as a means of confidence that the APIs work as expected. +// +// The purpose is to provide a regression test suite of PublishedAll +// APIs for: RConnection, RSocket, RSocketServ, CWLanMgmtClient, CWLanScanInfo, CComsDataBase, CComsDbTableView +// The tests are fully automated. +// + + + +LOAD_SUITE T_Wlan + + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0001 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0001 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL() +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement( TUint8, TUint8{ref}, const TUint8{ptr}{ptr}) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RConnection::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! RSocket::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! RSocket::Shutdown(TShutdown,TRequestStatus{ref}); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan Download 100kB to User Disk +//!@SYMTestActions +//! 1.- Instantiate a CCOMMSDB: NewL +//! 2.- Instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb ) +//! 3.- SetOutgoingIap ( WLANIAP = {IAP,Iap}; DEFAULT_SSID = {IAP,Ssid} ; commsdbtableview = comsdbtblview ) +//! 4.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 5.- Destroy a CCOMMSDB object: ~ +//! 6.- ConnectSocketServ +//! 7.- OpenRConnection socketserv ( socketserv = scktserv ) +//! 8.- StartRConnection socketserv ( socketserv = scktserv ) +//! 9.- OpenSocket( socketserv = scktserv; connection = rcntion ) +//! 10.- ConnectSocket ( Ip = {DownloadServer,Ip}; Port = {DownloadServer,Port} ) +//! 11.- DownloadSendHTTPGet ( Host = {DownloadServer,Ip}; File = /nokia/0100k.bin ) +//! 12.- ReceiveHTTPResponse( Save = {driveC,mmc}\0100k.bin ) +//! 13.- ShutDownSocket +//! 14.- CloseSocket +//! 15.- CloseConnection +//! 16.- CloseSocketServ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! TEF reports the test case passed. +//!@SYMTestType CIT + + START_TEST_BLOCK 600 T_Wlan \nt\wlan\networking-wlan-validation-automated-transfer.ini + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Transfer-0001-0001-NewL_command02 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Transfer-0001-0001-SetOutgoingIap_command03 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Transfer-0001-0001-Open_command07 + COMMAND rcntion Start NETWORKING-Wlan-Transfer-0001-0001-Start_command08 + COMMAND rsckt Open NETWORKING-Wlan-Transfer-0001-0001-Open_command09 + COMMAND rsckt Connect NETWORKING-Wlan-Transfer-0001-0001-Connect_command10 + OUTSTANDING + COMMAND rsckt DownloadSendHTTPGet NETWORKING-Wlan-Transfer-0001-0001-DownloadSendHTTPGet_command11 + OUTSTANDING + COMMAND rsckt RecvOneOrMore NETWORKING-Wlan-Transfer-0001-0001-RecvOneOrMore_command12 + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0001 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0002 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0002 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL() +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement(TUint8, TUint8{ref}, const TUint8{ptr}{ptr}) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RConnection::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! RSocket::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! RSocket::Shutdown(TShutdown,TRequestStatus{ref}); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan Download 10kB to Memory Card +//!@SYMTestActions +//! 1.- Instantiate a CCOMMSDB: NewL +//! 2.- Instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb ) +//! 3.- SetOutgoingIap ( WLANIAP = {IAP,Iap}; DEFAULT_SSID = {IAP,Ssid}; commsdbtableview = comsdbtblview ) +//! 4.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 5.- Destroy a CCOMMSDB object: ~ +//! 6.- ConnectSocketServ +//! 7.- OpenRConnection ( socketserv = scktserv ) +//! 8.- StartRConnection socketserv ( socketserv = scktserv ) +//! 9.- OpenSocket ( socketserv = scktserv; connection = rcntion ) +//! 10.- ConnectSocket ( Ip = {DownloadServer,Ip}; Port ={DownloadServer,Port} ) +//! 11.- DownloadSendHTTPGet ( Host = {DownloadServer,Ip}; File = /nokia/0010k.bin ) +//! 12.- ReceiveHTTPResponse ( Save = {driveE,mmc}\0010k.bin ) +//! 13.- ShutDownSocket +//! 14.- CloseSocket +//! 15.- CloseConnection +//! 16.- CloseSocketServ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! TEF reports the test case passed. +//!@SYMTestType CIT + + START_TEST_BLOCK 600 T_Wlan \nt\wlan\networking-wlan-validation-automated-transfer.ini + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Transfer-0002-0001-NewL_command02 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Transfer-0002-0001-SetOutgoingIap_command03 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Transfer-0002-0001-Open_command07 + COMMAND rcntion Start NETWORKING-Wlan-Transfer-0002-0001-Start_command08 + COMMAND rsckt Open NETWORKING-Wlan-Transfer-0002-0001-Open_command09 + COMMAND rsckt Connect NETWORKING-Wlan-Transfer-0002-0001-Connect_command10 + OUTSTANDING + COMMAND rsckt DownloadSendHTTPGet NETWORKING-Wlan-Transfer-0002-0001-DownloadSendHTTPGet_command11 + OUTSTANDING + COMMAND rsckt RecvOneOrMore NETWORKING-Wlan-Transfer-0002-0001-RecvOneOrMore_command12 + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0002 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0003 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0003 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL() +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement(TUint8, TUint8{ref}, const TUint8{ptr}{ptr}) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RConnection::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! RSocket::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! RSocket::Shutdown(TShutdown,TRequestStatus{ref}); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan Download 10MB to User Disk +//!@SYMTestActions +//! 1.- Instantiate a CCOMMSDB: NewL +//! 2.- Instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb ) +//! 3.- SetOutgoingIap ( WLANIAP = {IAP,Iap}; DEFAULT_SSID = {IAP,Ssid}; commsdbtableview = comsdbtblview) +//! 4.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 5.- Destroy a CCOMMSDB object: ~ +//! 6.-ConnectSocketServ +//! 7.-OpenRConnection ( socketserv = scktserv ) +//! 8.- StartRConnection ( socketserv = scktserv ) +//! 9.- OpenSocket socketserv connection( socketserv = scktserv; connection = rcntion ) +//! 10.- ConnectSocket ( Ip = {DownloadServer,Ip}; Port = {DownloadServer,Port} ) +//! 11.- DownloadSendHTTPGet ( Host = {DownloadServer,Ip}; File = /nokia/10MB.bin ) +//! 12.- ReceiveHTTPResponse ( Save = {driveC,mmc}\10MB.bin ) +//! 13.-ShutDownSocket +//! 14.- CloseSocket +//! 15.- CloseConnection +//! 16.- CloseSocketServer +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Download a 10MB file to User Disk with no errors +//!@SYMTestType CIT + + START_TEST_BLOCK 6000000 T_Wlan \nt\wlan\networking-wlan-validation-automated-transfer.ini + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Transfer-0003-0001-NewL_command02 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Transfer-0003-0001-SetOutgoingIap_command03 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Transfer-0003-0001-Open_command07 + COMMAND rcntion Start NETWORKING-Wlan-Transfer-0003-0001-Start_command08 + COMMAND rsckt Open NETWORKING-Wlan-Transfer-0003-0001-Open_command09 + COMMAND rsckt Connect NETWORKING-Wlan-Transfer-0003-0001-Connect_command10 + OUTSTANDING + COMMAND rsckt DownloadSendHTTPGet NETWORKING-Wlan-Transfer-0003-0001-DownloadSendHTTPGet_command11 + OUTSTANDING + COMMAND rsckt RecvOneOrMore NETWORKING-Wlan-Transfer-0003-0001-RecvOneOrMore_command12 + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0003 + + + + +START_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0004 + +//!@SYMTestCaseID NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0004 +//!@SYMAPI +//! CCommsDatabase::NewL(TBool); +//! CCommsDbTableView::OpenIAPTableViewMatchingBearerSetLC(TUint32, TCommDbConnectionDirection); +//! CWlanMgmtClient::NewL() +//! MWlanMgmtInterface::GetScanResults(CWlanScanInfo{ref}); +//! MWlanScanInfoBase::InformationElement( TUint8, TUint8{ref}, const TUint8{ptr}{ptr} ) ; +//! CCommsDbTableView::GotoFirstRecord(); +//! CCommsDbTableView::ReadTextL(const TDesC{ref}, TDes16{ref}); +//! CCommsDbTableView::ReadUintL(const TDesC{ref}, TUint32{ref}); +//! CWLanSettings::GetWlanSettings(TUint32,SWLANSettings{ref}); +//! CWLanSettings::WriteWlanSettings(SWLANSettings{ref}); +//! CWLanSettings::Disconnect(); +//! CCommsDbTableView::GotoNextRecord(); +//! RSocketServ::Connect(TUint); +//! RConnection::Open(RSocketServ{ref}, TUint); +//! RConnection::Start(TConnPref{ref}); +//! RSocket::Open(RSocketServ{ref},TUint,TUint,TUint, RConnection{ref}); +//! RSocket::Connect(TSockAddr{ref},TRequestStatus{ref}); +//! RSocket::RecvOneOrMore(TDes8{ref},TUint,TRequestStatus{ref},TSockXfrLength{ref}); +//! RSocket::Shutdown(TShutdown,TRequestStatus{ref}); +//! +//!@SYMAuthor alavariega +//!@SYMCreationDate 23/06/2008 +//!@SYMTestCaseDesc Wlan Upload 10MB from User Disk +//!@SYMTestActions +//! 1.- Instantiate a CCOMMSDB: NewL +//! 2.- Instantiate a CCOMMSDBTABLEVIEW: NewL ( commsdb = comsdb ) +//! 3.- GenerateFile ( File = {driveC,mmc}\10mb2.bin; Size = 10485760 ) +//! 4.- SetOutgoingIap ( WLANIAP = {IAP,Iap}; DEFAULT_SSID = {IAP,Ssid}; commsdbtableview = comsdbtblview ) +//! 5.- Destroy a CCOMMSDBTABLEVIEW object: ~ +//! 6.- Destroy a CCOMMSDB object: ~ +//! 7.- ConnectSocketServ +//! 8.-OpenRConnection ( socketserv = scktserv ) +//! 9.- StartRConnection ( socketserv = scktserv ) +//! 10.- OpenSocket ( socketserv = scktserv; connection = rcntion ) +//! 11.- ConnectSocket ( Ip = {UploadServer,Ip}; Port = {UploadServer,Port} ) +//! 12.- UploadSendHTTPPost ( File = {driveC,mmc}\10mb2.bin; FileServer = 10mb2.bin; clientID = SALT; serverScript = /dy/upload/upfile.php ) +//! 13.- ReceiveHTTPResponse ( Save = KNullDesC ) +//! 14.- ShutDownSocket +//! 15.- CloseSocket +//! 16.- CloseConnection +//! 17.- CloseSocketServ +//!@SYMTestStatus Verified +//!@SYMTestPriority Normal +//!@SYMTestExpectedResults +//! Upload a 10MB from User Disk with no errors +//!@SYMTestType CIT + + START_TEST_BLOCK 6000000 T_Wlan \nt\wlan\networking-wlan-validation-automated-transfer.ini + CREATE_OBJECT CCommsDatabase comsdb + CREATE_OBJECT CCommsDbTableView comsdbtblview + CREATE_OBJECT RSocketServ scktserv + CREATE_OBJECT RConnection rcntion + CREATE_OBJECT RSocket rsckt + CREATE_OBJECT RFile rfile + COMMAND comsdb NewL + COMMAND comsdbtblview NewL NETWORKING-Wlan-Transfer-0004-0001-NewL_command02 + COMMAND rfile GenerateFile NETWORKING-Wlan-Transfer-0004-0001-GenerateFile_command03 + COMMAND scktserv SetOutgoingIap NETWORKING-Wlan-Transfer-0004-0001-SetOutgoingIap_command04 + COMMAND comsdbtblview ~ + COMMAND comsdb ~ + COMMAND scktserv Connect + COMMAND rcntion Open NETWORKING-Wlan-Transfer-0004-0001-Open_command08 + COMMAND rcntion Start NETWORKING-Wlan-Transfer-0004-0001-Start_command09 + COMMAND rsckt Open NETWORKING-Wlan-Transfer-0004-0001-Open_command10 + COMMAND rsckt Connect NETWORKING-Wlan-Transfer-0004-0001-Connect_command11 + OUTSTANDING + COMMAND rsckt UploadSendHTTPPost NETWORKING-Wlan-Transfer-0004-0001-UploadSendHTTPPost_command12 + COMMAND rsckt RecvOneOrMore NETWORKING-Wlan-Transfer-0004-0001-RecvOneOrMore_command13 + COMMAND rsckt Shutdown + OUTSTANDING + COMMAND rsckt Close + COMMAND rcntion Close + COMMAND scktserv Close + END_TEST_BLOCK +END_TESTCASE NETWORKING-WLAN-VALIDATION-AUTOMATED-TRANSFER-0004 + +DELAY 10000 + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_CCommsDatabaseData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_CCommsDatabaseData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include "t_ccommsdatabasedata.h" + +/*@{*/ +//LIT's for commands of CT_CCommsDatabaseData +_LIT(KCmdNewL, "NewL"); +_LIT(KCmdDestructor, "~"); +/*@}*/ + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_CCommsDatabaseData* CT_CCommsDatabaseData::NewL() + { + CT_CCommsDatabaseData* ret = new (ELeave) CT_CCommsDatabaseData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/** + * Public destructor + */ +CT_CCommsDatabaseData::~CT_CCommsDatabaseData() + { + DestroyData(); + } + +/** + * Private constructor. First phase construction + */ + +CT_CCommsDatabaseData::CT_CCommsDatabaseData() +: iCommsDat(NULL) + { + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_CCommsDatabaseData::ConstructL() + { + } + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_CCommsDatabaseData::GetObject() + { + return iCommsDat; + } + +/** + * Process a command read from the Ini file + * @param aCommand The command to process + * @param aSection The section get from the *.ini file of the project T_Wlan + * @param aAsyncErrorIndex Command index dor async calls to returns errors to + * @return TBool ETrue if the command is process + * @leave system wide error + */ +TBool CT_CCommsDatabaseData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName&/* aSection*/, const TInt /*aAsyncErrorIndex*/) + { + TBool ret = ETrue; + + if(aCommand == KCmdNewL) + { + DoCmdNewL(); + } + else if(aCommand == KCmdDestructor) + { + DoCmdDestructor(); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret = EFalse; + } + + return ret; + } + + +/** + * Command to create an Instance of CCommsDatabase class + * @param + * @return + */ +void CT_CCommsDatabaseData::DoCmdNewL() + { + INFO_PRINTF1(_L("*START* CT_CCommsDatabaseData::DoCmdNewL")); + DestroyData(); + + TRAPD(err,iCommsDat = CCommsDatabase::NewL(ETrue)); + if(err!=KErrNone) + { + ERR_PRINTF2(_L("CCommsDatabase* commsDat = CCommsDatabase::NewL(ETrue) left with error %d"), err); + SetError(err); + } + else + { + INFO_PRINTF1(_L("CCommsDatabase* commsDat = CCommsDatabase::NewL(ETrue) was create")); + } + + INFO_PRINTF1(_L("*END* CT_CCommsDatabaseData::DoCmdNewL")); + } + +/** + * Command to destroy an Instance of CCommsDatabase class + * @param + * @return + */ +void CT_CCommsDatabaseData::DoCmdDestructor() + { + INFO_PRINTF1(_L("*START* CT_CCommsDatabaseData::DoCmdDestructor")); + DestroyData(); + INFO_PRINTF1(_L("*END* CT_CCommsDatabaseData::DoCmdDestructor")); + } + +/** + *Helper function to DoCmdDelete command + * @param + * @return + */ +void CT_CCommsDatabaseData::DestroyData() + { + if(iCommsDat) + { + delete iCommsDat; + iCommsDat = NULL; + } + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_CCommsDbTableViewData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_CCommsDbTableViewData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#include "t_ccommsdbtableviewdata.h" + +// CommsDat preferences setting class. +#include +#include + +/*@{*/ +//LIT for the data read from the ini file +_LIT(KCommsDb, "commsdb"); +/*@}*/ + +/*@{*/ +//LIT's for the commands +_LIT(KCmdNewL, "NewL"); +_LIT(KCmdDestructor, "~"); +/*@}*/ + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_CCommsDbTableViewData* CT_CCommsDbTableViewData::NewL() + { + CT_CCommsDbTableViewData* ret = new (ELeave) CT_CCommsDbTableViewData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/** + * Public destructor + */ +CT_CCommsDbTableViewData::~CT_CCommsDbTableViewData() + { + DestroyData(); + } + +/** + * Private constructor. First phase construction + */ +CT_CCommsDbTableViewData::CT_CCommsDbTableViewData() +: iSearchView(NULL) + { + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_CCommsDbTableViewData::ConstructL() + { + } + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_CCommsDbTableViewData::GetObject() + { + return iSearchView; + } + +/** +* Process a command read from the Ini file +* @param aCommand The command to process +* @param aSection The section get from the *.ini file of the project T_Wlan +* @param aAsyncErrorIndex Command index dor async calls to returns errors to +* @return TBool ETrue if the command is process +* @leave system wide error +*/ + +TBool CT_CCommsDbTableViewData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt/* aAsyncErrorIndex*/) + { + TBool ret = ETrue; + if(aCommand == KCmdNewL) + { + DoCmdNewL(aSection); + } + else if(aCommand == KCmdDestructor) + { + DoCmdDestructor(); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret = EFalse; + } + return ret; + } + + + + +/** + * Command to create an instance of CCommsDbTableView class + * @param aSection The section in the ini file for this command + * @return + */ +void CT_CCommsDbTableViewData::DoCmdNewL(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_CCommsDbTableViewData::DoCmdNewL")); + DestroyData(); + + TPtrC commsDbName; + const TUint32 KIAPMask = 0xffffffff; + TBool dataOk = ETrue; + + //param from the ini file + if(!GetStringFromConfig(aSection, KCommsDb, commsDbName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCommsDb); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + CCommsDatabase* acommsDat = static_cast(GetDataObjectL(commsDbName)); + //CCommsDatabase* acommsDat = CCommsDatabase::NewL(ETrue); + //iSearchView = acommsDat->OpenIAPTableViewMatchingBearerSetLC( KIAPMask, ECommDbConnectionDirectionOutgoing ); + iSearchView = acommsDat->OpenIAPTableViewMatchingBearerSetLC( KIAPMask, ECommDbConnectionDirectionOutgoing ); + CleanupStack::Pop(); + } + + INFO_PRINTF1(_L("*END* CT_CCommsDbTableViewData::DoCmdNewL")); + } +/** + * Command for delete an instance of CCommsDbTableView class + * @param + * @return + */ +void CT_CCommsDbTableViewData::DoCmdDestructor() + { + INFO_PRINTF1(_L("*START* CT_CCommsDbTableViewData::DoCmdDestructor")); + + //CleanupStack::Pop(iSearchView); + DestroyData(); + + INFO_PRINTF1(_L("*END* CT_CCommsDbTableViewData::DoCmdDestructor")); + } + +/** + * Helper function for the command DoCmdDelete + * @param + * @return + */ +void CT_CCommsDbTableViewData::DestroyData() + { + if (iSearchView) + { + delete iSearchView; + iSearchView = NULL; + } + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_RConnectionData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_RConnectionData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include "t_rconnectiondata.h" +#include "t_rsocketservdata.h" +#include + +/*@{*/ +//LIT param read from the ini file +_LIT(KSocketServ, "socketserv"); +/*@}*/ + +/*@{*/ +//LITs for commands +_LIT(KCmdOpen, "Open"); +_LIT(KCmdStart, "Start"); +_LIT(KCmdClose, "Close"); +/*@}*/ + + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_RConnectionData* CT_RConnectionData::NewL() + { + CT_RConnectionData * ret = new (ELeave)CT_RConnectionData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/** + * Public destructor + */ +CT_RConnectionData::~CT_RConnectionData() + { + if (iConnection) + { + delete iConnection; + iConnection = NULL; + } + } + +/** + * Private constructor. First phase construction + */ +CT_RConnectionData::CT_RConnectionData() +: iConnection(NULL) + { + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_RConnectionData::ConstructL() + { + iConnection = new (ELeave)RConnection(); + } + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_RConnectionData::GetObject() + { + return iConnection; + } + +/** + * Process a command read from the Ini file + * @param aCommand The command to process + * @param aSection The section get from the *.ini file of the project T_Wlan + * @param aAsyncErrorIndex Command index dor async calls to returns errors to + * @return TBool ETrue if the command is process + * @leave system wide error + */ +TBool CT_RConnectionData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) + { + TBool ret = ETrue; + if(aCommand == KCmdOpen) + { + DoCmdOpen(aSection); + } + else if(aCommand == KCmdStart) + { + DoCmdStart(aSection); + } + else if(aCommand == KCmdClose) + { + DoCmdClose(); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret= EFalse; + } + return ret; + } + + +/** + * Command to open a connection (RConnection::Open). The errors are management + * with SetError() and SetBlockResult(). + * @param aSection Section in the ini file for this command + * @return + */ +void CT_RConnectionData::DoCmdOpen(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RConnectionData::DoCmdOpen")); + TBool dataOk = ETrue; + + // read param from the ini file + TPtrC socketServName; + if(!GetStringFromConfig(aSection, KSocketServ, socketServName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSocketServ); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + RSocketServ* iSocketServ = static_cast(GetDataObjectL(socketServName)); + + // Open a connection + TInt err = iConnection->Open(*iSocketServ); + if(err == KErrNone) + { + INFO_PRINTF1(_L("The connection was opened")); + } + else + { + ERR_PRINTF2(_L("iConnection->Open( iSocketServ ) Failed with error %d"), err); + SetError(err); + } + + INFO_PRINTF1(_L("*END* CT_RConnectionData::DoCmdOpen")); + } + } + +/** + * Command to Start a connection with the ID IAP given before in the wrapper CT_RSocketServData. The + * errors are management with SetError() and SetBlockResult() + * @param aSection Section in the ini file for this command + * @return + */ +void CT_RConnectionData::DoCmdStart(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RConnectionData::DoCmdStart")); + TBool dataOk = ETrue; + + // read a param from the ini file + TPtrC socketServName; + if(!GetStringFromConfig(aSection, KSocketServ, socketServName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSocketServ); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + TInt err(KErrNone); + TUint32 id; + + // Get complete wrapper + CT_RSocketServData* iSocketServ = static_cast(GetDataWrapperL(socketServName)); + INFO_PRINTF2(_L("iSocketServ: %S"), &socketServName); + + if(iSocketServ != NULL) + { + // Start the connection using the given (WLAN) access point + id = iSocketServ->GetIapID(); + INFO_PRINTF2(_L("CT_RConnectionData::DoCmdStart: Start RConnection, using IAP [%d]"), id); + + TCommDbConnPref* connPref = new (ELeave) TCommDbConnPref; + connPref->SetIapId(id); + connPref->SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); + connPref->SetDirection( ECommDbConnectionDirectionOutgoing ); + connPref->SetBearerSet(KCommDbBearerUnknown); + + INFO_PRINTF1(_L("CT_RConnectionData: Starting connection")); + // Wait before the connection is really made + // Wait time is 8 seconds. + err = iConnection->Start( *connPref ) ; + if(err != KErrNone) + { + ERR_PRINTF2(_L("iConnection->Start( connPref ) Fail: %d "),err); + SetError(err); + } + } + else + { + ERR_PRINTF1(_L("CT_RConnectionData::DoCmdStart: iSocketServ is NULL")); + SetBlockResult(EFail); + } + } + + INFO_PRINTF1(_L("*END* CT_RConnectionData::DoCmdStart")); + } + + +/** + * Command to close a connection(RConnection::Close) + * @param + * @return + */ +void CT_RConnectionData::DoCmdClose() + { + INFO_PRINTF1(_L("*START* CT_RConnectionData::DoCmdClose")); + Close(); + INFO_PRINTF1(_L("*END* CT_RConnectionData::DoCmdClose")); + } + +/** + * Helper function for the command DoCmdConnection + * @param + * @return + */ + +void CT_RConnectionData::Close() + { + INFO_PRINTF1(_L("Closing connection")); + iConnection->Close(); + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_RFileData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_RFileData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include "t_rfiledata.h" + +/*@{*/ +//LIT for the command DoCmdGenerateFile +_LIT(KCmdGenerateFile, "GenerateFile"); +/*@}*/ + +/*@{*/ +//LITs for param reads from the ini file +_LIT(KFile, "File"); +_LIT(KSize, "Size"); +/*@}*/ + + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_RFileData* CT_RFileData::NewL() + { + CT_RFileData* ret = new (ELeave) CT_RFileData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/** + * Public destructor + */ +CT_RFileData::~CT_RFileData() + { + iFs.Close(); + + if (iFile) + { + delete iFile; + iFile = NULL; + } + } + +/** + * Private constructor. First phase construction + */ +CT_RFileData::CT_RFileData() +: iFile(NULL), + iFs() + { + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_RFileData::ConstructL() + { + iFile = new (ELeave)RFile(); + } + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_RFileData::GetObject() + { + return iFile; + } + +/** + * Process a command read from the Ini file + * @param aCommand The command to process + * @param aSection The section get from the *.ini file of the project T_Wlan + * @param aAsyncErrorIndex Command index dor async calls to returns errors to + * @return TBool ETrue if the command is process + * @leave system wide error + */ + +TBool CT_RFileData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) + { + TBool ret =ETrue; + if(aCommand == KCmdGenerateFile()) + { + DoCmdGenerateFile(aSection); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret = EFalse; + } + return ret; + } + + +/** + * Command to generate a file for uploading in a host. If there are errors, SetBlockResult() and SetError() + * are used for management. + * @param aSection Section in the ini file for this command + * @return + */ +void CT_RFileData::DoCmdGenerateFile(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RFileData::DoCmdGenerateFile")); + + TBool dataOk = ETrue; + + TPtrC file; + if(!GetStringFromConfig(aSection, KFile, file)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFile); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TInt size; + if(!GetIntFromConfig(aSection, KSize, size)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSize); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + INFO_PRINTF1(_L("Connect RFs")); + + CleanupClosePushL( iFs ); + CleanupClosePushL( *iFile ); + + TInt err = iFs.Connect(); + if(err == KErrNone) + { + INFO_PRINTF1(_L("Replace file")); + err = iFile->Replace( iFs, file, EFileShareAny|EFileWrite ); + if(err == KErrNone) + { + INFO_PRINTF1(_L("Set file size")); + err = iFile->SetSize( size ); + if(err != KErrNone) + { + ERR_PRINTF2(_L("CT_RFileData::DoCmdGenerateFile: file.SetSize(...) Failed with error %d"), err); + SetError(err); + } + } + else + { + ERR_PRINTF2(_L("CT_RFileData::DoCmdGenerateFile: file.Replace(...) Failed with error %d"), err); + SetError(err); + } + } + else + { + ERR_PRINTF2(_L("CT_RFileData::DoCmdGenerateFile: fs.Connect() Failed with error %d"), err); + SetError(err); + } + + INFO_PRINTF1(_L("Close RFile handle")); + CleanupStack::PopAndDestroy( iFile ); + INFO_PRINTF1(_L("Close RFs handle")); + CleanupStack::PopAndDestroy( &iFs ); + } + + INFO_PRINTF1(_L("*END* CT_RFileData::DoCmdGenerateFile")); + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_RSocketData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_RSocketData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,1359 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include +#include "t_rsocketdata.h" + +/*@{*/ +// LITs from the ini file +_LIT( KSocketServ, "socketserv"); +_LIT( KConnection, "connection"); +_LIT( KScanInfo, "scaninfo"); +_LIT( KAddress, "Ip"); +_LIT( KPort, "Port"); +_LIT( KFile, "File"); +_LIT( KSave, "Save"); +_LIT( KARates, "rate"); +_LIT( KFileServer, "FileServer"); +/*@}*/ + +/*@{*/ +// Upload +_LIT(KNullFile, "KNullDesC"); +/*@}*/ + +/*@{*/ +// LITs for the commands +_LIT( KCmdOpen, "Open"); +_LIT( KCmdConnect, "Connect"); +_LIT( KCmdHttpGet, "HttpGet"); +_LIT( KCmdDownloadSendHTTPGet, "DownloadSendHTTPGet"); +_LIT( KCmdRecvOneOrMore, "RecvOneOrMore"); +_LIT( KCmdUploadSendHTTPPost, "UploadSendHTTPPost"); +_LIT( KCmdCheckSupportedRates, "CheckSupportedRates"); +_LIT( KCmdShutdown, "Shutdown"); +_LIT( KCmdClose, "Close"); +/*@}*/ + +/*@{*/ +// Constants for creating a HTTP request in the command DoCmdDownloadSendHTTPGet +_LIT8( KHTTPGET, "GET"); +_LIT8( KHTTPSeparator, " "); +_LIT8( KHTTPSuffix, "HTTP/1.1"); +_LIT( KHostS, "Host"); +_LIT8( KLineFeed, "\r\n"); +_LIT8( KEmptyLine, "\r\n\r\n"); +_LIT8( KHeaderEndMark, "\r\n\r\n" ); +_LIT8( KContentLengthField, "Content-Length: "); +_LIT8( KFieldEnd, "\r\n" ); +_LIT8( KGETHTTP, "GET / HTTP/1.0\r\n\r\n" ); +/*@}*/ + +/*@{*/ +// Constants for CreateHTTPHeaderStart +_LIT8(KHTTPPOST, "POST"); +_LIT8(KLineBreak, "\r\n"); +_LIT(KClientID, "clientID"); +_LIT(KServerScript, "serverScript"); +_LIT8(KFrom, "From:"); +_LIT8(KHosts, "Host:"); +_LIT8(KContentType, "Content-Type:"); +_LIT8(KContentLength, "Content-Length:"); +_LIT8(KContentDisposition, "Content-Disposition:"); +_LIT8(KMultipartType, "multipart/form-data;"); +_LIT8(KOctetType, "application/octet-stream"); +_LIT8(KBoundary, "boundary=---------------------------sg976436h73"); +_LIT8(KBoundaryStart, "-----------------------------sg976436h73"); +_LIT8(KDisposition, "form-data; name=\"userfile\"; filename="); +_LIT8(KBackS, "\""); +_LIT8(KBoundaryEnd, "-----------------------------sg976436h73--"); +/*@}*/ + + +const TInt KHttpHeaderBufferIncrement = 4096; +// Const for supported rates +// The first bit includes information about BSSBasicRateSet, +// mask it out + +const TUint32 KBasicRateMask = 0x7F; +// 802.11g supported speed rate +const TUint8 K80211Rate1Mbit = 2; +const TUint8 K80211Rate2Mbit = 4; +const TUint8 K80211Rate5Mbit = 11; +const TUint8 K80211Rate11Mbit = 22; +const TUint8 K80211Rate12Mbit = 24; +const TUint8 K80211Rate18Mbit = 36; +const TUint8 K80211Rate22Mbit = 44; +const TUint8 K80211Rate24Mbit = 48; +const TUint8 K80211Rate33Mbit = 66; +const TUint8 K80211Rate36Mbit = 72; +const TUint8 K80211Rate48Mbit = 96; +const TUint8 K80211Rate54Mbit = 108; + + + + + + + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_RSocketData* CT_RSocketData::NewL() + { + CT_RSocketData * ret = new (ELeave)CT_RSocketData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/* + *RunL method for management Active callbacks + * @param aActive param to review which active call back is being fished + * @param aIndex + * @return void + */ +void CT_RSocketData::RunL(CActive* aActive, TInt /*aIndex*/) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::RunL")); + DecOutstanding(); // One of the async calls has completed + TInt err(KErrNone); + if(aActive == iActiveCallback) + { + INFO_PRINTF1(_L("active call back for Write Socket.")); + err = iActiveCallback->iStatus.Int(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("iSocket->Write(...) Fail")); + SetError(err); + } + else + { + INFO_PRINTF2(_L("CT_RSocketData::SendHTTPGet [%d]"), iActiveCallback->iStatus.Int()); + INFO_PRINTF1(_L("Asynchronous task has completed. RunL called")); + } + } + else if(aActive == iActCallConnectSocket) + { + INFO_PRINTF1(_L("active call back for Connect Socket.")); + err = iActCallConnectSocket->iStatus.Int(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("iSocket->Connect(...) Fail")); + SetError(err); + } + else + { + INFO_PRINTF1(_L("CT_RSocketData::DoCmdConnect(...) success")); + iSocketOpened = ETrue; + } + } + else if(aActive == iActCallShutDownSocket) + { + INFO_PRINTF1(_L("active call back for Shutdown Socket.")); + err = iActCallShutDownSocket->iStatus.Int(); + if(err != KErrNone) + { + ERR_PRINTF2(_L("iSocket->Shutdown(...): [%d] Fail"),iActCallShutDownSocket->iStatus.Int()); + SetError(err); + } + else + { + INFO_PRINTF1(_L("CT_RSocketData::Shutdown success")); + iSocketStarted = EFalse; + } + } + else + { + ERR_PRINTF1(_L("An unchecked active object completed")); + SetBlockResult(EFail); + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::RunL")); + } +/* + * public destructor + */ +CT_RSocketData::~CT_RSocketData() + { + if (iSocketStarted) + { + INFO_PRINTF1(_L("CT_RSocketData: Shutting down socket")); + Shutdown(); + } + if (iSocketOpened) + { + Close(); + } + if (iDownloadBuffer) + { + delete iDownloadBuffer; + iDownloadBuffer = NULL; + } + if (iSocket) + { + delete iSocket; + iSocket = NULL; + } + if (iActiveCallback) + { + delete iActiveCallback; + iActiveCallback = NULL; + } + if (iActCallShutDownSocket) + { + delete iActCallShutDownSocket; + iActCallShutDownSocket = NULL; + } + if (iActCallConnectSocket) + { + delete iActCallConnectSocket; + iActCallConnectSocket = NULL; + } + + iFs.Close(); + + if (iUploadBuffer) + { + delete iUploadBuffer; + iUploadBuffer = NULL; + } + } + +/** + * Private constructor. First phase construction + * + */ +CT_RSocketData::CT_RSocketData() +: iSocket(NULL), + iActiveCallback(NULL), + iActCallConnectSocket(NULL), + iActCallShutDownSocket(NULL), + iSocketOpened(EFalse), + iSocketStarted(EFalse), + iAsyncErrorIndex(0), + iDownloadBuffer(NULL), + iUploadBuffer(NULL), + iHttpResponseHeader(), + iDownloadThroughput(0.0), + iFs(), + iUploadThroughput(0.0), + itotalReceived(0) + { + + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_RSocketData::ConstructL() + { + const TInt KDefaultBufferSize = 4096; + TInt err(KErrNone); + iSocket = new (ELeave) RSocket(); + iActiveCallback = CActiveCallback::NewL(*this); + iActCallConnectSocket = CActiveCallback::NewL(*this); + iActCallShutDownSocket = CActiveCallback::NewL(*this); + iDownloadBuffer = HBufC8::NewL( KDefaultBufferSize); + iUploadBuffer = HBufC8::NewL(KDefaultBufferSize); + err = iFs.Connect(); + if(err != KErrNone) + { + SetError(err); + } + } + + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_RSocketData::GetObject() + { + return iSocket; + } + + + +/** + * Process a command read from the Ini file + * @param aCommand The command to process + * @param aSection The section get from the *.ini file of the project T_Wlan + * @param aAsyncErrorIndex Command index for async calls to returns errors to + * @return TBool ETrue if the command is process + * @leave system wide error + * + */ +TBool CT_RSocketData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) + { + TBool ret = ETrue; + if(aCommand == KCmdOpen ) + { + DoCmdOpen(aSection); + } + else if(aCommand == KCmdConnect) + { + DoCmdConnect(aSection,aAsyncErrorIndex); + } + else if(aCommand == KCmdDownloadSendHTTPGet) + { + DoCmdDownloadSendHTTPGet(aSection,aAsyncErrorIndex); + } + else if(aCommand == KCmdRecvOneOrMore) + { + DoCmdRecvOneOrMore(aSection); + } + else if(aCommand == KCmdUploadSendHTTPPost) + { + DoCmdUploadSendHTTPPost(aSection); + } + else if(aCommand == KCmdShutdown) + { + DoCmdShutdown(aAsyncErrorIndex); + } + else if(aCommand == KCmdClose) + { + DoCmdClose(); + } + else if(aCommand == KCmdHttpGet) + { + DoCmdHttpGet(); + } + else if(aCommand == KCmdCheckSupportedRates) + { + DoCmdCheckSupportedRates(aSection); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret = EFalse; + } + return ret; + } + + + + +/** + * Open the Socket from RSocket. The errors are management with SetError() and SetBlockResult(). + * @param aSection Section in the ini file for this command. + * @return + */ +void CT_RSocketData::DoCmdOpen(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdOpen")); + TBool dataOk = ETrue; + + TPtrC connectionName; + if(! GetStringFromConfig(aSection, KConnection, connectionName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KConnection); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC socketServName; + if(! GetStringFromConfig(aSection, KSocketServ, socketServName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSocketServ); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + INFO_PRINTF1(_L("Opening a TCP/IP socket")); + + RConnection* rConnection = static_cast(GetDataObjectL(connectionName)); + RSocketServ* rSocketServ = static_cast(GetDataObjectL(socketServName)); + + if(rConnection != NULL && rSocketServ != NULL) + { + TInt error = iSocket->Open( *rSocketServ, KAfInet, KSockStream, KProtocolInetTcp, *rConnection ); + + if(error == KErrNone) + { + iSocketOpened = ETrue; + } + else + { + ERR_PRINTF2(_L("Socket opening failed [%d]"), error); + SetError(error); + } + } + else + { + if(rConnection == NULL) + { + ERR_PRINTF2(_L("rConnection is NULL: %S"),rConnection); + SetBlockResult(EFail); + } + + if(rSocketServ == NULL) + { + INFO_PRINTF2(_L("rSocketServ is NULL: %S"),rSocketServ); + SetBlockResult(EFail); + } + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdOpen")); + } + +/** + * Command to Connect a Socket of RSocket. + * @param aSection Section to read from the ini file + * @param aAsyncErrorIndex Command index for async calls to returns errors to + * @return + */ +void CT_RSocketData::DoCmdConnect(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdConnect")); + TBool dataOk = ETrue; + + //Getting from the .ini the IP Address + TPtrC aIpAddr; + if(!GetStringFromConfig( aSection, KAddress, aIpAddr )) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAddress); + SetBlockResult(EFail); + dataOk = EFalse; + } + + //Getting the port from the file ini + TInt aPort; + if(!GetIntFromConfig( aSection, KPort,aPort )) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPort); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if(dataOk) + { + // Set the IP Address + TInetAddr inetAddr; + TInt err = inetAddr.Input( aIpAddr ) ; + if(err == KErrNone) + { + INFO_PRINTF2(_L("Remote IP: %S"), &aIpAddr ); + INFO_PRINTF2( _L("Port: %d"), aPort ); + // Set the port + inetAddr.SetPort( aPort ); + // Connect an IP through the Port 80 + iSocket->Connect( inetAddr, iActCallConnectSocket->iStatus ); + iActCallConnectSocket->Activate(aAsyncErrorIndex); + IncOutstanding(); + } + else + { + ERR_PRINTF2(_L("inetAddr.Input( aIpAddr ) Failed with error %d"), err); + SetError(err); + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdConnect")); + } + +/** + * Command to send the HTTP Get, using the socket Write. + * @param aSection Section to read from the ini file + * @param aAsyncErrorIndex Command index for async calls to returns errors to + * @return + */ +void CT_RSocketData::DoCmdDownloadSendHTTPGet(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex ) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdDownloadSendHTTPGet")); + TBool dataOk = ETrue; + + // Read params from the ini file + TPtrC aHost; + if(!GetStringFromConfig( aSection, KHostS, aHost)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHostS); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC aFilename; + if(!GetStringFromConfig( aSection, KFile, aFilename )) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFile); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + const TInt KMaxHostNameLength(256); + if( aHost.Length() > KMaxHostNameLength ) + { + ERR_PRINTF1(_L("Host is too long, cannot send HTTP request")); + SetBlockResult(EFail); + } + else if( aFilename.Length() > KMaxFileName ) + { + ERR_PRINTF1(_L("Filename is too long, cannot send HTTP request")); + SetBlockResult(EFail); + } + else + { + INFO_PRINTF1(_L("Create HTTP GET request")); + // Buffer that will hold the request. + TBuf8< sizeof( KHTTPGET ) + + sizeof( KHTTPSeparator ) + + KMaxFileName + + sizeof( KHTTPSeparator ) + + sizeof( KHTTPSuffix ) + + sizeof( KLineFeed ) + + sizeof( KHosts ) + + KMaxHostNameLength + + sizeof( KEmptyLine ) > request; + // Construct the final request. + request.Copy( KHTTPGET ); + request.Append( KHTTPSeparator ); + request.Append( aFilename ); + request.Append( KHTTPSeparator ); + request.Append( KHTTPSuffix ); + request.Append( KLineFeed ); + request.Append( KHosts ); + request.Append( aHost ); + request.Append( KEmptyLine ); + + INFO_PRINTF1(_L("Write to socket")); + // Send the request through socket + iSocket->Write(request, iActiveCallback->iStatus); + iActiveCallback->Activate(aAsyncErrorIndex); + IncOutstanding(); + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdDownloadSendHTTPGet")); + } + +/** + * Command to receive an HTTP Response for Upload and Download of files. + * @param aSection Section to read from the ini file + * @return + */ +void CT_RSocketData::DoCmdRecvOneOrMore(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdRecvOneOrMore")); + TBool dataOk = ETrue; + + // Read from the ini file + TPtrC aFilename; + if(!GetStringFromConfig( aSection, KSave,aFilename )) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSave); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + RFile file; + TInt error = KErrNone; + + //if KNullFile then Upload + TBool discardData = ( aFilename == KNullFile); + INFO_PRINTF2(_L("File and path to Download: %S"),&aFilename); + if( !discardData ) + { + INFO_PRINTF1( _L("Data is not discarded, creating file") ); + error = file.Replace( iFs, aFilename, EFileShareAny|EFileWrite ); + } + else + { + INFO_PRINTF1( _L("Discarding downloaded data") ); + } + + if( error == KErrNone ) + { + TSockXfrLength received; + TInt totalReceived = 0; + TInt contentReceived = 0; + TInt timedReceived = 0; + TInt contentLength = 0; + TRequestStatus status; + TPtr8 downloadBufferPtr( iDownloadBuffer->Des() ); + + downloadBufferPtr.SetMax(); + INFO_PRINTF2( _L("Using buffer size [%d]"), downloadBufferPtr.MaxSize() ); + + INFO_PRINTF1(_L("Set time stamps for download")); + TTime endTime; + TTime startTime; + + INFO_PRINTF1( _L("Receiving data")); + + // Let's assume that we receive a HTTP header first + TBool header( ETrue ); + TBool timerStarted( EFalse ); + TBool failure = EFalse; // a flag to delete multiple returns + + iHttpResponseHeader.Zero(); + // receive until RecvOneOrMore fails or all content is received + do + { + if( !timerStarted && !header) + { + startTime.HomeTime(); + endTime.HomeTime(); + timerStarted = ETrue; + } + + iSocket->RecvOneOrMore( downloadBufferPtr, 0, status, received ); + User::WaitForRequest( status ); + if( !header ) + { + timedReceived += received(); + } + + if( KErrNone == status.Int() ) + { + // Check if we are still receiving the HTTP header + if( header ) + { + //Increase httpResponseheader size if needed + if(iHttpResponseHeader.Length() + downloadBufferPtr.Length() > iHttpResponseHeader.MaxLength()) + { + error = iHttpResponseHeader.ReAlloc(iHttpResponseHeader.MaxLength() + KHttpHeaderBufferIncrement); + if(error != KErrNone) + { + ERR_PRINTF2( _L("iHttpResponseHeader.ReAlloc(...) Failed with error %d"), error); + SetError( error ); + failure = ETrue; + break; + } + } + + //Append the donwloaded content to headerbuffer + iHttpResponseHeader.Append(downloadBufferPtr); + TInt headerEndIndex = iHttpResponseHeader.Find( KHeaderEndMark ); + if( headerEndIndex != KErrNotFound ) + { + INFO_PRINTF1( _L("Header end mark found")); + //Parse Content-Length field and extract content length + TInt contentLengthStart = iHttpResponseHeader.Find( KContentLengthField ); + //If Content-Length field is found + if( contentLengthStart != KErrNotFound ) + { + INFO_PRINTF1(_L("Content-Length field found from HTTP response")); + contentLengthStart += KContentLengthField().Length(); + TPtrC8 contentLengthDes; + contentLengthDes.Set(iHttpResponseHeader.Mid( contentLengthStart )); + TInt contentLengthEnd = contentLengthDes.Find( KFieldEnd ); + contentLengthDes.Set(contentLengthDes.Mid(0, contentLengthEnd)); + TLex8 lex; + lex.Assign( contentLengthDes ); + lex.Val(contentLength); + INFO_PRINTF2( _L("Content-Length: [%d]"), contentLength ); + } + else + { + INFO_PRINTF1( _L("No Content-Length field found from HTTP response")); + INFO_PRINTF1( _L("Assuming Content-Length: 0")); + contentLength = 0; + file.Close(); + error = iFs.Delete(aFilename); + if(error != KErrNone) + { + INFO_PRINTF3(_L("Error [%d] for delete the file %S"), &aFilename,error); + SetError(error); + failure = ETrue; + break; + } + ERR_PRINTF2(_L("File %S was not found"), &aFilename); + SetBlockResult(EFail); + failure = ETrue; + break; + } + // Header was found + headerEndIndex += KHeaderEndMark().Length(); + //Convert the headerEndIndex in httpResponseheader to index in downloadBuffer + headerEndIndex -= totalReceived; + //Delete remaining parts of the HTTP header from the download buffer + downloadBufferPtr.Delete( 0, headerEndIndex ); + header = EFalse; + } + } + + // Increase the total received amount as we receive more data. + // Note: received data count also counts headers, this is taken + // into account in timing (startTime) + totalReceived += received(); + if(!header) + { + contentReceived += downloadBufferPtr.Length(); + } + + if( !discardData ) + { + error = file.Write( *iDownloadBuffer ); + if( KErrNone != error ) + { + ERR_PRINTF2( _L("Failed to write local file [%d]"), error ); + file.Close(); + SetError(error); + failure = ETrue; + break; + } + } + } + else + { + INFO_PRINTF1(_L("Set end time")); + endTime.HomeTime(); + INFO_PRINTF2( _L("Receiving err [%d]"), status.Int()); + break; + } + } + while( KErrNone == status.Int() && contentReceived < contentLength ); + + if (!failure) + { + endTime.HomeTime(); + INFO_PRINTF2( _L("Received total of [%d] bytes (inc headers)"), totalReceived ); + INFO_PRINTF2( _L("Content received [%d] bytes"), contentReceived ); + + //Set this printing optional + //Print only if any amount of datatransfer was timed (skipped in the case of very short data transfers) + if( timerStarted ) + { + INFO_PRINTF1(_L("Calculate duration of the transfer")); + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom( startTime ); + INFO_PRINTF2( _L("Duration for the timed data transfer was [%Ld] microseconds"), duration.Int64() ); + INFO_PRINTF2( _L("Received [%d] bytes during timed data transfer"), timedReceived); + iDownloadThroughput = ThroughputInMegaBits( duration, timedReceived ); + } + else + { + INFO_PRINTF1( _L("Data transfer too short for throughput calculation")); + } + + // We allow any response to our reply at the moment. + if( !discardData ) + { + file.Close(); + } + } + } + else + { + ERR_PRINTF2( _L("Failed to open local file [%d]"), error ); + SetError(error); + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdRecvOneOrMore")); + } + +/** + * Create an HTTP Post for uploading files. + * @param aSection Section to read from the ini file + * @return + */ +void CT_RSocketData::DoCmdUploadSendHTTPPost(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdUploadSendHTTPPost")); + TBool dataOk = ETrue; + + INFO_PRINTF1( _L("Write to socket")); + + TPtrC aFilename; + if(!GetStringFromConfig(aSection,KFile,aFilename)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFile); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC fileServer; + if(!GetStringFromConfig(aSection,KFileServer,fileServer)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFileServer); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC clientID; + if(!GetStringFromConfig(aSection,KClientID,clientID)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KClientID); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC serverScript; + if(!GetStringFromConfig(aSection,KServerScript,serverScript)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KServerScript); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + const TInt KMaxTag = 256; + // KHeaderWithoutData will change if you alter the header in any way that changes the + // amount of characters in it! SO REMEMBER to calclulate header size again. + const TInt KHeaderWithoutData = 200; + TBuf8 request; + TRequestStatus status; + + CreateHTTPHeaderStart(request, ReadFileSizeL(aFilename),fileServer, clientID, serverScript); + + iSocket->Write( request,status); + User::WaitForRequest( status ); + if(status.Int() == KErrNone) + { + INFO_PRINTF1( _L("HTTP POST request send, sending payload next")); + // Send file to iSocket + SendFileToSocketL(aFilename); + request.SetLength( 0 ); + CreateHTTPHeaderEnd(request); + + // Send the rest of the header + INFO_PRINTF1(_L("Sending boundary end")); + iSocket->Write( request, status ); + User::WaitForRequest( status ); + if(status.Int() != KErrNone) + { + ERR_PRINTF2(_L("CT_RSocketData::DoCmdUploadSendHTTPPost: iSocket->Write( request,status) Failed with error %d"), status.Int()); + SetError(status.Int()); + } + } + else + { + ERR_PRINTF2(_L("CT_RSocketData::DoCmdUploadSendHTTPPost: iSocket->Write( request,status) Failed with error %d"), status.Int()); + SetError(status.Int()); + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdUploadSendHTTPPost")); + } + +/** + * Create or build the header for POST. + * @param aRequest Descriptor with a lenght of 456 that contain the parameters for the POST + * @param aDataSize Size of the file + * @return + */ +void CT_RSocketData::CreateHTTPHeaderStart(TDes8& aRequest, TInt aDataSize,TDesC& aFileServer, TDesC& clientID,TDesC& serverScript) + { + // Manually created HTTP Post request is difficult to maintain. + // Request and server responce is logged into file during test run. + + // KHeaderWithoutData will change if you alter the header in any way + // that changes the amount of characters in it! SO REMEMBER to calclulate + // header size again. + const TInt KHeaderWithoutData = 200; + INFO_PRINTF1( _L("Set socket remote name")); + TSockAddr address; + iSocket->RemoteName( address ); + + // Construct request + aRequest.Append(KHTTPPOST); + aRequest.Append(KHTTPSeparator); + aRequest.Append(serverScript); + aRequest.Append(KHTTPSeparator); + aRequest.Append(KHTTPSuffix); + aRequest.Append(KLineBreak); + + aRequest.Append(KHosts); + aRequest.Append(KHTTPSeparator); + aRequest.Append(address); + aRequest.Append(KLineBreak); + + aRequest.Append(KFrom); + aRequest.Append(KHTTPSeparator); + aRequest.Append(clientID); + aRequest.Append(KLineBreak); + + aRequest.Append(KContentType); + aRequest.Append(KHTTPSeparator); + aRequest.Append(KMultipartType); + aRequest.Append(KHTTPSeparator); + aRequest.Append(KBoundary); + aRequest.Append(KLineBreak); + + aRequest.Append(KContentLength); + aRequest.Append(KHTTPSeparator); + // aRequest size + size of the data to be sent. Server must know how much + // data is coming. + aRequest.AppendNum(KHeaderWithoutData+aDataSize); + aRequest.Append(KLineBreak); + + // extra line break + aRequest.Append(KLineBreak); + + aRequest.Append(KBoundaryStart); + aRequest.Append(KLineBreak); + + aRequest.Append(KContentDisposition); + aRequest.Append(KHTTPSeparator); + aRequest.Append(KDisposition); + aRequest.Append(KBackS); + aRequest.Append(aFileServer); + aRequest.Append(KBackS); + aRequest.Append(KLineBreak); + + aRequest.Append(KContentType); + aRequest.Append(KHTTPSeparator); + aRequest.Append(KOctetType); + aRequest.Append(KLineBreak); + + aRequest.Append(KLineBreak); + } + +/** + * Send aFilename parameter to the Socket with RSocket::Write + * @param aFilename name of the file send to the Socket + * @return + */ +void CT_RSocketData::SendFileToSocketL(const TDesC& aFilename) + { + TInt err(KErrNone); + TPtr8 buffer( iUploadBuffer->Des() ); + buffer.SetMax(); + INFO_PRINTF2( _L("Using buffer size [%d]"), buffer.MaxSize() ); + TInt bytesSent = 0; + + INFO_PRINTF1( _L("Open file")); + RFile file; + + err = file.Open(iFs, aFilename, EFileShareAny|EFileRead); + + if(err == KErrNone) + { + CleanupClosePushL( file ); + INFO_PRINTF1(_L("Read file size")); + TInt fileSize = ReadFileSizeL(aFilename); + + INFO_PRINTF1( _L("Set time stamps for upload")); + TTime endTime; + endTime.HomeTime(); + TTime startTime; + startTime.HomeTime(); + + INFO_PRINTF1( _L("Send file")); + // Loop while enough bytes are sent to socket + while( bytesSent < fileSize ) + { + TInt err = file.Read( buffer ); + + if( err == KErrEof ) + { + INFO_PRINTF1(_L("File sending finished")); + INFO_PRINTF2( _L("Upload buffer length is [%d]"), buffer.Length()); + break; + } + else if( err != KErrNone ) + { + ERR_PRINTF2( _L("Failed to read file [%d]"), err ); + SetError( err ); + break; + } + + TRequestStatus status(KRequestPending); + iSocket->Write( buffer, status ); + User::WaitForRequest( status ); + err = status.Int(); + if(err != KErrNone) + { + ERR_PRINTF2(_L("CT_RSocketData::SendFileToSocketL:iSocket->Write(...) Fail [%d] "),err); + SetError(err); + break; + } + + bytesSent += ( buffer.Length() ); + } + + if (err == KErrNone || err == KErrEof) + { + INFO_PRINTF1( _L("Set end time")); + endTime.HomeTime(); + INFO_PRINTF2( _L("Sent [%d] bytes to server"), bytesSent); + + INFO_PRINTF1( _L("Calculate duration of the transfer")); + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom( startTime ); + INFO_PRINTF2( _L("Duration for the data transfer was [%Ld] microseconds"), duration.Int64() ); + iUploadThroughput = ThroughputInMegaBits( duration, bytesSent ); + CleanupStack::PopAndDestroy( &file ); + } + } + else + { + ERR_PRINTF2(_L("CT_RSocket::SendFileToSocketL::file.Open(...) Failed with error %d"), err); + SetError(err); + } + } + +/** + * Calculated the throughput based on duration of a data transfer and total transferred bytes. + * @param aDuration Duration of the transfer + * @param aBytes Total transferred in bytes + * @return Throughput in MBps + */ +TReal CT_RSocketData::ThroughputInMegaBits(TTimeIntervalMicroSeconds aDuration, TInt aBytes ) + { + const TReal KBitsInByte(8.0); + TReal throughput = ( KBitsInByte * (TReal) aBytes ) / (TReal) aDuration.Int64(); + return throughput; + } + +/** + * Read the lenght of the file (aFileName) + * @param aFileName file to read the lenght + * @return + */ +TInt CT_RSocketData::ReadFileSizeL(const TDesC& aFilename) + { + RFile file; + TInt error = file.Open(iFs, aFilename, EFileShareAny|EFileRead); + if ( error != KErrNone) + { + ERR_PRINTF2( _L("Failed to open local file [%d]"), error); + SetError(error); + return error; + } + + TInt fileSize = 0; + error = file.Size(fileSize); + + if (error!= KErrNone) + { + ERR_PRINTF2(_L("Failed to read file size [%d]"), error); + file.Close(); + SetError(error); + return error; + } + + file.Close(); + return fileSize; + } + +/** + * Build the final header to POST for uploading files + * @param aRequest Descriptor with 456 of lenght that contain the final POST request + * @return + */ +void CT_RSocketData::CreateHTTPHeaderEnd(TDes8& aRequest) + { + //TRequestStatus status; + aRequest.SetLength( 0 ); + //Create the rest of the header data + aRequest.Append( KLineBreak ); + aRequest.Append( KBoundaryEnd ); + aRequest.Append( KLineBreak ); + } + + +/** + * Make a HTTP request to the socket + * @param + * @return + */ +void CT_RSocketData::DoCmdHttpGet() + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdHttpGet")); + + TInt err(KErrNone); + //Constant for creating a HTTP request. + const TInt KHTTPSize = 128; + // Buffer that will hold the request. + TBuf8 request; + // Construct the final request. + request.Append( KGETHTTP ); + + INFO_PRINTF1( _L("Write to socket") ); + TRequestStatus status( KRequestPending ); + iSocket->Write( request, status); + User::WaitForRequest( status ); + INFO_PRINTF2( _L("CT_RSocketData::DoCmdHttpGet: Write done: [%d]"), status.Int() ); + err = status.Int(); + + if(err == KErrNone) + { + INFO_PRINTF1( _L("CT_RSocketData::DoCmdHttpGet: Receive from socket") ); + // receive until RecvOneOrMore fails + do + { + RecvOneOrMore(status); + } + while( status.Int() == KErrNone ); + + INFO_PRINTF2( _L("CT_RSocketData::DoCmdHttpGet: Receiving finished. Received [%d] bytes in total"), itotalReceived ); + + // Currently all error codes returned by the server are accepted. + // Should only KErrEof be accepted? + INFO_PRINTF2( _L("Ignoring error code from RSocket::RecvOneOrMore [%d]"), status.Int()); + } + else + { + ERR_PRINTF2(_L("CT_RSocketData::DoCmdHttpGet: iSocket.Write(...) Failed with error %d"), err); + SetError(err); + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdHttpGet")); + } + +/** + * Receive data from a remote host. + * @param status Indicates the complexion status of the request + * @return + */ +void CT_RSocketData::RecvOneOrMore(TRequestStatus &status) + { + TInt err(KErrNone); + // Create variables for receive buffer and received data counting variables. + const TInt KBufferSize(1024); + TBuf8 buffer; + TSockXfrLength received; + iSocket->RecvOneOrMore( buffer, 0, status, received); + User::WaitForRequest( status ); + err = status.Int(); + if( err == KErrNone ) + { + INFO_PRINTF2( _L("CWlanTestWrapper: Received [%d] bytes"), received() ); + itotalReceived += received(); + } + else if( err == KErrEof ) + { + INFO_PRINTF1(_L("End of File reached")); + } + else + { + ERR_PRINTF2(_L("RecvOneOrMore async call failed with error %d"), err); + SetError(err); + } + } + + + +/** + * Check the supported rates for the IAP. + * @param aSection Section to read from the ini file + * @return + */ +void CT_RSocketData::DoCmdCheckSupportedRates(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdCheckSupportedRates")); + TBool dataOk = ETrue; + + // Read from the ini file + TInt aRate; + if(!GetIntFromConfig(aSection,KARates,aRate)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KARates); + SetBlockResult(EFail); + dataOk = EFalse; + } + + // Check if a scan has been made + TPtrC iScanInfoName; + if(!GetStringFromConfig(aSection,KScanInfo,iScanInfoName )) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScanInfo); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + CWlanScanInfo* iScanInfo = static_cast(GetDataObjectL(iScanInfoName)); + + // Check if a scan has been made + if( iScanInfo != NULL ) + { + const TUint8 KTemp80211SupRatesId = 1; + const TUint8 KTemp80211SupRatesMaxLen = 18; + // Scan info gives data as "information elements" + TUint8 ieLen(0); + const TUint8* ieData(0); + + TInt err = iScanInfo->InformationElement( KTemp80211SupRatesId, ieLen, &ieData ); + + // Check supported rate if the information element was available + if(err == KErrNone) + { + TBuf8 supRates8; + supRates8.Copy( ieData, ieLen ); + TBool supported = CheckSupportedRates( supRates8, aRate ); + if(!supported) + { + ERR_PRINTF2( _L("%d rate not supportedRates"), aRate ); + SetError(KErrNotSupported); + } + } + else + { + ERR_PRINTF2( _L("err: [%d]"), err ); + SetError(err); + } + } + else + { + ERR_PRINTF1(_L("Failed to get CWlanScanInfo object")); + SetBlockResult(EFail); + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdCheckSupportedRates")); + } + +/** + * Review if the rate its supported. + * @param aSupportedRates Rate to calculate and if match with the desired rate + * @param aRate rate to verify if is supporrted, The rate to be checked in 0.5Mb/s units. + * Ie. 2 = 2 * 0.5Mb/s = 1Mb/s. + * @return Etrue if the rate is supported + */ +TBool CT_RSocketData::CheckSupportedRates(const TDesC8& aSupportedRates, const TUint8 aRate) + { + // Supported rates information element format is the following: + // | element id (1 octet) | length (1 octet) | supported rates (1-8 octets) | + // where each octet of supported rates contains one supported rate in + // units of 500 kb/s. The first bit of supported rates field is always 1 + // if the rate belongs to the BSSBasicRateSet, if the rate does not belong + // to the BSSBasicRateSet the first bit is 0. + + // For example Supported rates information element with value + // 0x01,0x02,0x82,0x84 + // would mean that BSSBasicRateSet rates 1Mb/s and 2Mb/s are supported + + TBool supported( EFalse ); + + for ( TInt i( 0 ); i < aSupportedRates.Length(); i++ ) + { + TUint8 rate = aSupportedRates[i] & KBasicRateMask; + if( rate == aRate ) supported = ETrue; + //INFO_PRINTF2( _L("speed rate [%d]"), rate); + switch( rate ) + { + case K80211Rate1Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 1Mbit") ); + break; + case K80211Rate2Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 2Mbit") ); + break; + case K80211Rate5Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 5Mbit") ); + break; + case K80211Rate11Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 11Mbit") ); + break; + case K80211Rate12Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 12Mbit") ); + break; + case K80211Rate18Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 18Mbit") ); + break; + case K80211Rate22Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 22Mbit") ); + break; + case K80211Rate24Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 24Mbit") ); + break; + case K80211Rate36Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 36Mbit") ); + break; + case K80211Rate48Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 48Mbit") ); + break; + case K80211Rate54Mbit: + INFO_PRINTF1( _L("AP can support Speed Rate 54Mbit") ); + break; + + default: + break; + } + } + + return supported; + } + +/** + * Shutdown the socket (RSocket::Shutdown). + * @param aAsyncErrorIndex Command index for async calls to returns errors to + * @return + */ +void CT_RSocketData::DoCmdShutdown( const TInt aAsyncErrorIndex) + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdShutdown")); + INFO_PRINTF1(_L("Starting to shutdown Socket")); + iSocket->Shutdown( RSocket::ENormal, iActCallShutDownSocket->iStatus); + iActCallShutDownSocket->Activate(aAsyncErrorIndex); + IncOutstanding(); + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdShutdown")); + } +/** + * Helper function calling from the destroyer. + * @param + * @return + */ +void CT_RSocketData::Shutdown() + { + TInt err(KErrNone); + TRequestStatus status; + iSocket->Shutdown(RSocket::ENormal, status); + User::WaitForRequest( status ); + err = status.Int(); + if( err != KErrNone ) + { + ERR_PRINTF2( _L("CT_RSocketData::Shutdown(): error[%d]"), err); + SetError(err); + } + } + +/** + * Close de socket. + * @param + * @return + */ +void CT_RSocketData::DoCmdClose() + { + INFO_PRINTF1(_L("*START* CT_RSocketData::DoCmdClose")); + Close(); + INFO_PRINTF1(_L("*END* CT_RSocketData::DoCmdClose")); + } +/** + * Helper function to close the socket. + * @param + * @return + */ +void CT_RSocketData::Close() + { + iSocket->Close(); + iSocketOpened = EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_RSocketServData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_RSocketServData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,431 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include "t_rsocketservdata.h" +#include +#include +#include +#include +#include +#include +/*@{*/ +//LIT's params fron the ini file +_LIT(KWlanIap, "WLANIAP"); +_LIT(KWlanSsid, "DEFAULT_SSID"); +_LIT(KCommsDbTableView, "commsdbtableview"); +_LIT(KCommsDatabase, "commsdatabase"); +/*@}*/ + +/*@{*/ +//LIT's commands +_LIT(KCmdSetOutgoingIap, "SetOutgoingIap"); +_LIT(KCmdConnect, "Connect"); +_LIT(KCmdClose, "Close"); +/*@}*/ + + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_RSocketServData* CT_RSocketServData::NewL() + { + CT_RSocketServData * ret = new (ELeave) CT_RSocketServData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/* + * public destructor + */ +CT_RSocketServData::~CT_RSocketServData() + { + if(iSocketServConnected) + { + Close(); + } + if(iSocketServ) + { + delete iSocketServ; + iSocketServ = NULL; + } + } + +/** + * Private constructor. First phase construction + */ +CT_RSocketServData::CT_RSocketServData() +: iSocketServ(NULL), + iSocketServConnected(EFalse), + iIapID(0) + { + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_RSocketServData::ConstructL() + { + iSocketServ = new (ELeave)RSocketServ(); + } + + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_RSocketServData::GetObject() + { + return iSocketServ; + } + +void CT_RSocketServData::SetIapID(TUint32 aIapID) + { + iIapID = aIapID; + } + +/** + * Process a command read from the Ini file + * @param aCommand The command to process + * @param aSection The section get from the *.ini file of the project T_Wlan + * @param aAsyncErrorIndex Command index dor async calls to returns errors to + * @return TBool ETrue if the command is process + * @leave system wide error + */ +TBool CT_RSocketServData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) + { + TBool ret = ETrue; + + if(aCommand == KCmdSetOutgoingIap) + { + DoCmdSetOutgoingIap(aSection); + } + else if(aCommand == KCmdConnect) + { + DoCmdConnect(); + } + else if(aCommand == KCmdClose) + { + DoCmdClose(); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret = EFalse; + } + return ret; + } + + +/** + * Get IAP, matching the name given (KWlanIap parameter read from the ini file). Set SSID of the + * IAP to the given value (KWlanSsid parameter read from the ini file). + * Store the ID of the IAP locally to allow using the IAP for connecting. + * If there are errors, are management for SetBlockResult() and SetError() + * @param aSection Section to review in the ini file for this command + * @return void + */ +void CT_RSocketServData::DoCmdSetOutgoingIap(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_RSocketServData::DoCmdSetOutgoingIap")); + TBool dataOk = ETrue; + + TPtrC aIapName; + if(!GetStringFromConfig(aSection, KWlanIap, aIapName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWlanIap); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC aSsid; + if(!GetStringFromConfig(aSection, KWlanSsid, aSsid)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWlanSsid); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC commsdbtableName; + if(!GetStringFromConfig(aSection, KCommsDbTableView, commsdbtableName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"),&KCommsDbTableView); + SetBlockResult(EFail); + dataOk = EFalse; + } + + TPtrC commsdbName; + if(!GetStringFromConfig(aSection, KCommsDatabase, commsdbName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"),&KCommsDatabase); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + // reset IAP id + SetIapID(0); + + TBool apFound = EFalse; + // Open view to IAP table, select all outgoing IAPs. + CCommsDbTableView* searchView = static_cast(GetDataObjectL(commsdbtableName)); + CCommsDatabase* commsDatabase = static_cast(GetDataObjectL(commsdbName)); + + // Make sure the view was available. + if( searchView != NULL && commsDatabase != NULL ) + { + CleanupStack::PushL(searchView); + INFO_PRINTF1(_L("Start browsing through the IAPs.")); + TInt error = searchView->GotoFirstRecord(); + + if( error == KErrNone ) + { + // Buffer for reading IAP names from CommsDat. Buffer size is set to + // maximum readable value from CommsDat. + TBuf iapName; + TUint32 iapID = 0; + INFO_PRINTF1(_L("CT_RSocketServData: CommsDat ready for searching, going through all outgoing IAPs")); + TUint32 iapservice = 0; + + TBool failed = EFalse; + + // Go through all IAPs. + while( error == KErrNone ) + { + iapName.FillZ(); + + // Read IAP ID and name from IAP table in CommsDat. + TRAPD(err, searchView->ReadTextL( TPtrC( COMMDB_NAME ), iapName )); + + if(err == KErrNone) + { + TRAP(err, searchView->ReadUintL( TPtrC( COMMDB_ID ), iapID )); + + if(err == KErrNone) + { + INFO_PRINTF3(_L("CT_RSocketServData: IAP (ID = [%d]): %S"), iapID, &iapName ); + + // Try to match the name with user input in the ini file. + if( iapName.Match( aIapName ) == KErrNone ) + { + INFO_PRINTF2(_L("CT_RSocketServData: Matching IAP name found with IAP ID = [%d]"), iapID ); + + apFound = ETrue; + + // Return the found IAP ID + SetIapID(iapID); + + // Read IAP service from IAP table in CommsDat. + TRAPD(err, searchView->ReadUintL( TPtrC( IAP_SERVICE ), iapservice )); + + if(err == KErrNone) + { + INFO_PRINTF2(_L("Service of the AP: %d"),iapservice); + + // Write the ssid given as a parameter in WLANServiceTable in CommsDat + INFO_PRINTF1(_L("CT_RSocketServData: Get WlanSettings from WLANServiceTable")); + CWLanSettings* wlanset = new (ELeave) CWLanSettings(); + CleanupStack::PushL( wlanset ); + + // Connect to CommsDat + err = wlanset->Connect(); + + if( err == KErrNone ) + { + // Get wlan settings corresponding IAP service info from IAP table + SWLANSettings wlanSettings; + err = wlanset->GetWlanSettings( iapservice, wlanSettings ); + + if( err == KErrNone ) + { + INFO_PRINTF2(_L("CT_RSocketServData: CommsDat: wlanSettings.Name = %S"), &wlanSettings.Name ); + INFO_PRINTF2(_L("CT_RSocketServData: CommsDat: wlanSettings.SSID = %S"), &wlanSettings.SSID ); + + // Set the new ssid from the ini file + wlanSettings.SSID = aSsid; + INFO_PRINTF2(_L("CT_RSocketServData: New value for wlanSettings.SSID = %S"), &wlanSettings.SSID ); + + // Write the new settings in CommsDat + err = wlanset->WriteWlanSettings(wlanSettings ); + + if( err == KErrNone ) + { + INFO_PRINTF1(_L("CT_RSocketServData: WlanSettings saved in CommsDat")); + wlanset->Disconnect(); + CleanupStack::PopAndDestroy( wlanset ); + } + else + { + ERR_PRINTF2(_L("CT_RSocketServData: WriteWlanSettings error: [%d]"), err ); + SetError(err); + failed = ETrue; + break; + } + } + else + { + ERR_PRINTF2(_L("CT_RSocketServData: Get WlanSettings error: [%d]"), err ); + SetError(err); + failed = ETrue; + break; + } + } + else + { + ERR_PRINTF2(_L("CT_RSocketServData: WLanSettings connect failed! [%d]"), err ); + SetError(err); + failed = ETrue; + break; + } + } + else + { + ERR_PRINTF2(_L("searchView->ReadUintL left with error %d"), err); + SetError(err); + failed = ETrue; + break; + } + } + + error = searchView->GotoNextRecord(); + if(error == KErrNotFound) + { + INFO_PRINTF2(_L("searchView->GotoNextRecord() not found [%d]"), error); + INFO_PRINTF1(_L("No more records to look for")); + } + else if(error != KErrNone) + { + ERR_PRINTF2(_L("searchView->GotoNextRecord() Failed with error = %d"),error); + SetError(err); + failed = ETrue; + break; + } + } + else + { + ERR_PRINTF2(_L("searchView->ReadUintL left with error %d"), err); + SetError(err); + failed = ETrue; + break; + } + } + else + { + ERR_PRINTF2(_L("searchView->ReadTextL left with error %d"), err); + SetError(err); + failed = ETrue; + break; + } + } + + CleanupStack::Pop( searchView ); + + //if( !failed && GetIapID() == 0 ) + // { + // ERR_PRINTF1(_L("No valid IAP found")); + // SetBlockResult(EFail); + // } + } + else + { + INFO_PRINTF2(_L("CT_RSocketServData: No IAPs found [%d]"), error ); + } + + if(apFound == EFalse) + { + CApAccessPointItem *wlan = CApAccessPointItem::NewLC(); + wlan->SetNamesL(aIapName); + wlan->SetBearerTypeL(EApBearerTypeWLAN); + wlan->WriteTextL(EApWlanNetworkName, aSsid); + CApDataHandler *handler = CApDataHandler::NewLC(*commsDatabase); + TUint32 apId = handler->CreateFromDataL(*wlan); + INFO_PRINTF4(_L("Add new IAP ID: %d, name:%S, SSID: %S"), apId,&aIapName,&aSsid); + SetIapID(apId); + CleanupStack::PopAndDestroy(2); + } + } + else + { + ERR_PRINTF1(_L("CT_RSocketServData: No IAPs found")); + ERR_PRINTF1(_L("CommsDat, no view and database were available.")); + SetBlockResult(EFail); + } + } + + INFO_PRINTF1(_L("*END* CT_RSocketServData::DoCmdSetOutgoingIap")); + } + +/** + * Command to calls RSocketServ::Connect. The error is management for SetError() helper + * @param + * @return + */ +void CT_RSocketServData::DoCmdConnect() + { + INFO_PRINTF1(_L("*START* CT_RSocketServData::DoCmdConnect")); + + TInt err = iSocketServ->Connect(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("iSocketServ->Connect() Fail")); + SetError(err); + } + else + { + iSocketServConnected = ETrue; + } + + INFO_PRINTF1(_L("*END* CT_RSocketServData::DoCmdConnect")); + } +/** + * Command to close RSocketServ instance + * @param + * @return + */ +void CT_RSocketServData::DoCmdClose() + { + INFO_PRINTF1(_L("*START* CT_RSocketServData::DoCmdClose")); + Close(); + INFO_PRINTF1(_L("*END* CT_RSocketServData::DoCmdClose")); + } + +/** + * Helper for the command DoCmdCloseSocketServ: RSocketServ::Close + * @param + * @return + */ +void CT_RSocketServData::Close() + { + iSocketServ->Close(); + iSocketServConnected = EFalse; + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_WlanDriverServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_WlanDriverServer.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include "t_wlandriverserver.h" +#include "t_wlanmgmtclientdata.h" +#include "t_wlanscaninfodata.h" +#include "t_rsocketservdata.h" +#include "t_ccommsdatabasedata.h" +#include "t_ccommsdbtableviewdata.h" +#include "t_rconnectiondata.h" +#include "t_rfiledata.h" +#include "t_rsocketdata.h" + + +/*@{*/ +_LIT(KT_WlanMgmtClient, "WlanMgmtClient"); +_LIT(KT_WlanScanInfo, "WlanScanInfo"); +_LIT(KT_WlanSocketServ, "RSocketServ"); +_LIT(KT_CCommsDB, "CCommsDatabase"); +_LIT(KT_CCommsDBTable, "CCommsDbTableView"); +_LIT(KT_RConnection, "RConnection"); +_LIT(KT_RSocket, "RSocket"); +_LIT(KT_RFile, "RFile"); +/*@}*/ + + +/** + * + * Same code for Secure and non-secure variants + * Called inside the MainL() function to create and start the + * CTestServer derived server. + * @return - Instance of the test server + */ +CT_WlanDriverServer* CT_WlanDriverServer::NewL() + { + CT_WlanDriverServer* server = new (ELeave) CT_WlanDriverServer(); + CleanupStack::PushL(server); + server->ConstructL(); + CleanupStack::Pop(server); + return server; + } + +/** + * Secure variant + * Much simpler, uses the new Rendezvous() call to sync with the client + */ +LOCAL_C void MainL() + { +#if (defined __DATA_CAGING__) + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched = NULL; + sched = new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CT_WlanDriverServer* server = NULL; + + // Create the CTestServer derived server + TRAPD(err, server = CT_WlanDriverServer::NewL()); + if(!err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + + delete server; + delete sched; + } + +/** + * + * Secure variant only + * Process entry point. Called by client using RProcess API + * @return - Standard Epoc error code on process exit + */ +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + +#if (defined TRAP_IGNORE) + TRAP_IGNORE(MainL()); +#else + TRAPD(err,MainL()); +#endif + + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } +/* + * Creates an instance of CDataWrapper that wraps a CT_WlanDriverData object + * @return wrapper - a CDataWrapper instance that wraps the CT_WlanDriverData object + */ +CDataWrapper* CT_WlanDriverServer::CT_WlanDriverBlock::CreateDataL(const TDesC& aData) + { + CDataWrapper* wrapper = NULL; + + if( KT_WlanMgmtClient() == aData ) + { + wrapper = CT_WlanMgmtClientData::NewL(); + } + else if(KT_WlanScanInfo() == aData) + { + wrapper = CT_WlanScanInfoData::NewL(); + } + else if(KT_WlanSocketServ() == aData) + { + wrapper = CT_RSocketServData::NewL(); + } + else if(KT_CCommsDB() == aData) + { + wrapper = CT_CCommsDatabaseData::NewL(); + } + else if(KT_CCommsDBTable() == aData) + { + wrapper = CT_CCommsDbTableViewData::NewL(); + } + else if(KT_RConnection() == aData) + { + wrapper = CT_RConnectionData::NewL(); + } + else if(KT_RSocket() == aData) + { + wrapper = CT_RSocketData::NewL(); + } + else if(KT_RFile() == aData) + { + wrapper = CT_RFileData::NewL(); + } + return wrapper; + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_WlanMgmtClientData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_WlanMgmtClientData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#include "t_wlanmgmtclientdata.h" +#include +#include + +/*@{*/ +//LIT's for Constant +_LIT(KScanInfo, "scaninfo"); +/*@}*/ + +/*@{*/ +//LIT's for WlanMgmtClientData +_LIT(KCmdInstantiateMgmtClient, "NewL"); +_LIT(KCmdGetScanResults, "GetScanResults"); +_LIT(KCmdDestructor, "~"); +/*@}*/ + + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_WlanMgmtClientData* CT_WlanMgmtClientData::NewL() + { + CT_WlanMgmtClientData* ret = new (ELeave) CT_WlanMgmtClientData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/** + * Public destructor + */ +CT_WlanMgmtClientData::~CT_WlanMgmtClientData() + { + DestroyData(); + } + +/** + * Private constructor. First phase construction + */ +CT_WlanMgmtClientData::CT_WlanMgmtClientData() +: iData(NULL) + { + } + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_WlanMgmtClientData::ConstructL() + { + } + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_WlanMgmtClientData::GetObject() + { + return iData; + } + + +/** +* Process a command read from the Ini file +* @param aCommand The command to process +* @param aSection The section get from the *.ini file of the project T_Wlan +* @param aAsyncErrorIndex Command index dor async calls to returns errors to +* @return TBool ETrue if the command is process +* @leave system wide error +*/ +TBool CT_WlanMgmtClientData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) + { + TBool ret = ETrue; + if(aCommand == KCmdInstantiateMgmtClient) + { + DoCmdNewL(); + } + else if(aCommand == KCmdGetScanResults) + { + DoCmdGetScanResults(aSection); + } + else if(aCommand == KCmdDestructor) + { + DoCmdDestructor(); + } + else + { + ERR_PRINTF1(_L("Unknown command.")); + ret = EFalse; + } + return ret; + } + + +/** + * Creates an Instance of CWlanMgmtClient + * @param + * @return + */ +void CT_WlanMgmtClientData::DoCmdNewL() + { + INFO_PRINTF1(_L("*START* CT_WlanMgmtClientData::DoCmdNewL")); + + DestroyData(); + + TRAPD(err,iData = CWlanMgmtClient::NewL()); + if(err != KErrNone) + { + ERR_PRINTF2(_L("CWlanMgmtClient was not constructed, err=%d" ),err); + SetError(err); + } + + INFO_PRINTF1(_L("*END* CT_WlanMgmtClientData::DoCmdNewL")); + } + + +/** + * Test getting Wlan scan info from Wlan management interface. Call + * DoCmdNewL for instantiate the CWlanMgmtClient and DoCmdNewL of CWlanScanInfo first. + * @param aSection Section to read from the ini file + * @return + */ +void CT_WlanMgmtClientData::DoCmdGetScanResults(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_WlanMgmtClientData::DoCmdGetScanResults")); + TBool dataOk = ETrue; + + TPtrC scanInfoName; + if(!GetStringFromConfig(aSection, KScanInfo, scanInfoName)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScanInfo); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + CWlanScanInfo* iScanInfo = static_cast(GetDataObjectL(scanInfoName)); + if ( iScanInfo != NULL ) + { + TInt err = iData->GetScanResults( *iScanInfo ) ; + if(err == KErrNone) + { + INFO_PRINTF2(_L("iScanInfo size [%d]"),iScanInfo->Size()); + } + else + { + ERR_PRINTF2(_L("iData->GetScanResults( *iScanInfo ) Failed with error %d"), err); + SetError(err); + } + } + else + { + ERR_PRINTF1(_L("iScanInfo is NULL")); + SetBlockResult(EFail); + } + } + + INFO_PRINTF1(_L("*END* CT_WlanMgmtClientData::DoCmdGetScanResults")); + } + +/** + * Destructor for CWlanMgmtClient + * @param + * @return + */ +void CT_WlanMgmtClientData::DoCmdDestructor() + { + INFO_PRINTF1(_L("*START* CT_WlanMgmtClientData::DoCmdDestructor")); + DestroyData(); + INFO_PRINTF1(_L("*END* CT_WlanMgmtClientData::DoCmdDestructor")); + } + +/** + * Destroy the object of CWlanMgmtClient, call made from DoCmdDestructor() + * @param + * @return + */ +void CT_WlanMgmtClientData::DestroyData() + { + if(iData) + { + delete iData; + iData = NULL; + } + } diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/src/T_WlanScanInfoData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/src/T_WlanScanInfoData.cpp Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,266 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "t_wlanscaninfodata.h" +//class CWlanScanInfo +#include +#include + +/*@{*/ +//LITs from the ini +_LIT(KSsidParam, "DEFAULT_SSID_Ssid"); +_LIT(KUid, "WlanScanUid"); +/*@}*/ + +/*@{*/ +//LIT's for the commands +_LIT(KCmdNewL, "NewL"); +_LIT(KCmdDestructor, "~"); +_LIT(KCmdInformationElement, "InformationElement"); +/*@}*/ + +/** + * Two phase constructor + * + * @leave system wide error + */ +CT_WlanScanInfoData* CT_WlanScanInfoData::NewL() + { + CT_WlanScanInfoData* ret = new(ELeave) CT_WlanScanInfoData(); + CleanupStack::PushL(ret); + ret->ConstructL(); + CleanupStack::Pop(ret); + return ret; + } + +/** + * Public destructor + */ +CT_WlanScanInfoData::~CT_WlanScanInfoData() + { + DestroyData(); + } + +/** + * Private constructor. First phase construction + */ +CT_WlanScanInfoData::CT_WlanScanInfoData() +: iData(NULL), + iScanInfoInstanceIdentifier(KNullUid) + { + } + + +/** + * Second phase construction + * + * @internalComponent + * + * @return N/A + * + * @pre None + * @post None + * + * @leave system wide error + */ +void CT_WlanScanInfoData::ConstructL() + { + } + +/** + * Return a pointer to the object that the data wraps + * + * @return pointer to the object that the data wraps + */ +TAny* CT_WlanScanInfoData::GetObject() + { + return iData; + } + + +/** + * Process a command read from the Ini file + * @param aCommand The command to process + * @param aSection The section get from the *.ini file of the project T_Wlan + * @param aAsyncErrorIndex Command index dor async calls to returns errors to + * @return TBool ETrue if the command is process + * @leave system wide error + */ +TBool CT_WlanScanInfoData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) + { + TBool ret = ETrue; + + if(aCommand == KCmdNewL) + { + DoCmdNewL(aSection); + } + else if(aCommand == KCmdDestructor) + { + DoCmdDestructor(); + } + else if(aCommand == KCmdInformationElement) + { + DoCmdInformationElement(aSection); + } + else + { + ret = EFalse; + ERR_PRINTF1(_L("Unknown command")); + } + + return ret; + } + + +/** + * Create an instance of CWlanScanInfo + * @param + * @return + */ +void CT_WlanScanInfoData::DoCmdNewL(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_WlanScanInfoData::DoCmdNewL")); + DestroyData(); + + TBool dataOk = ETrue; + + TInt wsUid; + if(!GetHexFromConfig(aSection, KUid, wsUid )) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if (dataOk) + { + const TUid WsUid = {wsUid}; + TAny* interface = NULL; + + TRAPD(err, interface = REComSession::CreateImplementationL( WsUid, iScanInfoInstanceIdentifier )); + if(err == KErrNone) + { + iData = reinterpret_cast( interface ); + + if(iData == NULL) + { + ERR_PRINTF1(_L("CT_WlanScanInfoData::DoCmdNewL() Fail")); + SetBlockResult(EFail); + } + } + else + { + ERR_PRINTF2(_L("Create Implementation left with error %d"), err); + SetError(err); + } + } + + INFO_PRINTF1(_L("*END* CT_WlanScanInfoData::DoCmdNewL")); + } + +/** + * Destructor for CWlanScanInfo + * @param + * @return + */ +void CT_WlanScanInfoData::DoCmdDestructor() + { + INFO_PRINTF1(_L("*START* CT_WlanScanInfoData::DoCmdDestructor")); + DestroyData(); + INFO_PRINTF1(_L("*END* CT_WlanScanInfoData::DoCmdDestructor")); + } + +/** + * called from DoCmdDestructor for destroy the object CWlanScanInfo + * @param + * @return + */ +void CT_WlanScanInfoData::DestroyData() + { + // Cannot use "delete" directly because we use a member variable as an + // ECom instance identifier + REComSession::DestroyedImplementation( iScanInfoInstanceIdentifier ); + iData = NULL; + } +/** + * Review if the IAP given in the ini file match with some Wireless Local Area Network (SelectScanInfo). + * @param aSection Section in the ini file for this command + * @return + */ +void CT_WlanScanInfoData::DoCmdInformationElement(const TTEFSectionName& aSection) + { + INFO_PRINTF1(_L("*START* CT_WlanScanInfoData::DoCmdInformationElement")); + TBool dataOk = ETrue; + + TPtrC aSsid; + if(!GetStringFromConfig(aSection,KSsidParam, aSsid)) + { + ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSsidParam); + SetBlockResult(EFail); + dataOk = EFalse; + } + + if(dataOk) + { + TInt err(KErrNone); + // Scan info gives data as "information elements" + TUint8 ieLen(0); + const TUint8* ieData; + TWlanSsid ssid8; + TBuf ssid; + TBool match = EFalse; + + INFO_PRINTF2(_L("SSID to be checked: %S"),&aSsid); + for( iData->First(); !iData->IsDone(); iData->Next() ) + { + INFO_PRINTF1(_L("found scan info")); + err = KErrNotReady; + // Information Element ID for SSID as specified in 802.11. + const TUint8 KWlan802Dot11SsidIE(0); + err = iData->InformationElement( KWlan802Dot11SsidIE, ieLen, &ieData ); + if(err != KErrNone) + { + ERR_PRINTF2(_L("CScanInfo::InformationElement err: [%d]"),err); + SetError(err); + break; + } + if(ieLen) + { + ssid8.Copy( ieData, ieLen ); + ssid.Copy( ssid8 ); + INFO_PRINTF2(_L("Current information element SSID: %S"),&ssid); + // check if this is an expected SSID + if( aSsid.Compare( ssid ) == 0 ) + { + INFO_PRINTF1(_L("SSID match!")); + match = ETrue; + break; + } + } + } + + if (err == KErrNone && !match) + { + ERR_PRINTF2(_L("Given SSID %S NOT FOUND!"),&aSsid); + SetBlockResult(EFail); + } + } + + INFO_PRINTF1(_L("*END* CT_WlanScanInfoData::DoCmdInformationElement")); + } + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/devlon52/t_wlan.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/testdata/devlon52/t_wlan.ini Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,8 @@ +[UID] +Uid = 0x101f8f01; + +[driveC] +mmc=c: + +[driveE] +mmc=e: diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/devlon52/t_wlan.tcs diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/networking-wlan-validation-automated-connection.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/testdata/networking-wlan-validation-automated-connection.ini Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,171 @@ +[wmgmtcnt] +name = wmgmtcnt + +[wlansinf] +name = wlansinf + +[comsdb] +name = comsdb + +[comsdbtblview] +name = comsdbtblview + +[scktserv] +name = scktserv + +[rcntion] +name = rcntion + +[rsckt] +name = rsckt + +[rfile] +name = rfile + +[include] +file1 = \nt\wlan\t_wlan.ini +file2 = \nt\wlan\t_wlan_environment.ini + + +[NETWORKING-Wlan-Connection-0001-0001-NewL_command02] +WlanScanUid = {UID, Uid} + +[NETWORKING-Wlan-Connection-0001-0001-GetScanResults_command03] +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0001-0001-InformationElement_command04] +DEFAULT_SSID_Ssid = {IAP,Iap} + + + +[NETWORKING-Wlan-Connection-0002-0001-NewL_command02] +commsdb = comsdb + +[NETWORKING-Wlan-Connection-0002-0001-SetOutgoingIap_command03] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP,Ssid} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Connection-0002-0001-Open_command07] +socketserv = scktserv + +[NETWORKING-Wlan-Connection-0002-0001-Start_command08] +socketserv = scktserv + +[NETWORKING-Wlan-Connection-0002-0001-Open_command09] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Connection-0002-0001-Connect_command10] +Ip = {DownloadServer,Ip} +Port = {DownloadServer,Port} + + + +[NETWORKING-Wlan-Connection-0003-0001-NewL_command02] +WlanScanUid = {UID, Uid} + +[NETWORKING-Wlan-Connection-0003-0001-NewL_command04] +commsdb = comsdb + +[NETWORKING-Wlan-Connection-0003-0001-GetScanResults_command05] +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0003-0001-InformationElement_command06] +DEFAULT_SSID_Ssid = {IAP80211b,Iap} + +[NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command07] +rate = 2 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command08] +rate = 4 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command09] +rate = 11 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command10] +rate = 22 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0003-0001-CheckSupportedRates_command11] +rate = 108 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0003-0001-SetOutgoingIap_command12] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP80211b,Iap} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Connection-0003-0001-Open_command16] +socketserv = scktserv + +[NETWORKING-Wlan-Connection-0003-0001-Start_command17] +socketserv = scktserv + +[NETWORKING-Wlan-Connection-0003-0001-Open_command18] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Connection-0003-0001-Connect_command19] +Ip = {DownloadServer,Ip} +Port = {DownloadServer,Port} + + + +[NETWORKING-Wlan-Connection-0004-0001-NewL_command02] +WlanScanUid = {UID, Uid} + +[NETWORKING-Wlan-Connection-0004-0001-NewL_command04] +commsdb = comsdb + +[NETWORKING-Wlan-Connection-0004-0001-GetScanResults_command05] +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0004-0001-InformationElement_command06] +DEFAULT_SSID_Ssid = {IAP80211g,Iap} + +[NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command07] +rate = 2 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command08] +rate = 4 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command09] +rate = 11 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command10] +rate = 22 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0004-0001-CheckSupportedRates_command11] +rate = 108 +scaninfo = wlansinf + +[NETWORKING-Wlan-Connection-0004-0001-SetOutgoingIap_command12] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP80211g,Iap} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Connection-0004-0001-Open_command16] +socketserv = scktserv + +[NETWORKING-Wlan-Connection-0004-0001-Start_command17] +socketserv = scktserv + +[NETWORKING-Wlan-Connection-0004-0001-Open_command18] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Connection-0004-0001-Connect_command19] +Ip = {DownloadServer,Ip} +Port ={DownloadServer,Port} + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/networking-wlan-validation-automated-instantiate.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/testdata/networking-wlan-validation-automated-instantiate.ini Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,34 @@ +[wmgmtcnt] +name = wmgmtcnt + +[wlansinf] +name = wlansinf + +[comsdb] +name = comsdb + +[comsdbtblview] +name = comsdbtblview + +[scktserv] +name = scktserv + +[rcntion] +name = rcntion + +[rsckt] +name = rsckt + +[rfile] +name = rfile + +[include] +file1 = \nt\wlan\t_wlan.ini +file2 = \nt\wlan\t_wlan_environment.ini + + +[NETWORKING-Wlan-Instantiate-0001-0001-NewL_command01] +WlanScanUid = {UID, Uid} + + + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/networking-wlan-validation-automated-transfer.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/testdata/networking-wlan-validation-automated-transfer.ini Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,161 @@ +[wmgmtcnt] +name = wmgmtcnt + +[wlansinf] +name = wlansinf + +[comsdb] +name = comsdb + +[comsdbtblview] +name = comsdbtblview + +[scktserv] +name = scktserv + +[rcntion] +name = rcntion + +[rsckt] +name = rsckt + +[rfile] +name = rfile + +[include] +file1 = \nt\wlan\t_wlan.ini +file2 = \nt\wlan\t_wlan_environment.ini + + +[NETWORKING-Wlan-Transfer-0001-0001-NewL_command02] +commsdb = comsdb + +[NETWORKING-Wlan-Transfer-0001-0001-SetOutgoingIap_command03] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP,Ssid} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Transfer-0001-0001-Open_command07] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0001-0001-Start_command08] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0001-0001-Open_command09] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Transfer-0001-0001-Connect_command10] +Ip = {DownloadServer,Ip} +Port = {DownloadServer,Port} + +[NETWORKING-Wlan-Transfer-0001-0001-DownloadSendHTTPGet_command11] +Host = {DownloadServer,Ip} +File = /nokia/0100k.bin + +[NETWORKING-Wlan-Transfer-0001-0001-RecvOneOrMore_command12] +Save = {driveC,mmc}\0100k.bin + + + +[NETWORKING-Wlan-Transfer-0002-0001-NewL_command02] +commsdb = comsdb + +[NETWORKING-Wlan-Transfer-0002-0001-SetOutgoingIap_command03] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP,Ssid} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Transfer-0002-0001-Open_command07] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0002-0001-Start_command08] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0002-0001-Open_command09] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Transfer-0002-0001-Connect_command10] +Ip = {DownloadServer,Ip} +Port ={DownloadServer,Port} + +[NETWORKING-Wlan-Transfer-0002-0001-DownloadSendHTTPGet_command11] +Host = {DownloadServer,Ip} +File = /nokia/0010k.bin + +[NETWORKING-Wlan-Transfer-0002-0001-RecvOneOrMore_command12] +Save = {driveE,mmc}\0010k.bin + + + +[NETWORKING-Wlan-Transfer-0003-0001-NewL_command02] +commsdb = comsdb + +[NETWORKING-Wlan-Transfer-0003-0001-SetOutgoingIap_command03] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP,Ssid} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Transfer-0003-0001-Open_command07] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0003-0001-Start_command08] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0003-0001-Open_command09] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Transfer-0003-0001-Connect_command10] +Ip = {DownloadServer,Ip} +Port = {DownloadServer,Port} + +[NETWORKING-Wlan-Transfer-0003-0001-DownloadSendHTTPGet_command11] +Host = {DownloadServer,Ip} +File = /nokia/10MB.bin + +[NETWORKING-Wlan-Transfer-0003-0001-RecvOneOrMore_command12] +Save = {driveC,mmc}\10MB.bin + + + +[NETWORKING-Wlan-Transfer-0004-0001-NewL_command02] +commsdb = comsdb + +[NETWORKING-Wlan-Transfer-0004-0001-GenerateFile_command03] +File = {driveC,mmc}\10mb2.bin +Size = 10485760 + +[NETWORKING-Wlan-Transfer-0004-0001-SetOutgoingIap_command04] +WLANIAP = {IAP,Iap} +DEFAULT_SSID = {IAP,Ssid} +commsdbtableview = comsdbtblview +commsdatabase = comsdb + +[NETWORKING-Wlan-Transfer-0004-0001-Open_command08] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0004-0001-Start_command09] +socketserv = scktserv + +[NETWORKING-Wlan-Transfer-0004-0001-Open_command10] +socketserv = scktserv +connection = rcntion + +[NETWORKING-Wlan-Transfer-0004-0001-Connect_command11] +Ip = {UploadServer,Ip} +Port = {UploadServer,Port} + +[NETWORKING-Wlan-Transfer-0004-0001-UploadSendHTTPPost_command12] +File = {driveC,mmc}\10mb2.bin +FileServer = 10mb2.bin +clientID = SALT +serverScript = /dy/upload/upfile.php + +[NETWORKING-Wlan-Transfer-0004-0001-RecvOneOrMore_command13] +Save = KNullDesC + diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/t_wlan_environment.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/testdata/t_wlan_environment.ini Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,18 @@ +[DownloadServer] +Ip = 200.78.210.108 +Port = 80 +Host = 200.78.210.108 + +[UploadServer] +Ip = 217.30.188.169 +Port = 80 + +[IAP] +Iap = nokia +Ssid = nokia + +[IAP80211g] +Iap = nokia + +[IAP80211b] +Iap = nokia diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/tube/t_wlan.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanapitest/wlanhaitest/wlan/testdata/tube/t_wlan.ini Tue Feb 02 02:03:13 2010 +0200 @@ -0,0 +1,8 @@ +[UID] +Uid = 0x101f8f01; + +[driveC] +mmc=c: + +[driveE] +mmc=e: diff -r 000000000000 -r c40eb8fe8501 wlanapitest/wlanhaitest/wlan/testdata/tube/t_wlan.tcs