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:
Simon Rozman 2020-01-22 09:23:46 +01:00
parent a75008891b
commit 9e9648c924
14 changed files with 0 additions and 497 deletions

View File

@ -54,8 +54,6 @@ namespace eap
///
class method
{
WINSTD_NONCOPYABLE(method)
public:
///
/// Constructs a method
@ -64,22 +62,6 @@ namespace eap
///
method(_In_ module &mod);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
method(_Inout_ method &&other) noexcept;
///
/// Moves a method
///
/// \param[in] other Method to move from
///
/// \returns Reference to this object
///
method& operator=(_Inout_ method &&other) noexcept;
/// \name Session management
/// @{
@ -220,8 +202,6 @@ namespace eap
///
class method_tunnel : public method
{
WINSTD_NONCOPYABLE(method_tunnel)
public:
///
/// Constructs a method
@ -231,22 +211,6 @@ namespace eap
///
method_tunnel(_In_ module &mod, _In_ method *inner);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
method_tunnel(_Inout_ method_tunnel &&other) noexcept;
///
/// Moves a method
///
/// \param[in] other Method to move from
///
/// \returns Reference to this object
///
method_tunnel& operator=(_Inout_ method_tunnel &&other) noexcept;
/// \name Session management
/// @{
@ -309,8 +273,6 @@ namespace eap
///
class method_eap : public method_tunnel
{
WINSTD_NONCOPYABLE(method_eap)
public:
///
/// Constructs a method
@ -321,22 +283,6 @@ namespace eap
///
method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method, _In_ method *inner);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
method_eap(_Inout_ method_eap &&other) noexcept;
///
/// Moves a method
///
/// \param[in] other Method to move from
///
/// \returns Reference to this object
///
method_eap& operator=(_Inout_ method_eap &&other) noexcept;
/// \name Session management
/// @{

View File

@ -57,8 +57,6 @@ namespace eap
///
class module
{
WINSTD_NONCOPYABLE(module)
public:
///
/// Constructs a module for the given EAP type
@ -726,8 +724,6 @@ namespace eap
///
class peer : public module
{
WINSTD_NONCOPYABLE(peer)
public:
///
/// Constructs a EAP peer module for the given EAP type

View File

@ -34,22 +34,6 @@ eap::method::method(_In_ module &mod) :
}
eap::method::method(_Inout_ method &&other) noexcept :
m_module(other.m_module)
{
}
eap::method& eap::method::operator=(_Inout_ method &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Move method within same module only!
}
return *this;
}
void eap::method::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
@ -126,24 +110,6 @@ eap::method_tunnel::method_tunnel(_In_ module &mod, _In_ method *inner) :
}
eap::method_tunnel::method_tunnel(_Inout_ method_tunnel &&other) noexcept :
m_inner(std::move(other.m_inner)),
method (std::move(other ))
{
}
eap::method_tunnel& eap::method_tunnel::operator=(_Inout_ method_tunnel &&other) noexcept
{
if (this != std::addressof(other)) {
(method&)*this = std::move(other );
m_inner = std::move(other.m_inner);
}
return *this;
}
void eap::method_tunnel::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
@ -240,28 +206,6 @@ eap::method_eap::method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method
}
eap::method_eap::method_eap(_Inout_ method_eap &&other) noexcept :
m_eap_method ( other.m_eap_method ),
m_id (std::move(other.m_id )),
m_send_nak (std::move(other.m_send_nak )),
method_tunnel(std::move(other ))
{
}
eap::method_eap& eap::method_eap::operator=(_Inout_ method_eap &&other) noexcept
{
if (this != std::addressof(other)) {
assert(m_eap_method == other.m_eap_method); // Move method within same EAP method type only!
(method_tunnel&)*this = std::move(other );
m_id = std::move(other.m_id );
m_send_nak = std::move(other.m_send_nak);
}
return *this;
}
void eap::method_eap::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,

View File

@ -44,8 +44,6 @@ namespace eap
///
class method_eaphost : public method
{
WINSTD_NONCOPYABLE(method_eaphost)
public:
///
/// Constructs an EAP method
@ -56,22 +54,6 @@ namespace eap
///
method_eaphost(_In_ module &mod, _In_ config_method_eaphost &cfg, _In_ credentials_eaphost &cred);
///
/// Moves an EAP method
///
/// \param[in] other EAP method to move from
///
method_eaphost(_Inout_ method_eaphost &&other) noexcept;
///
/// Moves an EAP method
///
/// \param[in] other EAP method to move from
///
/// \returns Reference to this object
///
method_eaphost& operator=(_Inout_ method_eaphost &&other) noexcept;
/// \name Session management
/// @{

View File

@ -37,28 +37,6 @@ eap::method_eaphost::method_eaphost(_In_ module &mod, _In_ config_method_eaphost
}
eap::method_eaphost::method_eaphost(_Inout_ method_eaphost &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_session_id(std::move(other.m_session_id)),
method (std::move(other ))
{
}
eap::method_eaphost& eap::method_eaphost::operator=(_Inout_ method_eaphost &&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_session_id = std::move(other.m_session_id);
}
return *this;
}
void eap::method_eaphost::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,

View File

@ -40,8 +40,6 @@ namespace eap
///
class method_gtc : public method
{
WINSTD_NONCOPYABLE(method_gtc)
public:
///
/// Constructs a GTC method
@ -52,22 +50,6 @@ namespace eap
///
method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _In_ credentials &cred);
///
/// Moves a GTC method
///
/// \param[in] other GTC method to move from
///
method_gtc(_Inout_ method_gtc &&other) noexcept;
///
/// Moves a GTC method
///
/// \param[in] other GTC method to move from
///
/// \returns Reference to this object
///
method_gtc& operator=(_Inout_ method_gtc &&other) noexcept;
/// \name Session management
/// @{

View File

@ -36,30 +36,6 @@ eap::method_gtc::method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _I
}
eap::method_gtc::method_gtc(_Inout_ method_gtc &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_challenge(std::move(other.m_challenge)),
m_response (std::move(other.m_response )),
method (std::move(other ))
{
}
eap::method_gtc& eap::method_gtc::operator=(_Inout_ method_gtc &&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_challenge = std::move(other.m_challenge);
m_response = std::move(other.m_response );
}
return *this;
}
void eap::method_gtc::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,

View File

@ -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
/// @{

View File

@ -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,

View File

@ -41,8 +41,6 @@ namespace eap
///
class method_pap_diameter : public method
{
WINSTD_NONCOPYABLE(method_pap_diameter)
public:
///
/// Constructs a PAP method
@ -53,22 +51,6 @@ namespace eap
///
method_pap_diameter(_In_ module &mod, _In_ config_method_pap &cfg, _In_ credentials_pass &cred);
///
/// Moves a PAP method
///
/// \param[in] other PAP method to move from
///
method_pap_diameter(_Inout_ method_pap_diameter &&other) noexcept;
///
/// Moves a PAP method
///
/// \param[in] other PAP method to move from
///
/// \returns Reference to this object
///
method_pap_diameter& operator=(_Inout_ method_pap_diameter &&other) noexcept;
/// \name Session management
/// @{

View File

@ -37,30 +37,6 @@ eap::method_pap_diameter::method_pap_diameter(_In_ module &mod, _In_ config_meth
}
eap::method_pap_diameter::method_pap_diameter(_Inout_ method_pap_diameter &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_phase (std::move(other.m_phase )),
m_packet_res(std::move(other.m_packet_res)),
method (std::move(other ))
{
}
eap::method_pap_diameter& eap::method_pap_diameter::operator=(_Inout_ method_pap_diameter &&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_phase = std::move(other.m_phase );
m_packet_res = std::move(other.m_packet_res);
}
return *this;
}
void eap::method_pap_diameter::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,

View File

@ -46,8 +46,6 @@ namespace eap
///
class method_defrag : public method_tunnel
{
WINSTD_NONCOPYABLE(method_defrag)
public:
#pragma warning(push)
#pragma warning(disable: 4480)
@ -88,22 +86,6 @@ namespace eap
///
method_defrag(_In_ module &mod, _In_ method *inner);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
method_defrag(_Inout_ method_defrag &&other) noexcept;
///
/// Moves a method
///
/// \param[in] other Method to move from
///
/// \returns Reference to this object
///
method_defrag& operator=(_Inout_ method_defrag &&other) noexcept;
/// \name Session management
/// @{
@ -150,22 +132,6 @@ namespace eap
///
method_eapmsg(_In_ module &mod, _In_ const wchar_t *identity, _In_ method *inner);
///
/// Moves a method
///
/// \param[in] other Method to move from
///
method_eapmsg(_Inout_ method_eapmsg &&other) noexcept;
///
/// Moves a method
///
/// \param[in] other Method to move from
///
/// \returns Reference to this object
///
method_eapmsg& operator=(_Inout_ method_eapmsg &&other) noexcept;
/// \name Session management
/// @{
@ -211,8 +177,6 @@ namespace eap
///
class method_ttls : public method_tunnel
{
WINSTD_NONCOPYABLE(method_ttls)
public:
///
/// Constructs an TTLS method
@ -224,22 +188,6 @@ namespace eap
///
method_ttls(_In_ module &mod, _In_ config_method_ttls &cfg, _In_ credentials_ttls &cred, _In_ method *inner);
///
/// Moves a TTLS method
///
/// \param[in] other TTLS method to move from
///
method_ttls(_Inout_ method_ttls &&other) noexcept;
///
/// Moves a TTLS method
///
/// \param[in] other TTLS method to move from
///
/// \returns Reference to this object
///
method_ttls& operator=(_Inout_ method_ttls &&other) noexcept;
/// \name Session management
/// @{

View File

@ -41,8 +41,6 @@ namespace eap
///
class peer_ttls : public peer
{
WINSTD_NONCOPYABLE(peer_ttls)
public:
///
/// Constructs a EAP-TTLS peer module

View File

@ -37,28 +37,6 @@ eap::method_defrag::method_defrag(_In_ module &mod, _In_ method *inner) :
}
eap::method_defrag::method_defrag(_Inout_ method_defrag &&other) noexcept :
m_data_req (std::move(other.m_data_req)),
m_data_res (std::move(other.m_data_res)),
m_send_res (std::move(other.m_send_res)),
method_tunnel(std::move(other ))
{
}
eap::method_defrag& eap::method_defrag::operator=(_Inout_ method_defrag &&other) noexcept
{
if (this != std::addressof(other)) {
(method_tunnel&)*this = std::move(other );
m_data_req = std::move(other.m_data_req);
m_data_res = std::move(other.m_data_res);
m_send_res = std::move(other.m_send_res);
}
return *this;
}
void eap::method_defrag::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
@ -181,28 +159,6 @@ eap::method_eapmsg::method_eapmsg(_In_ module &mod, _In_ const wchar_t *identity
}
eap::method_eapmsg::method_eapmsg(_Inout_ method_eapmsg &&other) noexcept :
m_identity (std::move(other.m_identity )),
m_phase (std::move(other.m_phase )),
m_packet_res (std::move(other.m_packet_res)),
method_tunnel(std::move(other ))
{
}
eap::method_eapmsg& eap::method_eapmsg::operator=(_Inout_ method_eapmsg &&other) noexcept
{
if (this != std::addressof(other)) {
(method_tunnel&)*this = std::move(other );
m_identity = std::move(other.m_identity );
m_phase = std::move(other.m_phase );
m_packet_res = std::move(other.m_packet_res);
}
return *this;
}
void eap::method_eapmsg::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
@ -349,48 +305,6 @@ eap::method_ttls::method_ttls(_In_ module &mod, _In_ config_method_ttls &cfg, _I
}
eap::method_ttls::method_ttls(_Inout_ method_ttls &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_user_ctx (std::move(other.m_user_ctx )),
m_sc_target_name (std::move(other.m_sc_target_name )),
m_sc_cred (std::move(other.m_sc_cred )),
m_sc_queue (std::move(other.m_sc_queue )),
m_sc_ctx (std::move(other.m_sc_ctx )),
m_sc_cert (std::move(other.m_sc_cert )),
m_phase (std::move(other.m_phase )),
m_packet_res (std::move(other.m_packet_res )),
m_packet_res_inner(std::move(other.m_packet_res_inner)),
m_eap_attr (std::move(other.m_eap_attr )),
method_tunnel (std::move(other ))
{
m_eap_attr_desc.dwNumberOfAttributes = (DWORD)m_eap_attr.size();
m_eap_attr_desc.pAttribs = m_eap_attr.data();
}
eap::method_ttls& eap::method_ttls::operator=(_Inout_ method_ttls &&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_tunnel&)*this = std::move(other );
m_user_ctx = std::move(other.m_user_ctx );
m_sc_target_name = std::move(other.m_sc_target_name );
m_sc_cred = std::move(other.m_sc_cred );
m_sc_queue = std::move(other.m_sc_queue );
m_sc_ctx = std::move(other.m_sc_ctx );
m_sc_cert = std::move(other.m_sc_cert );
m_phase = std::move(other.m_phase );
m_packet_res = std::move(other.m_packet_res );
m_packet_res_inner = std::move(other.m_packet_res_inner);
m_eap_attr = std::move(other.m_eap_attr );
}
return *this;
}
void eap::method_ttls::begin_session(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,