#include <IIOP_Transport.h>
Public Member Functions | |
TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler, TAO_ORB_Core *orb_core) | |
Constructor. | |
Protected Member Functions | |
virtual | ~TAO_IIOP_Transport (void) |
Destructor. | |
Private Member Functions | |
void | set_bidir_context_info (TAO_Operation_Details &opdetails) |
Set the Bidirectional context info in the service context list. | |
int | get_listen_point (IIOP::ListenPointList &listen_point_list, TAO_Acceptor *acceptor) |
Private Attributes | |
TAO_IIOP_Connection_Handler * | connection_handler_ |
Overridden Template Methods | |
Please check the documentation in "tao/Transport.h" for more details. | |
void | update_protocol_properties (int send_buffer_size, int recv_buffer_size, int no_delay, int enable_network_priority) |
Bridge method to call a similar method on the connection handler. | |
virtual int | send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, TAO_OutputCDR &stream, TAO_Message_Semantics message_semantics, ACE_Time_Value *max_wait_time) |
virtual int | send_message (TAO_OutputCDR &stream, TAO_Stub *stub=0, TAO_Message_Semantics message_semantics=TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait=0) |
Bridge method to call a similar method on the connection handler. | |
virtual int | tear_listen_point_list (TAO_InputCDR &cdr) |
Bridge method to call a similar method on the connection handler. | |
virtual TAO_Connection_Handler * | connection_handler_i (void) |
Bridge method to call a similar method on the connection handler. | |
virtual ACE_Event_Handler * | event_handler_i (void) |
Bridge method to call a similar method on the connection handler. | |
virtual ssize_t | send (iovec *iov, int iovcnt, size_t &bytes_transferred, const ACE_Time_Value *timeout=0) |
Bridge method to call a similar method on the connection handler. | |
virtual ssize_t | recv (char *buf, size_t len, const ACE_Time_Value *s=0) |
Bridge method to call a similar method on the connection handler. |
Specialization of the base TAO_Transport class to handle the IIOP protocol.
Definition at line 52 of file IIOP_Transport.h.
TAO_IIOP_Transport::TAO_IIOP_Transport | ( | TAO_IIOP_Connection_Handler * | handler, | |
TAO_ORB_Core * | orb_core | |||
) |
Constructor.
Definition at line 26 of file IIOP_Transport.cpp.
: TAO_Transport (IOP::TAG_INTERNET_IOP, orb_core) , connection_handler_ (handler) { }
TAO_IIOP_Transport::~TAO_IIOP_Transport | ( | void | ) | [protected, virtual] |
Destructor.
Protected destructor to enforce proper memory management through the reference counting mechanism.
Definition at line 34 of file IIOP_Transport.cpp.
{ }
TAO_Connection_Handler * TAO_IIOP_Transport::connection_handler_i | ( | void | ) | [virtual] |
Bridge method to call a similar method on the connection handler.
Implements TAO_Transport.
Definition at line 55 of file IIOP_Transport.cpp.
{ return this->connection_handler_; }
ACE_Event_Handler * TAO_IIOP_Transport::event_handler_i | ( | void | ) | [protected, virtual] |
Bridge method to call a similar method on the connection handler.
Implements TAO_Transport.
Definition at line 49 of file IIOP_Transport.cpp.
{ return this->connection_handler_; }
int TAO_IIOP_Transport::get_listen_point | ( | IIOP::ListenPointList & | listen_point_list, | |
TAO_Acceptor * | acceptor | |||
) | [private] |
Add the listen points in acceptor to the listen_point_list if this connection is in the same interface as that of the endpoints in the acceptor
Definition at line 338 of file IIOP_Transport.cpp.
{ TAO_IIOP_Acceptor *iiop_acceptor = dynamic_cast<TAO_IIOP_Acceptor *> (acceptor); if (iiop_acceptor == 0) return -1; // Get the array of endpoints serviced by TAO_IIOP_Acceptor const ACE_INET_Addr *endpoint_addr = iiop_acceptor->endpoints (); size_t count = iiop_acceptor->endpoint_count (); #if defined (TAO_USE_BROKEN_BIDIR) // Note: Looks like there is no point in sending the list of // endpoints on interfaces on which this connection has not // been established. If this is wrong, please correct me. ACE_INET_Addr local_addr; if (this->connection_handler_->peer ().get_local_addr (local_addr) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - IIOP_Transport::get_listen_point, ") ACE_TEXT ("could not resolve local host address\n")), -1); } #endif /* TAO_USE_BROKEN_BIDIR */ for (size_t index = 0; index < count; index++) { #if defined (TAO_USE_BROKEN_BIDIR) // Make sure port numbers are equal so the following comparison // only concerns the IP(v4/v6) address. local_addr.set_port_number (endpoint_addr[index].get_port_number ()); if (local_addr != endpoint_addr[index]) continue; #endif /* TAO_USE_BROKEN_BIDIR */ // Get the local address of the connection CORBA::String_var interface_name; // Get the hostname for the local address if (iiop_acceptor->hostname (this->orb_core_, endpoint_addr[index], interface_name.out ()) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - IIOP_Transport::get_listen_point, ") ACE_TEXT ("could not resolve local host name\n")), -1); } #if defined (ACE_HAS_IPV6) // If this is an IPv6 decimal linklocal address containing a scopeid than // remove the scopeid from the information being sent. const char *cp_scope = 0; if (endpoint_addr[index].get_type () == PF_INET6 && (cp_scope = ACE_OS::strchr (interface_name.in (), '%')) != 0) { CORBA::ULong len = cp_scope - interface_name.in (); interface_name[len] = '\0'; } #endif /* ACE_HAS_IPV6 */ // Get the count of the number of elements CORBA::ULong const len = listen_point_list.length (); // Increase the length by 1 listen_point_list.length (len + 1); // We have the connection and the acceptor endpoint on the // same interface IIOP::ListenPoint & point = listen_point_list[len]; point.host = CORBA::string_dup (interface_name.in ()); point.port = endpoint_addr[index].get_port_number (); if (TAO_debug_level >= 5) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("TAO (%P|%t) - Listen_Point_List[%d] = <%C:%d>\n"), len, point.host.in (), point.port)); } } return 1; }
ssize_t TAO_IIOP_Transport::recv | ( | char * | buf, | |
size_t | len, | |||
const ACE_Time_Value * | s = 0 | |||
) | [protected, virtual] |
Bridge method to call a similar method on the connection handler.
Implements TAO_Transport.
Definition at line 167 of file IIOP_Transport.cpp.
{ ssize_t const n = this->connection_handler_->peer ().recv (buf, len, max_wait_time); // Do not print the error message if it is a timeout, which could // occur in thread-per-connection. if (n == -1 && TAO_debug_level > 4 && errno != ETIME) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::recv, ") ACE_TEXT ("read failure - %m errno %d\n"), this->id (), ACE_ERRNO_GET)); } // Error handling if (n == -1) { if (errno == EWOULDBLOCK) return 0; return -1; } // Most of the errors handling is common for // Now the message has been read // @@ What are the other error handling here?? else if (n == 0) { return -1; } return n; }
ssize_t TAO_IIOP_Transport::send | ( | iovec * | iov, | |
int | iovcnt, | |||
size_t & | bytes_transferred, | |||
const ACE_Time_Value * | timeout = 0 | |||
) | [protected, virtual] |
Bridge method to call a similar method on the connection handler.
Implements TAO_Transport.
Definition at line 61 of file IIOP_Transport.cpp.
{ ssize_t const retval = this->connection_handler_->peer ().sendv (iov, iovcnt, max_wait_time); if (retval > 0) bytes_transferred = retval; else { if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::send, ") ACE_TEXT ("send failure (errno: %d) - %m\n"), this->id (), ACE_ERRNO_GET)); } } return retval; }
int TAO_IIOP_Transport::send_message | ( | TAO_OutputCDR & | stream, | |
TAO_Stub * | stub = 0 , |
|||
TAO_Message_Semantics | message_semantics = TAO_TWOWAY_REQUEST , |
|||
ACE_Time_Value * | max_time_wait = 0 | |||
) | [virtual] |
Bridge method to call a similar method on the connection handler.
Implements TAO_Transport.
Definition at line 229 of file IIOP_Transport.cpp.
{ // Format the message in the stream first if (this->messaging_object ()->format_message (stream, stub) != 0) return -1; // This guarantees to send all data (bytes) or return an error. ssize_t const n = this->send_message_shared (stub, message_semantics, stream.begin (), max_wait_time); if (n == -1) { // Dont try to be smart and request for %p in the debug // statement. If the event handler is destroyed the transport // would return -1 with errno set to ENOENT. %p then would dump // a core. %m would then be softer on this. if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::send_message, ") ACE_TEXT ("write failure - %m\n"), this->id ())); return -1; } return 1; }
int TAO_IIOP_Transport::send_request | ( | TAO_Stub * | stub, | |
TAO_ORB_Core * | orb_core, | |||
TAO_OutputCDR & | stream, | |||
TAO_Message_Semantics | message_semantics, | |||
ACE_Time_Value * | max_wait_time | |||
) | [virtual] |
Implements TAO_Transport.
Definition at line 208 of file IIOP_Transport.cpp.
{ if (this->ws_->sending_request (orb_core, message_semantics) == -1) return -1; if (this->send_message (stream, stub, message_semantics, max_wait_time) == -1) return -1; this->first_request_sent(); return 0; }
void TAO_IIOP_Transport::set_bidir_context_info | ( | TAO_Operation_Details & | opdetails | ) | [private, virtual] |
Set the Bidirectional context info in the service context list.
Reimplemented from TAO_Transport.
Definition at line 282 of file IIOP_Transport.cpp.
{ // Get a handle to the acceptor registry TAO_Acceptor_Registry &ar = this->orb_core ()->lane_resources ().acceptor_registry (); IIOP::ListenPointList listen_point_list; TAO_AcceptorSetIterator const end = ar.end (); for (TAO_AcceptorSetIterator acceptor = ar.begin (); acceptor != end; ++acceptor) { // Check whether it is an IIOP acceptor if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) { if (TAO_debug_level > 0) ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - IIOP_Transport::set_bidir_context_info, " "error getting listen_point\n")); return; } } } if (listen_point_list.length () == 0) { if (TAO_debug_level > 0) ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - IIOP_Transport::set_bidir_context_info, " "listen_point list is empty, client should send a list " "with at least one point\n")); return; } // We have the ListenPointList at this point. Create a output CDR // stream at this point TAO_OutputCDR cdr; // Marshal the information into the stream if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) || (!(cdr << listen_point_list))) return; // Add this info in to the svc_list opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, cdr); return; }
int TAO_IIOP_Transport::tear_listen_point_list | ( | TAO_InputCDR & | cdr | ) | [virtual] |
Bridge method to call a similar method on the connection handler.
Reimplemented from TAO_Transport.
Definition at line 262 of file IIOP_Transport.cpp.
{ CORBA::Boolean byte_order; if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) return -1; cdr.reset_byte_order (static_cast<int> (byte_order)); IIOP::ListenPointList listen_list; if (!(cdr >> listen_list)) return -1; // As we have received a bidirectional information, set the flag to // 0 (i.e., non-originating side) this->bidirectional_flag (0); return this->connection_handler_->process_listen_point_list (listen_list); }
void TAO_IIOP_Transport::update_protocol_properties | ( | int | send_buffer_size, | |
int | recv_buffer_size, | |||
int | no_delay, | |||
int | enable_network_priority | |||
) |
Bridge method to call a similar method on the connection handler.
The connection service handler used for accessing lower layer communication protocols.
Definition at line 135 of file IIOP_Transport.h.