diff --git a/CredWrite/Main.cpp b/CredWrite/Main.cpp index bde329e..a683e93 100644 --- a/CredWrite/Main.cpp +++ b/CredWrite/Main.cpp @@ -23,7 +23,7 @@ using namespace std; using namespace winstd; -eap::peer_base g_module(eap::type_undefined); +eap::peer_base g_module(eap_type_undefined); static int CredWrite() diff --git a/lib/EAPBase/include/Config.h b/lib/EAPBase/include/Config.h index fcb69ae..153d146 100644 --- a/lib/EAPBase/include/Config.h +++ b/lib/EAPBase/include/Config.h @@ -251,9 +251,9 @@ namespace eap /// /// Returns EAP method type of this configuration /// - /// \returns One of `eap::type_t` constants. + /// \returns One of `winstd::eap_type_t` constants. /// - virtual type_t get_method_id() const = 0; + virtual winstd::eap_type_t get_method_id() const = 0; }; diff --git a/lib/EAPBase/include/EAP.h b/lib/EAPBase/include/EAP.h index fa4373d..4489090 100644 --- a/lib/EAPBase/include/EAP.h +++ b/lib/EAPBase/include/EAP.h @@ -28,6 +28,7 @@ #if !defined(RC_INVOKED) && !defined(MIDL_PASS) #include +#include #include @@ -38,13 +39,6 @@ namespace eap { - /// - /// EAP method numbers - /// - /// \sa [Extensible Authentication Protocol (EAP) Registry (Chapter: Method Types)](https://www.iana.org/assignments/eap-numbers/eap-numbers.xhtml#eap-numbers-4) - /// - enum type_t; - /// /// Output BLOB cursor /// @@ -316,7 +310,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_contex /// \param[inout] cursor Memory cursor /// \param[in] val EAP method type to pack /// -inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::type_t &val); +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::eap_type_t &val); /// /// Returns packed size of an EAP method type @@ -325,7 +319,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::type_t & /// /// \returns Size of data when packed (in bytes) /// -inline size_t pksizeof(const eap::type_t &val); +inline size_t pksizeof(const winstd::eap_type_t &val); /// /// Unpacks an EAP method type @@ -333,22 +327,13 @@ inline size_t pksizeof(const eap::type_t &val); /// \param[inout] cursor Memory cursor /// \param[out] val EAP method type to unpack to /// -inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::type_t &val); +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::eap_type_t &val); #pragma once namespace eap { - enum type_t { - type_undefined = 0, ///< Undefined EAP type - type_tls = 13, ///< EAP-TLS - type_ttls = 21, ///< EAP-TTLS - type_peap = 25, ///< EAP-PEAP - type_mschapv2 = 26, ///< EAP-MSCHAPv2 - type_pap = 192, ///< PAP (Not actually an EAP method; Moved to the Unassigned area) - }; - struct cursor_out { typedef unsigned char *ptr_type; @@ -680,23 +665,23 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_contex } -inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::type_t &val) +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::eap_type_t &val) { cursor << (unsigned char)val; } -inline size_t pksizeof(_In_ const eap::type_t &val) +inline size_t pksizeof(_In_ const winstd::eap_type_t &val) { return pksizeof((unsigned char)val); } -inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::type_t &val) +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::eap_type_t &val) { unsigned char t; cursor >> t; - val = (eap::type_t)t; + val = (winstd::eap_type_t)t; } #endif diff --git a/lib/EAPBase/include/Module.h b/lib/EAPBase/include/Module.h index 8123255..abbac2d 100644 --- a/lib/EAPBase/include/Module.h +++ b/lib/EAPBase/include/Module.h @@ -66,7 +66,7 @@ namespace eap /// /// Constructs a module for the given EAP type /// - module(_In_ type_t eap_method); + module(_In_ winstd::eap_type_t eap_method); /// /// Destructs the module @@ -649,7 +649,7 @@ namespace eap public: HINSTANCE m_instance; ///< Windows module instance - const type_t m_eap_method; ///< EAP method type + const winstd::eap_type_t m_eap_method; ///< EAP method type protected: winstd::heap m_heap; ///< Heap @@ -685,7 +685,7 @@ namespace eap /// /// Constructs a EAP peer module for the given EAP type /// - peer_base(_In_ type_t eap_method) : module(eap_method) {} + peer_base(_In_ winstd::eap_type_t eap_method) : module(eap_method) {} /// /// Makes a new method config for the given method type @@ -704,7 +704,7 @@ namespace eap /// /// Constructs a EAP peer module for the given EAP type /// - peer(_In_ type_t eap_method) : peer_base<_Tmeth, _Tcred, _Tint, _Tintres>(eap_method) {} + peer(_In_ winstd::eap_type_t eap_method) : peer_base<_Tmeth, _Tcred, _Tint, _Tintres>(eap_method) {} /// /// Initializes an EAP peer method for EAPHost. diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index 19c8960..7061b96 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -429,7 +429,7 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * // Check EAP method type (). DWORD dwMethodID; if (eapxml::get_element_value(pXmlElMethod, bstr(L"eap-metadata:EAPMethod"), &dwMethodID) == ERROR_SUCCESS) { - if ((type_t)dwMethodID != cfg->get_method_id()) { + if ((eap_type_t)dwMethodID != cfg->get_method_id()) { // Wrong type. continue; } diff --git a/lib/EAPBase/src/Module.cpp b/lib/EAPBase/src/Module.cpp index 1d0aedd..b8266cd 100644 --- a/lib/EAPBase/src/Module.cpp +++ b/lib/EAPBase/src/Module.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::module ////////////////////////////////////////////////////////////////////// -eap::module::module(type_t eap_method) : +eap::module::module(eap_type_t eap_method) : m_eap_method(eap_method), m_instance(NULL) { diff --git a/lib/EAPBase_UI/include/Module.h b/lib/EAPBase_UI/include/Module.h index 02e40b8..9195c96 100644 --- a/lib/EAPBase_UI/include/Module.h +++ b/lib/EAPBase_UI/include/Module.h @@ -42,7 +42,7 @@ namespace eap /// /// Constructs a EAP UI peer module for the given EAP type /// - peer_ui(_In_ type_t eap_method) : peer_base<_Tmeth, _Tcred, _Tint, _Tintres>(eap_method) {} + peer_ui(_In_ winstd::eap_type_t eap_method) : peer_base<_Tmeth, _Tcred, _Tint, _Tintres>(eap_method) {} /// /// Raises the EAP method's specific connection configuration user interface dialog on the client. diff --git a/lib/PAP/include/Config.h b/lib/PAP/include/Config.h index a9e4aa2..5704ba7 100644 --- a/lib/PAP/include/Config.h +++ b/lib/PAP/include/Config.h @@ -94,6 +94,6 @@ namespace eap /// /// \returns `eap::type_pap` /// - virtual eap::type_t get_method_id() const; + virtual winstd::eap_type_t get_method_id() const; }; } diff --git a/lib/PAP/src/Config.cpp b/lib/PAP/src/Config.cpp index 316f838..f28d693 100644 --- a/lib/PAP/src/Config.cpp +++ b/lib/PAP/src/Config.cpp @@ -20,6 +20,9 @@ #include "StdAfx.h" +using namespace std; +using namespace winstd; + ////////////////////////////////////////////////////////////////////// // eap::config_method_pap @@ -66,7 +69,7 @@ eap::config* eap::config_method_pap::clone() const } -eap::type_t eap::config_method_pap::get_method_id() const +eap_type_t eap::config_method_pap::get_method_id() const { - return eap::type_pap; + return eap_type_pap; } diff --git a/lib/TLS/include/Config.h b/lib/TLS/include/Config.h index 6c07363..55ad4f2 100644 --- a/lib/TLS/include/Config.h +++ b/lib/TLS/include/Config.h @@ -164,7 +164,7 @@ namespace eap /// /// \returns `eap::type_tls` /// - virtual eap::type_t get_method_id() const; + virtual winstd::eap_type_t get_method_id() const; /// /// Adds CA to the list of trusted root CA's diff --git a/lib/TLS/src/Config.cpp b/lib/TLS/src/Config.cpp index a9bc2cb..1b7aa2e 100644 --- a/lib/TLS/src/Config.cpp +++ b/lib/TLS/src/Config.cpp @@ -281,9 +281,9 @@ void eap::config_method_tls::operator>>(_Inout_ cursor_in &cursor) } -eap::type_t eap::config_method_tls::get_method_id() const +eap_type_t eap::config_method_tls::get_method_id() const { - return type_tls; + return eap_type_tls; } diff --git a/lib/TTLS/include/Config.h b/lib/TTLS/include/Config.h index 09517df..3f079d4 100644 --- a/lib/TTLS/include/Config.h +++ b/lib/TTLS/include/Config.h @@ -148,7 +148,7 @@ namespace eap { /// /// \returns `eap::type_ttls` /// - virtual eap::type_t get_method_id() const; + virtual winstd::eap_type_t get_method_id() const; /// /// Generates public identity using current configuration and given credentials diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index be3430e..6745fc5 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -206,14 +206,14 @@ void eap::config_method_ttls::operator<<(_Inout_ cursor_out &cursor) const if (m_inner) { if (dynamic_cast(m_inner.get())) { - cursor << type_pap; + cursor << eap_type_pap; cursor << *m_inner; } else { assert(0); // Unsupported inner authentication method type. - cursor << type_undefined; + cursor << eap_type_undefined; } } else - cursor << type_undefined; + cursor << eap_type_undefined; cursor << m_anonymous_identity; } @@ -225,14 +225,14 @@ size_t eap::config_method_ttls::get_pk_size() const if (m_inner) { if (dynamic_cast(m_inner.get())) { size_inner = - pksizeof(type_pap) + + pksizeof(eap_type_pap) + pksizeof(*m_inner); } else { assert(0); // Unsupported inner authentication method type. - size_inner = pksizeof(type_undefined); + size_inner = pksizeof(eap_type_undefined); } } else - size_inner = pksizeof(type_undefined); + size_inner = pksizeof(eap_type_undefined); return config_method::get_pk_size() + @@ -247,10 +247,10 @@ void eap::config_method_ttls::operator>>(_Inout_ cursor_in &cursor) config_method::operator>>(cursor); cursor >> m_outer; - type_t eap_type; + eap_type_t eap_type; cursor >> eap_type; switch (eap_type) { - case type_pap: + case eap_type_pap: m_inner.reset(new config_method_pap(m_module)); cursor >> *m_inner; break; @@ -263,9 +263,9 @@ void eap::config_method_ttls::operator>>(_Inout_ cursor_in &cursor) } -eap::type_t eap::config_method_ttls::get_method_id() const +eap_type_t eap::config_method_ttls::get_method_id() const { - return type_ttls; + return eap_type_ttls; } diff --git a/lib/TTLS/src/Credentials.cpp b/lib/TTLS/src/Credentials.cpp index 1730b8a..3adf4dd 100644 --- a/lib/TTLS/src/Credentials.cpp +++ b/lib/TTLS/src/Credentials.cpp @@ -167,14 +167,14 @@ void eap::credentials_ttls::operator<<(_Inout_ cursor_out &cursor) const cursor << m_outer; if (m_inner) { if (dynamic_cast(m_inner.get())) { - cursor << type_pap; + cursor << eap_type_pap; cursor << *m_inner; } else { assert(0); // Unsupported inner authentication method type. - cursor << type_undefined; + cursor << eap_type_undefined; } } else - cursor << type_undefined; + cursor << eap_type_undefined; } @@ -184,14 +184,14 @@ size_t eap::credentials_ttls::get_pk_size() const if (m_inner) { if (dynamic_cast(m_inner.get())) { size_inner = - pksizeof(type_pap) + + pksizeof(eap_type_pap) + pksizeof(*m_inner); } else { assert(0); // Unsupported inner authentication method type. - size_inner = pksizeof(type_undefined); + size_inner = pksizeof(eap_type_undefined); } } else - size_inner = pksizeof(type_undefined); + size_inner = pksizeof(eap_type_undefined); return credentials::get_pk_size() + @@ -205,10 +205,10 @@ void eap::credentials_ttls::operator>>(_Inout_ cursor_in &cursor) credentials::operator>>(cursor); cursor >> m_outer; - type_t eap_type; + eap_type_t eap_type; cursor >> eap_type; switch (eap_type) { - case type_pap: + case eap_type_pap: m_inner.reset(new credentials_pap(m_module)); cursor >> *m_inner; break; diff --git a/lib/TTLS/src/Module.cpp b/lib/TTLS/src/Module.cpp index 6100319..cde822b 100644 --- a/lib/TTLS/src/Module.cpp +++ b/lib/TTLS/src/Module.cpp @@ -28,7 +28,7 @@ using namespace winstd; // eap::peer_ttls ////////////////////////////////////////////////////////////////////// -eap::peer_ttls::peer_ttls() : peer(type_ttls) +eap::peer_ttls::peer_ttls() : peer(eap_type_ttls) { } diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index 0dddbbb..9caf324 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -25,7 +25,7 @@ // eap::peer_ttls_ui ////////////////////////////////////////////////////////////////////// -eap::peer_ttls_ui::peer_ttls_ui() : peer_ui(type_ttls) +eap::peer_ttls_ui::peer_ttls_ui() : peer_ui(winstd::eap_type_ttls) { } diff --git a/lib/WinStd b/lib/WinStd index 431c7d9..4b63d60 160000 --- a/lib/WinStd +++ b/lib/WinStd @@ -1 +1 @@ -Subproject commit 431c7d99603d0457d586d7d722e3cad27ff42dd4 +Subproject commit 4b63d60b01c7f579f4da2d5d61bb766813884a9f