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.

193 lines
4.4 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1999
  3. Module Name:
  4. cpubfilt.hxx
  5. Abstract:
  6. Header file containing SENS's IPublisherFilter definition.
  7. Author:
  8. Gopal Parupudi <GopalP>
  9. [Notes:]
  10. optional-notes
  11. Revision History:
  12. GopalP 1/26/1998 Start.
  13. --*/
  14. #ifndef __CPUBFILT_HXX__
  15. #define __CPUBFILT_HXX__
  16. //
  17. // Constants
  18. //
  19. #define CONNECTION_MADE_METHOD L"ConnectionMade"
  20. #define CONNECTION_MADE_NOQOC_METHOD L"ConnectionMadeNoQOCInfo"
  21. #define CONNECTION_LOST_METHOD L"ConnectionLost"
  22. #define DESTINATION_REACHABLE_METHOD L"DestinationReachable"
  23. #define DESTINATION_REACHABLE_NOQOC_METHOD L"DestinationReachableNoQOCInfo"
  24. #define PROPERTY_CONNECTION_MADE_TYPE L"ulConnectionMadeType"
  25. #define PROPERTY_CONNECTION_MADE_NOQOC_TYPE L"ulConnectionMadeTypeNoQOC"
  26. #define PROPERTY_CONNECTION_LOST_TYPE L"ulConnectionLostType"
  27. #define PROPERTY_DESTINATION L"bstrDestination"
  28. #define PROPERTY_DESTINATION_TYPE L"ulDestinationType"
  29. #define PROPERTY_DESTINATION_NOQOC L"bstrDestinationNoQOC"
  30. #define PROPERTY_DESTINATION_NOQOC_TYPE L"ulDestinationTypeNoQOC"
  31. class CImpISensNetworkFilter : public ISensNetwork,
  32. public IPublisherFilter
  33. {
  34. public:
  35. CImpISensNetworkFilter(void);
  36. ~CImpISensNetworkFilter(void);
  37. //
  38. // IUnknown
  39. //
  40. STDMETHOD (QueryInterface) (REFIID, LPVOID *);
  41. STDMETHOD_(ULONG, AddRef) (void);
  42. STDMETHOD_(ULONG, Release) (void);
  43. //
  44. // IDispatch
  45. //
  46. STDMETHOD (GetTypeInfoCount) (UINT *);
  47. STDMETHOD (GetTypeInfo) (UINT, LCID, ITypeInfo **);
  48. STDMETHOD (GetIDsOfNames) (REFIID, LPOLESTR *, UINT, LCID, DISPID *);
  49. STDMETHOD (Invoke) (DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
  50. //
  51. // ISensNetwork
  52. //
  53. STDMETHOD (ConnectionMade) (BSTR, ULONG, LPSENS_QOCINFO);
  54. STDMETHOD (ConnectionMadeNoQOCInfo) (BSTR, ULONG);
  55. STDMETHOD (ConnectionLost) (BSTR, ULONG);
  56. STDMETHOD (DestinationReachable) (BSTR, BSTR, ULONG, LPSENS_QOCINFO);
  57. STDMETHOD (DestinationReachableNoQOCInfo) (BSTR, BSTR, ULONG);
  58. //
  59. // IPublisherFilter
  60. //
  61. STDMETHOD (Initialize) (BSTR, IDispatch*);
  62. STDMETHOD (PrepareToFire) (BSTR, IFiringControl*);
  63. private:
  64. LONG m_cRef;
  65. //
  66. // One collection per event/method.
  67. //
  68. IEnumEventObject* m_pConnectionMade_Enum;
  69. IEnumEventObject* m_pConnectionMadeNoQOC_Enum;
  70. IEnumEventObject* m_pConnectionLost_Enum;
  71. IEnumEventObject* m_pDestinationReachable_Enum;
  72. IEnumEventObject* m_pDestinationReachableNoQOC_Enum;
  73. IFiringControl* m_pConnectionMade_FiringControl;
  74. IFiringControl* m_pConnectionMadeNoQOC_FiringControl;
  75. IFiringControl* m_pConnectionLost_FiringControl;
  76. IFiringControl* m_pDestinationReachable_FiringControl;
  77. IFiringControl* m_pDestinationReachableNoQOC_FiringControl;
  78. };
  79. typedef CImpISensNetworkFilter FAR * LPCIMPISENSNETWORKFILTER;
  80. //
  81. // Classes relating to Publisher Filters
  82. //
  83. // Abstract base Filter class
  84. class __declspec(novtable) Filter
  85. {
  86. public:
  87. virtual HRESULT CheckMatch(IEventSubscription*) const = 0;
  88. };
  89. // Connection Filter
  90. class ConnectionFilter : public Filter
  91. {
  92. public:
  93. ConnectionFilter(
  94. const wchar_t* connectionTypeProperty,
  95. ULONG connectionType,
  96. HRESULT& hr
  97. );
  98. ~ConnectionFilter();
  99. virtual HRESULT CheckMatch(IEventSubscription*) const;
  100. private:
  101. BSTR m_connectionTypeProperty;
  102. ULONG m_connectionType;
  103. };
  104. // Destination Reachability Filter
  105. class ReachabilityFilter : public Filter
  106. {
  107. public:
  108. ReachabilityFilter(
  109. const wchar_t* destinationProperty,
  110. const wchar_t* destinationTypeProperty,
  111. BSTR destination,
  112. ULONG destinationType,
  113. HRESULT& hr
  114. );
  115. ~ReachabilityFilter();
  116. virtual HRESULT CheckMatch(IEventSubscription*) const;
  117. private:
  118. BSTR m_destinationProperty;
  119. BSTR m_destinationTypeProperty;
  120. BSTR m_destination;
  121. ULONG m_destinationType;
  122. };
  123. //
  124. // Forward definitions
  125. //
  126. HRESULT
  127. FilterAndFire(
  128. const Filter& filter,
  129. IEnumEventObject* enumerator,
  130. IFiringControl* firingControl
  131. );
  132. #endif // __CPUBFILT_HXX__