#include <UDP.h>
Inheritance diagram for TAO_AV_UDP_Transport:
Public Member Functions | |
TAO_AV_UDP_Transport (void) | |
TAO_AV_UDP_Transport (TAO_AV_UDP_Flow_Handler *handler) | |
virtual | ~TAO_AV_UDP_Transport (void) |
virtual int | open (ACE_Addr *addr) |
virtual int | close (void) |
virtual int | mtu (void) |
Write the complete Message_Block chain to the connection. | |
virtual ACE_Addr * | get_peer_addr (void) |
virtual int | set_remote_address (const ACE_INET_Addr &address) |
virtual ssize_t | send (const ACE_Message_Block *mblk, ACE_Time_Value *s=0) |
Write the complete Message_Block chain to the connection. | |
virtual ssize_t | send (const char *buf, size_t len, ACE_Time_Value *s=0) |
Write the contents of the buffer of length len to the connection. | |
virtual ssize_t | send (const iovec *iov, int iovcnt, ACE_Time_Value *s=0) |
Write the contents of iovcnt iovec's to the connection. | |
virtual ssize_t | recv (char *buf, size_t len, ACE_Time_Value *s=0) |
Read len bytes from into buf. | |
virtual ssize_t | recv (char *buf, size_t len, int flags, ACE_Time_Value *s=0) |
Read len bytes from into buf using flags. | |
virtual ssize_t | recv (iovec *iov, int iovcnt, ACE_Time_Value *s=0) |
Read received data into the iovec buffers. | |
TAO_AV_UDP_Flow_Handler * | handler (void) |
Protected Attributes | |
TAO_AV_UDP_Flow_Handler * | handler_ |
ACE_Addr * | addr_ |
ACE_INET_Addr | peer_addr_ |
Definition at line 48 of file UDP.h.
TAO_AV_UDP_Transport::TAO_AV_UDP_Transport | ( | void | ) |
TAO_AV_UDP_Transport::TAO_AV_UDP_Transport | ( | TAO_AV_UDP_Flow_Handler * | handler | ) |
TAO_AV_UDP_Transport::~TAO_AV_UDP_Transport | ( | void | ) | [virtual] |
int TAO_AV_UDP_Transport::close | ( | void | ) | [virtual] |
ACE_Addr * TAO_AV_UDP_Transport::get_peer_addr | ( | void | ) | [virtual] |
Implements TAO_AV_Transport.
Definition at line 203 of file UDP.cpp.
References peer_addr_.
00204 { 00205 return &this->peer_addr_; 00206 }
TAO_AV_UDP_Flow_Handler* TAO_AV_UDP_Transport::handler | ( | void | ) | [inline] |
int TAO_AV_UDP_Transport::mtu | ( | void | ) | [virtual] |
Write the complete Message_Block chain to the connection.
Implements TAO_AV_Transport.
Definition at line 197 of file UDP.cpp.
int TAO_AV_UDP_Transport::open | ( | ACE_Addr * | addr | ) | [virtual] |
ssize_t TAO_AV_UDP_Transport::recv | ( | iovec * | iov, | |
int | iovcnt, | |||
ACE_Time_Value * | s = 0 | |||
) | [virtual] |
Read received data into the iovec buffers.
Implements TAO_AV_Transport.
Definition at line 313 of file UDP.cpp.
References TAO_AV_UDP_Flow_Handler::get_socket(), handler_, and ACE_SOCK_Dgram::recv().
00316 { 00317 return handler_->get_socket ()->recv (iov,this->peer_addr_,0,timeout); 00318 }
ssize_t TAO_AV_UDP_Transport::recv | ( | char * | buf, | |
size_t | len, | |||
int | flags, | |||
ACE_Time_Value * | s = 0 | |||
) | [virtual] |
Read len bytes from into buf using flags.
Implements TAO_AV_Transport.
Definition at line 300 of file UDP.cpp.
References TAO_AV_UDP_Flow_Handler::get_socket(), handler_, and ACE_SOCK_Dgram::recv().
00304 { 00305 return this->handler_->get_socket ()->recv (buf, 00306 len, 00307 this->peer_addr_, 00308 flags, 00309 timeout); 00310 }
ssize_t TAO_AV_UDP_Transport::recv | ( | char * | buf, | |
size_t | len, | |||
ACE_Time_Value * | s = 0 | |||
) | [virtual] |
Read len bytes from into buf.
Implements TAO_AV_Transport.
Definition at line 292 of file UDP.cpp.
References TAO_AV_UDP_Flow_Handler::get_socket(), handler_, and ACE_SOCK_Dgram::recv().
00295 { 00296 return this->handler_->get_socket ()->recv (buf, len,this->peer_addr_); 00297 }
ssize_t TAO_AV_UDP_Transport::send | ( | const iovec * | iov, | |
int | iovcnt, | |||
ACE_Time_Value * | s = 0 | |||
) | [virtual] |
Write the contents of iovcnt iovec's to the connection.
Implements TAO_AV_Transport.
Definition at line 281 of file UDP.cpp.
References TAO_AV_UDP_Flow_Handler::get_socket(), handler_, and ACE_SOCK_Dgram::send().
00284 { 00285 return this->handler_->get_socket ()->send ((const iovec *) iov, 00286 iovcnt, 00287 this->peer_addr_); 00288 00289 }
ssize_t TAO_AV_UDP_Transport::send | ( | const char * | buf, | |
size_t | len, | |||
ACE_Time_Value * | s = 0 | |||
) | [virtual] |
Write the contents of the buffer of length len to the connection.
Implements TAO_AV_Transport.
Definition at line 268 of file UDP.cpp.
References ACE_DEBUG, ACE_INET_Addr::addr_to_string(), TAO_AV_UDP_Flow_Handler::get_socket(), handler_, LM_DEBUG, peer_addr_, ACE_SOCK_Dgram::send(), and TAO_debug_level.
00271 { 00272 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_UDP_Transport::send ")); 00273 char addr [BUFSIZ]; 00274 this->peer_addr_.addr_to_string (addr,BUFSIZ); 00275 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"to %s\n",addr)); 00276 00277 return this->handler_->get_socket ()->send (buf, len,this->peer_addr_); 00278 }
ssize_t TAO_AV_UDP_Transport::send | ( | const ACE_Message_Block * | mblk, | |
ACE_Time_Value * | s = 0 | |||
) | [virtual] |
Write the complete Message_Block chain to the connection.
Implements TAO_AV_Transport.
Definition at line 209 of file UDP.cpp.
References ACE_IOV_MAX, ACE_Message_Block::cont(), TAO_AV_UDP_Flow_Handler::get_socket(), handler_, and ACE_SOCK_Dgram::send().
00210 { 00211 // For the most part this was copied from GIOP::send_request and 00212 // friends. 00213 00214 iovec iov[ACE_IOV_MAX]; 00215 int iovcnt = 0; 00216 ssize_t n = 0; 00217 ssize_t nbytes = 0; 00218 00219 for (const ACE_Message_Block *i = mblk; 00220 i != 0; 00221 i = i->cont ()) 00222 { 00223 // Make sure there is something to send! 00224 if (i->length () > 0) 00225 { 00226 iov[iovcnt].iov_base = i->rd_ptr (); 00227 iov[iovcnt].iov_len = static_cast<u_long> (i->length ()); 00228 iovcnt++; 00229 00230 // The buffer is full make a OS call. @@ TODO this should 00231 // be optimized on a per-platform basis, for instance, some 00232 // platforms do not implement writev() there we should copy 00233 // the data into a buffer and call send_n(). In other cases 00234 // there may be some limits on the size of the iovec, there 00235 // we should set ACE_IOV_MAX to that limit. 00236 if (iovcnt == ACE_IOV_MAX) 00237 { 00238 n = this->handler_->get_socket ()->send ((const iovec *) iov, 00239 iovcnt, 00240 this->peer_addr_); 00241 00242 if (n < 1) 00243 return n; 00244 00245 nbytes += n; 00246 iovcnt = 0; 00247 } 00248 } 00249 } 00250 00251 // Check for remaining buffers to be sent! 00252 if (iovcnt != 0) 00253 { 00254 n = this->handler_->get_socket ()->send ((const iovec *) iov, 00255 iovcnt, 00256 this->peer_addr_); 00257 00258 if (n < 1) 00259 return n; 00260 00261 nbytes += n; 00262 } 00263 00264 return nbytes; 00265 }
int TAO_AV_UDP_Transport::set_remote_address | ( | const ACE_INET_Addr & | address | ) | [virtual] |
Definition at line 178 of file UDP.cpp.
References peer_addr_.
00179 { 00180 this->peer_addr_ = address; 00181 return 0; 00182 }
ACE_Addr* TAO_AV_UDP_Transport::addr_ [protected] |
TAO_AV_UDP_Flow_Handler* TAO_AV_UDP_Transport::handler_ [protected] |
ACE_INET_Addr TAO_AV_UDP_Transport::peer_addr_ [protected] |
Definition at line 103 of file UDP.h.
Referenced by get_peer_addr(), send(), and set_remote_address().