' ########################################################################################
' Microsoft Windows
' File: dot1x.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_dot1x_PBI)
#DEFINE PBX_dot1x_PBI
%EQUATE `DOT1X_INC = 1
#INCLUDE ONCE "Legacy/System/l2cmn.inc"
#INCLUDE ONCE "Legacy/System/eaptypes.inc"
'/*
' The identity that is being used by the 1X module. This is a function of the
' onex auth mode and system triggers (e.g. user logon/logoff)
' */
' enum ONEX_AUTH_IDENTITY
%EQUATE `OneXAuthIdentityNone = 0
%EQUATE `OneXAuthIdentityMachine = 1
%EQUATE `OneXAuthIdentityUser = 2
%EQUATE `OneXAuthIdentityExplicitUser = 3
%EQUATE `OneXAuthIdentityGuest = 4
%EQUATE `OneXAuthIdentityInvalid = 5
'/*
' The 1X authentication status. Each of the auth status corresponds to one or
' more of the internal 1X states.
' */
' enum ONEX_AUTH_STATUS
%EQUATE `OneXAuthNotStarted = 0
%EQUATE `OneXAuthInProgress = 1
%EQUATE `OneXAuthNoAuthenticatorFound = 2
%EQUATE `OneXAuthSuccess = 3
%EQUATE `OneXAuthFailure = 4
%EQUATE `OneXAuthInvalid = 5
'/*
' 1X specific reason codes
' */
' enum ONEX_REASON_CODE
%EQUATE `ONEX_REASON_CODE_SUCCESS = 0
%EQUATE `ONEX_REASON_START = %L2_REASON_CODE_ONEX_BASE
%EQUATE `ONEX_UNABLE_TO_IDENTIFY_USER = %ONEX_REASON_START + 1
%EQUATE `ONEX_IDENTITY_NOT_FOUND = %ONEX_UNABLE_TO_IDENTIFY_USER + 1
%EQUATE `ONEX_UI_DISABLED = %ONEX_IDENTITY_NOT_FOUND + 1
%EQUATE `ONEX_UI_FAILURE = %ONEX_UI_DISABLED + 1
%EQUATE `ONEX_EAP_FAILURE_RECEIVED = %ONEX_UI_FAILURE + 1
%EQUATE `ONEX_AUTHENTICATOR_NO_LONGER_PRESENT = %ONEX_EAP_FAILURE_RECEIVED + 1
%EQUATE `ONEX_NO_RESPONSE_TO_IDENTITY = %ONEX_AUTHENTICATOR_NO_LONGER_PRESENT + 1
%EQUATE `ONEX_PROFILE_VERSION_NOT_SUPPORTED = %ONEX_NO_RESPONSE_TO_IDENTITY + 1
%EQUATE `ONEX_PROFILE_INVALID_LENGTH = %ONEX_PROFILE_VERSION_NOT_SUPPORTED + 1
%EQUATE `ONEX_PROFILE_DISALLOWED_EAP_TYPE = %ONEX_PROFILE_INVALID_LENGTH + 1
%EQUATE `ONEX_PROFILE_INVALID_EAP_TYPE_OR_FLAG = %ONEX_PROFILE_DISALLOWED_EAP_TYPE + 1
%EQUATE `ONEX_PROFILE_INVALID_ONEX_FLAGS = %ONEX_PROFILE_INVALID_EAP_TYPE_OR_FLAG + 1
%EQUATE `ONEX_PROFILE_INVALID_TIMER_VALUE = %ONEX_PROFILE_INVALID_ONEX_FLAGS + 1
%EQUATE `ONEX_PROFILE_INVALID_SUPPLICANT_MODE = %ONEX_PROFILE_INVALID_TIMER_VALUE + 1
%EQUATE `ONEX_PROFILE_INVALID_AUTH_MODE = %ONEX_PROFILE_INVALID_SUPPLICANT_MODE + 1
%EQUATE `ONEX_PROFILE_INVALID_EAP_CONNECTION_PROPERTIES = %ONEX_PROFILE_INVALID_AUTH_MODE + 1
%EQUATE `ONEX_UI_CANCELLED = %ONEX_PROFILE_INVALID_EAP_CONNECTION_PROPERTIES + 1
%EQUATE `ONEX_PROFILE_INVALID_EXPLICIT_CREDENTIALS = %ONEX_UI_CANCELLED + 1
%EQUATE `ONEX_PROFILE_EXPIRED_EXPLICIT_CREDENTIALS = %ONEX_PROFILE_INVALID_EXPLICIT_CREDENTIALS + 1
%EQUATE `ONEX_UI_NOT_PERMITTED = %ONEX_PROFILE_EXPIRED_EXPLICIT_CREDENTIALS + 1
'/*
' Events for which 1X sends notifications to MSM
' On getting an event notification the callee should switch on the dwEvent.
' If dwEvent = OneXNotificationTypeResultUpdate, pvEventData points to an
' ONEX_RESULT_UPDATE_DATA structure
' If dwEvent = OneXNotificationTypeOneXUserIdentified, pvEventData points to
' a ONEX_USER_INFO structure
' If dwEvent = OneXNotificationTypeGotOneXIdentityString, pvEventData points to
' the identity (LPWSTR) being used for the 1X authentication
' If dwEvent = OneXNotificationTypeFallenBackOnGuest pvEventData is NULL
' if dwEvent = OneXNotificationTypeAuthRestarted, pvEventData points
' to the restart reason
' */
' enum ONEX_NOTIFICATION_TYPE
%EQUATE `OneXPublicNotificationBase = 0
%EQUATE `OneXNotificationTypeResultUpdate = 1
%EQUATE `OneXNotificationTypeAuthRestarted = 2
%EQUATE `OneXNotificationTypeEventInvalid = 3
%EQUATE `OneXNumNotifications = %OneXNotificationTypeEventInvalid
'/*
' The following list enumerates the reason for the 1X authentication process
' getting restarted
' */
' enum ONEX_AUTH_RESTART_REASON
%EQUATE `OneXRestartReasonPeerInitiated = 0
%EQUATE `OneXRestartReasonMsmInitiated = 1
%EQUATE `OneXRestartReasonOneXHeldStateTimeout = 2
%EQUATE `OneXRestartReasonOneXAuthTimeout = 3
%EQUATE `OneXRestartReasonOneXConfigurationChanged = 4
%EQUATE `OneXRestartReasonOneXUserChanged = 5
%EQUATE `OneXRestartReasonQuarantineStateChanged = 6
%EQUATE `OneXRestartReasonAltCredsTrial = 7
%EQUATE `OneXRestartReasonInvalid = 8
' // Size = 8 bytes
TYPE ONEX_VARIABLE_BLOB DWORD
 dwSize AS DWORD
 dwOffset AS DWORD
END TYPE
'/*
' The set of parameters that define the authentication context for 1X
' */
' // Size = 64 bytes
TYPE ONEX_AUTH_PARAMS DWORD
 fUpdatePending AS LONG
 oneXConnProfile AS ONEX_VARIABLE_BLOB
 authIdentity AS LONG ' ONEX_AUTH_IDENTITY
 dwQuarantineState AS DWORD
 fSessionId AS BIT * 1 IN DWORD
 fhUserToken AS BIT * 1
 fOnexUserProfile AS BIT * 1
 fIdentity AS BIT * 1
 fUserName AS BIT * 1
 fDomain AS BIT * 1
 dwSessionId AS DWORD
 hUserToken AS DWORD
 OneXUserProfile AS ONEX_VARIABLE_BLOB
 Identity AS ONEX_VARIABLE_BLOB
 UserName AS ONEX_VARIABLE_BLOB
 Domain AS ONEX_VARIABLE_BLOB
END TYPE
' // Size = 92 bytes
TYPE ONEX_EAP_ERROR DWORD
 dwWinError AS DWORD
 type AS EAP_METHOD_TYPE
 dwReasonCode AS DWORD
 rootCauseGuid AS GUID ' GUID
 repairGuid AS GUID ' GUID
 helpLinkGuid AS GUID ' GUID
 fRootCauseString AS BIT * 1 IN DWORD
 fRepairString AS BIT * 1
 RootCauseString AS ONEX_VARIABLE_BLOB
 RepairString AS ONEX_VARIABLE_BLOB
END TYPE
' // Size = 12 bytes
TYPE ONEX_STATUS DWORD
 authStatus AS LONG ' ONEX_AUTH_STATUS
 ' /*
 ' Any errors that happened during the authentication are indicated as
 ' error and reason codes below
 ' */
 dwReason AS DWORD
 dwError AS DWORD
END TYPE
' enum ONEX_EAP_METHOD_BACKEND_SUPPORT
%EQUATE `OneXEapMethodBackendSupportUnknown = 0
%EQUATE `OneXEapMethodBackendSupported = 1
%EQUATE `OneXEapMethodBackendUnsupported = 2
' // Size = 40 bytes
TYPE ONEX_RESULT_UPDATE_DATA DWORD
 oneXStatus AS ONEX_STATUS
 BackendSupport AS LONG ' ONEX_EAP_METHOD_BACKEND_SUPPORT
 fBackendEngaged AS LONG
 fOneXAuthParams AS BIT * 1 IN DWORD
 fEapError AS BIT * 1
 authParams AS ONEX_VARIABLE_BLOB
 eapError AS ONEX_VARIABLE_BLOB
END TYPE
' // Size = 24 bytes
TYPE ONEX_USER_INFO DWORD
 authIdentity AS LONG ' ONEX_AUTH_IDENTITY
 fUserName AS BIT * 1 IN DWORD
 fDomainName AS BIT * 1
 UserName AS ONEX_VARIABLE_BLOB
 DomainName AS ONEX_VARIABLE_BLOB
END TYPE
#ENDIF
