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:
@@ -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
|
||||
/// @{
|
||||
|
||||
|
@@ -41,8 +41,6 @@ namespace eap
|
||||
///
|
||||
class peer_ttls : public peer
|
||||
{
|
||||
WINSTD_NONCOPYABLE(peer_ttls)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a EAP-TTLS peer module
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user