ACE_WIN32_Asynch_Read_Dgram_Result Class Reference

This class provides concrete implementation for ACE_Asynch_Read_Dgram::Result class. More...

#include <WIN32_Asynch_IO.h>

Inheritance diagram for ACE_WIN32_Asynch_Read_Dgram_Result:

Inheritance graph
[legend]
Collaboration diagram for ACE_WIN32_Asynch_Read_Dgram_Result:

Collaboration graph
[legend]
List of all members.

Public Member Functions

size_t bytes_to_read (void) const
ACE_Message_Blockmessage_block (void) const
 Message block which contains the read data.

int remote_address (ACE_Addr &addr) const
 The address of where the packet came from.

sockaddr * saddr () const
int flags (void) const
 The flags used in the read.

ACE_HANDLE handle (void) const
 I/O handle used for reading.

size_t bytes_transferred (void) const
 Number of bytes transferred by the operation.

const void * act (void) const
 ACT associated with the operation.

int success (void) const
 Did the operation succeed?

const void * completion_key (void) const
u_long error (void) const
 Error value if the operation fail.

ACE_HANDLE event (void) const
 Event associated with the OVERLAPPED structure.

u_long offset (void) const
 This really make sense only when doing file I/O.

u_long offset_high (void) const
 Offset_high associated with the OVERLAPPED structure.

int priority (void) const
int signal_number (void) const
 No-op. Returns 0.

int post_completion (ACE_Proactor_Impl *proactor)
 Post to the Proactor's completion port.


Protected Member Functions

 ACE_WIN32_Asynch_Read_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, int flags, int protocol_family, const void *act, ACE_HANDLE event, int priority, int signal_number=0)
virtual void complete (size_t bytes_transferred, int success, const void *completion_key, u_long error)
 Proactor will call this method when the read completes.

virtual ~ACE_WIN32_Asynch_Read_Dgram_Result (void)
 Destructor.


Protected Attributes

size_t bytes_to_read_
 Bytes requested when the asynchronous read was initiated.

ACE_Message_Blockmessage_block_
 Message block for reading the data into.

ACE_Addrremote_address_
 The address of where the packet came from.

int addr_len_
int flags_
 The flags used in the read.

ACE_HANDLE handle_
 I/O handle used for reading.


Friends

class ACE_WIN32_Asynch_Read_Dgram
 Factory class will have special permissions.

class ACE_WIN32_Proactor
 Proactor class has special permission.


Detailed Description

This class provides concrete implementation for ACE_Asynch_Read_Dgram::Result class.

Definition at line 1559 of file WIN32_Asynch_IO.h.


Constructor & Destructor Documentation

ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result const ACE_Handler::Proxy_Ptr handler_proxy,
ACE_HANDLE  handle,
ACE_Message_Block message_block,
size_t  bytes_to_read,
int  flags,
int  protocol_family,
const void *  act,
ACE_HANDLE  event,
int  priority,
int  signal_number = 0
[protected]
 

Constructor is protected since creation is limited to ACE_Asynch_Read_Dgram factory.

Definition at line 3183 of file WIN32_Asynch_IO.cpp.

References ACE_ASSERT, ACE_NEW, ACE_Addr::get_size(), and ACE_Handler::Proxy_Ptr.

03194   : ACE_Asynch_Result_Impl (),
03195     ACE_Asynch_Read_Dgram_Result_Impl(),
03196     ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number),
03197     bytes_to_read_ (bytes_to_read),
03198     message_block_ (message_block),
03199     remote_address_ (0),
03200     addr_len_ (0),
03201     flags_ (flags),
03202     handle_ (handle)
03203 {
03204   ACE_ASSERT (protocol_family == PF_INET); // only supporting INET addresses
03205 
03206   ACE_NEW (remote_address_, ACE_INET_Addr);
03207   addr_len_ = remote_address_->get_size ();
03208 
03209   ACE_UNUSED_ARG (protocol_family);
03210 }

ACE_WIN32_Asynch_Read_Dgram_Result::~ACE_WIN32_Asynch_Read_Dgram_Result void   )  [protected, virtual]
 

Destructor.

Definition at line 3251 of file WIN32_Asynch_IO.cpp.

03252 {
03253   delete this->remote_address_;
03254 }


Member Function Documentation

const void * ACE_WIN32_Asynch_Read_Dgram_Result::act void   )  const [virtual]
 

ACT associated with the operation.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3124 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::act().

03125 {
03126   return ACE_WIN32_Asynch_Result::act ();
03127 }

size_t ACE_WIN32_Asynch_Read_Dgram_Result::bytes_to_read void   )  const [virtual]
 

The number of bytes which were requested at the start of the asynchronous read.

Implements ACE_Asynch_Read_Dgram_Result_Impl.

Definition at line 3070 of file WIN32_Asynch_IO.cpp.

03071 {
03072   return this->bytes_to_read_;
03073 }

size_t ACE_WIN32_Asynch_Read_Dgram_Result::bytes_transferred void   )  const [virtual]
 

Number of bytes transferred by the operation.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3118 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::bytes_transferred().

03119 {
03120   return ACE_WIN32_Asynch_Result::bytes_transferred ();
03121 }

void ACE_WIN32_Asynch_Read_Dgram_Result::complete size_t  bytes_transferred,
int  success,
const void *  completion_key,
u_long  error
[protected, virtual]
 

Proactor will call this method when the read completes.

Implements ACE_Asynch_Result_Impl.

Definition at line 3213 of file WIN32_Asynch_IO.cpp.

References ACE_Message_Block::cont(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_Handler::handle_read_dgram(), ACE_Addr::set_size(), ACE_Message_Block::space(), and ACE_Message_Block::wr_ptr().

03217 {
03218   // Copy the data which was returned by GetQueuedCompletionStatus
03219   this->bytes_transferred_ = bytes_transferred;
03220   this->success_ = success;
03221   this->completion_key_ = completion_key;
03222   this->error_ = error;
03223 
03224   // Appropriately move the pointers in the message block.
03225   for (ACE_Message_Block* mb = this->message_block_;
03226        (mb != 0) && (bytes_transferred > 0);
03227        mb = mb->cont ())
03228     {
03229       size_t len_part = mb->space ();
03230 
03231       if ( len_part > bytes_transferred)
03232         len_part = bytes_transferred;
03233 
03234       mb->wr_ptr (len_part);
03235 
03236       bytes_transferred -= len_part;
03237     }
03238 
03239   // Adjust the address length
03240   this->remote_address_->set_size (this->addr_len_);
03241 
03242   // Create the interface result class.
03243   ACE_Asynch_Read_Dgram::Result result (this);
03244 
03245   // Call the application handler.
03246   ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
03247   if (handler != 0)
03248     handler->handle_read_dgram (result);
03249 }

const void * ACE_WIN32_Asynch_Read_Dgram_Result::completion_key void   )  const [virtual]
 

This returns the ACT associated with the handle when it was registered with the I/O completion port. This ACT is not the same as the ACT associated with the asynchronous operation.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3136 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::completion_key().

03137 {
03138   return ACE_WIN32_Asynch_Result::completion_key ();
03139 }

u_long ACE_WIN32_Asynch_Read_Dgram_Result::error void   )  const [virtual]
 

Error value if the operation fail.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3142 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::error().

03143 {
03144   return ACE_WIN32_Asynch_Result::error ();
03145 }

ACE_HANDLE ACE_WIN32_Asynch_Read_Dgram_Result::event void   )  const [virtual]
 

Event associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3148 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::event().

03149 {
03150   return ACE_WIN32_Asynch_Result::event ();
03151 }

int ACE_WIN32_Asynch_Read_Dgram_Result::flags void   )  const [virtual]
 

The flags used in the read.

Implements ACE_Asynch_Read_Dgram_Result_Impl.

Definition at line 3106 of file WIN32_Asynch_IO.cpp.

03107 {
03108   return this->flags_;
03109 }

ACE_HANDLE ACE_WIN32_Asynch_Read_Dgram_Result::handle void   )  const [virtual]
 

I/O handle used for reading.

Implements ACE_Asynch_Read_Dgram_Result_Impl.

Definition at line 3112 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Read_Dgram::recv().

03113 {
03114   return this->handle_;
03115 }

ACE_Message_Block * ACE_WIN32_Asynch_Read_Dgram_Result::message_block void   )  const [virtual]
 

Message block which contains the read data.

Implements ACE_Asynch_Read_Dgram_Result_Impl.

Definition at line 3076 of file WIN32_Asynch_IO.cpp.

03077 {
03078   return this->message_block_;
03079 }

u_long ACE_WIN32_Asynch_Read_Dgram_Result::offset void   )  const [virtual]
 

This really make sense only when doing file I/O.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3154 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset().

03155 {
03156   return ACE_WIN32_Asynch_Result::offset ();
03157 }

u_long ACE_WIN32_Asynch_Read_Dgram_Result::offset_high void   )  const [virtual]
 

Offset_high associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3160 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset_high().

03161 {
03162   return ACE_WIN32_Asynch_Result::offset_high ();
03163 }

int ACE_WIN32_Asynch_Read_Dgram_Result::post_completion ACE_Proactor_Impl proactor  )  [virtual]
 

Post to the Proactor's completion port.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3178 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::post_completion().

03179 {
03180   return ACE_WIN32_Asynch_Result::post_completion (proactor);
03181 }

int ACE_WIN32_Asynch_Read_Dgram_Result::priority void   )  const [virtual]
 

The priority of the asynchronous operation. Currently, this is not supported on Win32.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3166 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::priority().

03167 {
03168   return ACE_WIN32_Asynch_Result::priority ();
03169 }

int ACE_WIN32_Asynch_Read_Dgram_Result::remote_address ACE_Addr addr  )  const [virtual]
 

The address of where the packet came from.

Implements ACE_Asynch_Read_Dgram_Result_Impl.

Definition at line 3083 of file WIN32_Asynch_IO.cpp.

References ACE_Addr::get_size(), ACE_Addr::get_type(), and ACE_Addr::set_addr().

03084 {
03085  int retVal = -1;  // failure
03086 
03087   // make sure the addresses are of the same type
03088   if (addr.get_type () == this->remote_address_->get_type ())
03089   { // copy the remote_address_ into addr
03090     addr.set_addr (this->remote_address_->get_addr (),
03091                    this->remote_address_->get_size ());
03092     retVal = 0; // success
03093   }
03094 
03095   return retVal;
03096 }

sockaddr * ACE_WIN32_Asynch_Read_Dgram_Result::saddr  )  const
 

Definition at line 3099 of file WIN32_Asynch_IO.cpp.

References ACE_Addr::get_addr().

Referenced by ACE_WIN32_Asynch_Read_Dgram::recv().

03100 {
03101   return (sockaddr *) this->remote_address_->get_addr ();
03102 }

int ACE_WIN32_Asynch_Read_Dgram_Result::signal_number void   )  const [virtual]
 

No-op. Returns 0.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3172 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::signal_number().

03173 {
03174   return ACE_WIN32_Asynch_Result::signal_number ();
03175 }

int ACE_WIN32_Asynch_Read_Dgram_Result::success void   )  const [virtual]
 

Did the operation succeed?

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 3130 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::success().

03131 {
03132   return ACE_WIN32_Asynch_Result::success ();
03133 }


Friends And Related Function Documentation

friend class ACE_WIN32_Asynch_Read_Dgram [friend]
 

Factory class will have special permissions.

Definition at line 1563 of file WIN32_Asynch_IO.h.

friend class ACE_WIN32_Proactor [friend]
 

Proactor class has special permission.

Reimplemented from ACE_WIN32_Asynch_Result.

Definition at line 1566 of file WIN32_Asynch_IO.h.


Member Data Documentation

int ACE_WIN32_Asynch_Read_Dgram_Result::addr_len_ [protected]
 

Definition at line 1660 of file WIN32_Asynch_IO.h.

Referenced by ACE_WIN32_Asynch_Read_Dgram::recv().

size_t ACE_WIN32_Asynch_Read_Dgram_Result::bytes_to_read_ [protected]
 

Bytes requested when the asynchronous read was initiated.

Definition at line 1652 of file WIN32_Asynch_IO.h.

int ACE_WIN32_Asynch_Read_Dgram_Result::flags_ [protected]
 

The flags used in the read.

Definition at line 1663 of file WIN32_Asynch_IO.h.

Referenced by ACE_WIN32_Asynch_Read_Dgram::recv().

ACE_HANDLE ACE_WIN32_Asynch_Read_Dgram_Result::handle_ [protected]
 

I/O handle used for reading.

Definition at line 1666 of file WIN32_Asynch_IO.h.

ACE_Message_Block* ACE_WIN32_Asynch_Read_Dgram_Result::message_block_ [protected]
 

Message block for reading the data into.

Definition at line 1655 of file WIN32_Asynch_IO.h.

ACE_Addr* ACE_WIN32_Asynch_Read_Dgram_Result::remote_address_ [protected]
 

The address of where the packet came from.

Definition at line 1658 of file WIN32_Asynch_IO.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:32:54 2006 for ACE by doxygen 1.3.6