TAO_UIPMC_Connector Class Reference

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

#include <UIPMC_Connector.h>

Inheritance diagram for TAO_UIPMC_Connector:

Inheritance graph
[legend]
Collaboration diagram for TAO_UIPMC_Connector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_UIPMC_Connector (CORBA::Boolean flag=0)
 Constructor.

 ~TAO_UIPMC_Connector (void)
 Destructor.

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 set_validate_endpoint (TAO_Endpoint *endpoint)
TAO_Transportmake_connection (TAO::Profile_Transport_Resolver *r, TAO_Transport_Descriptor_Interface &desc, ACE_Time_Value *timeout=0)
virtual TAO_Profilemake_profile ()
virtual int cancel_svc_handler (TAO_Connection_Handler *svc_handler)
 Cancel the passed cvs handler from the connector.


Private Types

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

Private Attributes

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

Detailed Description

UIPMC-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 44 of file UIPMC_Connector.h.


Member Typedef Documentation

typedef ACE_Hash_Map_Iterator_Ex< ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex > TAO_UIPMC_Connector::SvcHandlerIterator [private]
 

Definition at line 92 of file UIPMC_Connector.h.

Referenced by close().


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_UIPMC_Connector::TAO_UIPMC_Connector CORBA::Boolean  flag = 0  ) 
 

Constructor.

Definition at line 20 of file UIPMC_Connector.cpp.

00021   : TAO_Connector (IOP::TAG_UIPMC)
00022 {
00023 }

TAO_UIPMC_Connector::~TAO_UIPMC_Connector void   ) 
 

Destructor.

Definition at line 25 of file UIPMC_Connector.cpp.

00026 {
00027 }


Member Function Documentation

int TAO_UIPMC_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 207 of file UIPMC_Connector.cpp.

00209 {
00210   // Noop
00211   return 0;
00212 }

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

Implements TAO_Connector.

Definition at line 178 of file UIPMC_Connector.cpp.

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

00179 {
00180   // Check for a valid string
00181   if (!endpoint || !*endpoint)
00182     return -1;  // Failure
00183 
00184   static const char protocol[] = "miop";
00185   static size_t const len = sizeof (protocol) - 1;
00186 
00187   size_t const slot = ACE_OS::strchr (endpoint, ':') - endpoint;
00188 
00189   // Check for the proper prefix in the IOR.  If the proper prefix
00190   // isn't in the IOR then it is not an IOR we can use.
00191   if (slot == len
00192       && ACE_OS::strncasecmp (endpoint, protocol, len) == 0)
00193     return 0;
00194 
00195   return -1;
00196   // Failure: not a MIOP IOR
00197   // DO NOT throw an exception here.
00198 }

int TAO_UIPMC_Connector::close void   )  [virtual]
 

Implements TAO_Connector.

Definition at line 44 of file UIPMC_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.

00045 {
00046   SvcHandlerIterator iter (svc_handler_table_);
00047 
00048   while (!iter.done ())
00049     {
00050       (*iter).int_id_->remove_reference ();
00051       iter++;
00052     }
00053 
00054   return 0;
00055 }

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

Implements TAO_Connector.

Definition at line 139 of file UIPMC_Connector.cpp.

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

00140 {
00141   TAO_Profile *pfile;
00142   ACE_NEW_RETURN (pfile,
00143                   TAO_UIPMC_Profile (this->orb_core ()),
00144                   0);
00145 
00146   int r = pfile->decode (cdr);
00147   if (r == -1)
00148     {
00149       pfile->_decr_refcnt ();
00150       pfile = 0;
00151     }
00152 
00153   return pfile;
00154 }

TAO_Transport * TAO_UIPMC_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 93 of file UIPMC_Connector.cpp.

References ACE_DEBUG, ACE_NEW_RETURN, ACE_TEXT(), ACE_Event_Handler::add_reference(), TAO_UIPMC_Connection_Handler::addr(), ACE_Hash_Map_Manager_Ex< ACE_INET_Addr, TAO_UIPMC_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_UIPMC_Connection_Handler *, ACE_Hash< ACE_INET_Addr >, ACE_Equal_To< ACE_INET_Addr >, ACE_Null_Mutex >::find(), TAO_UIPMC_Connection_Handler::get_handle(), LM_DEBUG, TAO_UIPMC_Connection_Handler::local_addr(), TAO_UIPMC_Endpoint::object_addr(), TAO_UIPMC_Connection_Handler::open(), svc_handler_table_, TAO_debug_level, and TAO_Connection_Handler::transport().

00096 {
00097   TAO_UIPMC_Endpoint *uipmc_endpoint =
00098     dynamic_cast<TAO_UIPMC_Endpoint *> (desc.endpoint ());
00099 
00100   if (uipmc_endpoint == 0)
00101     return 0;
00102 
00103   const ACE_INET_Addr &remote_address =
00104     uipmc_endpoint->object_addr ();
00105 
00106   TAO_UIPMC_Connection_Handler *svc_handler = 0;
00107 
00108   if (this->svc_handler_table_.find (remote_address, svc_handler) == -1)
00109     {
00110       TAO_UIPMC_Connection_Handler *svc_handler_i = 0;
00111       ACE_NEW_RETURN (svc_handler_i,
00112                       TAO_UIPMC_Connection_Handler (this->orb_core ()),
00113                       0);
00114 
00115       svc_handler_i->local_addr (ACE_sap_any_cast (ACE_INET_Addr &));
00116       svc_handler_i->addr (remote_address);
00117 
00118       svc_handler_i->open (0);
00119 
00120       svc_handler_table_.bind (remote_address,
00121                                svc_handler_i);
00122       svc_handler = svc_handler_i;
00123 
00124       if (TAO_debug_level > 2)
00125         ACE_DEBUG ((LM_DEBUG,
00126                     ACE_TEXT ("(%P|%t) UIPMC_Connector::make_connection, ")
00127                     ACE_TEXT ("new connection on HANDLE %d\n"),
00128                     svc_handler->get_handle ()));
00129    }
00130 
00131   // @@ Michael: We do not use traditional connection management.
00132   svc_handler->add_reference ();
00133 
00134   return svc_handler->transport ();
00135 }

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

Implements TAO_Connector.

Definition at line 157 of file UIPMC_Connector.cpp.

References ACE_CHECK_RETURN, and ACE_NEW_THROW_EX.

00158 {
00159   // The endpoint should be of the form:
00160   //    N.n@host:port/object_key
00161   // or:
00162   //    host:port/object_key
00163 
00164   TAO_Profile *profile = 0;
00165   ACE_NEW_THROW_EX (profile,
00166                     TAO_UIPMC_Profile (this->orb_core ()),
00167                     CORBA::NO_MEMORY (
00168                       CORBA::SystemException::_tao_minor_code (
00169                         TAO::VMCID,
00170                         ENOMEM),
00171                       CORBA::COMPLETED_NO));
00172   ACE_CHECK_RETURN (0);
00173 
00174   return profile;
00175 }

char TAO_UIPMC_Connector::object_key_delimiter void   )  const [virtual]
 

Implements TAO_Connector.

Definition at line 201 of file UIPMC_Connector.cpp.

00202 {
00203   return TAO_UIPMC_Profile::object_key_delimiter_;
00204 }

int TAO_UIPMC_Connector::open TAO_ORB_Core orb_core  )  [virtual]
 

Implements TAO_Connector.

Definition at line 30 of file UIPMC_Connector.cpp.

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

00031 {
00032   this->orb_core (orb_core);
00033 
00034   // For the sake of uniformity do
00035   if (this->create_connect_strategy () == -1)
00036     return -1;
00037 
00038   // @@ Michael: We do not use traditional connection management.
00039 
00040   return 0;
00041 }

int TAO_UIPMC_Connector::set_validate_endpoint TAO_Endpoint endpoint  )  [protected, virtual]
 

= More TAO_Connector methods, please check the documentation on Transport_Connector.h

Implements TAO_Connector.

Definition at line 58 of file UIPMC_Connector.cpp.

References ACE_DEBUG, ACE_TEXT(), ACE_Addr::get_type(), LM_DEBUG, TAO_UIPMC_Endpoint::object_addr(), TAO_Endpoint::tag(), and TAO_debug_level.

00059 {
00060   if (endpoint->tag () != IOP::TAG_UIPMC)
00061     return -1;
00062 
00063   TAO_UIPMC_Endpoint *uipmc_endpoint =
00064     dynamic_cast<TAO_UIPMC_Endpoint *> (endpoint );
00065 
00066   if (uipmc_endpoint == 0)
00067     return -1;
00068 
00069   const ACE_INET_Addr &remote_address =
00070     uipmc_endpoint->object_addr ();
00071 
00072   // Verify that the remote ACE_INET_Addr was initialized properly.
00073   // Failure can occur if hostname lookup failed when initializing the
00074   // remote ACE_INET_Addr.
00075   if (remote_address.get_type () != AF_INET)
00076     {
00077       if (TAO_debug_level > 0)
00078         {
00079           ACE_DEBUG ((LM_DEBUG,
00080                       ACE_TEXT ("TAO (%P|%t) UIPMC connection failed.\n")
00081                       ACE_TEXT ("TAO (%P|%t) This is most likely ")
00082                       ACE_TEXT ("due to a hostname lookup ")
00083                       ACE_TEXT ("failure.\n")));
00084         }
00085 
00086       return -1;
00087     }
00088 
00089   return 0;
00090 }


Member Data Documentation

ACE_Hash_Map_Manager_Ex< ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex > TAO_UIPMC_Connector::svc_handler_table_ [private]
 

Definition at line 85 of file UIPMC_Connector.h.

Referenced by close(), and make_connection().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:05:14 2006 for TAO_PortableGroup by doxygen 1.3.6