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