1 karl 1.19 //%2004////////////////////////////////////////////////////////////////////////
|
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.17 // 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 mike 1.2 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 kumpf 1.11 // of this software and associated documentation files (the "Software"), to
12 // deal in the Software without restriction, including without limitation the
13 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
14 mike 1.2 // sell copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
16 //
|
17 kumpf 1.11 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
18 mike 1.2 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
19 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
20 kumpf 1.11 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
23 mike 1.2 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 //
26 //==============================================================================
27 //
28 // Author: Mike Brasher (mbrasher@bmc.com)
29 //
|
30 kumpf 1.16 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
31 // (carolann_graves@hp.com)
|
32 dj.gorey 1.18 // Dan Gorey, IBM (djgorey@us.ibm.com)
|
33 mike 1.2 //
34 //%/////////////////////////////////////////////////////////////////////////////
35
36 #ifndef Pegasus_HTTPConnector_h
37 #define Pegasus_HTTPConnector_h
38
39 #include <Pegasus/Common/Config.h>
|
40 mday 1.3 #include <Pegasus/Common/MessageQueueService.h>
|
41 mike 1.2 #include <Pegasus/Common/Monitor.h>
42 #include <Pegasus/Common/String.h>
43 #include <Pegasus/Common/TLS.h>
|
44 kumpf 1.13 #include <Pegasus/Common/Linkage.h>
|
45 mike 1.2
46 PEGASUS_NAMESPACE_BEGIN
47
48 struct HTTPConnectorRep;
|
49 dj.gorey 1.18 struct HTTPConnector2Rep;
50
|
51 mike 1.2 class HTTPConnection;
52
53 /** This class is used by clients to establish a connection with a
54 server. For each established connection, a HTTPConnection object
55 is created.
56 */
|
57 mday 1.10 class PEGASUS_COMMON_LINKAGE HTTPConnector : public MessageQueueService
|
58 mike 1.2 {
|
59 mday 1.4 public:
|
60 mday 1.3
|
61 mday 1.10 typedef MessageQueueService Base;
|
62 mday 1.3
|
63 mday 1.4 /** Constructor.
64 @param monitor pointer to monitor object which this class uses to
65 solicit SocketMessages on the server port (socket).
66 @param outputMessageQueue ouptut message queue for connections
67 created by this connector.
68 */
69 HTTPConnector(Monitor* monitor);
70
71 HTTPConnector(Monitor* monitor, SSLContext * sslcontext);
|
72 dj.gorey 1.18
73 HTTPConnector(monitor_2* monitor, SSLContext * sslcontext);
|
74 mday 1.4
75 /** Destructor. */
76 ~HTTPConnector();
77
78 /** This method is called whenever a SocketMessage is enqueued
79 on the input queue of the HTTPConnector object.
80 */
81
82 virtual void handleEnqueue(Message *);
83 virtual void handleEnqueue();
84
85 /** Establishes a new connection and creates an HTTPConnection object
86 to represent it.
87
|
88 kumpf 1.16 @param host indicates host to connect to
89 @param portNumber indicates port number to use
|
90 mday 1.4 @param outputMessageQueue output message queue for the HTTPConnection
91 that will be created.
|
92 kumpf 1.14 @exception InvalidLocatorException
93 @exception CannotCreateSocketException
94 @exception CannotConnectException
|
95 mday 1.4 */
|
96 kumpf 1.7 inline HTTPConnection* connect(
|
97 kumpf 1.16 const String& host,
98 const Uint32 portNumber,
|
99 kumpf 1.7 MessageQueue* outputMessageQueue)
100 {
|
101 kumpf 1.16 return connect(host, portNumber, NULL, outputMessageQueue);
|
102 kumpf 1.7 }
103
104 /** Establishes a new connection and creates an HTTPConnection object
105 to represent it.
106
|
107 kumpf 1.16 @param host indicates host to connect to
108 @param portNumber indicates port number to use
|
109 kumpf 1.7 @param sslContext Specifies the SSL context to use for this connection
110 @param outputMessageQueue output message queue for the HTTPConnection
111 that will be created.
|
112 kumpf 1.14 @exception InvalidLocatorException
113 @exception CannotCreateSocketException
114 @exception CannotConnectException
|
115 kumpf 1.7 */
|
116 mday 1.4 HTTPConnection* connect(
|
117 kumpf 1.16 const String& host,
118 const Uint32 portNumber,
|
119 kumpf 1.7 SSLContext * sslContext,
|
120 mday 1.4 MessageQueue* outputMessageQueue);
|
121 mike 1.2
|
122 mday 1.4 /** Destroys all the connections created by this connector. */
123 void destroyConnections();
|
124 mike 1.2
|
125 kumpf 1.5 /** Close the specified connection. */
126 void disconnect(HTTPConnection* connection);
127
|
128 mday 1.4 private:
|
129 mike 1.2
|
130 kumpf 1.6 /** Delete the specified connection. */
131 void _deleteConnection(HTTPConnection* httpConnection);
132
|
133 mday 1.4 Monitor* _monitor;
134 HTTPConnectorRep* _rep;
|
135 dj.gorey 1.18
136 SSLContext * _sslcontext;
137 int _entry_index;
138
139 };
140
141
142 //****************************MONITOR2************************
143
144 class PEGASUS_COMMON_LINKAGE HTTPConnector2 : public MessageQueueService
145 {
146 public:
147
148 typedef MessageQueueService Base;
149
150 /** Constructor.
151 @param monitor pointer to monitor object which this class uses to
152 solicit SocketMessages on the server port (socket).
153 @param outputMessageQueue ouptut message queue for connections
154 created by this connector.
155 */
156 dj.gorey 1.18 HTTPConnector2(monitor_2* monitor);
157
158 HTTPConnector2(monitor_2* monitor, SSLContext * sslcontext);
159
160 /** Destructor. */
161 ~HTTPConnector2();
162
163 /** This method is called whenever a SocketMessage is enqueued
164 on the input queue of the HTTPConnector object.
165 */
166
167 virtual void handleEnqueue(Message *);
168 virtual void handleEnqueue();
169
170 /** Establishes a new connection and creates an HTTPConnection object
171 to represent it.
172
173 @param host indicates host to connect to
174 @param portNumber indicates port number to use
175 @param outputMessageQueue output message queue for the HTTPConnection
176 that will be created.
177 dj.gorey 1.18 @exception InvalidLocatorException
178 @exception CannotCreateSocketException
179 @exception CannotConnectException
180 */
181 inline HTTPConnection2* connect(
182 const String& host,
183 const Uint32 portNumber,
184 MessageQueue* outputMessageQueue)
185 {
186 return connect(host, portNumber, NULL, outputMessageQueue);
187 }
188
189 /** Establishes a new connection and creates an HTTPConnection object
190 to represent it.
191
192 @param host indicates host to connect to
193 @param portNumber indicates port number to use
194 @param sslContext Specifies the SSL context to use for this connection
195 @param outputMessageQueue output message queue for the HTTPConnection
196 that will be created.
197 @exception InvalidLocatorException
198 dj.gorey 1.18 @exception CannotCreateSocketException
199 @exception CannotConnectException
200 */
201 HTTPConnection2* connect(
202 const String& host,
203 const Uint32 portNumber,
204 SSLContext * sslContext,
205 MessageQueue* outputMessageQueue);
206
207 /** Destroys all the connections created by this connector. */
208 void destroyConnections();
209
210 /** Close the specified connection. */
211 void disconnect(HTTPConnection2* connection);
212
213 private:
214
215 /** Delete the specified connection. */
216 void _deleteConnection(HTTPConnection2* httpConnection);
217
218 monitor_2* _monitor;
219 dj.gorey 1.18 HTTPConnector2Rep* _rep2;
|
220 mike 1.2
|
221 mday 1.4 SSLContext * _sslcontext;
|
222 mday 1.12 int _entry_index;
223
|
224 mike 1.2 };
225
226 PEGASUS_NAMESPACE_END
227
228 #endif /* Pegasus_HTTPConnector_h */
|