HTTP_Client.h

Go to the documentation of this file.
00001 
00002 /* -*- C++ -*- */
00003 
00004 //=============================================================================
00005 /**
00006  *  @file    HTTP_Client.h
00007  *
00008  *  $Id: HTTP_Client.h 79237 2007-08-07 09:48:21Z johnnyw $
00009  *
00010  *   This is the HTTP_Client class, which is the API for doing file
00011  *   uploads/downloads.
00012  *
00013  *  @author Stoyan Paunov
00014  */
00015 //=============================================================================
00016 
00017 
00018 #ifndef TAO_HTTP_CLIENT_H
00019 #define TAO_HTTP_CLIENT_H
00020 
00021 #include /**/ "tao/TAO_Export.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #include "tao/orbconf.h"
00028 
00029 #if (TAO_HAS_HTTP_PARSER == 1)
00030 
00031 #include "ace/INET_Addr.h"
00032 #include "ace/Svc_Handler.h"
00033 #include "ace/SOCK_Connector.h"
00034 #include "ace/Connector.h"
00035 #include "ace/Message_Block.h"
00036 #include "tao/HTTP_Handler.h"
00037 
00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00039 
00040 /**
00041  * @class TAO_HTTP_Client
00042  *
00043  * @brief HTTP_Client is intended to provide application API to
00044  * classes that wish to do network i/o at a very
00045  * high level of abstraction.
00046  *
00047  * This class provides the ability to retrieve data from
00048  * the network, of specified length and offset, and potentially
00049  * use any protocol "under the hood" to do so. It currently
00050  * uses HTTP. See HTTP_Handler also.
00051  */
00052 class TAO_Export TAO_HTTP_Client
00053 {
00054 public:
00055   TAO_HTTP_Client (void);
00056   ~TAO_HTTP_Client (void);
00057 
00058   /// Initializes the class with the given filename, hostname and port.
00059   /// it should be called with the filename, before any read/write calls
00060   int open (const ACE_TCHAR *filename,
00061             const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST,
00062             u_short port = 80);
00063 
00064   /// Starts a connection, and reads a file from the server into
00065   /// Message_Block mb
00066   int read (ACE_Message_Block *mb);
00067 
00068   /// Frees memory allocated for filename.
00069   int close ();
00070 
00071 private:
00072   /// Store the internet address of the server
00073   ACE_INET_Addr inet_addr_;
00074 
00075   /// The filename
00076   ACE_TCHAR *filename_;
00077 
00078   /// The connector endpoint to initiate the client connection
00079   ACE_Connector<TAO_HTTP_Handler, ACE_SOCK_CONNECTOR> connector_;
00080 
00081 };
00082 
00083 TAO_END_VERSIONED_NAMESPACE_DECL
00084 
00085 #endif /* TAO_HAS_HTTP_PARSER == 1 */
00086 
00087 #endif /* TAO_HTTP_CLIENT_H */

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7