eapol/eapol_framework/wapi_common/src/wai_message.cpp
changeset 17 8840d3e38314
equal deleted inserted replaced
2:1c7bc153c08e 17:8840d3e38314
       
     1 /*
       
     2 * ============================================================================
       
     3 *  Name        : ./accesssec/eapol/eapol_framework/wapi_common/src/wai_message.cpp
       
     4 *  Part of     : WAPI / WAPI       *** Info from the SWAD
       
     5 *  Description : WAPI authentication
       
     6 *  Version     : %version: 11 % << Don't touch! Updated by Synergy at check-out.
       
     7 *
       
     8 *  Copyright © 2001-2009 Nokia.  All rights reserved.
       
     9 *  This material, including documentation and any related computer
       
    10 *  programs, is protected by copyright controlled by Nokia.  All
       
    11 *  rights are reserved.  Copying, including reproducing, storing,
       
    12 *  adapting or translating, any or all of this material requires the
       
    13 *  prior written consent of Nokia.  This material also contains
       
    14 *  confidential information which may not be disclosed to others
       
    15 *  without the prior written consent of Nokia.
       
    16 * ============================================================================
       
    17 * Template version: 4.1.1
       
    18 */
       
    19 
       
    20 // This is enumeration of WAPI source code.
       
    21 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    22 	#undef EAP_FILE_NUMBER_ENUM
       
    23 	#define EAP_FILE_NUMBER_ENUM 711 
       
    24 	#undef EAP_FILE_NUMBER_DATE 
       
    25 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    26 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    27 
       
    28 #if defined(USE_WAPI_CORE)
       
    29 
       
    30 #include "eap_am_memory.h"
       
    31 #include "eap_tools.h"
       
    32 #include "eap_array.h"
       
    33 #include "wai_message.h"
       
    34 
       
    35 /** @file */
       
    36 
       
    37 
       
    38 //--------------------------------------------------
       
    39 
       
    40 EAP_FUNC_EXPORT wai_message_c::~wai_message_c()
       
    41 {
       
    42 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    43 
       
    44 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    45 }
       
    46 
       
    47 //--------------------------------------------------
       
    48 
       
    49 EAP_FUNC_EXPORT wai_message_c::wai_message_c(
       
    50 	abs_eap_am_tools_c * const tools,
       
    51 	const bool is_client)
       
    52 	: m_am_tools(tools)
       
    53 	, m_message_data(tools)
       
    54 	, m_is_client(is_client)
       
    55 {
       
    56 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    57 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    58 }
       
    59 
       
    60 //--------------------------------------------------
       
    61 
       
    62 EAP_FUNC_EXPORT eap_status_e wai_message_c::reset()
       
    63 {
       
    64 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    65 
       
    66 	eap_status_e status = m_message_data.reset();
       
    67 
       
    68 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    69 	return EAP_STATUS_RETURN(m_am_tools, status);
       
    70 }
       
    71 
       
    72 //--------------------------------------------------
       
    73 
       
    74 EAP_FUNC_EXPORT eap_status_e wai_message_c::set_wai_message_data(
       
    75 	const eap_variable_data_c * const wai_message_data)
       
    76 {
       
    77 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    78 
       
    79 	eap_status_e status = m_message_data.set_copy_of_buffer(wai_message_data);
       
    80 	if (status != eap_status_ok)
       
    81 	{
       
    82 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    83 		return EAP_STATUS_RETURN(m_am_tools, status);
       
    84 	}
       
    85 
       
    86 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    87 	return EAP_STATUS_RETURN(m_am_tools, status);
       
    88 }
       
    89 
       
    90 //--------------------------------------------------
       
    91 
       
    92 EAP_FUNC_EXPORT const eap_variable_data_c * wai_message_c::get_wai_message_data() const
       
    93 {
       
    94 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    95 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    96 	return &m_message_data;
       
    97 }
       
    98 
       
    99 //--------------------------------------------------
       
   100 
       
   101 EAP_FUNC_EXPORT eap_variable_data_c * wai_message_c::get_wai_message_data_writable()
       
   102 {
       
   103 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   104 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   105 	return &m_message_data;
       
   106 }
       
   107 
       
   108 //--------------------------------------------------
       
   109 
       
   110 EAP_FUNC_EXPORT bool wai_message_c::get_is_valid() const
       
   111 {
       
   112 	return m_message_data.get_is_valid();
       
   113 }
       
   114 
       
   115 //--------------------------------------------------
       
   116 
       
   117 EAP_FUNC_EXPORT wai_message_c * wai_message_c::copy() const
       
   118 {
       
   119 	wai_message_c * new_message = new wai_message_c(
       
   120 		m_am_tools,
       
   121 		m_is_client);
       
   122 	if (new_message == 0
       
   123 		|| new_message->get_is_valid() == false)
       
   124 	{
       
   125 		return 0;
       
   126 	}
       
   127 
       
   128 	eap_status_e status = new_message->set_wai_message_data(get_wai_message_data());
       
   129 	if (status != eap_status_ok)
       
   130 	{
       
   131 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   132 		(void) EAP_STATUS_RETURN(m_am_tools, status);
       
   133 		return 0;
       
   134 	}
       
   135 
       
   136 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   137 	return new_message;
       
   138 }
       
   139 
       
   140 //--------------------------------------------------
       
   141 
       
   142 #endif //#if defined(USE_WAPI_CORE)
       
   143 
       
   144 // End.