Some EapHost peer helper classes introduced
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "Common.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <eaphostpeerconfigapis.h>
|
||||
#include <eaptypes.h> // Must include after <Windows.h>
|
||||
|
||||
namespace winstd
|
||||
@@ -38,6 +39,16 @@ namespace winstd
|
||||
///
|
||||
enum eap_type_t;
|
||||
|
||||
///
|
||||
/// Deleter for unique_ptr using EapHostPeerFreeMemory
|
||||
///
|
||||
struct WINSTD_API EapHostPeerFreeMemory_delete;
|
||||
|
||||
///
|
||||
/// Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeEapError
|
||||
///
|
||||
struct WINSTD_API EapHostPeerFreeErrorMemory_delete;
|
||||
|
||||
///
|
||||
/// EAP_ATTRIBUTE wrapper class
|
||||
///
|
||||
@@ -53,6 +64,11 @@ namespace winstd
|
||||
///
|
||||
class WINSTD_API eap_packet;
|
||||
|
||||
///
|
||||
/// EAP_METHOD_INFO_ARRAY wrapper class
|
||||
///
|
||||
class WINSTD_API eap_method_info_array;
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
@@ -87,6 +103,40 @@ namespace winstd
|
||||
};
|
||||
|
||||
|
||||
struct WINSTD_API EapHostPeerFreeMemory_delete
|
||||
{
|
||||
///
|
||||
/// Default constructor
|
||||
///
|
||||
EapHostPeerFreeMemory_delete() {}
|
||||
|
||||
///
|
||||
/// Delete a pointer
|
||||
///
|
||||
void operator()(BYTE *_Ptr) const
|
||||
{
|
||||
EapHostPeerFreeMemory(_Ptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct WINSTD_API EapHostPeerFreeErrorMemory_delete
|
||||
{
|
||||
///
|
||||
/// Default constructor
|
||||
///
|
||||
EapHostPeerFreeErrorMemory_delete() {}
|
||||
|
||||
///
|
||||
/// Delete a pointer
|
||||
///
|
||||
void operator()(EAP_ERROR *_Ptr) const
|
||||
{
|
||||
EapHostPeerFreeErrorMemory(_Ptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class WINSTD_API __declspec(novtable) eap_attr : public EAP_ATTRIBUTE
|
||||
{
|
||||
public:
|
||||
@@ -304,4 +354,60 @@ namespace winstd
|
||||
///
|
||||
virtual handle_type duplicate_internal(_In_ handle_type h) const;
|
||||
};
|
||||
|
||||
|
||||
class WINSTD_API __declspec(novtable) eap_method_info_array : public EAP_METHOD_INFO_ARRAY
|
||||
{
|
||||
WINSTD_NONCOPYABLE(eap_method_info_array)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs an empty array
|
||||
///
|
||||
inline eap_method_info_array()
|
||||
{
|
||||
dwNumberOfMethods = 0;
|
||||
pEapMethods = NULL;
|
||||
}
|
||||
|
||||
///
|
||||
/// Move constructor
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline eap_method_info_array(_Inout_ eap_method_info_array &&other)
|
||||
{
|
||||
dwNumberOfMethods = other.dwNumberOfMethods;
|
||||
pEapMethods = other.pEapMethods;
|
||||
other.dwNumberOfMethods = 0;
|
||||
other.pEapMethods = NULL;
|
||||
}
|
||||
|
||||
///
|
||||
/// Destructor
|
||||
///
|
||||
~eap_method_info_array();
|
||||
|
||||
///
|
||||
/// Move assignment
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline eap_method_info_array& operator=(_Inout_ eap_method_info_array &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
if (pEapMethods)
|
||||
free_internal();
|
||||
dwNumberOfMethods = other.dwNumberOfMethods;
|
||||
pEapMethods = other.pEapMethods;
|
||||
other.dwNumberOfMethods = 0;
|
||||
other.pEapMethods = NULL;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
void free_internal();
|
||||
static void free_internal(_In_ EAP_METHOD_INFO *pMethodInfo);
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user