eapol/eapol_framework/eapol_common/include/eapol_rsna_key_data_gtk_header.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_GTK_HEADER_H_)
       
    22 #define _EAPOL_RSNA_KEY_DATA_GTK_HEADER_H_
       
    23 
       
    24 #include "eapol_header.h"
       
    25 #include "eap_general_header_base.h"
       
    26 #include "eapol_key_header.h"
       
    27 
       
    28 
       
    29 //------------------------------------------------------
       
    30 
       
    31 /// This is base class of EAPOL RSNA key data GTK header.
       
    32 /**
       
    33  * @code
       
    34  *      0       1       2       3       4       5       6       7
       
    35  *  +-------+-------+-------+-------+-------+-------+-------+-------+
       
    36  *  |    Key ID     |  Tx   |            Reserved                   |
       
    37  *  +-------+-------+-------+-------+-------+-------+-------+-------+
       
    38  *  |                      Reserved                                 |
       
    39  *  +-------+-------+-------+-------+-------+-------+-------+-------+
       
    40  *  |                    GTK (Length -6) Octets                     |
       
    41  *  +-                                                             -+
       
    42  *  |                                                               |
       
    43  *  +-------+-------+-------+-------+-------+-------+-------+-------+
       
    44  * @endcode
       
    45  */
       
    46 class EAP_EXPORT eapol_rsna_key_data_gtk_header_c
       
    47 : public eap_general_header_base_c
       
    48 {
       
    49 private:
       
    50 	//--------------------------------------------------
       
    51 
       
    52 	/// This is pointer to the tools class.
       
    53 	abs_eap_am_tools_c * const m_am_tools;
       
    54 
       
    55 	//--------------------------------------------------
       
    56 public:
       
    57 	//--------------------------------------------------
       
    58 
       
    59 	enum eapol_rsna_key_data_gtk_header_constants_e
       
    60 	{
       
    61 		EAPOL_RSNA_KEY_DATA_FLAGS_FIELD_SIZE          = sizeof(u8_t),
       
    62 		EAPOL_RSNA_KEY_DATA_RESERVED_FIELD_SIZE       = sizeof(u8_t),
       
    63 		EAPOL_RSNA_KEY_DATA_INVALID_GTK_INDEX         = 0xff,
       
    64 	};
       
    65 
       
    66 	//--------------------------------------------------
       
    67 protected:
       
    68 	//--------------------------------------------------
       
    69 
       
    70 	enum offsets_e
       
    71 	{
       
    72 		m_offset_flags                 = 0ul,
       
    73 		m_offset_reserved              = m_offset_flags                 + EAPOL_RSNA_KEY_DATA_FLAGS_FIELD_SIZE,
       
    74 		m_offset_gtk                   = m_offset_reserved              + EAPOL_RSNA_KEY_DATA_RESERVED_FIELD_SIZE,
       
    75 	};
       
    76 
       
    77 	enum eapol_rsna_key_data_gtk_header_masks_e
       
    78 	{
       
    79 		EAPOL_RSNA_KEY_DATA_GTK_INDEX_MASK = 0x03,
       
    80 		EAPOL_RSNA_KEY_DATA_TX_MASK        = 0x04,
       
    81 		EAPOL_RSNA_KEY_DATA_RESERVED_MASK  = 0xf8,
       
    82 	};
       
    83 
       
    84 	enum eapol_rsna_key_data_gtk_header_shift_e
       
    85 	{
       
    86 		EAPOL_RSNA_KEY_DATA_GTK_INDEX_SHIFT = 0x00,
       
    87 		EAPOL_RSNA_KEY_DATA_TX_SHIFT        = 0x02,
       
    88 		EAPOL_RSNA_KEY_DATA_RESERVED_SHIFT  = 0x03,
       
    89 	};
       
    90 
       
    91 	//--------------------------------------------------
       
    92 public:
       
    93 	//--------------------------------------------------
       
    94 
       
    95 	// 
       
    96 	virtual ~eapol_rsna_key_data_gtk_header_c();
       
    97 
       
    98 	// 
       
    99 	eapol_rsna_key_data_gtk_header_c(
       
   100 		abs_eap_am_tools_c * const tools,
       
   101 		void * const header_begin,
       
   102 		const u32_t header_buffer_length);
       
   103 
       
   104 	u8_t get_key_index() const;
       
   105 
       
   106 	bool get_tx_bit() const;
       
   107 
       
   108 	u8_t * get_gtk_offset(const u32_t offset, const u32_t contignuous_bytes) const;
       
   109 
       
   110 	/**
       
   111 	 * This function returns pointer to the GTK.
       
   112 	 * @param contignuous_bytes is the length of queried data in bytes.
       
   113 	 */
       
   114 	u8_t * get_gtk(const u32_t contignuous_bytes) const;
       
   115 
       
   116 	static u16_t get_header_length();
       
   117 
       
   118 
       
   119 	eap_status_e set_key_index(const u32_t index);
       
   120 
       
   121 	eap_status_e set_tx(const bool tx);
       
   122 
       
   123 	eap_status_e set_reserved_flag(const u32_t reserved);
       
   124 
       
   125 	eap_status_e set_reserved_field(const u32_t reserved);
       
   126 
       
   127 	eap_status_e check_header() const;
       
   128 
       
   129 	eap_status_e reset_header();
       
   130 
       
   131 	// 
       
   132 	//--------------------------------------------------
       
   133 }; // class eapol_rsna_key_data_gtk_header_c
       
   134 
       
   135 
       
   136 #endif //#if !defined(_EAPOL_RSNA_KEY_DATA_HEADER_H_)
       
   137 
       
   138 //------------------------------------------------------
       
   139 
       
   140 
       
   141 
       
   142 // End.