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.

654 lines
22 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  2. #include <windows.h>
  3. #include <provexpt.h>
  4. #define WBEM_NAMESPACE_EQUALS L"__Namespace=\""
  5. #define WBEM_NAMESPACE_QUOTE L"\""
  6. #define WBEM_CLASS_NAMESPACE L"__Namespace"
  7. #define WBEM_CLASS_NOTIFYSTATUS L"__NotifyStatus"
  8. #define WBEM_CLASS_EXTENDEDSTATUS L"__ExtendedStatus"
  9. #define WBEM_CLASS_SNMPNOTIFYSTATUS L"SnmpNotifyStatus"
  10. #define WBEM_CLASS_SNMPMACRO L"SnmpMacro"
  11. #define WBEM_CLASS_SNMPOBJECTTYPE L"SnmpObjectType"
  12. #define WBEM_CLASS_EXTRINSICEVENT L"__ExtrinsicEvent"
  13. #define WBEM_CLASS_SNMPNOTIFICATION L"SnmpNotification"
  14. #define WBEM_CLASS_SNMPEXTENDEDNOTIFICATION L"SnmpExtendedNotification"
  15. #define WBEM_CLASS_SNMPVARBIND L"SnmpVarBind"
  16. #define WBEM_CLASS_NULL L""
  17. #define WBEM_PROPERTY_CLASS L"__class"
  18. #define WBEM_PROPERTY_SUPERCLASS L"__superclass"
  19. #define WBEM_PROPERTY_KEY L"__key"
  20. #define WBEM_PROPERTY_GENUS L"__genus"
  21. #define WBEM_PROPERTY_DYNASTY L"__dynasty"
  22. #define WBEM_PROPERTY_STATUSCODE L"StatusCode"
  23. #define WBEM_PROPERTY_SNMPSTATUSCODE L"SnmpStatusCode"
  24. #define WBEM_PROPERTY_SNMPSTATUSMESSAGE L"Description"
  25. #define WBEM_QUALIFIER_DYNAMIC L"dynamic"
  26. #define WBEM_QUALIFIER_PROVIDER L"provider"
  27. #define WBEM_QUALIFIER_KEY L"key"
  28. #define WBEM_QUALIFIER_KEY_ORDER L"key_order"
  29. #define WBEM_QUALIFIER_READ L"read"
  30. #define WBEM_QUALIFIER_WRITE L"write"
  31. #define WBEM_QUALIFIER_AGENTSNMPVERSION L"AgentSNMPVersion"
  32. #define WBEM_QUALIFIER_AGENTTRANSPORT L"AgentTransport"
  33. #define WBEM_QUALIFIER_AGENTADDRESS L"AgentAddress"
  34. #define WBEM_QUALIFIER_AGENTREADCOMMUNITYNAME L"AgentReadCommunityName"
  35. #define WBEM_QUALIFIER_AGENTWRITECOMMUNITYNAME L"AgentWriteCommunityName"
  36. #define WBEM_QUALIFIER_AGENTRETRYCOUNT L"AgentRetryCount"
  37. #define WBEM_QUALIFIER_AGENTRETRYTIMEOUT L"AgentRetryTimeout"
  38. #define WBEM_QUALIFIER_AGENTVARBINDSPERPDU L"AgentVarBindsPerPdu"
  39. #define WBEM_QUALIFIER_AGENTFLOWCONTROLWINDOWSIZE L"AgentFlowControlWindowSize"
  40. #define WBEM_QUALIFIER_TYPE L"type"
  41. #define WBEM_QUALIFIER_NAME L"name"
  42. #define WBEM_QUALIFIER_DESCRIPTION L"description"
  43. #define WBEM_QUALIFIER_DYNASTY L"dynasty"
  44. #define WBEM_QUALIFIER_MODULE_NAME L"module_name"
  45. #define WBEM_QUALIFIER_GROUP_OBJECTID L"group_objectid"
  46. #define WBEM_QUALIFIER_VIRTUAL_KEY L"virtual_key"
  47. #define WBEM_QUALIFIER_OBJECT_IDENTIFIER L"object_identifier"
  48. #define WBEM_QUALIFIER_TEXTUAL_CONVENTION L"textual_convention"
  49. #define WBEM_QUALIFIER_ENCODING L"encoding"
  50. #define WBEM_QUALIFIER_SYNTAX L"syntax"
  51. #define WBEM_QUALIFIER_ENUMERATION L"enumeration"
  52. #define WBEM_QUALIFIER_BITS L"bits"
  53. #define WBEM_QUALIFIER_FIXED_LENGTH L"fixed_length"
  54. #define WBEM_QUALIFIER_VARIABLE_VALUE L"variable_value"
  55. #define WBEM_QUALIFIER_VARIABLE_LENGTH L"variable_length"
  56. #define WBEM_QUALIFIER_DISPLAY_HINT L"display_hint"
  57. #define WBEM_QUALIFIER_TYPE_MISMATCH L"type_mismatch"
  58. #define WBEM_QUALIFIER_VALUE_MISMATCH L"value_mismatch"
  59. #define WBEM_QUALIFIER_NOT_AVAILABLE L"not_available"
  60. #define WBEM_QUALIFIER_SINGLETON L"singleton"
  61. #define WBEM_QUALIFIER_TABLECLASS L"TableClass"
  62. #define WBEM_QUALIFIER_KEYTYPES L"KeyTypes"
  63. #define WBEM_QUALIFIER_KEYVALUES L"KeyValues"
  64. #define WBEM_QUALIFIER_VARBINDINDEX L"VarBindIndex"
  65. #define WBEM_QUALIFIER_ROWSTATUS L"rowstatus"
  66. #define WBEM_INDEX_QUALIFIER_KEY 1
  67. #define WBEM_INDEX_QUALIFIER_KEY_ORDER 2
  68. #define WBEM_INDEX_QUALIFIER_READ 3
  69. #define WBEM_INDEX_QUALIFIER_WRITE 4
  70. #define WBEM_INDEX_QUALIFIER_AGENTSNMPVERSION 5
  71. #define WBEM_INDEX_QUALIFIER_AGENTTRANSPORT 6
  72. #define WBEM_INDEX_QUALIFIER_AGENTADDRESS 7
  73. #define WBEM_INDEX_QUALIFIER_AGENTREADCOMMUNITYNAME 8
  74. #define WBEM_INDEX_QUALIFIER_AGENTWRITECOMMUNITYNAME 9
  75. #define WBEM_INDEX_QUALIFIER_AGENTRETRYCOUNT 10
  76. #define WBEM_INDEX_QUALIFIER_AGENTRETRYTIMEOUT 11
  77. #define WBEM_INDEX_QUALIFIER_AGENTVARBINDSPERPDU 12
  78. #define WBEM_INDEX_QUALIFIER_AGENTFLOWCONTROLWINDOWSIZE 13
  79. #define WBEM_INDEX_QUALIFIER_TYPE 14
  80. #define WBEM_INDEX_QUALIFIER_NAME 15
  81. #define WBEM_INDEX_QUALIFIER_DESCRIPTION 16
  82. #define WBEM_INDEX_QUALIFIER_DYNASTY 17
  83. #define WBEM_INDEX_QUALIFIER_MODULE_NAME 18
  84. #define WBEM_INDEX_QUALIFIER_GROUP_OBJECTID 19
  85. #define WBEM_INDEX_QUALIFIER_VIRTUAL_KEY 20
  86. #define WBEM_INDEX_QUALIFIER_OBJECT_IDENTIFIER 21
  87. #define WBEM_INDEX_QUALIFIER_TEXTUAL_CONVENTION 22
  88. #define WBEM_INDEX_QUALIFIER_ENCODING 23
  89. #define WBEM_INDEX_QUALIFIER_SYNTAX 24
  90. #define WBEM_INDEX_QUALIFIER_ENUMERATION 25
  91. #define WBEM_INDEX_QUALIFIER_BITS 26
  92. #define WBEM_INDEX_QUALIFIER_FIXED_LENGTH 27
  93. #define WBEM_INDEX_QUALIFIER_VARIABLE_VALUE 28
  94. #define WBEM_INDEX_QUALIFIER_VARIABLE_LENGTH 29
  95. #define WBEM_INDEX_QUALIFIER_DISPLAY_HINT 30
  96. #define WBEM_INDEX_QUALIFIER_TYPE_MISMATCH 31
  97. #define WBEM_INDEX_QUALIFIER_VALUE_MISMATCH 32
  98. #define WBEM_INDEX_QUALIFIER_NOT_AVAILABLE 33
  99. #define WBEM_INDEX_QUALIFIER_SINGLETON 34
  100. #define WBEM_INDEX_QUALIFIER_TABLECLASS 35
  101. #define WBEM_INDEX_QUALIFIER_KEYTYPES 36
  102. #define WBEM_INDEX_QUALIFIER_KEYVALUES 37
  103. #define WBEM_INDEX_QUALIFIER_VARBINDINDEX 38
  104. #define WBEM_INDEX_QUALIFIER_ROWSTATUS 39
  105. #define WBEM_TYPE_NULL L"NULL"
  106. #define WBEM_TYPE_INTEGER L"INTEGER"
  107. #define WBEM_TYPE_INTEGER32 L"INTEGER32"
  108. #define WBEM_TYPE_COUNTER L"Counter"
  109. #define WBEM_TYPE_GAUGE L"Gauge"
  110. #define WBEM_TYPE_TIMETICKS L"TimeTicks"
  111. #define WBEM_TYPE_UNSIGNED32 L"UNSIGNED32"
  112. #define WBEM_TYPE_COUNTER32 L"Counter32"
  113. #define WBEM_TYPE_COUNTER64 L"Counter64"
  114. #define WBEM_TYPE_GAUGE32 L"Gauge32"
  115. #define WBEM_TYPE_OCTETSTRING L"OCTETSTRING"
  116. #define WBEM_TYPE_OPAQUE L"Opaque"
  117. #define WBEM_TYPE_IPADDRESS L"IpAddress"
  118. #define WBEM_TYPE_NETWORKADDRESS L"NetworkAddress"
  119. #define WBEM_TYPE_OBJECTIDENTIFIER L"OBJECTIDENTIFIER"
  120. #define WBEM_TYPE_DISPLAYSTRING L"DisplayString"
  121. #define WBEM_TYPE_MACADDRESS L"MacAddress"
  122. #define WBEM_TYPE_PHYSADDRESS L"PhysAddress"
  123. #define WBEM_TYPE_ENUMERATEDINTEGER L"EnumeratedInteger"
  124. #define WBEM_TYPE_BITS L"BITS"
  125. #define WBEM_TYPE_DATETIME L"DateAndTime"
  126. #define WBEM_TYPE_SNMPOSIADDRESS L"SnmpOSIAddress"
  127. #define WBEM_TYPE_SNMPUDPADDRESS L"SnmpUDPAddress"
  128. #define WBEM_TYPE_SNMPIPXADDRESS L"SnmpIPXAddress"
  129. #define WBEM_TYPE_ROWSTATUS L"RowStatus"
  130. #define WBEM_INDEX_TYPE_NULL 1
  131. #define WBEM_INDEX_TYPE_INTEGER 2
  132. #define WBEM_INDEX_TYPE_INTEGER32 3
  133. #define WBEM_INDEX_TYPE_COUNTER 4
  134. #define WBEM_INDEX_TYPE_GAUGE 5
  135. #define WBEM_INDEX_TYPE_TIMETICKS 6
  136. #define WBEM_INDEX_TYPE_OCTETSTRING 7
  137. #define WBEM_INDEX_TYPE_OPAQUE 8
  138. #define WBEM_INDEX_TYPE_IPADDRESS 9
  139. #define WBEM_INDEX_TYPE_NETWORKADDRESS 10
  140. #define WBEM_INDEX_TYPE_OBJECTIDENTIFIER 11
  141. #define WBEM_INDEX_TYPE_DISPLAYSTRING 12
  142. #define WBEM_INDEX_TYPE_MACADDRESS 13
  143. #define WBEM_INDEX_TYPE_PHYSADDRESS 14
  144. #define WBEM_INDEX_TYPE_ENUMERATEDINTEGER 15
  145. #define WBEM_INDEX_TYPE_UNSIGNED32 16
  146. #define WBEM_INDEX_TYPE_COUNTER32 17
  147. #define WBEM_INDEX_TYPE_COUNTER64 18
  148. #define WBEM_INDEX_TYPE_GAUGE32 19
  149. #define WBEM_INDEX_TYPE_BITS 20
  150. #define WBEM_INDEX_TYPE_DATETIME 21
  151. #define WBEM_INDEX_TYPE_SNMPOSIADDRESS 22
  152. #define WBEM_INDEX_TYPE_SNMPUDPADDRESS 23
  153. #define WBEM_INDEX_TYPE_SNMPIPXADDRESS 24
  154. #define WBEM_INDEX_TYPE_ROWSTATUS 25
  155. #define WBEM_AGENTSNMPVERSION_DBCS_V1 "1"
  156. #define WBEM_AGENTSNMPVERSION_DBCS_V2C "2C"
  157. #define WBEM_AGENTIPTRANSPORT_DBCS "IP"
  158. #define WBEM_AGENTIPXTRANSPORT_DBCS "IPX"
  159. #define WBEM_AGENTSNMPVERSION_V1 L"1"
  160. #define WBEM_AGENTSNMPVERSION_V2C L"2C"
  161. #define WBEM_AGENTIPTRANSPORT L"IP"
  162. #define WBEM_AGENTIPXTRANSPORT L"IPX"
  163. #define WBEM_AGENTCOMMUNITYNAME L"public"
  164. #define WBEM_GENUS_INSTANCE 2
  165. #define WBEM_GENUS_CLASS 1
  166. #define WBEM_CLASS_NOCORRELATE 0x1000
  167. #define WBEM_CLASS_CORRELATE_CONTEXT_PROP L"Correlate"
  168. #define WBEM_QUERY_LANGUAGE_WQL L"WQL"
  169. #define WBEM_ERROR_CRITICAL_ERROR WBEM_E_PROVIDER_FAILURE
  170. #define WBEM_SNMP_ERROR_CRITICAL_ERROR WBEM_SNMP_E_PROVIDER_FAILURE
  171. #define WBEM_CLASS_PROPAGATION WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS
  172. typedef
  173. enum tag_WBEMSNMPSTATUS
  174. {
  175. WBEM_SNMP_NO_ERROR = 0,
  176. WBEM_SNMP_S_NO_ERROR = 0,
  177. WBEM_SNMP_S_NO_MORE_DATA = 0x40001,
  178. WBEM_SNMP_S_ALREADY_EXISTS = WBEM_SNMP_S_NO_MORE_DATA + 1,
  179. WBEM_SNMP_S_NOT_FOUND = WBEM_SNMP_S_ALREADY_EXISTS + 1,
  180. WBEM_SNMP_S_RESET_TO_DEFAULT = WBEM_SNMP_S_NOT_FOUND + 1,
  181. WBEM_SNMP_E_FAILED = 0x80041001,
  182. WBEM_SNMP_E_NOT_FOUND = WBEM_SNMP_E_FAILED + 1,
  183. WBEM_SNMP_E_ACCESS_DENIED = WBEM_SNMP_E_NOT_FOUND + 1,
  184. WBEM_SNMP_E_PROVIDER_FAILURE = WBEM_SNMP_E_ACCESS_DENIED + 1,
  185. WBEM_SNMP_E_TYPE_MISMATCH = WBEM_SNMP_E_PROVIDER_FAILURE + 1,
  186. WBEM_SNMP_E_OUT_OF_MEMORY = WBEM_SNMP_E_TYPE_MISMATCH + 1,
  187. WBEM_SNMP_E_INVALID_CONTEXT = WBEM_SNMP_E_OUT_OF_MEMORY + 1,
  188. WBEM_SNMP_E_INVALID_PARAMETER = WBEM_SNMP_E_INVALID_CONTEXT + 1,
  189. WBEM_SNMP_E_NOT_AVAILABLE = WBEM_SNMP_E_INVALID_PARAMETER + 1,
  190. WBEM_SNMP_E_CRITICAL_ERROR = WBEM_SNMP_E_NOT_AVAILABLE + 1,
  191. WBEM_SNMP_E_INVALID_STREAM = WBEM_SNMP_E_CRITICAL_ERROR + 1,
  192. WBEM_SNMP_E_NOT_SUPPORTED = WBEM_SNMP_E_INVALID_STREAM + 1,
  193. WBEM_SNMP_E_INVALID_SUPERCLASS = WBEM_SNMP_E_NOT_SUPPORTED + 1,
  194. WBEM_SNMP_E_INVALID_NAMESPACE = WBEM_SNMP_E_INVALID_SUPERCLASS + 1,
  195. WBEM_SNMP_E_INVALID_OBJECT = WBEM_SNMP_E_INVALID_NAMESPACE + 1,
  196. WBEM_SNMP_E_INVALID_CLASS = WBEM_SNMP_E_INVALID_OBJECT + 1,
  197. WBEM_SNMP_E_PROVIDER_NOT_FOUND = WBEM_SNMP_E_INVALID_CLASS + 1,
  198. WBEM_SNMP_E_INVALID_PROVIDER_REGISTRATION = WBEM_SNMP_E_PROVIDER_NOT_FOUND + 1,
  199. WBEM_SNMP_E_PROVIDER_LOAD_FAILURE = WBEM_SNMP_E_INVALID_PROVIDER_REGISTRATION + 1,
  200. WBEM_SNMP_E_INITIALIZATION_FAILURE = WBEM_SNMP_E_PROVIDER_LOAD_FAILURE + 1,
  201. WBEM_SNMP_E_TRANSPORT_FAILURE = WBEM_SNMP_E_INITIALIZATION_FAILURE + 1,
  202. WBEM_SNMP_E_INVALID_OPERATION = WBEM_SNMP_E_TRANSPORT_FAILURE + 1,
  203. WBEM_SNMP_E_INVALID_QUERY = WBEM_SNMP_E_INVALID_OPERATION + 1,
  204. WBEM_SNMP_E_INVALID_QUERY_TYPE = WBEM_SNMP_E_INVALID_QUERY + 1,
  205. WBEM_SNMP_E_ALREADY_EXISTS = WBEM_SNMP_E_INVALID_QUERY_TYPE + 1,
  206. WBEM_SNMP_E_OVERRIDE_NOT_ALLOWED = WBEM_SNMP_E_ALREADY_EXISTS + 1,
  207. WBEM_SNMP_E_PROPAGATED_QUALIFIER = WBEM_SNMP_E_OVERRIDE_NOT_ALLOWED + 1,
  208. WBEM_SNMP_E_UNEXPECTED = WBEM_SNMP_E_PROPAGATED_QUALIFIER + 1,
  209. WBEM_SNMP_E_ILLEGAL_OPERATION = WBEM_SNMP_E_UNEXPECTED + 1,
  210. WBEM_SNMP_E_CANNOT_BE_KEY = WBEM_SNMP_E_ILLEGAL_OPERATION + 1,
  211. WBEM_SNMP_E_INCOMPLETE_CLASS = WBEM_SNMP_E_CANNOT_BE_KEY + 1,
  212. WBEM_SNMP_E_INVALID_SYNTAX = WBEM_SNMP_E_INCOMPLETE_CLASS + 1,
  213. WBEM_SNMP_E_NONDECORATED_OBJECT = WBEM_SNMP_E_INVALID_SYNTAX + 1,
  214. WBEM_SNMP_E_READ_ONLY = WBEM_SNMP_E_NONDECORATED_OBJECT + 1,
  215. WBEM_SNMP_E_PROVIDER_NOT_CAPABLE = WBEM_SNMP_E_READ_ONLY + 1,
  216. WBEM_SNMP_E_CLASS_HAS_CHILDREN = WBEM_SNMP_E_PROVIDER_NOT_CAPABLE + 1,
  217. WBEM_SNMP_E_CLASS_HAS_INSTANCES = WBEM_SNMP_E_CLASS_HAS_CHILDREN + 1 ,
  218. // Added
  219. WBEM_SNMP_E_INVALID_PROPERTY = WBEM_SNMP_E_CLASS_HAS_INSTANCES + 1 ,
  220. WBEM_SNMP_E_INVALID_QUALIFIER = WBEM_SNMP_E_INVALID_PROPERTY + 1 ,
  221. WBEM_SNMP_E_INVALID_PATH = WBEM_SNMP_E_INVALID_QUALIFIER + 1 ,
  222. WBEM_SNMP_E_INVALID_PATHKEYPARAMETER = WBEM_SNMP_E_INVALID_PATH + 1 ,
  223. WBEM_SNMP_E_MISSINGPATHKEYPARAMETER = WBEM_SNMP_E_INVALID_PATHKEYPARAMETER + 1 ,
  224. WBEM_SNMP_E_INVALID_KEYORDERING = WBEM_SNMP_E_MISSINGPATHKEYPARAMETER + 1 ,
  225. WBEM_SNMP_E_DUPLICATEPATHKEYPARAMETER = WBEM_SNMP_E_INVALID_KEYORDERING + 1 ,
  226. WBEM_SNMP_E_MISSINGKEY = WBEM_SNMP_E_DUPLICATEPATHKEYPARAMETER + 1 ,
  227. WBEM_SNMP_E_INVALID_TRANSPORT = WBEM_SNMP_E_MISSINGKEY + 1 ,
  228. WBEM_SNMP_E_INVALID_TRANSPORTCONTEXT = WBEM_SNMP_E_INVALID_TRANSPORT + 1 ,
  229. WBEM_SNMP_E_TRANSPORT_ERROR = WBEM_SNMP_E_INVALID_TRANSPORTCONTEXT + 1 ,
  230. WBEM_SNMP_E_TRANSPORT_NO_RESPONSE = WBEM_SNMP_E_TRANSPORT_ERROR + 1 ,
  231. WBEM_SNMP_E_NOWRITABLEPROPERTIES = WBEM_SNMP_E_TRANSPORT_NO_RESPONSE + 1 ,
  232. WBEM_SNMP_E_NOREADABLEPROPERTIES = WBEM_SNMP_E_NOWRITABLEPROPERTIES + 1
  233. } WBEMSNMPSTATUS;
  234. enum WbemPropertyValueCheck
  235. {
  236. SetValueRegardlessReturnCheck = 0 ,
  237. SetValueRegardlessDontReturnCheck ,
  238. SetValueIfCheckOk ,
  239. DontSetValueReturnCheck
  240. } ;
  241. #if 0
  242. #if _MSC_VER >= 1100
  243. template <> __declspec ( dllexport ) UINT AFXAPI HashKey <wchar_t *> ( wchar_t *key ) ;
  244. #else
  245. __declspec ( dllexport ) UINT HashKey ( wchar_t *key ) ;
  246. #endif
  247. #if _MSC_VER >= 1100
  248. typedef wchar_t * WbemHack_wchar_t ;
  249. template<> __declspec ( dllexport ) BOOL AFXAPI CompareElements <wchar_t *, wchar_t * > ( const WbemHack_wchar_t *pElement1, const WbemHack_wchar_t *pElement2 ) ;
  250. #else
  251. __declspec ( dllexport ) BOOL CompareElements ( wchar_t **pElement1, wchar_t **pElement2 ) ;
  252. #endif
  253. #endif
  254. class __declspec ( dllexport ) WbemSnmpErrorObject
  255. {
  256. private:
  257. wchar_t *m_snmpErrorMessage ;
  258. WBEMSNMPSTATUS m_snmpErrorStatus ;
  259. WBEMSTATUS m_wbemErrorStatus ;
  260. protected:
  261. public:
  262. WbemSnmpErrorObject () : m_snmpErrorMessage ( NULL ) , m_wbemErrorStatus ( WBEM_NO_ERROR ) , m_snmpErrorStatus ( WBEM_SNMP_NO_ERROR ) {} ;
  263. virtual ~WbemSnmpErrorObject () { delete [] m_snmpErrorMessage ; } ;
  264. void SetStatus ( WBEMSNMPSTATUS a_snmpErrorStatus )
  265. {
  266. m_snmpErrorStatus = a_snmpErrorStatus ;
  267. } ;
  268. void SetWbemStatus ( WBEMSTATUS a_wbemErrorStatus )
  269. {
  270. m_wbemErrorStatus = a_wbemErrorStatus ;
  271. } ;
  272. void SetMessage ( wchar_t *a_snmpErrorMessage )
  273. {
  274. DebugMacro1 (
  275. if ( a_snmpErrorMessage )
  276. {
  277. SnmpDebugLog :: s_SnmpDebugLog->Write (
  278. L"\r\nWbemSnmpErrorObject :: SetMessage ( (%s) )" , a_snmpErrorMessage
  279. ) ;
  280. }
  281. )
  282. delete [] m_snmpErrorMessage ;
  283. m_snmpErrorMessage = UnicodeStringDuplicate ( a_snmpErrorMessage ) ;
  284. } ;
  285. wchar_t *GetMessage () { return m_snmpErrorMessage ; } ;
  286. WBEMSNMPSTATUS GetStatus () { return m_snmpErrorStatus ; } ;
  287. WBEMSTATUS GetWbemStatus () { return m_wbemErrorStatus ; } ;
  288. } ;
  289. class __declspec ( dllexport ) WbemSnmpQualifier
  290. {
  291. private:
  292. wchar_t *qualifierName ;
  293. SnmpInstanceType *typeValue ;
  294. protected:
  295. public:
  296. WbemSnmpQualifier ( const WbemSnmpQualifier &copy ) ;
  297. WbemSnmpQualifier (
  298. const wchar_t *qualifierName ,
  299. const SnmpInstanceType *typeValue
  300. ) ;
  301. virtual ~WbemSnmpQualifier () ;
  302. BOOL IsPropagatable () const ;
  303. wchar_t *GetName () const ;
  304. SnmpInstanceType *GetValue () const ;
  305. BOOL GetValue ( VARIANT &variant ) const ;
  306. VARTYPE GetValueVariantType () const ;
  307. BOOL SetValue ( const VARIANT &variant ) ;
  308. BOOL SetValue ( const SnmpInstanceType *value ) ;
  309. BOOL SetValue ( const wchar_t *value ) ;
  310. BOOL SetValue ( IWbemQualifierSet *a_Qualifier , const SnmpInstanceType &value ) ;
  311. } ;
  312. class __declspec ( dllexport ) WbemSnmpProperty
  313. {
  314. private:
  315. /*
  316. * Qualifier Information
  317. */
  318. SnmpMap <
  319. wchar_t *,wchar_t *,
  320. WbemSnmpQualifier *,WbemSnmpQualifier *
  321. > qualifierMap ;
  322. POSITION qualifierPosition ;
  323. /*
  324. * Property Information
  325. */
  326. BOOL m_isWritable ;
  327. BOOL m_isReadable ;
  328. BOOL m_isKey ;
  329. BOOL m_isVirtualKey ;
  330. BOOL m_IsNull ;
  331. BOOL tagged ;
  332. ULONG m_keyOrder ;
  333. ULONG m_TextualConvention ;
  334. wchar_t *propertyName ;
  335. SnmpInstanceType *propertyValue ;
  336. long m_Handle ;
  337. protected:
  338. public:
  339. WbemSnmpProperty ( const wchar_t *propertyName ) ;
  340. WbemSnmpProperty ( const WbemSnmpProperty &copy ) ;
  341. virtual ~WbemSnmpProperty () ;
  342. void SetTag ( BOOL tag = TRUE ) ;
  343. BOOL GetTag () ;
  344. BOOL IsKey () ;
  345. BOOL IsVirtualKey () ;
  346. BOOL IsWritable () ;
  347. BOOL IsReadable () ;
  348. ULONG GetKeyOrder () ;
  349. ULONG GetTextualConvention () ;
  350. CIMTYPE GetCimType () ;
  351. long GetHandle () ;
  352. void SetKey ( BOOL a_isKey = TRUE ) ;
  353. void SetKeyOrder ( ULONG a_keyOrder ) ;
  354. void SetVirtualKey ( BOOL a_isVirtualKey = TRUE ) ;
  355. void SetReadable ( BOOL a_isReadable = TRUE ) ;
  356. void SetWritable ( BOOL a_isWritable = TRUE ) ;
  357. void SetTextualConvention ( ULONG a_TextualConvention ) ;
  358. void SetHandle ( long a_Handle ) ;
  359. wchar_t *GetName () const ;
  360. BOOL IsNull () ;
  361. BOOL IsSNMPV1Type () { return propertyValue->IsSNMPV1Type () ; }
  362. BOOL IsSNMPV2CType () { return propertyValue->IsSNMPV2CType () ; }
  363. SnmpInstanceType *GetValue () const ;
  364. BOOL GetValue ( VARIANT &variant , CIMTYPE &type ) const ;
  365. VARTYPE GetValueVariantType () const ;
  366. VARTYPE GetValueVariantEncodedType () const ;
  367. BOOL SetValue ( const VARIANT &variant , const CIMTYPE &type , WbemPropertyValueCheck check = SetValueIfCheckOk ) ;
  368. BOOL SetValue ( const wchar_t *value , WbemPropertyValueCheck check = SetValueIfCheckOk ) ;
  369. BOOL SetValue ( const SnmpInstanceType *propertyValue , WbemPropertyValueCheck check = SetValueIfCheckOk ) ;
  370. BOOL SetValue ( const SnmpValue *propertyValue , WbemPropertyValueCheck check = SetValueIfCheckOk ) ;
  371. BOOL SetValue ( IWbemClassObject *a_Object , const SnmpValue *valueArg , WbemPropertyValueCheck check = SetValueIfCheckOk ) ;
  372. BOOL Encode ( const VARIANT &a_EncodeValue , SnmpObjectIdentifier &a_Encode ) ;
  373. #if 0
  374. BOOL SetValue ( IWbemObjectAccess *a_Object , const SnmpValue *valueArg , WbemPropertyValueCheck check = SetValueIfCheckOk ) ;
  375. BOOL SetDWORD ( BOOL a_Status , IWbemObjectAccess *a_Object , DWORD a_Value , WbemPropertyValueCheck check ) ;
  376. BOOL SetNULL ( BOOL a_Status , IWbemObjectAccess *a_Object , WbemPropertyValueCheck check ) ;
  377. BOOL SetSTRING ( BOOL a_Status , IWbemObjectAccess *a_Object , wchar_t *t_Value , ULONG t_ValueLength , WbemPropertyValueCheck check ) ;
  378. #endif
  379. ULONG GetQualifierCount () ;
  380. BOOL AddQualifier ( wchar_t *qualifierName ) ;
  381. BOOL AddQualifier ( WbemSnmpQualifier *qualifier ) ;
  382. void ResetQualifier () ;
  383. WbemSnmpQualifier *NextQualifier () ;
  384. WbemSnmpQualifier *FindQualifier ( wchar_t *qualifierName ) const ;
  385. virtual BOOL Check ( WbemSnmpErrorObject &a_errorObject ) ;
  386. } ;
  387. class __declspec ( dllexport ) WbemSnmpClassObject
  388. {
  389. private:
  390. /*
  391. * Object Information
  392. */
  393. BOOL m_isClass ;
  394. BOOL m_isKeyed ;
  395. BOOL m_isSingleton ;
  396. BOOL m_isVirtual ;
  397. BOOL m_isReadable ;
  398. BOOL m_isWritable ;
  399. ULONG m_numberOfAccessible ;
  400. wchar_t *className ;
  401. /*
  402. * Qualifier Information
  403. */
  404. SnmpMap <
  405. wchar_t *,wchar_t *,
  406. WbemSnmpQualifier *,WbemSnmpQualifier *
  407. > qualifierMap ;
  408. POSITION qualifierPosition ;
  409. /*
  410. * Property Information
  411. */
  412. SnmpList <WbemSnmpProperty *,WbemSnmpProperty *> keyedPropertyList ;
  413. LONG keyedPropertyPosition ;
  414. SnmpMap <
  415. wchar_t *,wchar_t *,
  416. WbemSnmpProperty *,WbemSnmpProperty *
  417. > propertyMap ;
  418. POSITION propertyPosition ;
  419. private:
  420. BOOL SetMosClassObject (
  421. WbemSnmpErrorObject &a_errorObject ,
  422. IWbemClassObject *mosClassObject ,
  423. BOOL rigorous = TRUE
  424. ) ;
  425. BOOL SetMosClassObjectQualifiers (
  426. WbemSnmpErrorObject &a_errorObject ,
  427. IWbemQualifierSet *classQualifierObject
  428. ) ;
  429. BOOL SetMosClassObjectProperties (
  430. WbemSnmpErrorObject &a_errorObject ,
  431. IWbemClassObject *mosClassObject ,
  432. BOOL rigorous = TRUE
  433. ) ;
  434. BOOL SetMosClassObjectPropertyQualifiers (
  435. WbemSnmpErrorObject &a_errorObject ,
  436. WbemSnmpProperty *snmpProperty ,
  437. IWbemQualifierSet *propertyQualifierSet
  438. ) ;
  439. BOOL GetMosClassObject (
  440. WbemSnmpErrorObject &a_errorObject ,
  441. IWbemClassObject *mosClassObject
  442. ) ;
  443. BOOL GetMosClassObjectQualifiers (
  444. WbemSnmpErrorObject &a_errorObject ,
  445. IWbemQualifierSet *classQualifierObject
  446. ) ;
  447. BOOL MergeMosClassObject (
  448. WbemSnmpErrorObject &a_errorObject ,
  449. IWbemClassObject *mosClassObject ,
  450. BOOL rigorous
  451. ) ;
  452. BOOL GetMosClassObjectProperties (
  453. WbemSnmpErrorObject &a_errorObject ,
  454. IWbemClassObject *mosClassObject
  455. ) ;
  456. BOOL GetMosClassObjectPropertyQualifiers (
  457. WbemSnmpErrorObject &a_errorObject ,
  458. WbemSnmpProperty *snmpProperty ,
  459. IWbemQualifierSet *propertyQualifierSet
  460. ) ;
  461. BOOL MergeMosClassObjectQualifiers (
  462. WbemSnmpErrorObject &a_errorObject ,
  463. IWbemQualifierSet *classQualifierObject
  464. ) ;
  465. BOOL MergeMosClassObjectProperties (
  466. WbemSnmpErrorObject &a_errorObject ,
  467. IWbemClassObject *mosClassObject ,
  468. BOOL rigorous = TRUE
  469. ) ;
  470. BOOL MergeMosClassObjectPropertyQualifiers (
  471. WbemSnmpErrorObject &a_errorObject ,
  472. WbemSnmpProperty *snmpProperty ,
  473. IWbemQualifierSet *propertyQualifierSet
  474. ) ;
  475. void AddKeyedProperty ( WbemSnmpProperty *snmpProperty ) ;
  476. protected:
  477. public:
  478. WbemSnmpClassObject () ;
  479. WbemSnmpClassObject ( const WbemSnmpClassObject &copy ) ;
  480. WbemSnmpClassObject ( const wchar_t *className , const BOOL isClass = TRUE ) ;
  481. virtual ~WbemSnmpClassObject () ;
  482. BOOL IsReadable () ;
  483. void SetReadable ( BOOL a_isReadable = TRUE ) ;
  484. BOOL IsWritable () ;
  485. void SetWritable ( BOOL a_isWritable = TRUE ) ;
  486. BOOL IsKeyed () ;
  487. void SetKeyed ( BOOL a_isKeyed = TRUE ) ;
  488. BOOL IsVirtual () ;
  489. void SetVirtual ( BOOL a_isVirtual = TRUE ) ;
  490. BOOL IsSingleton () ;
  491. void SetSingleton ( BOOL a_isSingleton = TRUE ) ;
  492. ULONG GetNumberOfAccessible () ;
  493. void SetNumberOfAccessible ( ULONG m_numberOfAccessible ) ;
  494. void SetIsClass ( const BOOL isClass ) { m_isClass = isClass ; }
  495. BOOL IsClass () { return m_isClass ; }
  496. wchar_t *GetClassName () const ;
  497. ULONG GetPropertyCount () ;
  498. BOOL AddProperty ( wchar_t *propertyName ) ;
  499. BOOL AddProperty ( WbemSnmpProperty *property ) ;
  500. void ResetProperty () ;
  501. void DeleteProperty ( wchar_t *propertyName ) ;
  502. WbemSnmpProperty *NextProperty () ;
  503. WbemSnmpProperty *GetCurrentProperty () ;
  504. BOOL GotoProperty ( WbemSnmpProperty *property );
  505. WbemSnmpProperty *FindProperty ( wchar_t *propertyName ) const ;
  506. BOOL AddKeyedProperty ( wchar_t *propertyName ) ;
  507. ULONG GetKeyPropertyCount () ;
  508. void ResetKeyProperty () ;
  509. WbemSnmpProperty *NextKeyProperty () ;
  510. WbemSnmpProperty *FindKeyProperty ( wchar_t *propertyName ) const ;
  511. ULONG GetQualifierCount () ;
  512. BOOL AddQualifier ( wchar_t *qualifierName ) ;
  513. BOOL AddQualifier ( WbemSnmpQualifier *qualifier ) ;
  514. void ResetQualifier () ;
  515. WbemSnmpQualifier *NextQualifier () ;
  516. WbemSnmpQualifier *FindQualifier ( wchar_t *qualifierName ) const ;
  517. BOOL Set ( WbemSnmpErrorObject &a_errorObject , IWbemClassObject *mosClassObject , BOOL rigorous = TRUE ) ;
  518. BOOL Get ( WbemSnmpErrorObject &a_errorObject , IWbemClassObject *mosClassObject ) ;
  519. BOOL Merge ( WbemSnmpErrorObject &a_errorObject , IWbemClassObject *mosClassObject , BOOL rigorous = TRUE ) ;
  520. virtual BOOL Check ( WbemSnmpErrorObject &a_errorObject ) ;
  521. } ;