3 * A RecordingDevice that listens to a socket and collects text.
6 #ifndef RECORDING_DEVICE_TEXT_H
7 #define RECORDING_DEVICE_TEXT_H
9 #include "ace/FILE_IO.h"
10 #include "ace/FILE_Connector.h"
11 #include "ace/SOCK_Stream.h"
12 #include "ace/SOCK_Acceptor.h"
14 #include "CommandStream.h"
15 #include "MessageInfo.h"
16 #include "RecordingDevice.h"
18 class TextListenerAcceptor
:
19 public ACE_Event_Handler
,
20 public RecordingDevice
23 TextListenerAcceptor ();
25 // ACE_Event_Handler interface
27 int open (ACE_INET_Addr
&addr
);
29 ACE_HANDLE
get_handle () const;
31 int handle_input (ACE_HANDLE
);
33 int accept (ACE_SOCK_Stream
&peer
);
35 // RecordingDevice interface
37 // Open a listening socket on the port specified by argv.
38 int init (int argc
, ACE_TCHAR
*argv
[]);
40 ACE_Event_Handler
*get_handler () const;
42 virtual RecordingDevice
*wait_for_activity ();
44 virtual int answer_call ();
46 virtual CallerId
*retrieve_callerId ();
48 virtual int play_message (ACE_FILE_Addr
&addr
);
50 virtual MessageType
*record_message (ACE_FILE_Addr
&addr
);
53 ACE_SOCK_Acceptor acceptor_
;
56 // Listing 01 code/ch18
57 class TextListener
: public RecordingDevice
60 TextListener (TextListenerAcceptor
*acceptor
);
62 virtual const ACE_TCHAR
*get_name () const;
66 CallerId
*retrieve_callerId ();
68 int play_message (ACE_FILE_Addr
&addr
);
70 MessageType
*record_message (ACE_FILE_Addr
&addr
);
72 virtual void release ();
74 // Listing 02 code/ch18
76 CommandStream
*command_stream_
;
77 TextListenerAcceptor
*acceptor_
;
78 ACE_SOCK_Stream peer_
;
82 #endif /* RECORDING_DEVICE_TEXT_H */