params.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    params.h
00006  *
00007  *  $Id: params.h 79221 2007-08-06 11:01:22Z johnnyw $
00008  *
00009  *  @author Chris Cleeland
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_PARAMS_H
00014 #define TAO_PARAMS_H
00015 
00016 #include /**/ "ace/pre.h"
00017 #include "ace/Unbounded_Queue.h"
00018 #include "ace/Array_Map.h"
00019 #include "ace/Synch.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "ace/SString.h"
00026 
00027 #include "tao/objectid.h"
00028 #include "tao/CORBA_String.h"
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 // Forward decls.
00033 
00034 // @@ Using an ACE_Unbounded_Queue to contain the endpoints and
00035 //    preconnects may not be the best container to use.  However, it
00036 //    will only be used during ORB bootstrapping.  Also, a template
00037 //    instantiation of ACE_Unbounded_Queue<ACE_CString> already exists
00038 //    in ACE so we do not have to worry about increasing TAO's
00039 //    footprint by using this container.
00040 typedef ACE_Unbounded_Queue<ACE_CString> TAO_EndpointSet;
00041 typedef ACE_Unbounded_Queue_Const_Iterator<ACE_CString> TAO_EndpointSetIterator;
00042 
00043 // -------------------------------------------------------------------
00044 
00045 /**
00046  * @class TAO_ORB_Parameters
00047  *
00048  * @brief Parameters that are specific to the ORB.  These parameters can
00049  * be for the client, the server, or for both.
00050  */
00051 class TAO_Export TAO_ORB_Parameters
00052 {
00053 public:
00054 
00055   typedef ACE_Array_Map<ACE_CString, ACE_CString> endpoints_map_type;
00056 
00057   /// Constructor.
00058   TAO_ORB_Parameters (void);
00059 
00060   /// Specifies the endpoints on which this server is willing to
00061   /// listen for requests.
00062   int add_endpoints (const ACE_CString &lane,
00063                      const ACE_CString &endpoints);
00064   void get_endpoint_set (const ACE_CString &lane,
00065                          TAO_EndpointSet &endpoint_set);
00066 
00067   /// Set/Get the port of services locatable through multicast.
00068   CORBA::UShort service_port (TAO::MCAST_SERVICEID service_id) const;
00069   void service_port (TAO::MCAST_SERVICEID service_id, CORBA::UShort port);
00070 
00071   /// Get/Set address:port for Multicast Discovery Protocol for
00072   /// the Naming Service.
00073   const char *mcast_discovery_endpoint (void) const;
00074   void mcast_discovery_endpoint (const char *mde);
00075 
00076   /// Set/Get the size to be used for a socket's receive buffer.
00077   int sock_rcvbuf_size (void) const;
00078   void sock_rcvbuf_size (int);
00079 
00080   /// Set/Get the size to be used for a socket's send buffer.
00081   int sock_sndbuf_size (void) const;
00082   void sock_sndbuf_size (int);
00083 
00084   /// Set/Get the status of whether to use TCP_NODELAY or not.
00085   int nodelay (void) const;
00086   void nodelay (int);
00087 
00088   /// Set/Get whether we should set SO_KEEPALIVE on the socket or not.
00089   int sock_keepalive (void);
00090   void sock_keepalive (int);
00091 
00092   /// Set/Get whether we should set SO_DONTROUTE on the socket or not.
00093   int sock_dontroute (void);
00094   void sock_dontroute (int);
00095 
00096   /**
00097    * Octet sequences are marshalled without doing any copies, we
00098    * simply append a block to the CDR message block chain. When the
00099    * octet sequence is small enough and there is room in the current
00100    * message block it is more efficient just to copy the buffer.
00101    */
00102   int cdr_memcpy_tradeoff (void) const;
00103   void cdr_memcpy_tradeoff (int);
00104 
00105   /**
00106    * Maximum size of a GIOP message before outgoing fragmentation
00107    * kicks in.
00108    */
00109   //@{
00110   ACE_CDR::ULong max_message_size (void) const;
00111   void max_message_size (ACE_CDR::ULong size);
00112   //@}
00113 
00114   /// The ORB will use the dotted decimal notation for addresses. By
00115   /// default we use the full ascii names.
00116   int use_dotted_decimal_addresses (void) const;
00117   void use_dotted_decimal_addresses (int);
00118 
00119   /// The ORB will cache incoming connections against the dotted
00120   /// decimal form of the peer's address
00121   int cache_incoming_by_dotted_decimal_address (void) const;
00122   void cache_incoming_by_dotted_decimal_address (int);
00123 
00124   /// The ORB will turn off SO_LINGER if this is zero.
00125   int linger (void) const;
00126   void linger (int);
00127 
00128   /// Set/Get the Init Reference of an arbitrary ObjectID.
00129   char *default_init_ref (void) const;
00130   void default_init_ref (const char *default_init_ref);
00131 
00132   /// Disable the OMG standard profile components, useful for
00133   /// homogenous environments.
00134   int std_profile_components (void) const;
00135   void std_profile_components (int x);
00136 
00137   /// Scheduling policy.
00138   /**
00139    * Scheduling policy specified by the user through the
00140    * -ORBSchedPolicy option.  This value is typically used by
00141    * functions like ACE_OS::thr_setprio() and
00142    * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
00143    * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
00144    */
00145   int ace_sched_policy (void) const;
00146   void ace_sched_policy (int x);
00147 
00148   /// Scheduling policy flag.
00149   /**
00150    * Scheduling policy specified by the user through the
00151    * -ORBSchedPolicy option.  This value is typically used by ACE
00152    * thread creation functions. Legal values are THR_SCHED_RR,
00153    * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
00154    */
00155   long sched_policy (void) const;
00156   void sched_policy (long x);
00157 
00158   /// Scheduling scope flag.
00159   /**
00160    * Scheduling policy specified by the user through the
00161    * -ORBScopePolicy option.  This value is typically used by ACE
00162    * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
00163    * THR_SCOPE_PROCESS.
00164    */
00165   long scope_policy (void) const;
00166   void scope_policy (long x);
00167 
00168   /// Thread creation flags.
00169   /**
00170    * Shorthand for OR'ing together the scope_policy and sched_policy.
00171    */
00172   long thread_creation_flags (void) const;
00173 
00174   /// Single read optimization.
00175   int single_read_optimization (void) const;
00176   void single_read_optimization (int x);
00177 
00178   /// Create shared profiles without priority
00179   int shared_profile (void) const;
00180   void shared_profile (int x);
00181 
00182   /// Want to use parallel connection attempts when profiles have multiple
00183   /// endpoints.
00184   bool use_parallel_connects(void) const;
00185   void use_parallel_connects (bool x);
00186 
00187   /// The milliseconds delay used to stagger individual connection starts
00188   /// when using parallel connects.
00189   unsigned long parallel_connect_delay (void) const;
00190   void parallel_connect_delay (unsigned long x);
00191 
00192   /// Mutators and accessors for rt_collocation_resolver
00193   bool disable_rt_collocation_resolver (void) const;
00194   void disable_rt_collocation_resolver (bool);
00195 
00196   /// Accepts the list of preferred interfaces and does a simple
00197   /// semantic check on the string
00198   bool preferred_interfaces (const char *s);
00199   const char *preferred_interfaces (void) const;
00200 
00201   void enforce_pref_interfaces (bool p);
00202   bool enforce_pref_interfaces (void) const;
00203 
00204 #if defined (ACE_HAS_IPV6)
00205   void prefer_ipv6_interfaces (bool p);
00206   bool prefer_ipv6_interfaces (void) const;
00207 
00208   void connect_ipv6_only (bool p);
00209   bool connect_ipv6_only (void) const;
00210 
00211   void use_ipv6_link_local (bool p);
00212   bool use_ipv6_link_local (void) const;
00213 #endif /* ACE_HAS_IPV6 */
00214 
00215   void negotiate_codesets (bool c);
00216   bool negotiate_codesets (void) const;
00217 
00218   void ami_collication (bool opt);
00219   bool ami_collication (void) const;
00220 
00221   void protocols_hooks_name (const char *s);
00222   const char *protocols_hooks_name (void) const;
00223 
00224   void thread_lane_resources_manager_factory_name (const char *s);
00225   const char *thread_lane_resources_manager_factory_name (void) const;
00226 
00227   void stub_factory_name (const char *s);
00228   const char *stub_factory_name (void) const;
00229 
00230   void poa_factory_name (const char *s);
00231   const char *poa_factory_name (void) const;
00232 
00233   void poa_factory_directive (const char *s);
00234   const char *poa_factory_directive (void) const;
00235 
00236   void endpoint_selector_factory_name (const char *s);
00237   const char *endpoint_selector_factory_name (void) const;
00238 
00239   void collocation_resolver_name (const char *s);
00240   const char *collocation_resolver_name (void) const;
00241 
00242 private:
00243   // Each "endpoint" is of the form:
00244   //
00245   //   protocol://V.v@addr1,...,W.w@addrN/
00246   //
00247   // or:
00248   //
00249   //   protocol://addr1,addr2,...,addrN/
00250   //
00251   // where "V.v" and "W.w" are optional versions.
00252   //
00253   // Multiple sets of endpoints may be seperated by a semi-colon `;'.
00254   // For example:
00255   //
00256   //   iiop://space:2001,odyssey:2010;uiop://foo,bar
00257   //
00258   // All preconnect or endpoint strings should be of the above form(s).
00259   int parse_and_add_endpoints (const ACE_CString &endpoints,
00260                                TAO_EndpointSet &endpoint_set);
00261 
00262   /// Map of endpoints this server is willing to accept requests on.
00263   endpoints_map_type endpoints_map_;
00264 
00265   /// Port numbers of the configured services.
00266   CORBA::UShort service_port_[TAO_NO_OF_MCAST_SERVICES];
00267 
00268   /// Address:port for Multicast Discovery Protocol for the Naming
00269   /// Service.
00270   CORBA::String_var mcast_discovery_endpoint_;
00271 
00272   /// List of comma separated prefixes from ORBDefaultInitRef.
00273   ACE_CString default_init_ref_;
00274 
00275   /// Size to be used for a socket's receive buffer.
00276   int sock_rcvbuf_size_;
00277 
00278   /// Size to be used for a socket's send buffer.
00279   int sock_sndbuf_size_;
00280 
00281   /// 1 if we're using TCP_NODELAY and 0 otherwise.
00282   int nodelay_;
00283 
00284   /// 1 if we're using SO_KEEPALIVE and 0 otherwise (default 0).
00285   int sock_keepalive_;
00286 
00287   /// 1 if we're using SO_DONTROUTE and 0 otherwise (default 0).
00288   int sock_dontroute_;
00289 
00290   /// Control the strategy for copying vs. appeding octet sequences in
00291   /// CDR streams.
00292   int cdr_memcpy_tradeoff_;
00293 
00294   /// Maximum GIOP message size to be sent over a given transport.
00295   /**
00296    * Setting a maximum message size will cause outgoing GIOP
00297    * fragmentation to be enabled.
00298    */
00299   ACE_CDR::ULong max_message_size_;
00300 
00301   /// For selecting a address notation
00302   int use_dotted_decimal_addresses_;
00303 
00304   /// If incoming connections should be cached against IP (true) or
00305   /// hostname (false).
00306   int cache_incoming_by_dotted_decimal_address_;
00307 
00308   /// For setting the SO_LINGER option
00309   int linger_;
00310 
00311   /// If true then the standard OMG components are not generated.
00312   int std_profile_components_;
00313 
00314   /// Scheduling policy.
00315   /**
00316    * Scheduling policy specified by the user through the
00317    * -ORBSchedPolicy option.  This value is typically used by
00318    * functions like ACE_OS::thr_setprio() and
00319    * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
00320    * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
00321    */
00322   int ace_sched_policy_;
00323 
00324   /// Scheduling policy flag.
00325   /**
00326    * Scheduling policy specified by the user through the
00327    * -ORBSchedPolicy option.  This value is typically used by ACE
00328    * thread creation functions. Legal values are THR_SCHED_RR,
00329    * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
00330    */
00331   long sched_policy_;
00332 
00333   /// Scheduling scope flag.
00334   /**
00335    * Scheduling policy specified by the user through the
00336    * -ORBScopePolicy option.  This value is typically used by ACE
00337    * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
00338    * THR_SCOPE_PROCESS.
00339    */
00340   long scope_policy_;
00341 
00342   /// Single read optimization.
00343   int single_read_optimization_;
00344 
00345   /// Shared Profile - Use the same profile for multiple endpoints
00346   int shared_profile_;
00347 
00348   /// Use Parallel Connects - Try to connect to all endpoints in a
00349   /// shared profile at once, use the first to complete.
00350   int use_parallel_connects_;
00351 
00352   /// When using parallel connects, this delay is used to stagger connection
00353   /// attempts. This gives a trade-off between opening more potential
00354   /// connections than necessary vs increasing the potential time before
00355   /// a good connection is discovered. Time is expressed in milliseconds.
00356   unsigned long parallel_connect_delay_;
00357 
00358   /// Preferred network interfaces as a string
00359   ACE_CString pref_network_;
00360 
00361   /// Default collocation resolver
00362   /**
00363    * The vanilla ORB has only one collocation resolver. But if the
00364    * RTORB is in place, the RTORB can get in a new collocation
00365    * resolver. There are some applications that would like to use the
00366    * default collocation resolver with the RTORB. This boolean is the
00367    * value of the option that the application passes in to enable/disable
00368    * the use of RT collocation resolver with the RTORB. The default value
00369    * is false to indicate that the RT_Collocation_Resolver will be
00370    * loaded if the RTORB is used.
00371    */
00372   bool disable_rt_collocation_resolver_;
00373 
00374   bool enforce_preferred_interfaces_;
00375 
00376 #if defined (ACE_HAS_IPV6)
00377   /// Prefer to connect IPv6 over IPv4 Yes or No.
00378   bool prefer_ipv6_interfaces_;
00379 
00380   /**
00381    * Only connect to (client) or listen on and accept from (server)
00382    * IPv6 interfaces Yes or No.
00383    */
00384   bool connect_ipv6_only_;
00385 
00386   /// Include Link Local IPv6 profiles to IOR Yes or No.
00387   bool use_ipv6_link_local_;
00388 #endif /* ACE_HAS_IPV6 */
00389 
00390   /// Enable the use of codeset negotiation
00391   bool negotiate_codesets_;
00392 
00393   /// Do we make collocated ami calls
00394   bool ami_collication_;
00395 
00396   /**
00397    * Name of the protocols_hooks that needs to be instantiated.
00398    * The default value is "Protocols_Hooks". If RTCORBA option is
00399    * set, its value will be set to be "RT_Protocols_Hooks".
00400    */
00401   ACE_CString protocols_hooks_name_;
00402 
00403   /**
00404    * Name of the stub factory that needs to be instantiated.
00405    * The default value is "Default_Stub_Factory". If TAO_RTCORBA is
00406    * linked, the set_stub_factory will be called to set the value
00407    * to be "RT_Stub_Factory".
00408    */
00409   ACE_CString stub_factory_name_;
00410 
00411   /**
00412    * Name of the endpoint selector factory that needs to be instantiated.
00413    * The default value is "Default_Endpoint_Selector_Factory". If
00414    * TAO_RTCORBA is linked, the set_endpoint_selector_factory will be
00415    * called to set the value to be "RT_Endpoint_Selector_Factory".
00416    */
00417   ACE_CString endpoint_selector_factory_name_;
00418 
00419   /**
00420    * Name of the thread lane resources manager that needs to be
00421    * instantiated.  The default value is
00422    * "Default_Thread_Lane_Resources_Manager_Factory". If TAO_RTCORBA
00423    * is linked, the set_thread_lane_resources_manager will be called
00424    * to set the value to be
00425    * "RT_Thread_Lane_Resources_Manager_Factory".
00426    */
00427   ACE_CString thread_lane_resources_manager_factory_name_;
00428 
00429   /**
00430    * Name of the service object used to create the RootPOA.  The
00431    * default value is "TAO_POA".  If TAO_RTCORBA is loaded, this
00432    * will be changed to TAO_RT_POA so that a POA equipped with
00433    * realtime extensions will be returned.
00434    */
00435   ACE_CString poa_factory_name_;
00436 
00437   /**
00438    * The service configurator directive used to load
00439    * poa_factory_name_ dynamically.
00440    */
00441   ACE_CString poa_factory_directive_;
00442 
00443   /**
00444    * Name of the collocation resolver that needs to be instantiated.
00445    * The default value is "Default_Collocation_Resolver". If
00446    * TAO_RTCORBA is linked, the set_collocation_resolver will be
00447    * called to set the value to be "RT_Collocation_Resolver".
00448    */
00449   ACE_CString collocation_resolver_name_;
00450 };
00451 
00452 TAO_END_VERSIONED_NAMESPACE_DECL
00453 
00454 #if defined (__ACE_INLINE__)
00455 # include "tao/params.inl"
00456 #endif /* __ACE_INLINE__ */
00457 
00458 #include /**/ "ace/post.h"
00459 
00460 #endif /* TAO_PARAMS_H */

Generated on Sun Jan 27 13:07:35 2008 for TAO by doxygen 1.3.6