Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
4.2 KiB

  1. /*
  2. Copyright (c) 1997, Microsoft Corporation, all rights reserved
  3. Description:
  4. Sample Extensible Authentication Protocol header file.
  5. History:
  6. */
  7. #ifndef _EAP_H_
  8. #define _EAP_H_
  9. #define PPP_EAP_PROTOCOL_ID 20 // This protocols Type Id
  10. // Defines states within the this EAP protocol.
  11. typedef enum _MYSTATE
  12. {
  13. MYSTATE_Initial,
  14. MYSTATE_WaitForUserOK,
  15. MYSTATE_WaitForRequest,
  16. MYSTATE_ReqSent,
  17. MYSTATE_WaitForAuthenticationToComplete,
  18. MYSTATE_Done
  19. } MYSTATE;
  20. typedef struct _EAPCB
  21. {
  22. MYSTATE EapState;
  23. DWORD fFlags;
  24. BOOL fAuthenticator;
  25. LPVOID pWorkBuffer;
  26. CHAR aszIdentity[ UNLEN + 1 ];
  27. DWORD dwIdExpected;
  28. CHAR aszPassword[ PWLEN + 1 ];
  29. DWORD dwResult;
  30. DWORD dwInitialPacketId;
  31. BYTE* pDataFromInteractiveUI;
  32. BYTE bRecvPacketId; //Special Id for Wireless case
  33. //because it does not retransmit packets
  34. DWORD dwSizeOfDataFromInteractiveUI;
  35. PBYTE pUIContext;
  36. RAS_AUTH_ATTRIBUTE* pUserAttributes;
  37. RAS_AUTH_ATTRIBUTE* pMPPEKeyAttributes; // MPPE key
  38. } EAPCB;
  39. typedef struct _EAP_NAME_DIALOG
  40. {
  41. WCHAR awszIdentity[ UNLEN + 1 ];
  42. WCHAR awszPassword[ PWLEN + 1 ];
  43. } EAP_NAME_DIALOG;
  44. // Globals
  45. #ifdef RASEAPGLOBALS
  46. DWORD g_dwEapTraceId = INVALID_TRACEID;
  47. HINSTANCE g_hInstance = NULL;
  48. #else
  49. extern DWORD g_dwEapTraceId;
  50. extern HINSTANCE g_hInstance;
  51. #endif // RASEAPGLOBALS
  52. // Function Prototypes
  53. VOID
  54. EapTrace(
  55. IN CHAR* Format,
  56. ...
  57. );
  58. DWORD APIENTRY
  59. EapBegin(
  60. OUT VOID** ppWorkBuf,
  61. IN VOID* pInfo
  62. );
  63. DWORD APIENTRY
  64. EapEnd(
  65. IN VOID* pWorkBuf
  66. );
  67. DWORD APIENTRY
  68. EapMakeMessage(
  69. IN VOID* pWorkBuf,
  70. IN PPP_EAP_PACKET* pReceiveBuf,
  71. OUT PPP_EAP_PACKET* pSendBuf,
  72. IN DWORD cbSendBuf,
  73. OUT PPP_EAP_OUTPUT* pResult,
  74. IN PPP_EAP_INPUT* pInput
  75. );
  76. DWORD
  77. AuthenticateeMakeMessage(
  78. IN EAPCB* pwb,
  79. IN PPP_EAP_PACKET* pReceiveBuf,
  80. OUT PPP_EAP_PACKET* pSendBuf,
  81. IN DWORD cbSendBuf,
  82. IN PPP_EAP_INPUT* pInput,
  83. OUT PPP_EAP_OUTPUT* pResult
  84. );
  85. DWORD
  86. AuthenticatorMakeMessage(
  87. IN EAPCB* pwb,
  88. IN PPP_EAP_PACKET* pReceiveBuf,
  89. OUT PPP_EAP_PACKET* pSendBuf,
  90. IN DWORD cbSendBuf,
  91. IN PPP_EAP_INPUT* pInput,
  92. OUT PPP_EAP_OUTPUT* pResult
  93. );
  94. VOID
  95. MakeResponseMessage(
  96. IN EAPCB* pwb,
  97. IN PPP_EAP_PACKET* pReceiveBuf,
  98. OUT PPP_EAP_PACKET * pSendBuf,
  99. IN DWORD cbSendBuf
  100. );
  101. VOID
  102. MakeResponseMessage1(
  103. IN EAPCB* pwb,
  104. OUT PPP_EAP_PACKET * pSendBuf,
  105. IN DWORD cbSendBuf
  106. );
  107. VOID
  108. MakeResultMessage(
  109. IN EAPCB * pwb,
  110. IN DWORD dwError,
  111. OUT PPP_EAP_PACKET* pSendBuf,
  112. IN DWORD cbSendBuf
  113. );
  114. DWORD
  115. GetPasswordFromResponse(
  116. IN PPP_EAP_PACKET* pReceiveBuf,
  117. OUT CHAR* pszUserName
  118. );
  119. DWORD
  120. MakeAuthenticationAttributes(
  121. IN CHAR * szUserName,
  122. IN CHAR * szPassword,
  123. IN EAPCB * pwb
  124. );
  125. DWORD
  126. MakeMPPEKeyAttributes(
  127. IN EAPCB * pwb
  128. );
  129. DWORD
  130. GetIdentity(
  131. IN HWND hwndParent,
  132. IN BYTE* pUserDataIn,
  133. IN DWORD dwSizeOfUserDataIn,
  134. OUT BYTE** ppUserDataOut,
  135. OUT DWORD* pdwSizeOfUserDataOut,
  136. OUT WCHAR** ppwszIdentityOut
  137. );
  138. VOID
  139. GetUsernameAndPassword(
  140. IN HWND hwndParent,
  141. IN EAP_NAME_DIALOG* pEapNameDialog
  142. );
  143. INT_PTR CALLBACK
  144. UsernameDialogProc(
  145. IN HWND hWnd,
  146. IN UINT unMsg,
  147. IN WPARAM wParam,
  148. IN LPARAM lParam
  149. );
  150. BOOL
  151. InitUsernameDialog(
  152. IN HWND hWnd,
  153. IN LPARAM lParam
  154. );
  155. BOOL
  156. UsernameCommand(
  157. IN EAP_NAME_DIALOG* pEapNameDialog,
  158. IN WORD wId,
  159. IN HWND hWndDlg
  160. );
  161. #endif // _EAP_H_