1 // $Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $
3 #include "ace/Asynch_IO.h"
5 ACE_RCSID(ace
, Asynch_IO
, "$Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $")
7 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
8 // This only works on platforms with Asynchronous IO
10 #include "ace/Proactor.h"
11 #include "ace/Message_Block.h"
12 #include "ace/INET_Addr.h"
13 #include "ace/Asynch_IO_Impl.h"
14 #include "ace/os_include/os_errno.h"
15 #include "ace/Truncate.h"
17 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
20 ACE_Asynch_Result::bytes_transferred (void) const
22 return this->implementation ()->bytes_transferred ();
26 ACE_Asynch_Result::act (void) const
28 return this->implementation ()->act ();
32 ACE_Asynch_Result::success (void) const
34 return this->implementation ()->success ();
38 ACE_Asynch_Result::completion_key (void) const
40 return this->implementation ()->completion_key ();
44 ACE_Asynch_Result::error (void) const
46 return this->implementation ()->error ();
50 ACE_Asynch_Result::event (void) const
52 return this->implementation ()->event ();
56 ACE_Asynch_Result::offset (void) const
58 return this->implementation ()->offset ();
62 ACE_Asynch_Result::offset_high (void) const
64 return this->implementation ()->offset_high ();
68 ACE_Asynch_Result::priority (void) const
70 return this->implementation ()->priority ();
74 ACE_Asynch_Result::signal_number (void) const
76 return this->implementation ()->signal_number ();
79 ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl
*implementation
)
80 : implementation_ (implementation
)
84 ACE_Asynch_Result::~ACE_Asynch_Result (void)
86 // Proactor deletes the implementation when the <complete> finishes.
89 ACE_Asynch_Result_Impl
*
90 ACE_Asynch_Result::implementation (void) const
92 return this->implementation_
;
95 // *********************************************************************
98 ACE_Asynch_Operation::open (ACE_Handler
&handler
,
100 const void *completion_key
,
101 ACE_Proactor
*proactor
)
103 return this->implementation ()->open (handler
.proxy (),
110 ACE_Asynch_Operation::cancel (void)
112 if (0 == this->implementation ())
117 return this->implementation ()->cancel ();
121 ACE_Asynch_Operation::proactor (void) const
123 if (0 == this->implementation ())
128 return this->implementation ()->proactor ();
131 ACE_Asynch_Operation::ACE_Asynch_Operation (void)
135 ACE_Asynch_Operation::~ACE_Asynch_Operation (void)
140 ACE_Asynch_Operation::get_proactor (ACE_Proactor
*user_proactor
,
141 ACE_Handler
&handler
) const
143 if (user_proactor
== 0)
145 // Grab the singleton proactor if <handler->proactor> is zero
146 user_proactor
= handler
.proactor ();
147 if (user_proactor
== 0)
148 user_proactor
= ACE_Proactor::instance ();
151 return user_proactor
;
154 // ************************************************************
156 ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void)
157 : implementation_ (0)
161 ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void)
163 // Delete the implementation.
164 delete this->implementation_
;
165 this->implementation_
= 0;
169 ACE_Asynch_Read_Stream::open (ACE_Handler
&handler
,
171 const void *completion_key
,
172 ACE_Proactor
*proactor
)
174 // Get a proactor for/from the user.
175 proactor
= this->get_proactor (proactor
, handler
);
177 // Now let us get the implementation initialized.
178 if ((this->implementation_
= proactor
->create_asynch_read_stream ()) == 0)
181 // Call the <open> method of the base class.
182 return ACE_Asynch_Operation::open (handler
,
189 ACE_Asynch_Read_Stream::read (ACE_Message_Block
&message_block
,
190 size_t bytes_to_read
,
195 if (0 == this->implementation_
)
200 return this->implementation_
->read (message_block
,
207 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
209 ACE_Asynch_Read_Stream::readv (ACE_Message_Block
&message_block
,
210 size_t bytes_to_read
,
215 if (0 == this->implementation_
)
220 return this->implementation_
->readv (message_block
,
226 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
228 ACE_Asynch_Operation_Impl
*
229 ACE_Asynch_Read_Stream::implementation (void) const
231 return this->implementation_
;
234 // ************************************************************
237 ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const
239 return this->implementation ()->bytes_to_read ();
243 ACE_Asynch_Read_Stream::Result::message_block (void) const
245 return this->implementation ()->message_block ();
249 ACE_Asynch_Read_Stream::Result::handle (void) const
251 return this->implementation ()->handle ();
254 ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl
*implementation
)
255 : ACE_Asynch_Result (implementation
),
256 implementation_ (implementation
)
260 ACE_Asynch_Read_Stream::Result::~Result (void)
262 // Proactor will delete the implementation after <complete> is
266 ACE_Asynch_Read_Stream_Result_Impl
*
267 ACE_Asynch_Read_Stream::Result::implementation (void) const
269 return this->implementation_
;
272 // ***************************************************
274 ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void)
275 : implementation_ (0)
279 ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void)
281 // Delete the implementation.
282 delete this->implementation_
;
283 this->implementation_
= 0;
287 ACE_Asynch_Write_Stream::open (ACE_Handler
&handler
,
289 const void *completion_key
,
290 ACE_Proactor
*proactor
)
292 // Get a proactor for/from the user.
293 proactor
= this->get_proactor (proactor
, handler
);
295 // Now let us get the implementation initialized.
296 if ((this->implementation_
= proactor
->create_asynch_write_stream ()) == 0)
299 // Call the <open> method of the base class.
300 return ACE_Asynch_Operation::open (handler
,
307 ACE_Asynch_Write_Stream::write (ACE_Message_Block
&message_block
,
308 size_t bytes_to_write
,
313 if (0 == this->implementation_
)
318 return this->implementation_
->write (message_block
,
325 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
327 ACE_Asynch_Write_Stream::writev (ACE_Message_Block
&message_block
,
328 size_t bytes_to_write
,
333 if (0 == this->implementation_
)
338 return this->implementation_
->writev (message_block
,
344 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
346 ACE_Asynch_Operation_Impl
*
347 ACE_Asynch_Write_Stream::implementation (void) const
349 return this->implementation_
;
352 // ************************************************************
355 ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const
357 return this->implementation ()->bytes_to_write ();
361 ACE_Asynch_Write_Stream::Result::message_block (void) const
363 return this->implementation ()->message_block ();
367 ACE_Asynch_Write_Stream::Result::handle (void) const
369 return this->implementation ()->handle ();
372 ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl
*implementation
)
373 : ACE_Asynch_Result (implementation
),
374 implementation_ (implementation
)
378 ACE_Asynch_Write_Stream::Result::~Result (void)
380 // Proactor will delte the implementation when the <complete> call
384 ACE_Asynch_Write_Stream_Result_Impl
*
385 ACE_Asynch_Write_Stream::Result::implementation (void) const
387 return this->implementation_
;
390 // ************************************************************
392 ACE_Asynch_Read_File::ACE_Asynch_Read_File (void)
393 : implementation_ (0)
397 ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void)
399 // Delete the implementation.
400 delete this->implementation_
;
401 this->implementation_
= 0;
405 ACE_Asynch_Read_File::open (ACE_Handler
&handler
,
407 const void *completion_key
,
408 ACE_Proactor
*proactor
)
410 // Get a proactor for/from the user.
411 proactor
= this->get_proactor (proactor
, handler
);
413 // Now let us get the implementation initialized.
414 if ((this->implementation_
= proactor
->create_asynch_read_file ()) == 0)
417 // Call the <open> method of the base class.
418 return ACE_Asynch_Operation::open (handler
,
425 ACE_Asynch_Read_File::read (ACE_Message_Block
&message_block
,
426 size_t bytes_to_read
,
427 unsigned long offset
,
428 unsigned long offset_high
,
433 if (0 == this->implementation_
)
438 return this->implementation_
->read (message_block
,
447 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
449 ACE_Asynch_Read_File::readv (ACE_Message_Block
&message_block
,
450 size_t bytes_to_read
,
451 unsigned long offset
,
452 unsigned long offset_high
,
457 if (0 == this->implementation_
)
462 return this->implementation_
->readv (message_block
,
470 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
472 ACE_Asynch_Operation_Impl
*
473 ACE_Asynch_Read_File::implementation (void) const
475 return this->implementation_
;
478 // ************************************************************
480 ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl
*implementation
)
481 : ACE_Asynch_Read_Stream::Result (implementation
),
482 implementation_ (implementation
)
486 ACE_Asynch_Read_File::Result::~Result (void)
488 // Proactor will delete the implementation when <complete> call
492 ACE_Asynch_Read_File_Result_Impl
*
493 ACE_Asynch_Read_File::Result::implementation (void) const
495 return this->implementation_
;
498 // ************************************************************
500 ACE_Asynch_Write_File::ACE_Asynch_Write_File (void)
501 : implementation_ (0)
505 ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void)
507 // Delete the implementation.
508 delete this->implementation_
;
509 this->implementation_
= 0;
513 ACE_Asynch_Write_File::open (ACE_Handler
&handler
,
515 const void *completion_key
,
516 ACE_Proactor
*proactor
)
518 // Get a proactor for/from the user.
519 proactor
= this->get_proactor (proactor
, handler
);
521 // Now let us get the implementation initialized.
522 if ((this->implementation_
= proactor
->create_asynch_write_file ()) == 0)
525 // Call the <open> method of the base class.
526 return ACE_Asynch_Operation::open (handler
,
533 ACE_Asynch_Write_File::write (ACE_Message_Block
&message_block
,
534 size_t bytes_to_write
,
535 unsigned long offset
,
536 unsigned long offset_high
,
541 if (0 == this->implementation_
)
546 return this->implementation_
->write (message_block
,
555 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
557 ACE_Asynch_Write_File::writev (ACE_Message_Block
&message_block
,
558 size_t bytes_to_write
,
559 unsigned long offset
,
560 unsigned long offset_high
,
565 if (0 == this->implementation_
)
570 return this->implementation_
->writev (message_block
,
578 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
580 ACE_Asynch_Operation_Impl
*
581 ACE_Asynch_Write_File::implementation (void) const
583 return this->implementation_
;
586 // ************************************************************
588 ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl
*implementation
)
589 : ACE_Asynch_Write_Stream::Result (implementation
),
590 implementation_ (implementation
)
594 ACE_Asynch_Write_File::Result::~Result (void)
596 // Proactor will delete the implementation when the <complete> call
600 ACE_Asynch_Write_File_Result_Impl
*
601 ACE_Asynch_Write_File::Result::implementation (void) const
603 return this->implementation_
;
606 // *********************************************************************
608 ACE_Asynch_Accept::ACE_Asynch_Accept (void)
609 : implementation_ (0)
613 ACE_Asynch_Accept::~ACE_Asynch_Accept (void)
615 // Delete the implementation.
616 delete this->implementation_
;
617 this->implementation_
= 0;
621 ACE_Asynch_Accept::open (ACE_Handler
&handler
,
623 const void *completion_key
,
624 ACE_Proactor
*proactor
)
626 // Get a proactor for/from the user.
627 proactor
= this->get_proactor (proactor
, handler
);
629 // Now let us get the implementation initialized.
630 if ((this->implementation_
= proactor
->create_asynch_accept ()) == 0)
633 // Call the <open> method of the base class.
634 return ACE_Asynch_Operation::open (handler
,
641 ACE_Asynch_Accept::accept (ACE_Message_Block
&message_block
,
642 size_t bytes_to_read
,
643 ACE_HANDLE accept_handle
,
649 if (0 == this->implementation_
)
654 return this->implementation_
->accept (message_block
,
663 ACE_Asynch_Operation_Impl
*
664 ACE_Asynch_Accept::implementation (void) const
666 return this->implementation_
;
669 // ************************************************************
672 ACE_Asynch_Accept::Result::bytes_to_read (void) const
674 return this->implementation ()->bytes_to_read ();
678 ACE_Asynch_Accept::Result::message_block (void) const
680 return this->implementation ()->message_block ();
684 ACE_Asynch_Accept::Result::listen_handle (void) const
686 return this->implementation ()->listen_handle ();
690 ACE_Asynch_Accept::Result::accept_handle (void) const
692 return this->implementation ()->accept_handle ();
695 ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl
*implementation
)
696 : ACE_Asynch_Result (implementation
),
697 implementation_ (implementation
)
701 ACE_Asynch_Accept::Result::~Result (void)
703 // Proactor will delete the implementation when the <complete> call
707 ACE_Asynch_Accept_Result_Impl
*
708 ACE_Asynch_Accept::Result::implementation (void) const
710 return this->implementation_
;
715 // *********************************************************************
717 ACE_Asynch_Connect::ACE_Asynch_Connect (void)
718 : implementation_ (0)
722 ACE_Asynch_Connect::~ACE_Asynch_Connect (void)
724 // Delete the implementation.
725 delete this->implementation_
;
726 this->implementation_
= 0;
730 ACE_Asynch_Connect::open (ACE_Handler
&handler
,
732 const void *completion_key
,
733 ACE_Proactor
*proactor
)
735 // Get a proactor for/from the user.
736 proactor
= this->get_proactor (proactor
, handler
);
738 // Now let us get the implementation initialized.
739 if ((this->implementation_
= proactor
->create_asynch_connect ()) == 0)
742 // Call the <open> method of the base class.
743 return ACE_Asynch_Operation::open (handler
,
750 ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle
,
751 const ACE_Addr
& remote_sap
,
752 const ACE_Addr
& local_sap
,
758 if (0 == this->implementation_
)
763 return this->implementation_
->connect (connect_handle
,
772 ACE_Asynch_Operation_Impl
*
773 ACE_Asynch_Connect::implementation (void) const
775 return this->implementation_
;
778 // ************************************************************
780 ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl
*implementation
)
781 : ACE_Asynch_Result (implementation
),
782 implementation_ (implementation
)
786 ACE_Asynch_Connect::Result::~Result (void)
788 // Proactor will delete the implementation when the <complete> call
793 ACE_Asynch_Connect::Result::connect_handle (void) const
795 return this->implementation ()->connect_handle ();
799 ACE_Asynch_Connect_Result_Impl
*
800 ACE_Asynch_Connect::Result::implementation (void) const
802 return this->implementation_
;
805 // ************************************************************
807 ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void)
808 : implementation_ (0)
812 ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void)
814 // Delete the implementation.
815 delete this->implementation_
;
816 this->implementation_
= 0;
820 ACE_Asynch_Transmit_File::open (ACE_Handler
&handler
,
822 const void *completion_key
,
823 ACE_Proactor
*proactor
)
825 // Get a proactor for/from the user.
826 proactor
= this->get_proactor (proactor
, handler
);
828 // Now let us get the implementation initialized.
829 if ((this->implementation_
= proactor
->create_asynch_transmit_file ()) == 0)
832 // Call the <open> method of the base class.
833 return ACE_Asynch_Operation::open (handler
,
840 ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file
,
841 Header_And_Trailer
*header_and_trailer
,
842 size_t bytes_to_write
,
843 unsigned long offset
,
844 unsigned long offset_high
,
845 size_t bytes_per_send
,
851 if (0 == this->implementation_
)
856 return this->implementation_
->transmit_file (file
,
868 ACE_Asynch_Operation_Impl
*
869 ACE_Asynch_Transmit_File::implementation (void) const
871 return this->implementation_
;
874 // ****************************************************************************
877 ACE_Asynch_Transmit_File::Result::socket (void) const
879 return this->implementation ()->socket ();
883 ACE_Asynch_Transmit_File::Result::file (void) const
885 return this->implementation ()->file ();
888 ACE_Asynch_Transmit_File::Header_And_Trailer
*
889 ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const
891 return this->implementation ()->header_and_trailer ();
895 ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const
897 return this->implementation ()->bytes_to_write ();
901 ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const
903 return this->implementation ()->bytes_per_send ();
907 ACE_Asynch_Transmit_File::Result::flags (void) const
909 return this->implementation ()->flags ();
912 ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl
*implementation
)
913 : ACE_Asynch_Result (implementation
),
914 implementation_ (implementation
)
918 ACE_Asynch_Transmit_File::Result::~Result (void)
922 ACE_Asynch_Transmit_File_Result_Impl
*
923 ACE_Asynch_Transmit_File::Result::implementation (void) const
925 return this->implementation_
;
928 // ************************************************************
930 ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block
*header
,
932 ACE_Message_Block
*trailer
,
933 size_t trailer_bytes
)
935 header_bytes_ (header_bytes
),
937 trailer_bytes_ (trailer_bytes
)
941 ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void)
946 ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block
*header
,
948 ACE_Message_Block
*trailer
,
949 size_t trailer_bytes
)
951 this->header (header
);
952 this->header_bytes (header_bytes
);
953 this->trailer (trailer
);
954 this->trailer_bytes (trailer_bytes
);
958 ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const
960 return this->header_
;
964 ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block
*message_block
)
966 this->header_
= message_block
;
970 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const
972 return this->header_bytes_
;
976 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes
)
978 this->header_bytes_
= bytes
;
982 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const
984 return this->trailer_
;
988 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block
*message_block
)
990 this->trailer_
= message_block
;
994 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const
996 return this->trailer_bytes_
;
1000 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes
)
1002 this->trailer_bytes_
= bytes
;
1005 ACE_LPTRANSMIT_FILE_BUFFERS
1006 ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
1008 // If both are zero, return zero
1009 if (this->header_
== 0 && this->trailer_
== 0)
1015 // Something is valid
1017 // If header is valid, set the fields
1018 if (this->header_
!= 0)
1020 this->transmit_buffers_
.Head
= this->header_
->rd_ptr ();
1021 #if defined (ACE_WIN64) || defined (ACE_WIN32)
1022 this->transmit_buffers_
.HeadLength
=
1023 ACE_Utils::truncate_cast
<DWORD
> (this->header_bytes_
);
1025 this->transmit_buffers_
.HeadLength
= this->header_bytes_
;
1026 #endif /* ACE_WIN64 || ACE_WIN32 */
1030 this->transmit_buffers_
.Head
= 0;
1031 this->transmit_buffers_
.HeadLength
= 0;
1034 // If trailer is valid, set the fields
1035 if (this->trailer_
!= 0)
1037 this->transmit_buffers_
.Tail
= this->trailer_
->rd_ptr ();
1038 #if defined(ACE_WIN64) || defined (ACE_WIN32)
1039 this->transmit_buffers_
.TailLength
=
1040 ACE_Utils::truncate_cast
<DWORD
> (this->trailer_bytes_
);
1042 this->transmit_buffers_
.TailLength
= this->trailer_bytes_
;
1043 #endif /* ACE_WIN64 || ACE_WIN32 */
1047 this->transmit_buffers_
.Tail
= 0;
1048 this->transmit_buffers_
.TailLength
= 0;
1051 // Return the transmit buffers
1052 return &this->transmit_buffers_
;
1056 // *********************************************************************
1058 ACE_Handler::ACE_Handler (void)
1059 : proactor_ (0), handle_ (ACE_INVALID_HANDLE
)
1061 ACE_Handler::Proxy
*p
;
1062 ACE_NEW (p
, ACE_Handler::Proxy (this));
1063 this->proxy_
.reset (p
);
1066 ACE_Handler::ACE_Handler (ACE_Proactor
*d
)
1067 : proactor_ (d
), handle_ (ACE_INVALID_HANDLE
)
1069 ACE_Handler::Proxy
*p
;
1070 ACE_NEW (p
, ACE_Handler::Proxy (this));
1071 this->proxy_
.reset (p
);
1074 ACE_Handler::~ACE_Handler (void)
1076 ACE_Handler::Proxy
*p
= this->proxy_
.get ();
1082 ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result
& /* result */)
1087 ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result
& /* result */)
1092 ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result
& /* result */)
1097 ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result
& /* result */)
1102 ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result
& /* result */)
1107 ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result
& /* result */)
1112 ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result
& /* result */)
1117 ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result
& /* result */)
1122 ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result
& /* result */)
1127 ACE_Handler::handle_time_out (const ACE_Time_Value
& /* tv */,
1128 const void * /* act */)
1133 ACE_Handler::handle_wakeup (void)
1138 ACE_Handler::proactor (void)
1140 return this->proactor_
;
1144 ACE_Handler::proactor (ACE_Proactor
*p
)
1146 this->proactor_
= p
;
1150 ACE_Handler::handle (void) const
1152 return this->handle_
;
1156 ACE_Handler::handle (ACE_HANDLE h
)
1161 ACE_Refcounted_Auto_Ptr
<ACE_Handler::Proxy
, ACE_SYNCH_MUTEX
> &
1162 ACE_Handler::proxy (void)
1164 return this->proxy_
;
1167 // ************************************************************
1169 ACE_Service_Handler::ACE_Service_Handler (void)
1173 ACE_Service_Handler::~ACE_Service_Handler (void)
1178 ACE_Service_Handler::addresses (const ACE_INET_Addr
& /* remote_address */,
1179 const ACE_INET_Addr
& /* local_address */ )
1184 ACE_Service_Handler::act (const void *)
1189 ACE_Service_Handler::open (ACE_HANDLE
,
1190 ACE_Message_Block
&)
1195 // ************************************************************
1197 ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void)
1198 : implementation_ (0)
1202 ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void)
1204 // Delete the implementation.
1205 delete this->implementation_
;
1206 this->implementation_
= 0;
1210 ACE_Asynch_Read_Dgram::open (ACE_Handler
&handler
,
1212 const void *completion_key
,
1213 ACE_Proactor
*proactor
)
1215 // Get a proactor for/from the user.
1216 proactor
= this->get_proactor (proactor
, handler
);
1218 // Now let us get the implementation initialized.
1219 if ((this->implementation_
= proactor
->create_asynch_read_dgram ()) == 0)
1222 // Call the <open> method of the base class.
1223 return ACE_Asynch_Operation::open (handler
,
1230 ACE_Asynch_Read_Dgram::recv (ACE_Message_Block
*message_block
,
1231 size_t &number_of_bytes_recvd
,
1233 int protocol_family
,
1238 if (0 == this->implementation_
)
1243 return this->implementation_
->recv (message_block
,
1244 number_of_bytes_recvd
,
1252 ACE_Asynch_Operation_Impl
*
1253 ACE_Asynch_Read_Dgram::implementation (void) const
1255 return this->implementation_
;
1258 // ************************************************************
1261 ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr
& addr
) const
1263 return this->implementation ()->remote_address (addr
);
1267 ACE_Asynch_Read_Dgram::Result::message_block (void) const
1269 return this->implementation ()->message_block ();
1273 ACE_Asynch_Read_Dgram::Result::flags (void) const
1275 return this->implementation ()->flags ();
1279 ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const
1281 return this->implementation ()->bytes_to_read ();
1285 ACE_Asynch_Read_Dgram::Result::handle (void) const
1287 return this->implementation ()->handle();
1290 ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl
*implementation
)
1291 : ACE_Asynch_Result (implementation
),
1292 implementation_ (implementation
)
1296 ACE_Asynch_Read_Dgram::Result::~Result (void)
1300 ACE_Asynch_Read_Dgram_Result_Impl
*
1301 ACE_Asynch_Read_Dgram::Result::implementation (void) const
1303 return this->implementation_
;
1306 // ************************************************************
1309 ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void)
1310 : implementation_ (0)
1314 ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void)
1316 // Delete the implementation.
1317 delete this->implementation_
;
1318 this->implementation_
= 0;
1322 ACE_Asynch_Write_Dgram::open (ACE_Handler
&handler
,
1324 const void *completion_key
,
1325 ACE_Proactor
*proactor
)
1327 // Get a proactor for/from the user.
1328 proactor
= this->get_proactor (proactor
, handler
);
1330 // Now let us get the implementation initialized.
1331 if ((this->implementation_
= proactor
->create_asynch_write_dgram ()) == 0)
1334 // Call the <open> method of the base class.
1335 return ACE_Asynch_Operation::open (handler
,
1342 ACE_Asynch_Write_Dgram::send (ACE_Message_Block
*message_block
,
1343 size_t &number_of_bytes_sent
,
1345 const ACE_Addr
& remote_addr
,
1350 if (0 == this->implementation_
)
1355 return this->implementation_
->send (message_block
,
1356 number_of_bytes_sent
,
1364 ACE_Asynch_Operation_Impl
*
1365 ACE_Asynch_Write_Dgram::implementation (void) const
1367 return this->implementation_
;
1370 // ************************************************************
1373 ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const
1375 return this->implementation ()->bytes_to_write ();
1379 ACE_Asynch_Write_Dgram::Result::message_block () const
1381 return this->implementation ()->message_block ();
1385 ACE_Asynch_Write_Dgram::Result::flags (void) const
1387 return this->implementation ()->flags ();
1391 ACE_Asynch_Write_Dgram::Result::handle (void) const
1393 return this->implementation ()->handle ();
1396 ACE_Asynch_Write_Dgram_Result_Impl
*
1397 ACE_Asynch_Write_Dgram::Result::implementation (void) const
1399 return this->implementation_
;
1402 ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl
*implementation
)
1403 : ACE_Asynch_Result (implementation
),
1404 implementation_ (implementation
)
1408 ACE_Asynch_Write_Dgram::Result::~Result (void)
1412 ACE_END_VERSIONED_NAMESPACE_DECL
1414 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */