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