wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_server.h
changeset 0 c40eb8fe8501
child 10 0abc8c98be24
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Main class for core server
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 54 %
       
    20 */
       
    21 
       
    22 #ifndef CORE_SERVER_H
       
    23 #define CORE_SERVER_H
       
    24 
       
    25 #include "am_platform_libraries.h"
       
    26 #include "abs_core_server.h"
       
    27 #include "abs_core_server_callback.h"
       
    28 #include "abs_core_driverif.h"
       
    29 #include "abs_core_driverif_callback.h"
       
    30 #include "core_operation_base.h"
       
    31 #include "core_type_list.h"
       
    32 #include "core_settings.h"
       
    33 #include "core_connection_data.h"
       
    34 #include "core_timer_counter_measures.h"
       
    35 #include "core_scan_list.h"
       
    36 #include "abs_core_wpx_adaptation.h"
       
    37 #include "core_operation_handle_bss_lost.h"
       
    38 #include "core_wlan_eapol_interface.h"
       
    39 
       
    40 class ScanList;
       
    41 class abs_core_timer_c;
       
    42 class abs_wlan_eapol_callback_interface_c;
       
    43 class abs_core_frame_handler_c;
       
    44 class abs_core_event_handler_c;
       
    45 class abs_core_protected_setup_handler_c;
       
    46 class core_eapol_handler_c;
       
    47 
       
    48 /**
       
    49  * core server class for WLAN management functionality.
       
    50  *
       
    51  * @lib wlmserversrv.lib
       
    52  * @since S60 v3.1
       
    53  */
       
    54 NONSHARABLE_CLASS( core_server_c ) :
       
    55     public abs_core_server_c,
       
    56     public abs_core_driverif_callback_c
       
    57     {
       
    58 
       
    59 public: 
       
    60 
       
    61     /**
       
    62      * Constructor.
       
    63      *
       
    64      * @param callback External service interface.
       
    65      * @param drivers Driver interface
       
    66      * @param settings Wlan Device Settings
       
    67      * @param mac_address MAC address of the device.
       
    68      * @param features Bitmask of enabled features.
       
    69      */
       
    70     core_server_c(
       
    71         abs_core_server_callback_c& callback,
       
    72         abs_core_driverif_c& drivers,
       
    73         const core_device_settings_s& settings,
       
    74         const core_mac_address_s& mac_address,
       
    75         u32_t features );
       
    76 
       
    77     /**
       
    78      * Destructor.
       
    79      */
       
    80     virtual ~core_server_c();
       
    81 
       
    82     /**
       
    83      * Perform the necessary initialization procedures after construction.
       
    84      * 
       
    85      * @since S60 v3.1
       
    86      * @return An error code if initialization fails, core_error_ok otherwise.
       
    87      * @note This method MUST be called after the construction of this object.
       
    88      */
       
    89     core_error_e init();
       
    90 
       
    91     /**
       
    92      * Get a reference to device settings.
       
    93      *
       
    94      * @since S60 v3.1
       
    95      * @return Reference to device settings.
       
    96      */
       
    97     core_device_settings_s& get_device_settings();
       
    98    
       
    99     /**
       
   100      * Get a reference to core engine settings.
       
   101      *
       
   102      * @since S60 v3.1
       
   103      * @return Reference to core engine settings.
       
   104      */   
       
   105     core_settings_c& get_core_settings();
       
   106     
       
   107     /**
       
   108      * Get a reference to connection data.
       
   109      *
       
   110      * @since S60 v3.1
       
   111      * @return Pointer to connection data.
       
   112      */   
       
   113     core_connection_data_c* get_connection_data();
       
   114 
       
   115     /**
       
   116      * Get a reference to EAPOL instance.
       
   117      *
       
   118      * @since S60 v3.1
       
   119      * @return Reference to EAPOL instance.
       
   120      */   
       
   121     core_wlan_eapol_interface_c& get_eapol_instance();
       
   122    
       
   123     /**
       
   124      * Direct the callbacks from EAPOL to the given handler.
       
   125      *
       
   126      * @since S60 v3.1
       
   127      * @param New handler of EAPOL callbacks.
       
   128      */   
       
   129     void set_eapol_handler(
       
   130         abs_wlan_eapol_callback_interface_c* handler );
       
   131    
       
   132     /**
       
   133      * Return the device MAC address.
       
   134      *
       
   135      * @since S60 v3.1
       
   136      * @return The device MAC address.
       
   137      */        
       
   138     core_mac_address_s& own_mac_addr();
       
   139 
       
   140     /**
       
   141      * Queue the given internal operation. This method should be used
       
   142      * when queueing operations from inside other operations.
       
   143      *
       
   144      * @param operation Operation to be queued.
       
   145      * @return core_error_ok if successfully queued, an error otherwise.
       
   146      * @note Ownership of the operation instance is transferred immediately
       
   147      *       to this method. If there's an error, the instance is automatically
       
   148      *       deleted.
       
   149      */
       
   150     core_error_e queue_int_operation(
       
   151         core_operation_base_c* operation );
       
   152 
       
   153     /**
       
   154      * Queue the given internal operation and run the next operation if
       
   155      * no operation is executing.
       
   156      *
       
   157      * @param operation Operation to be queued.
       
   158      * @return core_error_ok if successfully queued, an error otherwise.
       
   159      * @note Ownership of the operation instance is transferred immediately
       
   160      *       to this method. If there's an error, the instance is automatically
       
   161      *       deleted.
       
   162      */
       
   163     core_error_e queue_int_operation_and_run_next(
       
   164         core_operation_base_c* operation );
       
   165 
       
   166     /**
       
   167      * Check whether WPA counter measures are active.
       
   168      *
       
   169      * @since S60 v3.1
       
   170      * @return Whether WPA counter measures are active.
       
   171      */
       
   172     bool_t is_cm_active();
       
   173 
       
   174     /**
       
   175      * Initialize the connection related data structures.
       
   176      * @param iap_data The settings used for establishing the connection.
       
   177      * @param device_settings Handle to device settings.
       
   178      * @since S60 v3.1
       
   179      */
       
   180     core_error_e init_connection_data(
       
   181         const core_iap_data_s& iap_data,
       
   182         const core_device_settings_s& device_settings );
       
   183 
       
   184     /**
       
   185      * Cleans up connection related data structures from core engine
       
   186      * @since S60 v3.1
       
   187      */
       
   188     void clear_connection_data();
       
   189 
       
   190     /**
       
   191      * Schedule roaming timer.
       
   192      *
       
   193      * @since S60 v3.1
       
   194      * @param delay Expiration time in micro seconds.
       
   195      */    
       
   196     void schedule_roam_timer(
       
   197         u32_t delay );
       
   198 
       
   199     /**
       
   200      * Cancel the roaming timer.
       
   201      *
       
   202      * @since S60 v3.1
       
   203      */
       
   204     void cancel_roam_timer();
       
   205     
       
   206     /**
       
   207      * Schedule operation timer.     
       
   208      *
       
   209      * @since S60 v3.1
       
   210      * @param delay Expiration time in micro seconds.
       
   211      * @note This timer should never be used while running a sub-operation
       
   212      *       since it's possible the sub-operation will also try to the use
       
   213      *       the same timer.
       
   214      */    
       
   215     void schedule_operation_timer(
       
   216         u32_t delay );
       
   217 
       
   218     /**
       
   219      * Cancel the operation timer.
       
   220      *
       
   221      * @since S60 v3.1
       
   222      */
       
   223     void cancel_operation_timer();
       
   224 
       
   225     /**
       
   226      * Check whether DHCP timer is active.
       
   227      * 
       
   228      * @since S60 v5.0
       
   229      * @return true_t if timer is active, false_t otherwise.
       
   230      */
       
   231     bool_t is_dhcp_timer_active();
       
   232 
       
   233     /**
       
   234      * Schedule the DHCP timer.
       
   235      *
       
   236      * @since S60 v3.1
       
   237      * @param delay Expiration time in micro seconds.
       
   238      */    
       
   239     void schedule_dhcp_timer(
       
   240         u32_t delay );
       
   241 
       
   242     /**
       
   243      * Cancel the DHCP timer.
       
   244      *
       
   245      * @since S60 v3.1
       
   246      */
       
   247     void cancel_dhcp_timer();
       
   248 
       
   249     /**
       
   250      * Schedule the driver unload timer.
       
   251      * 
       
   252      * @since S60 v3.1
       
   253      * @param delay Expiration time in micro seconds.
       
   254      */
       
   255     void schedule_unload_timer(
       
   256         u32_t delay );
       
   257 
       
   258     /**
       
   259      * Cancel the driver unload timer.
       
   260      *
       
   261      * @since S60 v3.1
       
   262      */
       
   263     void cancel_unload_timer();
       
   264 
       
   265     /**
       
   266      * Check whether an operation with the given flags is in queue.
       
   267      *
       
   268      * @param feature_flags Feature flags to check for.
       
   269      * @return Whether an operation with the given flags is in queue.
       
   270      */
       
   271     bool_t is_operation_in_queue_with_flags(
       
   272         u32_t feature_flags );
       
   273 
       
   274     /**
       
   275      * Check whether an operation of the given type is in queue.
       
   276      *
       
   277      * @param type Type of the operation to search for.
       
   278      * @return Whether an operation of the given type is in queue.
       
   279      */
       
   280     bool_t is_operation_in_queue_with_type(
       
   281         u32_t type );
       
   282 
       
   283     /**
       
   284      * Cancels all the operations in the queue that have
       
   285      * the given feature flags enabled. Does not touch
       
   286      * the currently executing operation.
       
   287      *
       
   288      * @since S60 v3.1
       
   289      * @param feature_flags Feature flags to check for.
       
   290      */    
       
   291     void cancel_operations_with_flags(
       
   292         u32_t feature_flags );
       
   293 
       
   294     /**
       
   295      * Cancels all the operations of the given type in the queue.
       
   296      * Does not touch the currently executing operation.
       
   297      *
       
   298      * @since S60 v3.2
       
   299      * @param type Operation type to check for.
       
   300      */    
       
   301     void cancel_operations_with_type(
       
   302         u32_t type );
       
   303 
       
   304     /**
       
   305      * Cancels all the operations in the queue including
       
   306      * the currently executing operation.
       
   307      *
       
   308      * @since S60 v3.2
       
   309      * @param is_graceful_cancel Whether cancel should be graceful or forced.     
       
   310      */
       
   311     void cancel_all_operations(
       
   312         bool_t is_graceful_cancel );
       
   313 
       
   314     /**
       
   315      * Creates an instance of EAPOL if needed.
       
   316      *
       
   317      * @since S60 v3.1
       
   318      * @param mode Operating mode to use.
       
   319      * @return true_t if an instance is successfully created or it already exists, false_t otherwise.
       
   320      */
       
   321     bool_t create_eapol_instance(
       
   322         core_eapol_operating_mode_e mode );
       
   323 
       
   324     /**
       
   325      * Return the current frame handler.
       
   326      *
       
   327      * @since S60 v3.2
       
   328      * @return Pointer to the current frame handler.
       
   329      */
       
   330     abs_core_frame_handler_c* frame_handler();
       
   331 
       
   332     /**
       
   333      * Register a handler for received frames.
       
   334      *
       
   335      * @since S60 v5.0
       
   336      * @param handler Pointer to the new handler.
       
   337      */
       
   338     void register_frame_handler(
       
   339         abs_core_frame_handler_c* handler );
       
   340 
       
   341     /**
       
   342      * Unregister a handler for received frames.
       
   343      *
       
   344      * @since S60 v5.0
       
   345      * @param handler Pointer to the registered handler.
       
   346      */
       
   347     void unregister_frame_handler(
       
   348         abs_core_frame_handler_c* handler );
       
   349 
       
   350     /**
       
   351      * Return a reference to the scan list.
       
   352      *
       
   353      * @since S60 v3.1
       
   354      * @return A reference to the scan list.
       
   355      */
       
   356     core_scan_list_c& get_scan_list();
       
   357 
       
   358     /**
       
   359      * Return the current event handler.
       
   360      *
       
   361      * @since S60 v3.2
       
   362      * @return Pointer to the current event handler.
       
   363      */
       
   364     abs_core_event_handler_c* event_handler();
       
   365 
       
   366     /**
       
   367      * Register a handler for received indications.
       
   368      *
       
   369      * @since S60 v5.0
       
   370      * @param handler Pointer to the new handler.
       
   371      */
       
   372     void register_event_handler(
       
   373         abs_core_event_handler_c* handler );
       
   374 
       
   375     /**
       
   376      * Unregister a handler for received indications.
       
   377      *
       
   378      * @since S60 v5.0
       
   379      * @param handler Pointer to the registered handler.
       
   380      */
       
   381     void unregister_event_handler(
       
   382         abs_core_event_handler_c* handler );
       
   383 
       
   384     /**
       
   385      * Forces the engine to roam to any available AP.
       
   386      * 
       
   387      * @since S60 v3.1
       
   388      * @param reason Reason to roam.
       
   389      */
       
   390     void schedule_roam(
       
   391         core_operation_handle_bss_lost_c::core_bss_lost_reason_e reason );
       
   392 
       
   393     /**
       
   394      * Send a management frame.
       
   395      *
       
   396      * @since S60 v3.2
       
   397      * @param frame_type The type of the frame to send.
       
   398      * @param frame_length The length of the frame.
       
   399      * @param frame_data Pointer to the frame data.
       
   400      * @param destination Destination MAC address.
       
   401      * @return true_t if frame was successfully sent, false_t otherwise.
       
   402      */
       
   403     bool_t send_management_frame(
       
   404         core_frame_type_e frame_type,
       
   405         const u16_t frame_length,
       
   406         const u8_t* const frame_data,
       
   407         const core_mac_address_s& destination );
       
   408 
       
   409     /**
       
   410      * Send a data frame.
       
   411      *
       
   412      * @since S60 v3.2
       
   413      * @param ap_data AP data is being sent to.
       
   414      * @param frame_type The type of the frame to send.
       
   415      * @param frame_length The length of the frame.
       
   416      * @param frame_data Pointer to the frame data.
       
   417      * @param frame_priority Desired priority of the frame.
       
   418      * @param destination Destination MAC address.
       
   419      * @param send_unencrypted Whether the frame must be sent unencrypted.    
       
   420      * @return true_t if frame was successfully sent, false_t otherwise.
       
   421      */
       
   422     bool_t send_data_frame(
       
   423         const core_ap_data_c& ap_data,
       
   424         core_frame_type_e frame_type,
       
   425         const u16_t frame_length,
       
   426         const u8_t* const frame_data,
       
   427         core_access_class_e frame_priority,
       
   428         const core_mac_address_s& destination,
       
   429         bool_t send_unencrypted = false_t );
       
   430 
       
   431     /**
       
   432      * Get a reference to WPX adaptation instance.
       
   433      *
       
   434      * @since S60 v3.1
       
   435      * @return Reference to WPX adaptation instance.
       
   436      */   
       
   437     abs_core_wpx_adaptation_c& get_wpx_adaptation_instance();
       
   438 
       
   439     /**
       
   440      * Direct the Protected Setup events to the given handler.
       
   441      *
       
   442      * @since S60 v3.2
       
   443      * @param New handler of Protected Setup events.
       
   444      */  
       
   445     void set_protected_setup_handler(
       
   446         abs_core_protected_setup_handler_c* handler );
       
   447 
       
   448 public: // abs_core_server_c
       
   449 
       
   450     /**
       
   451      * Connect to a network.
       
   452      *
       
   453      * @since S60 v3.1
       
   454      * @param request_id An unique identification for the request.
       
   455      * @param settings The settings used for establishing the connection.
       
   456      * @param connect_status contains the error code of connection attempt
       
   457      *        on completion
       
   458      * @param ssid_list List of possible secondary SSIDs.
       
   459      */
       
   460     void connect(
       
   461         u32_t request_id,
       
   462         const core_iap_data_s& settings,
       
   463         core_connect_status_e& connect_status,
       
   464         core_type_list_c<core_ssid_entry_s>* ssid_list = NULL );
       
   465 
       
   466     /**
       
   467      * Disconnect an active connection.
       
   468      * 
       
   469      * @since S60 v3.1
       
   470      * @param request_id An unique identification for the request.
       
   471      */
       
   472     void release(
       
   473         u32_t request_id );
       
   474 
       
   475     /**
       
   476      * Request available networks with the given SSID.
       
   477      * 
       
   478      * @since S60 v3.1
       
   479      * @param request_id An unique identification for the request.
       
   480      * @param scan_mode Defines whether active or passive scan is performed.
       
   481      * @param scan_ssid Name of the network to scan for.
       
   482      * @param scan_channels Channels to scan.
       
   483      * @param scan_max_age Maximum age of returned scan results in seconds.     
       
   484      * @param scan_data Scan results are stored here.
       
   485      * @param is_current_ap_added Whether the current AP needs to be added during an ongoing
       
   486      *                            connection if not otherwise found in the scan.
       
   487      * @note If the length of the SSID is zero, a broadcast scan is performed.
       
   488      */
       
   489     void get_scan_result(
       
   490         u32_t request_id,
       
   491         core_scan_mode_e scan_mode,
       
   492         const core_ssid_s& scan_ssid,
       
   493         const core_scan_channels_s& scan_channels,
       
   494         u8_t scan_max_age,
       
   495         ScanList& scan_data,
       
   496         bool_t is_current_ap_added = true_t );
       
   497 
       
   498     /**
       
   499      * Find which iaps from the given list are currently available.
       
   500      * @since S60 v3.1
       
   501      * @param request_id An unique identification for the request.
       
   502      * @param is_active_scan_allowed specifies whether active scanning is allowed.
       
   503      * @param iap_data_list containing list of iap data structures.
       
   504      * @param iap_id_list list of iap ids are stored here on completion.
       
   505      * @param iap_ssid_list List of possible secondary SSIDs.
       
   506      * @param scan_data contains the scan results
       
   507      */
       
   508     void get_available_iaps(
       
   509         u32_t request_id,
       
   510         bool_t is_active_scan_allowed,
       
   511         core_type_list_c<core_iap_data_s>& iap_data_list,
       
   512         core_type_list_c<u32_t>& iap_id_list,
       
   513         core_type_list_c<core_ssid_entry_s>* iap_ssid_list,
       
   514         ScanList& scan_data );
       
   515 
       
   516     /**
       
   517      * Get the current RCPI value of the connection.
       
   518      * 
       
   519      * @since S60 v3.1
       
   520      * @param request_id An unique identification for the request.
       
   521      * @param rcpi Current channel power indicator (RCPI).
       
   522      */
       
   523     void get_current_rcpi(
       
   524         u32_t request_id,
       
   525         u32_t& rcpi );
       
   526 
       
   527     /**
       
   528      * Disable all WLAN activity.
       
   529      *
       
   530      * Disconnects the active connection and prevents any further
       
   531      * WLAN activity until enable_wlan() is called.
       
   532      *
       
   533      * @since S60 v3.1
       
   534      * @param request_id An unique identification for the request.
       
   535      */        
       
   536     void disable_wlan(
       
   537         u32_t request_id );
       
   538         
       
   539     /**
       
   540      * Allow WLAN activity after disabled_wlan().
       
   541      *
       
   542      * @since S60 v3.1     
       
   543      * @param request_id An unique identification for the request.
       
   544      */
       
   545     void enable_wlan(
       
   546         u32_t request_id );
       
   547 
       
   548     /**
       
   549      * Schedule an immediate driver unload.
       
   550      *
       
   551      * @since S60 v3.1     
       
   552      * @return core_error_ok if success, an error code otherwise.
       
   553      */
       
   554     core_error_e unload_drivers();
       
   555 
       
   556     /**
       
   557      * Get packet statistics of the current connection.
       
   558      *
       
   559      * @since S60 v3.2
       
   560      * @param request_id An unique identification for the request.
       
   561      * @param statistics Packet statistics of the current connection.     
       
   562      */
       
   563     void get_packet_statistics(
       
   564         u32_t request_id,
       
   565         core_packet_statistics_s& statistics );
       
   566 
       
   567     /**
       
   568      * Request creation of a virtual traffic stream.
       
   569      *
       
   570      * @since S60 v3.2
       
   571      * @param request_id An unique identification for the request.
       
   572      * @param tid TID of the virtual traffic stream.
       
   573      * @param user_priority User Priority of the virtual traffic stream.
       
   574      * @param is_automatic_stream Whether the virtual traffic stream
       
   575      *                            has been created automatically.
       
   576      * @param params Parameters of the virtual traffic stream.
       
   577      * @param stream_id ID assigned to this virtual traffic stream on
       
   578      *                  successful completion.
       
   579      * @param stream_status Status of the virtual traffic stream on
       
   580      *                      successful completion. 
       
   581      * @note If the TID has been defined as TRAFFIC_STREAM_ID_NONE,
       
   582      *       core server will select the next free ID.
       
   583      */
       
   584     void create_traffic_stream(
       
   585         u32_t request_id,
       
   586         u8_t tid,
       
   587         u8_t user_priority,
       
   588         bool_t is_automatic_stream,
       
   589         const core_traffic_stream_params_s& params,
       
   590         u32_t& stream_id,
       
   591         core_traffic_stream_status_e& stream_status );
       
   592 
       
   593     /**
       
   594      * Request deletion of a virtual traffic stream.
       
   595      *
       
   596      * @since S60 v3.2
       
   597      * @param request_id An unique identification for the request.
       
   598      * @param stream_id ID of the virtual traffic stream.
       
   599      */
       
   600     void delete_traffic_stream(
       
   601         u32_t request_id,
       
   602         u32_t stream_id );   
       
   603 
       
   604     /**
       
   605      * Start Protected Setup.
       
   606      * 
       
   607      * @since S60 v3.2
       
   608      * @param request_id An unique identification for the request.
       
   609      * @param iap_data IAP data used for running Protected Setup.
       
   610      * @param iap_data_list IAP data results from a successful Protected Setup operation.
       
   611      * @param protected_setup_status contains the error code of Protected Setup attempt
       
   612      *        on completion.
       
   613      */
       
   614     void run_protected_setup(
       
   615         u32_t request_id,
       
   616         const core_iap_data_s& iap_data,
       
   617         core_type_list_c<core_iap_data_s>& iap_data_list,
       
   618         core_protected_setup_status_e& protected_setup_status );
       
   619 
       
   620     /**
       
   621      * Initiate a roam to the given BSSID.
       
   622      * 
       
   623      * @since S60 v3.2
       
   624      * @param request_id An unique identification for the request.
       
   625      * @param bssid BSSID to roam to. If BSSID is set to BROADCAST_MAC_ADDR,
       
   626      *              search for a better BSS is initiated.
       
   627      * @note This method does not guarantee that the a roam to the given BSSID
       
   628      *       will occur. If the roam succeeds, the request will be completed
       
   629      *       with core_error_ok, otherwise with an error code.  
       
   630      */
       
   631     void directed_roam(
       
   632         u32_t request_id,
       
   633         const core_mac_address_s& bssid );    
       
   634 
       
   635     /**
       
   636      * Get the BSSID of the access point currently connected to.
       
   637      * 
       
   638      * @since S60 v3.1
       
   639      * @param bssid BSSID of the access point.
       
   640      * @return core_error_ok if success, an error code otherwise.
       
   641      */
       
   642     core_error_e get_current_bssid(
       
   643         core_mac_address_s& bssid );
       
   644 
       
   645     /**
       
   646      * Get the name of the network (SSID) currently connected to.
       
   647      * 
       
   648      * @since S60 v3.1
       
   649      * @param ssid Current SSID.
       
   650      * @return core_error_ok if success, an error code otherwise.
       
   651      */
       
   652     core_error_e get_current_ssid(
       
   653         core_ssid_s& ssid );
       
   654 
       
   655     /**
       
   656      * Get the current security mode of the connection.
       
   657      * 
       
   658      * @since S60 v3.1
       
   659      * @param mode Current security mode.
       
   660      * @return core_error_ok if success, an error code otherwise.
       
   661      */
       
   662     core_error_e get_current_security_mode(
       
   663         core_connection_security_mode_e& mode );
       
   664 
       
   665     /**
       
   666      * Get the current connection state.
       
   667      * 
       
   668      * @since S60 v3.1
       
   669      * @param state Current connection state.
       
   670      * @return core_error_ok if success, an error code otherwise.
       
   671      */
       
   672     core_error_e get_current_connection_state(
       
   673         core_connection_state_e& state );
       
   674 
       
   675     /**
       
   676      * Inform core server about updated device settings.
       
   677      * 
       
   678      * @since S60 v3.1     
       
   679      * @param settings Updated device settings.
       
   680      * @return core_error_ok if success, an error code otherwise.
       
   681      * @note This method does not guarantee that the new parameters
       
   682      * are taken into use immediately.     
       
   683      */
       
   684     core_error_e update_device_settings(
       
   685         core_device_settings_s& settings );
       
   686 
       
   687     /**
       
   688      * Set the preferred power save mode.
       
   689      * 
       
   690      * @since S60 v3.1
       
   691      * @param mode Preferred power save mode.
       
   692      * @return core_error_ok if success, an error code otherwise.
       
   693      * @note This method does not guarantee that the new parameters
       
   694      *       are taken into use immediately.
       
   695      */
       
   696     core_error_e set_power_save_mode(
       
   697         const core_power_save_mode_s& mode );
       
   698 
       
   699     /**
       
   700      * Add a BSSID to the rogue list.
       
   701      *
       
   702      * Prevents roaming to the given BSSID and hides it from
       
   703      * the scan results.
       
   704      *
       
   705      * @since S60 v3.1
       
   706      * @param bssid BSSID to add to the list.
       
   707      * @return core_error_ok if success, an error code otherwise.
       
   708      * @note The list entry will be persistent, meaning it will not
       
   709      * be cleared when the connection is closed.
       
   710      */
       
   711     core_error_e add_bssid_to_rogue_list(
       
   712         const core_mac_address_s& bssid );
       
   713 
       
   714     /**
       
   715      * Remove a BSSID from the rogue list.
       
   716      *
       
   717      * @since S60 v3.1
       
   718      * @param bssid BSSID to remove from the list.
       
   719      * @return core_error_ok if success, an error code otherwise.
       
   720      */
       
   721     core_error_e remove_bssid_from_rogue_list(
       
   722         const core_mac_address_s& bssid );
       
   723 
       
   724     /**
       
   725      * Return a list of BSSIDs on the rogue list.
       
   726      *
       
   727      * @since S60 v3.2
       
   728      * @param rogue_list List of BSSIDs on the rogue list.
       
   729      * @return core_error_ok if success, an error code otherwise.
       
   730      */
       
   731     core_error_e get_rogue_list(
       
   732         core_type_list_c<core_mac_address_s>& rogue_list );
       
   733 
       
   734     /**
       
   735      * Set the RCP level notification boundary.
       
   736      *
       
   737      * When the signal strength is getting worse (RCPI value is getting smaller),
       
   738      * the core server will indicate core_notification_e::core_notification_rcp_changed
       
   739      * when the RCPI value gets smaller than the the rcp_level_boundary value.
       
   740      *
       
   741      * When the signal strength is getting better, the core server will indicate
       
   742      * core_notification_e::core_notification_rcp_changed when the RCPI value
       
   743      * gets bigger than the combined value of rcp_level_boundary and hysteresis.
       
   744      *
       
   745      * @since S60 v3.1
       
   746      * @param rcp_level_boundary RCP level notification boundary.
       
   747      * @param hysteresis Specifies the difference between boundaries when 
       
   748      *                   the RCP level is rising vs. descending
       
   749      * @return core_error_ok if success, an error code otherwise.
       
   750      */
       
   751     core_error_e set_rcp_level_notification_boundary(
       
   752         const i32_t rcp_level_boundary,
       
   753         const i32_t hysteresis );
       
   754 
       
   755     /**
       
   756      * Clear packet statistics of the current connection.
       
   757      *
       
   758      * @since S60 v3.2
       
   759      * @return core_error_ok if success, an error code otherwise.
       
   760      */
       
   761     core_error_e clear_packet_statistics();
       
   762 
       
   763     /**
       
   764      * Get the current U-APSD settings.
       
   765      *
       
   766      * @since S60 v3.2
       
   767      * @param settings Current U-APSD settings.
       
   768      * @return core_error_ok if success, an error code otherwise.
       
   769      */
       
   770     core_error_e get_uapsd_settings(
       
   771         core_uapsd_settings_s& settings );
       
   772 
       
   773     /**
       
   774      * Set the U-APSD settings.
       
   775      *
       
   776      * @since S60 v3.2
       
   777      * @param settings Current U-APSD settings to be set.
       
   778      * @return core_error_ok if success, an error code otherwise.
       
   779      * @note This method does not guarantee that the new parameters
       
   780      * are taken into use immediately.     
       
   781      */
       
   782     core_error_e set_uapsd_settings(
       
   783         const core_uapsd_settings_s& settings );
       
   784 
       
   785     /**
       
   786      * Get the current power save settings.
       
   787      *
       
   788      * @since S60 v3.2
       
   789      * @param settings Current power save settings.
       
   790      * @return core_error_ok if success, an error code otherwise.
       
   791      */
       
   792     core_error_e get_power_save_settings(
       
   793         core_power_save_settings_s& settings );
       
   794 
       
   795     /**
       
   796      * Set the power save settings.
       
   797      *
       
   798      * @since S60 v3.2
       
   799      * @param settings Current power save settings to be set.
       
   800      * @return core_error_ok if success, an error code otherwise.
       
   801      * @note This method does not guarantee that the new parameters
       
   802      * are taken into use immediately.     
       
   803      */
       
   804     core_error_e set_power_save_settings(
       
   805         const core_power_save_settings_s& settings );
       
   806 
       
   807     /**
       
   808      * Get information about the current AP.
       
   809      *
       
   810      * @since S60 v3.2
       
   811      * @param info Information about the current AP.
       
   812      * @return core_error_ok if success, an error code otherwise.
       
   813      */
       
   814     core_error_e get_current_ap_info(
       
   815         core_ap_information_s& info ); 
       
   816 
       
   817     /**
       
   818      * Get roam metrics of the current connection.
       
   819      *
       
   820      * @since S60 v3.2
       
   821      * @param roam_metrics Roam metrics of the current connection.
       
   822      */
       
   823     void get_roam_metrics(
       
   824         core_roam_metrics_s& roam_metrics );
       
   825 
       
   826     /**
       
   827      * Set the arp filter.
       
   828      *
       
   829      * @since S60 v5.0
       
   830      * @param filter Current ARP filter to be set.
       
   831      * @return core_error_ok if success, an error code otherwise.
       
   832      * @note This method does not guarantee that the new filter
       
   833      *       is taken into use immediately.
       
   834      */
       
   835     core_error_e set_arp_filter(
       
   836         const core_arp_filter_s& filter );
       
   837 
       
   838     /**
       
   839      * Delivers multicast MAC address to drivers.
       
   840      *
       
   841      * @since S60 v3.1
       
   842      * @param join_group is set true_t if adding a multicast address
       
   843      *        otherwise the address will be removed.
       
   844      * @param multicast_addr contains the MAC address to add/remove
       
   845      * @return core_error_ok if success, an error code otherwise.
       
   846      * @note This method does not guarantee that the new address
       
   847      *       is taken into use immediately.
       
   848      */
       
   849     core_error_e configure_multicast_group(
       
   850         bool_t join_group,
       
   851         const core_mac_address_s& multicast_addr );
       
   852 
       
   853     /**
       
   854      * Get information about current traffic statuses and traffic modes for
       
   855      * access classes.
       
   856      *
       
   857      * @since S60 v3.2
       
   858      * @param info Information about the current traffic statuses and traffic modes.
       
   859      * @return core_error_ok if success, an error code otherwise.
       
   860      */
       
   861     core_error_e get_current_ac_traffic_info(
       
   862         core_ac_traffic_information_s& info );
       
   863 
       
   864     /**
       
   865      * An asynchronous request from the core server has been completed.
       
   866      *
       
   867      * @since S60 v3.1
       
   868      * @param request_id Identification of the corresponding request.
       
   869      * @param status Completion status of the request.
       
   870      */
       
   871     void request_complete(
       
   872         u32_t request_id,
       
   873         core_error_e status );
       
   874 
       
   875     /**
       
   876      * Cancel a pending asynchronous request.
       
   877      * 
       
   878      * @since S60 v3.1
       
   879      * @param request_id Identification of the corresponding request.
       
   880      */
       
   881     void cancel_request(
       
   882         u32_t request_id );
       
   883 
       
   884 public: // abs_core_driverif_callback_c
       
   885 
       
   886     /**
       
   887      * Inform the core server about a new received frame.
       
   888      *
       
   889      * @since S60 v3.1
       
   890      * @param frame_type The type of the frame received.
       
   891      * @param frame_length The length of the frame.
       
   892      * @param frame_data Pointer to the frame data.     
       
   893      * @param frame_rcpi RCPI value of the frame.
       
   894      */
       
   895     void receive_frame(
       
   896         core_frame_type_e frame_type,
       
   897         const u16_t frame_length,
       
   898         const u8_t* const frame_data,
       
   899         u8_t frame_rcpi );
       
   900 
       
   901     /**
       
   902      * Notify the core server about an adaptation layer event.
       
   903      *
       
   904      * @note received notification is never related to an existing operation,
       
   905      * but it may lead to starting a new one.
       
   906      *
       
   907      * @since S60 v3.1
       
   908      * @param indication Adaptation layer event.
       
   909      */
       
   910     void notify(
       
   911         core_am_indication_e indication );
       
   912 
       
   913 private:
       
   914 
       
   915     /**
       
   916      * Called by the timer framework when timer expires.
       
   917      * @param pointer to 'this' (note: the static method)
       
   918      */
       
   919     static void queue_timer_expired(
       
   920         void* this_ptr );
       
   921 
       
   922     /**
       
   923      * Called by the driver unload timer when it expires
       
   924      * @param pointer to 'this' (note: the static method)
       
   925      */
       
   926     static void unload_timer_expired(
       
   927         void* this_ptr );
       
   928 
       
   929     /**
       
   930      * Called by the roaming timer when it expires
       
   931      * @param pointer to 'this' (note: the static method)
       
   932      */
       
   933     static void roam_timer_expired(
       
   934         void* this_ptr );    
       
   935 
       
   936     /**
       
   937      * Called by the operation timer when it expires
       
   938      * @param pointer to 'this' (note: the static method)
       
   939      */
       
   940     static void operation_timer_expired(
       
   941         void* this_ptr );    
       
   942 
       
   943     /**
       
   944      * Called by the DHCP timer when it expires
       
   945      *
       
   946      * @since S60 v3.1
       
   947      * @param pointer to 'this' (note: the static method)
       
   948      */
       
   949     static void dhcp_timer_expired(
       
   950         void* this_ptr );    
       
   951 
       
   952     /**
       
   953      * Schedule the next operation to be run. If the queue is empty
       
   954      * or there's already a running operation, do nothing.
       
   955      */
       
   956     void schedule_operation();
       
   957 
       
   958     /**
       
   959      * Queue the given external operation and run the next operation if
       
   960      * no operation is executing.
       
   961      *
       
   962      * @param operation Operation to be queued.
       
   963      * @param request_id ID of the operation.
       
   964      * @note Ownership of the operation instance is transferred immediately
       
   965      *       to this method. If there's an error, the instance is automatically
       
   966      *       deleted.
       
   967      */
       
   968     void queue_ext_operation_and_run_next(
       
   969         core_operation_base_c* operation,
       
   970         u32_t request_id );
       
   971 
       
   972     /**
       
   973      * Notify EAPOL about a MIC failure.
       
   974      *
       
   975      * @param is_group_key_fail Is this a group or pairwise key failure.
       
   976      */
       
   977     void mic_failure(
       
   978         bool_t is_group_key_fail );
       
   979 
       
   980     /**
       
   981      * Queue an operation to unload the drivers.
       
   982      */
       
   983     void queue_unload_drivers();
       
   984 
       
   985 private: // data
       
   986 
       
   987     abs_core_server_callback_c& callback_m;
       
   988     
       
   989     abs_core_driverif_c& drivers_m;
       
   990 
       
   991     /** Device settings. */
       
   992     core_device_settings_s device_settings_m;
       
   993 
       
   994     /** Queue for operations to be performed. */
       
   995     core_type_list_c<core_operation_base_c> queue_m;
       
   996     
       
   997     /** Timer for running queue operations. */
       
   998     abs_core_timer_c* queue_timer_m;
       
   999     
       
  1000     /** Timer for unloading drivers */
       
  1001     abs_core_timer_c* driver_unload_timer_m;
       
  1002     
       
  1003     /** Core engine settings and statuses. */
       
  1004     core_settings_c core_settings_m;
       
  1005     
       
  1006     /** Connection data */
       
  1007     core_connection_data_c* connection_data_m;
       
  1008     
       
  1009     /** Device MAC address. */
       
  1010     core_mac_address_s own_mac_addr_m;
       
  1011     
       
  1012     /** Handler to EAPOL callbacks. */
       
  1013     core_eapol_handler_c* eapol_handler_m;
       
  1014     
       
  1015     /** EAPOL */
       
  1016     core_wlan_eapol_interface_c* eapol_m;
       
  1017 
       
  1018     /** Timer for WPA TKIP counter measures. */
       
  1019     core_timer_counter_measures_c cm_timer_m;
       
  1020 
       
  1021     /** Timer for romaing. */
       
  1022     abs_core_timer_c* roam_timer_m;
       
  1023 
       
  1024     /** Timer for currently active operation's purposes */
       
  1025     abs_core_timer_c* operation_timer_m;
       
  1026 
       
  1027     /** Timer for enabling power save after DHCP is done. */
       
  1028     abs_core_timer_c* driver_dhcp_timer_m;
       
  1029 
       
  1030     /** Handler for received frames. Not owned by this pointer. */
       
  1031     abs_core_frame_handler_c* frame_handler_m;
       
  1032     
       
  1033     /** Handler for received indications. Not owned by this pointer. */
       
  1034     abs_core_event_handler_c* event_handler_m;
       
  1035 
       
  1036     /** Scan list for storing beacons/probe responses. */
       
  1037     core_scan_list_c scan_list_m;
       
  1038 
       
  1039     /** WPX adaptation instance. */
       
  1040     abs_core_wpx_adaptation_c* wpx_adaptation_m;
       
  1041 
       
  1042     };
       
  1043 
       
  1044 #endif // CORE_SERVER_H