1 #include "ace/Asynch_IO.h"
3 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
4 // This only works on platforms with Asynchronous IO
6 #include "ace/Proactor.h"
7 #include "ace/Message_Block.h"
8 #include "ace/INET_Addr.h"
9 #include "ace/Asynch_IO_Impl.h"
10 #include "ace/os_include/os_errno.h"
11 #include "ace/Truncate.h"
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
16 ACE_Asynch_Result::bytes_transferred () const
18 return this->implementation ()->bytes_transferred ();
22 ACE_Asynch_Result::act () const
24 return this->implementation ()->act ();
28 ACE_Asynch_Result::success () const
30 return this->implementation ()->success ();
34 ACE_Asynch_Result::completion_key () const
36 return this->implementation ()->completion_key ();
40 ACE_Asynch_Result::error () const
42 return this->implementation ()->error ();
46 ACE_Asynch_Result::event () const
48 return this->implementation ()->event ();
52 ACE_Asynch_Result::offset () const
54 return this->implementation ()->offset ();
58 ACE_Asynch_Result::offset_high () const
60 return this->implementation ()->offset_high ();
64 ACE_Asynch_Result::priority () const
66 return this->implementation ()->priority ();
70 ACE_Asynch_Result::signal_number () const
72 return this->implementation ()->signal_number ();
75 ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl
*implementation
)
76 : implementation_ (implementation
)
80 ACE_Asynch_Result::~ACE_Asynch_Result ()
82 // Proactor deletes the implementation when the <complete> finishes.
85 ACE_Asynch_Result_Impl
*
86 ACE_Asynch_Result::implementation () const
88 return this->implementation_
;
91 // *********************************************************************
94 ACE_Asynch_Operation::open (ACE_Handler
&handler
,
96 const void *completion_key
,
97 ACE_Proactor
*proactor
)
99 return this->implementation ()->open (handler
.proxy (),
106 ACE_Asynch_Operation::cancel ()
108 if (0 == this->implementation ())
113 return this->implementation ()->cancel ();
117 ACE_Asynch_Operation::proactor () const
119 if (0 == this->implementation ())
124 return this->implementation ()->proactor ();
128 ACE_Asynch_Operation::get_proactor (ACE_Proactor
*user_proactor
,
129 ACE_Handler
&handler
) const
131 if (user_proactor
== 0)
133 // Grab the singleton proactor if <handler->proactor> is zero
134 user_proactor
= handler
.proactor ();
135 if (user_proactor
== 0)
136 user_proactor
= ACE_Proactor::instance ();
139 return user_proactor
;
142 // ************************************************************
144 ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream ()
145 : implementation_ (0)
149 ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream ()
151 // Delete the implementation.
152 delete this->implementation_
;
153 this->implementation_
= 0;
157 ACE_Asynch_Read_Stream::open (ACE_Handler
&handler
,
159 const void *completion_key
,
160 ACE_Proactor
*proactor
)
162 // Get a proactor for/from the user.
163 proactor
= this->get_proactor (proactor
, handler
);
165 // Now let us get the implementation initialized.
166 if ((this->implementation_
= proactor
->create_asynch_read_stream ()) == 0)
169 // Call the <open> method of the base class.
170 return ACE_Asynch_Operation::open (handler
,
177 ACE_Asynch_Read_Stream::read (ACE_Message_Block
&message_block
,
178 size_t bytes_to_read
,
183 if (0 == this->implementation_
)
188 return this->implementation_
->read (message_block
,
195 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
197 ACE_Asynch_Read_Stream::readv (ACE_Message_Block
&message_block
,
198 size_t bytes_to_read
,
203 if (0 == this->implementation_
)
208 return this->implementation_
->readv (message_block
,
214 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
216 ACE_Asynch_Operation_Impl
*
217 ACE_Asynch_Read_Stream::implementation () const
219 return this->implementation_
;
222 // ************************************************************
225 ACE_Asynch_Read_Stream::Result::bytes_to_read () const
227 return this->implementation ()->bytes_to_read ();
231 ACE_Asynch_Read_Stream::Result::message_block () const
233 return this->implementation ()->message_block ();
237 ACE_Asynch_Read_Stream::Result::handle () const
239 return this->implementation ()->handle ();
242 ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl
*implementation
)
243 : ACE_Asynch_Result (implementation
),
244 implementation_ (implementation
)
248 ACE_Asynch_Read_Stream::Result::~Result ()
250 // Proactor will delete the implementation after <complete> is
254 ACE_Asynch_Read_Stream_Result_Impl
*
255 ACE_Asynch_Read_Stream::Result::implementation () const
257 return this->implementation_
;
260 // ***************************************************
262 ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream ()
263 : implementation_ (0)
267 ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream ()
269 // Delete the implementation.
270 delete this->implementation_
;
271 this->implementation_
= 0;
275 ACE_Asynch_Write_Stream::open (ACE_Handler
&handler
,
277 const void *completion_key
,
278 ACE_Proactor
*proactor
)
280 // Get a proactor for/from the user.
281 proactor
= this->get_proactor (proactor
, handler
);
283 // Now let us get the implementation initialized.
284 if ((this->implementation_
= proactor
->create_asynch_write_stream ()) == 0)
287 // Call the <open> method of the base class.
288 return ACE_Asynch_Operation::open (handler
,
295 ACE_Asynch_Write_Stream::write (ACE_Message_Block
&message_block
,
296 size_t bytes_to_write
,
301 if (0 == this->implementation_
)
306 return this->implementation_
->write (message_block
,
313 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
315 ACE_Asynch_Write_Stream::writev (ACE_Message_Block
&message_block
,
316 size_t bytes_to_write
,
321 if (0 == this->implementation_
)
326 return this->implementation_
->writev (message_block
,
332 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
334 ACE_Asynch_Operation_Impl
*
335 ACE_Asynch_Write_Stream::implementation () const
337 return this->implementation_
;
340 // ************************************************************
343 ACE_Asynch_Write_Stream::Result::bytes_to_write () const
345 return this->implementation ()->bytes_to_write ();
349 ACE_Asynch_Write_Stream::Result::message_block () const
351 return this->implementation ()->message_block ();
355 ACE_Asynch_Write_Stream::Result::handle () const
357 return this->implementation ()->handle ();
360 ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl
*implementation
)
361 : ACE_Asynch_Result (implementation
),
362 implementation_ (implementation
)
366 ACE_Asynch_Write_Stream::Result::~Result ()
368 // Proactor will delte the implementation when the <complete> call
372 ACE_Asynch_Write_Stream_Result_Impl
*
373 ACE_Asynch_Write_Stream::Result::implementation () const
375 return this->implementation_
;
378 // ************************************************************
380 ACE_Asynch_Read_File::ACE_Asynch_Read_File ()
381 : implementation_ (0)
385 ACE_Asynch_Read_File::~ACE_Asynch_Read_File ()
387 // Delete the implementation.
388 delete this->implementation_
;
389 this->implementation_
= 0;
393 ACE_Asynch_Read_File::open (ACE_Handler
&handler
,
395 const void *completion_key
,
396 ACE_Proactor
*proactor
)
398 // Get a proactor for/from the user.
399 proactor
= this->get_proactor (proactor
, handler
);
401 // Now let us get the implementation initialized.
402 if ((this->implementation_
= proactor
->create_asynch_read_file ()) == 0)
405 // Call the <open> method of the base class.
406 return ACE_Asynch_Operation::open (handler
,
413 ACE_Asynch_Read_File::read (ACE_Message_Block
&message_block
,
414 size_t bytes_to_read
,
415 unsigned long offset
,
416 unsigned long offset_high
,
421 if (0 == this->implementation_
)
426 return this->implementation_
->read (message_block
,
435 #if defined (ACE_WIN32)
437 ACE_Asynch_Read_File::readv (ACE_Message_Block
&message_block
,
438 size_t bytes_to_read
,
439 unsigned long offset
,
440 unsigned long offset_high
,
445 if (0 == this->implementation_
)
450 return this->implementation_
->readv (message_block
,
458 #endif /* defined (ACE_WIN32) */
460 ACE_Asynch_Operation_Impl
*
461 ACE_Asynch_Read_File::implementation () const
463 return this->implementation_
;
466 // ************************************************************
468 ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl
*implementation
)
469 : ACE_Asynch_Read_Stream::Result (implementation
),
470 implementation_ (implementation
)
474 ACE_Asynch_Read_File::Result::~Result ()
476 // Proactor will delete the implementation when <complete> call
480 ACE_Asynch_Read_File_Result_Impl
*
481 ACE_Asynch_Read_File::Result::implementation () const
483 return this->implementation_
;
486 // ************************************************************
488 ACE_Asynch_Write_File::ACE_Asynch_Write_File ()
489 : implementation_ (0)
493 ACE_Asynch_Write_File::~ACE_Asynch_Write_File ()
495 // Delete the implementation.
496 delete this->implementation_
;
497 this->implementation_
= 0;
501 ACE_Asynch_Write_File::open (ACE_Handler
&handler
,
503 const void *completion_key
,
504 ACE_Proactor
*proactor
)
506 // Get a proactor for/from the user.
507 proactor
= this->get_proactor (proactor
, handler
);
509 // Now let us get the implementation initialized.
510 if ((this->implementation_
= proactor
->create_asynch_write_file ()) == 0)
513 // Call the <open> method of the base class.
514 return ACE_Asynch_Operation::open (handler
,
521 ACE_Asynch_Write_File::write (ACE_Message_Block
&message_block
,
522 size_t bytes_to_write
,
523 unsigned long offset
,
524 unsigned long offset_high
,
529 if (0 == this->implementation_
)
534 return this->implementation_
->write (message_block
,
543 #if defined (ACE_WIN32)
545 ACE_Asynch_Write_File::writev (ACE_Message_Block
&message_block
,
546 size_t bytes_to_write
,
547 unsigned long offset
,
548 unsigned long offset_high
,
553 if (0 == this->implementation_
)
558 return this->implementation_
->writev (message_block
,
566 #endif /* defined (ACE_WIN32) */
568 ACE_Asynch_Operation_Impl
*
569 ACE_Asynch_Write_File::implementation () const
571 return this->implementation_
;
574 // ************************************************************
576 ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl
*implementation
)
577 : ACE_Asynch_Write_Stream::Result (implementation
),
578 implementation_ (implementation
)
582 ACE_Asynch_Write_File::Result::~Result ()
584 // Proactor will delete the implementation when the <complete> call
588 ACE_Asynch_Write_File_Result_Impl
*
589 ACE_Asynch_Write_File::Result::implementation () const
591 return this->implementation_
;
594 // *********************************************************************
596 ACE_Asynch_Accept::ACE_Asynch_Accept ()
597 : implementation_ (0)
601 ACE_Asynch_Accept::~ACE_Asynch_Accept ()
603 // Delete the implementation.
604 delete this->implementation_
;
605 this->implementation_
= 0;
609 ACE_Asynch_Accept::open (ACE_Handler
&handler
,
611 const void *completion_key
,
612 ACE_Proactor
*proactor
)
614 // Get a proactor for/from the user.
615 proactor
= this->get_proactor (proactor
, handler
);
617 // Now let us get the implementation initialized.
618 if ((this->implementation_
= proactor
->create_asynch_accept ()) == 0)
621 // Call the <open> method of the base class.
622 return ACE_Asynch_Operation::open (handler
,
629 ACE_Asynch_Accept::accept (ACE_Message_Block
&message_block
,
630 size_t bytes_to_read
,
631 ACE_HANDLE accept_handle
,
637 if (0 == this->implementation_
)
642 return this->implementation_
->accept (message_block
,
651 ACE_Asynch_Operation_Impl
*
652 ACE_Asynch_Accept::implementation () const
654 return this->implementation_
;
657 // ************************************************************
660 ACE_Asynch_Accept::Result::bytes_to_read () const
662 return this->implementation ()->bytes_to_read ();
666 ACE_Asynch_Accept::Result::message_block () const
668 return this->implementation ()->message_block ();
672 ACE_Asynch_Accept::Result::listen_handle () const
674 return this->implementation ()->listen_handle ();
678 ACE_Asynch_Accept::Result::accept_handle () const
680 return this->implementation ()->accept_handle ();
683 ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl
*implementation
)
684 : ACE_Asynch_Result (implementation
),
685 implementation_ (implementation
)
689 ACE_Asynch_Accept::Result::~Result ()
691 // Proactor will delete the implementation when the <complete> call
695 ACE_Asynch_Accept_Result_Impl
*
696 ACE_Asynch_Accept::Result::implementation () const
698 return this->implementation_
;
702 // *********************************************************************
704 ACE_Asynch_Connect::ACE_Asynch_Connect ()
705 : implementation_ (0)
709 ACE_Asynch_Connect::~ACE_Asynch_Connect ()
711 // Delete the implementation.
712 delete this->implementation_
;
713 this->implementation_
= 0;
717 ACE_Asynch_Connect::open (ACE_Handler
&handler
,
719 const void *completion_key
,
720 ACE_Proactor
*proactor
)
722 // Get a proactor for/from the user.
723 proactor
= this->get_proactor (proactor
, handler
);
725 // Now let us get the implementation initialized.
726 if ((this->implementation_
= proactor
->create_asynch_connect ()) == 0)
729 // Call the <open> method of the base class.
730 return ACE_Asynch_Operation::open (handler
,
737 ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle
,
738 const ACE_Addr
& remote_sap
,
739 const ACE_Addr
& local_sap
,
745 if (0 == this->implementation_
)
750 return this->implementation_
->connect (connect_handle
,
759 ACE_Asynch_Operation_Impl
*
760 ACE_Asynch_Connect::implementation () const
762 return this->implementation_
;
765 // ************************************************************
767 ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl
*implementation
)
768 : ACE_Asynch_Result (implementation
),
769 implementation_ (implementation
)
773 ACE_Asynch_Connect::Result::~Result ()
775 // Proactor will delete the implementation when the <complete> call
780 ACE_Asynch_Connect::Result::connect_handle () const
782 return this->implementation ()->connect_handle ();
786 ACE_Asynch_Connect_Result_Impl
*
787 ACE_Asynch_Connect::Result::implementation () const
789 return this->implementation_
;
792 // ************************************************************
794 ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File ()
795 : implementation_ (0)
799 ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File ()
801 // Delete the implementation.
802 delete this->implementation_
;
803 this->implementation_
= 0;
807 ACE_Asynch_Transmit_File::open (ACE_Handler
&handler
,
809 const void *completion_key
,
810 ACE_Proactor
*proactor
)
812 // Get a proactor for/from the user.
813 proactor
= this->get_proactor (proactor
, handler
);
815 // Now let us get the implementation initialized.
816 if ((this->implementation_
= proactor
->create_asynch_transmit_file ()) == 0)
819 // Call the <open> method of the base class.
820 return ACE_Asynch_Operation::open (handler
,
827 ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file
,
828 Header_And_Trailer
*header_and_trailer
,
829 size_t bytes_to_write
,
830 unsigned long offset
,
831 unsigned long offset_high
,
832 size_t bytes_per_send
,
838 if (0 == this->implementation_
)
843 return this->implementation_
->transmit_file (file
,
855 ACE_Asynch_Operation_Impl
*
856 ACE_Asynch_Transmit_File::implementation () const
858 return this->implementation_
;
861 // ****************************************************************************
864 ACE_Asynch_Transmit_File::Result::socket () const
866 return this->implementation ()->socket ();
870 ACE_Asynch_Transmit_File::Result::file () const
872 return this->implementation ()->file ();
875 ACE_Asynch_Transmit_File::Header_And_Trailer
*
876 ACE_Asynch_Transmit_File::Result::header_and_trailer () const
878 return this->implementation ()->header_and_trailer ();
882 ACE_Asynch_Transmit_File::Result::bytes_to_write () const
884 return this->implementation ()->bytes_to_write ();
888 ACE_Asynch_Transmit_File::Result::bytes_per_send () const
890 return this->implementation ()->bytes_per_send ();
894 ACE_Asynch_Transmit_File::Result::flags () const
896 return this->implementation ()->flags ();
899 ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl
*implementation
)
900 : ACE_Asynch_Result (implementation
),
901 implementation_ (implementation
)
905 ACE_Asynch_Transmit_File::Result::~Result ()
909 ACE_Asynch_Transmit_File_Result_Impl
*
910 ACE_Asynch_Transmit_File::Result::implementation () const
912 return this->implementation_
;
915 // ************************************************************
917 ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block
*header
,
919 ACE_Message_Block
*trailer
,
920 size_t trailer_bytes
)
922 header_bytes_ (header_bytes
),
924 trailer_bytes_ (trailer_bytes
)
928 ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer ()
933 ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block
*header
,
935 ACE_Message_Block
*trailer
,
936 size_t trailer_bytes
)
938 this->header (header
);
939 this->header_bytes (header_bytes
);
940 this->trailer (trailer
);
941 this->trailer_bytes (trailer_bytes
);
945 ACE_Asynch_Transmit_File::Header_And_Trailer::header () const
947 return this->header_
;
951 ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block
*message_block
)
953 this->header_
= message_block
;
957 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes () const
959 return this->header_bytes_
;
963 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes
)
965 this->header_bytes_
= bytes
;
969 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer () const
971 return this->trailer_
;
975 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block
*message_block
)
977 this->trailer_
= message_block
;
981 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes () const
983 return this->trailer_bytes_
;
987 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes
)
989 this->trailer_bytes_
= bytes
;
992 ACE_LPTRANSMIT_FILE_BUFFERS
993 ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers ()
995 // If both are zero, return zero
996 if (this->header_
== 0 && this->trailer_
== 0)
1002 // Something is valid
1004 // If header is valid, set the fields
1005 if (this->header_
!= 0)
1007 this->transmit_buffers_
.Head
= this->header_
->rd_ptr ();
1008 #if defined (ACE_WIN64) || defined (ACE_WIN32)
1009 this->transmit_buffers_
.HeadLength
=
1010 ACE_Utils::truncate_cast
<DWORD
> (this->header_bytes_
);
1012 this->transmit_buffers_
.HeadLength
= this->header_bytes_
;
1013 #endif /* ACE_WIN64 || ACE_WIN32 */
1017 this->transmit_buffers_
.Head
= 0;
1018 this->transmit_buffers_
.HeadLength
= 0;
1021 // If trailer is valid, set the fields
1022 if (this->trailer_
!= 0)
1024 this->transmit_buffers_
.Tail
= this->trailer_
->rd_ptr ();
1025 #if defined(ACE_WIN64) || defined (ACE_WIN32)
1026 this->transmit_buffers_
.TailLength
=
1027 ACE_Utils::truncate_cast
<DWORD
> (this->trailer_bytes_
);
1029 this->transmit_buffers_
.TailLength
= this->trailer_bytes_
;
1030 #endif /* ACE_WIN64 || ACE_WIN32 */
1034 this->transmit_buffers_
.Tail
= 0;
1035 this->transmit_buffers_
.TailLength
= 0;
1038 // Return the transmit buffers
1039 return &this->transmit_buffers_
;
1043 // *********************************************************************
1045 ACE_Handler::ACE_Handler ()
1046 : proactor_ (0), handle_ (ACE_INVALID_HANDLE
)
1048 ACE_Handler::Proxy
*p
;
1049 ACE_NEW (p
, ACE_Handler::Proxy (this));
1050 this->proxy_
.reset (p
);
1053 ACE_Handler::ACE_Handler (ACE_Proactor
*d
)
1054 : proactor_ (d
), handle_ (ACE_INVALID_HANDLE
)
1056 ACE_Handler::Proxy
*p
;
1057 ACE_NEW (p
, ACE_Handler::Proxy (this));
1058 this->proxy_
.reset (p
);
1061 ACE_Handler::~ACE_Handler ()
1063 ACE_Handler::Proxy
*p
= this->proxy_
.get ();
1069 ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result
& /* result */)
1074 ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result
& /* result */)
1079 ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result
& /* result */)
1084 ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result
& /* result */)
1089 ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result
& /* result */)
1094 ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result
& /* result */)
1099 ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result
& /* result */)
1104 ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result
& /* result */)
1109 ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result
& /* result */)
1114 ACE_Handler::handle_time_out (const ACE_Time_Value
& /* tv */,
1115 const void * /* act */)
1120 ACE_Handler::handle_wakeup ()
1125 ACE_Handler::proactor ()
1127 return this->proactor_
;
1131 ACE_Handler::proactor (ACE_Proactor
*p
)
1133 this->proactor_
= p
;
1137 ACE_Handler::handle () const
1139 return this->handle_
;
1143 ACE_Handler::handle (ACE_HANDLE h
)
1148 ACE_Refcounted_Auto_Ptr
<ACE_Handler::Proxy
, ACE_SYNCH_MUTEX
> &
1149 ACE_Handler::proxy ()
1151 return this->proxy_
;
1154 // ************************************************************
1156 ACE_Service_Handler::ACE_Service_Handler ()
1160 ACE_Service_Handler::~ACE_Service_Handler ()
1165 ACE_Service_Handler::addresses (const ACE_INET_Addr
& /* remote_address */,
1166 const ACE_INET_Addr
& /* local_address */ )
1171 ACE_Service_Handler::act (const void *)
1176 ACE_Service_Handler::open (ACE_HANDLE
,
1177 ACE_Message_Block
&)
1182 // ************************************************************
1184 ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram ()
1185 : implementation_ (0)
1189 ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram ()
1191 // Delete the implementation.
1192 delete this->implementation_
;
1193 this->implementation_
= 0;
1197 ACE_Asynch_Read_Dgram::open (ACE_Handler
&handler
,
1199 const void *completion_key
,
1200 ACE_Proactor
*proactor
)
1202 // Get a proactor for/from the user.
1203 proactor
= this->get_proactor (proactor
, handler
);
1205 // Now let us get the implementation initialized.
1206 if ((this->implementation_
= proactor
->create_asynch_read_dgram ()) == 0)
1209 // Call the <open> method of the base class.
1210 return ACE_Asynch_Operation::open (handler
,
1217 ACE_Asynch_Read_Dgram::recv (ACE_Message_Block
*message_block
,
1218 size_t &number_of_bytes_recvd
,
1220 int protocol_family
,
1225 if (0 == this->implementation_
)
1230 return this->implementation_
->recv (message_block
,
1231 number_of_bytes_recvd
,
1239 ACE_Asynch_Operation_Impl
*
1240 ACE_Asynch_Read_Dgram::implementation () const
1242 return this->implementation_
;
1245 // ************************************************************
1248 ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr
& addr
) const
1250 return this->implementation ()->remote_address (addr
);
1254 ACE_Asynch_Read_Dgram::Result::message_block () const
1256 return this->implementation ()->message_block ();
1260 ACE_Asynch_Read_Dgram::Result::flags () const
1262 return this->implementation ()->flags ();
1266 ACE_Asynch_Read_Dgram::Result::bytes_to_read () const
1268 return this->implementation ()->bytes_to_read ();
1272 ACE_Asynch_Read_Dgram::Result::handle () const
1274 return this->implementation ()->handle();
1277 ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl
*implementation
)
1278 : ACE_Asynch_Result (implementation
),
1279 implementation_ (implementation
)
1283 ACE_Asynch_Read_Dgram::Result::~Result ()
1287 ACE_Asynch_Read_Dgram_Result_Impl
*
1288 ACE_Asynch_Read_Dgram::Result::implementation () const
1290 return this->implementation_
;
1293 // ************************************************************
1296 ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram ()
1297 : implementation_ (0)
1301 ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram ()
1303 // Delete the implementation.
1304 delete this->implementation_
;
1305 this->implementation_
= 0;
1309 ACE_Asynch_Write_Dgram::open (ACE_Handler
&handler
,
1311 const void *completion_key
,
1312 ACE_Proactor
*proactor
)
1314 // Get a proactor for/from the user.
1315 proactor
= this->get_proactor (proactor
, handler
);
1317 // Now let us get the implementation initialized.
1318 if ((this->implementation_
= proactor
->create_asynch_write_dgram ()) == 0)
1321 // Call the <open> method of the base class.
1322 return ACE_Asynch_Operation::open (handler
,
1329 ACE_Asynch_Write_Dgram::send (ACE_Message_Block
*message_block
,
1330 size_t &number_of_bytes_sent
,
1332 const ACE_Addr
& remote_addr
,
1337 if (0 == this->implementation_
)
1342 return this->implementation_
->send (message_block
,
1343 number_of_bytes_sent
,
1351 ACE_Asynch_Operation_Impl
*
1352 ACE_Asynch_Write_Dgram::implementation () const
1354 return this->implementation_
;
1357 // ************************************************************
1360 ACE_Asynch_Write_Dgram::Result::bytes_to_write () const
1362 return this->implementation ()->bytes_to_write ();
1366 ACE_Asynch_Write_Dgram::Result::message_block () const
1368 return this->implementation ()->message_block ();
1372 ACE_Asynch_Write_Dgram::Result::flags () const
1374 return this->implementation ()->flags ();
1378 ACE_Asynch_Write_Dgram::Result::handle () const
1380 return this->implementation ()->handle ();
1383 ACE_Asynch_Write_Dgram_Result_Impl
*
1384 ACE_Asynch_Write_Dgram::Result::implementation () const
1386 return this->implementation_
;
1389 ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl
*implementation
)
1390 : ACE_Asynch_Result (implementation
),
1391 implementation_ (implementation
)
1395 ACE_Asynch_Write_Dgram::Result::~Result ()
1399 ACE_END_VERSIONED_NAMESPACE_DECL
1401 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */