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 (void) const
18 return this->implementation ()->bytes_transferred ();
22 ACE_Asynch_Result::act (void) const
24 return this->implementation ()->act ();
28 ACE_Asynch_Result::success (void) const
30 return this->implementation ()->success ();
34 ACE_Asynch_Result::completion_key (void) const
36 return this->implementation ()->completion_key ();
40 ACE_Asynch_Result::error (void) const
42 return this->implementation ()->error ();
46 ACE_Asynch_Result::event (void) const
48 return this->implementation ()->event ();
52 ACE_Asynch_Result::offset (void) const
54 return this->implementation ()->offset ();
58 ACE_Asynch_Result::offset_high (void) const
60 return this->implementation ()->offset_high ();
64 ACE_Asynch_Result::priority (void) const
66 return this->implementation ()->priority ();
70 ACE_Asynch_Result::signal_number (void) 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 (void)
82 // Proactor deletes the implementation when the <complete> finishes.
85 ACE_Asynch_Result_Impl
*
86 ACE_Asynch_Result::implementation (void) 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 (void)
108 if (0 == this->implementation ())
113 return this->implementation ()->cancel ();
117 ACE_Asynch_Operation::proactor (void) const
119 if (0 == this->implementation ())
124 return this->implementation ()->proactor ();
127 ACE_Asynch_Operation::ACE_Asynch_Operation (void)
131 ACE_Asynch_Operation::~ACE_Asynch_Operation (void)
136 ACE_Asynch_Operation::get_proactor (ACE_Proactor
*user_proactor
,
137 ACE_Handler
&handler
) const
139 if (user_proactor
== 0)
141 // Grab the singleton proactor if <handler->proactor> is zero
142 user_proactor
= handler
.proactor ();
143 if (user_proactor
== 0)
144 user_proactor
= ACE_Proactor::instance ();
147 return user_proactor
;
150 // ************************************************************
152 ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void)
153 : implementation_ (0)
157 ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void)
159 // Delete the implementation.
160 delete this->implementation_
;
161 this->implementation_
= 0;
165 ACE_Asynch_Read_Stream::open (ACE_Handler
&handler
,
167 const void *completion_key
,
168 ACE_Proactor
*proactor
)
170 // Get a proactor for/from the user.
171 proactor
= this->get_proactor (proactor
, handler
);
173 // Now let us get the implementation initialized.
174 if ((this->implementation_
= proactor
->create_asynch_read_stream ()) == 0)
177 // Call the <open> method of the base class.
178 return ACE_Asynch_Operation::open (handler
,
185 ACE_Asynch_Read_Stream::read (ACE_Message_Block
&message_block
,
186 size_t bytes_to_read
,
191 if (0 == this->implementation_
)
196 return this->implementation_
->read (message_block
,
203 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
205 ACE_Asynch_Read_Stream::readv (ACE_Message_Block
&message_block
,
206 size_t bytes_to_read
,
211 if (0 == this->implementation_
)
216 return this->implementation_
->readv (message_block
,
222 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
224 ACE_Asynch_Operation_Impl
*
225 ACE_Asynch_Read_Stream::implementation (void) const
227 return this->implementation_
;
230 // ************************************************************
233 ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const
235 return this->implementation ()->bytes_to_read ();
239 ACE_Asynch_Read_Stream::Result::message_block (void) const
241 return this->implementation ()->message_block ();
245 ACE_Asynch_Read_Stream::Result::handle (void) const
247 return this->implementation ()->handle ();
250 ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl
*implementation
)
251 : ACE_Asynch_Result (implementation
),
252 implementation_ (implementation
)
256 ACE_Asynch_Read_Stream::Result::~Result (void)
258 // Proactor will delete the implementation after <complete> is
262 ACE_Asynch_Read_Stream_Result_Impl
*
263 ACE_Asynch_Read_Stream::Result::implementation (void) const
265 return this->implementation_
;
268 // ***************************************************
270 ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void)
271 : implementation_ (0)
275 ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void)
277 // Delete the implementation.
278 delete this->implementation_
;
279 this->implementation_
= 0;
283 ACE_Asynch_Write_Stream::open (ACE_Handler
&handler
,
285 const void *completion_key
,
286 ACE_Proactor
*proactor
)
288 // Get a proactor for/from the user.
289 proactor
= this->get_proactor (proactor
, handler
);
291 // Now let us get the implementation initialized.
292 if ((this->implementation_
= proactor
->create_asynch_write_stream ()) == 0)
295 // Call the <open> method of the base class.
296 return ACE_Asynch_Operation::open (handler
,
303 ACE_Asynch_Write_Stream::write (ACE_Message_Block
&message_block
,
304 size_t bytes_to_write
,
309 if (0 == this->implementation_
)
314 return this->implementation_
->write (message_block
,
321 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
323 ACE_Asynch_Write_Stream::writev (ACE_Message_Block
&message_block
,
324 size_t bytes_to_write
,
329 if (0 == this->implementation_
)
334 return this->implementation_
->writev (message_block
,
340 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */
342 ACE_Asynch_Operation_Impl
*
343 ACE_Asynch_Write_Stream::implementation (void) const
345 return this->implementation_
;
348 // ************************************************************
351 ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const
353 return this->implementation ()->bytes_to_write ();
357 ACE_Asynch_Write_Stream::Result::message_block (void) const
359 return this->implementation ()->message_block ();
363 ACE_Asynch_Write_Stream::Result::handle (void) const
365 return this->implementation ()->handle ();
368 ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl
*implementation
)
369 : ACE_Asynch_Result (implementation
),
370 implementation_ (implementation
)
374 ACE_Asynch_Write_Stream::Result::~Result (void)
376 // Proactor will delte the implementation when the <complete> call
380 ACE_Asynch_Write_Stream_Result_Impl
*
381 ACE_Asynch_Write_Stream::Result::implementation (void) const
383 return this->implementation_
;
386 // ************************************************************
388 ACE_Asynch_Read_File::ACE_Asynch_Read_File (void)
389 : implementation_ (0)
393 ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void)
395 // Delete the implementation.
396 delete this->implementation_
;
397 this->implementation_
= 0;
401 ACE_Asynch_Read_File::open (ACE_Handler
&handler
,
403 const void *completion_key
,
404 ACE_Proactor
*proactor
)
406 // Get a proactor for/from the user.
407 proactor
= this->get_proactor (proactor
, handler
);
409 // Now let us get the implementation initialized.
410 if ((this->implementation_
= proactor
->create_asynch_read_file ()) == 0)
413 // Call the <open> method of the base class.
414 return ACE_Asynch_Operation::open (handler
,
421 ACE_Asynch_Read_File::read (ACE_Message_Block
&message_block
,
422 size_t bytes_to_read
,
423 unsigned long offset
,
424 unsigned long offset_high
,
429 if (0 == this->implementation_
)
434 return this->implementation_
->read (message_block
,
443 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
445 ACE_Asynch_Read_File::readv (ACE_Message_Block
&message_block
,
446 size_t bytes_to_read
,
447 unsigned long offset
,
448 unsigned long offset_high
,
453 if (0 == this->implementation_
)
458 return this->implementation_
->readv (message_block
,
466 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
468 ACE_Asynch_Operation_Impl
*
469 ACE_Asynch_Read_File::implementation (void) const
471 return this->implementation_
;
474 // ************************************************************
476 ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl
*implementation
)
477 : ACE_Asynch_Read_Stream::Result (implementation
),
478 implementation_ (implementation
)
482 ACE_Asynch_Read_File::Result::~Result (void)
484 // Proactor will delete the implementation when <complete> call
488 ACE_Asynch_Read_File_Result_Impl
*
489 ACE_Asynch_Read_File::Result::implementation (void) const
491 return this->implementation_
;
494 // ************************************************************
496 ACE_Asynch_Write_File::ACE_Asynch_Write_File (void)
497 : implementation_ (0)
501 ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void)
503 // Delete the implementation.
504 delete this->implementation_
;
505 this->implementation_
= 0;
509 ACE_Asynch_Write_File::open (ACE_Handler
&handler
,
511 const void *completion_key
,
512 ACE_Proactor
*proactor
)
514 // Get a proactor for/from the user.
515 proactor
= this->get_proactor (proactor
, handler
);
517 // Now let us get the implementation initialized.
518 if ((this->implementation_
= proactor
->create_asynch_write_file ()) == 0)
521 // Call the <open> method of the base class.
522 return ACE_Asynch_Operation::open (handler
,
529 ACE_Asynch_Write_File::write (ACE_Message_Block
&message_block
,
530 size_t bytes_to_write
,
531 unsigned long offset
,
532 unsigned long offset_high
,
537 if (0 == this->implementation_
)
542 return this->implementation_
->write (message_block
,
551 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
553 ACE_Asynch_Write_File::writev (ACE_Message_Block
&message_block
,
554 size_t bytes_to_write
,
555 unsigned long offset
,
556 unsigned long offset_high
,
561 if (0 == this->implementation_
)
566 return this->implementation_
->writev (message_block
,
574 #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
576 ACE_Asynch_Operation_Impl
*
577 ACE_Asynch_Write_File::implementation (void) const
579 return this->implementation_
;
582 // ************************************************************
584 ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl
*implementation
)
585 : ACE_Asynch_Write_Stream::Result (implementation
),
586 implementation_ (implementation
)
590 ACE_Asynch_Write_File::Result::~Result (void)
592 // Proactor will delete the implementation when the <complete> call
596 ACE_Asynch_Write_File_Result_Impl
*
597 ACE_Asynch_Write_File::Result::implementation (void) const
599 return this->implementation_
;
602 // *********************************************************************
604 ACE_Asynch_Accept::ACE_Asynch_Accept (void)
605 : implementation_ (0)
609 ACE_Asynch_Accept::~ACE_Asynch_Accept (void)
611 // Delete the implementation.
612 delete this->implementation_
;
613 this->implementation_
= 0;
617 ACE_Asynch_Accept::open (ACE_Handler
&handler
,
619 const void *completion_key
,
620 ACE_Proactor
*proactor
)
622 // Get a proactor for/from the user.
623 proactor
= this->get_proactor (proactor
, handler
);
625 // Now let us get the implementation initialized.
626 if ((this->implementation_
= proactor
->create_asynch_accept ()) == 0)
629 // Call the <open> method of the base class.
630 return ACE_Asynch_Operation::open (handler
,
637 ACE_Asynch_Accept::accept (ACE_Message_Block
&message_block
,
638 size_t bytes_to_read
,
639 ACE_HANDLE accept_handle
,
645 if (0 == this->implementation_
)
650 return this->implementation_
->accept (message_block
,
659 ACE_Asynch_Operation_Impl
*
660 ACE_Asynch_Accept::implementation (void) const
662 return this->implementation_
;
665 // ************************************************************
668 ACE_Asynch_Accept::Result::bytes_to_read (void) const
670 return this->implementation ()->bytes_to_read ();
674 ACE_Asynch_Accept::Result::message_block (void) const
676 return this->implementation ()->message_block ();
680 ACE_Asynch_Accept::Result::listen_handle (void) const
682 return this->implementation ()->listen_handle ();
686 ACE_Asynch_Accept::Result::accept_handle (void) const
688 return this->implementation ()->accept_handle ();
691 ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl
*implementation
)
692 : ACE_Asynch_Result (implementation
),
693 implementation_ (implementation
)
697 ACE_Asynch_Accept::Result::~Result (void)
699 // Proactor will delete the implementation when the <complete> call
703 ACE_Asynch_Accept_Result_Impl
*
704 ACE_Asynch_Accept::Result::implementation (void) const
706 return this->implementation_
;
711 // *********************************************************************
713 ACE_Asynch_Connect::ACE_Asynch_Connect (void)
714 : implementation_ (0)
718 ACE_Asynch_Connect::~ACE_Asynch_Connect (void)
720 // Delete the implementation.
721 delete this->implementation_
;
722 this->implementation_
= 0;
726 ACE_Asynch_Connect::open (ACE_Handler
&handler
,
728 const void *completion_key
,
729 ACE_Proactor
*proactor
)
731 // Get a proactor for/from the user.
732 proactor
= this->get_proactor (proactor
, handler
);
734 // Now let us get the implementation initialized.
735 if ((this->implementation_
= proactor
->create_asynch_connect ()) == 0)
738 // Call the <open> method of the base class.
739 return ACE_Asynch_Operation::open (handler
,
746 ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle
,
747 const ACE_Addr
& remote_sap
,
748 const ACE_Addr
& local_sap
,
754 if (0 == this->implementation_
)
759 return this->implementation_
->connect (connect_handle
,
768 ACE_Asynch_Operation_Impl
*
769 ACE_Asynch_Connect::implementation (void) const
771 return this->implementation_
;
774 // ************************************************************
776 ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl
*implementation
)
777 : ACE_Asynch_Result (implementation
),
778 implementation_ (implementation
)
782 ACE_Asynch_Connect::Result::~Result (void)
784 // Proactor will delete the implementation when the <complete> call
789 ACE_Asynch_Connect::Result::connect_handle (void) const
791 return this->implementation ()->connect_handle ();
795 ACE_Asynch_Connect_Result_Impl
*
796 ACE_Asynch_Connect::Result::implementation (void) const
798 return this->implementation_
;
801 // ************************************************************
803 ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void)
804 : implementation_ (0)
808 ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void)
810 // Delete the implementation.
811 delete this->implementation_
;
812 this->implementation_
= 0;
816 ACE_Asynch_Transmit_File::open (ACE_Handler
&handler
,
818 const void *completion_key
,
819 ACE_Proactor
*proactor
)
821 // Get a proactor for/from the user.
822 proactor
= this->get_proactor (proactor
, handler
);
824 // Now let us get the implementation initialized.
825 if ((this->implementation_
= proactor
->create_asynch_transmit_file ()) == 0)
828 // Call the <open> method of the base class.
829 return ACE_Asynch_Operation::open (handler
,
836 ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file
,
837 Header_And_Trailer
*header_and_trailer
,
838 size_t bytes_to_write
,
839 unsigned long offset
,
840 unsigned long offset_high
,
841 size_t bytes_per_send
,
847 if (0 == this->implementation_
)
852 return this->implementation_
->transmit_file (file
,
864 ACE_Asynch_Operation_Impl
*
865 ACE_Asynch_Transmit_File::implementation (void) const
867 return this->implementation_
;
870 // ****************************************************************************
873 ACE_Asynch_Transmit_File::Result::socket (void) const
875 return this->implementation ()->socket ();
879 ACE_Asynch_Transmit_File::Result::file (void) const
881 return this->implementation ()->file ();
884 ACE_Asynch_Transmit_File::Header_And_Trailer
*
885 ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const
887 return this->implementation ()->header_and_trailer ();
891 ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const
893 return this->implementation ()->bytes_to_write ();
897 ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const
899 return this->implementation ()->bytes_per_send ();
903 ACE_Asynch_Transmit_File::Result::flags (void) const
905 return this->implementation ()->flags ();
908 ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl
*implementation
)
909 : ACE_Asynch_Result (implementation
),
910 implementation_ (implementation
)
914 ACE_Asynch_Transmit_File::Result::~Result (void)
918 ACE_Asynch_Transmit_File_Result_Impl
*
919 ACE_Asynch_Transmit_File::Result::implementation (void) const
921 return this->implementation_
;
924 // ************************************************************
926 ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block
*header
,
928 ACE_Message_Block
*trailer
,
929 size_t trailer_bytes
)
931 header_bytes_ (header_bytes
),
933 trailer_bytes_ (trailer_bytes
)
937 ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void)
942 ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block
*header
,
944 ACE_Message_Block
*trailer
,
945 size_t trailer_bytes
)
947 this->header (header
);
948 this->header_bytes (header_bytes
);
949 this->trailer (trailer
);
950 this->trailer_bytes (trailer_bytes
);
954 ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const
956 return this->header_
;
960 ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block
*message_block
)
962 this->header_
= message_block
;
966 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const
968 return this->header_bytes_
;
972 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes
)
974 this->header_bytes_
= bytes
;
978 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const
980 return this->trailer_
;
984 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block
*message_block
)
986 this->trailer_
= message_block
;
990 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const
992 return this->trailer_bytes_
;
996 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes
)
998 this->trailer_bytes_
= bytes
;
1001 ACE_LPTRANSMIT_FILE_BUFFERS
1002 ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
1004 // If both are zero, return zero
1005 if (this->header_
== 0 && this->trailer_
== 0)
1011 // Something is valid
1013 // If header is valid, set the fields
1014 if (this->header_
!= 0)
1016 this->transmit_buffers_
.Head
= this->header_
->rd_ptr ();
1017 #if defined (ACE_WIN64) || defined (ACE_WIN32)
1018 this->transmit_buffers_
.HeadLength
=
1019 ACE_Utils::truncate_cast
<DWORD
> (this->header_bytes_
);
1021 this->transmit_buffers_
.HeadLength
= this->header_bytes_
;
1022 #endif /* ACE_WIN64 || ACE_WIN32 */
1026 this->transmit_buffers_
.Head
= 0;
1027 this->transmit_buffers_
.HeadLength
= 0;
1030 // If trailer is valid, set the fields
1031 if (this->trailer_
!= 0)
1033 this->transmit_buffers_
.Tail
= this->trailer_
->rd_ptr ();
1034 #if defined(ACE_WIN64) || defined (ACE_WIN32)
1035 this->transmit_buffers_
.TailLength
=
1036 ACE_Utils::truncate_cast
<DWORD
> (this->trailer_bytes_
);
1038 this->transmit_buffers_
.TailLength
= this->trailer_bytes_
;
1039 #endif /* ACE_WIN64 || ACE_WIN32 */
1043 this->transmit_buffers_
.Tail
= 0;
1044 this->transmit_buffers_
.TailLength
= 0;
1047 // Return the transmit buffers
1048 return &this->transmit_buffers_
;
1052 // *********************************************************************
1054 ACE_Handler::ACE_Handler (void)
1055 : proactor_ (0), handle_ (ACE_INVALID_HANDLE
)
1057 ACE_Handler::Proxy
*p
;
1058 ACE_NEW (p
, ACE_Handler::Proxy (this));
1059 this->proxy_
.reset (p
);
1062 ACE_Handler::ACE_Handler (ACE_Proactor
*d
)
1063 : proactor_ (d
), handle_ (ACE_INVALID_HANDLE
)
1065 ACE_Handler::Proxy
*p
;
1066 ACE_NEW (p
, ACE_Handler::Proxy (this));
1067 this->proxy_
.reset (p
);
1070 ACE_Handler::~ACE_Handler (void)
1072 ACE_Handler::Proxy
*p
= this->proxy_
.get ();
1078 ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result
& /* result */)
1083 ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result
& /* result */)
1088 ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result
& /* result */)
1093 ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result
& /* result */)
1098 ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result
& /* result */)
1103 ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result
& /* result */)
1108 ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result
& /* result */)
1113 ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result
& /* result */)
1118 ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result
& /* result */)
1123 ACE_Handler::handle_time_out (const ACE_Time_Value
& /* tv */,
1124 const void * /* act */)
1129 ACE_Handler::handle_wakeup (void)
1134 ACE_Handler::proactor (void)
1136 return this->proactor_
;
1140 ACE_Handler::proactor (ACE_Proactor
*p
)
1142 this->proactor_
= p
;
1146 ACE_Handler::handle (void) const
1148 return this->handle_
;
1152 ACE_Handler::handle (ACE_HANDLE h
)
1157 ACE_Refcounted_Auto_Ptr
<ACE_Handler::Proxy
, ACE_SYNCH_MUTEX
> &
1158 ACE_Handler::proxy (void)
1160 return this->proxy_
;
1163 // ************************************************************
1165 ACE_Service_Handler::ACE_Service_Handler (void)
1169 ACE_Service_Handler::~ACE_Service_Handler (void)
1174 ACE_Service_Handler::addresses (const ACE_INET_Addr
& /* remote_address */,
1175 const ACE_INET_Addr
& /* local_address */ )
1180 ACE_Service_Handler::act (const void *)
1185 ACE_Service_Handler::open (ACE_HANDLE
,
1186 ACE_Message_Block
&)
1191 // ************************************************************
1193 ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void)
1194 : implementation_ (0)
1198 ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void)
1200 // Delete the implementation.
1201 delete this->implementation_
;
1202 this->implementation_
= 0;
1206 ACE_Asynch_Read_Dgram::open (ACE_Handler
&handler
,
1208 const void *completion_key
,
1209 ACE_Proactor
*proactor
)
1211 // Get a proactor for/from the user.
1212 proactor
= this->get_proactor (proactor
, handler
);
1214 // Now let us get the implementation initialized.
1215 if ((this->implementation_
= proactor
->create_asynch_read_dgram ()) == 0)
1218 // Call the <open> method of the base class.
1219 return ACE_Asynch_Operation::open (handler
,
1226 ACE_Asynch_Read_Dgram::recv (ACE_Message_Block
*message_block
,
1227 size_t &number_of_bytes_recvd
,
1229 int protocol_family
,
1234 if (0 == this->implementation_
)
1239 return this->implementation_
->recv (message_block
,
1240 number_of_bytes_recvd
,
1248 ACE_Asynch_Operation_Impl
*
1249 ACE_Asynch_Read_Dgram::implementation (void) const
1251 return this->implementation_
;
1254 // ************************************************************
1257 ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr
& addr
) const
1259 return this->implementation ()->remote_address (addr
);
1263 ACE_Asynch_Read_Dgram::Result::message_block (void) const
1265 return this->implementation ()->message_block ();
1269 ACE_Asynch_Read_Dgram::Result::flags (void) const
1271 return this->implementation ()->flags ();
1275 ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const
1277 return this->implementation ()->bytes_to_read ();
1281 ACE_Asynch_Read_Dgram::Result::handle (void) const
1283 return this->implementation ()->handle();
1286 ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl
*implementation
)
1287 : ACE_Asynch_Result (implementation
),
1288 implementation_ (implementation
)
1292 ACE_Asynch_Read_Dgram::Result::~Result (void)
1296 ACE_Asynch_Read_Dgram_Result_Impl
*
1297 ACE_Asynch_Read_Dgram::Result::implementation (void) const
1299 return this->implementation_
;
1302 // ************************************************************
1305 ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void)
1306 : implementation_ (0)
1310 ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void)
1312 // Delete the implementation.
1313 delete this->implementation_
;
1314 this->implementation_
= 0;
1318 ACE_Asynch_Write_Dgram::open (ACE_Handler
&handler
,
1320 const void *completion_key
,
1321 ACE_Proactor
*proactor
)
1323 // Get a proactor for/from the user.
1324 proactor
= this->get_proactor (proactor
, handler
);
1326 // Now let us get the implementation initialized.
1327 if ((this->implementation_
= proactor
->create_asynch_write_dgram ()) == 0)
1330 // Call the <open> method of the base class.
1331 return ACE_Asynch_Operation::open (handler
,
1338 ACE_Asynch_Write_Dgram::send (ACE_Message_Block
*message_block
,
1339 size_t &number_of_bytes_sent
,
1341 const ACE_Addr
& remote_addr
,
1346 if (0 == this->implementation_
)
1351 return this->implementation_
->send (message_block
,
1352 number_of_bytes_sent
,
1360 ACE_Asynch_Operation_Impl
*
1361 ACE_Asynch_Write_Dgram::implementation (void) const
1363 return this->implementation_
;
1366 // ************************************************************
1369 ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const
1371 return this->implementation ()->bytes_to_write ();
1375 ACE_Asynch_Write_Dgram::Result::message_block () const
1377 return this->implementation ()->message_block ();
1381 ACE_Asynch_Write_Dgram::Result::flags (void) const
1383 return this->implementation ()->flags ();
1387 ACE_Asynch_Write_Dgram::Result::handle (void) const
1389 return this->implementation ()->handle ();
1392 ACE_Asynch_Write_Dgram_Result_Impl
*
1393 ACE_Asynch_Write_Dgram::Result::implementation (void) const
1395 return this->implementation_
;
1398 ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl
*implementation
)
1399 : ACE_Asynch_Result (implementation
),
1400 implementation_ (implementation
)
1404 ACE_Asynch_Write_Dgram::Result::~Result (void)
1408 ACE_END_VERSIONED_NAMESPACE_DECL
1410 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */