wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacaddbroadcastwepkey.h
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Declaration of the WlanAddBroadcastWepKey class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 7 %
       
    20 */
       
    21 
       
    22 #ifndef WLANADDBROADCASTWEPKEY_H
       
    23 #define WLANADDBROADCASTWEPKEY_H
       
    24 
       
    25 #include "UmacWsaComplexCommand.h"
       
    26 
       
    27 
       
    28 /**
       
    29 *  FSM for inserting a single default WEP key 
       
    30 *  Inserts it as group and pairwise key 
       
    31 *  and also marks it as the default group key
       
    32 *
       
    33 *  @lib wlanumac.lib
       
    34 *  @since S60 3.1
       
    35 */
       
    36 class WlanAddBroadcastWepKey : public WlanWsaComplexCommand
       
    37     {
       
    38 
       
    39     // Types for the FSM
       
    40     
       
    41     // events for the FSM
       
    42     enum TEvent
       
    43         {
       
    44         ESTATEENTRY,    // state entry action to be executed                        
       
    45         ETXCOMPLETE,    // underlying sw layer tx delivery complete event   
       
    46         EABORT,         // abort execution event
       
    47         EEVENTMAX       // defined as an upper bound
       
    48         };
       
    49 
       
    50     // states of the FSM
       
    51     enum TState
       
    52         {
       
    53         EINIT,          // start state of the state machine
       
    54         EADDGROUPKEY,   // add group key
       
    55         EWRITEMIB,      // write mib (conditional exec)
       
    56         EADDPAIRWISEKEY,// add pairwise key (conditional exec)
       
    57         EFINIT,         // end state
       
    58         ESTATEMAX       // defined as an upper bound        
       
    59         }; 
       
    60 
       
    61 public:
       
    62 
       
    63     /**
       
    64     * C++ default constructor.
       
    65     */
       
    66     WlanAddBroadcastWepKey() : 
       
    67         iState( EINIT ), iFlags( 0 ), iKeyIndex( 0 ), iKeyLength( 0 ), 
       
    68         iKey( NULL ), iMacAddr( KZeroMacAddr ), iMemory( NULL ) {};
       
    69 
       
    70     /**
       
    71     * Destructor.
       
    72     */
       
    73     virtual inline ~WlanAddBroadcastWepKey();
       
    74 
       
    75     /**
       
    76     * ?member_description.
       
    77     * @since S60 3.1
       
    78     * @param 
       
    79     */
       
    80     void Set( 
       
    81         const TMacAddress& aMac,
       
    82         TUint32 aKeyIndex,             
       
    83         TBool aUseAsDefaulKey,     
       
    84         TBool aUseAsPairwiseKey,
       
    85         TUint32 aKeyLength,                      
       
    86         const TUint8 aKey[KMaxWEPKeyLength] );
       
    87 
       
    88 private:
       
    89 
       
    90     // Prohibit copy constructor.
       
    91     WlanAddBroadcastWepKey( const WlanAddBroadcastWepKey& );
       
    92     // Prohibit assigment operator.
       
    93     WlanAddBroadcastWepKey& operator= 
       
    94         ( const WlanAddBroadcastWepKey& );
       
    95 
       
    96     virtual void Entry( WlanContextImpl& aCtxImpl );
       
    97     virtual void Exit( WlanContextImpl& aCtxImpl);
       
    98 
       
    99 #ifndef NDEBUG 
       
   100     virtual const TInt8* GetStateName( TUint8& aLength ) const;
       
   101 #endif // !NDEBUG 
       
   102 
       
   103     /**
       
   104     * ?member_description.
       
   105     * @since S60 3.1
       
   106     * @param aCtxImpl global statemachine context
       
   107     */
       
   108     void ChangeInternalState( 
       
   109         WlanContextImpl& aCtxImpl, 
       
   110         TState aNewState );
       
   111 
       
   112     /**
       
   113     * ?member_description.
       
   114     * @since S60 3.1
       
   115     * @param aCtxImpl global statemachine context
       
   116     */
       
   117     void Fsm( 
       
   118         WlanContextImpl& aCtxImpl, 
       
   119         TEvent aEvent ); 
       
   120 
       
   121     /**
       
   122     * ?member_description.
       
   123     * @since S60 3.1
       
   124     * @param aCtxImpl global statemachine context
       
   125     */
       
   126     void OnStateEntryEvent( WlanContextImpl& aCtxImpl );
       
   127 
       
   128     /**
       
   129     * ?member_description.
       
   130     * @since S60 3.1
       
   131     * @param aCtxImpl global statemachine context
       
   132     */
       
   133     void OnTxCompleteEvent( WlanContextImpl& aCtxImpl );
       
   134 
       
   135     /**
       
   136     * ?member_description.
       
   137     * @since S60 3.1
       
   138     * @param aCtxImpl global statemachine context
       
   139     */
       
   140     void OnAbortEvent( WlanContextImpl& aCtxImpl );
       
   141 
       
   142     /**
       
   143     * ?member_description.
       
   144     * @since S60 3.1
       
   145     * @param aCtxImpl global statemachine context
       
   146     */
       
   147     void AddGroupKey( WlanContextImpl& aCtxImpl );
       
   148 
       
   149     /**
       
   150     * ?member_description.
       
   151     * @since S60 3.1
       
   152     * @param aCtxImpl global statemachine context
       
   153     */
       
   154     void AddPairwiseKey( WlanContextImpl& aCtxImpl );
       
   155 
       
   156     /**
       
   157     * ?member_description.
       
   158     * @since S60 3.1
       
   159     * @param aCtxImpl global statemachine context
       
   160     */
       
   161     void WriteMib( WlanContextImpl& aCtxImpl );
       
   162 
       
   163     /**
       
   164     * evaluates if key is to be marked as the default key 
       
   165     * @since S60 3.1
       
   166     * @return ETrue when evaluates true
       
   167     */
       
   168     inline TBool UseAsDefaultKey() const;
       
   169 
       
   170     /**
       
   171     * evaluates if key is inserted as a pairwise key
       
   172     * @since S60 3.1
       
   173     * @return ETrue when evaluates true
       
   174     */
       
   175     inline TBool UseAsPairwiseKey() const;
       
   176 
       
   177     static const TUint32 KUseAsDefaultKey      = ( 1 << 0 );
       
   178     static const TUint32 KUseAsPairwiseKey     = ( 1 << 1 );
       
   179 
       
   180 private:    // Data
       
   181 
       
   182     TState          iState;
       
   183 
       
   184     TUint32         iFlags;
       
   185     TUint32         iKeyIndex;             
       
   186     TUint32         iKeyLength;                      
       
   187     /**
       
   188     * cipher key to add
       
   189     * Not own
       
   190     */
       
   191     const TUint8*   iKey;
       
   192     TMacAddress     iMacAddr;
       
   193 
       
   194     // general purpose memory handle for the object
       
   195     TAny*            iMemory;
       
   196 
       
   197 #ifndef NDEBUG
       
   198     /** max length of state name for tracing */
       
   199     enum { KMaxStateStringLength = 50 };
       
   200     /** max length of event name for tracing */
       
   201     enum { KMaxEventStringLength = KMaxStateStringLength };
       
   202 
       
   203     /** state names for tracing */
       
   204     static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength];
       
   205     /** event names for tracing */
       
   206     static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength];
       
   207 
       
   208     static const TInt8  iName[];
       
   209 #endif // !NDEBUG
       
   210     };
       
   211 
       
   212 #include "umacaddbroadcastwepkey.inl"
       
   213 
       
   214 #endif      // WLANADDBROADCASTWEPKEY_H