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.

97 lines
2.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // TimeOfDay.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file declares the class TimeOfDay.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/04/1998 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _TIMEOFDAY_H_
  19. #define _TIMEOFDAY_H_
  20. #include <Condition.h>
  21. #include <Guard.h>
  22. #include <textmap.h>
  23. ///////////////////////////////////////////////////////////////////////////////
  24. //
  25. // CLASS
  26. //
  27. // TimeOfDayEvaluator
  28. //
  29. // DESCRIPTION
  30. //
  31. // This class determines whether a given hour map has the current hour set.
  32. //
  33. ///////////////////////////////////////////////////////////////////////////////
  34. class TimeOfDayEvaluator
  35. : Guardable
  36. {
  37. public:
  38. TimeOfDayEvaluator() throw ()
  39. : lastUpdate(0), offset(0), mask(0)
  40. { }
  41. BOOL isCurrentHourSet(PBYTE hourMap) const throw ();
  42. protected:
  43. mutable DWORDLONG lastUpdate; // Last time offset and mask were updated.
  44. mutable DWORD offset; // Byte in the hour map to check.
  45. mutable BYTE mask; // Mask to apply to the byte.
  46. };
  47. //////////
  48. // The global TimeOfDayEvaluator (no need for more than one).
  49. //////////
  50. extern TimeOfDayEvaluator theTimeOfDayEvaluator;
  51. ///////////////////////////////////////////////////////////////////////////////
  52. //
  53. // CLASS
  54. //
  55. // TimeOfDay
  56. //
  57. // DESCRIPTION
  58. //
  59. // This class imposes a Time of Day contraint for network policies.
  60. //
  61. ///////////////////////////////////////////////////////////////////////////////
  62. class ATL_NO_VTABLE TimeOfDay :
  63. public Condition,
  64. public CComCoClass<TimeOfDay, &__uuidof(TimeOfDay)>
  65. {
  66. public:
  67. IAS_DECLARE_REGISTRY(TimeOfDay, 1, IAS_REGISTRY_AUTO, NetworkPolicy)
  68. TimeOfDay() throw ()
  69. {
  70. memset(hourMap, 0, sizeof(hourMap));
  71. }
  72. //////////
  73. // ICondition
  74. //////////
  75. STDMETHOD(IsTrue)(/*[in]*/ IRequest* pRequest,
  76. /*[out, retval]*/ VARIANT_BOOL *pVal);
  77. //////////
  78. // IConditionText
  79. //////////
  80. STDMETHOD(put_ConditionText)(/*[in]*/ BSTR newVal);
  81. protected:
  82. BYTE hourMap[IAS_HOUR_MAP_LENGTH]; // Hour map being enforced.
  83. };
  84. #endif //_TIMEOFDAY_H_