3 //=============================================================================
7 * ACE_Blob_Handler is a base class for ACE_Blob_Reader and
8 * ACE_Blob_Writer which are created in response to calls to
9 * read/write, as appropriate
11 * @author Prashant Jain and Sumedh Mungee
13 //=============================================================================
16 #ifndef ACE_BLOB_HANDLER_H
17 #define ACE_BLOB_HANDLER_H
19 #include "ace/config-all.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/SOCK_Stream.h"
26 #include "ace/Svc_Handler.h"
27 #include "ace/Message_Block.h"
30 * @class ACE_Blob_Handler
32 * @brief Blob is intended to provide application API to
33 * classes that wish to do network i/o at a very
34 * high level of abstraction.
35 * = This class provides the ability to retrieve data from
36 * the network, of specified length and offset, and potentially
37 * use any protocol "under the hood" to do so. It currently
38 * uses HTTP. See Blob_Handler also.
40 class ACE_Blob_Handler
: public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_NULL_SYNCH
>
43 /// Null constructor, insures that it works properly with Connector
46 /// Always use this constructor to make Blob_Handlers
47 ACE_Blob_Handler (ACE_Message_Block
*mb
,
52 /// returns the number of bytes read/written in the last operation.
55 /// Activate this instance of the <ACE_Blob_Handler>
56 virtual int open (void * = 0);
58 /// Close down the Blob
59 virtual int close (u_long flags
= 0);
64 virtual int send_request ();
65 virtual int receive_reply ();
67 ACE_Message_Block
*mb_
;
74 MAX_HEADER_SIZE
= 2048
75 // The handler assumes that the first 2048 bytes of a server response
76 // contains the header
80 class ACE_Blob_Reader
: public ACE_Blob_Handler
83 ACE_Blob_Reader (ACE_Message_Block
*mb
,
87 const char *request_prefix
= "GET",
88 const char *request_suffix
= "HTTP/1.0\r\n\r\n");
93 const char *request_prefix_
;
94 const char *request_suffix_
;
97 class ACE_Blob_Writer
: public ACE_Blob_Handler
100 ACE_Blob_Writer (ACE_Message_Block
*mb
,
104 const char *request_prefix
= "PUT",
105 const char *request_suffix
= "HTTP/1.0\nContent-length:");
109 int receive_reply ();
110 const char *request_prefix_
;
111 const char *request_suffix_
;
114 #endif /* ACE_BLOB_HANDLER_H */