version 1.1.2.1, 2001/08/17 03:06:23
|
version 1.13, 2002/07/26 20:01:19
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// The Open Group, Tivoli Systems | // The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
|
|
#define Pegasus_HTTPConnector_h | #define Pegasus_HTTPConnector_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/MessageQueue.h> |
#include <Pegasus/Common/MessageQueueService.h> |
#include <Pegasus/Common/Monitor.h> | #include <Pegasus/Common/Monitor.h> |
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
|
#include <Pegasus/Common/TLS.h> |
|
#include <Pegasus/Common/Linkage.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
struct HTTPConnectorRep; | struct HTTPConnectorRep; |
|
class HTTPConnection; |
| |
/** This class is used by clients to establish a connection with a | /** This class is used by clients to establish a connection with a |
server. For each established connection, a HTTPConnection object | server. For each established connection, a HTTPConnection object |
is created. | is created. |
*/ | */ |
class PEGASUS_COMMON_LINKAGE HTTPConnector : public MessageQueue |
class PEGASUS_COMMON_LINKAGE HTTPConnector : public MessageQueueService |
{ | { |
public: | public: |
| |
|
typedef MessageQueueService Base; |
|
|
/** Constructor. | /** Constructor. |
@param monitor pointer to monitor object which this class uses to | @param monitor pointer to monitor object which this class uses to |
solicit SocketMessages on the server port (socket). | solicit SocketMessages on the server port (socket). |
|
|
*/ | */ |
HTTPConnector(Monitor* monitor); | HTTPConnector(Monitor* monitor); |
| |
|
HTTPConnector(Monitor* monitor, SSLContext * sslcontext); |
|
|
/** Destructor. */ | /** Destructor. */ |
~HTTPConnector(); | ~HTTPConnector(); |
| |
/** This method is called whenever a SocketMessage is enqueued | /** This method is called whenever a SocketMessage is enqueued |
on the input queue of the HTTPConnector object. | on the input queue of the HTTPConnector object. |
*/ | */ |
|
|
|
virtual void handleEnqueue(Message *); |
virtual void handleEnqueue(); | virtual void handleEnqueue(); |
| |
/** Establishes a new connection and creates an HTTPConnection object | /** Establishes a new connection and creates an HTTPConnection object |
|
|
@exception CannotConnect | @exception CannotConnect |
@exception UnexpectedFailure | @exception UnexpectedFailure |
*/ | */ |
void connect(const String& locator, MessageQueue* outputMessageQueue); |
inline HTTPConnection* connect( |
|
const String& locator, |
|
MessageQueue* outputMessageQueue) |
|
{ |
|
return connect(locator, NULL, outputMessageQueue); |
|
} |
|
|
|
/** Establishes a new connection and creates an HTTPConnection object |
|
to represent it. |
|
|
|
@param locator indicates which server to connect to (of the form |
|
host:port). |
|
@param sslContext Specifies the SSL context to use for this connection |
|
@param outputMessageQueue output message queue for the HTTPConnection |
|
that will be created. |
|
@exception InvalidLocator |
|
@exception CannotCreateSocket |
|
@exception CannotConnect |
|
@exception UnexpectedFailure |
|
*/ |
|
HTTPConnection* connect( |
|
const String& locator, |
|
SSLContext * sslContext, |
|
MessageQueue* outputMessageQueue); |
| |
/** Destroys all the connections created by this connector. */ | /** Destroys all the connections created by this connector. */ |
void destroyConnections(); | void destroyConnections(); |
| |
|
/** Close the specified connection. */ |
|
void disconnect(HTTPConnection* connection); |
|
|
private: | private: |
| |
|
/** Delete the specified connection. */ |
|
void _deleteConnection(HTTPConnection* httpConnection); |
|
|
Monitor* _monitor; | Monitor* _monitor; |
HTTPConnectorRep* _rep; | HTTPConnectorRep* _rep; |
|
|
|
SSLContext * _sslcontext; |
|
int _entry_index; |
|
|
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |