changeset 52 | c23bdf5a328a |
parent 39 | fe6b6762fccd |
51:e863583e6720 | 52:c23bdf5a328a |
---|---|
14 * Description: CEapVpnInterfaceImplementation |
14 * Description: CEapVpnInterfaceImplementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 61 % |
19 * %version: 67 % |
20 */ |
20 */ |
21 |
21 |
22 // INCLUDE FILES |
22 // INCLUDE FILES |
23 #include <w32std.h> |
23 #include <w32std.h> |
24 #include <pathinfo.h> |
24 #include <pathinfo.h> |
25 |
25 |
26 #include <EapType.h> |
26 #include <EapType.h> |
27 #include <EapTypePlugin.h> |
27 #include <EapTypePlugin.h> |
28 #include <EapGeneralSettings.h> |
|
28 |
29 |
29 #include "eap_vpn_if_implementation.h" |
30 #include "eap_vpn_if_implementation.h" |
30 #include "eap_am_memory.h" |
31 #include "eap_am_memory.h" |
31 #include "eap_tools.h" |
32 #include "eap_tools.h" |
32 #include "eap_type_all.h" |
33 #include "eap_type_all.h" |
46 #include "EapConversion.h" |
47 #include "EapConversion.h" |
47 #include "eap_session_core_base.h" |
48 #include "eap_session_core_base.h" |
48 #include "eap_automatic_variable.h" |
49 #include "eap_automatic_variable.h" |
49 #include "eap_core_client_message_if.h" |
50 #include "eap_core_client_message_if.h" |
50 #include "eap_process_tlv_message_data.h" |
51 #include "eap_process_tlv_message_data.h" |
52 #include "eapol_wlan_database_reference.h" |
|
51 |
53 |
52 // LOCAL CONSTANTS |
54 // LOCAL CONSTANTS |
53 const TUint KMaxConfigStringLength = 256; |
55 const TUint KMaxConfigStringLength = 256; |
54 const u32_t KMTU = 1500u; |
56 const u32_t KMTU = 1500u; |
55 const u32_t KTrailerLength = 0; |
57 const u32_t KTrailerLength = 0; |
56 const u32_t KHeaderOffset = 0; |
58 const u32_t KHeaderOffset = 0; |
57 |
59 |
58 #define KEapIdentityOffset 5 |
60 #define KEapIdentityOffset 5 |
61 |
|
62 #ifdef USE_EAP_VPN_FILETRACE |
|
59 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt"); |
63 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt"); |
64 #endif |
|
60 |
65 |
61 enum eapol_am_core_timer_id_e |
66 enum eapol_am_core_timer_id_e |
62 { |
67 { |
63 EAPOL_AM_CORE_TIMER_RESTART_AUTHENTICATION_ID, |
68 EAPOL_AM_CORE_TIMER_RESTART_AUTHENTICATION_ID, |
64 EAPOL_AM_CORE_TIMER_DELETE_STACK_ID, |
69 EAPOL_AM_CORE_TIMER_DELETE_STACK_ID, |
138 { |
143 { |
139 User::Leave(KErrGeneral); |
144 User::Leave(KErrGeneral); |
140 } |
145 } |
141 |
146 |
142 |
147 |
148 #ifdef USE_EAP_VPN_FILETRACE |
|
143 { |
149 { |
144 TFileName drivePath( PathInfo::MemoryCardRootPath() ); |
150 TFileName drivePath( PathInfo::MemoryCardRootPath() ); |
145 |
151 |
146 const TInt MAXPATHNAME=256ul; |
152 const TInt MAXPATHNAME=256ul; |
147 |
153 |
213 } |
219 } |
214 } |
220 } |
215 |
221 |
216 CleanupStack::PopAndDestroy(buf); // Delete pathbuffer. |
222 CleanupStack::PopAndDestroy(buf); // Delete pathbuffer. |
217 } |
223 } |
218 |
224 #endif |
225 |
|
219 m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools); |
226 m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools); |
220 if (m_eap_type_array == 0) |
227 if (m_eap_type_array == 0) |
221 { |
228 { |
222 User::Leave(KErrGeneral); |
229 User::Leave(KErrGeneral); |
223 } |
230 } |
316 EAP_TRACE_DEBUG( |
323 EAP_TRACE_DEBUG( |
317 m_am_tools, |
324 m_am_tools, |
318 TRACE_FLAGS_DEFAULT, |
325 TRACE_FLAGS_DEFAULT, |
319 (EAPL("CEapVpnInterfaceImplementation::~CEapVpnInterfaceImplementation() - destructor\n"))); |
326 (EAPL("CEapVpnInterfaceImplementation::~CEapVpnInterfaceImplementation() - destructor\n"))); |
320 |
327 |
328 #ifdef USE_EAP_VPN_FILETRACE |
|
321 delete m_trace_log_file_name; |
329 delete m_trace_log_file_name; |
322 m_trace_log_file_name = 0; |
330 m_trace_log_file_name = 0; |
323 |
331 #endif |
324 shutdown(); |
332 shutdown(); |
325 } |
333 } |
326 |
334 |
327 |
335 |
328 |
336 |
426 delete m_am_tools; |
434 delete m_am_tools; |
427 } |
435 } |
428 |
436 |
429 return eap_status_ok; |
437 return eap_status_ok; |
430 } |
438 } |
431 |
|
432 |
|
433 |
439 |
434 //-------------------------------------------------- |
440 //-------------------------------------------------- |
435 |
441 |
436 // |
442 // |
437 void CEapVpnInterfaceImplementation::RunL() |
443 void CEapVpnInterfaceImplementation::RunL() |
525 |
531 |
526 // All of the configuration options are optional. |
532 // All of the configuration options are optional. |
527 // So we return OK. |
533 // So we return OK. |
528 return eap_status_ok; |
534 return eap_status_ok; |
529 } |
535 } |
530 |
|
531 |
536 |
532 //---------------------------------------------------------- |
537 //---------------------------------------------------------- |
533 // Implementations of virtual functions from CEapVpnInterface |
538 // Implementations of virtual functions from CEapVpnInterface |
534 //---------------------------------------------------------- |
539 //---------------------------------------------------------- |
535 |
540 |
622 TRACE_FLAGS_DEFAULT, |
627 TRACE_FLAGS_DEFAULT, |
623 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): iRealmPrefix\n"), |
628 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): iRealmPrefix\n"), |
624 iRealmPrefix->Ptr(), |
629 iRealmPrefix->Ptr(), |
625 iRealmPrefix->Size())); |
630 iRealmPrefix->Size())); |
626 |
631 |
632 //-------------------------------------------------------- |
|
633 //-------------------------------------------------------- |
|
634 // Set the values for realm and user name if there is any. |
|
635 // If there is no values the default settings will be used( automatic realm and username). |
|
636 |
|
637 |
|
638 { |
|
639 EAP_TRACE_DEBUG( |
|
640 m_am_tools, |
|
641 TRACE_FLAGS_DEFAULT, |
|
642 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): About to configure manual/auto username and manual/auto realm, m_index_type=%d, m_index=%d\n"), |
|
643 m_index_type, |
|
644 m_index)); |
|
645 |
|
646 CEapType* eapType = 0; |
|
647 |
|
648 // Check if this EAP type has already been loaded |
|
649 i32_t eapArrayIndex = find<eap_type_value_e>( |
|
650 m_eap_type_array, |
|
651 &iRequestedEapType, |
|
652 m_am_tools); |
|
653 |
|
654 if (eapArrayIndex >= 0) |
|
655 { |
|
656 // Yep. It was loaded already. |
|
657 EAP_TRACE_DEBUG( |
|
658 m_am_tools, |
|
659 TRACE_FLAGS_DEFAULT, |
|
660 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): EAP Type Already loaded\n"))); |
|
661 |
|
662 eapType = m_eap_if_array[eapArrayIndex]; |
|
663 } |
|
664 else |
|
665 { |
|
666 // We must have a trap here since the EAP core knows nothing about Symbian. |
|
667 EAP_TRACE_DEBUG( |
|
668 m_am_tools, |
|
669 TRACE_FLAGS_DEFAULT, |
|
670 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): EAP Type new\n"))); |
|
671 |
|
672 TEapExpandedType aEapType; |
|
673 |
|
674 TInt error = CEapConversion::ConvertInternalTypeToExpandedEAPType( |
|
675 &iRequestedEapType, |
|
676 &aEapType); |
|
677 if (error != KErrNone) |
|
678 { |
|
679 EAP_TRACE_DEBUG_SYMBIAN( |
|
680 (_L("ERROR: CEapVpnInterfaceImplementation::EapConfigure(): Error from CEapConversion::ConvertExpandedEAPTypeToInternalType()=%d\n"), |
|
681 error)); |
|
682 |
|
683 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
684 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
685 } |
|
686 |
|
687 TRAP(error, (eapType = CEapType::NewL(m_index_type, m_index, aEapType))); |
|
688 |
|
689 if (error != KErrNone |
|
690 || eapType == 0) |
|
691 { |
|
692 // Interface not found or implementation creation function failed |
|
693 |
|
694 delete eapType; |
|
695 |
|
696 EAP_TRACE_DEBUG( |
|
697 m_am_tools, |
|
698 TRACE_FLAGS_DEFAULT, |
|
699 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): EAP Type new, unable to load\n"))); |
|
700 EAP_TRACE_ALWAYS( |
|
701 m_am_tools, |
|
702 TRACE_FLAGS_DEFAULT, |
|
703 (EAPL("ECom could not find/initiate implementation.\n"))); |
|
704 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
705 } |
|
706 |
|
707 // Add EAP-interface information to the member arrays. |
|
708 if (m_eap_if_array.Append(eapType) != KErrNone) |
|
709 { |
|
710 delete eapType; |
|
711 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
712 } |
|
713 } |
|
714 |
|
715 EAPSettings* setSettings = new EAPSettings; |
|
716 if( setSettings == NULL ) |
|
717 { |
|
718 EAP_TRACE_DEBUG( |
|
719 m_am_tools, |
|
720 TRACE_FLAGS_DEFAULT, |
|
721 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): EAPSettings allocation error \n"))); |
|
722 |
|
723 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
724 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
725 } |
|
726 |
|
727 if(iRequestedEapType == eap_type_aka) |
|
728 { |
|
729 setSettings->iEAPExpandedType = *EapExpandedTypeAka.GetType(); |
|
730 |
|
731 } |
|
732 else if(iRequestedEapType == eap_type_gsmsim) |
|
733 { |
|
734 setSettings->iEAPExpandedType = *EapExpandedTypeSim.GetType(); |
|
735 } |
|
736 else |
|
737 { |
|
738 delete setSettings; |
|
739 |
|
740 // Only EAP-SIM and AKA are possible now. |
|
741 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
742 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type); |
|
743 } |
|
744 |
|
745 if(iManualUsername && iManualUsername->Length() != 0) |
|
746 { |
|
747 setSettings->iUsernamePresent = ETrue; // Same value for both SIM and AKA. |
|
748 setSettings->iUsername.Copy(iManualUsername->Des()); |
|
749 } |
|
750 else |
|
751 { |
|
752 // No user name. we have to set automatic now. |
|
753 setSettings->iUsernamePresent = EFalse; // Same value for both SIM and AKA. |
|
754 setSettings->iUseAutomaticUsernamePresent = ETrue; // Same value for both SIM and AKA. |
|
755 setSettings->iUseAutomaticUsername = ETrue; // Same value for both SIM and AKA. |
|
756 } |
|
757 |
|
758 if(iManualRealm && iManualRealm->Length() != 0) |
|
759 { |
|
760 setSettings->iRealmPresent = ETrue; // Same value for both SIM and AKA. |
|
761 setSettings->iRealm.Copy(iManualRealm->Des()); |
|
762 } |
|
763 else |
|
764 { |
|
765 // No realm. we have to set automatic now. |
|
766 setSettings->iRealmPresent = EFalse; // Same value for both SIM and AKA. |
|
767 setSettings->iUseAutomaticRealmPresent = ETrue; // Same value for both SIM and AKA. |
|
768 setSettings->iUseAutomaticRealm = ETrue; // Same value for both SIM and AKA. |
|
769 } |
|
770 |
|
771 TRAP(error, eapType->SetConfigurationL(*setSettings) ); |
|
772 |
|
773 delete setSettings; |
|
774 setSettings = 0; |
|
775 |
|
776 if ( error != KErrNone ) |
|
777 { |
|
778 EAP_TRACE_DEBUG( |
|
779 m_am_tools, |
|
780 TRACE_FLAGS_DEFAULT, |
|
781 (EAPL("ERROR: CEapVpnInterfaceImplementation::EapConfigure(): Setting Manual Username and Realm failed. SetConfigurationL() error=%d\n"))); |
|
782 return error; |
|
783 } |
|
784 } |
|
785 |
|
786 { |
|
787 CEapGeneralSettings* genSet = NULL; |
|
788 |
|
789 TRAPD(error, genSet = CEapGeneralSettings::NewL(m_index_type, m_index)); |
|
790 |
|
791 if (error != KErrNone) |
|
792 { |
|
793 delete genSet; |
|
794 |
|
795 EAP_TRACE_DEBUG( |
|
796 m_am_tools, |
|
797 TRACE_FLAGS_DEFAULT, |
|
798 (EAPL("ERROR: CEapVpnInterfaceImplementation::EapConfigure(): CEapGeneralSettings::NewL() error=%d\n"))); |
|
799 return error; |
|
800 } |
|
801 |
|
802 TEapExpandedType tmpEap; |
|
803 RArray<TEapExpandedType> OuterEapsOn; |
|
804 RArray<TEapExpandedType> OuterEapsOff; |
|
805 |
|
806 tmpEap.SetValue( |
|
807 iRequestedEapType.get_vendor_id(), |
|
808 iRequestedEapType.get_vendor_type()); |
|
809 |
|
810 error = OuterEapsOn.Append(tmpEap); |
|
811 if(error != KErrNone) |
|
812 { |
|
813 OuterEapsOn.Close(); |
|
814 OuterEapsOff.Close(); |
|
815 delete genSet; |
|
816 |
|
817 EAP_TRACE_DEBUG( |
|
818 m_am_tools, |
|
819 TRACE_FLAGS_DEFAULT, |
|
820 (EAPL("ERROR: CEapVpnInterfaceImplementation::EapConfigure(): OuterEapsOn.Append() error=%d\n"))); |
|
821 return error; |
|
822 } |
|
823 |
|
824 error = genSet->SetEapMethods(OuterEapsOn, OuterEapsOff); |
|
825 |
|
826 OuterEapsOn.Close(); |
|
827 OuterEapsOff.Close(); |
|
828 delete genSet; |
|
829 |
|
830 if (error != KErrNone) |
|
831 { |
|
832 EAP_TRACE_DEBUG( |
|
833 m_am_tools, |
|
834 TRACE_FLAGS_DEFAULT, |
|
835 (EAPL("ERROR: CEapVpnInterfaceImplementation::EapConfigure(): SetEapMethods() error=%d\n"))); |
|
836 return error; |
|
837 } |
|
838 |
|
839 } |
|
840 |
|
841 { |
|
842 eap_status_e status(eap_status_ok); |
|
843 |
|
844 eap_variable_data_c reference(m_am_tools); |
|
845 |
|
846 { |
|
847 eapol_wlan_database_reference_values_s values = {m_index_type, m_index}; |
|
848 |
|
849 status = reference.set_copy_of_buffer(&values, sizeof(values)); |
|
850 if (status != eap_status_ok) |
|
851 { |
|
852 return m_am_tools->convert_eapol_error_to_am_error( |
|
853 EAP_STATUS_RETURN(m_am_tools, status)); |
|
854 } |
|
855 } |
|
856 |
|
857 status = iEapCore->set_eap_database_reference_values(&reference); |
|
858 if (status != eap_status_ok) |
|
859 { |
|
860 return m_am_tools->convert_eapol_error_to_am_error( |
|
861 EAP_STATUS_RETURN(m_am_tools, status)); |
|
862 } |
|
863 |
|
864 eap_variable_data_c SSID(m_am_tools); |
|
865 |
|
866 if (SSID.get_is_valid() == false) |
|
867 { |
|
868 EAP_TRACE_ERROR( |
|
869 m_am_tools, |
|
870 TRACE_FLAGS_DEFAULT, |
|
871 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): SSID failed.\n"))); |
|
872 return m_am_tools->convert_eapol_error_to_am_error( |
|
873 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error)); |
|
874 } |
|
875 |
|
876 const u8_t dummy[] = "dummy"; |
|
877 status = SSID.set_copy_of_buffer(dummy, sizeof(dummy)); |
|
878 if (status != eap_status_ok) |
|
879 { |
|
880 return m_am_tools->convert_eapol_error_to_am_error( |
|
881 EAP_STATUS_RETURN(m_am_tools, status)); |
|
882 } |
|
883 |
|
884 eap_variable_data_c preshared_key(m_am_tools); |
|
885 if (preshared_key.get_is_valid() == false) |
|
886 { |
|
887 EAP_TRACE_ERROR( |
|
888 m_am_tools, |
|
889 TRACE_FLAGS_DEFAULT, |
|
890 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): preshared_key failed.\n"))); |
|
891 return m_am_tools->convert_eapol_error_to_am_error( |
|
892 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error)); |
|
893 } |
|
894 |
|
895 // This is asynchronous function call that is completed by complete_get_802_11_authentication_mode() function call. |
|
896 status = iEapCore->get_802_11_authentication_mode( |
|
897 m_receive_network_id, |
|
898 eapol_key_authentication_type_RSNA_EAP, |
|
899 &SSID, |
|
900 &preshared_key); |
|
901 if (status != eap_status_ok) |
|
902 { |
|
903 return m_am_tools->convert_eapol_error_to_am_error( |
|
904 EAP_STATUS_RETURN(m_am_tools, status)); |
|
905 } |
|
906 |
|
907 status = wait_complete_get_802_11_authentication_mode(); |
|
908 if (status != eap_status_ok) |
|
909 { |
|
910 return m_am_tools->convert_eapol_error_to_am_error( |
|
911 EAP_STATUS_RETURN(m_am_tools, status)); |
|
912 } |
|
913 |
|
914 // Creates a EAP-session. |
|
915 status = iEapCore->create_eap_session(m_receive_network_id); |
|
916 if (status != eap_status_ok) |
|
917 { |
|
918 return m_am_tools->convert_eapol_error_to_am_error( |
|
919 EAP_STATUS_RETURN(m_am_tools, status)); |
|
920 } |
|
921 } |
|
922 |
|
627 return KErrNone; |
923 return KErrNone; |
628 } |
924 } |
629 |
925 |
630 |
926 //-------------------------------------------------- |
927 |
|
631 /** |
928 /** |
632 * Function: StartL |
929 * Function: StartL |
633 * |
930 * |
634 * Description: Initializes the eap plugin |
931 * Description: Initializes the eap plugin |
635 * |
932 * |
810 |
1107 |
811 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1108 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
812 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
1109 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
813 } |
1110 } |
814 |
1111 |
1112 //-------------------------------------------------- |
|
1113 |
|
815 /** |
1114 /** |
816 * Function: QueryIdentity |
1115 * Function: QueryIdentity |
817 * |
1116 * |
818 * Description: Ask the identity |
1117 * Description: Ask the identity |
819 * |
1118 * |
925 eap_request.set_code(eap_code_request); |
1224 eap_request.set_code(eap_code_request); |
926 eap_request.set_identifier(0); |
1225 eap_request.set_identifier(0); |
927 eap_request.set_type_data_length(0u, false); |
1226 eap_request.set_type_data_length(0u, false); |
928 eap_request.set_type(eap_type_identity, false); |
1227 eap_request.set_type(eap_type_identity, false); |
929 |
1228 |
1229 EAP_TRACE_DEBUG( |
|
1230 m_am_tools, |
|
1231 TRACE_FLAGS_DEFAULT, |
|
1232 (EAPL("CEapVpnInterfaceImplementation::send_eap_identity_request(): %s, code=0x%02x=%s, identifier=0x%02x, length=0x%04x, type=0x%08x=%s, packet length 0x%04x\n"), |
|
1233 (m_is_client == true) ? "client": "server", |
|
1234 eap_request.get_code(), |
|
1235 eap_request.get_code_string(), |
|
1236 eap_request.get_identifier(), |
|
1237 eap_request.get_length(), |
|
1238 convert_eap_type_to_u32_t(eap_request.get_type()), |
|
1239 eap_request.get_type_string(), |
|
1240 eap_request.get_length())); |
|
1241 |
|
930 EAP_ASSERT(eap_request.get_length() >= 4); |
1242 EAP_ASSERT(eap_request.get_length() >= 4); |
931 |
1243 |
932 status = iEapCore->packet_process( |
1244 status = iEapCore->packet_process( |
933 m_receive_network_id, |
1245 m_receive_network_id, |
934 &eap_request, |
1246 &eap_request, |
941 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1253 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
942 |
1254 |
943 return EAP_STATUS_RETURN(m_am_tools, status); |
1255 return EAP_STATUS_RETURN(m_am_tools, status); |
944 } |
1256 } |
945 |
1257 |
1258 //-------------------------------------------------- |
|
946 |
1259 |
947 /** |
1260 /** |
948 * Function: EapInbound |
1261 * Function: EapInbound |
949 * |
1262 * |
950 * Description: Handle incoming eap message. |
1263 * Description: Handle incoming eap message. |
984 eap_header_wr_c eap_request( |
1297 eap_header_wr_c eap_request( |
985 m_am_tools, |
1298 m_am_tools, |
986 request_packet.get_data_offset(0, aMessage.Length()), |
1299 request_packet.get_data_offset(0, aMessage.Length()), |
987 aMessage.Length()); |
1300 aMessage.Length()); |
988 |
1301 |
1302 EAP_TRACE_DEBUG( |
|
1303 m_am_tools, |
|
1304 TRACE_FLAGS_DEFAULT, |
|
1305 (EAPL("CEapVpnInterfaceImplementation::EapInbound(): %s, code=0x%02x=%s, identifier=0x%02x, length=0x%04x, type=0x%08x=%s, packet length 0x%04x\n"), |
|
1306 (m_is_client == true) ? "client": "server", |
|
1307 eap_request.get_code(), |
|
1308 eap_request.get_code_string(), |
|
1309 eap_request.get_identifier(), |
|
1310 eap_request.get_length(), |
|
1311 convert_eap_type_to_u32_t(eap_request.get_type()), |
|
1312 eap_request.get_type_string(), |
|
1313 eap_request.get_length())); |
|
1314 |
|
1315 EAP_TRACE_DATA_DEBUG( |
|
1316 m_am_tools, |
|
1317 TRACE_FLAGS_DEFAULT, |
|
1318 (EAPL("CEapVpnInterfaceImplementation::EapInbound(): EAP-packet"), |
|
1319 aMessage.Ptr(), |
|
1320 aMessage.Length())); |
|
1321 |
|
989 // Forward the packet to the Eap layer of the EAPOL stack. Ignore return value. Failure is signalled using state_notification. |
1322 // Forward the packet to the Eap layer of the EAPOL stack. Ignore return value. Failure is signalled using state_notification. |
990 status = iEapCore->packet_process( |
1323 status = iEapCore->packet_process( |
991 m_receive_network_id, |
1324 m_receive_network_id, |
992 &eap_request, |
1325 &eap_request, |
993 length); |
1326 length); |
1059 |
1392 |
1060 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1393 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1061 return status; |
1394 return status; |
1062 } |
1395 } |
1063 |
1396 |
1397 //-------------------------------------------------- |
|
1064 |
1398 |
1065 // Virtual callback function implementations, called by the eap_core |
1399 // Virtual callback function implementations, called by the eap_core |
1066 |
1400 |
1067 /** |
1401 /** |
1068 * The derived class could send packets to partner class with this function. |
1402 * The derived class could send packets to partner class with this function. |
1088 EAP_TRACE_ALWAYS( |
1422 EAP_TRACE_ALWAYS( |
1089 m_am_tools, |
1423 m_am_tools, |
1090 TRACE_FLAGS_DEFAULT, |
1424 TRACE_FLAGS_DEFAULT, |
1091 (EAPL("packet_send: packet buffer corrupted.\n"))); |
1425 (EAPL("packet_send: packet buffer corrupted.\n"))); |
1092 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1426 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1093 return eap_status_process_general_error; |
1427 return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error); |
1094 } |
1428 } |
1095 else if (header_offset+data_length != sent_packet->get_data_length()) |
1429 else if (header_offset+data_length != sent_packet->get_data_length()) |
1096 { |
1430 { |
1097 EAP_TRACE_ALWAYS( |
1431 EAP_TRACE_ALWAYS( |
1098 m_am_tools, |
1432 m_am_tools, |
1099 TRACE_FLAGS_DEFAULT, |
1433 TRACE_FLAGS_DEFAULT, |
1100 (EAPL("ERROR: packet_send: packet buffer corrupted (data_length != sent_packet->get_data_length()).\n"))); |
1434 (EAPL("ERROR: packet_send: packet buffer corrupted (data_length != sent_packet->get_data_length()).\n"))); |
1101 EAP_ASSERT(data_length == sent_packet->get_buffer_length()); |
1435 EAP_ASSERT(data_length == sent_packet->get_buffer_length()); |
1102 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1436 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1103 return eap_status_process_general_error; |
1437 return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error); |
1104 } |
1438 } |
1105 |
1439 |
1106 if (m_block_packet_sends_and_notifications == true) |
1440 if (m_block_packet_sends_and_notifications == true) |
1107 { |
1441 { |
1108 // Packet sending block is active. This happens when disassociated has been called. |
1442 // Packet sending block is active. This happens when disassociated has been called. |
1119 m_am_tools, |
1453 m_am_tools, |
1120 sent_packet->get_data_offset( |
1454 sent_packet->get_data_offset( |
1121 header_offset, data_length), |
1455 header_offset, data_length), |
1122 data_length); |
1456 data_length); |
1123 |
1457 |
1458 EAP_TRACE_DEBUG( |
|
1459 m_am_tools, |
|
1460 TRACE_FLAGS_DEFAULT, |
|
1461 (EAPL("CEapVpnInterfaceImplementation::packet_send(): %s, code=0x%02x=%s, identifier=0x%02x, length=0x%04x, type=0x%08x=%s, packet length 0x%04x\n"), |
|
1462 (m_is_client == true) ? "client": "server", |
|
1463 eap.get_code(), |
|
1464 eap.get_code_string(), |
|
1465 eap.get_identifier(), |
|
1466 eap.get_length(), |
|
1467 convert_eap_type_to_u32_t(eap.get_type()), |
|
1468 eap.get_type_string(), |
|
1469 eap.get_length())); |
|
1470 |
|
1124 TInt status(KErrNone); |
1471 TInt status(KErrNone); |
1125 if (status == KErrNone) |
1472 if (status == KErrNone) |
1126 { |
1473 { |
1127 u8_t * const packet_data = sent_packet->get_data_offset(header_offset, data_length); |
1474 u8_t * const packet_data = sent_packet->get_data_offset(header_offset, data_length); |
1128 if (packet_data == 0) |
1475 if (packet_data == 0) |
1129 { |
1476 { |
1130 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1477 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1131 return eap_status_buffer_too_short; |
1478 return eap_status_buffer_too_short; |
1132 } |
1479 } |
1480 |
|
1481 EAP_TRACE_DATA_DEBUG( |
|
1482 m_am_tools, |
|
1483 TRACE_FLAGS_DEFAULT, |
|
1484 (EAPL("CEapVpnInterfaceImplementation::packet_send(): EAP-packet"), |
|
1485 packet_data, |
|
1486 data_length)); |
|
1133 |
1487 |
1134 // Here we send the original packet. |
1488 // Here we send the original packet. |
1135 HBufC8* eapData = NULL; |
1489 HBufC8* eapData = NULL; |
1136 TInt error = KErrNone; |
1490 TInt error = KErrNone; |
1137 |
1491 |
1191 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1545 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1192 |
1546 |
1193 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status)); |
1547 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status)); |
1194 } |
1548 } |
1195 |
1549 |
1550 //-------------------------------------------------- |
|
1196 |
1551 |
1197 /** |
1552 /** |
1198 * The get_header_offset() function obtains the header offset of EAP-packet. |
1553 * The get_header_offset() function obtains the header offset of EAP-packet. |
1199 * @see abs_eap_base_type_c::get_header_offset(). |
1554 * @see abs_eap_base_type_c::get_header_offset(). |
1200 */ |
1555 */ |
1209 |
1564 |
1210 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1565 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1211 |
1566 |
1212 return KHeaderOffset; |
1567 return KHeaderOffset; |
1213 } |
1568 } |
1569 |
|
1570 //-------------------------------------------------- |
|
1214 |
1571 |
1215 /** |
1572 /** |
1216 * The load_module() function function indicates the lower level to |
1573 * The load_module() function function indicates the lower level to |
1217 * load new module of EAP-type. |
1574 * load new module of EAP-type. |
1218 * @param type is the requested EAP-type. |
1575 * @param type is the requested EAP-type. |
1340 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1697 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1341 return EAP_STATUS_RETURN(m_am_tools, status); |
1698 return EAP_STATUS_RETURN(m_am_tools, status); |
1342 } |
1699 } |
1343 } |
1700 } |
1344 |
1701 |
1702 #if 0 |
|
1703 |
|
1345 //-------------------------------------------------------- |
1704 //-------------------------------------------------------- |
1346 //-------------------------------------------------------- |
1705 //-------------------------------------------------------- |
1347 // Set the values for realm and user name if there is any. |
1706 // Set the values for realm and user name if there is any. |
1348 // If there is no values the default settings will be used( automatic realm and username). |
1707 // If there is no values the default settings will be used( automatic realm and username). |
1349 |
|
1350 |
1708 |
1351 { |
1709 { |
1352 EAP_TRACE_DEBUG( |
1710 EAP_TRACE_DEBUG( |
1353 m_am_tools, |
1711 m_am_tools, |
1354 TRACE_FLAGS_DEFAULT, |
1712 TRACE_FLAGS_DEFAULT, |
1421 } |
1779 } |
1422 |
1780 |
1423 delete setSettings; |
1781 delete setSettings; |
1424 setSettings = 0; |
1782 setSettings = 0; |
1425 } |
1783 } |
1784 #endif |
|
1785 |
|
1426 } |
1786 } |
1427 |
1787 |
1428 //-------------------------------------------------------- |
1788 //-------------------------------------------------------- |
1429 //-------------------------------------------------------- |
1789 //-------------------------------------------------------- |
1430 |
1790 |
1431 // Create the EAP protocol interface implementation. |
1791 // Create the EAP protocol interface implementation. |
1432 EAP_TRACE_DEBUG( |
1792 EAP_TRACE_DEBUG( |
1433 m_am_tools, |
1793 m_am_tools, |
1434 TRACE_FLAGS_DEFAULT, |
1794 TRACE_FLAGS_DEFAULT, |
1435 (EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL()\n"))); |
1795 (EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL()\n"))); |
1436 |
1796 |
1437 |
1797 |
1438 { |
1798 { |
1439 CEapTypePlugin* eapPlugin = 0; |
1799 CEapTypePlugin* eapPlugin = 0; |
1440 |
1800 |
1441 TRAP(error, (eapPlugin = CEapTypePlugin::NewL(aEapType.GetValue(), m_index_type, m_index))); |
1801 TRAP(error, (eapPlugin = CEapTypePlugin::NewL(aEapType.GetValue(), m_index_type, m_index, m_am_tools))); |
1442 |
1802 |
1443 if (error != KErrNone |
1803 if (error != KErrNone |
1444 || eapPlugin == 0) |
1804 || eapPlugin == 0) |
1445 { |
1805 { |
1446 // Interface not found or implementation creation function failed |
1806 // Interface not found or implementation creation function failed |
1568 |
1928 |
1569 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1929 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1570 return EAP_STATUS_RETURN(m_am_tools, status); |
1930 return EAP_STATUS_RETURN(m_am_tools, status); |
1571 } |
1931 } |
1572 |
1932 |
1933 //-------------------------------------------------- |
|
1934 |
|
1573 /** |
1935 /** |
1574 * The unload_module() function unloads the module of a EAP-type. |
1936 * The unload_module() function unloads the module of a EAP-type. |
1575 * @param eap_type is the requested EAP-type. |
1937 * @param eap_type is the requested EAP-type. |
1576 */ |
1938 */ |
1577 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type) |
1939 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type) |
1606 void CEapVpnInterfaceImplementation::set_is_valid() |
1968 void CEapVpnInterfaceImplementation::set_is_valid() |
1607 { |
1969 { |
1608 m_is_valid = true; |
1970 m_is_valid = true; |
1609 } |
1971 } |
1610 |
1972 |
1973 //-------------------------------------------------- |
|
1974 |
|
1611 bool CEapVpnInterfaceImplementation::get_is_valid() |
1975 bool CEapVpnInterfaceImplementation::get_is_valid() |
1612 { |
1976 { |
1613 return m_is_valid; |
1977 return m_is_valid; |
1614 } |
1978 } |
1615 |
1979 |
1980 //-------------------------------------------------- |
|
1981 |
|
1616 void CEapVpnInterfaceImplementation::increment_authentication_counter() |
1982 void CEapVpnInterfaceImplementation::increment_authentication_counter() |
1617 { |
1983 { |
1618 ++m_authentication_counter; |
1984 ++m_authentication_counter; |
1619 } |
1985 } |
1620 |
1986 |
1987 //-------------------------------------------------- |
|
1988 |
|
1621 u32_t CEapVpnInterfaceImplementation::get_authentication_counter() |
1989 u32_t CEapVpnInterfaceImplementation::get_authentication_counter() |
1622 { |
1990 { |
1623 return m_authentication_counter; |
1991 return m_authentication_counter; |
1624 } |
1992 } |
1625 |
1993 |
1994 //-------------------------------------------------- |
|
1995 |
|
1626 bool CEapVpnInterfaceImplementation::get_is_client() |
1996 bool CEapVpnInterfaceImplementation::get_is_client() |
1627 { |
1997 { |
1628 return m_is_client; |
1998 return m_is_client; |
1629 } |
1999 } |
2000 |
|
2001 //-------------------------------------------------- |
|
1630 |
2002 |
1631 /** |
2003 /** |
1632 * Note this function is just an example. Parameters will change later. |
2004 * Note this function is just an example. Parameters will change later. |
1633 * The packet_data_crypto_keys() function gives the generated keys to lower level. |
2005 * The packet_data_crypto_keys() function gives the generated keys to lower level. |
1634 * After EAP-authentication has generated the keys it calls this function |
2006 * After EAP-authentication has generated the keys it calls this function |
1669 } |
2041 } |
1670 |
2042 |
1671 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2043 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1672 return eap_status_ok; |
2044 return eap_status_ok; |
1673 } |
2045 } |
2046 |
|
2047 //-------------------------------------------------- |
|
1674 |
2048 |
1675 /** |
2049 /** |
1676 * The packet_data_session_key() function passes one traffic encryption key to |
2050 * The packet_data_session_key() function passes one traffic encryption key to |
1677 * the lower layers. Ultimately the key can end up to the WLAN hardware. |
2051 * the lower layers. Ultimately the key can end up to the WLAN hardware. |
1678 * @param send_network_id carries the addresses (network identity) and type of the packet. |
2052 * @param send_network_id carries the addresses (network identity) and type of the packet. |
1692 |
2066 |
1693 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2067 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1694 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status)); |
2068 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status)); |
1695 } |
2069 } |
1696 |
2070 |
2071 //-------------------------------------------------- |
|
1697 |
2072 |
1698 eap_status_e CEapVpnInterfaceImplementation::add_configuration_data( |
2073 eap_status_e CEapVpnInterfaceImplementation::add_configuration_data( |
1699 eap_process_tlv_message_data_c * const message, |
2074 eap_process_tlv_message_data_c * const message, |
1700 const eap_configuration_field_c * field, |
2075 const eap_configuration_field_c * field, |
1701 const eap_configure_type_e /* type */, |
2076 const eap_configure_type_e type, |
1702 const eap_variable_data_c * const value_data |
2077 const eap_variable_data_c * const value_data |
1703 ) |
2078 ) |
1704 { |
2079 { |
1705 eap_variable_data_c selector(m_am_tools); |
2080 eap_variable_data_c selector(m_am_tools); |
1706 |
2081 |
1720 if (config.get_is_valid() == false) |
2095 if (config.get_is_valid() == false) |
1721 { |
2096 { |
1722 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
2097 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
1723 } |
2098 } |
1724 |
2099 |
1725 config.set_type(eap_configure_type_hex_data); |
2100 config.set_type(type); |
1726 |
2101 |
1727 status = config.get_data()->set_copy_of_buffer( |
2102 status = config.get_data()->set_copy_of_buffer( |
1728 value_data); |
2103 value_data); |
1729 if (status != eap_status_ok) |
2104 if (status != eap_status_ok) |
1730 { |
2105 { |
1743 |
2118 |
1744 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2119 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1745 return EAP_STATUS_RETURN(m_am_tools, status); |
2120 return EAP_STATUS_RETURN(m_am_tools, status); |
1746 } |
2121 } |
1747 |
2122 |
2123 //-------------------------------------------------- |
|
1748 |
2124 |
1749 const TUint32 K2DigitMncMccList[] |
2125 const TUint32 K2DigitMncMccList[] |
1750 = { |
2126 = { |
1751 202,204,206,208,213,214,216,218, |
2127 202,204,206,208,213,214,216,218, |
1752 219,220,222,226,228,230,231,232, |
2128 219,220,222,226,228,230,231,232, |
1768 645,646,647,648,649,650,651,652, |
2144 645,646,647,648,649,650,651,652, |
1769 653,654,655,702,704,706,710,712, |
2145 653,654,655,702,704,706,710,712, |
1770 714,716,724,730,734,744,746,901 |
2146 714,716,724,730,734,744,746,901 |
1771 }; |
2147 }; |
1772 |
2148 |
2149 //-------------------------------------------------- |
|
2150 |
|
1773 /** |
2151 /** |
1774 * The read_configure() function reads the configuration data identified |
2152 * The read_configure() function reads the configuration data identified |
1775 * by the field string of field_length bytes length. Adaptation module must direct |
2153 * by the field string of field_length bytes length. Adaptation module must direct |
1776 * the query to some persistent store. |
2154 * the query to some persistent store. |
1777 * @see abs_eap_base_type_c::read_configure(). |
2155 * @see abs_eap_base_type_c::read_configure(). |
1931 if (value_data.get_is_valid() == false) |
2309 if (value_data.get_is_valid() == false) |
1932 { |
2310 { |
1933 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
2311 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
1934 } |
2312 } |
1935 |
2313 |
1936 // Set uma realm prefix of EAP-SIM and EAP-AKA. |
2314 if (iRealmPrefix != 0) |
1937 status = value_data.set_copy_of_buffer(iRealmPrefix->Ptr(), iRealmPrefix->Length()); |
2315 { |
1938 if (status != eap_status_ok) |
2316 // Set uma realm prefix of EAP-SIM and EAP-AKA. |
1939 { |
2317 status = value_data.set_copy_of_buffer(iRealmPrefix->Ptr(), iRealmPrefix->Length()); |
1940 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2318 if (status != eap_status_ok) |
1941 return EAP_STATUS_RETURN(m_am_tools, status); |
2319 { |
2320 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2321 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2322 } |
|
1942 } |
2323 } |
1943 |
2324 |
1944 status = add_configuration_data( |
2325 status = add_configuration_data( |
1945 &message, |
2326 &message, |
1946 cf_str_EAP_GSMSIM_UMA_realm_prefix.get_field(), |
2327 cf_str_EAP_GSMSIM_UMA_realm_prefix.get_field(), |
2147 eap_variable_data_c value_data(m_am_tools); |
2528 eap_variable_data_c value_data(m_am_tools); |
2148 if (value_data.get_is_valid() == false) |
2529 if (value_data.get_is_valid() == false) |
2149 { |
2530 { |
2150 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
2531 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
2151 } |
2532 } |
2533 #ifdef USE_EAP_VPN_FILETRACE |
|
2152 |
2534 |
2153 status = value_data.set_copy_of_buffer(m_trace_log_file_name); |
2535 status = value_data.set_copy_of_buffer(m_trace_log_file_name); |
2154 if (status != eap_status_ok) |
2536 if (status != eap_status_ok) |
2155 { |
2537 { |
2156 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2538 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2157 return EAP_STATUS_RETURN(m_am_tools, status); |
2539 return EAP_STATUS_RETURN(m_am_tools, status); |
2158 } |
2540 } |
2159 |
2541 #endif |
2160 status = add_configuration_data( |
2542 status = add_configuration_data( |
2161 &message, |
2543 &message, |
2162 cf_str_EAP_TRACE_output_file_name.get_field(), |
2544 cf_str_EAP_TRACE_output_file_name.get_field(), |
2163 eap_configure_type_string, |
2545 eap_configure_type_string, |
2164 &value_data); |
2546 &value_data); |
2408 || wanted_field.compare( |
2790 || wanted_field.compare( |
2409 cf_str_EAP_AKA_UMA_realm_prefix.get_field()->get_field(), |
2791 cf_str_EAP_AKA_UMA_realm_prefix.get_field()->get_field(), |
2410 cf_str_EAP_AKA_UMA_realm_prefix.get_field()->get_field_length()) == 0) |
2792 cf_str_EAP_AKA_UMA_realm_prefix.get_field()->get_field_length()) == 0) |
2411 { |
2793 { |
2412 // Set uma realm prefix of EAP-SIM and EAP-AKA. |
2794 // Set uma realm prefix of EAP-SIM and EAP-AKA. |
2413 status = data->set_copy_of_buffer(iRealmPrefix->Ptr(), iRealmPrefix->Length()); |
2795 |
2796 if (iRealmPrefix != 0) |
|
2797 { |
|
2798 status = data->set_copy_of_buffer(iRealmPrefix->Ptr(), iRealmPrefix->Length()); |
|
2799 } |
|
2800 else |
|
2801 { |
|
2802 status = eap_status_illegal_configure_field; |
|
2803 } |
|
2804 |
|
2414 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2805 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2415 return EAP_STATUS_RETURN(m_am_tools, status); |
2806 return EAP_STATUS_RETURN(m_am_tools, status); |
2416 } |
2807 } |
2417 else if (wanted_field.compare( |
2808 else if (wanted_field.compare( |
2418 cf_str_EAP_GSMSIM_use_manual_realm.get_field()->get_field(), |
2809 cf_str_EAP_GSMSIM_use_manual_realm.get_field()->get_field(), |
2437 || wanted_field.compare( |
2828 || wanted_field.compare( |
2438 cf_str_EAP_AKA_manual_realm.get_field()->get_field(), |
2829 cf_str_EAP_AKA_manual_realm.get_field()->get_field(), |
2439 cf_str_EAP_AKA_manual_realm.get_field()->get_field_length()) == 0) |
2830 cf_str_EAP_AKA_manual_realm.get_field()->get_field_length()) == 0) |
2440 { |
2831 { |
2441 // ManualRealm of EAP-SIM and EAP-AKA. |
2832 // ManualRealm of EAP-SIM and EAP-AKA. |
2442 status = data->set_copy_of_buffer(iManualRealm->Ptr(), iManualRealm->Length()); |
2833 if(iManualRealm != 0) |
2834 { |
|
2835 status = data->set_copy_of_buffer(iManualRealm->Ptr(), iManualRealm->Length()); |
|
2836 } |
|
2837 else |
|
2838 { |
|
2839 status = eap_status_illegal_configure_field; |
|
2840 } |
|
2841 |
|
2443 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2842 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2444 return EAP_STATUS_RETURN(m_am_tools, status); |
2843 return EAP_STATUS_RETURN(m_am_tools, status); |
2445 } |
2844 } |
2446 else if (wanted_field.compare( |
2845 else if (wanted_field.compare( |
2447 cf_str_EAP_GSMSIM_use_manual_username.get_field()->get_field(), |
2846 cf_str_EAP_GSMSIM_use_manual_username.get_field()->get_field(), |
2489 // 2-digit MNC configuration of EAP-SIM and EAP-AKA. |
2888 // 2-digit MNC configuration of EAP-SIM and EAP-AKA. |
2490 status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList)); |
2889 status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList)); |
2491 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2890 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2492 return EAP_STATUS_RETURN(m_am_tools, status); |
2891 return EAP_STATUS_RETURN(m_am_tools, status); |
2493 } |
2892 } |
2893 #ifdef USE_EAP_VPN_FILETRACE |
|
2494 else if (wanted_field.compare( |
2894 else if (wanted_field.compare( |
2495 cf_str_EAP_TRACE_output_file_name.get_field()->get_field(), |
2895 cf_str_EAP_TRACE_output_file_name.get_field()->get_field(), |
2496 cf_str_EAP_TRACE_output_file_name.get_field()->get_field_length()) == 0) |
2896 cf_str_EAP_TRACE_output_file_name.get_field()->get_field_length()) == 0) |
2497 { |
2897 { |
2498 // Trace output file name. |
2898 // Trace output file name. |
2499 status = data->set_copy_of_buffer( |
2899 status = data->set_copy_of_buffer( |
2500 m_trace_log_file_name); |
2900 m_trace_log_file_name); |
2501 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2901 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2502 return EAP_STATUS_RETURN(m_am_tools, status); |
2902 return EAP_STATUS_RETURN(m_am_tools, status); |
2503 } |
2903 } |
2904 #endif |
|
2504 else if (wanted_field.compare( |
2905 else if (wanted_field.compare( |
2505 cf_str_EAP_GSMSIM_max_session_validity_time.get_field()->get_field(), |
2906 cf_str_EAP_GSMSIM_max_session_validity_time.get_field()->get_field(), |
2506 cf_str_EAP_GSMSIM_max_session_validity_time.get_field()->get_field_length()) == 0 |
2907 cf_str_EAP_GSMSIM_max_session_validity_time.get_field()->get_field_length()) == 0 |
2507 || wanted_field.compare( |
2908 || wanted_field.compare( |
2508 cf_str_EAP_AKA_max_session_validity_time.get_field()->get_field(), |
2909 cf_str_EAP_AKA_max_session_validity_time.get_field()->get_field(), |
2544 data); |
2945 data); |
2545 |
2946 |
2546 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2947 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2547 return EAP_STATUS_RETURN(m_am_tools, status); |
2948 return EAP_STATUS_RETURN(m_am_tools, status); |
2548 } |
2949 } |
2950 |
|
2951 //-------------------------------------------------- |
|
2549 |
2952 |
2550 /** |
2953 /** |
2551 * The write_configure() function writes the configuration data identified |
2954 * The write_configure() function writes the configuration data identified |
2552 * by the field string of field_length bytes length. Adaptation module must direct |
2955 * by the field string of field_length bytes length. Adaptation module must direct |
2553 * the action to some persistent store. |
2956 * the action to some persistent store. |
2559 { |
2962 { |
2560 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2963 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2561 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2964 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2562 return eap_status_not_supported; |
2965 return eap_status_not_supported; |
2563 } |
2966 } |
2967 |
|
2968 //-------------------------------------------------- |
|
2564 |
2969 |
2565 /** |
2970 /** |
2566 * This is notification of internal state transition. |
2971 * This is notification of internal state transition. |
2567 * This is used for notifications, debugging and protocol testing. |
2972 * This is used for notifications, debugging and protocol testing. |
2568 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully |
2973 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully |
2578 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2983 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2579 |
2984 |
2580 EAP_TRACE_DEBUG( |
2985 EAP_TRACE_DEBUG( |
2581 m_am_tools, |
2986 m_am_tools, |
2582 TRACE_FLAGS_DEFAULT, |
2987 TRACE_FLAGS_DEFAULT, |
2583 (EAPL("CEapVpnInterfaceImplementation::state_notification() = %d\n"), state->get_current_state())); |
2988 (EAPL("CEapVpnInterfaceImplementation::state_notification() = %d=%s\n"), |
2989 state->get_current_state(), |
|
2990 eap_state_notification_c::get_state_string(eap_protocol_layer_eap, state->get_current_state()))); |
|
2584 |
2991 |
2585 if (m_block_packet_sends_and_notifications == true) |
2992 if (m_block_packet_sends_and_notifications == true) |
2586 { |
2993 { |
2587 // Notification block is active. |
2994 // Notification block is active. |
2588 EAP_TRACE_ALWAYS( |
2995 EAP_TRACE_ALWAYS( |
2647 } |
3054 } |
2648 } |
3055 } |
2649 |
3056 |
2650 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3057 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2651 } |
3058 } |
3059 |
|
3060 //-------------------------------------------------- |
|
2652 |
3061 |
2653 /** |
3062 /** |
2654 * The set_timer() function initializes timer to be elapsed after time_ms milliseconds. |
3063 * The set_timer() function initializes timer to be elapsed after time_ms milliseconds. |
2655 * @param initializer is pointer to object which timer_expired() function will |
3064 * @param initializer is pointer to object which timer_expired() function will |
2656 * be called after timer elapses. |
3065 * be called after timer elapses. |
2682 |
3091 |
2683 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3092 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2684 return status; |
3093 return status; |
2685 } |
3094 } |
2686 |
3095 |
3096 //-------------------------------------------------- |
|
3097 |
|
2687 /** |
3098 /** |
2688 * The cancel_timer() function cancels the timer id initiated by initializer. |
3099 * The cancel_timer() function cancels the timer id initiated by initializer. |
2689 * @param initializer is pointer to object which set the cancelled timer. |
3100 * @param initializer is pointer to object which set the cancelled timer. |
2690 * @param id is identifier which will be returned in timer_expired() function. |
3101 * @param id is identifier which will be returned in timer_expired() function. |
2691 * The user selects and interprets the id for this timer. |
3102 * The user selects and interprets the id for this timer. |
2709 |
3120 |
2710 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3121 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2711 return status; |
3122 return status; |
2712 } |
3123 } |
2713 |
3124 |
3125 //-------------------------------------------------- |
|
3126 |
|
2714 /** |
3127 /** |
2715 * The cancel_all_timers() function cancels all timers. |
3128 * The cancel_all_timers() function cancels all timers. |
2716 * User should use this in termination of the stack before |
3129 * User should use this in termination of the stack before |
2717 * the adaptation module of tools is deleted. |
3130 * the adaptation module of tools is deleted. |
2718 * Preferred mode is to cancel each timer directly |
3131 * Preferred mode is to cancel each timer directly |
2733 |
3146 |
2734 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3147 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2735 return status; |
3148 return status; |
2736 } |
3149 } |
2737 |
3150 |
3151 //-------------------------------------------------- |
|
3152 |
|
2738 /** |
3153 /** |
2739 * This function queries the validity of EAP-type. |
3154 * This function queries the validity of EAP-type. |
2740 * Lower layer should return eap_status_ok if this EAP-type is supported. |
3155 * Lower layer should return eap_status_ok if this EAP-type is supported. |
2741 * @param eap_type is the requested EAP-type. |
3156 * @param eap_type is the requested EAP-type. |
2742 */ |
3157 */ |
2789 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3204 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2790 |
3205 |
2791 return EAP_STATUS_RETURN(m_am_tools, status); |
3206 return EAP_STATUS_RETURN(m_am_tools, status); |
2792 } |
3207 } |
2793 |
3208 |
3209 //-------------------------------------------------- |
|
3210 |
|
2794 /** |
3211 /** |
2795 * This function queries the list of supported EAP-types. |
3212 * This function queries the list of supported EAP-types. |
2796 * Lower layer should return eap_status_ok if this call succeeds. |
3213 * Lower layer should return eap_status_ok if this call succeeds. |
2797 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
3214 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
2798 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
3215 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
2871 } |
3288 } |
2872 |
3289 |
2873 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3290 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2874 return eap_status_ok; |
3291 return eap_status_ok; |
2875 } |
3292 } |
2876 //-------------------------------------------------- |
3293 |
2877 |
3294 //-------------------------------------------------- |
2878 |
3295 |
2879 eap_status_e CEapVpnInterfaceImplementation::add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & /*rogue_ap_list*/) |
3296 eap_status_e CEapVpnInterfaceImplementation::add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & /*rogue_ap_list*/) |
2880 { |
3297 { |
2881 // Not used, but might be called |
3298 // Not used, but might be called |
2882 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3299 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2889 |
3306 |
2890 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3307 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2891 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(err)); |
3308 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(err)); |
2892 } |
3309 } |
2893 |
3310 |
3311 //-------------------------------------------------- |
|
2894 |
3312 |
2895 eap_status_e CEapVpnInterfaceImplementation::restart_authentication( |
3313 eap_status_e CEapVpnInterfaceImplementation::restart_authentication( |
2896 const eap_am_network_id_c * const /*receive_network_id*/, |
3314 const eap_am_network_id_c * const /*receive_network_id*/, |
2897 const bool /*is_client_when_true*/, |
3315 const bool /*is_client_when_true*/, |
2898 const bool /*force_clean_restart*/, |
3316 const bool /*force_clean_restart*/, |
3033 implArray->Close(); |
3451 implArray->Close(); |
3034 } |
3452 } |
3035 |
3453 |
3036 //-------------------------------------------------- |
3454 //-------------------------------------------------- |
3037 |
3455 |
3456 eap_status_e CEapVpnInterfaceImplementation::wait_complete_get_802_11_authentication_mode() |
|
3457 { |
|
3458 EAP_TRACE_DEBUG( |
|
3459 m_am_tools, |
|
3460 TRACE_FLAGS_DEFAULT, |
|
3461 (EAPL("CEapGeneralSettingsImpl::wait_complete_get_802_11_authentication_mode(): calls iWait.Start()\n"))); |
|
3462 |
|
3463 iWait.Start(); |
|
3464 |
|
3465 EAP_TRACE_DEBUG( |
|
3466 m_am_tools, |
|
3467 TRACE_FLAGS_DEFAULT, |
|
3468 (EAPL("CEapGeneralSettingsImpl::WaitCompletion(): iWait.Start() returns, m_completion_status=%d\n"), |
|
3469 m_completion_status)); |
|
3470 |
|
3471 return EAP_STATUS_RETURN(m_am_tools, m_completion_status); |
|
3472 } |
|
3473 |
|
3474 //-------------------------------------------------- |
|
3475 |
|
3038 eap_status_e CEapVpnInterfaceImplementation::complete_get_802_11_authentication_mode( |
3476 eap_status_e CEapVpnInterfaceImplementation::complete_get_802_11_authentication_mode( |
3039 const eap_status_e /* completion_status */, |
3477 const eap_status_e completion_status, |
3040 const eap_am_network_id_c * /* const receive_network_id */, |
3478 const eap_am_network_id_c * const /* receive_network_id */, |
3041 const eapol_key_802_11_authentication_mode_e /* mode */) |
3479 const eapol_key_802_11_authentication_mode_e /* mode */) |
3042 { |
3480 { |
3043 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3481 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3482 EAP_TRACE_DEBUG( |
|
3483 m_am_tools, |
|
3484 TRACE_FLAGS_DEFAULT, |
|
3485 (EAPL("CEapGeneralSettingsImpl::complete_get_802_11_authentication_mode(): calls iWait.AsyncStop()\n"))); |
|
3486 |
|
3044 |
3487 |
3045 EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true); |
3488 EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true); |
3046 |
3489 |
3490 m_completion_status = completion_status; |
|
3491 |
|
3492 // This is needed to continue the execution after iWait->Start(); |
|
3493 iWait.AsyncStop(); |
|
3494 |
|
3495 EAP_TRACE_DEBUG( |
|
3496 m_am_tools, |
|
3497 TRACE_FLAGS_DEFAULT, |
|
3498 (EAPL("CEapGeneralSettingsImpl::complete_get_802_11_authentication_mode(): iWait.AsyncStop() returns, m_completion_status=%d\n"), |
|
3499 m_completion_status)); |
|
3500 |
|
3047 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3501 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3048 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
3502 return EAP_STATUS_RETURN(m_am_tools, m_completion_status); |
3049 } |
3503 } |
3050 |
3504 |
3051 //-------------------------------------------------- |
3505 //-------------------------------------------------- |
3052 |
3506 |
3053 eap_status_e CEapVpnInterfaceImplementation::complete_remove_eap_session( |
3507 eap_status_e CEapVpnInterfaceImplementation::complete_remove_eap_session( |