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.5 );
|
308 karl 1.35.4.1
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.5 );
|
320 karl 1.35.4.1
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.5 );
|
336 karl 1.35.4.1
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.5 );
|
350 karl 1.35.4.1
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.5 );
|
368 karl 1.35.4.1
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.5 );
|
384 karl 1.35.4.1
385 virtual CIMResponseData pullInstancesWithPath(
386 CIMEnumerationContext& enumerationContext,
387 Boolean& endOfSequence,
|
388 karl 1.35.4.8 Uint32 maxObjectCount
|
389 karl 1.35.4.5 );
|
390 karl 1.35.4.1
391 virtual CIMResponseData pullInstancePaths(
392 CIMEnumerationContext& enumerationContext,
393 Boolean& endOfSequence,
|
394 karl 1.35.4.4 Uint32 maxObjectCount
|
395 karl 1.35.4.5 );
|
396 karl 1.35.4.1
|
397 karl 1.35.4.8 virtual CIMResponseData pullInstances(
398 CIMEnumerationContext& enumerationContext,
399 Boolean& endOfSequence,
400 Uint32 maxObjectCount
401 );
402
|
403 karl 1.35.4.1 virtual void closeEnumeration(
404 CIMEnumerationContext& enumerationContext
|
405 karl 1.35.4.5 );
|
406 karl 1.35.4.1
407 virtual Uint64Arg enumerationCount(
408 CIMEnumerationContext& enumerationContext
|
409 karl 1.35.4.5 );
410
411 virtual CIMResponseData OpenQueryInstances(
412 CIMEnumerationContext& enumerationContext,
413 Boolean& endOfSequence,
414 const CIMNamespaceName& nameSpace,
415 const String& filterQueryLanguage,
|
416 karl 1.35.4.6 const String& filterQuery,
|
417 karl 1.35.4.5 CIMClass& queryResultClass,
418 Boolean returnQueryResultClass = false,
419 Boolean continueOnError = false,
420 Uint32 operationTimeout = NULL,
421 Uint32 maxObjectCount = 0
422 );
|
423 karl 1.35.4.3 //EXP_PULL_END
|
424 karl 1.35.4.1
|
425 w.white 1.18 void registerClientOpPerformanceDataHandler(
426 ClientOpPerformanceDataHandler & handler);
|
427 david.dillard 1.19
|
428 w.white 1.18 void deregisterClientOpPerformanceDataHandler();
429
|
430 mike 1.31 void setBinaryResponse(bool x) { _binaryResponse = x; }
431
432 void setBinaryRequest(bool x) { _binaryRequest = x; }
433
|
434 karl 1.35.4.2 void connectLocalBinary();
435
436 bool _binaryResponse;
437
|
438 kumpf 1.1 private:
439
|
440 mike 1.31 void _connect(bool binaryRequest, bool binaryResponse);
|
441 karl 1.35.4.7 void _disconnect(bool keepChallengeStatus = false);
|
442 karl 1.35.4.2 void _connectLocal(bool binary);
|
443 kumpf 1.4
|
444 kumpf 1.1 Message* _doRequest(
|
445 a.arora 1.12 AutoPtr<CIMRequestMessage>& request,
|
446 kumpf 1.30 MessageType expectedResponseMessageType);
|
447 kumpf 1.1
|
448 a.arora 1.12 AutoPtr<Monitor> _monitor;
449 AutoPtr<HTTPConnector> _httpConnector;
|
450 denise.eckstein 1.20 HTTPConnection* _httpConnection;
|
451 r.kieninger 1.11
|
452 kumpf 1.1 Uint32 _timeoutMilliseconds;
453 Boolean _connected;
|
454 kumpf 1.29 /**
455 The CIMExportClient uses a lazy reconnect algorithm. A reconnection
456 is necessary when the server (listener) sends a Connection: Close
457 header in the HTTP response or when a connection timeout occurs
458 while waiting for a response. In these cases, a disconnect is
459 performed immediately and the _doReconnect flag is set. The
460 connection is re-established only when required to perform another
461 operation. Note that in the case of a connection timeout, the
462 challenge status must be reset in the ClientAuthenticator to allow
463 authentication to be performed properly on the new connection.
464 */
465 Boolean _doReconnect;
466
|
467 a.arora 1.12 AutoPtr<CIMOperationResponseDecoder> _responseDecoder;
468 AutoPtr<CIMOperationRequestEncoder> _requestEncoder;
|
469 kumpf 1.1 ClientAuthenticator _authenticator;
470 String _connectHost;
471 Uint32 _connectPortNumber;
|
472 kumpf 1.10 AutoPtr<SSLContext> _connectSSLContext;
|
473 a.dunfey 1.22 ClientPerfDataStore perfDataStore;
|
474 kumpf 1.1
|
475 kumpf 1.21 AcceptLanguageList requestAcceptLanguages;
476 ContentLanguageList requestContentLanguages;
477 ContentLanguageList responseContentLanguages;
|
478 mike 1.31 bool _binaryRequest;
|
479 r.kieninger 1.34 bool _localConnect;
|
480 kumpf 1.1 };
481
|
482 karl 1.35.4.4 /****************************************************************************
483 **
484 ** Implementation of ClientTrace class. This allows setup of variables
485 ** to control display of Client network send and receive.
486 **
487 ****************************************************************************/
488 // Tests for Display optons of the form:
489 // Env variable PEGASUS_CLIENT_TRACE= <intrace> : <outtrace
490 // intrace = "con" | "log" | "both"
491 // outtrace = intrace
492 // ex set PEGASUS_CLIENT_TRACE=BOTH:BOTH traces input and output
493 // to console and log
494 // Keywords are case insensitive.
495 // PEP 90
496 // options allowed are:
497 // keyword:keyword separately define input and output
498 // keyword: Input only
499 // :keyword Output Only
500 // keyword Input and output defined by keyword
501 //
502 class ClientTrace
503 karl 1.35.4.4 {
504 public:
505 // Bit flags, that define what is to be displayed.
506 enum TraceType
507 {
508 TRACE_NONE = 0,
509 TRACE_CON = 1,
510 TRACE_LOG = 2,
511 TRACE_BOTH = 3
512 };
513
514 // setup the control variables from env variable
515 static void setup();
516
517 // Called from OperationRequest and Response handlers to test for
518 // particular masks set. Return true if the TraceType mask defined by
519 // tt is set in the state variable.
520 static Boolean displayOutput(TraceType tt);
521 static Boolean displayInput(TraceType tt);
522
523 private:
524 karl 1.35.4.4 // constructors, etc. are private and not to be used.
525 ClientTrace();
526 ClientTrace(ClientTrace const&);
527 ClientTrace& operator=(ClientTrace const&);
528
529 // internal function to translate input strings to TraceTypes
530 static TraceType selectType(const String& str);
531
532 // Define the display states set by setup.
533 static Uint32 inputState;
534 static Uint32 outputState;
535 };
536
|
537 kumpf 1.1 PEGASUS_NAMESPACE_END
538
539 #endif /* Pegasus_ClientRep_h */
|