Source code of Windows XP (NT5)
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.

104 lines
3.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: radbal.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _RADBAL_H_
  11. #define _RADBAL_H_
  12. #include <winsock.h>
  13. // 5 seconds for default timeout to server requests
  14. #define DEFTIMEOUT 5
  15. // Windows NT Bug : 186647 - use new defaults
  16. #define DEFAUTHPORT 1812
  17. #define DEFACCTPORT 1813
  18. #define MAXSCORE 30
  19. #define INCSCORE 3
  20. #define DECSCORE 2
  21. #define MINSCORE 0
  22. typedef struct RadiusServer
  23. {
  24. TCHAR szName[MAX_PATH+1]; // Name of radius server
  25. TCHAR wszSecret[MAX_PATH+1]; // secret password use to encrypt packets
  26. ULONG cchSecret; // # of characters in secret
  27. SOCKADDR_IN IPAddress; // IP Address of radius server
  28. struct timeval Timeout; // recv timeout in seconds
  29. DWORD cRetries; // number of times to retry sending packets to server
  30. INT cScore; // Score indicating functioning power of server.
  31. DWORD AuthPort; // Authentication port number
  32. DWORD AcctPort; // Accounting port number
  33. // BOOL fAuthentication; // Enable authentication
  34. // BOOL fAccounting; // Enable accounting
  35. BOOL fAccountingOnOff; // Enable accounting On/Off messages
  36. BYTE bIdentifier; // Unique ID for packet
  37. LONG lPacketID; // Global Packet ID across all servers
  38. BOOL fUseDigitalSignatures; // Enable Digital Signatures
  39. struct RadiusServer *pNext; // Pointer to next radius server in linked list
  40. DWORD dwUnique; // unique id (used by the UI)
  41. // this is not persistent!
  42. UCHAR ucSeed; // seed value for RtlEncode
  43. // This should be kept in sync with what is in radcfg.cpp
  44. void UseDefaults();
  45. BOOL fPersisted; // was entry persisted?
  46. } RADIUSSERVER, *PRADIUSSERVER;
  47. class CRadiusServers
  48. {
  49. public:
  50. CRadiusServers();
  51. ~CRadiusServers();
  52. // dwUnique specifies the server to insert before
  53. // dwUnique == 0, is add it to the head of the list
  54. // dwUnique == -1, means add it to the tail
  55. DWORD AddServer(RADIUSSERVER *pRadiusServer,
  56. LONG_PTR dwUnique);
  57. VOID ValidateServer(RADIUSSERVER *pServer,
  58. BOOL fResponding);
  59. DWORD DeleteServer(LONG_PTR dwUnique, BOOL fRemoveLSAEntry);
  60. RADIUSSERVER * GetNextServer(BOOL fFirst);
  61. VOID MoveServer(LONG_PTR dwUnique, BOOL fUp);
  62. BOOL FindServer(LPCTSTR pszServerName, RADIUSSERVER **ppServer);
  63. BOOL FindServer(DWORD dwUnique, RADIUSSERVER **ppServer);
  64. // Operations for deleted servers
  65. RADIUSSERVER * GetFirstDeletedServer()
  66. {
  67. return m_pDeletedServers;
  68. }
  69. void AddToDeletedServerList(RADIUSSERVER *pServer);
  70. void ClearDeletedServerList(LPCTSTR pszServerName);
  71. void FreeAllServers();
  72. private:
  73. RADIUSSERVER * m_pServerList; // Linked list of valid radius servers
  74. RADIUSSERVER * m_pCurrentServer; // Last server request was sent to
  75. CRITICAL_SECTION m_cs; // used to prevent multiple access to variables of this class
  76. DWORD m_dwUnique; // incremented each time AddServer
  77. // is called
  78. RADIUSSERVER * m_pDeletedServers; // Linked list of deleted servers
  79. };
  80. #endif // _RADBAL_H_