diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-11-22 10:17:27 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-11-22 10:17:27 +0000 |
commit | 8e5e515c5d0c06b9fd3e6f455d4c428c24d2e34e (patch) | |
tree | 1e3355b8e089285cc970eb8f599a74efb9872d7d /TAO/tao/HTTP_Client.h | |
parent | 69a23ed484eaf5d858c23aec6cb4f44ed1e3c708 (diff) | |
download | ATCD-8e5e515c5d0c06b9fd3e6f455d4c428c24d2e34e.tar.gz |
Wed Nov 22 09:07:12 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao/HTTP_Client.h')
-rw-r--r-- | TAO/tao/HTTP_Client.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/TAO/tao/HTTP_Client.h b/TAO/tao/HTTP_Client.h new file mode 100644 index 00000000000..9da4d9bb799 --- /dev/null +++ b/TAO/tao/HTTP_Client.h @@ -0,0 +1,72 @@ + +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file HTTP_Client.h + * + * $Id$ + * + * This is the HTTP_Client class, which is the API for doing file + * uploads/downloads. + * + * @author Stoyan Paunov + */ +//============================================================================= + + +#ifndef TAO_HTTP_CLIENT_H +#define TAO_HTTP_CLIENT_H + + +#include "ace/INET_Addr.h" +#include "ace/Svc_Handler.h" +#include "ace/SOCK_Connector.h" +#include "ace/Connector.h" +#include "ace/Message_Block.h" +#include "tao/HTTP_Handler.h" + +/** + * @class TAO_HTTP_Client + * + * @brief HTTP_Client is intended to provide application API to + * classes that wish to do network i/o at a very + * high level of abstraction. + * + * This class provides the ability to retrieve data from + * the network, of specified length and offset, and potentially + * use any protocol "under the hood" to do so. It currently + * uses HTTP. See HTTP_Handler also. + */ +class TAO_HTTP_Client +{ +public: + TAO_HTTP_Client (void); + ~TAO_HTTP_Client (void); + + /// Initializes the class with the given filename, hostname and port. + /// it should be called with the filename, before any read/write calls + int open (const ACE_TCHAR *filename, + const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST, + u_short port = 80); + + /// Starts a connection, and reads a file from the server into + /// Message_Block mb + int read (ACE_Message_Block *mb); + + /// Frees memory allocated for filename. + int close (); + +private: + /// Store the internet address of the server + ACE_INET_Addr inet_addr_; + + /// The filename + ACE_TCHAR *filename_; + + /// The connector endpoint to initiate the client connection + ACE_Connector<TAO_HTTP_Handler, ACE_SOCK_CONNECTOR> connector_; + +}; + +#endif /* TAO_HTTP_CLIENT_H */ |