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.

167 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. RouteGroup.h
  5. Abstract:
  6. This file provides declaration of the service
  7. outbound routing groups.
  8. Author:
  9. Oded Sacher (OdedS) Nov, 1999
  10. Revision History:
  11. --*/
  12. #ifndef _OUT_ROUTE_GROUP_H
  13. #define _OUT_ROUTE_GROUP_H
  14. #include <map>
  15. #include <list>
  16. #include <string>
  17. #include <algorithm>
  18. #include <set>
  19. using namespace std;
  20. #pragma hdrstop
  21. #pragma warning (disable : 4786) // identifier was truncated to '255' characters in the debug information
  22. // This pragma does not work KB ID: Q167355
  23. /************************************
  24. * *
  25. * wstrCaseInsensitiveLess *
  26. * *
  27. ************************************/
  28. class wstrCaseInsensitiveLess
  29. {
  30. public:
  31. bool operator()(const wstring X, wstring Y) const
  32. {
  33. LPCWSTR lpcwstrX = X.c_str();
  34. LPCWSTR lpcwstrY = Y.c_str();
  35. if (_wcsicmp(lpcwstrX,lpcwstrY) < 0)
  36. {
  37. return true;
  38. }
  39. return false;
  40. }
  41. };
  42. typedef list<DWORD> GROUP_DEVICES, *PGROUP_DEVICES;
  43. /************************************
  44. * *
  45. * COutboundRoutingGroup *
  46. * *
  47. ************************************/
  48. class COutboundRoutingGroup
  49. {
  50. public:
  51. COutboundRoutingGroup () {}
  52. ~COutboundRoutingGroup () {}
  53. COutboundRoutingGroup (const COutboundRoutingGroup& rhs)
  54. : m_DeviceList(rhs.m_DeviceList) {}
  55. COutboundRoutingGroup& operator= (const COutboundRoutingGroup& rhs)
  56. {
  57. if (this == &rhs)
  58. {
  59. return *this;
  60. }
  61. m_DeviceList = rhs.m_DeviceList;
  62. return *this;
  63. }
  64. DWORD Load(HKEY hGroupKey, LPCWSTR lpcwstrGroupName);
  65. DWORD SetDevices (const LPDWORD lpdwDevices, DWORD dwNumDevices, BOOL fAllDevicesGroup);
  66. DWORD SerializeDevices (LPDWORD* lppDevices, LPDWORD lpdwNumDevices, BOOL bAllocate = TRUE) const;
  67. DWORD Save(HKEY hGroupKey) const;
  68. DWORD AddDevice (DWORD dwDevice);
  69. DWORD DelDevice (DWORD dwDevice);
  70. DWORD SetDeviceOrder (DWORD dwDevice, DWORD dwOrder);
  71. DWORD GetStatus (FAX_ENUM_GROUP_STATUS* lpStatus) const;
  72. #if DBG
  73. void Dump () const;
  74. #endif
  75. private:
  76. BOOL IsDeviceInGroup (DWORD dwDevice) const;
  77. DWORD ValidateDevices (const LPDWORD lpdwDevices, DWORD dwNumDevices, BOOL fAllDevicesGroup) const;
  78. GROUP_DEVICES m_DeviceList;
  79. }; // COutboundRoutingGroup
  80. /************************************
  81. * *
  82. * COutboundRoutingGroupsMap *
  83. * *
  84. ************************************/
  85. typedef COutboundRoutingGroup *PCGROUP;
  86. typedef map<wstring, COutboundRoutingGroup, wstrCaseInsensitiveLess> GROUPS_MAP, *PGROUPS_MAP;
  87. //
  88. // The CGroupMap class maps between group name and a list of device ID's
  89. //
  90. class COutboundRoutingGroupsMap
  91. {
  92. public:
  93. COutboundRoutingGroupsMap () {}
  94. ~COutboundRoutingGroupsMap () {}
  95. DWORD Load ();
  96. DWORD AddGroup (LPCWSTR lpcwstrGroupName, PCGROUP pCGroup);
  97. DWORD DelGroup (LPCWSTR lpcwstrGroupName);
  98. DWORD SerializeGroups (PFAX_OUTBOUND_ROUTING_GROUPW* ppGroups,
  99. LPDWORD lpdwNumGroups,
  100. LPDWORD lpdwBufferSize) const;
  101. PCGROUP FindGroup (LPCWSTR lpcwstrGroupName) const;
  102. BOOL UpdateAllDevicesGroup (void);
  103. DWORD RemoveDevice (DWORD dwDeviceId);
  104. #if DBG
  105. void Dump () const;
  106. #endif
  107. private:
  108. GROUPS_MAP m_GroupsMap;
  109. }; // COutboundRoutingGroupsMap
  110. /************************************
  111. * *
  112. * Externes *
  113. * *
  114. ************************************/
  115. extern COutboundRoutingGroupsMap* g_pGroupsMap; // Map of group name to list of device IDs
  116. //
  117. // IMPORTANT - No locking mechanism - USE g_CsConfig to serialize calls to g_pGroupsMap
  118. //
  119. /************************************
  120. * *
  121. * Functions *
  122. * *
  123. ************************************/
  124. BOOL
  125. IsDeviceInstalled (DWORD dwDeviceId);
  126. #endif