DIOP_Acceptor.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    DIOP_Acceptor.h
00006  *
00007  *  $Id: DIOP_Acceptor.h 78931 2007-07-18 09:59:36Z johnnyw $
00008  *
00009  *  DIOP specific acceptor processing
00010  *
00011  *  @author  Michael Kircher
00012  */
00013 //=============================================================================
00014 
00015 
00016 #ifndef TAO_DIOP_ACCEPTOR_H
00017 #define TAO_DIOP_ACCEPTOR_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "tao/orbconf.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
00028 
00029 #include "tao/Transport_Acceptor.h"
00030 #include "tao/Strategies/DIOP_Connection_Handler.h"
00031 #include "tao/Acceptor_Impl.h"
00032 
00033 #include "tao/GIOP_Message_Version.h"
00034 
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036 
00037 // TAO DIOP_Acceptor concrete call defination
00038 
00039 /**
00040  * @class TAO_DIOP_Acceptor
00041  *
00042  * @brief TAO_DIOP_Acceptor
00043  *
00044  * The DIOP-specific bridge class for the concrete acceptor.
00045  */
00046 class TAO_Strategies_Export TAO_DIOP_Acceptor : public TAO_Acceptor
00047 {
00048 public:
00049   /// Constructor.
00050   TAO_DIOP_Acceptor (void);
00051 
00052   /// Destructor.
00053   ~TAO_DIOP_Acceptor (void);
00054 
00055   /// @@ Helper method for the implementation repository, should go
00056   ///    away
00057   const ACE_INET_Addr& address (void) const;
00058 
00059   /// Returns the array of endpoints in this acceptor
00060   const ACE_INET_Addr *endpoints (void);
00061 
00062   /// Returns address for default endpoint
00063   const ACE_INET_Addr& default_address (void) const;
00064 
00065   /// Set address for default endpoint
00066   void set_default_address (const ACE_INET_Addr& addr);
00067 
00068   /**
00069    * @name The TAO_Acceptor Methods
00070    *
00071    * Please check the documentation in Transport_Acceptor.h for details.
00072    */
00073   //@{
00074   virtual int open (TAO_ORB_Core *orb_core,
00075                     ACE_Reactor *reactor,
00076                     int version_major,
00077                     int version_minor,
00078                     const char *address,
00079                     const char *options = 0);
00080   virtual int open_default (TAO_ORB_Core *orb_core,
00081                             ACE_Reactor *reactor,
00082                             int version_major,
00083                             int version_minor,
00084                             const char *options = 0);
00085   virtual int close (void);
00086   virtual int create_profile (const TAO::ObjectKey &object_key,
00087                               TAO_MProfile &mprofile,
00088                               CORBA::Short priority);
00089 
00090   virtual int is_collocated (const TAO_Endpoint *endpoint);
00091   virtual CORBA::ULong endpoint_count (void);
00092 
00093   virtual int object_key (IOP::TaggedProfile &profile,
00094                           TAO::ObjectKey &key);
00095   //@}
00096 
00097   /**
00098    * Set the host name for the given addr.
00099    * A hostname may be forced by using specified_hostname.  This
00100    * is useful if the given address corresponds to more than one
00101    * hostname and the desired one cannot be determined in any
00102    * other way.
00103    */
00104   virtual int hostname (TAO_ORB_Core *orb_core,
00105                         ACE_INET_Addr &addr,
00106                         char *&host,
00107                         const char *specified_hostname = 0);
00108 
00109   /**
00110    * Set the host name for the given address using the dotted decimal
00111    * format.
00112    */
00113   int dotted_decimal_address (ACE_INET_Addr &addr,
00114                               char *&host);
00115 
00116 protected:
00117 
00118   /**
00119    * Helper method
00120    * Clear out 'addr' & 'specified_hostname' and initialize them based
00121    * upon 'address'. If a non-zero pointer is passed in for def_type,
00122    * this will be set to AF_INET6 if IPv6 support is enabled and
00123    * supplied hostname is either [] or [::]. It will be set to AF_INET
00124    * if the hostname is 0.0.0.0, otherwise it is set to
00125    * AF_UNSPEC. This value is then passed to probe_interfaces by open.
00126    */
00127   int parse_address (const char *address,
00128                      ACE_INET_Addr &addr,
00129                      ACE_CString &specified_hostname,
00130                      int *def_type = 0);
00131 
00132   /**
00133    * Implement the common part of the open*() methods.  This method is
00134    * virtual to allow a derived class implementation to be invoked
00135    * instead.
00136    */
00137   virtual int open_i (const ACE_INET_Addr &addr,
00138                       ACE_Reactor *reactor);
00139 
00140   /**
00141    * Probe the system for available network interfaces, and initialize
00142    * the <addrs_> array with an ACE_INET_Addr for each network
00143    * interface.  The port for each initialized ACE_INET_Addr will be
00144    * set in the open_i() method.  This method only gets invoked when
00145    * no explicit hostname is provided in the specified endpoint.
00146    *
00147    * The optional argument def_type is used to constrain the resulting
00148    * list of interfaces to be either only IPv6 or IPv4, or both, when
00149    * ACE_HAS_IPV6 is enabled and the source endpoint was an explicitly
00150    * declared wildcard.
00151    */
00152   int probe_interfaces (TAO_ORB_Core *orb_core, int def_type = AF_UNSPEC);
00153 
00154   /// Parse protocol specific options.
00155   virtual int parse_options (const char *options);
00156 
00157   /// Helper method to add a new profile to the mprofile for
00158   /// each endpoint.
00159   int create_new_profile (const TAO::ObjectKey &object_key,
00160                           TAO_MProfile &mprofile,
00161                           CORBA::Short priority);
00162 
00163   /// Helper method to create a profile that contains all of
00164   /// our endpoints.
00165   int create_shared_profile (const TAO::ObjectKey &object_key,
00166                              TAO_MProfile &mprofile,
00167                              CORBA::Short priority);
00168 protected:
00169 
00170   /// Array of ACE_INET_Addr instances, each one corresponding to a
00171   /// given network interface.
00172   ACE_INET_Addr *addrs_;
00173 
00174   /**
00175    * Cache the information about the endpoints serviced by this
00176    * acceptor.
00177    * There may in fact be multiple hostnames for this endpoint. For
00178    * example, if the IP address is INADDR_ANY (0.0.0.0) then there
00179    * will be possibly a different hostname for each interface.
00180    */
00181   char **hosts_;
00182 
00183   /// The number of host names cached in the hosts_ array (equivalent
00184   /// to the number of endpoints opened by this Acceptor).
00185   CORBA::ULong endpoint_count_;
00186 
00187   /**
00188    * The GIOP version for this endpoint
00189    * @@ Theoretically they shouldn't be here!! We need to look at a
00190    * way to move this out
00191    */
00192   TAO_GIOP_Message_Version version_;
00193 
00194   /// ORB Core.
00195   TAO_ORB_Core *orb_core_;
00196 
00197   /// Address for default endpoint
00198   ACE_INET_Addr default_address_;
00199 
00200 private:
00201   // @@ Frank: From DIOP_Acceptor.h
00202   TAO_DIOP_Connection_Handler *connection_handler_;
00203 
00204 };
00205 
00206 TAO_END_VERSIONED_NAMESPACE_DECL
00207 
00208 #if defined(__ACE_INLINE__)
00209 #include "tao/Strategies/DIOP_Acceptor.inl"
00210 #endif /* __ACE_INLINE__ */
00211 
00212 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
00213 
00214 #include /**/ "ace/post.h"
00215 
00216 #endif  /* TAO_DIOP_ACCEPTOR_H */

Generated on Tue Feb 2 17:47:18 2010 for TAO_Strategies by  doxygen 1.4.7