diff --git a/lib/EAPBase/include/Config.h b/lib/EAPBase/include/Config.h index c0d093e..c9854f8 100644 --- a/lib/EAPBase/include/Config.h +++ b/lib/EAPBase/include/Config.h @@ -45,33 +45,30 @@ namespace eap class config_providers; } -namespace eapserial -{ - /// - /// Packs a configuration - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Configuration to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const eap::config &val); +/// +/// 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 get_pk_size(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(const eap::config &val); - /// - /// Unpacks a configuration - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Configuration to unpack to - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ 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 @@ -181,7 +178,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -195,7 +192,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} @@ -288,7 +285,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -302,7 +299,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} @@ -412,7 +409,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -426,7 +423,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} @@ -531,7 +528,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -545,7 +542,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} @@ -555,22 +552,19 @@ namespace eap } -namespace eapserial +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val) { - inline void pack(_Inout_ cursor_out &cursor, _In_ const eap::config &val) - { - val.pack(cursor); - } - - - inline size_t get_pk_size(const eap::config &val) - { - return val.get_pk_size(); - } - - - inline void unpack(_Inout_ cursor_in &cursor, _Out_ eap::config &val) - { - val.unpack(cursor); - } + val.operator<<(cursor); +} + + +inline size_t pksizeof(const eap::config &val) +{ + return val.get_pk_size(); +} + + +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val) +{ + val.operator>>(cursor); } diff --git a/lib/EAPBase/include/Credentials.h b/lib/EAPBase/include/Credentials.h index d1047b7..36bbfb8 100644 --- a/lib/EAPBase/include/Credentials.h +++ b/lib/EAPBase/include/Credentials.h @@ -293,7 +293,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -307,7 +307,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} diff --git a/lib/EAPBase/include/EAP.h b/lib/EAPBase/include/EAP.h index 1ced4e7..fa4373d 100644 --- a/lib/EAPBase/include/EAP.h +++ b/lib/EAPBase/include/EAP.h @@ -44,10 +44,7 @@ namespace eap /// \sa [Extensible Authentication Protocol (EAP) Registry (Chapter: Method Types)](https://www.iana.org/assignments/eap-numbers/eap-numbers.xhtml#eap-numbers-4) /// enum type_t; -} -namespace eapserial -{ /// /// Output BLOB cursor /// @@ -57,286 +54,286 @@ namespace eapserial /// Input BLOB cursor /// struct cursor_in; +} - /// - /// Packs a boolean - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Variable with data to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const bool &val); +/// +/// Packs a boolean +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val Variable with data to pack +/// +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const bool &val); - /// - /// Returns packed size of a boolean - /// - /// \param[in] val Data to pack - /// - /// \returns Size of data when packed (in bytes) - /// - inline size_t get_pk_size(_In_ const bool &val); +/// +/// Returns packed size of a boolean +/// +/// \param[in] val Data to pack +/// +/// \returns Size of data when packed (in bytes) +/// +inline size_t pksizeof(_In_ const bool &val); - /// - /// Unpacks a boolean - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Variable to receive unpacked value - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ bool &val); +/// +/// Unpacks a boolean +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val Variable to receive unpacked value +/// +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val); - /// - /// Packs a byte - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Variable with data to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const unsigned char &val); +/// +/// Packs a byte +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val Variable with data to pack +/// +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned char &val); - /// - /// Returns packed size of a byte - /// - /// \param[in] val Data to pack - /// - /// \returns Size of data when packed (in bytes) - /// - inline size_t get_pk_size(_In_ const unsigned char &val); +/// +/// Returns packed size of a byte +/// +/// \param[in] val Data to pack +/// +/// \returns Size of data when packed (in bytes) +/// +inline size_t pksizeof(_In_ const unsigned char &val); - /// - /// Unpacks a byte - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Variable to receive unpacked value - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ unsigned char &val); +/// +/// Unpacks a byte +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val Variable to receive unpacked value +/// +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val); - /// - /// Packs an unsigned int - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Variable with data to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const unsigned int &val); +/// +/// Packs an unsigned int +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val Variable with data to pack +/// +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned int &val); - /// - /// Returns packed size of an unsigned int - /// - /// \param[in] val Data to pack - /// - /// \returns Size of data when packed (in bytes) - /// - inline size_t get_pk_size(_In_ const unsigned int &val); +/// +/// Returns packed size of an unsigned int +/// +/// \param[in] val Data to pack +/// +/// \returns Size of data when packed (in bytes) +/// +inline size_t pksizeof(_In_ const unsigned int &val); - /// - /// Unpacks an unsigned int - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Variable to receive unpacked value - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ unsigned int &val); +/// +/// Unpacks an unsigned int +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val Variable to receive unpacked value +/// +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val); #ifdef _WIN64 - /// - /// Packs a size_t - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Variable with data to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const size_t &val); +/// +/// Packs a size_t +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val Variable with data to pack +/// +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const size_t &val); - /// - /// Returns packed size of a size_t - /// - /// \param[in] val Data to pack - /// - /// \returns Size of data when packed (in bytes) - /// - inline size_t get_pk_size(_In_ const size_t &val); +/// +/// Returns packed size of a size_t +/// +/// \param[in] val Data to pack +/// +/// \returns Size of data when packed (in bytes) +/// +inline size_t pksizeof(_In_ const size_t &val); - /// - /// Unpacks a size_t - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Variable to receive unpacked value - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ size_t &val); +/// +/// Unpacks a size_t +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val Variable to receive unpacked value +/// +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val); #endif - /// - /// Packs a string - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val String to pack - /// - template inline void pack(_Inout_ cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val); +/// +/// Packs a string +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val String to pack +/// +template inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val); - /// - /// Returns packed size of a string - /// - /// \param[in] val String to pack - /// - /// \returns Size of data when packed (in bytes) - /// - template inline size_t get_pk_size(const std::basic_string<_Elem, _Traits, _Ax> &val); +/// +/// Returns packed size of a string +/// +/// \param[in] val String to pack +/// +/// \returns Size of data when packed (in bytes) +/// +template inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val); - /// - /// Unpacks a string - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val String to unpack to - /// - template inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val); +/// +/// Unpacks a string +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val String to unpack to +/// +template inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val); - /// - /// Packs a wide string - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val String to pack - /// - template inline void pack(_Inout_ cursor_out &cursor, _In_ const std::basic_string &val); +/// +/// Packs a wide string +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val String to pack +/// +template inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string &val); - /// - /// Returns packed size of a wide string - /// - /// \param[in] val String to pack - /// - /// \returns Size of data when packed (in bytes) - /// - template inline size_t get_pk_size(const std::basic_string &val); +/// +/// Returns packed size of a wide string +/// +/// \param[in] val String to pack +/// +/// \returns Size of data when packed (in bytes) +/// +template inline size_t pksizeof(const std::basic_string &val); - /// - /// Unpacks a wide string - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val String to unpack to - /// - template inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::basic_string &val); +/// +/// Unpacks a wide string +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val String to unpack to +/// +template inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string &val); - /// - /// Packs a vector - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Vector to pack - /// - template inline void pack(_Inout_ cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val); +/// +/// Packs a vector +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val Vector to pack +/// +template inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val); - /// - /// Returns packed size of a vector - /// - /// \param[in] val Vector to pack - /// - /// \returns Size of data when packed (in bytes) - /// - template inline size_t get_pk_size(const std::vector<_Ty, _Ax> &val); +/// +/// Returns packed size of a vector +/// +/// \param[in] val Vector to pack +/// +/// \returns Size of data when packed (in bytes) +/// +template inline size_t pksizeof(const std::vector<_Ty, _Ax> &val); - /// - /// Unpacks a vector - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Vector to unpack to - /// - template inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val); +/// +/// Unpacks a vector +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val Vector to unpack to +/// +template inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val); - /// - /// Packs a list - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val List to pack - /// - template inline void pack(_Inout_ cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val); +/// +/// Packs a list +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val List to pack +/// +template inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val); - /// - /// Returns packed size of a list - /// - /// \param[in] val List to pack - /// - /// \returns Size of data when packed (in bytes) - /// - template inline size_t get_pk_size(const std::list<_Ty, _Ax> &val); +/// +/// Returns packed size of a list +/// +/// \param[in] val List to pack +/// +/// \returns Size of data when packed (in bytes) +/// +template inline size_t pksizeof(const std::list<_Ty, _Ax> &val); - /// - /// Unpacks a list - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val List to unpack to - /// - template inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val); +/// +/// Unpacks a list +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val List to unpack to +/// +template inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val); - /// - /// Packs a std::unique_ptr - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val std::unique_ptr to pack - /// - template inline void pack(_Inout_ cursor_out &cursor, _In_ const std::unique_ptr<_Ty, _Dx> &val); +/// +/// Packs a std::unique_ptr +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val std::unique_ptr to pack +/// +template inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::unique_ptr<_Ty, _Dx> &val); - /// - /// Returns packed size of a std::unique_ptr - /// - /// \param[in] val std::unique_ptr to pack - /// - /// \returns Size of data when packed (in bytes) - /// - template inline size_t get_pk_size(const std::unique_ptr<_Ty, _Dx> &val); +/// +/// Returns packed size of a std::unique_ptr +/// +/// \param[in] val std::unique_ptr to pack +/// +/// \returns Size of data when packed (in bytes) +/// +template inline size_t pksizeof(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 - ///// - //template inline void unpack(_Inout_ cursor_in &cursor, _Out_ 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 +///// +//template inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::unique_ptr<_Ty, _Dx> &val); - /// - /// Packs a certificate context - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val Certificate context to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const winstd::cert_context &val); +/// +/// Packs a certificate context +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val Certificate context to pack +/// +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_context &val); - /// - /// Returns packed size of a certificate context - /// - /// \param[in] val Certificate context to pack - /// - /// \returns Size of data when packed (in bytes) - /// - inline size_t get_pk_size(const winstd::cert_context &val); +/// +/// Returns packed size of a certificate context +/// +/// \param[in] val Certificate context to pack +/// +/// \returns Size of data when packed (in bytes) +/// +inline size_t pksizeof(const winstd::cert_context &val); - /// - /// Unpacks a certificate context - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val Certificate context to unpack to - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ winstd::cert_context &val); +/// +/// Unpacks a certificate context +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val Certificate context to unpack to +/// +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_context &val); - /// - /// Packs an EAP method type - /// - /// \param[inout] cursor Memory cursor - /// \param[in] val EAP method type to pack - /// - inline void pack(_Inout_ cursor_out &cursor, _In_ const eap::type_t &val); +/// +/// Packs an EAP method type +/// +/// \param[inout] cursor Memory cursor +/// \param[in] val EAP method type to pack +/// +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::type_t &val); - /// - /// Returns packed size of an EAP method type - /// - /// \param[in] val EAP method type to pack - /// - /// \returns Size of data when packed (in bytes) - /// - inline size_t get_pk_size(const eap::type_t &val); +/// +/// Returns packed size of an EAP method type +/// +/// \param[in] val EAP method type to pack +/// +/// \returns Size of data when packed (in bytes) +/// +inline size_t pksizeof(const eap::type_t &val); - /// - /// Unpacks an EAP method type - /// - /// \param[inout] cursor Memory cursor - /// \param[out] val EAP method type to unpack to - /// - inline void unpack(_Inout_ cursor_in &cursor, _Out_ eap::type_t &val); -} +/// +/// Unpacks an EAP method type +/// +/// \param[inout] cursor Memory cursor +/// \param[out] val EAP method type to unpack to +/// +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::type_t &val); #pragma once @@ -351,11 +348,7 @@ namespace eap type_mschapv2 = 26, ///< EAP-MSCHAPv2 type_pap = 192, ///< PAP (Not actually an EAP method; Moved to the Unassigned area) }; -} - -namespace eapserial -{ struct cursor_out { typedef unsigned char *ptr_type; @@ -371,339 +364,339 @@ namespace eapserial ptr_type ptr; ///< Pointer to first data unread ptr_type ptr_end; ///< Pointer to the end of BLOB }; +} - inline void pack(_Inout_ cursor_out &cursor, _In_ const bool &val) - { - cursor_out::ptr_type ptr_end = cursor.ptr + 1; - assert(ptr_end <= cursor.ptr_end); - *cursor.ptr = val ? 1 : 0; - cursor.ptr = ptr_end; - } +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const bool &val) +{ + eap::cursor_out::ptr_type ptr_end = cursor.ptr + 1; + assert(ptr_end <= cursor.ptr_end); + *cursor.ptr = val ? 1 : 0; + cursor.ptr = ptr_end; +} - inline size_t get_pk_size(_In_ const bool &val) - { - UNREFERENCED_PARAMETER(val); - return sizeof(unsigned char); - } +inline size_t pksizeof(_In_ const bool &val) +{ + UNREFERENCED_PARAMETER(val); + return sizeof(unsigned char); +} - inline void unpack(_Inout_ cursor_in &cursor, _Out_ bool &val) - { - cursor_in::ptr_type ptr_end = cursor.ptr + 1; - assert(ptr_end <= cursor.ptr_end); - val = *cursor.ptr ? true : false; - cursor.ptr = ptr_end; - } +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val) +{ + eap::cursor_in::ptr_type ptr_end = cursor.ptr + 1; + assert(ptr_end <= cursor.ptr_end); + val = *cursor.ptr ? true : false; + cursor.ptr = ptr_end; +} - inline void pack(_Inout_ cursor_out &cursor, _In_ const unsigned char &val) - { - cursor_out::ptr_type ptr_end = cursor.ptr + 1; - assert(ptr_end <= cursor.ptr_end); - *cursor.ptr = val; - cursor.ptr = ptr_end; - } +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned char &val) +{ + eap::cursor_out::ptr_type ptr_end = cursor.ptr + 1; + assert(ptr_end <= cursor.ptr_end); + *cursor.ptr = val; + cursor.ptr = ptr_end; +} - inline size_t get_pk_size(_In_ const unsigned char &val) - { - UNREFERENCED_PARAMETER(val); - return sizeof(unsigned char); - } +inline size_t pksizeof(_In_ const unsigned char &val) +{ + UNREFERENCED_PARAMETER(val); + return sizeof(unsigned char); +} - inline void unpack(_Inout_ cursor_in &cursor, _Out_ unsigned char &val) - { - cursor_in::ptr_type ptr_end = cursor.ptr + 1; - assert(ptr_end <= cursor.ptr_end); - val = *cursor.ptr; - cursor.ptr = ptr_end; - } +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val) +{ + eap::cursor_in::ptr_type ptr_end = cursor.ptr + 1; + assert(ptr_end <= cursor.ptr_end); + val = *cursor.ptr; + cursor.ptr = ptr_end; +} - inline void pack(_Inout_ cursor_out &cursor, _In_ const unsigned int &val) - { - cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int); - assert(ptr_end <= cursor.ptr_end); - *(unsigned int*)cursor.ptr = val; - cursor.ptr = ptr_end; - } +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned int &val) +{ + eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int); + assert(ptr_end <= cursor.ptr_end); + *(unsigned int*)cursor.ptr = val; + cursor.ptr = ptr_end; +} - inline size_t get_pk_size(_In_ const unsigned int &val) - { - UNREFERENCED_PARAMETER(val); - return sizeof(unsigned int); - } +inline size_t pksizeof(_In_ const unsigned int &val) +{ + UNREFERENCED_PARAMETER(val); + return sizeof(unsigned int); +} - inline void unpack(_Inout_ cursor_in &cursor, _Out_ unsigned int &val) - { - cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int); - assert(ptr_end <= cursor.ptr_end); - val = *(unsigned int*)cursor.ptr; - cursor.ptr = ptr_end; - } +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val) +{ + eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int); + assert(ptr_end <= cursor.ptr_end); + val = *(unsigned int*)cursor.ptr; + cursor.ptr = ptr_end; +} #ifdef _WIN64 - inline void pack(_Inout_ cursor_out &cursor, _In_ const size_t &val) - { - cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(size_t); - assert(ptr_end <= cursor.ptr_end); - *(size_t*)cursor.ptr = val; - cursor.ptr = ptr_end; - } +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const size_t &val) +{ + eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(size_t); + assert(ptr_end <= cursor.ptr_end); + *(size_t*)cursor.ptr = val; + cursor.ptr = ptr_end; +} - inline size_t get_pk_size(_In_ const size_t &val) - { - UNREFERENCED_PARAMETER(val); - return sizeof(size_t); - } +inline size_t pksizeof(_In_ const size_t &val) +{ + UNREFERENCED_PARAMETER(val); + return sizeof(size_t); +} - inline void unpack(_Inout_ cursor_in &cursor, _Out_ size_t &val) - { - cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(size_t); - assert(ptr_end <= cursor.ptr_end); - val = *(size_t*)cursor.ptr; - cursor.ptr = ptr_end; - } +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val) +{ + eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(size_t); + assert(ptr_end <= cursor.ptr_end); + val = *(size_t*)cursor.ptr; + cursor.ptr = ptr_end; +} #endif - template - inline void pack(_Inout_ cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val) - { - std::basic_string<_Elem, _Traits, _Ax>::size_type count = val.length(); - assert(strlen(val.c_str()) == count); // String should not contain zero terminators. - size_t size = sizeof(_Elem)*(count + 1); - cursor_out::ptr_type ptr_end = cursor.ptr + size; - assert(ptr_end <= cursor.ptr_end); - memcpy(cursor.ptr, (const _Elem*)val.c_str(), size); - cursor.ptr = ptr_end; - } +template +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val) +{ + std::basic_string<_Elem, _Traits, _Ax>::size_type count = val.length(); + assert(strlen(val.c_str()) == count); // String should not contain zero terminators. + size_t size = sizeof(_Elem)*(count + 1); + eap::cursor_out::ptr_type ptr_end = cursor.ptr + size; + assert(ptr_end <= cursor.ptr_end); + memcpy(cursor.ptr, (const _Elem*)val.c_str(), size); + cursor.ptr = ptr_end; +} - template - inline size_t get_pk_size(const std::basic_string<_Elem, _Traits, _Ax> &val) - { - return sizeof(_Elem)*(val.length() + 1); - } +template +inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val) +{ + return sizeof(_Elem)*(val.length() + 1); +} - template - inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val) - { - size_t count_max = cursor.ptr_end - cursor.ptr; - std::basic_string<_Elem, _Traits, _Ax>::size_type count = strnlen((const _Elem*&)cursor.ptr, count_max); - assert(count < count_max); // String should be zero terminated. - val.assign((const _Elem*&)cursor.ptr, count); - cursor.ptr += sizeof(_Elem)*(count + 1); - } +template +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val) +{ + size_t count_max = cursor.ptr_end - cursor.ptr; + std::basic_string<_Elem, _Traits, _Ax>::size_type count = strnlen((const _Elem*&)cursor.ptr, count_max); + assert(count < count_max); // String should be zero terminated. + val.assign((const _Elem*&)cursor.ptr, count); + cursor.ptr += sizeof(_Elem)*(count + 1); +} - template - inline void pack(_Inout_ cursor_out &cursor, _In_ const std::basic_string &val) - { - std::string val_utf8; - WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL); - pack(cursor, val_utf8); - } +template +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string &val) +{ + std::string val_utf8; + WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL); + cursor << val_utf8; +} - template - inline size_t get_pk_size(const std::basic_string &val) - { - return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL) + 1); - } +template +inline size_t pksizeof(const std::basic_string &val) +{ + return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL) + 1); +} - template - inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::basic_string &val) - { - std::string val_utf8; - unpack(cursor, val_utf8); - MultiByteToWideChar(CP_UTF8, 0, val_utf8.c_str(), (int)val_utf8.length(), val); - } +template +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string &val) +{ + std::string val_utf8; + cursor >> val_utf8; + MultiByteToWideChar(CP_UTF8, 0, val_utf8.c_str(), (int)val_utf8.length(), val); +} - template - inline void pack(_Inout_ cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val) - { - std::vector<_Ty, _Ax>::size_type count = val.size(); - pack(cursor, count); +template +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val) +{ + std::vector<_Ty, _Ax>::size_type count = val.size(); + cursor << count; - // Since we do not know wheter vector elements are primitives or objects, iterate instead of memcpy. - // For performance critical vectors of flat opaque data types write specialized template instantiation. - for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) - pack(cursor, val[i]); - } + // Since we do not know wheter vector elements are primitives or objects, iterate instead of memcpy. + // For performance critical vectors of flat opaque data types write specialized template instantiation. + for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) + cursor << val[i]; +} - template - inline size_t get_pk_size(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. - std::vector<_Ty, _Ax>::size_type count = val.size(); - size_t size = get_pk_size(count); - for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) - size += get_pk_size(val[i]); - return size; - } +template +inline size_t pksizeof(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. + std::vector<_Ty, _Ax>::size_type count = val.size(); + size_t size = pksizeof(count); + for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) + size += pksizeof(val[i]); + return size; +} - template - inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val) - { - std::vector<_Ty, _Ax>::size_type count; - unpack(cursor, count); +template +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val) +{ + std::vector<_Ty, _Ax>::size_type count; + cursor >> count; - // Since we do not know wheter vector elements are primitives or objects, iterate instead of assign(). - // For performance critical vectors of flat opaque data types write specialized template instantiation. - val.clear(); - val.reserve(count); - for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) { - _Ty el; - unpack(cursor, el); - val.push_back(el); - } - } - - - template - inline void pack(_Inout_ cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val) - { - std::list<_Ty, _Ax>::size_type count = val.size(); - pack(cursor, count); - - // Since we do not know wheter list elements are primitives or objects, iterate instead of memcpy. - // For performance critical vectors of flat opaque data types write specialized template instantiation. - for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i) - pack(cursor, *i); - } - - - template - inline size_t get_pk_size(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. - std::list<_Ty, _Ax>::size_type count = val.size(); - size_t size = get_pk_size(count); - for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i) - size += get_pk_size(*i); - return size; - } - - - template - inline void unpack(_Inout_ cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val) - { - std::list<_Ty, _Ax>::size_type count; - unpack(cursor, count); - - // Since we do not know wheter list elements are primitives or objects, iterate instead of assign(). - // For performance critical vectors of flat opaque data types write specialized template instantiation. - val.clear(); - for (std::list<_Ty, _Ax>::size_type i = 0; i < count; i++) { - _Ty el; - unpack(cursor, el); - val.push_back(el); - } - } - - - template - inline void pack(_Inout_ cursor_out &cursor, _In_ const std::unique_ptr<_Ty, _Dx> &val) - { - if (val) { - pack(cursor, true); - pack(cursor, *val); - } else - pack(cursor, false); - } - - - template - inline size_t get_pk_size(const std::unique_ptr<_Ty, _Dx> &val) - { - return - val ? - get_pk_size(true) + - get_pk_size(*val) : - get_pk_size(false); - } - - - inline void pack(_Inout_ cursor_out &cursor, _In_ const winstd::cert_context &val) - { - if (val) { - pack(cursor, (unsigned int)val->dwCertEncodingType); - pack(cursor, (unsigned int)val->cbCertEncoded ); - cursor_out::ptr_type ptr_end = cursor.ptr + val->cbCertEncoded; - assert(ptr_end <= cursor.ptr_end); - memcpy(cursor.ptr, val->pbCertEncoded, val->cbCertEncoded); - cursor.ptr = ptr_end; - } else { - pack(cursor, (unsigned int)0); - pack(cursor, (unsigned int)0); - } - } - - - inline size_t get_pk_size(const winstd::cert_context &val) - { - return - val ? - get_pk_size((unsigned int)val->dwCertEncodingType) + - get_pk_size((unsigned int)val->cbCertEncoded ) + - val->cbCertEncoded : - get_pk_size((unsigned int)0) + - get_pk_size((unsigned int)0); - } - - - inline void unpack(_Inout_ cursor_in &cursor, _Out_ winstd::cert_context &val) - { - DWORD dwCertEncodingType; - unpack(cursor, (unsigned int&)dwCertEncodingType); - - DWORD dwCertEncodedSize; - unpack(cursor, (unsigned int&)dwCertEncodedSize); - - if (dwCertEncodedSize) { - cursor_in::ptr_type ptr_end = cursor.ptr + dwCertEncodedSize; - assert(ptr_end <= cursor.ptr_end); - val.create(dwCertEncodingType, (BYTE*)cursor.ptr, dwCertEncodedSize); - cursor.ptr = ptr_end; - } else - val.free(); - } - - - inline void pack(_Inout_ cursor_out &cursor, _In_ const eap::type_t &val) - { - pack(cursor, (unsigned char)val); - } - - - inline size_t get_pk_size(_In_ const eap::type_t &val) - { - return get_pk_size((unsigned char)val); - } - - - inline void unpack(_Inout_ cursor_in &cursor, _Out_ eap::type_t &val) - { - unsigned char t; - unpack(cursor, t); - val = (eap::type_t)t; + // Since we do not know wheter vector elements are primitives or objects, iterate instead of assign(). + // For performance critical vectors of flat opaque data types write specialized template instantiation. + val.clear(); + val.reserve(count); + for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) { + _Ty el; + cursor >> el; + val.push_back(el); } } + +template +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val) +{ + std::list<_Ty, _Ax>::size_type count = val.size(); + cursor << count; + + // Since we do not know wheter list elements are primitives or objects, iterate instead of memcpy. + // For performance critical vectors of flat opaque data types write specialized template instantiation. + for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i) + cursor << *i; +} + + +template +inline size_t pksizeof(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. + std::list<_Ty, _Ax>::size_type count = val.size(); + size_t size = pksizeof(count); + for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i) + size += pksizeof(*i); + return size; +} + + +template +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val) +{ + std::list<_Ty, _Ax>::size_type count; + cursor >> count; + + // Since we do not know wheter list elements are primitives or objects, iterate instead of assign(). + // For performance critical vectors of flat opaque data types write specialized template instantiation. + val.clear(); + for (std::list<_Ty, _Ax>::size_type i = 0; i < count; i++) { + _Ty el; + cursor >> el; + val.push_back(el); + } +} + + +template +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::unique_ptr<_Ty, _Dx> &val) +{ + if (val) { + cursor << true; + cursor << *val; + } else + cursor << false; +} + + +template +inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val) +{ + return + val ? + pksizeof(true) + + pksizeof(*val) : + pksizeof(false); +} + + +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_context &val) +{ + if (val) { + cursor << (unsigned int)val->dwCertEncodingType; + cursor << (unsigned int)val->cbCertEncoded ; + eap::cursor_out::ptr_type ptr_end = cursor.ptr + val->cbCertEncoded; + assert(ptr_end <= cursor.ptr_end); + memcpy(cursor.ptr, val->pbCertEncoded, val->cbCertEncoded); + cursor.ptr = ptr_end; + } else { + cursor << (unsigned int)0; + cursor << (unsigned int)0; + } +} + + +inline size_t pksizeof(const winstd::cert_context &val) +{ + return + val ? + pksizeof((unsigned int)val->dwCertEncodingType) + + pksizeof((unsigned int)val->cbCertEncoded ) + + val->cbCertEncoded : + pksizeof((unsigned int)0) + + pksizeof((unsigned int)0); +} + + +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_context &val) +{ + DWORD dwCertEncodingType; + cursor >> (unsigned int&)dwCertEncodingType; + + DWORD dwCertEncodedSize; + cursor >> (unsigned int&)dwCertEncodedSize; + + if (dwCertEncodedSize) { + eap::cursor_in::ptr_type ptr_end = cursor.ptr + dwCertEncodedSize; + assert(ptr_end <= cursor.ptr_end); + val.create(dwCertEncodingType, (BYTE*)cursor.ptr, dwCertEncodedSize); + cursor.ptr = ptr_end; + } else + val.free(); +} + + +inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::type_t &val) +{ + cursor << (unsigned char)val; +} + + +inline size_t pksizeof(_In_ const eap::type_t &val) +{ + return pksizeof((unsigned char)val); +} + + +inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::type_t &val) +{ + unsigned char t; + cursor >> t; + val = (eap::type_t)t; +} + #endif diff --git a/lib/EAPBase/include/Module.h b/lib/EAPBase/include/Module.h index c16c834..0541f41 100644 --- a/lib/EAPBase/include/Module.h +++ b/lib/EAPBase/include/Module.h @@ -561,13 +561,13 @@ namespace eap if (!decrypt_md5(cp, pDataIn, dwDataInSize, data, ppEapError)) return false; - eapserial::cursor_in cursor = { data.data(), data.data() + data.size() }; - eapserial::unpack(cursor, record); + cursor_in cursor = { data.data(), data.data() + data.size() }; + cursor >> record; #else UNREFERENCED_PARAMETER(ppEapError); - eapserial::cursor_in cursor = { pDataIn, pDataIn + dwDataInSize }; - eapserial::unpack(cursor, record); + cursor_in cursor = { pDataIn, pDataIn + dwDataInSize }; + cursor >> record; #endif return true; @@ -596,11 +596,11 @@ namespace eap #if EAP_ENCRYPT_BLOBS // Allocate BLOB. std::vector > data; - data.resize(eapserial::get_pk_size(record)); + data.resize(pksizeof(record)); // Pack to BLOB. - eapserial::cursor_out cursor = { data.data(), data.data() + data.size() }; - eapserial::pack(cursor, record); + cursor_out cursor = { data.data(), data.data() + data.size() }; + cursor << record; data.resize(cursor.ptr - &data.front()); // Prepare cryptographics provider. @@ -629,7 +629,7 @@ namespace eap // Allocate BLOB. assert(ppDataOut); assert(pdwDataOutSize); - *pdwDataOutSize = (DWORD)eapserial::get_pk_size(record); + *pdwDataOutSize = (DWORD)pksizeof(record); *ppDataOut = alloc_memory(*pdwDataOutSize); if (!*ppDataOut) { log_error(*ppEapError = g_peer.make_error(ERROR_OUTOFMEMORY, tstring_printf(_T(__FUNCTION__) _T(" Error allocating memory for BLOB (%uB)."), *pdwDataOutSize).c_str())); @@ -637,8 +637,8 @@ namespace eap } // Pack to BLOB. - eapserial::cursor_out cursor = { *ppDataOut, *ppDataOut + *pdwDataOutSize }; - eapserial::pack(cursor, record); + cursor_out cursor = { *ppDataOut, *ppDataOut + *pdwDataOutSize }; + cursor << record; *pdwDataOutSize = cursor.ptr - *ppDataOut; #endif diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index 48a774b..45ea8b9 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -81,7 +81,7 @@ bool eap::config::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapErr } -void eap::config::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::config::operator<<(_Inout_ cursor_out &cursor) const { UNREFERENCED_PARAMETER(cursor); } @@ -93,7 +93,7 @@ size_t eap::config::get_pk_size() const } -void eap::config::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::config::operator>>(_Inout_ cursor_in &cursor) { UNREFERENCED_PARAMETER(cursor); } @@ -120,10 +120,10 @@ eap::config_method::config_method(_In_ const config_method &other) : eap::config_method::config_method(_Inout_ config_method &&other) : - m_allow_save(move(other.m_allow_save)), - m_anonymous_identity(move(other.m_anonymous_identity)), - m_preshared(move(other.m_preshared)), - config(move(other)) + m_allow_save(std::move(other.m_allow_save)), + m_anonymous_identity(std::move(other.m_anonymous_identity)), + m_preshared(std::move(other.m_preshared)), + config(std::move(other)) { } @@ -144,10 +144,10 @@ eap::config_method& eap::config_method::operator=(_In_ const config_method &othe eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other) { if (this != &other) { - (config&&)*this = move(other); - m_allow_save = move(other.m_allow_save); - m_anonymous_identity = move(other.m_anonymous_identity); - m_preshared = move(other.m_preshared); + (config&&)*this = std::move(other); + m_allow_save = std::move(other.m_allow_save); + m_anonymous_identity = std::move(other.m_anonymous_identity); + m_preshared = std::move(other.m_preshared); } return *this; @@ -222,7 +222,7 @@ bool eap::config_method::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **p unique_ptr preshared(make_credentials()); assert(preshared); if (preshared->load(pXmlElClientSideCredential, ppEapError)) { - m_preshared = move(preshared); + m_preshared = std::move(preshared); } else { // This is not really an error - merely an indication pre-shared credentials are unavailable. if (*ppEapError) { @@ -236,44 +236,44 @@ bool eap::config_method::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **p } -void eap::config_method::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::config_method::operator<<(_Inout_ cursor_out &cursor) const { - config::pack(cursor); - eapserial::pack(cursor, m_allow_save ); - eapserial::pack(cursor, m_anonymous_identity); + config::operator<<(cursor); + cursor << m_allow_save ; + cursor << m_anonymous_identity; if (m_preshared) { - eapserial::pack(cursor, true); - m_preshared->pack(cursor); + cursor << true; + cursor << *m_preshared; } else - eapserial::pack(cursor, false); + cursor << false; } size_t eap::config_method::get_pk_size() const { return - config::get_pk_size() + - eapserial::get_pk_size(m_allow_save ) + - eapserial::get_pk_size(m_anonymous_identity) + + config::get_pk_size() + + pksizeof(m_allow_save ) + + pksizeof(m_anonymous_identity) + (m_preshared ? - eapserial::get_pk_size(true) + - m_preshared->get_pk_size() : - eapserial::get_pk_size(false)); + pksizeof(true ) + + pksizeof(*m_preshared) : + pksizeof(false )); } -void eap::config_method::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::config_method::operator>>(_Inout_ cursor_in &cursor) { - config::unpack(cursor); - eapserial::unpack(cursor, m_allow_save ); - eapserial::unpack(cursor, m_anonymous_identity); + config::operator>>(cursor); + cursor >> m_allow_save ; + cursor >> m_anonymous_identity; bool use_preshared; - eapserial::unpack(cursor, use_preshared); + cursor >> use_preshared; if (use_preshared) { m_preshared.reset(make_credentials()); assert(m_preshared); - m_preshared->unpack(cursor); + cursor >> *m_preshared; } else m_preshared.reset(nullptr); } @@ -303,22 +303,22 @@ eap::config_provider::config_provider(_In_ const config_provider &other) : config(other) { for (list >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) - m_methods.push_back(move(unique_ptr(*method ? (config_method*)method->get()->clone() : nullptr))); + m_methods.push_back(std::move(unique_ptr(*method ? (config_method*)method->get()->clone() : nullptr))); } eap::config_provider::config_provider(_Inout_ config_provider &&other) : - m_read_only(move(other.m_read_only)), - m_id(move(other.m_id)), - m_name(move(other.m_name)), - m_help_email(move(other.m_help_email)), - m_help_web(move(other.m_help_web)), - m_help_phone(move(other.m_help_phone)), - m_lbl_alt_credential(move(other.m_lbl_alt_credential)), - m_lbl_alt_identity(move(other.m_lbl_alt_identity)), - m_lbl_alt_password(move(other.m_lbl_alt_password)), - m_methods(move(other.m_methods)), - config(move(other)) + m_read_only(std::move(other.m_read_only)), + m_id(std::move(other.m_id)), + m_name(std::move(other.m_name)), + m_help_email(std::move(other.m_help_email)), + m_help_web(std::move(other.m_help_web)), + m_help_phone(std::move(other.m_help_phone)), + m_lbl_alt_credential(std::move(other.m_lbl_alt_credential)), + m_lbl_alt_identity(std::move(other.m_lbl_alt_identity)), + m_lbl_alt_password(std::move(other.m_lbl_alt_password)), + m_methods(std::move(other.m_methods)), + config(std::move(other)) { } @@ -339,7 +339,7 @@ eap::config_provider& eap::config_provider::operator=(_In_ const config_provider m_methods.clear(); for (list >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) - m_methods.push_back(move(unique_ptr(*method ? (config_method*)method->get()->clone() : nullptr))); + m_methods.push_back(std::move(unique_ptr(*method ? (config_method*)method->get()->clone() : nullptr))); } return *this; @@ -349,17 +349,17 @@ eap::config_provider& eap::config_provider::operator=(_In_ const config_provider eap::config_provider& eap::config_provider::operator=(_Inout_ config_provider &&other) { if (this != &other) { - (config&&)*this = move(other); - m_read_only = move(m_read_only); - m_id = move(other.m_id); - m_name = move(other.m_name); - m_help_email = move(other.m_help_email); - m_help_web = move(other.m_help_web); - m_help_phone = move(other.m_help_phone); - m_lbl_alt_credential = move(other.m_lbl_alt_credential); - m_lbl_alt_identity = move(other.m_lbl_alt_identity); - m_lbl_alt_password = move(other.m_lbl_alt_password); - m_methods = move(other.m_methods); + (config&&)*this = std::move(other); + m_read_only = std::move(m_read_only); + m_id = std::move(other.m_id); + m_name = std::move(other.m_name); + m_help_email = std::move(other.m_help_email); + m_help_web = std::move(other.m_help_web); + m_help_phone = std::move(other.m_help_phone); + m_lbl_alt_credential = std::move(other.m_lbl_alt_credential); + m_lbl_alt_identity = std::move(other.m_lbl_alt_identity); + m_lbl_alt_password = std::move(other.m_lbl_alt_password); + m_methods = std::move(other.m_methods); } return *this; @@ -583,69 +583,69 @@ bool eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * return false; // Add configuration to the list. - m_methods.push_back(move(cfg)); + m_methods.push_back(std::move(cfg)); } return true; } -void eap::config_provider::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::config_provider::operator<<(_Inout_ cursor_out &cursor) const { - config::pack(cursor); - eapserial::pack(cursor, m_read_only ); - eapserial::pack(cursor, m_id ); - eapserial::pack(cursor, m_name ); - eapserial::pack(cursor, m_help_email ); - eapserial::pack(cursor, m_help_web ); - eapserial::pack(cursor, m_help_phone ); - eapserial::pack(cursor, m_lbl_alt_credential); - eapserial::pack(cursor, m_lbl_alt_identity ); - eapserial::pack(cursor, m_lbl_alt_password ); - eapserial::pack(cursor, m_methods ); + config::operator<<(cursor); + cursor << m_read_only ; + cursor << m_id ; + cursor << m_name ; + cursor << m_help_email ; + cursor << m_help_web ; + cursor << m_help_phone ; + cursor << m_lbl_alt_credential; + cursor << m_lbl_alt_identity ; + cursor << m_lbl_alt_password ; + cursor << m_methods ; } size_t eap::config_provider::get_pk_size() const { return - config::get_pk_size() + - eapserial::get_pk_size(m_read_only ) + - eapserial::get_pk_size(m_id ) + - eapserial::get_pk_size(m_name ) + - eapserial::get_pk_size(m_help_email ) + - eapserial::get_pk_size(m_help_web ) + - eapserial::get_pk_size(m_help_phone ) + - eapserial::get_pk_size(m_lbl_alt_credential) + - eapserial::get_pk_size(m_lbl_alt_identity ) + - eapserial::get_pk_size(m_lbl_alt_password ) + - eapserial::get_pk_size(m_methods ); + config::get_pk_size() + + pksizeof(m_read_only ) + + pksizeof(m_id ) + + pksizeof(m_name ) + + pksizeof(m_help_email ) + + pksizeof(m_help_web ) + + pksizeof(m_help_phone ) + + pksizeof(m_lbl_alt_credential) + + pksizeof(m_lbl_alt_identity ) + + pksizeof(m_lbl_alt_password ) + + pksizeof(m_methods ); } -void eap::config_provider::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::config_provider::operator>>(_Inout_ cursor_in &cursor) { - config::unpack(cursor); - eapserial::unpack(cursor, m_read_only ); - eapserial::unpack(cursor, m_id ); - eapserial::unpack(cursor, m_name ); - eapserial::unpack(cursor, m_help_email ); - eapserial::unpack(cursor, m_help_web ); - eapserial::unpack(cursor, m_help_phone ); - eapserial::unpack(cursor, m_lbl_alt_credential); - eapserial::unpack(cursor, m_lbl_alt_identity ); - eapserial::unpack(cursor, m_lbl_alt_password ); + config::operator>>(cursor); + cursor >> m_read_only ; + cursor >> m_id ; + cursor >> m_name ; + cursor >> m_help_email ; + cursor >> m_help_web ; + cursor >> m_help_phone ; + cursor >> m_lbl_alt_credential; + cursor >> m_lbl_alt_identity ; + cursor >> m_lbl_alt_password ; list::size_type count; bool is_nonnull; - eapserial::unpack(cursor, count); + cursor >> count; m_methods.clear(); for (list::size_type i = 0; i < count; i++) { - eapserial::unpack(cursor, is_nonnull); + cursor >> is_nonnull; if (is_nonnull) { unique_ptr el(m_module.make_config_method()); - el->unpack(cursor); - m_methods.push_back(move(el)); + cursor >> *el; + m_methods.push_back(std::move(el)); } else m_methods.push_back(nullptr); } @@ -669,8 +669,8 @@ eap::config_providers::config_providers(_In_ const config_providers &other) : eap::config_providers::config_providers(_Inout_ config_providers &&other) : - m_providers(move(other.m_providers)), - config(move(other)) + m_providers(std::move(other.m_providers)), + config(std::move(other)) { } @@ -689,8 +689,8 @@ eap::config_providers& eap::config_providers::operator=(_In_ const config_provid eap::config_providers& eap::config_providers::operator=(_Inout_ config_providers &&other) { if (this != &other) { - (config&&)*this = move(other); - m_providers = move(other.m_providers); + (config&&)*this = std::move(other); + m_providers = std::move(other.m_providers); } return *this; @@ -769,17 +769,17 @@ bool eap::config_providers::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR return false; // Add provider to the list. - m_providers.push_back(move(prov)); + m_providers.push_back(std::move(prov)); } return true; } -void eap::config_providers::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::config_providers::operator<<(_Inout_ cursor_out &cursor) const { - config::pack(cursor); - eapserial::pack(cursor, m_providers); + config::operator<<(cursor); + cursor << m_providers; } @@ -787,20 +787,20 @@ size_t eap::config_providers::get_pk_size() const { return config::get_pk_size() + - eapserial::get_pk_size(m_providers); + pksizeof(m_providers); } -void eap::config_providers::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::config_providers::operator>>(_Inout_ cursor_in &cursor) { - config::unpack(cursor); + config::operator>>(cursor); list::size_type count; - eapserial::unpack(cursor, count); + cursor >> count; m_providers.clear(); for (list::size_type i = 0; i < count; i++) { config_provider el(m_module); - el.unpack(cursor); - m_providers.push_back(move(el)); + cursor >> el; + m_providers.push_back(std::move(el)); } } diff --git a/lib/EAPBase/src/Credentials.cpp b/lib/EAPBase/src/Credentials.cpp index f3f8bdb..3d8e824 100644 --- a/lib/EAPBase/src/Credentials.cpp +++ b/lib/EAPBase/src/Credentials.cpp @@ -233,28 +233,28 @@ bool eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR } -void eap::credentials_pass::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::credentials_pass::operator<<(_Inout_ cursor_out &cursor) const { - eap::credentials::pack(cursor); - eapserial::pack(cursor, m_identity); - eapserial::pack(cursor, m_password); + credentials::operator<<(cursor); + cursor << m_identity; + cursor << m_password; } size_t eap::credentials_pass::get_pk_size() const { return - eap::credentials::get_pk_size() + - eapserial::get_pk_size(m_identity) + - eapserial::get_pk_size(m_password); + credentials::get_pk_size() + + pksizeof(m_identity) + + pksizeof(m_password); } -void eap::credentials_pass::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::credentials_pass::operator>>(_Inout_ cursor_in &cursor) { - eap::credentials::unpack(cursor); - eapserial::unpack(cursor, m_identity); - eapserial::unpack(cursor, m_password); + credentials::operator>>(cursor); + cursor >> m_identity; + cursor >> m_password; } diff --git a/lib/TLS/include/Config.h b/lib/TLS/include/Config.h index 7461245..eb64a4d 100644 --- a/lib/TLS/include/Config.h +++ b/lib/TLS/include/Config.h @@ -141,7 +141,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -155,7 +155,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} diff --git a/lib/TLS/include/Credentials.h b/lib/TLS/include/Credentials.h index 2ce71a5..2fe6d20 100644 --- a/lib/TLS/include/Credentials.h +++ b/lib/TLS/include/Credentials.h @@ -137,7 +137,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -151,7 +151,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// @} diff --git a/lib/TLS/src/Config.cpp b/lib/TLS/src/Config.cpp index 2d97cd1..0968c3c 100644 --- a/lib/TLS/src/Config.cpp +++ b/lib/TLS/src/Config.cpp @@ -87,7 +87,7 @@ eap::config_method_tls::config_method_tls(_Inout_ config_method_tls &&other) : } -eap::config_method_tls& eap::config_method_tls::operator=(_In_ const eap::config_method_tls &other) +eap::config_method_tls& eap::config_method_tls::operator=(_In_ const config_method_tls &other) { if (this != &other) { (config_method&)*this = other; @@ -99,7 +99,7 @@ eap::config_method_tls& eap::config_method_tls::operator=(_In_ const eap::config } -eap::config_method_tls& eap::config_method_tls::operator=(_Inout_ eap::config_method_tls &&other) +eap::config_method_tls& eap::config_method_tls::operator=(_Inout_ config_method_tls &&other) { if (this != &other) { (config_method&&)*this = std::move(other); @@ -226,7 +226,7 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR // Log loaded CA certificates. list cert_names; for (std::list::const_iterator cert = m_trusted_root_ca.cbegin(), cert_end = m_trusted_root_ca.cend(); cert != cert_end; ++cert) - cert_names.push_back(std::move(eap::get_cert_title(*cert))); + cert_names.push_back(std::move(get_cert_title(*cert))); m_module.log_config((xpathServerSideCredential + L"/CA").c_str(), cert_names); } @@ -256,28 +256,28 @@ bool eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR } -void eap::config_method_tls::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::config_method_tls::operator<<(_Inout_ cursor_out &cursor) const { - eap::config_method::pack(cursor); - eapserial::pack(cursor, m_trusted_root_ca); - eapserial::pack(cursor, m_server_names ); + config_method::operator<<(cursor); + cursor << m_trusted_root_ca; + cursor << m_server_names ; } size_t eap::config_method_tls::get_pk_size() const { return - eap::config_method::get_pk_size() + - eapserial::get_pk_size(m_trusted_root_ca) + - eapserial::get_pk_size(m_server_names ); + config_method::get_pk_size() + + pksizeof(m_trusted_root_ca) + + pksizeof(m_server_names ); } -void eap::config_method_tls::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::config_method_tls::operator>>(_Inout_ cursor_in &cursor) { - eap::config_method::unpack(cursor); - eapserial::unpack(cursor, m_trusted_root_ca); - eapserial::unpack(cursor, m_server_names ); + config_method::operator>>(cursor); + cursor >> m_trusted_root_ca; + cursor >> m_server_names ; } @@ -289,7 +289,7 @@ eap::credentials* eap::config_method_tls::make_credentials() const eap::type_t eap::config_method_tls::get_method_id() const { - return eap::type_tls; + return type_tls; } diff --git a/lib/TLS/src/Credentials.cpp b/lib/TLS/src/Credentials.cpp index 10f7670..3bb905d 100644 --- a/lib/TLS/src/Credentials.cpp +++ b/lib/TLS/src/Credentials.cpp @@ -167,25 +167,25 @@ bool eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR * } -void eap::credentials_tls::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::credentials_tls::operator<<(_Inout_ cursor_out &cursor) const { - eap::credentials::pack(cursor); - eapserial::pack(cursor, m_cert); + credentials::operator<<(cursor); + cursor << m_cert; } size_t eap::credentials_tls::get_pk_size() const { return - eap::credentials::get_pk_size() + - eapserial::get_pk_size(m_cert); + credentials::get_pk_size() + + pksizeof(m_cert); } -void eap::credentials_tls::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::credentials_tls::operator>>(_Inout_ cursor_in &cursor) { - eap::credentials::unpack(cursor); - eapserial::unpack(cursor, m_cert); + credentials::operator>>(cursor); + cursor >> m_cert; } @@ -279,7 +279,7 @@ std::wstring eap::credentials_tls::get_identity() const tstring eap::credentials_tls::get_name() const { - return m_cert ? std::move(eap::get_cert_title(m_cert)) : L""; + return m_cert ? std::move(get_cert_title(m_cert)) : L""; } diff --git a/lib/TTLS/include/Config.h b/lib/TTLS/include/Config.h index b4d1271..4b90022 100644 --- a/lib/TTLS/include/Config.h +++ b/lib/TTLS/include/Config.h @@ -127,7 +127,7 @@ namespace eap { /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -141,7 +141,7 @@ namespace eap { /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// /// Returns EAP method type of this configuration diff --git a/lib/TTLS/include/Credentials.h b/lib/TTLS/include/Credentials.h index 1824de1..31a13f0 100644 --- a/lib/TTLS/include/Credentials.h +++ b/lib/TTLS/include/Credentials.h @@ -133,7 +133,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void pack(_Inout_ eapserial::cursor_out &cursor) const; + virtual void operator<<(_Inout_ cursor_out &cursor) const; /// /// Returns packed size of a configuration @@ -147,7 +147,7 @@ namespace eap /// /// \param[inout] cursor Memory cursor /// - virtual void unpack(_Inout_ eapserial::cursor_in &cursor); + virtual void operator>>(_Inout_ cursor_in &cursor); /// \name Storage /// @{ diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index 61aaaf5..ea905e2 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -146,7 +146,7 @@ bool eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERRO { // PAP m_module.log_config((xpath + L"/NonEAPAuthMethod").c_str(), L"PAP"); - m_inner.reset(new eap::config_method_pap(m_module)); + m_inner.reset(new config_method_pap(m_module)); if (!m_inner->load(pXmlElInnerAuthenticationMethod, ppEapError)) return false; } else { @@ -158,19 +158,19 @@ bool eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERRO } -void eap::config_method_ttls::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::config_method_ttls::operator<<(_Inout_ cursor_out &cursor) const { - eap::config_method_tls::pack(cursor); + config_method_tls::operator<<(cursor); if (m_inner) { - if (dynamic_cast(m_inner.get())) { - eapserial::pack(cursor, eap::type_pap); - m_inner->pack(cursor); + if (dynamic_cast(m_inner.get())) { + cursor << type_pap; + cursor << *m_inner; } else { assert(0); // Unsupported inner authentication method type. - eapserial::pack(cursor, eap::type_undefined); + cursor << type_undefined; } } else - eapserial::pack(cursor, eap::type_undefined); + cursor << type_undefined; } @@ -178,33 +178,33 @@ size_t eap::config_method_ttls::get_pk_size() const { size_t size_inner; if (m_inner) { - if (dynamic_cast(m_inner.get())) { + if (dynamic_cast(m_inner.get())) { size_inner = - eapserial::get_pk_size(eap::type_pap) + - m_inner->get_pk_size(); + pksizeof(type_pap) + + pksizeof(*m_inner); } else { assert(0); // Unsupported inner authentication method type. - size_inner = eapserial::get_pk_size(eap::type_undefined); + size_inner = pksizeof(type_undefined); } } else - size_inner = eapserial::get_pk_size(eap::type_undefined); + size_inner = pksizeof(type_undefined); return - eap::config_method_tls::get_pk_size() + + config_method_tls::get_pk_size() + size_inner; } -void eap::config_method_ttls::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::config_method_ttls::operator>>(_Inout_ cursor_in &cursor) { - eap::config_method_tls::unpack(cursor); + config_method_tls::operator>>(cursor); - eap::type_t eap_type; - eapserial::unpack(cursor, eap_type); + type_t eap_type; + cursor >> eap_type; switch (eap_type) { - case eap::type_pap: - m_inner.reset(new eap::config_method_pap(m_module)); - m_inner->unpack(cursor); + case type_pap: + m_inner.reset(new config_method_pap(m_module)); + cursor >> *m_inner; break; default: assert(0); // Unsupported inner authentication method type. @@ -215,5 +215,5 @@ void eap::config_method_ttls::unpack(_Inout_ eapserial::cursor_in &cursor) eap::type_t eap::config_method_ttls::get_method_id() const { - return eap::type_ttls; + return type_ttls; } diff --git a/lib/TTLS/src/Credentials.cpp b/lib/TTLS/src/Credentials.cpp index 741c8f8..671c408 100644 --- a/lib/TTLS/src/Credentials.cpp +++ b/lib/TTLS/src/Credentials.cpp @@ -149,19 +149,19 @@ bool eap::credentials_ttls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR } -void eap::credentials_ttls::pack(_Inout_ eapserial::cursor_out &cursor) const +void eap::credentials_ttls::operator<<(_Inout_ cursor_out &cursor) const { - eap::credentials_tls::pack(cursor); + credentials_tls::operator<<(cursor); if (m_inner) { - if (dynamic_cast(m_inner.get())) { - eapserial::pack(cursor, eap::type_pap); - m_inner->pack(cursor); + if (dynamic_cast(m_inner.get())) { + cursor << type_pap; + cursor << *m_inner; } else { assert(0); // Unsupported inner authentication method type. - eapserial::pack(cursor, eap::type_undefined); + cursor << type_undefined; } } else - eapserial::pack(cursor, eap::type_undefined); + cursor << type_undefined; } @@ -169,33 +169,33 @@ size_t eap::credentials_ttls::get_pk_size() const { size_t size_inner; if (m_inner) { - if (dynamic_cast(m_inner.get())) { + if (dynamic_cast(m_inner.get())) { size_inner = - eapserial::get_pk_size(eap::type_pap) + - m_inner->get_pk_size(); + pksizeof(type_pap) + + pksizeof(*m_inner); } else { assert(0); // Unsupported inner authentication method type. - size_inner = eapserial::get_pk_size(eap::type_undefined); + size_inner = pksizeof(type_undefined); } } else - size_inner = eapserial::get_pk_size(eap::type_undefined); + size_inner = pksizeof(type_undefined); return - eap::credentials_tls::get_pk_size() + + credentials_tls::get_pk_size() + size_inner; } -void eap::credentials_ttls::unpack(_Inout_ eapserial::cursor_in &cursor) +void eap::credentials_ttls::operator>>(_Inout_ cursor_in &cursor) { - eap::credentials_tls::unpack(cursor); + credentials_tls::operator>>(cursor); - eap::type_t eap_type; - eapserial::unpack(cursor, eap_type); + type_t eap_type; + cursor >> eap_type; switch (eap_type) { - case eap::type_pap: - m_inner.reset(new eap::credentials_pap(m_module)); - m_inner->unpack(cursor); + case type_pap: + m_inner.reset(new credentials_pap(m_module)); + cursor >> *m_inner; break; default: assert(0); // Unsupported inner authentication method type.