3 //=============================================================================
7 * @author Chris Cleeland
9 //=============================================================================
14 #include /**/ "ace/pre.h"
15 #include "tao/Invocation_Retry_Params.h"
16 #include "ace/Unbounded_Queue.h"
17 #include "ace/Array_Map.h"
18 #include "ace/Synch.h"
19 #include "ace/Time_Value.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/SString.h"
27 #include "tao/objectid.h"
28 #include "tao/CORBA_String.h"
30 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
34 // @@ Using an ACE_Unbounded_Queue to contain the endpoints and
35 // preconnects may not be the best container to use. However, it
36 // will only be used during ORB bootstrapping. Also, a template
37 // instantiation of ACE_Unbounded_Queue<ACE_CString> already exists
38 // in ACE so we do not have to worry about increasing TAO's
39 // footprint by using this container.
40 typedef ACE_Unbounded_Queue
<ACE_CString
> TAO_EndpointSet
;
41 typedef ACE_Unbounded_Queue_Const_Iterator
<ACE_CString
> TAO_EndpointSetIterator
;
43 // -------------------------------------------------------------------
46 * @class TAO_ORB_Parameters
48 * @brief Parameters that are specific to the ORB. These parameters can
49 * be for the client, the server, or for both.
51 class TAO_Export TAO_ORB_Parameters
55 typedef ACE_Array_Map
<ACE_CString
, ACE_CString
> endpoints_map_type
;
58 TAO_ORB_Parameters ();
60 /// Specifies the endpoints on which this server is willing to
61 /// listen for requests.
62 int add_endpoints (const ACE_CString
&lane
,
63 const ACE_CString
&endpoints
);
64 void get_endpoint_set (const ACE_CString
&lane
,
65 TAO_EndpointSet
&endpoint_set
);
67 /// Set/Get the port of services locatable through multicast.
68 CORBA::UShort
service_port (TAO::MCAST_SERVICEID service_id
) const;
69 void service_port (TAO::MCAST_SERVICEID service_id
, CORBA::UShort port
);
71 /// Get/Set address:port for Multicast Discovery Protocol for
72 /// the Naming Service.
73 const char *mcast_discovery_endpoint () const;
74 void mcast_discovery_endpoint (const char *mde
);
76 /// Set/Get the size to be used for a socket's receive buffer.
77 int sock_rcvbuf_size () const;
78 void sock_rcvbuf_size (int);
80 /// Set/Get the size to be used for a socket's send buffer.
81 int sock_sndbuf_size () const;
82 void sock_sndbuf_size (int);
84 /// Set/Get the status of whether to use TCP_NODELAY or not.
88 /// Set/Get whether we should set SO_KEEPALIVE on the socket or not.
89 int sock_keepalive ();
90 void sock_keepalive (int);
92 /// Set/Get whether we should set SO_DONTROUTE on the socket or not.
93 int sock_dontroute ();
94 void sock_dontroute (int);
96 /// Set/Get the number of hops to be used for datagrams sent through socket.
98 void ip_hoplimit (int);
100 /// Set/Get whether we should set IP_MULTICAST_LOOP on the socket or not.
101 bool ip_multicastloop ();
102 void ip_multicastloop (bool);
104 /// Set/Get client side port span values
105 u_short
iiop_client_port_base ();
106 void iiop_client_port_base (u_short
);
107 u_short
iiop_client_port_span ();
108 void iiop_client_port_span (u_short
);
111 * Octet sequences are marshalled without doing any copies, we
112 * simply append a block to the CDR message block chain. When the
113 * octet sequence is small enough and there is room in the current
114 * message block it is more efficient just to copy the buffer.
116 int cdr_memcpy_tradeoff () const;
117 void cdr_memcpy_tradeoff (int);
120 * Maximum size of a GIOP message before outgoing fragmentation
124 ACE_CDR::ULong
max_message_size () const;
125 void max_message_size (ACE_CDR::ULong size
);
128 /// The ORB will use the dotted decimal notation for addresses. By
129 /// default we use the full ascii names.
130 int use_dotted_decimal_addresses () const;
131 void use_dotted_decimal_addresses (int);
133 /// The ORB will cache incoming connections against the dotted
134 /// decimal form of the peer's address
135 int cache_incoming_by_dotted_decimal_address () const;
136 void cache_incoming_by_dotted_decimal_address (int);
138 /// The ORB will turn off SO_LINGER if this is zero.
142 /// The amount of time desired by the user to wait to accept
143 /// connections after a particular type of accept() error.
144 time_t accept_error_delay () const;
145 void accept_error_delay (time_t);
147 /// Set/Get the Init Reference of an arbitrary ObjectID.
148 char *default_init_ref () const;
149 void default_init_ref (const char *default_init_ref
);
151 /// Disable the OMG standard profile components, useful for
152 /// homogenous environments.
153 bool std_profile_components () const;
154 void std_profile_components (bool x
);
156 /// Scheduling policy.
158 * Scheduling policy specified by the user through the
159 * -ORBSchedPolicy option. This value is typically used by
160 * functions like ACE_OS::thr_setprio() and
161 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
162 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
164 int ace_sched_policy () const;
165 void ace_sched_policy (int x
);
167 /// Scheduling policy flag.
169 * Scheduling policy specified by the user through the
170 * -ORBSchedPolicy option. This value is typically used by ACE
171 * thread creation functions. Legal values are THR_SCHED_RR,
172 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
174 long sched_policy () const;
175 void sched_policy (long x
);
177 /// Scheduling scope flag.
179 * Scheduling policy specified by the user through the
180 * -ORBScopePolicy option. This value is typically used by ACE
181 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
184 long scope_policy () const;
185 void scope_policy (long x
);
187 /// Thread creation flags.
189 * Shorthand for OR'ing together the scope_policy and sched_policy.
191 long thread_creation_flags () const;
193 /// Single read optimization.
194 int single_read_optimization () const;
195 void single_read_optimization (int x
);
197 /// Create shared profiles without priority
198 int shared_profile () const;
199 void shared_profile (int x
);
201 /// Want to use parallel connection attempts when profiles have multiple
203 bool use_parallel_connects() const;
204 void use_parallel_connects (bool x
);
206 /// The milliseconds delay used to stagger individual connection starts
207 /// when using parallel connects.
208 unsigned long parallel_connect_delay () const;
209 void parallel_connect_delay (unsigned long x
);
211 /// Mutators and accessors for rt_collocation_resolver
212 bool disable_rt_collocation_resolver () const;
213 void disable_rt_collocation_resolver (bool);
215 /// Accepts the list of preferred interfaces and does a simple
216 /// semantic check on the string before setting. Also the getter.
217 bool preferred_interfaces (const char *s
);
218 const char *preferred_interfaces () const;
220 /// Utility function called by the preferred interfaces setter
221 static bool check_preferred_interfaces_string (const char *);
223 void enforce_pref_interfaces (bool p
);
224 bool enforce_pref_interfaces () const;
226 #if defined (ACE_HAS_IPV6)
227 void prefer_ipv6_interfaces (bool p
);
228 bool prefer_ipv6_interfaces () const;
230 void connect_ipv6_only (bool p
);
231 bool connect_ipv6_only () const;
233 void use_ipv6_link_local (bool p
);
234 bool use_ipv6_link_local () const;
235 #endif /* ACE_HAS_IPV6 */
237 void negotiate_codesets (bool c
);
238 bool negotiate_codesets () const;
240 void ami_collication (bool opt
);
241 bool ami_collication () const;
243 void protocols_hooks_name (const char *s
);
244 const char *protocols_hooks_name () const;
246 void thread_lane_resources_manager_factory_name (const char *s
);
247 const char *thread_lane_resources_manager_factory_name () const;
249 void dynamic_thread_pool_config_name (const char *s
);
250 const char *dynamic_thread_pool_config_name () const;
252 void stub_factory_name (const char *s
);
253 const char *stub_factory_name () const;
255 void poa_factory_name (const char *s
);
256 const char *poa_factory_name () const;
258 void poa_factory_directive (const ACE_TCHAR
*s
);
259 const ACE_TCHAR
*poa_factory_directive () const;
261 void endpoint_selector_factory_name (const char *s
);
262 const char *endpoint_selector_factory_name () const;
264 void collocation_resolver_name (const char *s
);
265 const char *collocation_resolver_name () const;
267 void forward_invocation_on_object_not_exist (bool opt
);
268 bool forward_invocation_on_object_not_exist () const;
270 void forward_on_exception_limit (const int ef
, const int limit
);
271 void forward_on_exception_delay (const ACE_Time_Value
&delay
);
273 TAO::Invocation_Retry_Params
&invocation_retry_params ();
274 const TAO::Invocation_Retry_Params
&invocation_retry_params () const;
276 void forward_once_exception (const int ef
);
277 int forward_once_exception () const;
279 void allow_ziop_no_server_policies (bool opt
);
280 bool allow_ziop_no_server_policies () const;
283 /// Each "endpoint" is of the form:
285 /// protocol://V.v@addr1,...,W.w@addrN/
289 /// protocol://addr1,addr2,...,addrN/
291 /// where "V.v" and "W.w" are optional versions.
293 /// Multiple sets of endpoints may be separated by a semi-colon `;'.
296 /// iiop://space:2001,odyssey:2010;uiop://foo,bar
298 /// All preconnect or endpoint strings should be of the above form(s).
299 int parse_and_add_endpoints (const ACE_CString
&endpoints
,
300 TAO_EndpointSet
&endpoint_set
);
302 /// Map of endpoints this server is willing to accept requests on.
303 endpoints_map_type endpoints_map_
;
305 /// Port numbers of the configured services.
306 CORBA::UShort service_port_
[TAO_NO_OF_MCAST_SERVICES
];
308 /// Address:port for Multicast Discovery Protocol for the Naming
310 CORBA::String_var mcast_discovery_endpoint_
;
312 /// List of comma separated prefixes from ORBDefaultInitRef.
313 ACE_CString default_init_ref_
;
315 /// Size to be used for a socket's receive buffer.
316 int sock_rcvbuf_size_
;
318 /// Size to be used for a socket's send buffer.
319 int sock_sndbuf_size_
;
321 /// 1 if we're using TCP_NODELAY and 0 otherwise.
324 /// 1 if we're using SO_KEEPALIVE and 0 otherwise (default 0).
327 /// 1 if we're using SO_DONTROUTE and 0 otherwise (default 0).
330 /// Number of hops to be used for datagrams sent through socket.
333 /// 1 if we're using IP_MULTICAST_LOOP and 0 otherwise.
334 bool ip_multicastloop_
;
336 /// define a range for local ports to use with IIOP connections
337 /// default base 0 to use ephemeral port. Span will be 0 if base is 0.
338 u_short iiop_client_port_base_
;
339 u_short iiop_client_port_span_
;
341 /// Control the strategy for copying vs. appending octet sequences in
343 int cdr_memcpy_tradeoff_
;
345 /// Maximum GIOP message size to be sent over a given transport.
347 * Setting a maximum message size will cause outgoing GIOP
348 * fragmentation to be enabled.
350 ACE_CDR::ULong max_message_size_
;
352 /// For selecting a address notation
353 int use_dotted_decimal_addresses_
;
355 /// If incoming connections should be cached against IP (true) or
356 /// hostname (false).
357 int cache_incoming_by_dotted_decimal_address_
;
359 /// For setting the SO_LINGER option
362 /// For setting the accept retry delay
363 time_t accept_error_delay_
;
365 /// If true then the standard OMG components are not generated.
366 bool std_profile_components_
;
368 /// Scheduling policy.
370 * Scheduling policy specified by the user through the
371 * -ORBSchedPolicy option. This value is typically used by
372 * functions like ACE_OS::thr_setprio() and
373 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
374 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
376 int ace_sched_policy_
;
378 /// Scheduling policy flag.
380 * Scheduling policy specified by the user through the
381 * -ORBSchedPolicy option. This value is typically used by ACE
382 * thread creation functions. Legal values are THR_SCHED_RR,
383 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
387 /// Scheduling scope flag.
389 * Scheduling policy specified by the user through the
390 * -ORBScopePolicy option. This value is typically used by ACE
391 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
396 /// Single read optimization.
397 int single_read_optimization_
;
399 /// Shared Profile - Use the same profile for multiple endpoints
402 /// Use Parallel Connects - Try to connect to all endpoints in a
403 /// shared profile at once, use the first to complete.
404 int use_parallel_connects_
;
406 /// When using parallel connects, this delay is used to stagger connection
407 /// attempts. This gives a trade-off between opening more potential
408 /// connections than necessary vs increasing the potential time before
409 /// a good connection is discovered. Time is expressed in milliseconds.
410 unsigned long parallel_connect_delay_
;
412 /// Preferred network interfaces as a string
413 ACE_CString pref_network_
;
415 /// Default collocation resolver
417 * The vanilla ORB has only one collocation resolver. But if the
418 * RTORB is in place, the RTORB can get in a new collocation
419 * resolver. There are some applications that would like to use the
420 * default collocation resolver with the RTORB. This boolean is the
421 * value of the option that the application passes in to enable/disable
422 * the use of RT collocation resolver with the RTORB. The default value
423 * is false to indicate that the RT_Collocation_Resolver will be
424 * loaded if the RTORB is used.
426 bool disable_rt_collocation_resolver_
;
428 bool enforce_preferred_interfaces_
;
430 #if defined (ACE_HAS_IPV6)
431 /// Prefer to connect IPv6 over IPv4 Yes or No.
432 bool prefer_ipv6_interfaces_
;
435 * Only connect to (client) or listen on and accept from (server)
436 * IPv6 interfaces Yes or No.
438 bool connect_ipv6_only_
;
440 /// Include Link Local IPv6 profiles to IOR Yes or No.
441 bool use_ipv6_link_local_
;
442 #endif /* ACE_HAS_IPV6 */
444 /// Enable the use of codeset negotiation
445 bool negotiate_codesets_
;
447 /// Do we make collocated ami calls
448 bool ami_collication_
;
451 * Name of the protocols_hooks that needs to be instantiated.
452 * The default value is "Protocols_Hooks". If RTCORBA option is
453 * set, its value will be set to be "RT_Protocols_Hooks".
455 ACE_CString protocols_hooks_name_
;
458 * Name of the stub factory that needs to be instantiated.
459 * The default value is "Default_Stub_Factory". If TAO_RTCORBA is
460 * linked, the set_stub_factory will be called to set the value
461 * to be "RT_Stub_Factory".
463 ACE_CString stub_factory_name_
;
466 * Name of the endpoint selector factory that needs to be instantiated.
467 * The default value is "Default_Endpoint_Selector_Factory". If
468 * TAO_RTCORBA is linked, the set_endpoint_selector_factory will be
469 * called to set the value to be "RT_Endpoint_Selector_Factory".
471 ACE_CString endpoint_selector_factory_name_
;
474 * Name of the thread lane resources manager that needs to be
475 * instantiated. The default value is
476 * "Default_Thread_Lane_Resources_Manager_Factory". If TAO_RTCORBA
477 * is linked, the set_thread_lane_resources_manager will be called
478 * to set the value to be
479 * "RT_Thread_Lane_Resources_Manager_Factory".
481 ACE_CString thread_lane_resources_manager_factory_name_
;
484 * Name of the non-RT dynamic thread pool configuration set to load.
485 * This is only used if the Dynamic_TP library is linked. Default
486 * is an empty string.
488 ACE_CString dynamic_thread_pool_config_name_
;
491 * Name of the service object used to create the RootPOA. The
492 * default value is "TAO_POA". If TAO_RTCORBA is loaded, this
493 * will be changed to TAO_RT_POA so that a POA equipped with
494 * realtime extensions will be returned.
496 ACE_CString poa_factory_name_
;
499 * The service configurator directive used to load
500 * poa_factory_name_ dynamically.
502 ACE_TString poa_factory_directive_
;
506 * Do we need forward invocation to next avaiable profile upon
507 * OBJECT_NOT_EXIST exception?
509 bool forward_invocation_on_object_not_exist_
;
511 TAO::Invocation_Retry_Params invocation_retry_params_
;
514 * The exceptions upon which the requests will be forwarded once.
515 * This is retained for backward compatibility of behavior.
517 int forward_once_exception_
;
520 * Name of the collocation resolver that needs to be instantiated.
521 * The default value is "Default_Collocation_Resolver". If
522 * TAO_RTCORBA is linked, the set_collocation_resolver will be
523 * called to set the value to be "RT_Collocation_Resolver".
525 ACE_CString collocation_resolver_name_
;
527 // Allows a client to ZIOP compress without having any server
528 // ZIOP available compressor's list policies. THIS IS GOING DIRECTLY
529 // AGAINST THE CORBA Compressed GIOP (ZIOP) V1.0 specification, but
530 // allows us to use ZIOP with MIOP and/or CORBALOCs.
531 // We have to trust the end user knows what his system is configured to allow;
532 // Any servers that cannot decompress the client's used ZIOP compressor will
533 // reject the request as they simply cannot decode or handle it (comms will
534 // simply timeout or lock-up at the client for any such incorrect two-way requests).
535 bool allow_ziop_no_server_policies_
;
538 TAO_END_VERSIONED_NAMESPACE_DECL
540 #if defined (__ACE_INLINE__)
541 # include "tao/params.inl"
542 #endif /* __ACE_INLINE__ */
544 #include /**/ "ace/post.h"
546 #endif /* TAO_PARAMS_H */