00001
00002
00003 #include "ace/Asynch_IO.h"
00004
00005 ACE_RCSID(ace, Asynch_IO, "$Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $")
00006
00007 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
00008
00009
00010 #include "ace/Proactor.h"
00011 #include "ace/Message_Block.h"
00012 #include "ace/INET_Addr.h"
00013 #include "ace/Asynch_IO_Impl.h"
00014 #include "ace/os_include/os_errno.h"
00015 #include "ace/Truncate.h"
00016
00017 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 size_t
00020 ACE_Asynch_Result::bytes_transferred (void) const
00021 {
00022 return this->implementation ()->bytes_transferred ();
00023 }
00024
00025 const void *
00026 ACE_Asynch_Result::act (void) const
00027 {
00028 return this->implementation ()->act ();
00029 }
00030
00031 int
00032 ACE_Asynch_Result::success (void) const
00033 {
00034 return this->implementation ()->success ();
00035 }
00036
00037 const void *
00038 ACE_Asynch_Result::completion_key (void) const
00039 {
00040 return this->implementation ()->completion_key ();
00041 }
00042
00043 unsigned long
00044 ACE_Asynch_Result::error (void) const
00045 {
00046 return this->implementation ()->error ();
00047 }
00048
00049 ACE_HANDLE
00050 ACE_Asynch_Result::event (void) const
00051 {
00052 return this->implementation ()->event ();
00053 }
00054
00055 unsigned long
00056 ACE_Asynch_Result::offset (void) const
00057 {
00058 return this->implementation ()->offset ();
00059 }
00060
00061 unsigned long
00062 ACE_Asynch_Result::offset_high (void) const
00063 {
00064 return this->implementation ()->offset_high ();
00065 }
00066
00067 int
00068 ACE_Asynch_Result::priority (void) const
00069 {
00070 return this->implementation ()->priority ();
00071 }
00072
00073 int
00074 ACE_Asynch_Result::signal_number (void) const
00075 {
00076 return this->implementation ()->signal_number ();
00077 }
00078
00079 ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation)
00080 : implementation_ (implementation)
00081 {
00082 }
00083
00084 ACE_Asynch_Result::~ACE_Asynch_Result (void)
00085 {
00086
00087 }
00088
00089 ACE_Asynch_Result_Impl *
00090 ACE_Asynch_Result::implementation (void) const
00091 {
00092 return this->implementation_;
00093 }
00094
00095
00096
00097 int
00098 ACE_Asynch_Operation::open (ACE_Handler &handler,
00099 ACE_HANDLE handle,
00100 const void *completion_key,
00101 ACE_Proactor *proactor)
00102 {
00103 return this->implementation ()->open (handler.proxy (),
00104 handle,
00105 completion_key,
00106 proactor);
00107 }
00108
00109 int
00110 ACE_Asynch_Operation::cancel (void)
00111 {
00112 if (0 == this->implementation ())
00113 {
00114 errno = EFAULT;
00115 return -1;
00116 }
00117 return this->implementation ()->cancel ();
00118 }
00119
00120 ACE_Proactor *
00121 ACE_Asynch_Operation::proactor (void) const
00122 {
00123 if (0 == this->implementation ())
00124 {
00125 errno = EFAULT;
00126 return 0;
00127 }
00128 return this->implementation ()->proactor ();
00129 }
00130
00131 ACE_Asynch_Operation::ACE_Asynch_Operation (void)
00132 {
00133 }
00134
00135 ACE_Asynch_Operation::~ACE_Asynch_Operation (void)
00136 {
00137 }
00138
00139 ACE_Proactor *
00140 ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor,
00141 ACE_Handler &handler) const
00142 {
00143 if (user_proactor == 0)
00144 {
00145
00146 user_proactor = handler.proactor ();
00147 if (user_proactor == 0)
00148 user_proactor = ACE_Proactor::instance ();
00149 }
00150
00151 return user_proactor;
00152 }
00153
00154
00155
00156 ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void)
00157 : implementation_ (0)
00158 {
00159 }
00160
00161 ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void)
00162 {
00163
00164 delete this->implementation_;
00165 this->implementation_ = 0;
00166 }
00167
00168 int
00169 ACE_Asynch_Read_Stream::open (ACE_Handler &handler,
00170 ACE_HANDLE handle,
00171 const void *completion_key,
00172 ACE_Proactor *proactor)
00173 {
00174
00175 proactor = this->get_proactor (proactor, handler);
00176
00177
00178 if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0)
00179 return -1;
00180
00181
00182 return ACE_Asynch_Operation::open (handler,
00183 handle,
00184 completion_key,
00185 proactor);
00186 }
00187
00188 int
00189 ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
00190 size_t bytes_to_read,
00191 const void *act,
00192 int priority,
00193 int signal_number)
00194 {
00195 if (0 == this->implementation_)
00196 {
00197 errno = EFAULT;
00198 return -1;
00199 }
00200 return this->implementation_->read (message_block,
00201 bytes_to_read,
00202 act,
00203 priority,
00204 signal_number);
00205 }
00206
00207 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
00208 int
00209 ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
00210 size_t bytes_to_read,
00211 const void *act,
00212 int priority,
00213 int signal_number)
00214 {
00215 if (0 == this->implementation_)
00216 {
00217 errno = EFAULT;
00218 return -1;
00219 }
00220 return this->implementation_->readv (message_block,
00221 bytes_to_read,
00222 act,
00223 priority,
00224 signal_number);
00225 }
00226 #endif
00227
00228 ACE_Asynch_Operation_Impl *
00229 ACE_Asynch_Read_Stream::implementation (void) const
00230 {
00231 return this->implementation_;
00232 }
00233
00234
00235
00236 size_t
00237 ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const
00238 {
00239 return this->implementation ()->bytes_to_read ();
00240 }
00241
00242 ACE_Message_Block &
00243 ACE_Asynch_Read_Stream::Result::message_block (void) const
00244 {
00245 return this->implementation ()->message_block ();
00246 }
00247
00248 ACE_HANDLE
00249 ACE_Asynch_Read_Stream::Result::handle (void) const
00250 {
00251 return this->implementation ()->handle ();
00252 }
00253
00254 ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation)
00255 : ACE_Asynch_Result (implementation),
00256 implementation_ (implementation)
00257 {
00258 }
00259
00260 ACE_Asynch_Read_Stream::Result::~Result (void)
00261 {
00262
00263
00264 }
00265
00266 ACE_Asynch_Read_Stream_Result_Impl *
00267 ACE_Asynch_Read_Stream::Result::implementation (void) const
00268 {
00269 return this->implementation_;
00270 }
00271
00272
00273
00274 ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void)
00275 : implementation_ (0)
00276 {
00277 }
00278
00279 ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void)
00280 {
00281
00282 delete this->implementation_;
00283 this->implementation_ = 0;
00284 }
00285
00286 int
00287 ACE_Asynch_Write_Stream::open (ACE_Handler &handler,
00288 ACE_HANDLE handle,
00289 const void *completion_key,
00290 ACE_Proactor *proactor)
00291 {
00292
00293 proactor = this->get_proactor (proactor, handler);
00294
00295
00296 if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0)
00297 return -1;
00298
00299
00300 return ACE_Asynch_Operation::open (handler,
00301 handle,
00302 completion_key,
00303 proactor);
00304 }
00305
00306 int
00307 ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
00308 size_t bytes_to_write,
00309 const void *act,
00310 int priority,
00311 int signal_number)
00312 {
00313 if (0 == this->implementation_)
00314 {
00315 errno = EFAULT;
00316 return -1;
00317 }
00318 return this->implementation_->write (message_block,
00319 bytes_to_write,
00320 act,
00321 priority,
00322 signal_number);
00323 }
00324
00325 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO)
00326 int
00327 ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block,
00328 size_t bytes_to_write,
00329 const void *act,
00330 int priority,
00331 int signal_number)
00332 {
00333 if (0 == this->implementation_)
00334 {
00335 errno = EFAULT;
00336 return -1;
00337 }
00338 return this->implementation_->writev (message_block,
00339 bytes_to_write,
00340 act,
00341 priority,
00342 signal_number);
00343 }
00344 #endif
00345
00346 ACE_Asynch_Operation_Impl *
00347 ACE_Asynch_Write_Stream::implementation (void) const
00348 {
00349 return this->implementation_;
00350 }
00351
00352
00353
00354 size_t
00355 ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const
00356 {
00357 return this->implementation ()->bytes_to_write ();
00358 }
00359
00360 ACE_Message_Block &
00361 ACE_Asynch_Write_Stream::Result::message_block (void) const
00362 {
00363 return this->implementation ()->message_block ();
00364 }
00365
00366 ACE_HANDLE
00367 ACE_Asynch_Write_Stream::Result::handle (void) const
00368 {
00369 return this->implementation ()->handle ();
00370 }
00371
00372 ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation)
00373 : ACE_Asynch_Result (implementation),
00374 implementation_ (implementation)
00375 {
00376 }
00377
00378 ACE_Asynch_Write_Stream::Result::~Result (void)
00379 {
00380
00381
00382 }
00383
00384 ACE_Asynch_Write_Stream_Result_Impl *
00385 ACE_Asynch_Write_Stream::Result::implementation (void) const
00386 {
00387 return this->implementation_;
00388 }
00389
00390
00391
00392 ACE_Asynch_Read_File::ACE_Asynch_Read_File (void)
00393 : implementation_ (0)
00394 {
00395 }
00396
00397 ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void)
00398 {
00399
00400 delete this->implementation_;
00401 this->implementation_ = 0;
00402 }
00403
00404 int
00405 ACE_Asynch_Read_File::open (ACE_Handler &handler,
00406 ACE_HANDLE handle,
00407 const void *completion_key,
00408 ACE_Proactor *proactor)
00409 {
00410
00411 proactor = this->get_proactor (proactor, handler);
00412
00413
00414 if ((this->implementation_ = proactor->create_asynch_read_file ()) == 0)
00415 return -1;
00416
00417
00418 return ACE_Asynch_Operation::open (handler,
00419 handle,
00420 completion_key,
00421 proactor);
00422 }
00423
00424 int
00425 ACE_Asynch_Read_File::read (ACE_Message_Block &message_block,
00426 size_t bytes_to_read,
00427 unsigned long offset,
00428 unsigned long offset_high,
00429 const void *act,
00430 int priority,
00431 int signal_number)
00432 {
00433 if (0 == this->implementation_)
00434 {
00435 errno = EFAULT;
00436 return -1;
00437 }
00438 return this->implementation_->read (message_block,
00439 bytes_to_read,
00440 offset,
00441 offset_high,
00442 act,
00443 priority,
00444 signal_number);
00445 }
00446
00447 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
00448 int
00449 ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block,
00450 size_t bytes_to_read,
00451 unsigned long offset,
00452 unsigned long offset_high,
00453 const void *act,
00454 int priority,
00455 int signal_number)
00456 {
00457 if (0 == this->implementation_)
00458 {
00459 errno = EFAULT;
00460 return -1;
00461 }
00462 return this->implementation_->readv (message_block,
00463 bytes_to_read,
00464 offset,
00465 offset_high,
00466 act,
00467 priority,
00468 signal_number);
00469 }
00470 #endif
00471
00472 ACE_Asynch_Operation_Impl *
00473 ACE_Asynch_Read_File::implementation (void) const
00474 {
00475 return this->implementation_;
00476 }
00477
00478
00479
00480 ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation)
00481 : ACE_Asynch_Read_Stream::Result (implementation),
00482 implementation_ (implementation)
00483 {
00484 }
00485
00486 ACE_Asynch_Read_File::Result::~Result (void)
00487 {
00488
00489
00490 }
00491
00492 ACE_Asynch_Read_File_Result_Impl *
00493 ACE_Asynch_Read_File::Result::implementation (void) const
00494 {
00495 return this->implementation_;
00496 }
00497
00498
00499
00500 ACE_Asynch_Write_File::ACE_Asynch_Write_File (void)
00501 : implementation_ (0)
00502 {
00503 }
00504
00505 ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void)
00506 {
00507
00508 delete this->implementation_;
00509 this->implementation_ = 0;
00510 }
00511
00512 int
00513 ACE_Asynch_Write_File::open (ACE_Handler &handler,
00514 ACE_HANDLE handle,
00515 const void *completion_key,
00516 ACE_Proactor *proactor)
00517 {
00518
00519 proactor = this->get_proactor (proactor, handler);
00520
00521
00522 if ((this->implementation_ = proactor->create_asynch_write_file ()) == 0)
00523 return -1;
00524
00525
00526 return ACE_Asynch_Operation::open (handler,
00527 handle,
00528 completion_key,
00529 proactor);
00530 }
00531
00532 int
00533 ACE_Asynch_Write_File::write (ACE_Message_Block &message_block,
00534 size_t bytes_to_write,
00535 unsigned long offset,
00536 unsigned long offset_high,
00537 const void *act,
00538 int priority,
00539 int signal_number)
00540 {
00541 if (0 == this->implementation_)
00542 {
00543 errno = EFAULT;
00544 return -1;
00545 }
00546 return this->implementation_->write (message_block,
00547 bytes_to_write,
00548 offset,
00549 offset_high,
00550 act,
00551 priority,
00552 signal_number);
00553 }
00554
00555 #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
00556 int
00557 ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block,
00558 size_t bytes_to_write,
00559 unsigned long offset,
00560 unsigned long offset_high,
00561 const void *act,
00562 int priority,
00563 int signal_number)
00564 {
00565 if (0 == this->implementation_)
00566 {
00567 errno = EFAULT;
00568 return -1;
00569 }
00570 return this->implementation_->writev (message_block,
00571 bytes_to_write,
00572 offset,
00573 offset_high,
00574 act,
00575 priority,
00576 signal_number);
00577 }
00578 #endif
00579
00580 ACE_Asynch_Operation_Impl *
00581 ACE_Asynch_Write_File::implementation (void) const
00582 {
00583 return this->implementation_;
00584 }
00585
00586
00587
00588 ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation)
00589 : ACE_Asynch_Write_Stream::Result (implementation),
00590 implementation_ (implementation)
00591 {
00592 }
00593
00594 ACE_Asynch_Write_File::Result::~Result (void)
00595 {
00596
00597
00598 }
00599
00600 ACE_Asynch_Write_File_Result_Impl *
00601 ACE_Asynch_Write_File::Result::implementation (void) const
00602 {
00603 return this->implementation_;
00604 }
00605
00606
00607
00608 ACE_Asynch_Accept::ACE_Asynch_Accept (void)
00609 : implementation_ (0)
00610 {
00611 }
00612
00613 ACE_Asynch_Accept::~ACE_Asynch_Accept (void)
00614 {
00615
00616 delete this->implementation_;
00617 this->implementation_ = 0;
00618 }
00619
00620 int
00621 ACE_Asynch_Accept::open (ACE_Handler &handler,
00622 ACE_HANDLE handle,
00623 const void *completion_key,
00624 ACE_Proactor *proactor)
00625 {
00626
00627 proactor = this->get_proactor (proactor, handler);
00628
00629
00630 if ((this->implementation_ = proactor->create_asynch_accept ()) == 0)
00631 return -1;
00632
00633
00634 return ACE_Asynch_Operation::open (handler,
00635 handle,
00636 completion_key,
00637 proactor);
00638 }
00639
00640 int
00641 ACE_Asynch_Accept::accept (ACE_Message_Block &message_block,
00642 size_t bytes_to_read,
00643 ACE_HANDLE accept_handle,
00644 const void *act,
00645 int priority,
00646 int signal_number,
00647 int addr_family)
00648 {
00649 if (0 == this->implementation_)
00650 {
00651 errno = EFAULT;
00652 return -1;
00653 }
00654 return this->implementation_->accept (message_block,
00655 bytes_to_read,
00656 accept_handle,
00657 act,
00658 priority,
00659 signal_number,
00660 addr_family);
00661 }
00662
00663 ACE_Asynch_Operation_Impl *
00664 ACE_Asynch_Accept::implementation (void) const
00665 {
00666 return this->implementation_;
00667 }
00668
00669
00670
00671 size_t
00672 ACE_Asynch_Accept::Result::bytes_to_read (void) const
00673 {
00674 return this->implementation ()->bytes_to_read ();
00675 }
00676
00677 ACE_Message_Block &
00678 ACE_Asynch_Accept::Result::message_block (void) const
00679 {
00680 return this->implementation ()->message_block ();
00681 }
00682
00683 ACE_HANDLE
00684 ACE_Asynch_Accept::Result::listen_handle (void) const
00685 {
00686 return this->implementation ()->listen_handle ();
00687 }
00688
00689 ACE_HANDLE
00690 ACE_Asynch_Accept::Result::accept_handle (void) const
00691 {
00692 return this->implementation ()->accept_handle ();
00693 }
00694
00695 ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation)
00696 : ACE_Asynch_Result (implementation),
00697 implementation_ (implementation)
00698 {
00699 }
00700
00701 ACE_Asynch_Accept::Result::~Result (void)
00702 {
00703
00704
00705 }
00706
00707 ACE_Asynch_Accept_Result_Impl *
00708 ACE_Asynch_Accept::Result::implementation (void) const
00709 {
00710 return this->implementation_;
00711 }
00712
00713
00714
00715
00716
00717 ACE_Asynch_Connect::ACE_Asynch_Connect (void)
00718 : implementation_ (0)
00719 {
00720 }
00721
00722 ACE_Asynch_Connect::~ACE_Asynch_Connect (void)
00723 {
00724
00725 delete this->implementation_;
00726 this->implementation_ = 0;
00727 }
00728
00729 int
00730 ACE_Asynch_Connect::open (ACE_Handler &handler,
00731 ACE_HANDLE handle,
00732 const void *completion_key,
00733 ACE_Proactor *proactor)
00734 {
00735
00736 proactor = this->get_proactor (proactor, handler);
00737
00738
00739 if ((this->implementation_ = proactor->create_asynch_connect ()) == 0)
00740 return -1;
00741
00742
00743 return ACE_Asynch_Operation::open (handler,
00744 handle,
00745 completion_key,
00746 proactor);
00747 }
00748
00749 int
00750 ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle,
00751 const ACE_Addr & remote_sap,
00752 const ACE_Addr & local_sap,
00753 int reuse_addr,
00754 const void *act,
00755 int priority,
00756 int signal_number)
00757 {
00758 if (0 == this->implementation_)
00759 {
00760 errno = EFAULT;
00761 return -1;
00762 }
00763 return this->implementation_->connect (connect_handle,
00764 remote_sap,
00765 local_sap,
00766 reuse_addr,
00767 act,
00768 priority,
00769 signal_number);
00770 }
00771
00772 ACE_Asynch_Operation_Impl *
00773 ACE_Asynch_Connect::implementation (void) const
00774 {
00775 return this->implementation_;
00776 }
00777
00778
00779
00780 ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation)
00781 : ACE_Asynch_Result (implementation),
00782 implementation_ (implementation)
00783 {
00784 }
00785
00786 ACE_Asynch_Connect::Result::~Result (void)
00787 {
00788
00789
00790 }
00791
00792 ACE_HANDLE
00793 ACE_Asynch_Connect::Result::connect_handle (void) const
00794 {
00795 return this->implementation ()->connect_handle ();
00796 }
00797
00798
00799 ACE_Asynch_Connect_Result_Impl *
00800 ACE_Asynch_Connect::Result::implementation (void) const
00801 {
00802 return this->implementation_;
00803 }
00804
00805
00806
00807 ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void)
00808 : implementation_ (0)
00809 {
00810 }
00811
00812 ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void)
00813 {
00814
00815 delete this->implementation_;
00816 this->implementation_ = 0;
00817 }
00818
00819 int
00820 ACE_Asynch_Transmit_File::open (ACE_Handler &handler,
00821 ACE_HANDLE handle,
00822 const void *completion_key,
00823 ACE_Proactor *proactor)
00824 {
00825
00826 proactor = this->get_proactor (proactor, handler);
00827
00828
00829 if ((this->implementation_ = proactor->create_asynch_transmit_file ()) == 0)
00830 return -1;
00831
00832
00833 return ACE_Asynch_Operation::open (handler,
00834 handle,
00835 completion_key,
00836 proactor);
00837 }
00838
00839 int
00840 ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
00841 Header_And_Trailer *header_and_trailer,
00842 size_t bytes_to_write,
00843 unsigned long offset,
00844 unsigned long offset_high,
00845 size_t bytes_per_send,
00846 unsigned long flags,
00847 const void *act,
00848 int priority,
00849 int signal_number)
00850 {
00851 if (0 == this->implementation_)
00852 {
00853 errno = EFAULT;
00854 return -1;
00855 }
00856 return this->implementation_->transmit_file (file,
00857 header_and_trailer,
00858 bytes_to_write,
00859 offset,
00860 offset_high,
00861 bytes_per_send,
00862 flags,
00863 act,
00864 priority,
00865 signal_number);
00866 }
00867
00868 ACE_Asynch_Operation_Impl *
00869 ACE_Asynch_Transmit_File::implementation (void) const
00870 {
00871 return this->implementation_;
00872 }
00873
00874
00875
00876 ACE_HANDLE
00877 ACE_Asynch_Transmit_File::Result::socket (void) const
00878 {
00879 return this->implementation ()->socket ();
00880 }
00881
00882 ACE_HANDLE
00883 ACE_Asynch_Transmit_File::Result::file (void) const
00884 {
00885 return this->implementation ()->file ();
00886 }
00887
00888 ACE_Asynch_Transmit_File::Header_And_Trailer *
00889 ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const
00890 {
00891 return this->implementation ()->header_and_trailer ();
00892 }
00893
00894 size_t
00895 ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const
00896 {
00897 return this->implementation ()->bytes_to_write ();
00898 }
00899
00900 size_t
00901 ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const
00902 {
00903 return this->implementation ()->bytes_per_send ();
00904 }
00905
00906 unsigned long
00907 ACE_Asynch_Transmit_File::Result::flags (void) const
00908 {
00909 return this->implementation ()->flags ();
00910 }
00911
00912 ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation)
00913 : ACE_Asynch_Result (implementation),
00914 implementation_ (implementation)
00915 {
00916 }
00917
00918 ACE_Asynch_Transmit_File::Result::~Result (void)
00919 {
00920 }
00921
00922 ACE_Asynch_Transmit_File_Result_Impl *
00923 ACE_Asynch_Transmit_File::Result::implementation (void) const
00924 {
00925 return this->implementation_;
00926 }
00927
00928
00929
00930 ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header,
00931 size_t header_bytes,
00932 ACE_Message_Block *trailer,
00933 size_t trailer_bytes)
00934 : header_ (header),
00935 header_bytes_ (header_bytes),
00936 trailer_ (trailer),
00937 trailer_bytes_ (trailer_bytes)
00938 {
00939 }
00940
00941 ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void)
00942 {
00943 }
00944
00945 void
00946 ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header,
00947 size_t header_bytes,
00948 ACE_Message_Block *trailer,
00949 size_t trailer_bytes)
00950 {
00951 this->header (header);
00952 this->header_bytes (header_bytes);
00953 this->trailer (trailer);
00954 this->trailer_bytes (trailer_bytes);
00955 }
00956
00957 ACE_Message_Block *
00958 ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const
00959 {
00960 return this->header_;
00961 }
00962
00963 void
00964 ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block)
00965 {
00966 this->header_ = message_block;
00967 }
00968
00969 size_t
00970 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const
00971 {
00972 return this->header_bytes_;
00973 }
00974
00975 void
00976 ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes)
00977 {
00978 this->header_bytes_ = bytes;
00979 }
00980
00981 ACE_Message_Block *
00982 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const
00983 {
00984 return this->trailer_;
00985 }
00986
00987 void
00988 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block)
00989 {
00990 this->trailer_ = message_block;
00991 }
00992
00993 size_t
00994 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const
00995 {
00996 return this->trailer_bytes_;
00997 }
00998
00999 void
01000 ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes)
01001 {
01002 this->trailer_bytes_ = bytes;
01003 }
01004
01005 ACE_LPTRANSMIT_FILE_BUFFERS
01006 ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void)
01007 {
01008
01009 if (this->header_ == 0 && this->trailer_ == 0)
01010 {
01011 return 0;
01012 }
01013 else
01014 {
01015
01016
01017
01018 if (this->header_ != 0)
01019 {
01020 this->transmit_buffers_.Head = this->header_->rd_ptr ();
01021 #if defined (ACE_WIN64) || defined (ACE_WIN32)
01022 this->transmit_buffers_.HeadLength =
01023 ACE_Utils::truncate_cast<DWORD> (this->header_bytes_);
01024 #else
01025 this->transmit_buffers_.HeadLength = this->header_bytes_;
01026 #endif
01027 }
01028 else
01029 {
01030 this->transmit_buffers_.Head = 0;
01031 this->transmit_buffers_.HeadLength = 0;
01032 }
01033
01034
01035 if (this->trailer_ != 0)
01036 {
01037 this->transmit_buffers_.Tail = this->trailer_->rd_ptr ();
01038 #if defined(ACE_WIN64) || defined (ACE_WIN32)
01039 this->transmit_buffers_.TailLength =
01040 ACE_Utils::truncate_cast<DWORD> (this->trailer_bytes_);
01041 #else
01042 this->transmit_buffers_.TailLength = this->trailer_bytes_;
01043 #endif
01044 }
01045 else
01046 {
01047 this->transmit_buffers_.Tail = 0;
01048 this->transmit_buffers_.TailLength = 0;
01049 }
01050
01051
01052 return &this->transmit_buffers_;
01053 }
01054 }
01055
01056
01057
01058 ACE_Handler::ACE_Handler (void)
01059 : proactor_ (0), handle_ (ACE_INVALID_HANDLE)
01060 {
01061 ACE_Handler::Proxy *p;
01062 ACE_NEW (p, ACE_Handler::Proxy (this));
01063 this->proxy_.reset (p);
01064 }
01065
01066 ACE_Handler::ACE_Handler (ACE_Proactor *d)
01067 : proactor_ (d), handle_ (ACE_INVALID_HANDLE)
01068 {
01069 ACE_Handler::Proxy *p;
01070 ACE_NEW (p, ACE_Handler::Proxy (this));
01071 this->proxy_.reset (p);
01072 }
01073
01074 ACE_Handler::~ACE_Handler (void)
01075 {
01076 ACE_Handler::Proxy *p = this->proxy_.get ();
01077 if (p)
01078 p->reset ();
01079 }
01080
01081 void
01082 ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & )
01083 {
01084 }
01085
01086 void
01087 ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & )
01088 {
01089 }
01090
01091 void
01092 ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & )
01093 {
01094 }
01095
01096 void
01097 ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & )
01098 {
01099 }
01100
01101 void
01102 ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & )
01103 {
01104 }
01105
01106 void
01107 ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & )
01108 {
01109 }
01110
01111 void
01112 ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & )
01113 {
01114 }
01115
01116 void
01117 ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & )
01118 {
01119 }
01120
01121 void
01122 ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & )
01123 {
01124 }
01125
01126 void
01127 ACE_Handler::handle_time_out (const ACE_Time_Value & ,
01128 const void * )
01129 {
01130 }
01131
01132 void
01133 ACE_Handler::handle_wakeup (void)
01134 {
01135 }
01136
01137 ACE_Proactor *
01138 ACE_Handler::proactor (void)
01139 {
01140 return this->proactor_;
01141 }
01142
01143 void
01144 ACE_Handler::proactor (ACE_Proactor *p)
01145 {
01146 this->proactor_ = p;
01147 }
01148
01149 ACE_HANDLE
01150 ACE_Handler::handle (void) const
01151 {
01152 return this->handle_;
01153 }
01154
01155 void
01156 ACE_Handler::handle (ACE_HANDLE h)
01157 {
01158 this->handle_ = h;
01159 }
01160
01161 ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy, ACE_SYNCH_MUTEX> &
01162 ACE_Handler::proxy (void)
01163 {
01164 return this->proxy_;
01165 }
01166
01167
01168
01169 ACE_Service_Handler::ACE_Service_Handler (void)
01170 {
01171 }
01172
01173 ACE_Service_Handler::~ACE_Service_Handler (void)
01174 {
01175 }
01176
01177 void
01178 ACE_Service_Handler::addresses (const ACE_INET_Addr & ,
01179 const ACE_INET_Addr & )
01180 {
01181 }
01182
01183 void
01184 ACE_Service_Handler::act (const void *)
01185 {
01186 }
01187
01188 void
01189 ACE_Service_Handler::open (ACE_HANDLE,
01190 ACE_Message_Block &)
01191 {
01192 }
01193
01194
01195
01196
01197 ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void)
01198 : implementation_ (0)
01199 {
01200 }
01201
01202 ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void)
01203 {
01204
01205 delete this->implementation_;
01206 this->implementation_ = 0;
01207 }
01208
01209 int
01210 ACE_Asynch_Read_Dgram::open (ACE_Handler &handler,
01211 ACE_HANDLE handle,
01212 const void *completion_key,
01213 ACE_Proactor *proactor)
01214 {
01215
01216 proactor = this->get_proactor (proactor, handler);
01217
01218
01219 if ((this->implementation_ = proactor->create_asynch_read_dgram ()) == 0)
01220 return -1;
01221
01222
01223 return ACE_Asynch_Operation::open (handler,
01224 handle,
01225 completion_key,
01226 proactor);
01227 }
01228
01229 ssize_t
01230 ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
01231 size_t &number_of_bytes_recvd,
01232 int flags,
01233 int protocol_family,
01234 const void *act,
01235 int priority,
01236 int signal_number)
01237 {
01238 if (0 == this->implementation_)
01239 {
01240 errno = EFAULT;
01241 return -1;
01242 }
01243 return this->implementation_->recv (message_block,
01244 number_of_bytes_recvd,
01245 flags,
01246 protocol_family,
01247 act,
01248 priority,
01249 signal_number);
01250 }
01251
01252 ACE_Asynch_Operation_Impl *
01253 ACE_Asynch_Read_Dgram::implementation (void) const
01254 {
01255 return this->implementation_;
01256 }
01257
01258
01259
01260 int
01261 ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const
01262 {
01263 return this->implementation ()->remote_address (addr);
01264 }
01265
01266 ACE_Message_Block*
01267 ACE_Asynch_Read_Dgram::Result::message_block (void) const
01268 {
01269 return this->implementation ()->message_block ();
01270 }
01271
01272 int
01273 ACE_Asynch_Read_Dgram::Result::flags (void) const
01274 {
01275 return this->implementation ()->flags ();
01276 }
01277
01278 size_t
01279 ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const
01280 {
01281 return this->implementation ()->bytes_to_read ();
01282 }
01283
01284 ACE_HANDLE
01285 ACE_Asynch_Read_Dgram::Result::handle (void) const
01286 {
01287 return this->implementation ()->handle();
01288 }
01289
01290 ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation)
01291 : ACE_Asynch_Result (implementation),
01292 implementation_ (implementation)
01293 {
01294 }
01295
01296 ACE_Asynch_Read_Dgram::Result::~Result (void)
01297 {
01298 }
01299
01300 ACE_Asynch_Read_Dgram_Result_Impl *
01301 ACE_Asynch_Read_Dgram::Result::implementation (void) const
01302 {
01303 return this->implementation_;
01304 }
01305
01306
01307
01308
01309 ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void)
01310 : implementation_ (0)
01311 {
01312 }
01313
01314 ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void)
01315 {
01316
01317 delete this->implementation_;
01318 this->implementation_ = 0;
01319 }
01320
01321 int
01322 ACE_Asynch_Write_Dgram::open (ACE_Handler &handler,
01323 ACE_HANDLE handle,
01324 const void *completion_key,
01325 ACE_Proactor *proactor)
01326 {
01327
01328 proactor = this->get_proactor (proactor, handler);
01329
01330
01331 if ((this->implementation_ = proactor->create_asynch_write_dgram ()) == 0)
01332 return -1;
01333
01334
01335 return ACE_Asynch_Operation::open (handler,
01336 handle,
01337 completion_key,
01338 proactor);
01339 }
01340
01341 ssize_t
01342 ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
01343 size_t &number_of_bytes_sent,
01344 int flags,
01345 const ACE_Addr& remote_addr,
01346 const void *act,
01347 int priority,
01348 int signal_number)
01349 {
01350 if (0 == this->implementation_)
01351 {
01352 errno = EFAULT;
01353 return -1;
01354 }
01355 return this->implementation_->send (message_block,
01356 number_of_bytes_sent,
01357 flags,
01358 remote_addr,
01359 act,
01360 priority,
01361 signal_number);
01362 }
01363
01364 ACE_Asynch_Operation_Impl *
01365 ACE_Asynch_Write_Dgram::implementation (void) const
01366 {
01367 return this->implementation_;
01368 }
01369
01370
01371
01372 size_t
01373 ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const
01374 {
01375 return this->implementation ()->bytes_to_write ();
01376 }
01377
01378 ACE_Message_Block*
01379 ACE_Asynch_Write_Dgram::Result::message_block () const
01380 {
01381 return this->implementation ()->message_block ();
01382 }
01383
01384 int
01385 ACE_Asynch_Write_Dgram::Result::flags (void) const
01386 {
01387 return this->implementation ()->flags ();
01388 }
01389
01390 ACE_HANDLE
01391 ACE_Asynch_Write_Dgram::Result::handle (void) const
01392 {
01393 return this->implementation ()->handle ();
01394 }
01395
01396 ACE_Asynch_Write_Dgram_Result_Impl *
01397 ACE_Asynch_Write_Dgram::Result::implementation (void) const
01398 {
01399 return this->implementation_;
01400 }
01401
01402 ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation)
01403 : ACE_Asynch_Result (implementation),
01404 implementation_ (implementation)
01405 {
01406 }
01407
01408 ACE_Asynch_Write_Dgram::Result::~Result (void)
01409 {
01410 }
01411
01412 ACE_END_VERSIONED_NAMESPACE_DECL
01413
01414 #endif