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
54 typedef ACE_Array_Map
<ACE_CString
, ACE_CString
> endpoints_map_type
;
57 TAO_ORB_Parameters ();
59 /// Specifies the endpoints on which this server is willing to
60 /// listen for requests.
61 int add_endpoints (const ACE_CString
&lane
,
62 const ACE_CString
&endpoints
);
63 void get_endpoint_set (const ACE_CString
&lane
,
64 TAO_EndpointSet
&endpoint_set
);
66 /// Set/Get the port of services locatable through multicast.
67 CORBA::UShort
service_port (TAO::MCAST_SERVICEID service_id
) const;
68 void service_port (TAO::MCAST_SERVICEID service_id
, CORBA::UShort port
);
70 /// Get/Set address:port for Multicast Discovery Protocol for
71 /// the Naming Service.
72 const char *mcast_discovery_endpoint () const;
73 void mcast_discovery_endpoint (const char *mde
);
75 /// Set/Get the size to be used for a socket's receive buffer.
76 int sock_rcvbuf_size () const;
77 void sock_rcvbuf_size (int);
79 /// Set/Get the size to be used for a socket's send buffer.
80 int sock_sndbuf_size () const;
81 void sock_sndbuf_size (int);
83 /// Set/Get the status of whether to use TCP_NODELAY or not.
87 /// Set/Get whether we should set SO_KEEPALIVE on the socket or not.
88 int sock_keepalive ();
89 void sock_keepalive (int);
91 /// Set/Get whether we should set SO_DONTROUTE on the socket or not.
92 int sock_dontroute ();
93 void sock_dontroute (int);
95 /// Set/Get the number of hops to be used for datagrams sent through socket.
97 void ip_hoplimit (int);
99 /// Set/Get whether we should set IP_MULTICAST_LOOP on the socket or not.
100 bool ip_multicastloop ();
101 void ip_multicastloop (bool);
103 /// Set/Get client side port span values
104 u_short
iiop_client_port_base ();
105 void iiop_client_port_base (u_short
);
106 u_short
iiop_client_port_span ();
107 void iiop_client_port_span (u_short
);
110 * Octet sequences are marshalled without doing any copies, we
111 * simply append a block to the CDR message block chain. When the
112 * octet sequence is small enough and there is room in the current
113 * message block it is more efficient just to copy the buffer.
115 int cdr_memcpy_tradeoff () const;
116 void cdr_memcpy_tradeoff (int);
119 * Maximum size of a GIOP message before outgoing fragmentation
123 ACE_CDR::ULong
max_message_size () const;
124 void max_message_size (ACE_CDR::ULong size
);
127 /// The ORB will use the dotted decimal notation for addresses. By
128 /// default we use the full ascii names.
129 int use_dotted_decimal_addresses () const;
130 void use_dotted_decimal_addresses (int);
132 /// The ORB will cache incoming connections against the dotted
133 /// decimal form of the peer's address
134 int cache_incoming_by_dotted_decimal_address () const;
135 void cache_incoming_by_dotted_decimal_address (int);
137 /// The ORB will turn off SO_LINGER if this is zero.
141 /// The amount of time desired by the user to wait to accept
142 /// connections after a particular type of accept() error.
143 time_t accept_error_delay () const;
144 void accept_error_delay (time_t);
146 /// Set/Get the Init Reference of an arbitrary ObjectID.
147 char *default_init_ref () const;
148 void default_init_ref (const char *default_init_ref
);
150 /// Disable the OMG standard profile components, useful for
151 /// homogenous environments.
152 bool std_profile_components () const;
153 void std_profile_components (bool x
);
155 /// Scheduling policy.
157 * Scheduling policy specified by the user through the
158 * -ORBSchedPolicy option. This value is typically used by
159 * functions like ACE_OS::thr_setprio() and
160 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
161 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
163 int ace_sched_policy () const;
164 void ace_sched_policy (int x
);
166 /// Scheduling policy flag.
168 * Scheduling policy specified by the user through the
169 * -ORBSchedPolicy option. This value is typically used by ACE
170 * thread creation functions. Legal values are THR_SCHED_RR,
171 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
173 long sched_policy () const;
174 void sched_policy (long x
);
176 /// Scheduling scope flag.
178 * Scheduling policy specified by the user through the
179 * -ORBScopePolicy option. This value is typically used by ACE
180 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
183 long scope_policy () const;
184 void scope_policy (long x
);
186 /// Thread creation flags.
188 * Shorthand for OR'ing together the scope_policy and sched_policy.
190 long thread_creation_flags () const;
192 /// Single read optimization.
193 int single_read_optimization () const;
194 void single_read_optimization (int x
);
196 /// Create shared profiles without priority
197 int shared_profile () const;
198 void shared_profile (int x
);
200 /// Want to use parallel connection attempts when profiles have multiple
202 bool use_parallel_connects() const;
203 void use_parallel_connects (bool x
);
205 /// The milliseconds delay used to stagger individual connection starts
206 /// when using parallel connects.
207 unsigned long parallel_connect_delay () const;
208 void parallel_connect_delay (unsigned long x
);
210 /// Mutators and accessors for rt_collocation_resolver
211 bool disable_rt_collocation_resolver () const;
212 void disable_rt_collocation_resolver (bool);
214 /// Accepts the list of preferred interfaces and does a simple
215 /// semantic check on the string before setting. Also the getter.
216 bool preferred_interfaces (const char *s
);
217 const char *preferred_interfaces () const;
219 /// Utility function called by the preferred interfaces setter
220 static bool check_preferred_interfaces_string (const char *);
222 void enforce_pref_interfaces (bool p
);
223 bool enforce_pref_interfaces () const;
225 #if defined (ACE_HAS_IPV6)
226 void prefer_ipv6_interfaces (bool p
);
227 bool prefer_ipv6_interfaces () const;
229 void connect_ipv6_only (bool p
);
230 bool connect_ipv6_only () const;
232 void use_ipv6_link_local (bool p
);
233 bool use_ipv6_link_local () const;
234 #endif /* ACE_HAS_IPV6 */
236 void negotiate_codesets (bool c
);
237 bool negotiate_codesets () const;
239 void ami_collication (bool opt
);
240 bool ami_collication () const;
242 void protocols_hooks_name (const char *s
);
243 const char *protocols_hooks_name () const;
245 void thread_lane_resources_manager_factory_name (const char *s
);
246 const char *thread_lane_resources_manager_factory_name () const;
248 void dynamic_thread_pool_config_name (const char *s
);
249 const char *dynamic_thread_pool_config_name () const;
251 void stub_factory_name (const char *s
);
252 const char *stub_factory_name () const;
254 void poa_factory_name (const char *s
);
255 const char *poa_factory_name () const;
257 void poa_factory_directive (const ACE_TCHAR
*s
);
258 const ACE_TCHAR
*poa_factory_directive () const;
260 void endpoint_selector_factory_name (const char *s
);
261 const char *endpoint_selector_factory_name () const;
263 void collocation_resolver_name (const char *s
);
264 const char *collocation_resolver_name () const;
266 void forward_invocation_on_object_not_exist (bool opt
);
267 bool forward_invocation_on_object_not_exist () const;
269 void forward_on_exception_limit (const int ef
, const int limit
);
270 void forward_on_exception_delay (const ACE_Time_Value
&delay
);
272 TAO::Invocation_Retry_Params
&invocation_retry_params ();
273 const TAO::Invocation_Retry_Params
&invocation_retry_params () const;
275 void forward_once_exception (const int ef
);
276 int forward_once_exception () const;
278 void allow_ziop_no_server_policies (bool opt
);
279 bool allow_ziop_no_server_policies () const;
282 /// Each "endpoint" is of the form:
284 /// protocol://V.v@addr1,...,W.w@addrN/
288 /// protocol://addr1,addr2,...,addrN/
290 /// where "V.v" and "W.w" are optional versions.
292 /// Multiple sets of endpoints may be separated by a semi-colon `;'.
295 /// iiop://space:2001,odyssey:2010;uiop://foo,bar
297 /// All preconnect or endpoint strings should be of the above form(s).
298 int parse_and_add_endpoints (const ACE_CString
&endpoints
,
299 TAO_EndpointSet
&endpoint_set
);
301 /// Map of endpoints this server is willing to accept requests on.
302 endpoints_map_type endpoints_map_
;
304 /// Port numbers of the configured services.
305 CORBA::UShort service_port_
[TAO_NO_OF_MCAST_SERVICES
];
307 /// Address:port for Multicast Discovery Protocol for the Naming
309 CORBA::String_var mcast_discovery_endpoint_
;
311 /// List of comma separated prefixes from ORBDefaultInitRef.
312 ACE_CString default_init_ref_
;
314 /// Size to be used for a socket's receive buffer.
315 int sock_rcvbuf_size_
;
317 /// Size to be used for a socket's send buffer.
318 int sock_sndbuf_size_
;
320 /// 1 if we're using TCP_NODELAY and 0 otherwise.
323 /// 1 if we're using SO_KEEPALIVE and 0 otherwise (default 0).
326 /// 1 if we're using SO_DONTROUTE and 0 otherwise (default 0).
329 /// Number of hops to be used for datagrams sent through socket.
332 /// 1 if we're using IP_MULTICAST_LOOP and 0 otherwise.
333 bool ip_multicastloop_
;
335 /// define a range for local ports to use with IIOP connections
336 /// default base 0 to use ephemeral port. Span will be 0 if base is 0.
337 u_short iiop_client_port_base_
;
338 u_short iiop_client_port_span_
;
340 /// Control the strategy for copying vs. appending octet sequences in
342 int cdr_memcpy_tradeoff_
;
344 /// Maximum GIOP message size to be sent over a given transport.
346 * Setting a maximum message size will cause outgoing GIOP
347 * fragmentation to be enabled.
349 ACE_CDR::ULong max_message_size_
;
351 /// For selecting a address notation
352 int use_dotted_decimal_addresses_
;
354 /// If incoming connections should be cached against IP (true) or
355 /// hostname (false).
356 int cache_incoming_by_dotted_decimal_address_
;
358 /// For setting the SO_LINGER option
361 /// For setting the accept retry delay
362 time_t accept_error_delay_
;
364 /// If true then the standard OMG components are not generated.
365 bool std_profile_components_
;
367 /// Scheduling policy.
369 * Scheduling policy specified by the user through the
370 * -ORBSchedPolicy option. This value is typically used by
371 * functions like ACE_OS::thr_setprio() and
372 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
373 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
375 int ace_sched_policy_
;
377 /// Scheduling policy flag.
379 * Scheduling policy specified by the user through the
380 * -ORBSchedPolicy option. This value is typically used by ACE
381 * thread creation functions. Legal values are THR_SCHED_RR,
382 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
386 /// Scheduling scope flag.
388 * Scheduling policy specified by the user through the
389 * -ORBScopePolicy option. This value is typically used by ACE
390 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
395 /// Single read optimization.
396 int single_read_optimization_
;
398 /// Shared Profile - Use the same profile for multiple endpoints
401 /// Use Parallel Connects - Try to connect to all endpoints in a
402 /// shared profile at once, use the first to complete.
403 int use_parallel_connects_
;
405 /// When using parallel connects, this delay is used to stagger connection
406 /// attempts. This gives a trade-off between opening more potential
407 /// connections than necessary vs increasing the potential time before
408 /// a good connection is discovered. Time is expressed in milliseconds.
409 unsigned long parallel_connect_delay_
;
411 /// Preferred network interfaces as a string
412 ACE_CString pref_network_
;
414 /// Default collocation resolver
416 * The vanilla ORB has only one collocation resolver. But if the
417 * RTORB is in place, the RTORB can get in a new collocation
418 * resolver. There are some applications that would like to use the
419 * default collocation resolver with the RTORB. This boolean is the
420 * value of the option that the application passes in to enable/disable
421 * the use of RT collocation resolver with the RTORB. The default value
422 * is false to indicate that the RT_Collocation_Resolver will be
423 * loaded if the RTORB is used.
425 bool disable_rt_collocation_resolver_
;
427 bool enforce_preferred_interfaces_
;
429 #if defined (ACE_HAS_IPV6)
430 /// Prefer to connect IPv6 over IPv4 Yes or No.
431 bool prefer_ipv6_interfaces_
;
434 * Only connect to (client) or listen on and accept from (server)
435 * IPv6 interfaces Yes or No.
437 bool connect_ipv6_only_
;
439 /// Include Link Local IPv6 profiles to IOR Yes or No.
440 bool use_ipv6_link_local_
;
441 #endif /* ACE_HAS_IPV6 */
443 /// Enable the use of codeset negotiation
444 bool negotiate_codesets_
;
446 /// Do we make collocated ami calls
447 bool ami_collication_
;
450 * Name of the protocols_hooks that needs to be instantiated.
451 * The default value is "Protocols_Hooks". If RTCORBA option is
452 * set, its value will be set to be "RT_Protocols_Hooks".
454 ACE_CString protocols_hooks_name_
;
457 * Name of the stub factory that needs to be instantiated.
458 * The default value is "Default_Stub_Factory". If TAO_RTCORBA is
459 * linked, the set_stub_factory will be called to set the value
460 * to be "RT_Stub_Factory".
462 ACE_CString stub_factory_name_
;
465 * Name of the endpoint selector factory that needs to be instantiated.
466 * The default value is "Default_Endpoint_Selector_Factory". If
467 * TAO_RTCORBA is linked, the set_endpoint_selector_factory will be
468 * called to set the value to be "RT_Endpoint_Selector_Factory".
470 ACE_CString endpoint_selector_factory_name_
;
473 * Name of the thread lane resources manager that needs to be
474 * instantiated. The default value is
475 * "Default_Thread_Lane_Resources_Manager_Factory". If TAO_RTCORBA
476 * is linked, the set_thread_lane_resources_manager will be called
477 * to set the value to be
478 * "RT_Thread_Lane_Resources_Manager_Factory".
480 ACE_CString thread_lane_resources_manager_factory_name_
;
483 * Name of the non-RT dynamic thread pool configuration set to load.
484 * This is only used if the Dynamic_TP library is linked. Default
485 * is an empty string.
487 ACE_CString dynamic_thread_pool_config_name_
;
490 * Name of the service object used to create the RootPOA. The
491 * default value is "TAO_POA". If TAO_RTCORBA is loaded, this
492 * will be changed to TAO_RT_POA so that a POA equipped with
493 * realtime extensions will be returned.
495 ACE_CString poa_factory_name_
;
498 * The service configurator directive used to load
499 * poa_factory_name_ dynamically.
501 ACE_TString poa_factory_directive_
;
505 * Do we need forward invocation to next avaiable profile upon
506 * OBJECT_NOT_EXIST exception?
508 bool forward_invocation_on_object_not_exist_
;
510 TAO::Invocation_Retry_Params invocation_retry_params_
;
513 * The exceptions upon which the requests will be forwarded once.
514 * This is retained for backward compatibility of behavior.
516 int forward_once_exception_
;
519 * Name of the collocation resolver that needs to be instantiated.
520 * The default value is "Default_Collocation_Resolver". If
521 * TAO_RTCORBA is linked, the set_collocation_resolver will be
522 * called to set the value to be "RT_Collocation_Resolver".
524 ACE_CString collocation_resolver_name_
;
526 // Allows a client to ZIOP compress without having any server
527 // ZIOP available compressor's list policies. THIS IS GOING DIRECTLY
528 // AGAINST THE CORBA Compressed GIOP (ZIOP) V1.0 specification, but
529 // allows us to use ZIOP with MIOP and/or CORBALOCs.
530 // We have to trust the end user knows what his system is configured to allow;
531 // Any servers that cannot decompress the client's used ZIOP compressor will
532 // reject the request as they simply cannot decode or handle it (comms will
533 // simply timeout or lock-up at the client for any such incorrect two-way requests).
534 bool allow_ziop_no_server_policies_
;
537 TAO_END_VERSIONED_NAMESPACE_DECL
539 #if defined (__ACE_INLINE__)
540 # include "tao/params.inl"
541 #endif /* __ACE_INLINE__ */
543 #include /**/ "ace/post.h"
545 #endif /* TAO_PARAMS_H */