1 martin 1.32 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.33 //
|
3 martin 1.32 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.33 //
|
10 martin 1.32 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.33 //
|
17 martin 1.32 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.33 //
|
20 martin 1.32 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.33 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.32 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.33 //
|
28 martin 1.32 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_ClientRep_h
33 #define Pegasus_ClientRep_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/String.h>
37 #include <Pegasus/Common/CIMName.h>
38 #include <Pegasus/Common/SSLContext.h>
39 #include <Pegasus/Common/CIMObject.h>
40 #include <Pegasus/Common/CIMClass.h>
41 #include <Pegasus/Common/CIMInstance.h>
42 #include <Pegasus/Common/CIMObjectPath.h>
43 #include <Pegasus/Common/CIMValue.h>
44 #include <Pegasus/Common/CIMParamValue.h>
45 #include <Pegasus/Common/CIMPropertyList.h>
46 #include <Pegasus/Common/CIMQualifierDecl.h>
47 #include <Pegasus/Common/Exception.h>
48 #include <Pegasus/Common/Constants.h>
49 #include <Pegasus/Common/FileSystem.h>
50 kumpf 1.1 #include <Pegasus/Common/Monitor.h>
51 #include <Pegasus/Common/HTTPConnector.h>
52 #include <Pegasus/Common/CIMMessage.h>
53 #include <Pegasus/Common/HTTPConnection.h>
54 #include <Pegasus/Common/XmlWriter.h>
55 #include <Pegasus/Common/TimeValue.h>
|
56 kumpf 1.10 #include <Pegasus/Common/AutoPtr.h>
|
57 kumpf 1.1 #include <Pegasus/Client/CIMClientException.h>
58 #include <Pegasus/Client/Linkage.h>
59 #include <Pegasus/Client/CIMClientInterface.h>
|
60 a.dunfey 1.22 #include <Pegasus/Client/ClientPerfDataStore.h>
|
61 kumpf 1.1
62 #include "CIMOperationResponseDecoder.h"
63 #include "CIMOperationRequestEncoder.h"
|
64 w.white 1.16
|
65 kumpf 1.1
66 PEGASUS_NAMESPACE_BEGIN
67
68 ///////////////////////////////////////////////////////////////////////////////
69 //
70 // CIMClientRep
71 //
72 ///////////////////////////////////////////////////////////////////////////////
|
73 mike 1.24 class PEGASUS_CLIENT_LINKAGE CIMClientRep : public CIMClientInterface
|
74 kumpf 1.1 {
75 public:
76
77 // Timeout value defines the time the CIMClient will wait for a response
78 // to an outstanding request. If a request times out, the connection
79 // gets reset (disconnected and reconnected).
|
80 marek 1.28 CIMClientRep(Uint32 timeoutMilliseconds =
81 PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
|
82 kumpf 1.1
83 ~CIMClientRep();
84
85 virtual void handleEnqueue();
86
87 virtual Uint32 getTimeout() const
88 {
89 return _timeoutMilliseconds;
90 }
91
92 virtual void setTimeout(Uint32 timeoutMilliseconds)
93 {
94 _timeoutMilliseconds = timeoutMilliseconds;
|
95 kumpf 1.27 if ((_connected) && (_httpConnection != 0))
|
96 marek 1.28 _httpConnection->setSocketWriteTimeout(_timeoutMilliseconds/1000+1);
|
97 kumpf 1.1 }
98
|
99 kumpf 1.21 AcceptLanguageList getRequestAcceptLanguages() const;
100 ContentLanguageList getRequestContentLanguages() const;
101 ContentLanguageList getResponseContentLanguages() const;
102 void setRequestAcceptLanguages(const AcceptLanguageList& langs);
103 void setRequestContentLanguages(const ContentLanguageList& langs);
|
104 kumpf 1.1 void setRequestDefaultLanguages();
105
106 void connect(
107 const String& host,
108 const Uint32 portNumber,
109 const String& userName,
110 const String& password
111 );
112
113 void connect(
114 const String& host,
115 const Uint32 portNumber,
116 const SSLContext& sslContext,
117 const String& userName,
118 const String& password
119 );
120
121 void connectLocal();
122
123 void disconnect();
124
|
125 david.dillard 1.19 Boolean isConnected() const throw();
|
126 marek 1.9
|
127 r.kieninger 1.34 Boolean isLocalConnect() const throw();
128
|
129 kumpf 1.1 virtual CIMClass getClass(
130 const CIMNamespaceName& nameSpace,
131 const CIMName& className,
132 Boolean localOnly = true,
133 Boolean includeQualifiers = true,
134 Boolean includeClassOrigin = false,
135 const CIMPropertyList& propertyList = CIMPropertyList()
136 );
137
|
138 thilo.boehm 1.35 virtual CIMResponseData getInstance(
|
139 kumpf 1.1 const CIMNamespaceName& nameSpace,
140 const CIMObjectPath& instanceName,
141 Boolean localOnly = true,
142 Boolean includeQualifiers = false,
143 Boolean includeClassOrigin = false,
144 const CIMPropertyList& propertyList = CIMPropertyList()
145 );
146
147 virtual void deleteClass(
148 const CIMNamespaceName& nameSpace,
149 const CIMName& className
150 );
151
152 virtual void deleteInstance(
153 const CIMNamespaceName& nameSpace,
154 const CIMObjectPath& instanceName
155 );
156
157 virtual void createClass(
158 const CIMNamespaceName& nameSpace,
159 const CIMClass& newClass
160 kumpf 1.1 );
161
162 virtual CIMObjectPath createInstance(
163 const CIMNamespaceName& nameSpace,
164 const CIMInstance& newInstance
165 );
166
167 virtual void modifyClass(
168 const CIMNamespaceName& nameSpace,
169 const CIMClass& modifiedClass
170 );
171
172 virtual void modifyInstance(
173 const CIMNamespaceName& nameSpace,
174 const CIMInstance& modifiedInstance,
175 Boolean includeQualifiers = true,
176 const CIMPropertyList& propertyList = CIMPropertyList()
177 );
178
179 virtual Array<CIMClass> enumerateClasses(
180 const CIMNamespaceName& nameSpace,
181 kumpf 1.1 const CIMName& className = CIMName(),
182 Boolean deepInheritance = false,
183 Boolean localOnly = true,
184 Boolean includeQualifiers = true,
185 Boolean includeClassOrigin = false
186 );
187
188 virtual Array<CIMName> enumerateClassNames(
189 const CIMNamespaceName& nameSpace,
190 const CIMName& className = CIMName(),
191 Boolean deepInheritance = false
192 );
193
|
194 thilo.boehm 1.35 virtual CIMResponseData enumerateInstances(
|
195 r.kieninger 1.34 const CIMNamespaceName& nameSpace,
196 const CIMName& className,
197 Boolean deepInheritance = true,
198 Boolean localOnly = true,
199 Boolean includeQualifiers = false,
200 Boolean includeClassOrigin = false,
201 const CIMPropertyList& propertyList = CIMPropertyList()
202 );
203
|
204 thilo.boehm 1.35 virtual CIMResponseData enumerateInstanceNames(
|
205 kumpf 1.1 const CIMNamespaceName& nameSpace,
206 const CIMName& className
207 );
208
|
209 thilo.boehm 1.35 virtual CIMResponseData execQuery(
|
210 kumpf 1.1 const CIMNamespaceName& nameSpace,
211 const String& queryLanguage,
212 const String& query
213 );
214
|
215 thilo.boehm 1.35 virtual CIMResponseData associators(
|
216 r.kieninger 1.34 const CIMNamespaceName& nameSpace,
217 const CIMObjectPath& objectName,
218 const CIMName& assocClass = CIMName(),
219 const CIMName& resultClass = CIMName(),
220 const String& role = String::EMPTY,
221 const String& resultRole = String::EMPTY,
222 Boolean includeQualifiers = false,
223 Boolean includeClassOrigin = false,
224 const CIMPropertyList& propertyList = CIMPropertyList()
225 );
226
|
227 thilo.boehm 1.35 virtual CIMResponseData associatorNames(
|
228 kumpf 1.1 const CIMNamespaceName& nameSpace,
229 const CIMObjectPath& objectName,
230 const CIMName& assocClass = CIMName(),
231 const CIMName& resultClass = CIMName(),
232 const String& role = String::EMPTY,
233 const String& resultRole = String::EMPTY
234 );
235
|
236 thilo.boehm 1.35 virtual CIMResponseData references(
|
237 kumpf 1.1 const CIMNamespaceName& nameSpace,
238 const CIMObjectPath& objectName,
239 const CIMName& resultClass = CIMName(),
240 const String& role = String::EMPTY,
241 Boolean includeQualifiers = false,
242 Boolean includeClassOrigin = false,
243 const CIMPropertyList& propertyList = CIMPropertyList()
244 );
245
|
246 thilo.boehm 1.35 virtual CIMResponseData referenceNames(
|
247 kumpf 1.1 const CIMNamespaceName& nameSpace,
248 const CIMObjectPath& objectName,
249 const CIMName& resultClass = CIMName(),
250 const String& role = String::EMPTY
251 );
252
253 virtual CIMValue getProperty(
254 const CIMNamespaceName& nameSpace,
255 const CIMObjectPath& instanceName,
256 const CIMName& propertyName
257 );
258
259 virtual void setProperty(
260 const CIMNamespaceName& nameSpace,
261 const CIMObjectPath& instanceName,
262 const CIMName& propertyName,
263 const CIMValue& newValue = CIMValue()
264 );
265
266 virtual CIMQualifierDecl getQualifier(
267 const CIMNamespaceName& nameSpace,
268 kumpf 1.1 const CIMName& qualifierName
269 );
270
271 virtual void setQualifier(
272 const CIMNamespaceName& nameSpace,
273 const CIMQualifierDecl& qualifierDeclaration
274 );
275
276 virtual void deleteQualifier(
277 const CIMNamespaceName& nameSpace,
278 const CIMName& qualifierName
279 );
280
281 virtual Array<CIMQualifierDecl> enumerateQualifiers(
282 const CIMNamespaceName& nameSpace
283 );
284
285 virtual CIMValue invokeMethod(
286 const CIMNamespaceName& nameSpace,
287 const CIMObjectPath& instanceName,
288 const CIMName& methodName,
289 kumpf 1.1 const Array<CIMParamValue>& inParameters,
290 Array<CIMParamValue>& outParameters
291 );
292
|
293 karl 1.35.4.3 // EXP_PULL_BEGIN
|
294 karl 1.35.4.1 virtual CIMResponseData openEnumerateInstances(
295 CIMEnumerationContext& enumerationContext,
296 Boolean& endOfSequence,
297 const CIMNamespaceName& nameSpace,
298 const CIMName& className,
299 Boolean deepInheritance = false,
300 Boolean includeClassOrigin = false,
301 const CIMPropertyList& propertyList = CIMPropertyList(),
302 const String& filterQueryLanguage = String::EMPTY,
303 const String& filterQuery = String::EMPTY,
304 const Uint32Arg& operationTimeout = Uint32Arg(),
|
305 karl 1.35.4.4 Boolean continueOnError = false,
306 Uint32 maxObjectCount = 0
|
307 karl 1.35.4.1 );
308
309 virtual CIMResponseData openEnumerateInstancePaths(
310 CIMEnumerationContext& enumerationContext,
311 Boolean& endOfSequence,
312 const CIMNamespaceName& nameSpace,
313 const CIMName& className,
314 const String& filterQueryLanguage = String(),
315 const String& filterQuery = String(),
316 const Uint32Arg& operationTimeout = Uint32Arg(),
|
317 karl 1.35.4.4 Boolean continueOnError = false,
318 Uint32 maxObjectCount = 0
|
319 karl 1.35.4.1 );
320
321 virtual CIMResponseData openReferenceInstances(
322 CIMEnumerationContext& enumerationContext,
323 Boolean& endOfSequence,
324 const CIMNamespaceName& nameSpace,
325 const CIMObjectPath& objectName,
326 const CIMName& resultClass = CIMName(),
327 const String& role = String::EMPTY,
328 Boolean includeClassOrigin = false,
329 const CIMPropertyList& propertyList = CIMPropertyList(),
330 const String& filterQueryLanguage = String(),
331 const String& filterQuery = String(),
332 const Uint32Arg& operationTimeout = Uint32Arg(),
|
333 karl 1.35.4.4 Boolean continueOnError = false,
334 Uint32 maxObjectCount = 0
|
335 karl 1.35.4.1 );
336
337 virtual CIMResponseData openReferenceInstancePaths(
338 CIMEnumerationContext& enumerationContext,
339 Boolean& endOfSequence,
340 const CIMNamespaceName& nameSpace,
341 const CIMObjectPath& objectName,
342 const CIMName& resultClass = CIMName(),
343 const String& role = String::EMPTY,
344 const String& filterQueryLanguage = String(),
345 const String& filterQuery = String(),
346 const Uint32Arg& operationTimeout = Uint32Arg(),
|
347 karl 1.35.4.4 Boolean continueOnError = false,
348 Uint32 maxObjectCount = 0
|
349 karl 1.35.4.1 );
350
351 virtual CIMResponseData openAssociatorInstances(
352 CIMEnumerationContext& enumerationContext,
353 Boolean& endOfSequence,
354 const CIMNamespaceName& nameSpace,
355 const CIMObjectPath& objectName,
356 const CIMName& assocClass = CIMName(),
357 const CIMName& resultClass = CIMName(),
358 const String& role = String::EMPTY,
359 const String& resultRole = String::EMPTY,
360 Boolean includeClassOrigin = false,
361 const CIMPropertyList& propertyList = CIMPropertyList(),
362 const String& filterQueryLanguage = String(),
363 const String& filterQuery = String(),
364 const Uint32Arg& operationTimeout = Uint32Arg(),
|
365 karl 1.35.4.4 Boolean continueOnError = false,
366 Uint32 maxObjectCount = 0
|
367 karl 1.35.4.1 );
368
369 virtual CIMResponseData openAssociatorInstancePaths(
370 CIMEnumerationContext& enumerationContext,
371 Boolean& endOfSequence,
372 const CIMNamespaceName& nameSpace,
373 const CIMObjectPath& objectName,
374 const CIMName& assocClass = CIMName(),
375 const CIMName& resultClass = CIMName(),
376 const String& role = String::EMPTY,
377 const String& resultRole = String::EMPTY,
378 const String& filterQueryLanguage = String(),
379 const String& filterQuery = String(),
380 const Uint32Arg& operationTimeout = Uint32Arg(),
|
381 karl 1.35.4.4 Boolean continueOnError = false,
382 Uint32 maxObjectCount = 0
|
383 karl 1.35.4.1 );
384
385 virtual CIMResponseData pullInstancesWithPath(
386 CIMEnumerationContext& enumerationContext,
387 Boolean& endOfSequence,
|
388 karl 1.35.4.4 Uint32 maxObjectCount
|
389 karl 1.35.4.1 );
390
391 virtual CIMResponseData pullInstancePaths(
392 CIMEnumerationContext& enumerationContext,
393 Boolean& endOfSequence,
|
394 karl 1.35.4.4 Uint32 maxObjectCount
|
395 karl 1.35.4.1 );
396
397 virtual void closeEnumeration(
398 CIMEnumerationContext& enumerationContext
399 );
400
401 virtual Uint64Arg enumerationCount(
402 CIMEnumerationContext& enumerationContext
403 );
|
404 karl 1.35.4.3 //EXP_PULL_END
|
405 karl 1.35.4.1
|
406 w.white 1.18 void registerClientOpPerformanceDataHandler(
407 ClientOpPerformanceDataHandler & handler);
|
408 david.dillard 1.19
|
409 w.white 1.18 void deregisterClientOpPerformanceDataHandler();
410
|
411 mike 1.31 void setBinaryResponse(bool x) { _binaryResponse = x; }
412
413 void setBinaryRequest(bool x) { _binaryRequest = x; }
414
|
415 karl 1.35.4.2 void connectLocalBinary();
416
417 bool _binaryResponse;
418
|
419 kumpf 1.1 private:
420
|
421 mike 1.31 void _connect(bool binaryRequest, bool binaryResponse);
|
422 kumpf 1.4 void _disconnect();
|
423 karl 1.35.4.2 void _connectLocal(bool binary);
|
424 kumpf 1.4
|
425 kumpf 1.1 Message* _doRequest(
|
426 a.arora 1.12 AutoPtr<CIMRequestMessage>& request,
|
427 kumpf 1.30 MessageType expectedResponseMessageType);
|
428 kumpf 1.1
|
429 a.arora 1.12 AutoPtr<Monitor> _monitor;
430 AutoPtr<HTTPConnector> _httpConnector;
|
431 denise.eckstein 1.20 HTTPConnection* _httpConnection;
|
432 r.kieninger 1.11
|
433 kumpf 1.1 Uint32 _timeoutMilliseconds;
434 Boolean _connected;
|
435 kumpf 1.29 /**
436 The CIMExportClient uses a lazy reconnect algorithm. A reconnection
437 is necessary when the server (listener) sends a Connection: Close
438 header in the HTTP response or when a connection timeout occurs
439 while waiting for a response. In these cases, a disconnect is
440 performed immediately and the _doReconnect flag is set. The
441 connection is re-established only when required to perform another
442 operation. Note that in the case of a connection timeout, the
443 challenge status must be reset in the ClientAuthenticator to allow
444 authentication to be performed properly on the new connection.
445 */
446 Boolean _doReconnect;
447
|
448 a.arora 1.12 AutoPtr<CIMOperationResponseDecoder> _responseDecoder;
449 AutoPtr<CIMOperationRequestEncoder> _requestEncoder;
|
450 kumpf 1.1 ClientAuthenticator _authenticator;
451 String _connectHost;
452 Uint32 _connectPortNumber;
|
453 kumpf 1.10 AutoPtr<SSLContext> _connectSSLContext;
|
454 a.dunfey 1.22 ClientPerfDataStore perfDataStore;
|
455 kumpf 1.1
|
456 kumpf 1.21 AcceptLanguageList requestAcceptLanguages;
457 ContentLanguageList requestContentLanguages;
458 ContentLanguageList responseContentLanguages;
|
459 mike 1.31 bool _binaryRequest;
|
460 r.kieninger 1.34 bool _localConnect;
|
461 kumpf 1.1 };
462
|
463 karl 1.35.4.4 /****************************************************************************
464 **
465 ** Implementation of ClientTrace class. This allows setup of variables
466 ** to control display of Client network send and receive.
467 **
468 ****************************************************************************/
469 // Tests for Display optons of the form:
470 // Env variable PEGASUS_CLIENT_TRACE= <intrace> : <outtrace
471 // intrace = "con" | "log" | "both"
472 // outtrace = intrace
473 // ex set PEGASUS_CLIENT_TRACE=BOTH:BOTH traces input and output
474 // to console and log
475 // Keywords are case insensitive.
476 // PEP 90
477 // options allowed are:
478 // keyword:keyword separately define input and output
479 // keyword: Input only
480 // :keyword Output Only
481 // keyword Input and output defined by keyword
482 //
483 class ClientTrace
484 karl 1.35.4.4 {
485 public:
486 // Bit flags, that define what is to be displayed.
487 enum TraceType
488 {
489 TRACE_NONE = 0,
490 TRACE_CON = 1,
491 TRACE_LOG = 2,
492 TRACE_BOTH = 3
493 };
494
495 // setup the control variables from env variable
496 static void setup();
497
498 // Called from OperationRequest and Response handlers to test for
499 // particular masks set. Return true if the TraceType mask defined by
500 // tt is set in the state variable.
501 static Boolean displayOutput(TraceType tt);
502 static Boolean displayInput(TraceType tt);
503
504 private:
505 karl 1.35.4.4 // constructors, etc. are private and not to be used.
506 ClientTrace();
507 ClientTrace(ClientTrace const&);
508 ClientTrace& operator=(ClientTrace const&);
509
510 // internal function to translate input strings to TraceTypes
511 static TraceType selectType(const String& str);
512
513 // Define the display states set by setup.
514 static Uint32 inputState;
515 static Uint32 outputState;
516 };
517
|
518 kumpf 1.1 PEGASUS_NAMESPACE_END
519
520 #endif /* Pegasus_ClientRep_h */
|