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.

191 lines
4.7 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. #ifndef __PROPQUERY_H
  13. #define __PROPQUERY_H
  14. #define SYSTEM_PROPERTY_CLASS L"__CLASS"
  15. #define SYSTEM_PROPERTY_SUPERCLASS L"__SUPERCLASS"
  16. #define SYSTEM_PROPERTY_DYNASTY L"__DYNASTY"
  17. #define SYSTEM_PROPERTY_DERIVATION L"__DERIVATION"
  18. #define SYSTEM_PROPERTY_GENUS L"__GENUS"
  19. #define SYSTEM_PROPERTY_NAMESPACE L"__NAMESPACE"
  20. #define SYSTEM_PROPERTY_PROPERTY_COUNT L"__PROPERTY_COUNT"
  21. #define SYSTEM_PROPERTY_SERVER L"__SERVER"
  22. #define SYSTEM_PROPERTY_RELPATH L"__RELPATH"
  23. #define SYSTEM_PROPERTY_PATH L"__PATH"
  24. #include <provtree.h>
  25. #include <provdnf.h>
  26. class SnmpQueryEventObject : public SnmpInstanceResponseEventObject , public QueryPreprocessor
  27. {
  28. protected:
  29. WmiTreeNode *AllocTypeNode (
  30. void *a_Context ,
  31. BSTR a_PropertyName ,
  32. VARIANT &a_Variant ,
  33. WmiValueNode :: WmiValueFunction a_PropertyFunction ,
  34. WmiValueNode :: WmiValueFunction a_ConstantFunction ,
  35. WmiTreeNode *a_Parent
  36. ) ;
  37. QuadState InvariantEvaluate (
  38. void *a_Context ,
  39. WmiTreeNode *a_Operator ,
  40. WmiTreeNode *a_Operand
  41. ) ;
  42. WmiRangeNode *AllocInfiniteRangeNode (
  43. void *a_Context ,
  44. BSTR a_PropertyName
  45. ) ;
  46. QueryPreprocessor :: QuadState Compare (
  47. wchar_t *a_Operand1 ,
  48. wchar_t *a_Operand2 ,
  49. DWORD a_Operand1Func ,
  50. DWORD a_Operand2Func ,
  51. WmiTreeNode &a_OperatorType
  52. ) ;
  53. QueryPreprocessor :: QuadState Compare (
  54. LONG a_Operand1 ,
  55. LONG a_Operand2 ,
  56. DWORD a_Operand1Func ,
  57. DWORD a_Operand2Func ,
  58. WmiTreeNode &a_OperatorType
  59. ) ;
  60. QueryPreprocessor :: QuadState CompareCaseInsensitiveString (
  61. BSTR a_PropertyName ,
  62. WmiTreeNode *a_Operator ,
  63. WmiTreeNode *a_Operand ,
  64. bool a_Class = false
  65. ) ;
  66. QueryPreprocessor :: QuadState CompareString (
  67. BSTR a_PropertyName ,
  68. WmiTreeNode *a_Operator ,
  69. WmiTreeNode *a_Operand ,
  70. bool a_Class = false
  71. ) ;
  72. QueryPreprocessor :: QuadState CompareInteger (
  73. BSTR a_PropertyName ,
  74. WmiTreeNode *a_Operator ,
  75. WmiTreeNode *a_Operand
  76. ) ;
  77. void GetPropertiesToPartition ( ULONG &a_Count , BSTR *&a_Container ) ;
  78. SnmpInstanceClassObject *requestObject ;
  79. wchar_t *Query ;
  80. wchar_t *QueryFormat ;
  81. wchar_t *Class ;
  82. #ifdef POST_FILTERING_RECEIVED_ROW
  83. BOOL Compare (
  84. const LONG & op1 ,
  85. const LONG & op2 ,
  86. const DWORD & op1Func ,
  87. const DWORD & op2Func ,
  88. const int & operatorType
  89. ) ;
  90. BOOL Compare (
  91. const wchar_t * & op1 ,
  92. const wchar_t * & op2 ,
  93. const DWORD & op1Func ,
  94. const DWORD & op2Func ,
  95. const int & operatorType
  96. ) ;
  97. BOOL Compare (
  98. const SAFEARRAY * & op1 ,
  99. const SAFEARRAY * & op2 ,
  100. const DWORD & op1Func ,
  101. const DWORD & op2Func ,
  102. const int & operatorType
  103. ) ;
  104. BOOL ExpressionCompare ( SnmpInstanceClassObject *snmpObject , SQL_LEVEL_1_TOKEN *propertyValue ) ;
  105. BOOL RecursivePostEvaluateWhereClause ( SnmpInstanceClassObject *snmpObject , int &index ) ;
  106. BOOL PostEvaluateWhereClause ( SnmpInstanceClassObject *snmpObject ) ;
  107. #endif //POST_FILTERING_RECEIVED_ROW
  108. BOOL CheckWhereCondition ( WbemSnmpErrorObject &a_errorObject , WbemSnmpProperty *property , SQL_LEVEL_1_TOKEN *token ) ;
  109. BOOL PreEvaluate ( WbemSnmpErrorObject &a_errorObject ) ;
  110. BOOL FilterSelectProperties ( WbemSnmpErrorObject &a_errorObject ) ;
  111. BOOL PreEvaluateWhereClause ( WbemSnmpErrorObject &a_errorObject ) ;
  112. BOOL IsSystemProperty (const wchar_t *propertyName ) ;
  113. private:
  114. SQL_LEVEL_1_RPN_EXPRESSION *rpnExpression ;
  115. SQL1_Parser parser ;
  116. CTextLexSource source ;
  117. public:
  118. SnmpQueryEventObject ( CImpPropProv *provider , BSTR QueryFormat , BSTR Query , IWbemContext *a_Context ) ;
  119. ~SnmpQueryEventObject () ;
  120. SnmpClassObject *GetSnmpClassObject () { return & snmpObject ; }
  121. SnmpClassObject *GetSnmpRequestClassObject () { return requestObject ; }
  122. BOOL Instantiate ( WbemSnmpErrorObject &a_errorObject ) ;
  123. } ;
  124. class SnmpQueryAsyncEventObject : public SnmpQueryEventObject
  125. {
  126. private:
  127. ULONG state ;
  128. IWbemObjectSink *notificationHandler ;
  129. protected:
  130. public:
  131. SnmpQueryAsyncEventObject ( CImpPropProv *provider , BSTR QueryFormat , BSTR Query , IWbemObjectSink *notify , IWbemContext *a_Context ) ;
  132. ~SnmpQueryAsyncEventObject () ;
  133. void Process () ;
  134. void ReceiveRow ( SnmpInstanceClassObject *snmpObject ) ;
  135. void ReceiveRow ( IWbemClassObject *snmpObject ) ;
  136. void ReceiveComplete () ;
  137. } ;
  138. #endif // __PROPQUERY_H