wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/inc/core_frame_wsc_ie.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:  Class for parsing WSC IEs.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CORE_FRAME_WSC_IE_H
       
    20 #define CORE_FRAME_WSC_IE_H
       
    21 
       
    22 #include "core_frame_dot11_ie.h"
       
    23 #include "core_types.h"
       
    24 
       
    25 // Compile time assert. Used to make sure that datatypes in generate are correct size.
       
    26 #define COMPILE_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
       
    27 
       
    28 
       
    29 const u8_t CORE_FRAME_WSC_IE_USED_VERSION = 0x10;
       
    30 const u8_t CORE_FRAME_WSC_IE_REQUEST_TYPE_ENROLLEE = 0x01;
       
    31 
       
    32 /**
       
    33  * Class for parsing and generating WSC IEs (Wi-Fi Protected Setup).
       
    34  *
       
    35  * @since S60 v3.2
       
    36  */
       
    37 NONSHARABLE_CLASS( core_frame_wsc_ie_c ) : public core_frame_dot11_ie_c
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     enum core_frame_wsc_ie_config_method_e
       
    43         {
       
    44         core_frame_wsc_ie_config_method_usba            = 0x0001,
       
    45         core_frame_wsc_ie_config_method_ethernet        = 0x0002,
       
    46         core_frame_wsc_ie_config_method_pin_label       = 0x0004,
       
    47         core_frame_wsc_ie_config_method_pin_display     = 0x0008,
       
    48         core_frame_wsc_ie_config_method_nfc_ext_token   = 0x0010,
       
    49         core_frame_wsc_ie_config_method_nfc_int_token   = 0x0020,
       
    50         core_frame_wsc_ie_config_method_nfc_interface   = 0x0040,
       
    51         core_frame_wsc_ie_config_method_push_button     = 0x0080,
       
    52         core_frame_wsc_ie_config_method_keypad          = 0x0100
       
    53         };
       
    54 
       
    55     /**
       
    56      * Factory for creating a parser instance.
       
    57      *
       
    58      * @since S60 v3.2
       
    59      * @param ie Pointer to the IE data.
       
    60      * @return A pointer to the created IE instance.
       
    61      */
       
    62     static core_frame_wsc_ie_c* instance(
       
    63         const core_frame_dot11_ie_c& ie );
       
    64 
       
    65     /**
       
    66      * Factory for creating an IE with the given parameters.
       
    67      *
       
    68      * @since S60 v3.2
       
    69      * @param version Used Protected Setup version number.
       
    70      * @param request_type Specifies the mode in which the device will operate in this setup exchange.
       
    71      * @return A pointer to the created IE instance.
       
    72      */
       
    73     static core_frame_wsc_ie_c* instance(
       
    74         const u8_t version,
       
    75         const u8_t request_type );
       
    76 
       
    77     /** 
       
    78      * Destructor.
       
    79      */
       
    80     virtual ~core_frame_wsc_ie_c();
       
    81 
       
    82     /**
       
    83      * Following getters are used to read values from IE.
       
    84      * Conversion from Big endian to host order is done in these methods.
       
    85      * 
       
    86      * @return Attribute value or pointer to attribute data.
       
    87      */
       
    88     u16_t association_state() const;
       
    89     u16_t config_methods() const;
       
    90     u16_t configuration_error() const;
       
    91     const u8_t* device_name() const;
       
    92     u16_t device_password_id() const;
       
    93     const u8_t* manufacturer() const;
       
    94     const u8_t* model_name() const;
       
    95     const u8_t* model_number() const;
       
    96     u8_t request_type() const;
       
    97     u8_t response_type() const;
       
    98     u8_t rf_bands() const;
       
    99     bool_t selected_registrar() const;
       
   100     const u8_t* serial_number() const;
       
   101     u8_t protected_setup_state() const;
       
   102     const u8_t* uuid_e() const;
       
   103     const u8_t* uuid_r() const;
       
   104     u8_t version() const;
       
   105     u16_t selected_registrar_config_methods() const;
       
   106     const u8_t* primary_device_type() const;
       
   107     bool_t ap_setup_locked() const;
       
   108 
       
   109 private:
       
   110 
       
   111     /**
       
   112      * Search through data and stores Attribute indexes to members.
       
   113      */
       
   114     void search_attributes();
       
   115     
       
   116     /**
       
   117      * Generate IE for Association request.
       
   118      *
       
   119      * @param version Used Protected Setup version number.
       
   120      * @param request_type Specifies the mode in which the device will operate in this setup exchange.
       
   121      */
       
   122     void generate(
       
   123         const u8_t version,
       
   124         const u8_t request_type );
       
   125 
       
   126     /**
       
   127      * Constructor
       
   128      *
       
   129      * @param data_length Length of the IE data.
       
   130      * @param data Pointer to the IE data.     
       
   131      */
       
   132     core_frame_wsc_ie_c(
       
   133        u16_t data_length,
       
   134        const u8_t* data,
       
   135        u16_t max_data_length );
       
   136        
       
   137 private: // Data
       
   138 
       
   139     /* 
       
   140      * Indexes to data fields within IE.
       
   141      * These indexes are used in getters for easy access to attributes.
       
   142      */
       
   143     u8_t association_state_ind_m;
       
   144     u8_t config_methods_ind_m;
       
   145     u8_t configuration_error_ind_m;
       
   146     u8_t device_name_ind_m;
       
   147     u8_t device_password_id_ind_m;
       
   148     u8_t manufacturer_ind_m;
       
   149     u8_t model_name_ind_m;
       
   150     u8_t model_number_ind_m;
       
   151     u8_t request_type_ind_m;
       
   152     u8_t response_type_ind_m;
       
   153     u8_t rf_bands_ind_m;
       
   154     u8_t selected_registrar_ind_m;
       
   155     u8_t serial_number_ind_m;
       
   156     u8_t protected_setup_state_ind_m;
       
   157     u8_t uuid_e_ind_m;
       
   158     u8_t uuid_r_ind_m;
       
   159     u8_t version_ind_m;
       
   160     u8_t selected_registrar_config_methods_ind_m;
       
   161     u8_t primary_device_type_ind_m;
       
   162     u8_t ap_setup_locked_ind_m;
       
   163 
       
   164     };
       
   165 
       
   166 
       
   167 #endif // CORE_FRAME_WSC_IE_H