eapol/eapol_framework/wapi_common/src/wapi_strings.cpp
changeset 17 8840d3e38314
equal deleted inserted replaced
2:1c7bc153c08e 17:8840d3e38314
       
     1 /*
       
     2 * ============================================================================
       
     3 *  Name        : ./accesssec/eapol/eapol_framework/wapi_common/src/wapi_strings.cpp
       
     4 *  Part of     : WAPI / WAPI       *** Info from the SWAD
       
     5 *  Description : WAPI authentication
       
     6 *  Version     : %version: 23 % << 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 
       
    21 
       
    22 // This is enumeration of WAPI source code.
       
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    24 	#undef EAP_FILE_NUMBER_ENUM
       
    25 	#define EAP_FILE_NUMBER_ENUM 707 
       
    26 	#undef EAP_FILE_NUMBER_DATE 
       
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    29 
       
    30 
       
    31 #if defined(USE_WAPI_CORE)
       
    32 
       
    33 #include "eap_automatic_variable.h"
       
    34 #include "ec_cs_types.h"
       
    35 #include "ec_cs_data.h"
       
    36 #include "wapi_strings.h"
       
    37 
       
    38 //----------------------------------------------------------------------------
       
    39 
       
    40 EAP_FUNC_EXPORT wapi_strings_c::~wapi_strings_c()
       
    41 {
       
    42 }
       
    43 
       
    44 EAP_FUNC_EXPORT wapi_strings_c::wapi_strings_c()
       
    45 {
       
    46 }
       
    47 
       
    48 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wapi_completion_operation_string(const wapi_completion_operation_e type)
       
    49 {
       
    50 #if defined(USE_EAP_TRACE_STRINGS)
       
    51 	EAP_IF_RETURN_STRING(type, wapi_completion_operation_none)
       
    52 	else EAP_IF_RETURN_STRING(type, wapi_completion_operation_continue_certificate_authentication)
       
    53 	else
       
    54 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
    55 	{
       
    56 		EAP_UNREFERENCED_PARAMETER(type);
       
    57 		return EAPL("Unknown WAPI completion operation");
       
    58 	}
       
    59 }
       
    60 
       
    61 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wai_protocol_version_string(const wai_protocol_version_e type)
       
    62 {
       
    63 #if defined(USE_EAP_TRACE_STRINGS)
       
    64 	EAP_IF_RETURN_STRING(type, wai_protocol_version_none)
       
    65 	else EAP_IF_RETURN_STRING(type, wai_protocol_version_1)
       
    66 	else
       
    67 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
    68 	{
       
    69 		EAP_UNREFERENCED_PARAMETER(type);
       
    70 		return EAPL("Unknown WAI protocol version");
       
    71 	}
       
    72 }
       
    73 
       
    74 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wai_protocol_type_string(const wai_protocol_type_e type)
       
    75 {
       
    76 #if defined(USE_EAP_TRACE_STRINGS)
       
    77 	EAP_IF_RETURN_STRING(type, wai_protocol_type_none)
       
    78 	else EAP_IF_RETURN_STRING(type, wai_protocol_type_wai)
       
    79 	else
       
    80 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
    81 	{
       
    82 		EAP_UNREFERENCED_PARAMETER(type);
       
    83 		return EAPL("Unknown WAI protocol type");
       
    84 	}
       
    85 }
       
    86 
       
    87 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wai_protocol_subtype_string(const wai_protocol_subtype_e type)
       
    88 {
       
    89 #if defined(USE_EAP_TRACE_STRINGS)
       
    90 	EAP_IF_RETURN_STRING(type, wai_protocol_subtype_none)
       
    91 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_pre_authentication_start)
       
    92 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_stakey_request)
       
    93 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_authentication_activation)
       
    94 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_access_authentication_request)
       
    95 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_access_authentication_response)
       
    96 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_certificate_authentication_request)
       
    97 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_certificate_authentication_response)
       
    98 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_unicast_key_negotiation_request)
       
    99 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_unicast_key_negotiation_response)
       
   100 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_unicast_key_negotiation_confirmation)
       
   101 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_multicast_key_announcement)
       
   102 	else EAP_IF_RETURN_STRING(type, wai_protocol_subtype_multicast_key_announcement_response)
       
   103 	else
       
   104 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
   105 	{
       
   106 		EAP_UNREFERENCED_PARAMETER(type);
       
   107 		return EAPL("Unknown WAI protocol subtype");
       
   108 	}
       
   109 }
       
   110 
       
   111 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wai_tlv_header_string(const wai_tlv_type_e type)
       
   112 {
       
   113 #if defined(USE_EAP_TRACE_STRINGS)
       
   114 	EAP_IF_RETURN_STRING(type, wai_tlv_type_none)
       
   115 	else EAP_IF_RETURN_STRING(type, wai_tlv_type_signature_attribute)
       
   116 	else EAP_IF_RETURN_STRING(type, wai_tlv_type_echd_parameter)
       
   117 	else EAP_IF_RETURN_STRING(type, wai_tlv_type_result_of_certificate_validation)
       
   118 	else EAP_IF_RETURN_STRING(type, wai_tlv_type_identity_list)
       
   119 	else
       
   120 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
   121 	{
       
   122 		EAP_UNREFERENCED_PARAMETER(type);
       
   123 		return EAPL("Unknown WAI TLV header type");
       
   124 	}
       
   125 }
       
   126 
       
   127 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wai_payload_type_string(const wai_payload_type_e type)
       
   128 {
       
   129 #if defined(USE_EAP_TRACE_STRINGS)
       
   130 	EAP_IF_RETURN_STRING(type, wai_payload_type_none)
       
   131 	else EAP_IF_RETURN_STRING(type, wai_payload_type_flag)
       
   132 	else EAP_IF_RETURN_STRING(type, wai_payload_type_access_result)
       
   133 	else EAP_IF_RETURN_STRING(type, wai_payload_type_uskid)
       
   134 	else EAP_IF_RETURN_STRING(type, wai_payload_type_mskid_stakeyid)
       
   135 	else EAP_IF_RETURN_STRING(type, wai_payload_type_result)
       
   136 	else EAP_IF_RETURN_STRING(type, wai_payload_type_addid)
       
   137 	else EAP_IF_RETURN_STRING(type, wai_payload_type_bkid)
       
   138 	else EAP_IF_RETURN_STRING(type, wai_payload_type_key_announcement_identifier)
       
   139 	else EAP_IF_RETURN_STRING(type, wai_payload_type_data_sequence_number)
       
   140 	else EAP_IF_RETURN_STRING(type, wai_payload_type_message_authentication_code)
       
   141 	else EAP_IF_RETURN_STRING(type, wai_payload_type_authentication_identifier)
       
   142 	else EAP_IF_RETURN_STRING(type, wai_payload_type_nonce)
       
   143 	else EAP_IF_RETURN_STRING(type, wai_payload_type_key_data)
       
   144 	else EAP_IF_RETURN_STRING(type, wai_payload_type_wie)
       
   145 	else EAP_IF_RETURN_STRING(type, wai_payload_type_echd_parameter)
       
   146 	else EAP_IF_RETURN_STRING(type, wai_payload_type_signature_attributes)
       
   147 	else EAP_IF_RETURN_STRING(type, wai_payload_type_result_of_certificate_verification)
       
   148 	else EAP_IF_RETURN_STRING(type, wai_payload_type_identity_list)
       
   149 	else EAP_IF_RETURN_STRING(type, wai_payload_type_optional)
       
   150 	else EAP_IF_RETURN_STRING(type, wai_payload_type_certificate)
       
   151 	else EAP_IF_RETURN_STRING(type, wai_payload_type_identity)
       
   152 	else EAP_IF_RETURN_STRING(type, wai_payload_type_first_known)
       
   153 	else EAP_IF_RETURN_STRING(type, wai_payload_type_last_known)
       
   154 	else
       
   155 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
   156 	{
       
   157 		EAP_UNREFERENCED_PARAMETER(type);
       
   158 		return EAPL("Unknown WAI payload type");
       
   159 	}
       
   160 }
       
   161 
       
   162 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wapi_core_state_string(const wapi_core_state_e state)
       
   163 {
       
   164 #if defined(USE_EAP_TRACE_STRINGS)
       
   165 	EAP_IF_RETURN_STRING(state, wapi_core_state_none)
       
   166 	else EAP_IF_RETURN_STRING(state, wapi_core_state_start_unicast_key_negotiation)
       
   167 	else EAP_IF_RETURN_STRING(state, wapi_core_state_start_certificate_negotiation)
       
   168 	else EAP_IF_RETURN_STRING(state, wapi_core_state_start_multicast_key_announcement)
       
   169 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_authentication_activation_message)
       
   170 	else EAP_IF_RETURN_STRING(state, wapi_core_state_process_authentication_activation_message)
       
   171 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_access_authentication_request_message)
       
   172 	else EAP_IF_RETURN_STRING(state, wapi_core_state_process_access_authentication_request_message)
       
   173 	else EAP_IF_RETURN_STRING(state, wapi_core_state_process_access_authentication_request_message_ASU_signature_trusted_by_AE)
       
   174 	else EAP_IF_RETURN_STRING(state, wapi_core_state_process_access_authentication_request_message_AE_signature_trusted_by_ASUE)
       
   175 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_certificate_authentication_request_message)
       
   176 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_certificate_authentication_response_message)
       
   177 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_access_authentication_response_message)
       
   178 	else EAP_IF_RETURN_STRING(state, wapi_core_state_process_access_authentication_response_message)
       
   179 	else EAP_IF_RETURN_STRING(state, wapi_core_state_process_access_authentication_response_message_ASU_signature)
       
   180 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_unicast_key_negotiation_request_message)
       
   181 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_unicast_key_negotiation_response_message)
       
   182 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_unicast_key_negotiation_confirmation_message)
       
   183 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_multicast_announcement_message)
       
   184 	else EAP_IF_RETURN_STRING(state, wapi_core_state_wait_multicast_announcement_response_message)
       
   185 	else EAP_IF_RETURN_STRING(state, wapi_core_state_authentication_ok)
       
   186 	else EAP_IF_RETURN_STRING(state, wapi_core_state_authentication_failed)
       
   187 	else
       
   188 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
   189 	{
       
   190 		EAP_UNREFERENCED_PARAMETER(state);
       
   191 		return EAPL("Unknown WAPI core state");
       
   192 	}
       
   193 };
       
   194 
       
   195 
       
   196 EAP_FUNC_EXPORT eap_const_string wapi_strings_c::get_wapi_negotiation_state_string(const wapi_negotiation_state_e state)
       
   197 {
       
   198 #if defined(USE_EAP_TRACE_STRINGS)
       
   199 	EAP_IF_RETURN_STRING(state, wapi_negotiation_state_none)
       
   200 	else EAP_IF_RETURN_STRING(state, wapi_negotiation_state_initial_negotiation)
       
   201 	else EAP_IF_RETURN_STRING(state, wapi_negotiation_state_rekeying)
       
   202 	else
       
   203 #endif // #if defined(USE_EAP_TRACE_STRINGS)
       
   204 	{
       
   205 		EAP_UNREFERENCED_PARAMETER(state);
       
   206 		return EAPL("Unknown WAPI negotiation state");
       
   207 	}
       
   208 };
       
   209 
       
   210 //----------------------------------------------------------------------------------
       
   211 
       
   212 #endif //#if defined(USE_WAPI_CORE)
       
   213 
       
   214 // End.