Transport_Connector.h

Go to the documentation of this file.
00001 // This may look like C, but it's really -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file Transport_Connector.h
00006  *
00007  *  $Id: Transport_Connector.h 79388 2007-08-17 16:05:00Z wilsond $
00008  *
00009  *  Define the interface for the Connector component in TAO's
00010  *  pluggable protocol framework.
00011  *
00012  *  @author  Fred Kuhns <fredk@cs.wustl.edu>
00013  */
00014 //=============================================================================
00015 
00016 #ifndef TAO_CONNECTOR_H
00017 #define TAO_CONNECTOR_H
00018 
00019 #include /**/ "ace/pre.h"
00020 #include "tao/Basic_Types.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include /**/ "tao/TAO_Export.h"
00027 
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029 class ACE_Time_Value;
00030 ACE_END_VERSIONED_NAMESPACE_DECL
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 class TAO_Transport_Descriptor_Interface;
00035 class TAO_InputCDR;
00036 class TAO_Endpoint;
00037 class TAO_Profile;
00038 class TAO_MProfile;
00039 class TAO_ORB_Core;
00040 class TAO_Connect_Strategy;
00041 class TAO_Transport;
00042 class TAO_Connection_Handler;
00043 class TAO_LF_Multi_Event;
00044 
00045 namespace TAO
00046 {
00047   class Profile_Transport_Resolver;
00048 }
00049 
00050 /*
00051  * Hook to add includes and forward declaration
00052  * to the Connector class.
00053  */
00054 //@@ TAO_CONNECTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
00055 
00056 /**
00057  * @class TAO_Connector
00058  *
00059  * @brief Generic Connector interface definitions.
00060  *
00061  * Base class for connector bridge object.
00062  *
00063  * @todo Need to rename the class as TAO_Transport_Connector.
00064  */
00065 class TAO_Export TAO_Connector
00066 {
00067 public:
00068 
00069   /// Default constructor.
00070   TAO_Connector (CORBA::ULong tag);
00071 
00072   /// The destructor.
00073   virtual ~TAO_Connector (void);
00074 
00075   /**
00076    * The tag identifying the specific ORB transport layer protocol.
00077    * For example IOP::TAG_INTERNET_IOP == 0.  The tag is used in the
00078    * IOR to identify the type of profile included. IOR -> {{tag0,
00079    * profile0} {tag1, profile1} ...}.  The IOP module defines the
00080    * ProfileId typedef to be a CORBA::ULong.
00081    */
00082   CORBA::ULong tag (void) const;
00083 
00084   /// Parse a string containing a URL style IOR and return an
00085   /// MProfile.  Verify that ior is in the correct format.
00086   int make_mprofile (const char *ior, TAO_MProfile &mprofile);
00087 
00088   /// Helper function to assist corbaloc parsing. The default simply validates
00089   /// the protocol identifyier and scans up to the next comma or slash.
00090   /// Any protocol that has a specific need, such as uiop, can override this
00091   /// method to  provide a custom scanner.
00092   /// The profile returned is either null if this the ior does not match or an
00093   /// empty profile of the correct type, obtained from make_profile().
00094   virtual TAO_Profile *corbaloc_scan (const char *ior, size_t &len);
00095 
00096   ///  Initialize object and register with reactor.
00097   virtual int open (TAO_ORB_Core *orb_core) = 0;
00098 
00099   /// Shutdown Connector bridge and concrete Connector.
00100   virtual int close (void) = 0;
00101 
00102   /**
00103    * To support pluggable we need to abstract away the details of the
00104    * connect ()  method so it can be called from the invocation code
00105    * independent of the actual transport protocol in use.
00106    */
00107   virtual TAO_Transport *connect (TAO::Profile_Transport_Resolver *r,
00108                                   TAO_Transport_Descriptor_Interface *desc,
00109                                   ACE_Time_Value *timeout);
00110 
00111   /// A variation on connect that will try simultanious connections
00112   /// on all endpoints listed in the desc.
00113   virtual TAO_Transport *parallel_connect (TAO::Profile_Transport_Resolver *r,
00114                                            TAO_Transport_Descriptor_Interface
00115                                            *desc, ACE_Time_Value *timeout);
00116 
00117   /// Create a profile for this protocol and initialize it based on the
00118   /// encapsulation in @a cdr
00119   virtual TAO_Profile *create_profile (TAO_InputCDR &cdr) = 0;
00120 
00121   /// Check that the prefix of the provided endpoint is valid for use
00122   /// with a given pluggable protocol.
00123   virtual int check_prefix (const char *endpoint) = 0;
00124 
00125   /// Return the object key delimiter to use or expect.
00126   virtual char object_key_delimiter (void) const = 0;
00127 
00128   //@@ TAO_CONNECTOR_SPL_PUBLIC_METHODS_ADD_HOOK
00129 
00130 protected:
00131   /// A flag indicating the actual connector supports parallel connection
00132   /// attempts. The base implementation alwayse returns 0. Override to return
00133   /// non-zero if parallel connection attempts may be tried.
00134   virtual int supports_parallel_connects (void) const;
00135 
00136   /// Create a profile with a given endpoint.
00137   virtual TAO_Profile *make_profile (void) = 0;
00138 
00139   /// Set and validate endpoint. We need to do this to initialize our
00140   /// remote *_Addr's which have not been done during IOR decode.
00141   virtual int set_validate_endpoint (TAO_Endpoint *endpoint) = 0;
00142 
00143   /// Make a connection
00144   virtual TAO_Transport *make_connection (TAO::Profile_Transport_Resolver *r,
00145                                           TAO_Transport_Descriptor_Interface
00146                                           &desc, ACE_Time_Value *timeout) = 0;
00147 
00148   /// Make a connection using - not a pure virtual since not all
00149   /// protocols support this.
00150   virtual TAO_Transport* make_parallel_connection (
00151       TAO::Profile_Transport_Resolver *r,
00152       TAO_Transport_Descriptor_Interface &desc,
00153       ACE_Time_Value *timeout);
00154 
00155   /// Cancel the passed cvs handler from the connector
00156   virtual int cancel_svc_handler (TAO_Connection_Handler *svc_handler) = 0;
00157 
00158   /// Check whether the connection is not closed
00159   /**
00160    * @retval 0 The connection happens to be not closed, but is now open
00161    * because an other thread managed to open the handler
00162    * @retval -1 The connection is closed
00163    */
00164   virtual int check_connection_closure (TAO_Connection_Handler
00165                                         *connection_handler);
00166 
00167   /**
00168    * Wait for connection completion. We have a transport that is not
00169    * connected yet, wait until it is connected.
00170    * @retval true When we could use @a transport
00171    * @return false When we can't use the @a transport
00172    */
00173   virtual bool wait_for_connection_completion(
00174       TAO::Profile_Transport_Resolver *r,
00175       TAO_Transport *&transport,
00176       ACE_Time_Value *timeout);
00177 
00178   /// In the case of a parallel connection attempt, we take an array of
00179   /// transports, and wait on any of them. When the first one completes,
00180   /// the rest are closed.
00181   virtual bool wait_for_connection_completion(
00182       TAO::Profile_Transport_Resolver *r,
00183       TAO_Transport *&the_winner,
00184       TAO_Transport **transport,
00185       unsigned int count,
00186       TAO_LF_Multi_Event *mev,
00187       ACE_Time_Value *timeout);
00188 
00189   /// Set the ORB Core pointer
00190   void orb_core (TAO_ORB_Core *orb_core);
00191 
00192   /// Create a connect strategy
00193   int create_connect_strategy (void);
00194 
00195   /// Return the TAO_ORB_Core pointer
00196   TAO_ORB_Core *orb_core (void);
00197 
00198 protected:
00199 
00200   /// The (a)synch connect strategy
00201   TAO_Connect_Strategy *active_connect_strategy_;
00202 
00203 private:
00204 
00205   /// IOP protocol tag.
00206   CORBA::ULong const tag_;
00207 
00208   /// Pointer to our ORB core
00209   TAO_ORB_Core *orb_core_;
00210 
00211   //@@ TAO_CONNECTOR_SPL_PRIVATE_DATA_ADD_HOOK
00212 };
00213 
00214 //@@ TAO_CONNECTOR_SPL_EXTERN_ADD_HOOK
00215 
00216 TAO_END_VERSIONED_NAMESPACE_DECL
00217 
00218 #if defined (__ACE_INLINE__)
00219 # include "tao/Transport_Connector.inl"
00220 #endif /* __ACE_INLINE__ */
00221 
00222 #include /**/ "ace/post.h"
00223 #endif /*TAO_CONNECTOR_H*/

Generated on Tue Feb 2 17:37:53 2010 for TAO by  doxygen 1.4.7