- Doxygen documentation updated
- Some minor issues stumbled upon fixed - WIN1250 >> UTF-8
This commit is contained in:
@@ -24,32 +24,16 @@
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// Base class for configuration storage
|
||||
///
|
||||
class config;
|
||||
|
||||
///
|
||||
/// Base class for method configuration storage
|
||||
///
|
||||
class config_method;
|
||||
|
||||
///
|
||||
/// Base class for method with credentials
|
||||
///
|
||||
class config_method_with_cred;
|
||||
|
||||
///
|
||||
/// Provider configuration storage
|
||||
///
|
||||
class config_provider;
|
||||
|
||||
///
|
||||
/// Connection configuration storage
|
||||
///
|
||||
class config_connection;
|
||||
}
|
||||
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
@@ -65,7 +49,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(const eap::config &val);
|
||||
inline size_t pksizeof(_In_ const eap::config &val);
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
@@ -75,6 +59,8 @@ inline size_t pksizeof(const eap::config &val);
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val);
|
||||
|
||||
/// @}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Module.h"
|
||||
@@ -96,6 +82,15 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val);
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// \defgroup EAPBaseConfig Configuration
|
||||
/// Configuration management
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Base class for configuration storage
|
||||
///
|
||||
class config
|
||||
{
|
||||
public:
|
||||
@@ -139,17 +134,17 @@ namespace eap
|
||||
config& operator=(_Inout_ config &&other);
|
||||
|
||||
///
|
||||
/// Clones this configuration
|
||||
/// Clones this object
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
/// \returns Pointer to cloned object with identical data
|
||||
///
|
||||
virtual config* clone() const = 0;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
/// Save data to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
@@ -169,21 +164,21 @@ namespace eap
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
/// Packs this object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
/// Returns packed size of this object
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
/// Unpacks this object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
@@ -192,7 +187,7 @@ namespace eap
|
||||
/// @}
|
||||
|
||||
public:
|
||||
module &m_module; ///< EAP module
|
||||
module &m_module; ///< EAP module
|
||||
|
||||
protected:
|
||||
static const winstd::bstr namespace_eapmetadata; ///< Reusable BSTR containing "urn:ietf:params:xml:ns:yang:ietf-eap-metadata"
|
||||
@@ -202,6 +197,9 @@ namespace eap
|
||||
class credentials;
|
||||
|
||||
|
||||
///
|
||||
/// Base class for method configuration storage
|
||||
///
|
||||
class config_method : public config
|
||||
{
|
||||
public:
|
||||
@@ -264,50 +262,17 @@ namespace eap
|
||||
///
|
||||
config_method& operator=(_Inout_ config_method &&other);
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
@@ -335,6 +300,9 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Base class for method with credentials
|
||||
///
|
||||
class config_method_with_cred : public config_method
|
||||
{
|
||||
public:
|
||||
@@ -378,50 +346,17 @@ namespace eap
|
||||
///
|
||||
config_method_with_cred& operator=(_Inout_ config_method_with_cred &&other);
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
@@ -430,6 +365,9 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Provider configuration storage
|
||||
///
|
||||
class config_provider : public config
|
||||
{
|
||||
public:
|
||||
@@ -472,57 +410,19 @@ namespace eap
|
||||
///
|
||||
config_provider& operator=(_Inout_ config_provider &&other);
|
||||
|
||||
///
|
||||
/// Clones configuration
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
///
|
||||
virtual config* clone() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
@@ -555,6 +455,9 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Connection configuration storage
|
||||
///
|
||||
class config_connection : public config
|
||||
{
|
||||
public:
|
||||
@@ -603,62 +506,26 @@ namespace eap
|
||||
///
|
||||
config_connection& operator=(_Inout_ config_connection &&other);
|
||||
|
||||
///
|
||||
/// Clones configuration
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
///
|
||||
virtual config* clone() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
std::list<eap::config_provider> m_providers; ///< Provider configurations
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
|
||||
@@ -668,7 +535,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &
|
||||
}
|
||||
|
||||
|
||||
inline size_t pksizeof(const eap::config &val)
|
||||
inline size_t pksizeof(_In_ const eap::config &val)
|
||||
{
|
||||
return val.get_pk_size();
|
||||
}
|
||||
@@ -680,19 +547,43 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val)
|
||||
}
|
||||
|
||||
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a method status
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Method status to pack
|
||||
///
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config_method::status_t &val)
|
||||
{
|
||||
cursor << (unsigned char)val;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a method status
|
||||
///
|
||||
/// \param[in] val Method status to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(_In_ const eap::config_method::status_t &val)
|
||||
{
|
||||
return pksizeof((unsigned char)val);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a method status
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Method status to unpack to
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config_method::status_t &val)
|
||||
{
|
||||
cursor >> (unsigned char&)val;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
@@ -22,19 +22,8 @@
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// Base class for method credential storage
|
||||
///
|
||||
class credentials;
|
||||
|
||||
///
|
||||
/// Password based method credentials
|
||||
///
|
||||
class credentials_pass;
|
||||
|
||||
///
|
||||
/// Connection credentials
|
||||
///
|
||||
class credentials_connection;
|
||||
}
|
||||
|
||||
@@ -58,6 +47,15 @@ namespace eap
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// \defgroup EAPBaseCred Credentials
|
||||
/// Credential management
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Base class for method credential storage
|
||||
///
|
||||
class credentials : public config
|
||||
{
|
||||
public:
|
||||
@@ -127,50 +125,17 @@ namespace eap
|
||||
///
|
||||
virtual bool empty() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Storage
|
||||
@@ -240,7 +205,7 @@ namespace eap
|
||||
/// Combine credentials in the following order:
|
||||
///
|
||||
/// 1. Cached credentials
|
||||
/// 2. Configured credentials (if \p cfg is derived from config_method_with_cred)
|
||||
/// 2. Configured credentials (if \p cfg is derived from `config_method_with_cred`)
|
||||
/// 3. Stored credentials
|
||||
///
|
||||
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
|
||||
@@ -266,6 +231,9 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Password based method credentials
|
||||
///
|
||||
class credentials_pass : public credentials
|
||||
{
|
||||
public:
|
||||
@@ -319,110 +287,46 @@ namespace eap
|
||||
///
|
||||
credentials_pass& operator=(_Inout_ credentials_pass &&other);
|
||||
|
||||
///
|
||||
/// Clones credentials
|
||||
///
|
||||
/// \returns Pointer to cloned credentials
|
||||
///
|
||||
virtual config* clone() const;
|
||||
|
||||
///
|
||||
/// Resets credentials
|
||||
///
|
||||
virtual void clear();
|
||||
|
||||
///
|
||||
/// Test credentials if blank
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if blank
|
||||
/// - \c false otherwise
|
||||
///
|
||||
virtual bool empty() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Storage
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save credentials to Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||
/// \param[in] level Credential level (0=outer, 1=inner, 2=inner-inner...)
|
||||
///
|
||||
virtual void store(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level) const;
|
||||
|
||||
///
|
||||
/// Retrieve credentials from Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
|
||||
/// \param[in] level Credential level (0=outer, 1=inner, 2=inner-inner...)
|
||||
///
|
||||
virtual void retrieve(_In_z_ LPCTSTR pszTargetName, _In_ unsigned int level);
|
||||
|
||||
///
|
||||
/// Return target suffix for Windows Credential Manager credential name
|
||||
/// @copydoc eap::credentials::target_suffix()
|
||||
/// \returns This implementation always returns `_T("pass")`
|
||||
///
|
||||
virtual LPCTSTR target_suffix() const;
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Combine credentials in the following order:
|
||||
///
|
||||
/// 1. Cached credentials
|
||||
/// 2. Configured credentials (if \p cfg is derived from config_method_with_cred)
|
||||
/// 2. Configured credentials (if \p cfg is derived from `config_method_with_cred`)
|
||||
/// 3. Stored credentials
|
||||
///
|
||||
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
|
||||
/// \param[in] hTokenImpersonateUser Impersonation token for a logged-on user to collect user-related information
|
||||
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL, must be credentials_eaphost* type)
|
||||
/// \param[in] cfg Method configuration (unused, as must be as config_method_eaphost is not derived from config_method_with_cred)
|
||||
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL, must be `credentials_eaphost*` type)
|
||||
/// \param[in] cfg Method configuration (unused, as must be as config_method_eaphost is not derived from `config_method_with_cred`)
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
|
||||
///
|
||||
/// \returns
|
||||
@@ -438,8 +342,8 @@ namespace eap
|
||||
_In_opt_z_ LPCTSTR pszTargetName);
|
||||
|
||||
public:
|
||||
winstd::sanitizing_wstring m_password; ///< Password
|
||||
enc_alg_t m_enc_alg; ///< Encryption algorithm used for XML password keeping
|
||||
winstd::sanitizing_wstring m_password; ///< Password
|
||||
enc_alg_t m_enc_alg; ///< Encryption algorithm used for XML password keeping
|
||||
|
||||
private:
|
||||
/// \cond internal
|
||||
@@ -448,6 +352,9 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Connection credentials
|
||||
///
|
||||
class credentials_connection : public config
|
||||
{
|
||||
public:
|
||||
@@ -491,57 +398,19 @@ namespace eap
|
||||
///
|
||||
credentials_connection& operator=(_Inout_ credentials_connection &&other);
|
||||
|
||||
///
|
||||
/// Clones configuration
|
||||
///
|
||||
/// \returns Pointer to cloned configuration
|
||||
///
|
||||
virtual config* clone() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// \name XML management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
@@ -575,22 +444,47 @@ namespace eap
|
||||
std::wstring m_id; ///< Provider ID
|
||||
std::unique_ptr<credentials> m_cred; ///< Credentials
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a credential encryption algorithm ID
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Credential encryption algorithm ID to pack
|
||||
///
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::credentials_pass::enc_alg_t &val)
|
||||
{
|
||||
cursor << (unsigned char)val;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Returns packed size of a credential encryption algorithm ID
|
||||
///
|
||||
/// \param[in] val Credential encryption algorithm ID to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(_In_ const eap::credentials_pass::enc_alg_t &val)
|
||||
{
|
||||
return pksizeof((unsigned char)val);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unpacks a credential encryption algorithm ID
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Credential encryption algorithm ID to unpack to
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::credentials_pass::enc_alg_t &val)
|
||||
{
|
||||
cursor >> (unsigned char&)val;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
@@ -21,9 +21,18 @@
|
||||
#define IDR_EAP_KEY_PUBLIC 1
|
||||
#define IDR_EAP_KEY_PRIVATE 2
|
||||
|
||||
///
|
||||
/// \defgroup EAPBaseStream Memory Packaging
|
||||
/// Simple serialization/deserialization of data to/from memory opaque BLOBs
|
||||
///
|
||||
/// @{
|
||||
#ifndef EAP_ENCRYPT_BLOBS
|
||||
///
|
||||
/// Compiler variable to control whether BLOBs leaving our module get encrypted
|
||||
///
|
||||
#define EAP_ENCRYPT_BLOBS 1
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
#define _HOST_LOW_ENDIAN
|
||||
|
||||
@@ -42,15 +51,17 @@
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// Output BLOB cursor
|
||||
///
|
||||
struct cursor_out;
|
||||
struct cursor_in;
|
||||
|
||||
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_f;
|
||||
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_zf;
|
||||
|
||||
///
|
||||
/// Input BLOB cursor
|
||||
/// \defgroup EAPBaseSanitizing Sanitizing memory
|
||||
/// Secure memory erasing after use
|
||||
///
|
||||
struct cursor_in;
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Sanitizing dynamically allocated BLOB
|
||||
@@ -58,17 +69,7 @@ namespace eap
|
||||
typedef std::vector<unsigned char, winstd::sanitizing_allocator<unsigned char> > sanitizing_blob;
|
||||
|
||||
///
|
||||
/// Sanitizing BLOB of fixed size
|
||||
///
|
||||
template<size_t N> struct sanitizing_blob_f;
|
||||
|
||||
///
|
||||
/// Sanitizing BLOB of fixed size (zero initialized)
|
||||
///
|
||||
template<size_t N> struct sanitizing_blob_zf;
|
||||
|
||||
///
|
||||
/// Sanitizing BLOB of fixed size (zero initialized in _DEBUG version)
|
||||
/// Sanitizing BLOB of fixed size (zero initialized in _DEBUG version, non-initialized in release version)
|
||||
///
|
||||
#ifdef _DEBUG
|
||||
#define sanitizing_blob_xf sanitizing_blob_zf
|
||||
@@ -76,19 +77,13 @@ namespace eap
|
||||
#define sanitizing_blob_xf sanitizing_blob_f
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Diameter AVP flags
|
||||
///
|
||||
/// @}
|
||||
|
||||
/// \addtogroup EAPBaseDiameter
|
||||
/// @{
|
||||
|
||||
enum diameter_avp_flags_t;
|
||||
|
||||
///
|
||||
/// Diameter AVP header
|
||||
///
|
||||
struct diameter_avp_header;
|
||||
|
||||
///
|
||||
/// Diameter AVP header with Vendor-ID
|
||||
///
|
||||
struct diameter_avp_header_ven;
|
||||
|
||||
///
|
||||
@@ -124,8 +119,13 @@ namespace eap
|
||||
_In_bytecount_(size) const void *data,
|
||||
_In_ unsigned int size,
|
||||
_Inout_ sanitizing_blob &packet);
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a boolean
|
||||
///
|
||||
@@ -243,7 +243,7 @@ template<class _Elem, class _Traits, class _Ax> inline void operator<<(_Inout_ e
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||
template<class _Elem, class _Traits, class _Ax> inline size_t pksizeof(_In_ const std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||
|
||||
///
|
||||
/// Unpacks a string
|
||||
@@ -268,7 +268,7 @@ template<class _Traits, class _Ax> inline void operator<<(_Inout_ eap::cursor_ou
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline size_t pksizeof(const std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||
template<class _Traits, class _Ax> inline size_t pksizeof(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||
|
||||
///
|
||||
/// Unpacks a wide string
|
||||
@@ -293,7 +293,7 @@ template<class _Ty, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &c
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline size_t pksizeof(const std::vector<_Ty, _Ax> &val);
|
||||
template<class _Ty, class _Ax> inline size_t pksizeof(_In_ const std::vector<_Ty, _Ax> &val);
|
||||
|
||||
///
|
||||
/// Unpacks a vector
|
||||
@@ -318,7 +318,7 @@ template<class _Ty, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &c
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline size_t pksizeof(const std::list<_Ty, _Ax> &val);
|
||||
template<class _Ty, class _Ax> inline size_t pksizeof(_In_ const std::list<_Ty, _Ax> &val);
|
||||
|
||||
///
|
||||
/// Unpacks a list
|
||||
@@ -343,16 +343,9 @@ template<class _Ty, class _Dx> inline void operator<<(_Inout_ eap::cursor_out &c
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template<class _Ty, class _Dx> inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val);
|
||||
template<class _Ty, class _Dx> inline size_t pksizeof(_In_ const std::unique_ptr<_Ty, _Dx> &val);
|
||||
|
||||
/////
|
||||
///// Unpacks a std::unique_ptr
|
||||
/////
|
||||
///// \note Not generally unpackable, since we do not know, how to create a new instance of unique_ptr.
|
||||
/////
|
||||
///// \param[inout] cursor Memory cursor
|
||||
///// \param[out] val std::unique_ptr to unpack to
|
||||
/////
|
||||
// std::unique_ptr<> is generally not unpackable, since we do not know, how to create a new instance of unique_ptr.
|
||||
//template<class _Ty, class _Dx> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::unique_ptr<_Ty, _Dx> &val);
|
||||
|
||||
///
|
||||
@@ -370,7 +363,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(const winstd::cert_context &val);
|
||||
inline size_t pksizeof(_In_ const winstd::cert_context &val);
|
||||
|
||||
///
|
||||
/// Unpacks a certificate context
|
||||
@@ -395,7 +388,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::eap_t
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(const winstd::eap_type_t &val);
|
||||
inline size_t pksizeof(_In_ const winstd::eap_type_t &val);
|
||||
|
||||
///
|
||||
/// Unpacks an EAP method type
|
||||
@@ -480,6 +473,14 @@ inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val);
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &val);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// \defgroup EAPBaseConversion Data conversion
|
||||
/// Data conversion
|
||||
///
|
||||
/// @{
|
||||
|
||||
#ifndef htonll
|
||||
///
|
||||
/// Converts an unsigned __int64 from host to TCP/IP network byte order.
|
||||
@@ -492,7 +493,7 @@ inline unsigned __int64 htonll(unsigned __int64 val);
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Converts an 24-bit integer from host to TCP/IP network byte order.
|
||||
/// Converts a 24-bit integer from host to TCP/IP network byte order.
|
||||
///
|
||||
/// \param[in ] val A 24-bit unsigned number in host byte order
|
||||
/// \param[out] out A 24-bit unsigned number in network byte order
|
||||
@@ -500,7 +501,7 @@ inline unsigned __int64 htonll(unsigned __int64 val);
|
||||
inline void hton24(_In_ unsigned int val, _Out_ unsigned char out[3]);
|
||||
|
||||
///
|
||||
/// Converts an 24-bit integer from TCP/IP network to host byte order.
|
||||
/// Converts a 24-bit integer from TCP/IP network to host byte order.
|
||||
///
|
||||
/// \param[in] val A 24-bit unsigned number in network byte order
|
||||
///
|
||||
@@ -508,11 +509,19 @@ inline void hton24(_In_ unsigned int val, _Out_ unsigned char out[3]);
|
||||
///
|
||||
inline unsigned int ntoh24(_In_ const unsigned char val[3]);
|
||||
|
||||
/// @}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Output BLOB cursor
|
||||
///
|
||||
struct cursor_out
|
||||
{
|
||||
///
|
||||
@@ -525,6 +534,9 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Input BLOB cursor
|
||||
///
|
||||
struct cursor_in
|
||||
{
|
||||
///
|
||||
@@ -536,12 +548,18 @@ namespace eap
|
||||
ptr_type ptr_end; ///< Pointer to the end of BLOB
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
/// \addtogroup EAPBaseSanitizing
|
||||
/// @{
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
template<size_t N>
|
||||
struct __declspec(novtable) sanitizing_blob_f<N>
|
||||
///
|
||||
/// Sanitizing BLOB of fixed size
|
||||
///
|
||||
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_f<N>
|
||||
{
|
||||
unsigned char data[N]; ///< BLOB data
|
||||
|
||||
@@ -664,8 +682,11 @@ namespace eap
|
||||
}
|
||||
};
|
||||
|
||||
template<size_t N>
|
||||
struct __declspec(novtable) sanitizing_blob_zf<N> : sanitizing_blob_f<N>
|
||||
|
||||
///
|
||||
/// Sanitizing BLOB of fixed size (zero initialized)
|
||||
///
|
||||
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_zf<N> : sanitizing_blob_f<N>
|
||||
{
|
||||
///
|
||||
/// Constructor
|
||||
@@ -697,7 +718,17 @@ namespace eap
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// \defgroup EAPBaseDiameter Diameter
|
||||
/// Diameter authentication protocol
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Diameter AVP flags
|
||||
///
|
||||
#pragma warning(suppress: 4480)
|
||||
enum diameter_avp_flags_t : unsigned char {
|
||||
diameter_avp_flag_vendor = 0x80, ///< Vendor-ID present
|
||||
@@ -709,6 +740,9 @@ namespace eap
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
/// Diameter AVP header
|
||||
///
|
||||
struct diameter_avp_header
|
||||
{
|
||||
unsigned char code[4]; ///< AVP Code
|
||||
@@ -717,12 +751,17 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Diameter AVP header with Vendor-ID
|
||||
///
|
||||
struct diameter_avp_header_ven : public diameter_avp_header
|
||||
{
|
||||
unsigned char vendor[4]; ///< Vendor-ID
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
|
||||
@@ -842,7 +881,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_st
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
inline size_t pksizeof(_In_ const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
return sizeof(_Elem)*(val.length() + 1);
|
||||
}
|
||||
@@ -869,7 +908,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_st
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline size_t pksizeof(const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
inline size_t pksizeof(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
{
|
||||
return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL) + 1);
|
||||
}
|
||||
@@ -898,7 +937,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline size_t pksizeof(const std::vector<_Ty, _Ax> &val)
|
||||
inline size_t pksizeof(_In_ const std::vector<_Ty, _Ax> &val)
|
||||
{
|
||||
// Since we do not know wheter vector elements are primitives or objects, iterate instead of sizeof().
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
@@ -942,7 +981,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline size_t pksizeof(const std::list<_Ty, _Ax> &val)
|
||||
inline size_t pksizeof(_In_ const std::list<_Ty, _Ax> &val)
|
||||
{
|
||||
// Since we do not know wheter list elements are primitives or objects, iterate instead of sizeof().
|
||||
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||
@@ -981,7 +1020,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::unique_p
|
||||
|
||||
|
||||
template<class _Ty, class _Dx>
|
||||
inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val)
|
||||
inline size_t pksizeof(_In_ const std::unique_ptr<_Ty, _Dx> &val)
|
||||
{
|
||||
return
|
||||
val ?
|
||||
@@ -1007,7 +1046,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_
|
||||
}
|
||||
|
||||
|
||||
inline size_t pksizeof(const winstd::cert_context &val)
|
||||
inline size_t pksizeof(_In_ const winstd::cert_context &val)
|
||||
{
|
||||
return
|
||||
val ?
|
||||
|
@@ -29,39 +29,531 @@
|
||||
|
||||
namespace eapxml
|
||||
{
|
||||
///
|
||||
/// \defgroup EAPBaseXML XML DOM
|
||||
/// Easy interaction with MSXML
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Returns owner document object for a given node
|
||||
///
|
||||
/// \param[in ] pXmlNode XML node
|
||||
/// \param[out] ppXmlDoc XML document
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ winstd::com_obj<IXMLDOMDocument2> &ppXmlDoc);
|
||||
|
||||
///
|
||||
/// Selects single child node by name
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrNodeName XML node selection name
|
||||
/// \param[out] ppXmlNode Child XML node found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj<IXMLDOMNode> &ppXmlNode);
|
||||
|
||||
///
|
||||
/// Selects child nodes by name
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrNodeName XML node selection name
|
||||
/// \param[out] ppXmlNodes List of child XML nodes found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj<IXMLDOMNodeList> &ppXmlNodes);
|
||||
|
||||
///
|
||||
/// Selects single child element by name
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
|
||||
|
||||
///
|
||||
/// Creates a new element
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
|
||||
|
||||
///
|
||||
/// Creates a new child element if not already present
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementNameSelect XML element selection name
|
||||
/// \param[in ] bstrElementNameCreate XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[out] ppXmlElement XML element found or created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
|
||||
|
||||
///
|
||||
/// Tests if node has a parent set
|
||||
///
|
||||
/// \param[in] pXmlNode XML node
|
||||
///
|
||||
/// \returns
|
||||
/// - Non zero when \p pXmlNode has a parent set;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool has_parent(_In_ IXMLDOMNode *pXmlNode);
|
||||
|
||||
///
|
||||
/// Returns child element text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] pbstrValue XML element text
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] sValue XML element text
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Traits, class _Ax> inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element text converted to number
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] pdwValue XML element text converted to number
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD &pdwValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element text converted to boolean
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] pbValue XML element text converted to boolean
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool &pbValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element BLOB encoded as Base64 text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] aValue XML element BLOB
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Ty, class _Ax> inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element BLOB encoded as hexadecimal text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[out] aValue XML element BLOB
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Ty, class _Ax> inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element localizable text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[in ] pszLang Desired localization
|
||||
/// \param[out] pbstrValue XML element text
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns child element localizable text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrElementName XML element selection name
|
||||
/// \param[in ] pszLang Desired localization
|
||||
/// \param[out] sValue XML element text
|
||||
/// \param[out] ppXmlElement Child XML element found
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Traits, class _Ax> inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Creates a new child element
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj<IXMLDOMElement> &ppXmlElement);
|
||||
|
||||
///
|
||||
/// Creates a new child element with text
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[in ] bstrValue XML element text
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Creates a new child element with text converted from number
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[in ] dwValue XML element number
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Creates a new child element with text converted from boolean
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[in ] bValue XML element boolean
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Creates a new child element with Base64 encoded text from BLOB
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[in ] pValue Pointer to BLOB data
|
||||
/// \param[in ] nValueLen Size of \p pValue in bytes
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Creates a new child element with hexadecimal encoded text from BLOB
|
||||
///
|
||||
/// \param[in ] pDoc Owner XML document
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrElementName XML element name
|
||||
/// \param[in ] bstrNamespace XML element namespace
|
||||
/// \param[in ] pValue Pointer to BLOB data
|
||||
/// \param[in ] nValueLen Size of \p pValue in bytes
|
||||
/// \param[out] ppXmlElement XML element created
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
|
||||
|
||||
///
|
||||
/// Returns attribute text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute selection name
|
||||
/// \param[out] pbstrValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ winstd::bstr &pbstrValue);
|
||||
|
||||
///
|
||||
/// Returns attribute text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute selection name
|
||||
/// \param[out] sValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Traits, class _Ax> inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Returns attribute text converted to number
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute selection name
|
||||
/// \param[out] pdwValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD &pdwValue);
|
||||
|
||||
///
|
||||
/// Returns attribute text converted to boolean
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute selection name
|
||||
/// \param[out] pbValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool &pbValue);
|
||||
|
||||
///
|
||||
/// Returns attribute BLOB converted from Base64 encoded text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute selection name
|
||||
/// \param[out] aValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Ty, class _Ax> inline HRESULT get_attrib_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
|
||||
///
|
||||
/// Returns attribute BLOB converted from hexadecimal encoded text
|
||||
///
|
||||
/// \param[in ] pXmlParent Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute selection name
|
||||
/// \param[out] aValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
template<class _Ty, class _Ax> inline HRESULT get_attrib_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
|
||||
///
|
||||
/// Sets node attribute
|
||||
///
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute name
|
||||
/// \param[out] bstrValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_z_ const BSTR bstrValue);
|
||||
|
||||
///
|
||||
/// Sets node attribute converted from number
|
||||
///
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute name
|
||||
/// \param[out] dwValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ DWORD dwValue);
|
||||
|
||||
///
|
||||
/// Sets node attribute converted from boolean
|
||||
///
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute name
|
||||
/// \param[out] bValue XML atribute value
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ bool bValue);
|
||||
|
||||
///
|
||||
/// Sets node attribute to Base64 encoded text from BLOB
|
||||
///
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute name
|
||||
/// \param[in ] pValue Pointer to BLOB data
|
||||
/// \param[in ] nValueLen Size of \p pValue in bytes
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||
///
|
||||
/// Sets node attribute to hexadecimal encoded text from BLOB
|
||||
///
|
||||
/// \param[in ] pCurrentDOMNode Parent XML node
|
||||
/// \param[in ] bstrAttributeName XML attribute name
|
||||
/// \param[in ] pValue Pointer to BLOB data
|
||||
/// \param[in ] nValueLen Size of \p pValue in bytes
|
||||
///
|
||||
/// \returns
|
||||
/// - >0 if succeeded with warnings;
|
||||
/// - =0 (\c S_OK) if successful;
|
||||
/// - <0 if failed.
|
||||
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
|
||||
///
|
||||
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||
|
||||
///
|
||||
/// Builds XPath for a given node
|
||||
///
|
||||
/// \param[in] pXmlNode XML node
|
||||
///
|
||||
/// \returns String with XPath for a given node up to node terminal parent
|
||||
///
|
||||
inline std::wstring get_xpath(_In_ IXMLDOMNode *pXmlNode);
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
@@ -20,23 +20,8 @@
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// Method base class
|
||||
///
|
||||
class method;
|
||||
|
||||
///
|
||||
/// Tunnel method base class
|
||||
///
|
||||
/// This is a base class for all the methods that encapsulate inner methods to provide stacking framework.
|
||||
///
|
||||
class method_tunnel;
|
||||
|
||||
///
|
||||
/// EAP tunnel method
|
||||
///
|
||||
/// This method encapsulates inner data in EAP packets.
|
||||
///
|
||||
class method_eap;
|
||||
}
|
||||
|
||||
@@ -58,6 +43,15 @@ extern "C" {
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// \defgroup EAPBaseMethod Methods
|
||||
/// Methods
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Method base class
|
||||
///
|
||||
class method
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method)
|
||||
@@ -86,7 +80,7 @@ namespace eap
|
||||
///
|
||||
method& operator=(_Inout_ method &&other);
|
||||
|
||||
/// \name Packet processing
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
///
|
||||
@@ -94,6 +88,11 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
|
||||
///
|
||||
/// \param[in] dwFlags A combination of EAP flags that describe the new EAP authentication session behavior.
|
||||
/// \param[in] pAttributeArray A pointer to an array structure that specifies the EAP attributes of the entity to authenticate.
|
||||
/// \param[in] hTokenImpersonateUser Specifies a handle to the user impersonation token to use in this session.
|
||||
/// \param[in] dwMaxSendPacketSize Specifies the maximum size in bytes of an EAP packet sent during the session. If the method needs to send a packet larger than the maximum size, the method must accommodate fragmentation and reassembly.
|
||||
///
|
||||
virtual void begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
@@ -107,11 +106,21 @@ namespace eap
|
||||
///
|
||||
virtual void end_session();
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Processes a packet received by EapHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
/// \param[in] pReceivedPacket Received packet data
|
||||
/// \param[in] dwReceivedPacketSize \p pReceivedPacket size in bytes
|
||||
///
|
||||
/// \returns Action peer wants EapHost to do next.
|
||||
///
|
||||
virtual EapPeerMethodResponseAction process_request_packet(
|
||||
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize) = 0;
|
||||
@@ -121,20 +130,26 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||
///
|
||||
/// \param[out] packet Response packet
|
||||
/// \param[in] size_max The maximum size in bytes \p packet must not exceed. If the method needs to send a packet larger than the maximum size, the method must accommodate fragmentation and reassembly.
|
||||
///
|
||||
virtual void get_response_packet(
|
||||
_Out_ sanitizing_blob &packet,
|
||||
_In_opt_ DWORD size_max = MAXDWORD) = 0;
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Obtains the result of an authentication session from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
|
||||
///
|
||||
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
|
||||
/// \param[out] pResult A pointer to a structure that contains the authentication results.
|
||||
///
|
||||
virtual void get_result(
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Inout_ EapPeerMethodResult *pResult);
|
||||
|
||||
/// @}
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *pResult);
|
||||
|
||||
/// \name User Interaction
|
||||
/// @{
|
||||
@@ -146,9 +161,12 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerGetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363612.aspx)
|
||||
///
|
||||
/// \param[out] ppUIContextData A pointer to an address that contains a byte buffer with the supplicant user interface context data from EAPHost.
|
||||
/// \param[out] pdwUIContextDataSize A pointer to a value that specifies the size of the user interface context data byte buffer returned in \p ppUIContextData.
|
||||
///
|
||||
virtual void get_ui_context(
|
||||
_Inout_ BYTE **ppUIContextData,
|
||||
_Inout_ DWORD *pdwUIContextDataSize);
|
||||
_Out_ BYTE **ppUIContextData,
|
||||
_Out_ DWORD *pdwUIContextDataSize);
|
||||
|
||||
///
|
||||
/// Provides a user interface context to the EAP method.
|
||||
@@ -157,6 +175,11 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerSetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363626.aspx)
|
||||
///
|
||||
/// \param[in] pUIContextData A pointer to an address that contains a byte buffer with the new supplicant UI context data to set on EAPHost.
|
||||
/// \param[in] dwUIContextDataSize \p pUIContextData size in bytes
|
||||
///
|
||||
/// \returns Action peer wants EapHost to do next.
|
||||
///
|
||||
virtual EapPeerMethodResponseAction set_ui_context(
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ DWORD dwUIContextDataSize);
|
||||
@@ -171,13 +194,19 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
|
||||
///
|
||||
virtual void get_response_attributes(_Inout_ EapAttributes *pAttribs);
|
||||
/// \param[out] pAttribs A pointer to a structure that contains an array of EAP authentication response attributes for the supplicant.
|
||||
///
|
||||
virtual void get_response_attributes(_Out_ EapAttributes *pAttribs);
|
||||
|
||||
///
|
||||
/// Provides an updated array of EAP response attributes to the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
|
||||
///
|
||||
/// \param[in] pAttribs A pointer to a structure that contains an array of new EAP authentication response attributes to set for the supplicant on EAPHost.
|
||||
///
|
||||
/// \returns Action peer wants EapHost to do next.
|
||||
///
|
||||
virtual EapPeerMethodResponseAction set_response_attributes(_In_ const EapAttributes *pAttribs);
|
||||
|
||||
/// @}
|
||||
@@ -187,6 +216,11 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Tunnel method base class
|
||||
///
|
||||
/// This is a base class for all the methods that encapsulate inner methods to provide stacking framework.
|
||||
///
|
||||
class method_tunnel : public method
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_tunnel)
|
||||
@@ -216,77 +250,43 @@ namespace eap
|
||||
///
|
||||
method_tunnel& operator=(_Inout_ method_tunnel &&other);
|
||||
|
||||
/// \name Packet processing
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
|
||||
///
|
||||
virtual void begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_In_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
|
||||
|
||||
///
|
||||
/// Ends an EAP authentication session for the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||
///
|
||||
virtual void end_session();
|
||||
|
||||
///
|
||||
/// Processes a packet received by EapHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
/// @}
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
virtual EapPeerMethodResponseAction process_request_packet(
|
||||
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize);
|
||||
|
||||
///
|
||||
/// Obtains a response packet from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||
///
|
||||
virtual void get_response_packet(
|
||||
_Out_ sanitizing_blob &packet,
|
||||
_In_opt_ DWORD size_max = MAXDWORD);
|
||||
|
||||
///
|
||||
/// Obtains the result of an authentication session from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
|
||||
///
|
||||
virtual void get_result(
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Inout_ EapPeerMethodResult *pResult);
|
||||
|
||||
/// @}
|
||||
|
||||
virtual void get_result(
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *pResult);
|
||||
|
||||
/// \name User Interaction
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Obtains the user interface context from the EAP method.
|
||||
///
|
||||
/// \note This function is always followed by the `EapPeerInvokeInteractiveUI()` function, which is followed by the `EapPeerSetUIContext()` function.
|
||||
///
|
||||
/// \sa [EapPeerGetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363612.aspx)
|
||||
///
|
||||
virtual void get_ui_context(
|
||||
_Inout_ BYTE **ppUIContextData,
|
||||
_Inout_ DWORD *pdwUIContextDataSize);
|
||||
_Out_ BYTE **ppUIContextData,
|
||||
_Out_ DWORD *pdwUIContextDataSize);
|
||||
|
||||
///
|
||||
/// Provides a user interface context to the EAP method.
|
||||
///
|
||||
/// \note This function is called after the UI has been raised through the `EapPeerGetUIContext()` function.
|
||||
///
|
||||
/// \sa [EapPeerSetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363626.aspx)
|
||||
///
|
||||
virtual EapPeerMethodResponseAction set_ui_context(
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ DWORD dwUIContextDataSize);
|
||||
@@ -296,18 +296,8 @@ namespace eap
|
||||
/// \name EAP Response Attributes
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Obtains an array of EAP response attributes from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
|
||||
///
|
||||
virtual void get_response_attributes(_Inout_ EapAttributes *pAttribs);
|
||||
virtual void get_response_attributes(_Out_ EapAttributes *pAttribs);
|
||||
|
||||
///
|
||||
/// Provides an updated array of EAP response attributes to the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
|
||||
///
|
||||
virtual EapPeerMethodResponseAction set_response_attributes(_In_ const EapAttributes *pAttribs);
|
||||
|
||||
/// @}
|
||||
@@ -317,6 +307,11 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAP tunnel method
|
||||
///
|
||||
/// This method encapsulates inner data in EAP packets.
|
||||
///
|
||||
class method_eap : public method_tunnel
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_eap)
|
||||
@@ -350,26 +345,20 @@ namespace eap
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Processes a packet received by EapHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
virtual EapPeerMethodResponseAction process_request_packet(
|
||||
_In_bytecount_(dwReceivedPacketSize) const void *pReceivedPacket,
|
||||
_In_ DWORD dwReceivedPacketSize);
|
||||
|
||||
///
|
||||
/// Obtains a response packet from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||
///
|
||||
virtual void get_response_packet(
|
||||
_Out_ sanitizing_blob &packet,
|
||||
_In_opt_ DWORD size_max = MAXDWORD);
|
||||
|
||||
/// @}
|
||||
|
||||
protected:
|
||||
const winstd::eap_type_t m_eap_method; ///< EAP method type
|
||||
unsigned char m_id; ///< Request packet ID
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
@@ -20,18 +20,7 @@
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// EAP module base class
|
||||
///
|
||||
/// Provides basic services to EAP methods.
|
||||
///
|
||||
class module;
|
||||
|
||||
///
|
||||
/// EAP peer base class
|
||||
///
|
||||
/// A group of methods all EAP peers must or should implement.
|
||||
///
|
||||
class peer;
|
||||
}
|
||||
|
||||
@@ -58,6 +47,17 @@ extern "C" {
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// \defgroup EAPBaseModule Modules
|
||||
/// Modules
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// EAP module base class
|
||||
///
|
||||
/// Provides basic services to EAP methods.
|
||||
///
|
||||
class module
|
||||
{
|
||||
WINSTD_NONCOPYABLE(module)
|
||||
@@ -109,7 +109,9 @@ namespace eap
|
||||
void free_error_memory(_In_ EAP_ERROR *err);
|
||||
|
||||
///
|
||||
/// Makes a new method config
|
||||
/// Makes a new method configuration
|
||||
///
|
||||
/// \returns New method configuration
|
||||
///
|
||||
virtual config_method* make_config_method();
|
||||
|
||||
@@ -134,6 +136,7 @@ namespace eap
|
||||
/// Writes EAPMETHOD_TRACE_EVT_FN_CALL and returns auto event writer class
|
||||
///
|
||||
/// \param[in] pszFnName Function name
|
||||
/// \param[in] result Reference to function return variable
|
||||
///
|
||||
/// \returns A new auto event writer that writes EAPMETHOD_TRACE_EVT_FN_RETURN_DWORD event on destruction
|
||||
///
|
||||
@@ -228,6 +231,9 @@ namespace eap
|
||||
///
|
||||
/// If \c _DEBUG is set the value is masked.
|
||||
///
|
||||
/// \param[in] name Variable name
|
||||
/// \param[in] value Variable value
|
||||
///
|
||||
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_z_ LPCWSTR value) const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@@ -242,6 +248,10 @@ namespace eap
|
||||
///
|
||||
/// If \c _DEBUG is set the value is masked.
|
||||
///
|
||||
/// \param[in] name Variable name
|
||||
/// \param[in] data Variable data
|
||||
/// \param[in] size \p data size in bytes
|
||||
///
|
||||
inline void log_config_discrete(_In_z_ LPCWSTR name, _In_bytecount_(size) const void *data, _In_ ULONG size) const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@@ -254,6 +264,8 @@ namespace eap
|
||||
///
|
||||
/// Logs event
|
||||
///
|
||||
/// \param[in] EventDescriptor Event descriptor
|
||||
///
|
||||
inline void log_event(_In_ PCEVENT_DESCRIPTOR EventDescriptor, ...) const
|
||||
{
|
||||
va_list arg;
|
||||
@@ -273,7 +285,6 @@ namespace eap
|
||||
/// \param[in ] hProv Handle of cryptographics provider
|
||||
/// \param[in ] data Pointer to data to encrypt
|
||||
/// \param[in ] size Size of \p data in bytes
|
||||
/// \param[out] enc Encrypted data
|
||||
/// \param[out] hHash Handle of hashing object
|
||||
///
|
||||
/// \returns Encrypted data
|
||||
@@ -522,11 +533,6 @@ namespace eap
|
||||
/// \param[inout] record Object to unpack to
|
||||
/// \param[in ] pDataIn Pointer to encrypted BLOB
|
||||
/// \param[in ] dwDataInSize Size of \p pDataIn
|
||||
/// \param[out ] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
template<class T>
|
||||
void unpack(
|
||||
@@ -615,6 +621,11 @@ namespace eap
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// EAP peer base class
|
||||
///
|
||||
/// A group of methods all EAP peers must or should implement.
|
||||
///
|
||||
class peer : public module
|
||||
{
|
||||
WINSTD_NONCOPYABLE(peer)
|
||||
@@ -646,23 +657,43 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
|
||||
///
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] pConnectionData Connection data used for the EAP method. If set to \c NULL, the static property of the method, as configured in the registry, is returned.
|
||||
/// \param[in ] dwConnectionDataSize The size, in bytes, of the connection data buffer provided in \p pConnectionData.
|
||||
/// \param[in ] pUserData A pointer to a byte buffer that contains the opaque user data BLOB. This parameter can be \c NULL.
|
||||
/// \param[in ] dwUserDataSize The size, in bytes, of the user data buffer provided in \p pUserData.
|
||||
/// \param[out] ppUserDataOut A pointer to a pointer to the returned user data. The data is passed to \p EapPeerBeginSession() as input \p pUserData.
|
||||
/// \param[out] pdwUserDataOutSize Specifies the size, in bytes, of the \p ppUserDataOut buffer.
|
||||
/// \param[in ] hTokenImpersonateUser A handle to the user impersonation token to use in this session.
|
||||
/// \param[out] pfInvokeUI Returns \c TRUE if the user identity and user data blob aren't returned successfully, and the method seeks to collect the information from the user through the user interface dialog.
|
||||
/// \param[out] ppwszIdentity A pointer to the returned user identity. The pointer will be included in the identity response packet and returned to the server.
|
||||
///
|
||||
virtual void get_identity(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_Inout_ BYTE **ppUserDataOut,
|
||||
_Inout_ DWORD *pdwUserDataOutSize,
|
||||
_Out_ BYTE **ppUserDataOut,
|
||||
_Out_ DWORD *pdwUserDataOutSize,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_Inout_ BOOL *pfInvokeUI,
|
||||
_Inout_ WCHAR **ppwszIdentity) = 0;
|
||||
_Out_ BOOL *pfInvokeUI,
|
||||
_Out_ WCHAR **ppwszIdentity) = 0;
|
||||
|
||||
///
|
||||
/// Defines the implementation of an EAP method-specific function that retrieves the properties of an EAP method given the connection and user data.
|
||||
///
|
||||
/// \sa [EapPeerGetMethodProperties function](https://msdn.microsoft.com/en-us/library/windows/desktop/hh706636.aspx)
|
||||
///
|
||||
/// \param[in ] dwVersion The version number of the API.
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] hUserImpersonationToken A handle to the user impersonation token to use in this session.
|
||||
/// \param[in ] pConnectionData Connection data used for the EAP method. If set to \c NULL, the static property of the method, as configured in the registry, is returned.
|
||||
/// \param[in ] dwConnectionDataSize The size, in bytes, of the connection data buffer provided in \p pConnectionData.
|
||||
/// \param[in ] pUserData A pointer to a byte buffer that contains the opaque user data BLOB. This parameter can be \c NULL.
|
||||
/// \param[in ] dwUserDataSize The size, in bytes, of the user data buffer provided in \p pUserData.
|
||||
/// \param[out] pMethodPropertyArray A pointer to the method properties array. Caller should free the inner pointers using `EapHostPeerFreeMemory()` starting at the innermost pointer. The caller should free an \c empvtString value only when the type is \c empvtString.
|
||||
///
|
||||
virtual void get_method_properties(
|
||||
_In_ DWORD dwVersion,
|
||||
_In_ DWORD dwFlags,
|
||||
@@ -671,72 +702,107 @@ namespace eap
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_Inout_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray) = 0;
|
||||
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray) = 0;
|
||||
|
||||
///
|
||||
/// Converts XML into the configuration BLOB. The XML based credentials can come from group policy or from a system administrator.
|
||||
///
|
||||
/// \sa [EapPeerCredentialsXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363603.aspx)
|
||||
///
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] pConfigRoot A pointer to an XML node that contains credentials, which are either user or machine credentials depending on the configuration passed in. The XML document is created with the EapHostUserCredentials Schema.
|
||||
/// \param[in ] dwConnectionDataSize The size of the EAP SSO configuration data pointed to by \p pConnectionData, in bytes.
|
||||
/// \param[in ] pConnectionData A pointer to an opaque byte buffer that contains the EAP SSO configuration data BLOB.
|
||||
/// \param[out] ppCredentialsOut A pointer to the byte buffer that receives the credentials BLOB buffer generated by the input XML. The buffer can is of size \p pdwCredentialsOutSize. After consuming the data, this memory must be freed by calling `EapPeerFreeMemory()`.
|
||||
/// \param[out] pdwCredentialsOutSize The size, in bytes, of the buffer pointed to by \p ppCredentialsOut.
|
||||
///
|
||||
virtual void credentials_xml2blob(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ IXMLDOMNode *pConfigRoot,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_Inout_ BYTE **ppCredentialsOut,
|
||||
_Inout_ DWORD *pdwCredentialsOutSize) = 0;
|
||||
_Out_ BYTE **ppCredentialsOut,
|
||||
_Out_ DWORD *pdwCredentialsOutSize) = 0;
|
||||
|
||||
///
|
||||
/// Defines the implementation of an EAP method-specific function that obtains the EAP Single-Sign-On (SSO) credential input fields for an EAP method.
|
||||
///
|
||||
/// \sa [EapPeerQueryCredentialInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363622.aspx)
|
||||
///
|
||||
/// \param[in ] hUserImpersonationToken An impersonation token for the user whose credentials are to be requested and obtained.
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] dwConnectionDataSize The size of the EAP SSO configuration data pointed to by \p pConnectionData, in bytes.
|
||||
/// \param[in ] pConnectionData A pointer to an opaque byte buffer that contains the EAP SSO configuration data BLOB.
|
||||
/// \param[out] pEapConfigInputFieldsArray A Pointer to a structure that contains the input fields to display to the supplicant user. The `pwszData` fields in the individual `EAP_CONFIG_INPUT_FIELD_DATA` elements are initialized to \c NULL.
|
||||
///
|
||||
virtual void query_credential_input_fields(
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_Inout_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const;
|
||||
_Out_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const;
|
||||
|
||||
///
|
||||
/// Defines the implementation of an EAP method function that obtains the user BLOB data provided in an interactive Single-Sign-On (SSO) UI raised on the supplicant.
|
||||
///
|
||||
/// \sa [EapPeerQueryUserBlobFromCredentialInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204697.aspx)
|
||||
///
|
||||
/// \param[in ] hUserImpersonationToken An impersonation token for the user whose credentials are to be requested and obtained.
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] dwConnectionDataSize The size of the EAP SSO configuration data pointed to by \p pConnectionData, in bytes.
|
||||
/// \param[in ] pConnectionData A pointer to an opaque byte buffer that contains the EAP SSO configuration data BLOB.
|
||||
/// \param[in ] pEapConfigInputFieldArray A pointer to a structure that contains the input fields to display to the supplicant user. The `pwszData` fields in the individual `EAP_CONFIG_INPUT_FIELD_DATA` elements are initialized to \c NULL.
|
||||
/// \param[out] pdwUsersBlobSize A pointer to a buffer that contains the size, in bytes, of the opaque user configuration data BLOB in \p ppUserBlob.
|
||||
/// \param[out] ppUserBlob A pointer that contains the opaque user data BLOB.
|
||||
///
|
||||
virtual void query_user_blob_from_credential_input_fields(
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ const EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldArray,
|
||||
_Inout_ DWORD *pdwUsersBlobSize,
|
||||
_Inout_ BYTE **ppUserBlob) const;
|
||||
_Out_ DWORD *pdwUsersBlobSize,
|
||||
_Out_ BYTE **ppUserBlob) const;
|
||||
|
||||
///
|
||||
/// Defines the implementation of an EAP method API that provides the input fields for interactive UI components to be raised on the supplicant.
|
||||
///
|
||||
/// \sa [EapPeerQueryInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204695.aspx)
|
||||
///
|
||||
/// \param[in ] dwVersion The version number of the API.
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] dwUIContextDataSize The size of the context data in \p pUIContextData, in bytes.
|
||||
/// \param[in ] pUIContextData A pointer to a BLOB that contains UI context data, represented as inner pointers to field data. The supplicant obtained these inner pointers from EAPHost run-time APIs.
|
||||
/// \param[out] pEapInteractiveUIData Pointer that receives a structure that contains configuration information for interactive UI components raised on an EAP supplicant.
|
||||
///
|
||||
virtual void query_interactive_ui_input_fields(
|
||||
_In_ DWORD dwVersion,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwUIContextDataSize,
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_Inout_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const;
|
||||
_Out_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const;
|
||||
|
||||
///
|
||||
/// Converts user information into a user BLOB that can be consumed by EapHost run-time functions.
|
||||
///
|
||||
/// \sa [EapPeerQueryUIBlobFromInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204696.aspx)
|
||||
///
|
||||
/// \param[in ] dwVersion The version number of the API.
|
||||
/// \param[in ] dwFlags A combination of EAP flags that describe the EAP authentication session behavior.
|
||||
/// \param[in ] dwUIContextDataSize The size of the context data in \p pUIContextData, in bytes.
|
||||
/// \param[in ] pUIContextData A pointer to a BLOB that contains UI context data, represented as inner pointers to field data. The supplicant obtained these inner pointers from EAPHost run-time APIs.
|
||||
/// \param[in ] pEapInteractiveUIData Pointer with a structure that contains configuration information for interactive user interface components raised on an EAP supplicant.
|
||||
/// \param[out] pdwDataFromInteractiveUISize A pointer to a `DWORD` that specifies the size of the buffer pointed to by the \p ppDataFromInteractiveUI parameter, in bytes. If this value is not set to \c 0, then a pointer to a buffer of the size specified in this parameter must be supplied in the \p ppDataFromInteractiveUI parameter.
|
||||
/// \param[out] ppDataFromInteractiveUI A pointer that receives a credentials BLOB that can be used in authentication. The caller should free the inner pointers using the function \p EapPeerFreeMemory(), starting at the innermost pointer. If a non-NULL value is supplied for this parameter, meaning that an existing data BLOB is passed to it, the supplied data BLOB will be updated and returned in this parameter.
|
||||
///
|
||||
virtual void query_ui_blob_from_interactive_ui_input_fields(
|
||||
_In_ DWORD dwVersion,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwUIContextDataSize,
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
|
||||
_Inout_ DWORD *pdwDataFromInteractiveUISize,
|
||||
_Inout_ BYTE **ppDataFromInteractiveUI) const;
|
||||
_Out_ DWORD *pdwDataFromInteractiveUISize,
|
||||
_Out_ BYTE **ppDataFromInteractiveUI) const;
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
@@ -746,6 +812,15 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
|
||||
///
|
||||
/// \param[in] dwFlags A combination of EAP flags that describe the new EAP authentication session behavior.
|
||||
/// \param[in] pAttributeArray A pointer to an array structure that specifies the EAP attributes of the entity to authenticate.
|
||||
/// \param[in] hTokenImpersonateUser Specifies a handle to the user impersonation token to use in this session.
|
||||
/// \param[in] pConnectionData Connection data specific to this method used to decide the user data returned from this API, where the user data depends on certain connection data configuration. When this parameter is NULL the method implementation should use default values for connection.
|
||||
/// \param[in] dwConnectionDataSize Specifies the size, in bytes, of the connection data buffer provided in \p pConnectionData.
|
||||
/// \param[in] pUserData A pointer to a byte buffer that contains the opaque user data BLOB.
|
||||
/// \param[in] dwUserDataSize Specifies the size in bytes of the user data buffer provided in \p pUserData.
|
||||
/// \param[in] dwMaxSendPacketSize Specifies the maximum size in bytes of an EAP packet sent during the session. If the method needs to send a packet larger than the maximum size, the method must accommodate fragmentation and reassembly.
|
||||
///
|
||||
/// \returns Session handle
|
||||
///
|
||||
virtual EAP_SESSION_HANDLE begin_session(
|
||||
@@ -763,13 +838,25 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||
///
|
||||
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
///
|
||||
virtual void end_session(_In_ EAP_SESSION_HANDLE hSession) = 0;
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Processes a packet received by EapHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[in] pReceivedPacket Received packet data
|
||||
/// \param[in] dwReceivedPacketSize \p pReceivedPacket size in bytes
|
||||
/// \param[in] pEapOutput A pointer to a structure that contains the output of the packet process operation.
|
||||
///
|
||||
virtual void process_request_packet(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
@@ -781,20 +868,33 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||
///
|
||||
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[inout] pSendPacket A pointer to a structure that contains the response packet.
|
||||
/// \param[inout] pdwSendPacketSize A pointer to a value that contains the size in bytes of the buffer allocated for the response packet. On return, this parameter receives a pointer to the actual size in bytes of \p pSendPacket.
|
||||
///
|
||||
virtual void get_response_packet(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||
_Inout_ DWORD *pdwSendPacketSize) = 0;
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Obtains the result of an authentication session from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
|
||||
///
|
||||
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
|
||||
/// \param[out] pResult A pointer to a structure that contains the authentication results.
|
||||
///
|
||||
virtual void get_result(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Inout_ EapPeerMethodResult *pResult) = 0;
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *pResult) = 0;
|
||||
|
||||
/// \name User Interaction
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Obtains the user interface context from the EAP method.
|
||||
@@ -803,10 +903,14 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerGetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363612.aspx)
|
||||
///
|
||||
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[out] ppUIContextData A pointer to an address that contains a byte buffer with the supplicant user interface context data from EAPHost.
|
||||
/// \param[out] pdwUIContextDataSize A pointer to a value that specifies the size of the user interface context data byte buffer returned in \p ppUIContextData.
|
||||
///
|
||||
virtual void get_ui_context(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Inout_ BYTE **ppUIContextData,
|
||||
_Inout_ DWORD *pdwUIContextDataSize) = 0;
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Out_ BYTE **ppUIContextData,
|
||||
_Out_ DWORD *pdwUIContextDataSize) = 0;
|
||||
|
||||
///
|
||||
/// Provides a user interface context to the EAP method.
|
||||
@@ -815,26 +919,43 @@ namespace eap
|
||||
///
|
||||
/// \sa [EapPeerSetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363626.aspx)
|
||||
///
|
||||
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[in] pUIContextData A pointer to an address that contains a byte buffer with the new supplicant UI context data to set on EAPHost.
|
||||
/// \param[in] dwUIContextDataSize \p pUIContextData size in bytes
|
||||
/// \param[in] pEapOutput A pointer to a structure that contains the output of the packet process operation.
|
||||
///
|
||||
virtual void set_ui_context(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ DWORD dwUIContextDataSize,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput) = 0;
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name EAP Response Attributes
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Obtains an array of EAP response attributes from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
|
||||
///
|
||||
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[out] pAttribs A pointer to a structure that contains an array of EAP authentication response attributes for the supplicant.
|
||||
///
|
||||
virtual void get_response_attributes(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Inout_ EapAttributes *pAttribs) = 0;
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Out_ EapAttributes *pAttribs) = 0;
|
||||
|
||||
///
|
||||
/// Provides an updated array of EAP response attributes to the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
|
||||
///
|
||||
/// \param[in] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
|
||||
/// \param[in] pAttribs A pointer to a structure that contains an array of new EAP authentication response attributes to set for the supplicant on EAPHost.
|
||||
/// \param[in] pEapOutput A pointer to a structure that contains the output of the packet process operation.
|
||||
///
|
||||
virtual void set_response_attributes(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_ const EapAttributes *pAttribs,
|
||||
@@ -842,4 +963,6 @@ namespace eap
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
Reference in New Issue
Block a user