EAP-TTLS session development continues...

This commit is contained in:
2016-08-05 00:32:57 +02:00
parent a102b43a19
commit f2aa43913d
14 changed files with 565 additions and 39 deletions

View File

@@ -24,6 +24,14 @@ namespace eap
/// TTLS session
///
class session_ttls;
///
/// EAP-TTLS packet flags
///
/// \sa [Extensible Authentication Protocol Tunneled Transport Layer Security Authenticated Protocol Version 0 (EAP-TTLSv0) (Chapter: 9.1 Packet Format)](https://tools.ietf.org/html/rfc5281#section-9.1)
///
enum ttls_flags_t;
}
#pragma once
@@ -33,6 +41,14 @@ namespace eap
namespace eap
{
enum ttls_flags_t {
ttls_flags_length_incl = 0x80, ///< Length included
ttls_flags_more_frag = 0x40, ///< More fragments
ttls_flags_start = 0x20, ///< Start
ttls_flags_ver_mask = 0x07, ///< Version mask
};
class session_ttls : public session<config_method_ttls, credentials_ttls, bool, bool>
{
public:
@@ -75,6 +91,27 @@ namespace eap
///
session_ttls& operator=(_Inout_ session_ttls &&other);
/// \name Session start/end
/// @{
///
/// 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)
///
/// \returns
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool begin(
_In_ DWORD dwFlags,
_In_ const EapAttributes *pAttributeArray,
_In_ HANDLE hTokenImpersonateUser,
_In_ DWORD dwMaxSendPacketSize,
_Out_ EAP_ERROR **ppEapError);
/// @}
/// \name Packet processing
/// @{
@@ -93,6 +130,20 @@ namespace eap
_Out_ EapPeerMethodOutput *pEapOutput,
_Out_ EAP_ERROR **ppEapError);
///
/// Obtains a response packet from the EAP method.
///
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
///
/// \returns
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
virtual bool get_response_packet(
_Inout_ DWORD *pdwSendPacketSize,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Out_ EAP_ERROR **ppEapError);
///
/// Obtains the result of an authentication session from the EAP method.
///
@@ -108,5 +159,23 @@ namespace eap
_Out_ EAP_ERROR **ppEapError);
/// @}
public:
enum phase_t {
phase_handshake_start = 0,
} m_phase; ///< Session phase
enum version_t {
version_0 = 0, ///< EAP-TTLS v0
} m_version; ///< EAP-TTLS version
struct {
EapCode m_code; ///< Packet code
BYTE m_id; ///< Packet ID
BYTE m_flags; ///< Packet flags
std::vector<BYTE> m_data; ///< Packet data
}
m_packet_req, ///< Request packet
m_packet_res; ///< Response packet
};
}