wlan_bearer/wlanldd/wlan_common/umac_common/inc/UmacDot11AuthenticatePending.h
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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 WlanDot11AuthenticatePending class
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 22 %
       
    20 */
       
    21 
       
    22 #ifndef WLANDOT11AUTHENTICATEPENDING_H
       
    23 #define WLANDOT11AUTHENTICATEPENDING_H
       
    24 
       
    25 #include "UmacDot11Connecting.h"
       
    26 
       
    27 /**
       
    28 *  Infrastructure mode authnetication establishment base class.
       
    29 *  This is a state where authentication request has been sent
       
    30 *  to an AP and response to it is waited.
       
    31 *
       
    32 *  @lib wlanumac.lib
       
    33 *  @since S60 v3.1
       
    34 */
       
    35 class WlanDot11AuthenticatePending : public WlanDot11Connecting
       
    36     {
       
    37 public:
       
    38 
       
    39     /**
       
    40     * Destructor.
       
    41     */
       
    42     virtual ~WlanDot11AuthenticatePending() {};
       
    43 
       
    44 protected:  
       
    45 
       
    46     // Types for the FSM
       
    47     
       
    48     // events for the FSM
       
    49     enum TEvent
       
    50         {
       
    51         ESTATEENTRY,        // state entry action to be executed
       
    52         ECONTINUE,          // generic continue event
       
    53         // a valid authentication response message has been processed
       
    54         // authentication attempt may have accpeted or denied
       
    55         ERXAUTHRESPONSE,
       
    56         // authenticate request frame has been xferred 
       
    57         // to the WLAN device tx queue
       
    58         ETX_AUTHFRAME_XFER,
       
    59         ETX_SCHEDULER_FULL, // packet scheduler is full
       
    60         ETIMEOUT,           // authentication timer timeout event       
       
    61         EPUSHPACKET,        // packet push to packet scheduler possible
       
    62         EEVENTMAX           // defined as an upper bound
       
    63         };
       
    64 
       
    65     // states of the FSM
       
    66     enum TState
       
    67         {
       
    68         EINIT,                          // start state of the state machine
       
    69         // dot11-authentication message is sent
       
    70         ETXAUTHFRAME,                               
       
    71         // authentication response message is waited
       
    72         EWAIT4AUTHRESPONSE,             
       
    73         // EPUSHPACKET event waited
       
    74         EWAIT4PUSHPACKET,
       
    75         // junction state prior moving to dot11associationpending
       
    76         // or dot11softreset dot11 state
       
    77         ECONTINUEDOT11TRAVERSE,   
       
    78         ESTATEMAX                       // defined as an upper bound        
       
    79         }; 
       
    80 
       
    81     // authentication frame received flag
       
    82     static const TUint32 KAuthReceived             = (1 << 0);
       
    83     // authentication was a success flag
       
    84     static const TUint32 KAuthSuccess              = (1 << 1);
       
    85 
       
    86 protected:
       
    87     
       
    88     /**
       
    89     * C++ default constructor.
       
    90     */
       
    91     WlanDot11AuthenticatePending() : iState( EINIT ) {};
       
    92 
       
    93     /**
       
    94     * Parses authentication response message(s)
       
    95     * @since S60 3.1
       
    96     * @param aCtxImpl global statemachine context
       
    97     * @param aAuthModeDesired authentication mode expected
       
    98     * @param aFrame pointer to the beginning of the authentication response
       
    99     *               frame
       
   100     * @param aFlags flags from WHA frame receive method
       
   101     * @return ETrue proceed with authentication sequnce, otherwise abort
       
   102     */
       
   103     static TBool ResolveAuthMessage( 
       
   104         WlanContextImpl&,
       
   105         TUint16 aAuthModeDesired,
       
   106         const void* aFrame,
       
   107         TUint32 aFlags );
       
   108 
       
   109     /**
       
   110     * Sends authentication sequence number 1 message
       
   111     * @since S60 3.1
       
   112     * @param aCtxImpl global statemachine context
       
   113     * @return ETrue upon success, 
       
   114     * EFalse if packet scheduler discarded the frame
       
   115     */
       
   116     TBool SendAuthSeqNbr1Frame( WlanContextImpl& aCtxImpl ) const;
       
   117 
       
   118     /**
       
   119     * ?member_description.
       
   120     * @since S60 3.1
       
   121     * @param aCtxImpl global statemachine context
       
   122     */
       
   123     void ChangeInternalState( 
       
   124         WlanContextImpl& aCtxImpl, 
       
   125         TState aNewState );
       
   126 
       
   127     /**
       
   128     * ?member_description.
       
   129     * @since S60 3.1
       
   130     * @param aCtxImpl global statemachine context
       
   131     */
       
   132     void Fsm( 
       
   133         WlanContextImpl& aCtxImpl, 
       
   134         TEvent aEvent ); 
       
   135 
       
   136     /**
       
   137     * ?member_description.
       
   138     * @since S60 3.1
       
   139     * @param aCtxImpl global statemachine context
       
   140     */
       
   141     void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl );
       
   142 
       
   143     /**
       
   144     * ?member_description.
       
   145     * @since S60 3.1
       
   146     * @param aCtxImpl global statemachine context
       
   147     */
       
   148     void StateEntryActions( WlanContextImpl& aCtxImpl );
       
   149 
       
   150     /**
       
   151     * ?member_description.
       
   152     * @since S60 3.1
       
   153     * @param aCtxImpl global statemachine context
       
   154     */
       
   155     static void StartAuthenticationFrameResponseTimer( 
       
   156         WlanContextImpl& aCtxImpl );
       
   157     
       
   158 private:    
       
   159     
       
   160     /**
       
   161     * ?member_description.
       
   162     * @since S60 3.1
       
   163     * @return ETrue if we are authenticated EFalse in otherwise
       
   164     */    
       
   165     inline TBool Authenticated() const;
       
   166     
       
   167     /**
       
   168     * ?member_description.
       
   169     * @since S60 3.1
       
   170     * @param aCtxImpl global statemachine context
       
   171     */
       
   172     virtual void OnStateEntryEvent( WlanContextImpl& aCtxImpl ) = 0;
       
   173 
       
   174     /**
       
   175     * ?member_description.
       
   176     * @since S60 3.1
       
   177     * @param aCtxImpl global statemachine context
       
   178     */
       
   179     virtual void OnRxAuthResponseEvent( WlanContextImpl& aCtxImpl ) = 0;
       
   180 
       
   181     /**
       
   182     * Called internally to set the used 
       
   183     * authentication number to authenticate message
       
   184     * @since S60 3.1
       
   185     * @param aCtxImpl global statemachine context
       
   186     */
       
   187     virtual void OnSetAlgorithmNumber( WlanContextImpl& aCtxImpl ) = 0;
       
   188 
       
   189     /**
       
   190     * ?member_description.
       
   191     * @since S60 3.1
       
   192     * @param aCtxImpl global statemachine context
       
   193     */
       
   194     void OnContinueEvent( WlanContextImpl& aCtxImpl );
       
   195 
       
   196     /**
       
   197     * ?member_description.
       
   198     * @since S60 3.1
       
   199     * @param aCtxImpl global statemachine context
       
   200     */
       
   201     void OnTimeoutEvent( WlanContextImpl& aCtxImpl );
       
   202 
       
   203     /**
       
   204     * ?member_description.
       
   205     * @since S60 3.1
       
   206     * @param aCtxImpl global statemachine context
       
   207     */
       
   208     void OnPushPacketEvent( WlanContextImpl& aCtxImpl );
       
   209 
       
   210     /**
       
   211     * ?member_description.
       
   212     * @since S60 3.1
       
   213     * @param aCtxImpl global statemachine context
       
   214     */
       
   215     void OnTxAuthFrameXferEvent( WlanContextImpl& aCtxImpl );
       
   216 
       
   217     /**
       
   218     * ?member_description.
       
   219     * @since S60 3.1
       
   220     * @param aCtxImpl global statemachine context
       
   221     */
       
   222     void OnTxSchedulerFullEvent( WlanContextImpl& aCtxImpl );
       
   223 
       
   224     // Functions from base classes
       
   225 
       
   226     /**
       
   227     * From ?base_class ?member_description.
       
   228     * @since S60 3.1
       
   229     * @param aCtxImpl global statemachine context
       
   230     */
       
   231     virtual void Entry( WlanContextImpl& aCtxImpl );
       
   232 
       
   233     /**
       
   234     * From ?base_class ?member_description.
       
   235     * State exit method
       
   236     * @since S60 3.1
       
   237     * @param aCtxImpl global statemachine context
       
   238     */
       
   239     virtual void Exit( WlanContextImpl& aCtxImpl );
       
   240 
       
   241     /**
       
   242     * From ?base_class ?member_description.
       
   243     * Timer timeout function
       
   244     * @since S60 3.1
       
   245     * @param aCtxImpl global statemachine context
       
   246     * @return ETrue if a state change occurred in the state machine
       
   247     *         EFalse otherwise
       
   248     */
       
   249     virtual TBool OnTimeout( WlanContextImpl& aCtxImpl );
       
   250 
       
   251     /**
       
   252      * Method called when packet has been transferred to the WLAN device
       
   253      *
       
   254      * @since S60 3.1
       
   255      * @param aCtxImpl global state machine context
       
   256      * @param aPacketId packet whose transfer is complete
       
   257      * @param aMetaHeader frame meta header
       
   258      */
       
   259     virtual void OnPacketTransferComplete( 
       
   260         WlanContextImpl& aCtxImpl, 
       
   261         TUint32 aPacketId,
       
   262         TDataBuffer* aMetaHeader );
       
   263 
       
   264     /**
       
   265     * From ?base_class ?member_description.
       
   266     * @since S60 3.1
       
   267     * @param aCtxImpl global statemachine context
       
   268     * @param aRcpi RCPI of the frame
       
   269     * @param aFlags flags from WHA frame receive method
       
   270     * @param aBuffer pointer to the beginning of the Rx buffer allocated
       
   271     *        for the frame
       
   272     */
       
   273     virtual void ReceivePacket( 
       
   274         WlanContextImpl& aCtxImpl,
       
   275         WHA::TStatus aStatus,
       
   276         const void* aFrame,
       
   277         TUint16 aLength,
       
   278         WHA::TRate aRate,
       
   279         WHA::TRcpi aRcpi,
       
   280         WHA::TChannelNumber aChannel,
       
   281         TUint8* aBuffer,
       
   282         TUint32 aFlags );
       
   283 
       
   284     /**
       
   285     * From ?base_class ?member_description.
       
   286     * @since S60 3.1
       
   287     * @param aCtxImpl global statemachine context
       
   288     */
       
   289     virtual void OnPacketPushPossible( WlanContextImpl& aCtxImpl );
       
   290         
       
   291     // Prohibit copy constructor 
       
   292     WlanDot11AuthenticatePending( const WlanDot11AuthenticatePending& );
       
   293     // Prohibit assigment operator
       
   294     WlanDot11AuthenticatePending& operator= ( 
       
   295         const WlanDot11AuthenticatePending& );        
       
   296 
       
   297 protected:  // Data
       
   298 
       
   299     TState              iState;
       
   300 
       
   301 #ifndef NDEBUG
       
   302     /** max length of state name for tracing */
       
   303     enum { KMaxStateStringLength = 50 };
       
   304     /** max length of event name for tracing */
       
   305     enum { KMaxEventStringLength = KMaxStateStringLength };
       
   306 
       
   307     /** state names for tracing */
       
   308     static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength];
       
   309     /** event names for tracing */
       
   310     static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength];
       
   311 #endif
       
   312     };
       
   313 
       
   314 #include "umacdot11authenticatepending.inl"
       
   315 
       
   316 #endif      // WLANDOT11AUTHENTICATEPENDING_H