eapol/eapol_framework/eapol_common/include/eapol_ethernet_address.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_ETHERNET_ADDRESS_H_)
       
    22 #define _EAPOL_ETHERNET_ADDRESS_H_
       
    23 
       
    24 #include "eap_tools.h"
       
    25 #include "eapol_header.h"
       
    26 #include "eap_general_header_base.h"
       
    27 
       
    28 const u32_t EAPOL_ETHERNET_ADDRESS_LENGTH = 6u;
       
    29 
       
    30 
       
    31 class eap_eth_address_c
       
    32 {
       
    33 private:
       
    34 	u8_t m_address[EAPOL_ETHERNET_ADDRESS_LENGTH];
       
    35 public:
       
    36 
       
    37 	eap_eth_address_c()
       
    38 	{
       
    39 	}
       
    40 
       
    41 	virtual ~eap_eth_address_c()
       
    42 	{
       
    43 	}
       
    44 
       
    45 	u8_t * get_address() const
       
    46 	{
       
    47 		return const_cast<u8_t *>(m_address);
       
    48 	}
       
    49 
       
    50 	u32_t get_address_length() const
       
    51 	{
       
    52 		return sizeof(m_address);
       
    53 	}
       
    54 
       
    55 	void set_address(abs_eap_am_tools_c * const m_am_tools, u8_t * const p_address, const u32_t length)
       
    56 	{
       
    57 		EAP_UNREFERENCED_PARAMETER(m_am_tools);
       
    58 
       
    59 		EAP_ASSERT_TOOLS(m_am_tools, length == EAPOL_ETHERNET_ADDRESS_LENGTH);
       
    60 
       
    61 		for (u32_t ind = 0u; ind < length; ind++)
       
    62 		{
       
    63 			m_address[ind] = p_address[ind];
       
    64 		}
       
    65 	}
       
    66 
       
    67 	void reset_address()
       
    68 	{
       
    69 		for (u32_t ind = 0u; ind < EAPOL_ETHERNET_ADDRESS_LENGTH; ind++)
       
    70 		{
       
    71 			m_address[ind] = 0;
       
    72 		}
       
    73 	}
       
    74 };
       
    75 
       
    76 
       
    77 #endif //#if !defined(_EAPOL_ETHERNET_ADDRESS_H_)
       
    78 
       
    79 //--------------------------------------------------
       
    80 
       
    81 
       
    82 
       
    83 // End.