Resolve the make_...() methods

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2020-02-05 10:14:14 +01:00
parent 5195b79eed
commit 5b02352f1a
13 changed files with 67 additions and 71 deletions

View File

@@ -108,7 +108,7 @@ namespace eap
///
/// \returns New method configuration
///
virtual config_method* make_config_method();
virtual config_method* make_config();
/// @}

View File

@@ -632,7 +632,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot)
com_obj<IXMLDOMNode> pXmlElMethod;
pXmlListMethods->get_item(i, &pXmlElMethod);
unique_ptr<config_method> cfg(m_module.make_config_method());
unique_ptr<config_method> cfg(m_module.make_config());
// Check EAP method type (<EAPMethod>).
DWORD dwMethodID;
@@ -709,7 +709,7 @@ void eap::config_provider::operator>>(_Inout_ cursor_in &cursor)
bool is_nonnull;
cursor >> is_nonnull;
if (is_nonnull) {
unique_ptr<config_method> el(m_module.make_config_method());
unique_ptr<config_method> el(m_module.make_config());
cursor >> *el;
m_methods.push_back(std::move(el));
} else

View File

@@ -187,7 +187,7 @@ void eap::module::log_error(_In_ const EAP_ERROR *err) const
}
eap::config_method* eap::module::make_config_method()
eap::config_method* eap::module::make_config()
{
return NULL;
}

View File

@@ -190,7 +190,7 @@ public:
#endif
// Set banner title.
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config_method());
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config());
m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str()));
for (auto provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) {
@@ -253,7 +253,7 @@ protected:
wxEAPConfigDialogBase::OnProvAdd(event);
// One method
std::unique_ptr<eap::config_method> cfg_method(m_cfg.m_module.make_config_method());
std::unique_ptr<eap::config_method> cfg_method(m_cfg.m_module.make_config());
// Create provider.
eap::config_provider cfg_provider(m_cfg.m_module);

View File

@@ -442,7 +442,7 @@ wxEAPProviderSelectDialog::wxEAPProviderSelectDialog(eap::config_connection &cfg
wxEAPProviderSelectDialogBase(parent)
{
// Set banner title.
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config_method());
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config());
m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str()));
// Iterate over providers.

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
namespace eap
@@ -157,12 +157,12 @@ namespace eap
protected:
///
/// Makes a new inner method
/// Makes a new method
///
/// \param[in] cfg Method configuration
/// \param[in] cred Credentials
///
/// \returns A new inner method of given type
/// \returns A new method
///
virtual method* make_method(_In_ config_method_tls &cfg, _In_ credentials_tls &cred) = 0;

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
#include "StdAfx.h"
@@ -170,7 +170,7 @@ void eap::peer_tls_base::credentials_xml2blob(
UNREFERENCED_PARAMETER(dwConnectionDataSize);
// Load credentials from XML.
unique_ptr<config_method> cfg(make_config_method());
unique_ptr<config_method> cfg(make_config());
unique_ptr<credentials> cred(cfg->make_credentials());
cred->load(pConfigRoot);

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sal.h>
@@ -103,6 +103,7 @@ namespace eap
///
virtual credentials* make_credentials() const;
protected:
///
/// Makes a new inner method config
///
@@ -110,7 +111,7 @@ namespace eap
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const = 0;
virtual config_method* make_inner_config(_In_ winstd::eap_type_t eap_type) const = 0;
///
/// Makes a new inner method config
@@ -119,7 +120,7 @@ namespace eap
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ const wchar_t *eap_type) const = 0;
virtual config_method* make_inner_config(_In_ const wchar_t *eap_type) const = 0;
public:
std::unique_ptr<config_method> m_inner; ///< Inner authentication configuration
@@ -192,23 +193,16 @@ namespace eap
///
virtual const wchar_t* get_method_str() const;
protected:
///
/// Makes a new inner method config
/// @copydoc eap::config_method_tls_tunnel::make_inner_config()
///
/// \param[in] eap_type EAP type
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const;
virtual config_method* make_inner_config(_In_ winstd::eap_type_t eap_type) const;
///
/// Makes a new inner method config
/// @copydoc eap::config_method_tls_tunnel::make_inner_config()
///
/// \param[in] eap_type EAP type
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ const wchar_t *eap_type) const;
virtual config_method* make_inner_config(_In_ const wchar_t *eap_type) const;
};
/// @}

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
namespace eap
@@ -78,13 +78,15 @@ namespace eap
peer_ttls();
///
/// @copydoc eap::method::make_config_method()
/// @copydoc eap::method::make_config()
/// \returns This implementation always returns `eap::config_method_ttls` type of configuration
///
virtual config_method* make_config_method();
virtual config_method* make_config();
protected:
/// @copydoc eap::method::make_config_method()
///
/// @copydoc eap::peer_tls_base::make_method()
///
virtual method* make_method(_In_ config_method_tls &cfg, _In_ credentials_tls &cred);
};

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
#include "StdAfx.h"
@@ -95,7 +95,7 @@ void eap::config_method_tls_tunnel::operator>>(_Inout_ cursor_in &cursor)
eap_type_t eap_type;
cursor >> eap_type;
m_inner.reset(make_config_method(eap_type));
m_inner.reset(make_inner_config(eap_type));
cursor >> *m_inner;
}
@@ -253,10 +253,10 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot)
#endif
))
{
m_inner.reset(make_config_method((eap_type_t)dwMethod));
m_inner.reset(make_inner_config((eap_type_t)dwMethod));
m_module.log_config((xpath + L"/EAPMethod").c_str(), m_inner->get_method_str());
} else if (SUCCEEDED(eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:NonEAPAuthMethod"), bstrMethod))) {
m_inner.reset(make_config_method(bstrMethod));
m_inner.reset(make_inner_config(bstrMethod));
m_module.log_config((xpath + L"/NonEAPAuthMethod").c_str(), m_inner->get_method_str());
} else
throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Unsupported inner authentication method.");
@@ -277,7 +277,7 @@ const wchar_t* eap::config_method_ttls::get_method_str() const
}
eap::config_method* eap::config_method_ttls::make_config_method(_In_ winstd::eap_type_t eap_type) const
eap::config_method* eap::config_method_ttls::make_inner_config(_In_ winstd::eap_type_t eap_type) const
{
switch (eap_type) {
case eap_type_t::legacy_pap : return new config_method_pap (m_module, m_level + 1);
@@ -292,7 +292,7 @@ eap::config_method* eap::config_method_ttls::make_config_method(_In_ winstd::eap
}
eap::config_method* eap::config_method_ttls::make_config_method(_In_ const wchar_t *eap_type) const
eap::config_method* eap::config_method_ttls::make_inner_config(_In_ const wchar_t *eap_type) const
{
if (_wcsicmp(eap_type, L"PAP" ) == 0) return new config_method_pap (m_module, m_level + 1);
else if (_wcsicmp(eap_type, L"MSCHAPv2" ) == 0) return new config_method_mschapv2 (m_module, m_level + 1);

View File

@@ -165,7 +165,7 @@ eap::peer_ttls::peer_ttls() : peer_tls_tunnel(eap_type_t::ttls)
}
eap::config_method* eap::peer_ttls::make_config_method()
eap::config_method* eap::peer_ttls::make_config()
{
return new config_method_ttls(*this, 0);
}

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
namespace eap
@@ -47,10 +47,10 @@ namespace eap
peer_ttls_ui();
///
/// @copydoc eap::method::make_config_method()
/// @copydoc eap::method::make_config()
/// \returns This implementation always returns `eap::config_method_ttls` type of configuration
///
virtual config_method* make_config_method();
virtual config_method* make_config();
virtual void invoke_config_ui(
_In_ HWND hwndParent,

View File

@@ -1,21 +1,21 @@
/*
Copyright 2015-2020 Amebis
Copyright 2016 GÉANT
Copyright 2016 G<EFBFBD>ANT
This file is part of GÉANTLink.
This file is part of G<EFBFBD>ANTLink.
GÉANTLink is free software: you can redistribute it and/or modify it
G<EFBFBD>ANTLink is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GÉANTLink is distributed in the hope that it will be useful, but
G<EFBFBD>ANTLink is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
along with G<EFBFBD>ANTLink. If not, see <http://www.gnu.org/licenses/>.
*/
#include "StdAfx.h"
@@ -33,7 +33,7 @@ eap::peer_ttls_ui::peer_ttls_ui() : peer_ui(eap_type_t::ttls, _T("EAP-TTLS_UI"))
}
eap::config_method* eap::peer_ttls_ui::make_config_method()
eap::config_method* eap::peer_ttls_ui::make_config()
{
return new config_method_ttls(*this, 0);
}