eapol/eapol_framework/eapol_common/include/eapol_rsna_key_data_payloads.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 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:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #if !defined(_EAPOL_RSNA_KEY_DATA_PAYLOADS_H_)
       
    22 #define _EAPOL_RSNA_KEY_DATA_PAYLOADS_H_
       
    23 
       
    24 #include "eap_variable_data.h"
       
    25 #include "eap_am_export.h"
       
    26 #include "eapol_rsna_key_data_header.h"
       
    27 #include "eap_array.h"
       
    28 
       
    29 
       
    30 
       
    31 class EAP_EXPORT eapol_rsna_variable_data_c
       
    32 : public eap_variable_data_c
       
    33 {
       
    34 private:
       
    35 	//--------------------------------------------------
       
    36 
       
    37 	abs_eap_am_tools_c * const m_am_tools;
       
    38 
       
    39 	eapol_rsna_key_data_header_c m_original_header;
       
    40 
       
    41 	//--------------------------------------------------
       
    42 protected:
       
    43 	//--------------------------------------------------
       
    44 
       
    45 	//--------------------------------------------------
       
    46 public:
       
    47 	//--------------------------------------------------
       
    48 
       
    49 	EAP_FUNC_IMPORT virtual ~eapol_rsna_variable_data_c();
       
    50 
       
    51 	EAP_FUNC_IMPORT eapol_rsna_variable_data_c(
       
    52 		abs_eap_am_tools_c * const tools,
       
    53 		const bool is_RSNA_when_true,
       
    54 		const bool is_WPXM_when_true);
       
    55 
       
    56 	EAP_FUNC_IMPORT const eapol_rsna_key_data_header_c * get_original_header() const;
       
    57 
       
    58 	EAP_FUNC_IMPORT eap_status_e set_buffer(
       
    59 		const eapol_rsna_key_data_header_c * const original_header,
       
    60 		u8_t *buffer,
       
    61 		const u32_t buffer_length,
       
    62 		const bool free_buffer,
       
    63 		const bool is_writable);
       
    64 
       
    65 	//--------------------------------------------------
       
    66 }; // class eapol_rsna_variable_data_c
       
    67 
       
    68 
       
    69 //--------------------------------------------------
       
    70 
       
    71 
       
    72 // 
       
    73 class EAP_EXPORT eapol_rsna_key_data_payloads_c
       
    74 {
       
    75 private:
       
    76 	//--------------------------------------------------
       
    77 
       
    78 	abs_eap_am_tools_c * const m_am_tools;
       
    79 
       
    80 
       
    81 	/// This includes reference to Group Transient Key (GTK) if such payloads is included to EAPOL Key Data.
       
    82 	eapol_rsna_variable_data_c m_group_key;
       
    83 
       
    84 	/// This is KeyID if such payloads is included to EAPOL Key Data.
       
    85 	u8_t m_group_key_id;
       
    86 
       
    87 	/// This is Tx bit if such payloads is included to EAPOL Key Data.
       
    88 	bool m_group_key_tx_bit;
       
    89 
       
    90 
       
    91 	/// This includes reference to STAKey if such payloads is included to EAPOL Key Data.
       
    92 	eapol_rsna_variable_data_c m_STAKey;
       
    93 
       
    94 	/// This includes reference to Pairwise Master Key ID (PMKID) if such payloads is included to EAPOL Key Data.
       
    95 	eapol_rsna_variable_data_c m_PMKID;
       
    96 
       
    97 	/// This plain reference to information elements if such payloads is included to EAPOL Key Data.
       
    98 	/// Here could be included one or more RSN IEs.
       
    99 	eap_array_c<eap_variable_data_c> m_RSN_IE;
       
   100 
       
   101 	bool m_is_valid;
       
   102 
       
   103 	//--------------------------------------------------
       
   104 protected:
       
   105 	//--------------------------------------------------
       
   106 
       
   107 	//--------------------------------------------------
       
   108 public:
       
   109 	//--------------------------------------------------
       
   110 
       
   111 
       
   112 	enum eapol_rsna_key_data_payload_status_e
       
   113 	{
       
   114 		eapol_rsna_key_data_payload_status_optional,
       
   115 		eapol_rsna_key_data_payload_status_must_be,
       
   116 		eapol_rsna_key_data_payload_status_must_not_be
       
   117 	};
       
   118 
       
   119 
       
   120 	EAP_FUNC_IMPORT virtual ~eapol_rsna_key_data_payloads_c();
       
   121 
       
   122 	EAP_FUNC_IMPORT eapol_rsna_key_data_payloads_c(
       
   123 		abs_eap_am_tools_c * const tools,
       
   124 		const bool is_RSNA_when_true,
       
   125 		const bool is_WPXM_when_true);
       
   126 
       
   127 	EAP_FUNC_IMPORT bool check_one_payload(
       
   128 		const eapol_rsna_key_data_payload_status_e status,
       
   129 		const eapol_rsna_variable_data_c * const payload);
       
   130 
       
   131 	EAP_FUNC_IMPORT bool check_one_payload(
       
   132 		const eapol_rsna_key_data_payload_status_e status,
       
   133 		const eap_array_c<eap_variable_data_c> * const payload);
       
   134 
       
   135 	/** This function checks the correct set of payloads are included in the message.
       
   136 	 *  NOTE do not change the order of parameters.
       
   137 	 *  Add new payload type to the last of the parameter list.
       
   138 	 */
       
   139 	EAP_FUNC_IMPORT bool check_payloads(
       
   140 		const eapol_rsna_key_data_payload_status_e key_id_and_group_key,
       
   141 		const eapol_rsna_key_data_payload_status_e sta_key,
       
   142 		const eapol_rsna_key_data_payload_status_e pmkid,
       
   143 		const eapol_rsna_key_data_payload_status_e one_or_more_RSN_IE
       
   144 		);
       
   145 
       
   146 	u8_t get_group_key_id();
       
   147 
       
   148 	bool get_group_key_tx();
       
   149 
       
   150 	eapol_rsna_variable_data_c * get_group_key();
       
   151 
       
   152 	eapol_rsna_variable_data_c * get_STAKey();
       
   153 
       
   154 	eapol_rsna_variable_data_c * get_PMKID();
       
   155 
       
   156 	eap_array_c<eap_variable_data_c> * get_RSN_IE();
       
   157 
       
   158 	bool get_is_valid() const;
       
   159 
       
   160 
       
   161 	void set_group_key_id(const u8_t key_index);
       
   162 
       
   163 	void set_group_key_tx(const bool key_tx_bit);
       
   164 
       
   165 	//--------------------------------------------------
       
   166 }; // class eapol_rsna_key_data_payloads_c
       
   167 
       
   168 
       
   169 #endif //#if !defined(_EAPOL_RSNA_KEY_DATA_PAYLOADS_H_)
       
   170 
       
   171 //--------------------------------------------------
       
   172 
       
   173 
       
   174 
       
   175 // End.