TAO_DIOP_Connector Class Reference

DIOP-specific Connector bridge for pluggable protocols. More...

#include <DIOP_Connector.h>

Inheritance diagram for TAO_DIOP_Connector:

Inheritance graph
[legend]
Collaboration diagram for TAO_DIOP_Connector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_DIOP_Connector (CORBA::Boolean flag=false)
 Constructor.

 ~TAO_DIOP_Connector (void)
 Destructor.

The TAO_Connector Methods
Please check the documentation in Transport_Connector.h for details.

int open (TAO_ORB_Core *orb_core)
int close (void)
TAO_Profilecreate_profile (TAO_InputCDR &cdr)
virtual int check_prefix (const char *endpoint)
virtual char object_key_delimiter (void) const

Protected Member Functions

int cancel_svc_handler (TAO_Connection_Handler *svc_handler)
 Cancel the passed cvs handler from the connector.

More TAO_Connector Methods
Please check the documentation in Transport_Connector.h for details.

int set_validate_endpoint (TAO_Endpoint *ep)
TAO_Transportmake_connection (TAO::Profile_Transport_Resolver *r, TAO_Transport_Descriptor_Interface &desc, ACE_Time_Value *timeout=0)
virtual TAO_Profilemake_profile ()

Protected Attributes

CORBA::Boolean lite_flag_
 Do we need to use a GIOP_Lite for sending messages?


Private Types

typedef ACE_Hash_Map_Iterator_Ex<
ACE_INET_Addr, TAO_DIOP_Connection_Handler *,
ACE_Hash< ACE_INET_Addr >,
ACE_Equal_To< ACE_INET_Addr >,
ACE_Null_Mutex
SvcHandlerIterator

Private Member Functions

TAO_DIOP_Endpointremote_endpoint (TAO_Endpoint *ep)
 Return the remote endpoint, a helper function.


Private Attributes

ACE_Hash_Map_Manager_Ex< ACE_INET_Addr,
TAO_DIOP_Connection_Handler *,
ACE_Hash< ACE_INET_Addr >,
ACE_Equal_To< ACE_INET_Addr >,
ACE_Null_Mutex
svc_handler_table_

Detailed Description

DIOP-specific Connector bridge for pluggable protocols.

Concrete instance of the TAO_Connector class. Responsible for establishing a connection with a server and is called from the Connector_Registory.

Definition at line 47 of file DIOP_Connector.h.


Member Typedef Documentation

typedef ACE_Hash_Map_Iterator_Ex< ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex > TAO_DIOP_Connector::SvcHandlerIterator [private]
 

Definition at line 115 of file DIOP_Connector.h.

Referenced by close().


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_DIOP_Connector::TAO_DIOP_Connector CORBA::Boolean  flag = false  ) 
 

Constructor.

Definition at line 28 of file DIOP_Connector.cpp.

References TAO_TAG_DIOP_PROFILE.

00029   : TAO_Connector (TAO_TAG_DIOP_PROFILE),
00030     lite_flag_ (flag)
00031 {
00032 }

TAO_DIOP_Connector::~TAO_DIOP_Connector void   ) 
 

Destructor.

Definition at line 34 of file DIOP_Connector.cpp.

00035 {
00036 }


Member Function Documentation

int TAO_DIOP_Connector::cancel_svc_handler TAO_Connection_Handler svc_handler  )  [protected, virtual]
 

Cancel the passed cvs handler from the connector.

Implements TAO_Connector.

Definition at line 234 of file DIOP_Connector.cpp.

00236 {
00237   return 0;
00238 }

int TAO_DIOP_Connector::check_prefix const char *  endpoint  )  [virtual]
 

Implements TAO_Connector.

Definition at line 188 of file DIOP_Connector.cpp.

References ACE_OS::strchr(), ACE_OS::strlen(), and ACE_OS::strncasecmp().

00189 {
00190   // Check for a valid string
00191   if (!endpoint || !*endpoint)
00192     return -1;  // Failure
00193 
00194   const char *protocol[] = { "diop", "dioploc" };
00195 
00196   size_t const slot = ACE_OS::strchr (endpoint, ':') - endpoint;
00197 
00198   size_t const len0 = ACE_OS::strlen (protocol[0]);
00199   size_t const len1 = ACE_OS::strlen (protocol[1]);
00200 
00201   // Check for the proper prefix in the IOR.  If the proper prefix
00202   // isn't in the IOR then it is not an IOR we can use.
00203   if (slot == len0
00204       && ACE_OS::strncasecmp (endpoint, protocol[0], len0) == 0)
00205     return 0;
00206   else if (slot == len1
00207            && ACE_OS::strncasecmp (endpoint, protocol[1], len1) == 0)
00208     return 0;
00209 
00210   return -1;
00211   // Failure: not an DIOP IOR
00212   // DO NOT throw an exception here.
00213 }

int TAO_DIOP_Connector::close void   )  [virtual]
 

Implements TAO_Connector.

Definition at line 53 of file DIOP_Connector.cpp.

References ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::done(), svc_handler_table_, and SvcHandlerIterator.

00054 {
00055   // The list of service handlers cleans itself??
00056   SvcHandlerIterator iter (svc_handler_table_);
00057 
00058   while (!iter.done ())
00059     {
00060       (*iter).int_id_->remove_reference ();
00061       iter++;
00062     }
00063 
00064   // @@ Michael: We do not use regular connection management.
00065   return 0;
00066 }

TAO_Profile * TAO_DIOP_Connector::create_profile TAO_InputCDR cdr  )  [virtual]
 

Implements TAO_Connector.

Definition at line 149 of file DIOP_Connector.cpp.

References TAO_Profile::_decr_refcnt(), ACE_NEW_RETURN, and TAO_Profile::decode().

00150 {
00151   TAO_Profile *pfile = 0;
00152   ACE_NEW_RETURN (pfile,
00153                   TAO_DIOP_Profile (this->orb_core ()),
00154                   0);
00155 
00156   int const r = pfile->decode (cdr);
00157   if (r == -1)
00158     {
00159       pfile->_decr_refcnt ();
00160       pfile = 0;
00161     }
00162 
00163   return pfile;
00164 }

TAO_Transport * TAO_DIOP_Connector::make_connection TAO::Profile_Transport_Resolver r,
TAO_Transport_Descriptor_Interface desc,
ACE_Time_Value timeout = 0
[protected, virtual]
 

Implements TAO_Connector.

Definition at line 101 of file DIOP_Connector.cpp.

References ACE_DEBUG, ACE_NEW_RETURN, ACE_TEXT, ACE_Event_Handler::add_reference(), TAO_DIOP_Connection_Handler::addr(), ACE_Hash_Map_Manager_Ex< ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash< ACE_INET_Addr >, ACE_Equal_To< ACE_INET_Addr >, ACE_Null_Mutex >::bind(), TAO_Transport_Descriptor_Interface::endpoint(), ACE_Hash_Map_Manager_Ex< ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash< ACE_INET_Addr >, ACE_Equal_To< ACE_INET_Addr >, ACE_Null_Mutex >::find(), TAO_DIOP_Connection_Handler::get_handle(), LM_DEBUG, TAO_DIOP_Connection_Handler::local_addr(), TAO_DIOP_Endpoint::object_addr(), TAO_DIOP_Connection_Handler::open(), remote_endpoint(), svc_handler_table_, TAO_debug_level, and TAO_Connection_Handler::transport().

00104 {
00105   TAO_DIOP_Endpoint *diop_endpoint =
00106     this->remote_endpoint (desc.endpoint ());
00107 
00108   if (diop_endpoint == 0)
00109     return 0;
00110 
00111   const ACE_INET_Addr &remote_address =
00112     diop_endpoint->object_addr ();
00113 
00114   TAO_DIOP_Connection_Handler *svc_handler = 0;
00115 
00116   if (svc_handler_table_.find (remote_address, svc_handler) == -1)
00117     {
00118       TAO_DIOP_Connection_Handler *svc_handler_i = 0;
00119       ACE_NEW_RETURN (svc_handler_i,
00120                       TAO_DIOP_Connection_Handler (this->orb_core (),
00121                                                    this->lite_flag_),
00122                       0);
00123 
00124       svc_handler_i->local_addr (ACE_sap_any_cast (ACE_INET_Addr &));
00125       svc_handler_i->addr (remote_address);
00126 
00127       svc_handler_i->open (0);
00128 
00129       svc_handler_table_.bind (remote_address,
00130                                svc_handler_i);
00131       svc_handler = svc_handler_i;
00132 
00133       if (TAO_debug_level > 2)
00134         ACE_DEBUG ((LM_DEBUG,
00135                     ACE_TEXT ("(%P|%t) DIOP_Connector::connect - ")
00136                     ACE_TEXT ("new connection on HANDLE %d\n"),
00137                     svc_handler->get_handle ()));
00138    }
00139 
00140   // @@ Michael: We do not use regular connection management.
00141   svc_handler->add_reference ();
00142   TAO_Transport *transport =
00143     svc_handler->transport ();
00144 
00145   return transport;
00146 }

TAO_Profile * TAO_DIOP_Connector::make_profile  )  [protected, virtual]
 

Implements TAO_Connector.

Definition at line 167 of file DIOP_Connector.cpp.

References ACE_CHECK_RETURN, and ACE_NEW_THROW_EX.

00168 {
00169   // The endpoint should be of the form:
00170   //    N.n@host:port/object_key
00171   // or:
00172   //    host:port/object_key
00173 
00174   TAO_Profile *profile = 0;
00175   ACE_NEW_THROW_EX (profile,
00176                     TAO_DIOP_Profile (this->orb_core ()),
00177                     CORBA::NO_MEMORY (
00178                       CORBA::SystemException::_tao_minor_code (
00179                         TAO::VMCID,
00180                         ENOMEM),
00181                       CORBA::COMPLETED_NO));
00182   ACE_CHECK_RETURN (0);
00183 
00184   return profile;
00185 }

char TAO_DIOP_Connector::object_key_delimiter void   )  const [virtual]
 

Implements TAO_Connector.

Definition at line 216 of file DIOP_Connector.cpp.

00217 {
00218   return TAO_DIOP_Profile::object_key_delimiter_;
00219 }

int TAO_DIOP_Connector::open TAO_ORB_Core orb_core  )  [virtual]
 

Implements TAO_Connector.

Definition at line 39 of file DIOP_Connector.cpp.

References TAO_Connector::create_connect_strategy(), and TAO_Connector::orb_core().

00040 {
00041   this->orb_core (orb_core);
00042 
00043   // Create our connect strategy
00044   if (this->create_connect_strategy () == -1)
00045     return -1;
00046 
00047   // @@ Michael: We do not use regular connection management.
00048 
00049   return 0;
00050 }

TAO_DIOP_Endpoint * TAO_DIOP_Connector::remote_endpoint TAO_Endpoint ep  )  [private]
 

Return the remote endpoint, a helper function.

Definition at line 222 of file DIOP_Connector.cpp.

References TAO_Endpoint::tag(), and TAO_TAG_DIOP_PROFILE.

Referenced by make_connection(), and set_validate_endpoint().

00223 {
00224   if (endpoint->tag () != TAO_TAG_DIOP_PROFILE)
00225     return 0;
00226 
00227   TAO_DIOP_Endpoint *diop_endpoint =
00228     dynamic_cast<TAO_DIOP_Endpoint *> (endpoint );
00229 
00230   return diop_endpoint;
00231 }

int TAO_DIOP_Connector::set_validate_endpoint TAO_Endpoint ep  )  [protected, virtual]
 

Implements TAO_Connector.

Definition at line 69 of file DIOP_Connector.cpp.

References ACE_DEBUG, ACE_TEXT, ACE_Addr::get_type(), LM_DEBUG, TAO_DIOP_Endpoint::object_addr(), remote_endpoint(), and TAO_debug_level.

00070 {
00071   TAO_DIOP_Endpoint *diop_endpoint =
00072     this->remote_endpoint (endpoint);
00073 
00074   if (diop_endpoint == 0)
00075     return -1;
00076 
00077   const ACE_INET_Addr &remote_address =
00078     diop_endpoint->object_addr ();
00079 
00080   // Verify that the remote ACE_INET_Addr was initialized properly.
00081   // Failure can occur if hostname lookup failed when initializing the
00082   // remote ACE_INET_Addr.
00083   if (remote_address.get_type () != AF_INET)
00084     {
00085       if (TAO_debug_level > 0)
00086         {
00087           ACE_DEBUG ((LM_DEBUG,
00088                       ACE_TEXT ("TAO (%P|%t) DIOP connection failed.\n")
00089                       ACE_TEXT ("TAO (%P|%t) This is most likely ")
00090                       ACE_TEXT ("due to a hostname lookup ")
00091                       ACE_TEXT ("failure.\n")));
00092         }
00093 
00094       return -1;
00095     }
00096 
00097   return 0;
00098 }


Member Data Documentation

CORBA::Boolean TAO_DIOP_Connector::lite_flag_ [protected]
 

Do we need to use a GIOP_Lite for sending messages?

Definition at line 96 of file DIOP_Connector.h.

ACE_Hash_Map_Manager_Ex< ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex > TAO_DIOP_Connector::svc_handler_table_ [private]
 

Definition at line 109 of file DIOP_Connector.h.

Referenced by close(), and make_connection().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:41:07 2006 for TAO_Strategies by doxygen 1.3.6