1 kumpf 1.11 //%/////////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 kumpf 1.11 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
|
4 mike 1.2 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 kumpf 1.11 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 mike 1.2 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
|
13 kumpf 1.11 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mike 1.2 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 kumpf 1.11 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 mike 1.2 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
|
26 kumpf 1.16 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
27 // (carolann_graves@hp.com)
|
28 mike 1.2 //
29 //%/////////////////////////////////////////////////////////////////////////////
30
31 #ifndef Pegasus_HTTPConnector_h
32 #define Pegasus_HTTPConnector_h
33
34 #include <Pegasus/Common/Config.h>
|
35 mday 1.3 #include <Pegasus/Common/MessageQueueService.h>
|
36 mike 1.2 #include <Pegasus/Common/Monitor.h>
37 #include <Pegasus/Common/String.h>
38 #include <Pegasus/Common/TLS.h>
|
39 kumpf 1.13 #include <Pegasus/Common/Linkage.h>
|
40 mike 1.2
41 PEGASUS_NAMESPACE_BEGIN
42
43 struct HTTPConnectorRep;
44 class HTTPConnection;
45
46 /** This class is used by clients to establish a connection with a
47 server. For each established connection, a HTTPConnection object
48 is created.
49 */
|
50 mday 1.10 class PEGASUS_COMMON_LINKAGE HTTPConnector : public MessageQueueService
|
51 mike 1.2 {
|
52 mday 1.4 public:
|
53 mday 1.3
|
54 mday 1.10 typedef MessageQueueService Base;
|
55 mday 1.3
|
56 mday 1.4 /** Constructor.
57 @param monitor pointer to monitor object which this class uses to
58 solicit SocketMessages on the server port (socket).
59 @param outputMessageQueue ouptut message queue for connections
60 created by this connector.
61 */
62 HTTPConnector(Monitor* monitor);
63
64 HTTPConnector(Monitor* monitor, SSLContext * sslcontext);
65
66 /** Destructor. */
67 ~HTTPConnector();
68
69 /** This method is called whenever a SocketMessage is enqueued
70 on the input queue of the HTTPConnector object.
71 */
72
73 virtual void handleEnqueue(Message *);
74 virtual void handleEnqueue();
75
76 /** Establishes a new connection and creates an HTTPConnection object
77 mday 1.4 to represent it.
78
|
79 kumpf 1.16 @param host indicates host to connect to
80 @param portNumber indicates port number to use
|
81 mday 1.4 @param outputMessageQueue output message queue for the HTTPConnection
82 that will be created.
|
83 kumpf 1.14 @exception InvalidLocatorException
84 @exception CannotCreateSocketException
85 @exception CannotConnectException
|
86 mday 1.4 */
|
87 kumpf 1.7 inline HTTPConnection* connect(
|
88 kumpf 1.16 const String& host,
89 const Uint32 portNumber,
|
90 kumpf 1.7 MessageQueue* outputMessageQueue)
91 {
|
92 kumpf 1.16 return connect(host, portNumber, NULL, outputMessageQueue);
|
93 kumpf 1.7 }
94
95 /** Establishes a new connection and creates an HTTPConnection object
96 to represent it.
97
|
98 kumpf 1.16 @param host indicates host to connect to
99 @param portNumber indicates port number to use
|
100 kumpf 1.7 @param sslContext Specifies the SSL context to use for this connection
101 @param outputMessageQueue output message queue for the HTTPConnection
102 that will be created.
|
103 kumpf 1.14 @exception InvalidLocatorException
104 @exception CannotCreateSocketException
105 @exception CannotConnectException
|
106 kumpf 1.7 */
|
107 mday 1.4 HTTPConnection* connect(
|
108 kumpf 1.16 const String& host,
109 const Uint32 portNumber,
|
110 kumpf 1.7 SSLContext * sslContext,
|
111 mday 1.4 MessageQueue* outputMessageQueue);
|
112 mike 1.2
|
113 mday 1.4 /** Destroys all the connections created by this connector. */
114 void destroyConnections();
|
115 mike 1.2
|
116 kumpf 1.5 /** Close the specified connection. */
117 void disconnect(HTTPConnection* connection);
118
|
119 mday 1.4 private:
|
120 mike 1.2
|
121 kumpf 1.6 /** Delete the specified connection. */
122 void _deleteConnection(HTTPConnection* httpConnection);
123
|
124 mday 1.4 Monitor* _monitor;
125 HTTPConnectorRep* _rep;
|
126 mike 1.2
|
127 mday 1.4 SSLContext * _sslcontext;
|
128 mday 1.12 int _entry_index;
129
|
130 mike 1.2 };
131
132 PEGASUS_NAMESPACE_END
133
134 #endif /* Pegasus_HTTPConnector_h */
|