eap::method introduced
This commit is contained in:
@@ -91,6 +91,7 @@
|
||||
<ClCompile Include="..\src\Config.cpp" />
|
||||
<ClCompile Include="..\src\Credentials.cpp" />
|
||||
<ClCompile Include="..\src\Module.cpp" />
|
||||
<ClCompile Include="..\src\Session.cpp" />
|
||||
<ClCompile Include="..\src\StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
|
@@ -46,5 +46,8 @@
|
||||
<ClCompile Include="..\src\Module.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Session.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -20,6 +20,11 @@
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// EAP method base class
|
||||
///
|
||||
class method;
|
||||
|
||||
///
|
||||
/// EAP session
|
||||
///
|
||||
@@ -28,6 +33,8 @@ namespace eap
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Config.h"
|
||||
#include "Credentials.h"
|
||||
#include "Module.h"
|
||||
|
||||
#include <WinStd/EAP.h>
|
||||
@@ -42,6 +49,90 @@ extern "C" {
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class method
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs an EAP method
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Method configuration
|
||||
///
|
||||
method(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred);
|
||||
|
||||
///
|
||||
/// Copies an EAP method
|
||||
///
|
||||
/// \param[in] other EAP method to copy from
|
||||
///
|
||||
method(_In_ const method &other);
|
||||
|
||||
///
|
||||
/// Moves an EAP method
|
||||
///
|
||||
/// \param[in] other EAP method to move from
|
||||
///
|
||||
method(_Inout_ method &&other);
|
||||
|
||||
///
|
||||
/// Copies an EAP method
|
||||
///
|
||||
/// \param[in] other EAP method to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method& operator=(_In_ const method &other);
|
||||
|
||||
///
|
||||
/// Moves an EAP method
|
||||
///
|
||||
/// \param[in] other EAP method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method& operator=(_Inout_ method &&other);
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Processes a packet received by EAPHost from a supplicant.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
virtual bool process_request_packet(
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
///
|
||||
/// Obtains a response packet from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_response_packet(
|
||||
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
module &m_module; ///< EAP module
|
||||
config_method &m_cfg; ///< Method configuration
|
||||
credentials &m_cred; ///< User credentials
|
||||
};
|
||||
|
||||
|
||||
template <class _Tcred, class _Tint, class _Tintres>
|
||||
class session
|
||||
{
|
||||
@@ -340,7 +431,7 @@ namespace eap
|
||||
|
||||
public:
|
||||
module &m_module; ///< EAP module
|
||||
config_provider_list m_cfg; ///< Providers configuration
|
||||
config_provider_list m_cfg; ///< Providers configuration
|
||||
credentials_type m_cred; ///< User credentials
|
||||
interactive_request_type m_intreq; ///< Interactive UI request data
|
||||
DWORD m_eap_flags; ///< A combination of EAP flags that describe the new EAP authentication session behavior
|
||||
|
76
lib/EAPBase/src/Session.cpp
Normal file
76
lib/EAPBase/src/Session.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 G<>ANT
|
||||
|
||||
This file is part of G<>ANTLink.
|
||||
|
||||
G<>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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::method
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::method::method(_In_ module &module, _In_ config_method &cfg, _In_ credentials &cred) :
|
||||
m_module(module),
|
||||
m_cfg(cfg),
|
||||
m_cred(cred)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method::method(_In_ const method &other) :
|
||||
m_module(other.m_module),
|
||||
m_cfg(other.m_cfg),
|
||||
m_cred(other.m_cred)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method::method(_Inout_ method &&other) :
|
||||
m_module(other.m_module),
|
||||
m_cfg(other.m_cfg),
|
||||
m_cred(other.m_cred)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method& eap::method::operator=(_In_ const method &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Copy method within same module only!
|
||||
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Copy method with same configuration only!
|
||||
assert(std::addressof(m_cred ) == std::addressof(other.m_cred )); // Copy method with same credentials only!
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::method& eap::method::operator=(_Inout_ method &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Copy method within same module only!
|
||||
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Copy method with same configuration only!
|
||||
assert(std::addressof(m_cred ) == std::addressof(other.m_cred )); // Copy method with same credentials only!
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
Reference in New Issue
Block a user