Template arguments and type names unified

This commit is contained in:
2016-07-20 11:25:03 +02:00
parent 2a19b4624a
commit 43751ed908
10 changed files with 109 additions and 99 deletions

View File

@@ -32,14 +32,14 @@ namespace eap
///
/// A group of methods all EAP peers must or should implement.
///
template <class _Tcfg, class _Tid, class _Tint, class _Tintres> class peer_base;
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres> class peer_base;
///
/// EAP peer base class
///
/// A group of methods all EAP peers must or should implement.
///
template <class _Tcfg, class _Tid, class _Tint, class _Tintres> class peer;
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres> class peer;
}
#pragma once
@@ -654,24 +654,29 @@ namespace eap
};
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres>
class peer_base : public module
{
public:
///
/// Method configuration data type
///
typedef _Tmeth config_method_type;
///
/// Provider configuration data type
///
typedef config_provider<_Tcfg> provider_config_type;
typedef config_provider<config_method_type> config_provider_type;
///
/// Configuration data type
///
typedef config_providers<provider_config_type> config_type;
typedef config_providers<config_provider_type> config_providers_type;
///
/// Identity data type
/// Credentials data type
///
typedef _Tid identity_type;
typedef _Tcred credentials_type;
///
/// Interactive request data type
@@ -691,14 +696,14 @@ namespace eap
};
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
class peer : public peer_base<_Tcfg, _Tid, _Tint, _Tintres>
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres>
class peer : public peer_base<_Tmeth, _Tcred, _Tint, _Tintres>
{
public:
///
/// Constructs a EAP peer module for the given EAP type
///
peer(_In_ type_t eap_method) : peer_base<_Tcfg, _Tid, _Tint, _Tintres>(eap_method) {}
peer(_In_ type_t eap_method) : peer_base<_Tmeth, _Tcred, _Tint, _Tintres>(eap_method) {}
///
/// Initializes an EAP peer method for EAPHost.
@@ -732,13 +737,13 @@ namespace eap
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool get_identity(
_In_ DWORD dwFlags,
_In_ const config_type &cfg,
_Inout_ identity_type &usr,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity,
_Out_ EAP_ERROR **ppEapError) = 0;
_In_ DWORD dwFlags,
_In_ const config_providers_type &cfg,
_Inout_ credentials_type &usr,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity,
_Out_ EAP_ERROR **ppEapError) = 0;
///
/// Defines the implementation of an EAP method-specific function that retrieves the properties of an EAP method given the connection and user data.
@@ -753,8 +758,8 @@ namespace eap
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ HANDLE hUserImpersonationToken,
_In_ const config_type &cfg,
_In_ const identity_type &usr,
_In_ const config_providers_type &cfg,
_In_ const credentials_type &usr,
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray,
_Out_ EAP_ERROR **ppEapError) const = 0;

View File

@@ -23,7 +23,7 @@ namespace eap
///
/// EAP session
///
template <class _Tcfg, class _Tid, class _Tint, class _Tintres> class session;
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres> class session;
}
#pragma once
@@ -40,24 +40,29 @@ extern "C" {
namespace eap
{
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres>
class session
{
public:
///
/// Method configuration data type
///
typedef _Tmeth config_method_type;
///
/// Provider configuration data type
///
typedef config_provider<_Tcfg> provider_config_type;
typedef config_provider<config_method_type> config_provider_type;
///
/// Configuration data type
///
typedef config_providers<provider_config_type> config_type;
typedef config_providers<config_provider_type> config_providers_type;
///
/// Identity data type
/// Credentials data type
///
typedef _Tid identity_type;
typedef _Tcred credentials_type;
///
/// Interactive request data type
@@ -78,7 +83,7 @@ namespace eap
session(_In_ module &mod) :
m_module(mod),
m_cfg(mod),
m_id(mod)
m_cred(mod)
{
}
@@ -91,7 +96,7 @@ namespace eap
session(_In_ const session &other) :
m_module(other.m_module),
m_cfg(other.m_cfg),
m_id(other.m_id)
m_cred(other.m_cred)
{
}
@@ -104,7 +109,7 @@ namespace eap
session(_Inout_ session &&other) :
m_module(other.m_module),
m_cfg(std::move(other.m_cfg)),
m_id(std::move(other.m_id))
m_cred(std::move(other.m_cred))
{
}
@@ -120,8 +125,8 @@ namespace eap
{
if (this != std::addressof(other)) {
assert(std::addressof(m_module) ==std::addressof(other.m_module)); // Copy session within same module only!
m_cfg = other.m_cfg;
m_id = other.m_id;
m_cfg = other.m_cfg;
m_cred = other.m_cred;
}
return *this;
}
@@ -138,8 +143,8 @@ namespace eap
{
if (this != std::addressof(other)) {
assert(std::addressof(m_module) ==std::addressof(other.m_module)); // Move session within same module only!
m_cfg = std::move(other.m_cfg);
m_id = std::move(other.m_id);
m_cfg = std::move(other.m_cfg);
m_cred = std::move(other.m_cred);
}
return *this;
}
@@ -360,8 +365,8 @@ namespace eap
/// @}
public:
module &m_module; ///< Reference of the EAP module
config_type m_cfg; ///< Session configuration
identity_type m_id; ///< User identity
module &m_module; ///< Reference of the EAP module
config_providers_type m_cfg; ///< Session configuration
credentials_type m_cred; ///< User credentials
};
}

View File

@@ -96,7 +96,7 @@ public:
///
/// Configuration data type
///
typedef eap::config_providers<_Tprov> config_type;
typedef eap::config_providers<_Tprov> config_providers_type;
///
/// This data type
@@ -107,7 +107,7 @@ public:
///
/// Constructs a configuration dialog
///
wxEAPConfigDialog(config_type &cfg, wxWindow* parent) :
wxEAPConfigDialog(config_providers_type &cfg, wxWindow* parent) :
m_cfg(cfg),
wxEAPConfigDialogBase(parent)
{
@@ -150,7 +150,7 @@ protected:
protected:
config_type &m_cfg; ///< EAP providers configuration
config_providers_type &m_cfg; ///< EAP providers configuration
};

View File

@@ -25,7 +25,7 @@ namespace eap
///
/// A group of methods all EAP UI peers must or should implement.
///
template <class _Tmeth, class _Tid, class _Tint, class _Tintres> class peer_ui;
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres> class peer_ui;
}
#pragma once
@@ -35,14 +35,14 @@ namespace eap
namespace eap
{
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
class peer_ui : public peer_base<_Tcfg, _Tid, _Tint, _Tintres>
template <class _Tmeth, class _Tcred, class _Tint, class _Tintres>
class peer_ui : public peer_base<_Tmeth, _Tcred, _Tint, _Tintres>
{
public:
///
/// Constructs a EAP UI peer module for the given EAP type
///
peer_ui(_In_ type_t eap_method) : peer_base<_Tcfg, _Tid, _Tint, _Tintres>(eap_method) {}
peer_ui(_In_ 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.
@@ -58,9 +58,9 @@ namespace eap
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool invoke_config_ui(
_In_ HWND hwndParent,
_Inout_ config_type &cfg,
_Out_ EAP_ERROR **ppEapError) = 0;
_In_ HWND hwndParent,
_Inout_ config_providers_type &cfg,
_Out_ EAP_ERROR **ppEapError) = 0;
///
/// Raises a custom interactive user interface dialog to obtain user identity information for the EAP method on the client.
@@ -79,12 +79,12 @@ namespace eap
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool invoke_identity_ui(
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_type &cfg,
_Inout_ identity_type &usr,
_Out_ LPWSTR *ppwszIdentity,
_Out_ EAP_ERROR **ppEapError) = 0;
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_providers_type &cfg,
_Inout_ credentials_type &usr,
_Out_ LPWSTR *ppwszIdentity,
_Out_ EAP_ERROR **ppEapError) = 0;
///
/// Raises a custom interactive user interface dialog for the EAP method on the client.

View File

@@ -75,13 +75,13 @@ namespace eap
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool get_identity(
_In_ DWORD dwFlags,
_In_ const config_type &cfg,
_Inout_ identity_type &usr,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity,
_Out_ EAP_ERROR **ppEapError);
_In_ DWORD dwFlags,
_In_ const config_providers_type &cfg,
_Inout_ credentials_type &usr,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity,
_Out_ EAP_ERROR **ppEapError);
///
/// Defines the implementation of an EAP method-specific function that retrieves the properties of an EAP method given the connection and user data.
@@ -96,8 +96,8 @@ namespace eap
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ HANDLE hUserImpersonationToken,
_In_ const config_type &cfg,
_In_ const identity_type &usr,
_In_ const config_providers_type &cfg,
_In_ const credentials_type &usr,
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray,
_Out_ EAP_ERROR **ppEapError) const;
};

View File

@@ -59,13 +59,13 @@ bool eap::peer_ttls::shutdown(_Out_ EAP_ERROR **ppEapError)
bool eap::peer_ttls::get_identity(
_In_ DWORD dwFlags,
_In_ const config_type &cfg,
_Inout_ identity_type &usr,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity,
_Out_ EAP_ERROR **ppEapError)
_In_ DWORD dwFlags,
_In_ const config_providers_type &cfg,
_Inout_ credentials_type &usr,
_In_ HANDLE hTokenImpersonateUser,
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity,
_Out_ EAP_ERROR **ppEapError)
{
UNREFERENCED_PARAMETER(dwFlags);
UNREFERENCED_PARAMETER(cfg);
@@ -84,8 +84,8 @@ bool eap::peer_ttls::get_method_properties(
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ HANDLE hUserImpersonationToken,
_In_ const config_type &cfg,
_In_ const identity_type &usr,
_In_ const config_providers_type &cfg,
_In_ const credentials_type &usr,
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray,
_Out_ EAP_ERROR **ppEapError) const
{

View File

@@ -57,9 +57,9 @@ namespace eap
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool invoke_config_ui(
_In_ HWND hwndParent,
_Inout_ config_type &cfg,
_Out_ EAP_ERROR **ppEapError);
_In_ HWND hwndParent,
_Inout_ config_providers_type &cfg,
_Out_ EAP_ERROR **ppEapError);
///
/// Raises a custom interactive user interface dialog to obtain user identity information for the EAP method on the client.
@@ -78,12 +78,12 @@ namespace eap
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool invoke_identity_ui(
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_type &cfg,
_Inout_ identity_type &usr,
_Out_ LPWSTR *ppwszIdentity,
_Out_ EAP_ERROR **ppEapError);
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_providers_type &cfg,
_Inout_ credentials_type &usr,
_Out_ LPWSTR *ppwszIdentity,
_Out_ EAP_ERROR **ppEapError);
///
/// Raises a custom interactive user interface dialog for the EAP method on the client.

View File

@@ -31,9 +31,9 @@ eap::peer_ttls_ui::peer_ttls_ui() : peer_ui<eap::config_method_ttls, eap::creden
bool eap::peer_ttls_ui::invoke_config_ui(
_In_ HWND hwndParent,
_Inout_ config_type &cfg,
_Out_ EAP_ERROR **ppEapError)
_In_ HWND hwndParent,
_Inout_ config_providers_type &cfg,
_Out_ EAP_ERROR **ppEapError)
{
UNREFERENCED_PARAMETER(ppEapError);
@@ -50,7 +50,7 @@ bool eap::peer_ttls_ui::invoke_config_ui(
wxTopLevelWindows.Append(&parent);
// Create and launch configuration dialog.
wxEAPConfigDialog<config_method_ttls, wxTTLSConfigWindow<provider_config_type> > dlg(cfg, &parent);
wxEAPConfigDialog<config_method_ttls, wxTTLSConfigWindow<config_provider_type> > dlg(cfg, &parent);
result = dlg.ShowModal();
wxTopLevelWindows.DeleteObject(&parent);
@@ -69,12 +69,12 @@ bool eap::peer_ttls_ui::invoke_config_ui(
bool eap::peer_ttls_ui::invoke_identity_ui(
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_type &cfg,
_Inout_ identity_type &usr,
_Out_ LPWSTR *ppwszIdentity,
_Out_ EAP_ERROR **ppEapError)
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_providers_type &cfg,
_Inout_ credentials_type &usr,
_Out_ LPWSTR *ppwszIdentity,
_Out_ EAP_ERROR **ppEapError)
{
UNREFERENCED_PARAMETER(dwFlags);
UNREFERENCED_PARAMETER(cfg);