Support for packing and unpacking of config_method_eapmsg added
This commit is contained in:
parent
5dad353d98
commit
597095b536
@ -426,6 +426,31 @@ inline size_t pksizeof(_In_ const GUID &val);
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ GUID &val);
|
||||
|
||||
///
|
||||
/// Packs a EAP_METHOD_TYPE
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Variable with data to pack
|
||||
///
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const EAP_METHOD_TYPE &val);
|
||||
|
||||
///
|
||||
/// Returns packed size of a EAP_METHOD_TYPE
|
||||
///
|
||||
/// \param[in] val Data to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val);
|
||||
|
||||
///
|
||||
/// Unpacks a EAP_METHOD_TYPE
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Variable to receive unpacked value
|
||||
///
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &val);
|
||||
|
||||
#ifndef htonll
|
||||
///
|
||||
/// Converts an unsigned __int64 from host to TCP/IP network byte order.
|
||||
@ -1100,6 +1125,31 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ GUID &val)
|
||||
}
|
||||
|
||||
|
||||
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const EAP_METHOD_TYPE &val)
|
||||
{
|
||||
auto ptr_end = cursor.ptr + sizeof(EAP_METHOD_TYPE);
|
||||
assert(ptr_end <= cursor.ptr_end);
|
||||
memcpy(cursor.ptr, &val, sizeof(EAP_METHOD_TYPE));
|
||||
cursor.ptr = ptr_end;
|
||||
}
|
||||
|
||||
|
||||
inline size_t pksizeof(_In_ const EAP_METHOD_TYPE &val)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(val);
|
||||
return sizeof(EAP_METHOD_TYPE);
|
||||
}
|
||||
|
||||
|
||||
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ EAP_METHOD_TYPE &val)
|
||||
{
|
||||
auto ptr_end = cursor.ptr + sizeof(EAP_METHOD_TYPE);
|
||||
assert(ptr_end <= cursor.ptr_end);
|
||||
memcpy(&val, cursor.ptr, sizeof(EAP_METHOD_TYPE));
|
||||
cursor.ptr = ptr_end;
|
||||
}
|
||||
|
||||
|
||||
#ifndef htonll
|
||||
|
||||
inline unsigned __int64 htonll(unsigned __int64 val)
|
||||
|
@ -89,6 +89,33 @@ namespace eap
|
||||
///
|
||||
virtual config* clone() const;
|
||||
|
||||
///
|
||||
/// \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);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Returns EAP method type of this configuration
|
||||
///
|
||||
|
@ -80,6 +80,31 @@ eap::config* eap::config_method_eapmsg::clone() const
|
||||
}
|
||||
|
||||
|
||||
void eap::config_method_eapmsg::operator<<(_Inout_ cursor_out &cursor) const
|
||||
{
|
||||
config_method::operator<<(cursor);
|
||||
cursor << m_type ;
|
||||
cursor << m_cfg_blob;
|
||||
}
|
||||
|
||||
|
||||
size_t eap::config_method_eapmsg::get_pk_size() const
|
||||
{
|
||||
return
|
||||
config_method::get_pk_size() +
|
||||
pksizeof(m_type ) +
|
||||
pksizeof(m_cfg_blob);
|
||||
}
|
||||
|
||||
|
||||
void eap::config_method_eapmsg::operator>>(_Inout_ cursor_in &cursor)
|
||||
{
|
||||
config_method::operator>>(cursor);
|
||||
cursor >> m_type ;
|
||||
cursor >> m_cfg_blob;
|
||||
}
|
||||
|
||||
|
||||
eap_type_t eap::config_method_eapmsg::get_method_id() const
|
||||
{
|
||||
return (eap_type_t)m_type.eapType.type;
|
||||
|
Loading…
x
Reference in New Issue
Block a user