wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_sub_operation_wpa_connect.h
changeset 0 c40eb8fe8501
child 3 6524e815f76f
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  Statemachine for connecting to a WPA network
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CORE_SUB_OPERATION_WPA_CONNECT_H
       
    20 #define CORE_SUB_OPERATION_WPA_CONNECT_H
       
    21 
       
    22 #include "core_operation_base.h"
       
    23 #include "core_ap_data.h"
       
    24 #include "abs_core_event_handler.h"
       
    25 #include "core_type_list.h"
       
    26 #include "abs_wlan_eapol_callback_interface.h"
       
    27 
       
    28 /** The maximum length of a PMKID. */
       
    29 const u32_t CORE_EAPOL_PMKID_MAX_LENGTH  = 256;
       
    30 
       
    31 class core_server_c;
       
    32 class abs_core_driverif_c;
       
    33 class core_frame_dot11_ie_c;
       
    34 class core_frame_assoc_resp_c;
       
    35 
       
    36 /**
       
    37  * Statemachine for connecting to a WPA network
       
    38  *
       
    39  * @lib wlmserversrv.lib
       
    40  * @since S60 v3.1
       
    41  */
       
    42 NONSHARABLE_CLASS( core_sub_operation_wpa_connect_c ) :
       
    43     public core_operation_base_c,
       
    44     public abs_wlan_eapol_callback_interface_c,
       
    45     public abs_core_event_handler_c
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * The possible states of the state machine.
       
    52      */
       
    53     enum core_state_e
       
    54         {
       
    55         core_state_init = core_base_state_next,
       
    56         core_state_start_authentication_needed,
       
    57         core_state_do_connect,
       
    58         core_state_req_connect,
       
    59         core_state_req_connect_failed,
       
    60         core_state_req_association_failed,
       
    61         core_state_process_eapol_frame,
       
    62         core_state_req_state_notification,
       
    63         core_state_bss_lost,
       
    64         core_state_user_cancel,
       
    65         core_state_MAX
       
    66         };
       
    67 
       
    68     /**
       
    69      * Constructor.
       
    70      */
       
    71     core_sub_operation_wpa_connect_c(
       
    72         u32_t request_id,
       
    73         core_server_c* server,
       
    74         abs_core_driverif_c* drivers,
       
    75         abs_core_server_callback_c* adaptation,
       
    76         bool_t& is_connected,
       
    77         core_management_status_e& connect_status,
       
    78         const core_ssid_s& ssid,
       
    79         core_ap_data_c& ap_data,
       
    80         bool_t& is_cached_sa_used,
       
    81         core_type_list_c<core_frame_dot11_ie_c>& assoc_ie_list,
       
    82         core_frame_assoc_resp_c** assoc_resp );
       
    83 
       
    84     /**
       
    85      * Destructor.
       
    86      */
       
    87     virtual ~core_sub_operation_wpa_connect_c();
       
    88 
       
    89 protected:
       
    90 
       
    91     /**
       
    92      * This method is called when a pending request has been completed
       
    93      * and so sub-operations are pending.
       
    94      *
       
    95      * @since S60 v3.1
       
    96      * @return status of the operation:
       
    97      *     core_error_request_pending if the operation is not finished,
       
    98      *     otherwise the status code of the finished operation
       
    99      */
       
   100     core_error_e next_state();
       
   101 
       
   102     /**
       
   103      * This method is called when the operation needs to be canceled.     
       
   104      *
       
   105      * @since S60 v3.1
       
   106      * @return status of the operation:
       
   107      *     core_error_request_pending if the operation is not finished,
       
   108      *     otherwise the status code of the finished operation
       
   109      */
       
   110     core_error_e cancel();
       
   111 
       
   112     /**
       
   113      * This method is called when the operation is cancelled from the outside.
       
   114      *
       
   115      * @since S60 v3.2
       
   116      * @param do_graceful_cancel Whether cancel should be graceful or forced.
       
   117      */
       
   118     void user_cancel(
       
   119         bool_t do_graceful_cancel );
       
   120 
       
   121 // from base class abs_wlan_eapol_callback_interface_c  
       
   122 
       
   123     /**
       
   124      * From abs_wlan_eapol_callback_interface_c
       
   125      */
       
   126     core_error_e packet_send(
       
   127         network_id_c * send_network_id,
       
   128         u8_t * packet_data,
       
   129         u32_t packet_data_length,
       
   130         bool_t send_unencrypted );
       
   131 
       
   132     /**
       
   133      * From abs_wlan_eapol_callback_interface_c
       
   134      */
       
   135     core_error_e associate(
       
   136         wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode );
       
   137 		
       
   138     /**
       
   139      * From abs_wlan_eapol_callback_interface_c
       
   140      */
       
   141     core_error_e disassociate(
       
   142         network_id_c * receive_network_id,
       
   143 	    const bool_t self_disassociation );
       
   144 		  
       
   145     /**
       
   146      * From abs_wlan_eapol_callback_interface_c
       
   147      */        
       
   148     core_error_e packet_data_session_key(
       
   149         network_id_c * send_network_id,
       
   150         session_key_c * key );
       
   151 
       
   152     /**
       
   153      * From abs_wlan_eapol_callback_interface_c
       
   154      */        
       
   155     void state_notification(
       
   156         state_notification_c * state );
       
   157 
       
   158     /**
       
   159      * From abs_wlan_eapol_callback_interface_c
       
   160      */
       
   161     core_error_e reassociate(
       
   162         network_id_c * send_network_id,
       
   163         const wlan_eapol_if_eapol_key_authentication_type_e authentication_type,
       
   164         u8_t * PMKID,
       
   165         u32_t PMKID_length );
       
   166 
       
   167     /**
       
   168      * From abs_wlan_eapol_callback_interface_c
       
   169      */
       
   170     core_error_e complete_check_pmksa_cache(
       
   171         core_type_list_c<network_id_c> & network_id_list );
       
   172 
       
   173     /**
       
   174      * From abs_wlan_eapol_callback_interface_c
       
   175      */
       
   176     core_error_e complete_start_wpx_fast_roam_reassociation(
       
   177         network_id_c * receive_network_id,
       
   178         u8_t * reassociation_request_ie,
       
   179         u32_t reassociation_request_ie_length );
       
   180 
       
   181     /**
       
   182      * From abs_wlan_eapol_callback_interface_c
       
   183      */
       
   184     core_error_e new_protected_setup_credentials(
       
   185         core_type_list_c< protected_setup_credential_c > & credential_list );
       
   186 
       
   187     /**
       
   188      * From abs_wlan_eapol_callback_interface_c
       
   189      */
       
   190     void handle_error(
       
   191         wlan_eapol_if_error_e errorcode,
       
   192         wlan_eapol_if_message_type_function_e function );
       
   193 
       
   194 // from base class abs_core_event_handler_c  
       
   195 
       
   196     bool_t notify(
       
   197         core_am_indication_e indication );
       
   198 
       
   199 private: // data
       
   200 
       
   201     /**
       
   202      * Whether we are still connected to an AP.
       
   203      */
       
   204     bool_t& is_connected_m;
       
   205    
       
   206     /**
       
   207      * Whether the connection attempt uses a cached security association.
       
   208      */
       
   209     bool_t& is_cached_sa_used_m;
       
   210    
       
   211     /**
       
   212      * Status of connection attempt.
       
   213      */
       
   214     core_management_status_e& connect_status_m;
       
   215 
       
   216     /**
       
   217      * SSID to connect to.
       
   218      */
       
   219     const core_ssid_s& ssid_m;
       
   220     
       
   221     /**
       
   222      * AP to connect to.
       
   223      */
       
   224     core_ap_data_c& ap_data_m;
       
   225 
       
   226     /**
       
   227      * BSSID currently tried.
       
   228      */
       
   229     core_mac_address_s current_bssid_m;
       
   230 
       
   231     /**
       
   232      * Length of PMKID data.
       
   233      */
       
   234     u16_t pmkid_length_m;
       
   235 
       
   236     /**
       
   237      * PMKID data.
       
   238      */
       
   239     u8_t pmkid_data_m[CORE_EAPOL_PMKID_MAX_LENGTH];
       
   240 
       
   241     /**
       
   242      * Sent WPA/RSN/WAPI IE data.
       
   243      */
       
   244     core_frame_dot11_ie_c* sent_ie_m;
       
   245 
       
   246     /**
       
   247      * Authentication algorithm used for the connection.
       
   248      */
       
   249     u16_t auth_algorithm_m;
       
   250     
       
   251     /**
       
   252      * Authentication type for EAPOL.
       
   253      */
       
   254     wlan_eapol_if_eapol_key_authentication_type_e eapol_auth_type_m;
       
   255 
       
   256     /**
       
   257      * List of IEs that will be added to the (re-)association request.
       
   258      */
       
   259     core_type_list_c<core_frame_dot11_ie_c>& assoc_ie_list_m;
       
   260 
       
   261     /**
       
   262      * The (re-)association response frame is stored here if received.
       
   263      * Not owned by this class.
       
   264      */
       
   265     core_frame_assoc_resp_c** assoc_resp_m;
       
   266 
       
   267     /**
       
   268      * Whether the connection attempt uses a proactive key caching.
       
   269      */
       
   270     bool_t is_key_caching_used_m;
       
   271 
       
   272     };
       
   273 
       
   274 #endif // CORE_SUB_OPERATION_WPA_CONNECT_H