2
// Hey, Emacs! This is a C++ file!
3
// IO.h,v 1.10 2001/02/18 15:35:28 schmidt Exp
5
// ============================================================================
16
// ============================================================================
21
class ACE_Message_Block;
22
class JAWS_IO_Handler;
26
#if !defined (ACE_LACKS_PRAGMA_ONCE)
28
#endif /* ACE_LACKS_PRAGMA_ONCE */
30
#include "ace/Asynch_IO.h"
35
// This class defines the abstract interface for an I/O class in
36
// the context of Web-likes servers
40
// An I/O class should have the following interface. Derived
41
// classes will define the exactly how the I/O will take place
42
// (Asynchronous, Synchronous, Reactive)
46
virtual ~JAWS_IO (void);
47
void handler (JAWS_IO_Handler *handler);
49
virtual void handle (ACE_HANDLE h) = 0;
50
virtual ACE_HANDLE handle (void) const = 0;
52
// James, please add documentation here.
54
virtual void read (ACE_Message_Block& mb, int size) = 0;
55
// read from the handle size bytes into the message block.
57
virtual void transmit_file (const char *filename,
61
int trailer_size) = 0;
62
// send header, filename, trailer to the handle.
64
virtual void receive_file (const char *filename,
66
int initial_data_length,
67
int entire_length) = 0;
68
// read data from the handle and store in filename.
70
virtual void send_confirmation_message (const char *buffer, int length) = 0;
71
// send a confirmation message to the handle.
73
virtual void send_error_message (const char *buffer, int length) = 0;
74
// send an error message to the handle.
77
JAWS_IO_Handler *handler_;
83
// This class defines the abstract interface for an I/O handler class in
84
// the context of Web-likes servers
89
virtual void read_complete (ACE_Message_Block &data) = 0;
90
// This method is called by the IO class when new client data shows
93
virtual void read_error (void) = 0;
94
// This method is called by the IO class when there was an error in
95
// reading new data from the client.
97
virtual void transmit_file_complete (void) = 0;
98
// This method is called by the IO class when the requested file has
99
// been successfully transmitted to the client.
101
virtual void transmit_file_error (int result) = 0;
102
// This method is called by the IO class when there was an error in
103
// transmitting the requested file to the client.
105
virtual void receive_file_complete (void) = 0;
106
// This method is called by the IO class when the requested file has
107
// been successfully received from the client.
109
virtual void receive_file_error (int result) = 0;
110
// This method is called by the IO class when there was an error in
111
// receiving the requested file from the client.
113
virtual void write_error (void) = 0;
114
// This method is called by the IO class when there was an error in
115
// writing data to the client.
117
virtual void confirmation_message_complete (void) = 0;
118
// This method is called by the IO class when the confirmation
119
// message has been delivered to the client.
121
virtual void error_message_complete (void) = 0;
122
// This method is called by the IO class when the error message has
123
// been delivered to the client.
127
class JAWS_Synch_IO : public JAWS_IO
130
// This class defines the interface for a Synchronous I/O class.
135
JAWS_Synch_IO (void);
137
~JAWS_Synch_IO (void);
139
virtual void handle (ACE_HANDLE h);
140
virtual ACE_HANDLE handle (void) const;
142
void read (ACE_Message_Block& mb, int size);
144
void transmit_file (const char *filename,
150
void receive_file (const char *filename,
152
int initial_data_length,
155
void send_confirmation_message (const char *buffer,
158
void send_error_message (const char *buffer,
162
virtual void send_message (const char *buffer,
168
// This only works on Win32
169
#if defined (ACE_WIN32)
171
class JAWS_Asynch_IO : public JAWS_IO, public ACE_Handler
174
// This class defines the interface for a Asynchronous I/O class.
179
JAWS_Asynch_IO (void);
181
~JAWS_Asynch_IO (void);
183
virtual void handle (ACE_HANDLE h) { ACE_Handler::handle (h); };
184
virtual ACE_HANDLE handle (void) const { return ACE_Handler::handle (); };
186
void read (ACE_Message_Block& mb, int size);
188
void transmit_file (const char *filename,
194
void receive_file (const char *filename,
196
int initial_data_length,
199
void send_confirmation_message (const char *buffer,
202
void send_error_message (const char *buffer,
212
virtual void send_message (const char *buffer,
216
virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result);
217
// This method will be called when an asynchronous read completes on
220
virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result);
221
// This method will be called when an asynchronous write completes
224
virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result);
225
// This method will be called when an asynchronous transmit file
229
#endif /* ACE_WIN32 */
230
#endif /* JAWS_IO_H */