1 karl 1.25 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.19 // 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.15 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.19 // 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.21 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.25 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.2 //
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 karl 1.25 //
|
21 mike 1.2 // 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: Mike Brasher (mbrasher@bmc.com)
33 //
34 // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
35 // Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
|
36 kumpf 1.10 // Carol Ann Krug Graves, Hewlett-Packard Company
|
37 david.dillard 1.22 // (carolann_graves@hp.com)
38 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
|
39 dj.gorey 1.17 // Dan Gorey (djgorey@us.ibm.com)
|
40 david.dillard 1.22 // David Dillard, VERITAS Software Corp.
41 // (david.dillard@veritas.com)
|
42 dj.gorey 1.17 //
|
43 mike 1.2 //%/////////////////////////////////////////////////////////////////////////////
44
|
45 kumpf 1.14 #ifndef Pegasus_ExportClient_h
46 #define Pegasus_ExportClient_h
|
47 mike 1.2
48 #include <Pegasus/Common/Config.h>
49 #include <Pegasus/Common/String.h>
|
50 kumpf 1.11 #include <Pegasus/Common/CIMName.h>
|
51 mike 1.2 #include <Pegasus/Common/Monitor.h>
52 #include <Pegasus/Common/HTTPConnector.h>
53 #include <Pegasus/Common/CIMMessage.h>
|
54 marek 1.26 #include <Pegasus/Common/HTTPConnection.h>
|
55 kumpf 1.11 #include <Pegasus/Common/MessageQueue.h>
|
56 mike 1.2 #include <Pegasus/Common/CIMObject.h>
57 #include <Pegasus/Common/Exception.h>
|
58 kumpf 1.24 #include <Pegasus/Common/ContentLanguageList.h>
|
59 kumpf 1.13 #include <Pegasus/Common/SSLContext.h>
|
60 kumpf 1.18 #include <Pegasus/Common/AutoPtr.h>
|
61 mike 1.2 #include <Pegasus/Client/ClientAuthenticator.h>
62 #include <Pegasus/ExportClient/Linkage.h>
63
64 PEGASUS_NAMESPACE_BEGIN
65
66 class Monitor;
67 class CIMExportResponseDecoder;
68 class CIMExportRequestEncoder;
69
70 /** This class provides the interface that a client uses to communicate
71 with a CIMOM.
72 */
|
73 kumpf 1.11 class PEGASUS_EXPORT_CLIENT_LINKAGE CIMExportClient : public MessageQueue
|
74 mike 1.2 {
|
75 mday 1.4 public:
76 enum { DEFAULT_TIMEOUT_MILLISECONDS = 20000 };
|
77 mike 1.2
|
78 kumpf 1.11 /** Constructor for a CIM Export Client object.
79 */
|
80 mday 1.4 CIMExportClient(
|
81 david.dillard 1.22 Monitor* monitor,
82 HTTPConnector* httpConnector,
83 Uint32 timeoutMilliseconds = DEFAULT_TIMEOUT_MILLISECONDS);
|
84 mday 1.4
|
85 kumpf 1.11 // Destructor for a CIM Export Client object.
|
86 mday 1.4 ~CIMExportClient();
87
|
88 kumpf 1.11 /** Gets the timeout in milliseconds for the CIMExportClient.
89 Default is 20 seconds (20000 milliseconds).
90 */
|
91 kumpf 1.9 Uint32 getTimeout() const
|
92 mday 1.4 {
|
93 david.dillard 1.22 return _timeoutMilliseconds;
|
94 mday 1.4 }
95
|
96 kumpf 1.11 /** Sets the timeout in milliseconds for the CIMExportClient.
97 @param timeoutMilliseconds Defines the number of milliseconds the
|
98 david.dillard 1.22 CIMExportClient will wait for a response to an outstanding request.
99 If a request times out, the connection gets reset (disconnected and
|
100 kumpf 1.11 reconnected). Default is 20 seconds (20000 milliseconds).
101 */
|
102 kumpf 1.9 void setTimeout(Uint32 timeoutMilliseconds)
|
103 mday 1.4 {
|
104 david.dillard 1.22 _timeoutMilliseconds = timeoutMilliseconds;
|
105 marek 1.26 if ((_connected) && (_httpConnection != 0))
106 _httpConnection->setSocketWriteTimeout(_timeoutMilliseconds/1000+1);
107
|
108 mday 1.4 }
109
|
110 kumpf 1.11 /** Creates an HTTP connection with the server
111 defined by the host and portNumber.
112 @param host String defining the server to which the client should
113 connect.
114 @param portNumber Uint32 defining the port number for the server
115 to which the client should connect.
116 @exception AlreadyConnectedException
117 If a connection has already been established.
118 @exception InvalidLocatorException
119 If the specified address is improperly formed.
120 @exception CannotCreateSocketException
121 If a socket cannot be created.
122 @exception CannotConnectException
123 If the socket connection fails.
124 */
|
125 kumpf 1.10 void connect(
|
126 david.dillard 1.22 const String& host,
|
127 kumpf 1.10 const Uint32 portNumber);
|
128 mday 1.4
|
129 kumpf 1.13 /** Creates an HTTP connection with a Listener defined by
130 the host and portNumber.
131 @param host String defining the hostname of the listener.
132 @param portNumber Uint32 defining the port number of the listener.
133 @param sslContext SSL context to use for this connection.
134 @exception AlreadyConnectedException
135 If a connection has already been established.
136 @exception InvalidLocatorException
137 If the specified address is improperly formed.
138 @exception CannotCreateSocketException
139 If a socket cannot be created.
140 @exception CannotConnectException
141 If the socket connection fails.
142 */
143 void connect(
144 const String& host,
145 const Uint32 portNumber,
146 const SSLContext& sslContext);
147
148
|
149 kumpf 1.11 /** Closes the connection with the server if the connection
150 was open, simply returns if the connection was not open. Clients are
151 expected to use this method to close the open connection before
152 opening a new connection.
153 */
154 void disconnect();
155
|
156 chuck 1.12 // l10n
|
157 kumpf 1.11 /** Send indication message to the destination where the url input
|
158 david.dillard 1.22 parameter defines the destination.
|
159 kumpf 1.11
|
160 david.dillard 1.22 @param url String defining the destination of the indication to be sent.
161 @param instance CIMInstance is the indication instance which needs to
|
162 kumpf 1.11 be sent to the destination.
|
163 david.dillard 1.22 @param contentLanguages The language of the indication
|
164 kumpf 1.11 */
|
165 mday 1.4 virtual void exportIndication(
|
166 david.dillard 1.22 const String& url,
167 const CIMInstance& instance,
|
168 kumpf 1.24 const ContentLanguageList& contentLanguages = ContentLanguageList());
|
169 mday 1.4
170 private:
171
|
172 kumpf 1.11 void _connect();
173
|
174 kumpf 1.16 void _disconnect();
175
|
176 kumpf 1.11 void _reconnect();
177
178 Message* _doRequest(
179 CIMRequestMessage * request,
180 const Uint32 expectedResponseMessageType);
|
181 mday 1.4
|
182 kumpf 1.11 String _getLocalHostName();
|
183 mday 1.4
184 Monitor* _monitor;
185 HTTPConnector* _httpConnector;
|
186 kumpf 1.11 HTTPConnection* _httpConnection;
|
187 dj.gorey 1.17
|
188 kumpf 1.9 Uint32 _timeoutMilliseconds;
|
189 mday 1.4 Boolean _connected;
190 CIMExportResponseDecoder* _responseDecoder;
191 CIMExportRequestEncoder* _requestEncoder;
|
192 kumpf 1.11 ClientAuthenticator _authenticator;
193 String _connectHost;
194 Uint32 _connectPortNumber;
|
195 kumpf 1.18 AutoPtr<SSLContext> _connectSSLContext;
|
196 mike 1.2 };
197
198 PEGASUS_NAMESPACE_END
199
|
200 kumpf 1.14 #endif /* Pegasus_ExportClient_h */
|