(file) Return to CIMExportClient.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ExportClient

  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            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34 kumpf 1.14 #ifndef Pegasus_ExportClient_h
 35            #define Pegasus_ExportClient_h
 36 mike  1.2  
 37            #include <Pegasus/Common/Config.h>
 38            #include <Pegasus/Common/String.h>
 39 kumpf 1.11 #include <Pegasus/Common/CIMName.h>
 40 mike  1.2  #include <Pegasus/Common/Monitor.h>
 41            #include <Pegasus/Common/HTTPConnector.h>
 42            #include <Pegasus/Common/CIMMessage.h>
 43 marek 1.26 #include <Pegasus/Common/HTTPConnection.h>
 44 kumpf 1.11 #include <Pegasus/Common/MessageQueue.h>
 45 mike  1.2  #include <Pegasus/Common/CIMObject.h>
 46            #include <Pegasus/Common/Exception.h>
 47 kumpf 1.24 #include <Pegasus/Common/ContentLanguageList.h>
 48 kumpf 1.13 #include <Pegasus/Common/SSLContext.h>
 49 kumpf 1.18 #include <Pegasus/Common/AutoPtr.h>
 50 mike  1.2  #include <Pegasus/Client/ClientAuthenticator.h>
 51            #include <Pegasus/ExportClient/Linkage.h>
 52            
 53            PEGASUS_NAMESPACE_BEGIN
 54            
 55            class Monitor;
 56            class CIMExportResponseDecoder;
 57            class CIMExportRequestEncoder;
 58            
 59 kumpf 1.30 /**
 60                This class provides the interface that a client uses to communicate
 61 mike  1.2      with a CIMOM.
 62            */
 63 kumpf 1.11 class PEGASUS_EXPORT_CLIENT_LINKAGE CIMExportClient : public MessageQueue
 64 mike  1.2  {
 65 kumpf 1.30 public:
 66 mike  1.2  
 67 kumpf 1.30     /**
 68                    Constructor for a CIM Export Client object.
 69                */
 70                CIMExportClient(
 71                    Monitor* monitor,
 72                    HTTPConnector* httpConnector,
 73                    Uint32 timeoutMilliseconds =
 74                        PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
 75            
 76                // Destructor for a CIM Export Client object.
 77                ~CIMExportClient();
 78            
 79                /**
 80                    Gets the timeout in milliseconds for the CIMExportClient.
 81                    Default is 20 seconds (20000 milliseconds).
 82                */
 83                Uint32 getTimeout() const
 84                {
 85                    return _timeoutMilliseconds;
 86                }
 87 mday  1.4  
 88 kumpf 1.30     /**
 89                    Sets the timeout in milliseconds for the CIMExportClient.
 90 kumpf 1.11         @param timeoutMilliseconds Defines the number of milliseconds the
 91 david.dillard 1.22         CIMExportClient will wait for a response to an outstanding request.
 92                            If a request times out, the connection gets reset (disconnected and
 93 kumpf         1.11         reconnected).  Default is 20 seconds (20000 milliseconds).
 94 kumpf         1.30     */
 95                        void setTimeout(Uint32 timeoutMilliseconds)
 96                        {
 97                            _timeoutMilliseconds = timeoutMilliseconds;
 98                            if ((_connected) && (_httpConnection != 0))
 99                            {
100                                _httpConnection->setSocketWriteTimeout(_timeoutMilliseconds/1000+1);
101                            }
102                        }
103 marek         1.26 
104 kumpf         1.30     /**
105                            Creates an HTTP connection with the server
106 kumpf         1.11         defined by the host and portNumber.
107                            @param host String defining the server to which the client should
108                            connect.
109                            @param portNumber Uint32 defining the port number for the server
110                            to which the client should connect.
111                            @exception AlreadyConnectedException
112                                If a connection has already been established.
113                            @exception InvalidLocatorException
114                                If the specified address is improperly formed.
115                            @exception CannotCreateSocketException
116                                If a socket cannot be created.
117                            @exception CannotConnectException
118                                If the socket connection fails.
119 kumpf         1.30     */
120                        void connect(
121                            const String& host,
122                            const Uint32 portNumber);
123                    
124                        /**
125                            Creates an HTTP connection with a Listener defined by
126                            the host and portNumber.
127                            @param host String defining the hostname of the listener.
128                            @param portNumber Uint32 defining the port number of the listener.
129                            @param sslContext SSL context to use for this connection.
130                            @exception AlreadyConnectedException
131                                If a connection has already been established.
132                            @exception InvalidLocatorException
133                                If the specified address is improperly formed.
134                            @exception CannotCreateSocketException
135                                If a socket cannot be created.
136                            @exception CannotConnectException
137                                If the socket connection fails.
138                        */
139                        void connect(
140 kumpf         1.30         const String& host,
141                            const Uint32 portNumber,
142                            const SSLContext& sslContext);
143 kumpf         1.13 
144                    
145 kumpf         1.30     /**
146                            Closes the connection with the server if the connection
147 kumpf         1.11         was open, simply returns if the connection was not open. Clients are
148                            expected to use this method to close the open connection before
149                            opening a new connection.
150 kumpf         1.30     */
151                        void disconnect();
152 kumpf         1.11 
153 kumpf         1.30     /**
154                            Send indication message to the destination where the url input
155 david.dillard 1.22         parameter defines the destination.
156 kumpf         1.11 
157 david.dillard 1.22         @param url String defining the destination of the indication to be sent.
158                            @param instance CIMInstance is the indication instance which needs to
159 kumpf         1.11         be sent to the destination.
160 david.dillard 1.22         @param contentLanguages The language of the indication
161 kumpf         1.30     */
162                        virtual void exportIndication(
163                            const String& url,
164                            const CIMInstance& instance,
165                            const ContentLanguageList& contentLanguages = ContentLanguageList());
166                    
167                    private:
168                    
169                        void _connect();
170                        void _disconnect();
171                    
172                        Message* _doRequest(
173                            CIMRequestMessage* request,
174                            Uint32 expectedResponseMessageType);
175                    
176                        Monitor* _monitor;
177                        HTTPConnector* _httpConnector;
178                        HTTPConnection* _httpConnection;
179                    
180                        Uint32 _timeoutMilliseconds;
181                        Boolean _connected;
182 kumpf         1.30     /**
183                            The CIMExportClient uses a lazy reconnect algorithm.  A reconnection
184                            is necessary when the server (listener) sends a Connection: Close
185                            header in the HTTP response or when a connection timeout occurs
186                            while waiting for a response.  In these cases, a disconnect is
187                            performed immediately and the _doReconnect flag is set.  The
188                            connection is re-established only when required to perform another
189                            operation.  Note that in the case of a connection timeout, the
190                            challenge status must be reset in the ClientAuthenticator to allow
191                            authentication to be performed properly on the new connection.
192                        */
193                        Boolean _doReconnect;
194                    
195                        CIMExportResponseDecoder* _responseDecoder;
196                        CIMExportRequestEncoder* _requestEncoder;
197                        ClientAuthenticator _authenticator;
198                        String _connectHost;
199                        Uint32 _connectPortNumber;
200                        AutoPtr<SSLContext> _connectSSLContext;
201 mike          1.2  };
202                    
203                    PEGASUS_NAMESPACE_END
204                    
205 kumpf         1.14 #endif /* Pegasus_ExportClient_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2