1 karl 1.7 //%2006////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.1 //
|
3 karl 1.5 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.3 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.5 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.6 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.7 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 kumpf 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Author: Barbara Packard (barbara_packard@hp.com)
33 //
|
34 kumpf 1.2 // Modified By: Adriano Zanuz (adriano.zanuz@hp.com)
|
35 kumpf 1.4 // Terry Martin, Hewlett-Packard Company (terry.martin@hp.com)
|
36 kumpf 1.1 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
39
40 #ifndef Pegasus_WMICollector_h
41 #define Pegasus_WMICollector_h
42
43 #include <Pegasus/Common/Array.h>
44 #include <Pegasus/Common/String.h>
45 #include <Pegasus/Common/CIMPropertyList.h>
46 #include <Pegasus/Common/CIMObjectPath.h>
47 #include <Pegasus/Common/CIMInstance.h>
48 #include <Pegasus/Common/CIMClass.h>
49
50 #include <Pegasus/Common/CIMValue.h>
51 #include <Pegasus/Common/CIMDateTime.h>
52 #include <Pegasus/Common/CIMProperty.h>
53 #include <Pegasus/Common/CIMPropertyList.h>
54 #include <Pegasus/Common/CIMPropertyList.h>
55 #include <Pegasus/Common/CIMParamValue.h>
56
|
57 kumpf 1.2 //#include <Ntsecapi.h>
58
|
59 kumpf 1.1 PEGASUS_NAMESPACE_BEGIN
60
61 class WMICollector
62 {
63 public:
|
64 kumpf 1.2 WMICollector(bool bLocal = FALSE);
|
65 kumpf 1.1 virtual ~WMICollector(void);
66
67 virtual void terminate(void);
68
69 bool getInstanceEnum(
70 IEnumWbemClassObject **ppInstances,
71 const String & sClassName,
72 Boolean deepInheritance);
73
74 bool getClassEnum(
75 IEnumWbemClassObject **ppClasses,
76 const String & sSuperClass,
77 Boolean deepInheritance);
78
79 bool getQueryResult(
80 IEnumWbemClassObject **ppInstances,
81 const String & query,
82 const String & queryLanguage);
83
84 void setNamespace(const char * sNamespace){m_bsNamespace = (LPCTSTR)sNamespace;}
85 void setNamespace(const String & sNamespace);
|
86 kumpf 1.2 void setUserName(const String & sUserName);
87 void setPassword(const String & sPassword);
|
88 kumpf 1.1 bool Connect(IWbemServices **ppServices);
89 bool setup();
90
91 bool getObject(IWbemClassObject **ppObject, const String & sObjectName);
92
93 bool getCIMInstance(IWbemClassObject *pObject,
94 CIMInstance & cimInst,
95 Boolean localOnly,
96 Boolean includeQualifiers,
97 Boolean includeClassOrigin,
98 const CIMPropertyList& propertyList = CIMPropertyList(),
99 Boolean getKeyProperties = FALSE);
100
101 bool getCIMObject(IWbemClassObject *pObject,
102 CIMObject & cimObj,
103 Boolean localOnly,
104 Boolean includeQualifiers,
105 Boolean includeClassOrigin,
106 const CIMPropertyList& propertyList = CIMPropertyList(),
107 Boolean getKeyProperties = FALSE);
108
109 kumpf 1.1
110 bool getCIMClass(IWbemClassObject *pObject,
111 CIMClass & cimClass,
112 Boolean localOnly,
113 Boolean includeQualifiers,
114 Boolean includeClassOrigin,
115 const CIMPropertyList& propertyList = CIMPropertyList());
116
117 static String getClassName(IWbemClassObject *pObject);
118 String getSuperClass(IWbemClassObject *pClass);
119 String getRelativePath(IWbemClassObject *pObject);
120
121 bool isInstance(IWbemClassObject *pObject);
122
123 bool getObjectProperties(IWbemClassObject * pObject,
124 CIMObject & cimObj,
125 Boolean localOnly,
126 Boolean includeQualifiers,
127 Boolean includeClassOrigin,
128 const CIMPropertyList& propertyList,
129 Boolean bGetKeyProperties = FALSE);
130 kumpf 1.1
131 static CIMProperty getProperty(IWbemClassObject *pClass,
132 const CComBSTR & bsName,
133 const CComVariant & vValue, // this will be NULL for class objects
134 CIMTYPE type,
|
135 kumpf 1.4 Boolean includeClassOrigin,
136 Boolean includeQualifiers,
137 Boolean bPropagated);
138
139 bool getClassMethods(IWbemClassObject *pObject,
140 CIMClass & cimClass,
141 Boolean localOnly,
142 Boolean includeQualifiers,
143 Boolean includeClassOrigin);
144
145 static CIMMethod getMethod(IWbemClassObject *pClass,
146 const CComBSTR &bsName,
147 const CComPtr<IWbemClassObject> &inParameters,
148 const CComPtr<IWbemClassObject> &outParameters,
|
149 kumpf 1.1 Boolean includeClassOrigin,
150 Boolean includeQualifiers,
151 Boolean bPropagated);
152
|
153 kumpf 1.2 bool setProxySecurity(IUnknown * pProxy);
154
155 bool isLocalNamespace()
156 {return m_bIsLocalNamespace;}
157
158 bool isLocalConnection()
159 { return m_bLocalConnection; }
160
|
161 kumpf 1.1 private:
162 static String getStringProperty(
163 IWbemClassObject *pObject,
164 const CComBSTR & bsPropertyName);
165
166 bool isArrayType(VARTYPE vt)
167 {return (vt & VT_ARRAY) ? true : false;}
168
169 bool isReferenceType(VARTYPE vt)
170 {return (vt & VT_BYREF) ? true : false;}
171
|
172 kumpf 1.2 void logonUser();
173
174 void revertToSelf();
175
176 /*
177 LSA_HANDLE GetPolicyHandle();
178 bool GetAccountSid(LPTSTR, LPTSTR, PSID*);
179 void AddPrivileges(PSID, LSA_HANDLE);
180 void InitLsaString(PLSA_UNICODE_STRING, LPWSTR);
181 */
182
|
183 kumpf 1.1 bool m_bInitialized;
|
184 kumpf 1.2 bool m_bIsLocalNamespace;
185 bool m_bImpersonate;
186 bool m_bLocalConnection;
|
187 kumpf 1.1
188 // WMI interfaces
189 CComBSTR m_bsNamespace;
|
190 kumpf 1.2 CComBSTR m_bsUserName;
191 CComBSTR m_bsPassword;
192 CComBSTR m_bsDomain;
|
193 kumpf 1.1 };
194
195 PEGASUS_NAMESPACE_END
196
197 #endif
|