00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file params.h 00006 * 00007 * $Id: params.h 81470 2008-04-28 12:40:23Z elliott_c $ 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 /// The amount of time desired by the user to wait to accept 00129 /// connections after a particular type of accept() error. 00130 time_t accept_error_delay (void) const; 00131 void accept_error_delay (time_t); 00132 00133 /// Set/Get the Init Reference of an arbitrary ObjectID. 00134 char *default_init_ref (void) const; 00135 void default_init_ref (const char *default_init_ref); 00136 00137 /// Disable the OMG standard profile components, useful for 00138 /// homogenous environments. 00139 int std_profile_components (void) const; 00140 void std_profile_components (int x); 00141 00142 /// Scheduling policy. 00143 /** 00144 * Scheduling policy specified by the user through the 00145 * -ORBSchedPolicy option. This value is typically used by 00146 * functions like ACE_OS::thr_setprio() and 00147 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR, 00148 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER. 00149 */ 00150 int ace_sched_policy (void) const; 00151 void ace_sched_policy (int x); 00152 00153 /// Scheduling policy flag. 00154 /** 00155 * Scheduling policy specified by the user through the 00156 * -ORBSchedPolicy option. This value is typically used by ACE 00157 * thread creation functions. Legal values are THR_SCHED_RR, 00158 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT. 00159 */ 00160 long sched_policy (void) const; 00161 void sched_policy (long x); 00162 00163 /// Scheduling scope flag. 00164 /** 00165 * Scheduling policy specified by the user through the 00166 * -ORBScopePolicy option. This value is typically used by ACE 00167 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and 00168 * THR_SCOPE_PROCESS. 00169 */ 00170 long scope_policy (void) const; 00171 void scope_policy (long x); 00172 00173 /// Thread creation flags. 00174 /** 00175 * Shorthand for OR'ing together the scope_policy and sched_policy. 00176 */ 00177 long thread_creation_flags (void) const; 00178 00179 /// Single read optimization. 00180 int single_read_optimization (void) const; 00181 void single_read_optimization (int x); 00182 00183 /// Create shared profiles without priority 00184 int shared_profile (void) const; 00185 void shared_profile (int x); 00186 00187 /// Want to use parallel connection attempts when profiles have multiple 00188 /// endpoints. 00189 bool use_parallel_connects(void) const; 00190 void use_parallel_connects (bool x); 00191 00192 /// The milliseconds delay used to stagger individual connection starts 00193 /// when using parallel connects. 00194 unsigned long parallel_connect_delay (void) const; 00195 void parallel_connect_delay (unsigned long x); 00196 00197 /// Mutators and accessors for rt_collocation_resolver 00198 bool disable_rt_collocation_resolver (void) const; 00199 void disable_rt_collocation_resolver (bool); 00200 00201 /// Accepts the list of preferred interfaces and does a simple 00202 /// semantic check on the string 00203 bool preferred_interfaces (const char *s); 00204 const char *preferred_interfaces (void) const; 00205 00206 void enforce_pref_interfaces (bool p); 00207 bool enforce_pref_interfaces (void) const; 00208 00209 #if defined (ACE_HAS_IPV6) 00210 void prefer_ipv6_interfaces (bool p); 00211 bool prefer_ipv6_interfaces (void) const; 00212 00213 void connect_ipv6_only (bool p); 00214 bool connect_ipv6_only (void) const; 00215 00216 void use_ipv6_link_local (bool p); 00217 bool use_ipv6_link_local (void) const; 00218 #endif /* ACE_HAS_IPV6 */ 00219 00220 void negotiate_codesets (bool c); 00221 bool negotiate_codesets (void) const; 00222 00223 void ami_collication (bool opt); 00224 bool ami_collication (void) const; 00225 00226 void protocols_hooks_name (const char *s); 00227 const char *protocols_hooks_name (void) const; 00228 00229 void thread_lane_resources_manager_factory_name (const char *s); 00230 const char *thread_lane_resources_manager_factory_name (void) const; 00231 00232 void stub_factory_name (const char *s); 00233 const char *stub_factory_name (void) const; 00234 00235 void poa_factory_name (const char *s); 00236 const char *poa_factory_name (void) const; 00237 00238 void poa_factory_directive (const char *s); 00239 const char *poa_factory_directive (void) const; 00240 00241 void endpoint_selector_factory_name (const char *s); 00242 const char *endpoint_selector_factory_name (void) const; 00243 00244 void collocation_resolver_name (const char *s); 00245 const char *collocation_resolver_name (void) const; 00246 00247 private: 00248 // Each "endpoint" is of the form: 00249 // 00250 // protocol://V.v@addr1,...,W.w@addrN/ 00251 // 00252 // or: 00253 // 00254 // protocol://addr1,addr2,...,addrN/ 00255 // 00256 // where "V.v" and "W.w" are optional versions. 00257 // 00258 // Multiple sets of endpoints may be seperated by a semi-colon `;'. 00259 // For example: 00260 // 00261 // iiop://space:2001,odyssey:2010;uiop://foo,bar 00262 // 00263 // All preconnect or endpoint strings should be of the above form(s). 00264 int parse_and_add_endpoints (const ACE_CString &endpoints, 00265 TAO_EndpointSet &endpoint_set); 00266 00267 /// Map of endpoints this server is willing to accept requests on. 00268 endpoints_map_type endpoints_map_; 00269 00270 /// Port numbers of the configured services. 00271 CORBA::UShort service_port_[TAO_NO_OF_MCAST_SERVICES]; 00272 00273 /// Address:port for Multicast Discovery Protocol for the Naming 00274 /// Service. 00275 CORBA::String_var mcast_discovery_endpoint_; 00276 00277 /// List of comma separated prefixes from ORBDefaultInitRef. 00278 ACE_CString default_init_ref_; 00279 00280 /// Size to be used for a socket's receive buffer. 00281 int sock_rcvbuf_size_; 00282 00283 /// Size to be used for a socket's send buffer. 00284 int sock_sndbuf_size_; 00285 00286 /// 1 if we're using TCP_NODELAY and 0 otherwise. 00287 int nodelay_; 00288 00289 /// 1 if we're using SO_KEEPALIVE and 0 otherwise (default 0). 00290 int sock_keepalive_; 00291 00292 /// 1 if we're using SO_DONTROUTE and 0 otherwise (default 0). 00293 int sock_dontroute_; 00294 00295 /// Control the strategy for copying vs. appeding octet sequences in 00296 /// CDR streams. 00297 int cdr_memcpy_tradeoff_; 00298 00299 /// Maximum GIOP message size to be sent over a given transport. 00300 /** 00301 * Setting a maximum message size will cause outgoing GIOP 00302 * fragmentation to be enabled. 00303 */ 00304 ACE_CDR::ULong max_message_size_; 00305 00306 /// For selecting a address notation 00307 int use_dotted_decimal_addresses_; 00308 00309 /// If incoming connections should be cached against IP (true) or 00310 /// hostname (false). 00311 int cache_incoming_by_dotted_decimal_address_; 00312 00313 /// For setting the SO_LINGER option 00314 int linger_; 00315 00316 /// For setting the accept retry delay 00317 time_t accept_error_delay_; 00318 00319 /// If true then the standard OMG components are not generated. 00320 int std_profile_components_; 00321 00322 /// Scheduling policy. 00323 /** 00324 * Scheduling policy specified by the user through the 00325 * -ORBSchedPolicy option. This value is typically used by 00326 * functions like ACE_OS::thr_setprio() and 00327 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR, 00328 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER. 00329 */ 00330 int ace_sched_policy_; 00331 00332 /// Scheduling policy flag. 00333 /** 00334 * Scheduling policy specified by the user through the 00335 * -ORBSchedPolicy option. This value is typically used by ACE 00336 * thread creation functions. Legal values are THR_SCHED_RR, 00337 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT. 00338 */ 00339 long sched_policy_; 00340 00341 /// Scheduling scope flag. 00342 /** 00343 * Scheduling policy specified by the user through the 00344 * -ORBScopePolicy option. This value is typically used by ACE 00345 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and 00346 * THR_SCOPE_PROCESS. 00347 */ 00348 long scope_policy_; 00349 00350 /// Single read optimization. 00351 int single_read_optimization_; 00352 00353 /// Shared Profile - Use the same profile for multiple endpoints 00354 int shared_profile_; 00355 00356 /// Use Parallel Connects - Try to connect to all endpoints in a 00357 /// shared profile at once, use the first to complete. 00358 int use_parallel_connects_; 00359 00360 /// When using parallel connects, this delay is used to stagger connection 00361 /// attempts. This gives a trade-off between opening more potential 00362 /// connections than necessary vs increasing the potential time before 00363 /// a good connection is discovered. Time is expressed in milliseconds. 00364 unsigned long parallel_connect_delay_; 00365 00366 /// Preferred network interfaces as a string 00367 ACE_CString pref_network_; 00368 00369 /// Default collocation resolver 00370 /** 00371 * The vanilla ORB has only one collocation resolver. But if the 00372 * RTORB is in place, the RTORB can get in a new collocation 00373 * resolver. There are some applications that would like to use the 00374 * default collocation resolver with the RTORB. This boolean is the 00375 * value of the option that the application passes in to enable/disable 00376 * the use of RT collocation resolver with the RTORB. The default value 00377 * is false to indicate that the RT_Collocation_Resolver will be 00378 * loaded if the RTORB is used. 00379 */ 00380 bool disable_rt_collocation_resolver_; 00381 00382 bool enforce_preferred_interfaces_; 00383 00384 #if defined (ACE_HAS_IPV6) 00385 /// Prefer to connect IPv6 over IPv4 Yes or No. 00386 bool prefer_ipv6_interfaces_; 00387 00388 /** 00389 * Only connect to (client) or listen on and accept from (server) 00390 * IPv6 interfaces Yes or No. 00391 */ 00392 bool connect_ipv6_only_; 00393 00394 /// Include Link Local IPv6 profiles to IOR Yes or No. 00395 bool use_ipv6_link_local_; 00396 #endif /* ACE_HAS_IPV6 */ 00397 00398 /// Enable the use of codeset negotiation 00399 bool negotiate_codesets_; 00400 00401 /// Do we make collocated ami calls 00402 bool ami_collication_; 00403 00404 /** 00405 * Name of the protocols_hooks that needs to be instantiated. 00406 * The default value is "Protocols_Hooks". If RTCORBA option is 00407 * set, its value will be set to be "RT_Protocols_Hooks". 00408 */ 00409 ACE_CString protocols_hooks_name_; 00410 00411 /** 00412 * Name of the stub factory that needs to be instantiated. 00413 * The default value is "Default_Stub_Factory". If TAO_RTCORBA is 00414 * linked, the set_stub_factory will be called to set the value 00415 * to be "RT_Stub_Factory". 00416 */ 00417 ACE_CString stub_factory_name_; 00418 00419 /** 00420 * Name of the endpoint selector factory that needs to be instantiated. 00421 * The default value is "Default_Endpoint_Selector_Factory". If 00422 * TAO_RTCORBA is linked, the set_endpoint_selector_factory will be 00423 * called to set the value to be "RT_Endpoint_Selector_Factory". 00424 */ 00425 ACE_CString endpoint_selector_factory_name_; 00426 00427 /** 00428 * Name of the thread lane resources manager that needs to be 00429 * instantiated. The default value is 00430 * "Default_Thread_Lane_Resources_Manager_Factory". If TAO_RTCORBA 00431 * is linked, the set_thread_lane_resources_manager will be called 00432 * to set the value to be 00433 * "RT_Thread_Lane_Resources_Manager_Factory". 00434 */ 00435 ACE_CString thread_lane_resources_manager_factory_name_; 00436 00437 /** 00438 * Name of the service object used to create the RootPOA. The 00439 * default value is "TAO_POA". If TAO_RTCORBA is loaded, this 00440 * will be changed to TAO_RT_POA so that a POA equipped with 00441 * realtime extensions will be returned. 00442 */ 00443 ACE_CString poa_factory_name_; 00444 00445 /** 00446 * The service configurator directive used to load 00447 * poa_factory_name_ dynamically. 00448 */ 00449 ACE_CString poa_factory_directive_; 00450 00451 /** 00452 * Name of the collocation resolver that needs to be instantiated. 00453 * The default value is "Default_Collocation_Resolver". If 00454 * TAO_RTCORBA is linked, the set_collocation_resolver will be 00455 * called to set the value to be "RT_Collocation_Resolver". 00456 */ 00457 ACE_CString collocation_resolver_name_; 00458 }; 00459 00460 TAO_END_VERSIONED_NAMESPACE_DECL 00461 00462 #if defined (__ACE_INLINE__) 00463 # include "tao/params.inl" 00464 #endif /* __ACE_INLINE__ */ 00465 00466 #include /**/ "ace/post.h" 00467 00468 #endif /* TAO_PARAMS_H */