Asynch_IO.cpp

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

Generated on Thu Nov 9 09:41:46 2006 for ACE by doxygen 1.3.6