eap::config split to eap::config and eap::packable
This commit is contained in:
@@ -31,36 +31,6 @@ namespace eap
|
||||
class config_connection;
|
||||
}
|
||||
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val);
|
||||
|
||||
///
|
||||
/// Returns packed size of a configuration
|
||||
///
|
||||
/// \param[in] val Configuration to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(_In_ const eap::config &val);
|
||||
|
||||
///
|
||||
/// Unpacks a configuration
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Configuration to unpack to
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val);
|
||||
|
||||
/// @}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Module.h"
|
||||
@@ -89,9 +59,9 @@ namespace eap
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Base class for configuration storage
|
||||
/// Base class for packable and XML-exportable storage
|
||||
///
|
||||
class config
|
||||
class config : public packable
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -160,32 +130,6 @@ namespace eap
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs this object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of this object
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks this object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
module &m_module; ///< EAP module
|
||||
|
||||
@@ -530,24 +474,6 @@ namespace eap
|
||||
}
|
||||
|
||||
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val)
|
||||
{
|
||||
val.operator<<(cursor);
|
||||
}
|
||||
|
||||
|
||||
inline size_t pksizeof(_In_ const eap::config &val)
|
||||
{
|
||||
return val.get_pk_size();
|
||||
}
|
||||
|
||||
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val)
|
||||
{
|
||||
val.operator>>(cursor);
|
||||
}
|
||||
|
||||
|
||||
/// \addtogroup EAPBaseStream
|
||||
/// @{
|
||||
|
||||
|
@@ -80,6 +80,8 @@ namespace eap
|
||||
struct cursor_out;
|
||||
struct cursor_in;
|
||||
|
||||
class packable;
|
||||
|
||||
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_f;
|
||||
template<size_t N> struct WINSTD_NOVTABLE sanitizing_blob_zf;
|
||||
|
||||
@@ -499,6 +501,31 @@ inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val);
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &val);
|
||||
|
||||
///
|
||||
/// Packs a packable object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Object to pack
|
||||
///
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::packable &val);
|
||||
|
||||
///
|
||||
/// Returns packed size of a packable object
|
||||
///
|
||||
/// \param[in] val Object to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(_In_ const eap::packable &val);
|
||||
|
||||
///
|
||||
/// Unpacks a packable object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Object to unpack to
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::packable &val);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
@@ -574,6 +601,45 @@ namespace eap
|
||||
ptr_type ptr_end; ///< Pointer to the end of BLOB
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Base class for all packable data classes
|
||||
///
|
||||
class packable
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs configuration
|
||||
///
|
||||
packable();
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Packs this object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
|
||||
///
|
||||
/// Returns packed size of this object
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
virtual size_t get_pk_size() const;
|
||||
|
||||
///
|
||||
/// Unpacks this object
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
///
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
/// \addtogroup EAPBaseSanitizing
|
||||
@@ -1198,6 +1264,24 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &va
|
||||
}
|
||||
|
||||
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::packable &val)
|
||||
{
|
||||
val.operator<<(cursor);
|
||||
}
|
||||
|
||||
|
||||
inline size_t pksizeof(_In_ const eap::packable &val)
|
||||
{
|
||||
return val.get_pk_size();
|
||||
}
|
||||
|
||||
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::packable &val)
|
||||
{
|
||||
val.operator>>(cursor);
|
||||
}
|
||||
|
||||
|
||||
#ifndef htonll
|
||||
|
||||
inline unsigned __int64 htonll(unsigned __int64 val)
|
||||
|
@@ -43,17 +43,16 @@ namespace eap
|
||||
///
|
||||
/// UI context
|
||||
///
|
||||
class ui_context : public config
|
||||
class ui_context : public packable
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs context
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Connection configuration
|
||||
/// \param[in] cred Connection credentials
|
||||
///
|
||||
ui_context(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred);
|
||||
ui_context(_In_ config_connection &cfg, _In_ credentials_connection &cred);
|
||||
|
||||
///
|
||||
/// Copies context
|
||||
|
Reference in New Issue
Block a user