Make modules and methods non-copyable & non-movable
Modules and methods are never duplicated or moved in a memory. Moving constructors and operators are dead code. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -45,8 +45,6 @@ namespace eap
|
||||
///
|
||||
class method_mschapv2_base : public method
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_mschapv2_base)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a MSCHAPv2 method
|
||||
@@ -57,22 +55,6 @@ namespace eap
|
||||
///
|
||||
method_mschapv2_base(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
|
||||
|
||||
///
|
||||
/// Moves a MSCHAPv2 method
|
||||
///
|
||||
/// \param[in] other MSCHAPv2 method to move from
|
||||
///
|
||||
method_mschapv2_base(_Inout_ method_mschapv2_base &&other) noexcept;
|
||||
|
||||
///
|
||||
/// Moves a MSCHAPv2 method
|
||||
///
|
||||
/// \param[in] other MSCHAPv2 method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method_mschapv2_base& operator=(_Inout_ method_mschapv2_base &&other) noexcept;
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
@@ -145,8 +127,6 @@ namespace eap
|
||||
///
|
||||
class method_mschapv2 : public method_mschapv2_base
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_mschapv2)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a MSCHAPv2 method
|
||||
@@ -157,22 +137,6 @@ namespace eap
|
||||
///
|
||||
method_mschapv2(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
|
||||
|
||||
///
|
||||
/// Moves a MSCHAPv2 method
|
||||
///
|
||||
/// \param[in] other MSCHAPv2 method to move from
|
||||
///
|
||||
method_mschapv2(_Inout_ method_mschapv2 &&other) noexcept;
|
||||
|
||||
///
|
||||
/// Moves a MSCHAPv2 method
|
||||
///
|
||||
/// \param[in] other MSCHAPv2 method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method_mschapv2& operator=(_Inout_ method_mschapv2 &&other) noexcept;
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
@@ -191,8 +155,6 @@ namespace eap
|
||||
///
|
||||
class method_mschapv2_diameter : public method_mschapv2_base
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_mschapv2_diameter)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a MSCHAPv2 method
|
||||
@@ -203,22 +165,6 @@ namespace eap
|
||||
///
|
||||
method_mschapv2_diameter(_In_ module &mod, _In_ config_method_mschapv2 &cfg, _In_ credentials_pass &cred);
|
||||
|
||||
///
|
||||
/// Moves a MSCHAPv2 method
|
||||
///
|
||||
/// \param[in] other MSCHAPv2 method to move from
|
||||
///
|
||||
method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other) noexcept;
|
||||
|
||||
///
|
||||
/// Moves a MSCHAPv2 method
|
||||
///
|
||||
/// \param[in] other MSCHAPv2 method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method_mschapv2_diameter& operator=(_Inout_ method_mschapv2_diameter &&other) noexcept;
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
|
@@ -37,38 +37,6 @@ eap::method_mschapv2_base::method_mschapv2_base(_In_ module &mod, _In_ config_me
|
||||
}
|
||||
|
||||
|
||||
eap::method_mschapv2_base::method_mschapv2_base(_Inout_ method_mschapv2_base &&other) noexcept :
|
||||
m_cfg ( other.m_cfg ),
|
||||
m_cred ( other.m_cred ),
|
||||
m_cp (std::move(other.m_cp )),
|
||||
m_challenge_server(std::move(other.m_challenge_server)),
|
||||
m_challenge_client(std::move(other.m_challenge_client)),
|
||||
m_ident (std::move(other.m_ident )),
|
||||
m_nt_resp (std::move(other.m_nt_resp )),
|
||||
m_packet_res (std::move(other.m_packet_res )),
|
||||
method (std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_mschapv2_base& eap::method_mschapv2_base::operator=(_Inout_ method_mschapv2_base &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
|
||||
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method within same credentials only!
|
||||
(method&)*this = std::move(other );
|
||||
m_cp = std::move(other.m_cp );
|
||||
m_challenge_server = std::move(other.m_challenge_server);
|
||||
m_challenge_client = std::move(other.m_challenge_client);
|
||||
m_ident = std::move(other.m_ident );
|
||||
m_nt_resp = std::move(other.m_nt_resp );
|
||||
m_packet_res = std::move(other.m_packet_res );
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method_mschapv2_base::begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
@@ -209,21 +177,6 @@ eap::method_mschapv2::method_mschapv2(_In_ module &mod, _In_ config_method_mscha
|
||||
}
|
||||
|
||||
|
||||
eap::method_mschapv2::method_mschapv2(_Inout_ method_mschapv2 &&other) noexcept :
|
||||
method_mschapv2_base(std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_mschapv2& eap::method_mschapv2::operator=(_Inout_ method_mschapv2 &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other))
|
||||
(method_mschapv2_base&)*this = std::move(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
EapPeerMethodResponseAction eap::method_mschapv2::process_request_packet(
|
||||
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize)
|
||||
@@ -326,24 +279,6 @@ eap::method_mschapv2_diameter::method_mschapv2_diameter(_In_ module &mod, _In_ c
|
||||
}
|
||||
|
||||
|
||||
eap::method_mschapv2_diameter::method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other) noexcept :
|
||||
m_phase (std::move(other.m_phase)),
|
||||
method_mschapv2_base(std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_mschapv2_diameter& eap::method_mschapv2_diameter::operator=(_Inout_ method_mschapv2_diameter &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(method_mschapv2_base&)*this = std::move(other );
|
||||
m_phase = std::move(other.m_phase);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method_mschapv2_diameter::begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
|
Reference in New Issue
Block a user