home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / rras / eap / eap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-10  |  3.0 KB  |  165 lines

  1. /********************************************************************/
  2. /**          Copyright(c) 1985-1997 Microsoft Corporation.         **/
  3. /********************************************************************/
  4.  
  5. //***
  6. //
  7. // Filename:    eap.h
  8. //
  9. // Description: Sample Extensible Authentication Protocol header file
  10. //
  11. //
  12.  
  13. #ifndef _EAP_H_
  14. #define _EAP_H_
  15.  
  16. //
  17. // This protocols Type Id
  18. //
  19.  
  20. #define PPP_EAP_PROTOCOL_ID 20
  21.  
  22. //
  23. // Defines states within the this EAP protocol.
  24. //
  25.  
  26. typedef enum _MYSTATE 
  27. {
  28.     MYSTATE_Initial,
  29.     MYSTATE_ReqSent,
  30.     MYSTATE_WaitForAuthenticationToComplete,
  31.     MYSTATE_Done
  32.  
  33. }MYSTATE;
  34.  
  35. typedef struct _EAPCB 
  36. {
  37.     MYSTATE     EapState;
  38.  
  39.     HANDLE      hPort;
  40.  
  41.     BOOL        fAuthenticator;
  42.  
  43.     LPVOID      pWorkBuffer;
  44.  
  45.     CHAR        szIdentity[ UNLEN + 1 ];
  46.  
  47.     DWORD       dwIdExpected;
  48.  
  49.     CHAR        szPassword[ PWLEN + 1 ];
  50.  
  51.     DWORD       dwResult;
  52.  
  53.     RAS_AUTH_ATTRIBUTE * pUserAttributes;
  54.  
  55. } EAPCB, *PEAPCB;
  56.  
  57. //
  58. // Function Prototypes
  59. //
  60.  
  61. DWORD APIENTRY
  62. EapBegin(
  63.     OUT VOID** ppWorkBuf,
  64.     IN  VOID*  pInfo 
  65. );
  66.  
  67. DWORD APIENTRY
  68. EapEnd(
  69.     IN VOID* pWorkBuf 
  70. );
  71.  
  72. DWORD APIENTRY
  73. EapMakeMessage(
  74.     IN  VOID*               pWorkBuf,
  75.     IN  PPP_EAP_PACKET*     pReceiveBuf,
  76.     OUT PPP_EAP_PACKET*     pSendBuf,
  77.     IN  DWORD               cbSendBuf,
  78.     OUT PPP_EAP_OUTPUT*     pResult,
  79.     IN  PPP_EAP_INPUT*      pInput 
  80. );
  81.  
  82. DWORD
  83. CMakeMessage(
  84.     IN  EAPCB*              pwb,
  85.     IN  PPP_EAP_PACKET*     pReceiveBuf,
  86.     OUT PPP_EAP_PACKET*     pSendBuf,
  87.     IN  DWORD               cbSendBuf,
  88.     IN PPP_EAP_INPUT*       pInput,
  89.     OUT  PPP_EAP_OUTPUT*    pResult
  90. );
  91.  
  92. DWORD
  93. SMakeMessage(
  94.     IN  EAPCB*              pwb,
  95.     IN  PPP_EAP_PACKET*     pReceiveBuf,
  96.     OUT PPP_EAP_PACKET*     pSendBuf,
  97.     IN  DWORD               cbSendBuf,
  98.     IN PPP_EAP_INPUT*       pInput,
  99.     OUT  PPP_EAP_OUTPUT*    pResult
  100. );
  101.  
  102. VOID
  103. MakeResponseMessage(
  104.     IN  EAPCB*              pwb,
  105.     IN  PPP_EAP_PACKET*     pReceiveBuf,
  106.     OUT PPP_EAP_PACKET *    pSendBuf,
  107.     IN DWORD                cbSendBuf
  108. );
  109.  
  110. VOID
  111. MakeResultMessage(
  112.     IN  DWORD              dwError,
  113.     IN  BYTE               bId,
  114.     OUT PPP_EAP_PACKET*    pSendBuf,
  115.     IN  DWORD              cbSendBuf
  116. );
  117.  
  118. DWORD
  119. GetPasswordFromResponse(
  120.     IN  PPP_EAP_PACKET*    pReceiveBuf,
  121.     OUT CHAR*              pszUserName
  122. );
  123.  
  124. DWORD
  125. AuthenticateUser(
  126.     IN CHAR *               szUserName,
  127.     IN CHAR *               szPassword,
  128.     IN EAPCB *              pwb
  129. );
  130.  
  131. //
  132. // Globals.
  133. //
  134.  
  135. #ifdef RASEAPGLOBALS
  136. #define GLOBALS
  137. #define EXTERN
  138. #else
  139. #define EXTERN extern
  140. #endif
  141.  
  142. //
  143. // Next packet identifier to assign.  
  144. //
  145. EXTERN DWORD dwNextId
  146. #ifdef GLOBALS
  147.     = 0
  148. #endif
  149. ;
  150.  
  151. EXTERN
  152. DWORD  (APIENTRY *FpRasAuthenticateClient)( 
  153.     IN  HANDLE                  hPort,
  154.     IN  RAS_AUTH_ATTRIBUTE *    pInAttributes 
  155. )
  156. #ifdef GLOBALS
  157.     = NULL
  158. #endif
  159. ;
  160.  
  161. #undef EXTERN
  162. #undef GLOBALS
  163.  
  164. #endif // _EAP_H_
  165.