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.

90 lines
2.5 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // InfoShare.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file describes the class InfoShare.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 09/09/1997 Original version.
  16. // 03/17/1998 Added clear() method.
  17. // 06/01/1998 Added default constructor.
  18. // 09/09/1998 Protect client changes with a shared Mutex.
  19. //
  20. ///////////////////////////////////////////////////////////////////////////////
  21. #ifndef _INFOSHARE_H_
  22. #define _INFOSHARE_H_
  23. #include <iasinfo.h>
  24. #include <guard.h>
  25. #include <nocopy.h>
  26. #include <map>
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //
  29. // CLASS
  30. //
  31. // InfoShare
  32. //
  33. // DESCRIPTION
  34. //
  35. // This class manages the shared memory used for exposing server
  36. // statistics to the outside world.
  37. //
  38. ///////////////////////////////////////////////////////////////////////////////
  39. class InfoShare
  40. : NonCopyable
  41. {
  42. public:
  43. InfoShare() throw ();
  44. ~InfoShare() throw ();
  45. // Returns the RadiusClientEntry struct for the given address.
  46. RadiusClientEntry* findClientEntry(PCWSTR inetAddress) throw ();
  47. // Returns the RadiusServerEntry struct.
  48. RadiusServerEntry* getServerEntry() const throw ()
  49. { return info ? &(info->seServer) : NULL; }
  50. // Sets the server reset time.
  51. void onReset() throw ();
  52. bool initialize() throw ();
  53. void finalize() throw ();
  54. protected:
  55. // Functions to serialize access to the shared memory.
  56. void Lock() throw ()
  57. { WaitForSingleObject(monitor, INFINITE); }
  58. void Unlock() throw ()
  59. { ReleaseMutex(monitor); }
  60. friend class Guard<InfoShare>;
  61. // Create a new client entry in shared memory.
  62. RadiusClientEntry* addClientEntry(DWORD address) throw ();
  63. // Clear the data structure.
  64. void clear() throw ();
  65. // Map addresses to RadiusClientEntry's.
  66. typedef std::map< DWORD, RadiusClientEntry* > ClientMap;
  67. ClientMap clients; // Index of client entries.
  68. HANDLE monitor; // Handle of the mutex.
  69. DWORD pageSize; // Size of a page (in bytes).
  70. DWORD committed; // Number of pages committed.
  71. DWORD reserved; // Number of pages reserved.
  72. HANDLE fileMap; // Handle of the file mapping.
  73. RadiusStatistics* info; // Pointer to shared struct.
  74. };
  75. #endif // _INFOSHARE_H_