Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / HTTP_Client.h
blobe0a1ee6a6f694903266e7a4cb3821958be3c59f2
2 /* -*- C++ -*- */
4 //=============================================================================
5 /**
6 * @file HTTP_Client.h
8 * This is the HTTP_Client class, which is the API for doing file
9 * uploads/downloads.
11 * @author Stoyan Paunov
13 //=============================================================================
16 #ifndef TAO_HTTP_CLIENT_H
17 #define TAO_HTTP_CLIENT_H
19 #include /**/ "tao/TAO_Export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "tao/orbconf.h"
27 #if (TAO_HAS_HTTP_PARSER == 1)
29 #include "ace/INET_Addr.h"
30 #include "ace/Svc_Handler.h"
31 #include "ace/SOCK_Connector.h"
32 #include "ace/Connector.h"
33 #include "ace/Message_Block.h"
34 #include "tao/HTTP_Handler.h"
36 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
38 /**
39 * @class TAO_HTTP_Client
41 * @brief HTTP_Client is intended to provide application API to
42 * classes that wish to do network i/o at a very
43 * high level of abstraction.
45 * This class provides the ability to retrieve data from
46 * the network, of specified length and offset, and potentially
47 * use any protocol "under the hood" to do so. It currently
48 * uses HTTP. See HTTP_Handler also.
50 class TAO_Export TAO_HTTP_Client
52 public:
53 TAO_HTTP_Client ();
54 ~TAO_HTTP_Client ();
56 /// Initializes the class with the given filename, hostname and port.
57 /// it should be called with the filename, before any read/write calls
58 int open (const ACE_TCHAR *filename,
59 const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST,
60 u_short port = 80);
62 /// Starts a connection, and reads a file from the server into
63 /// Message_Block mb
64 int read (ACE_Message_Block *mb);
66 /// Frees memory allocated for filename.
67 int close ();
69 private:
70 /// Store the internet address of the server
71 ACE_INET_Addr inet_addr_;
73 /// The filename
74 ACE_TCHAR *filename_;
76 /// The connector endpoint to initiate the client connection
77 ACE_Connector<TAO_HTTP_Handler, ACE_SOCK_CONNECTOR> connector_;
80 TAO_END_VERSIONED_NAMESPACE_DECL
82 #endif /* TAO_HAS_HTTP_PARSER == 1 */
84 #endif /* TAO_HTTP_CLIENT_H */