00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file params.h 00006 * 00007 * params.h,v 1.97 2006/04/26 19:18:14 mesnier_p Exp 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 #endif /* ACE_HAS_IPV6 */ 00211 00212 void negotiate_codesets (bool c); 00213 bool negotiate_codesets (void) const; 00214 00215 private: 00216 // Each "endpoint" is of the form: 00217 // 00218 // protocol://V.v@addr1,...,W.w@addrN/ 00219 // 00220 // or: 00221 // 00222 // protocol://addr1,addr2,...,addrN/ 00223 // 00224 // where "V.v" and "W.w" are optional versions. 00225 // 00226 // Multiple sets of endpoints may be seperated by a semi-colon `;'. 00227 // For example: 00228 // 00229 // iiop://space:2001,odyssey:2010;uiop://foo,bar 00230 // 00231 // All preconnect or endpoint strings should be of the above form(s). 00232 int parse_and_add_endpoints (const ACE_CString &endpoints, 00233 TAO_EndpointSet &endpoint_set); 00234 00235 /// Map of endpoints this server is willing to accept requests on. 00236 endpoints_map_type endpoints_map_; 00237 00238 /// Port numbers of the configured services. 00239 CORBA::UShort service_port_[TAO_NO_OF_MCAST_SERVICES]; 00240 00241 /// Address:port for Multicast Discovery Protocol for the Naming 00242 /// Service. 00243 CORBA::String_var mcast_discovery_endpoint_; 00244 00245 /// List of comma separated prefixes from ORBDefaultInitRef. 00246 ACE_CString default_init_ref_; 00247 00248 /// Size to be used for a socket's receive buffer. 00249 int sock_rcvbuf_size_; 00250 00251 /// Size to be used for a socket's send buffer. 00252 int sock_sndbuf_size_; 00253 00254 /// 1 if we're using TCP_NODELAY and 0 otherwise. 00255 int nodelay_; 00256 00257 /// 1 if we're using SO_KEEPALIVE and 0 otherwise (default 0). 00258 int sock_keepalive_; 00259 00260 /// 1 if we're using SO_DONTROUTE and 0 otherwise (default 0). 00261 int sock_dontroute_; 00262 00263 /// Control the strategy for copying vs. appeding octet sequences in 00264 /// CDR streams. 00265 int cdr_memcpy_tradeoff_; 00266 00267 /// Maximum GIOP message size to be sent over a given transport. 00268 /** 00269 * Setting a maximum message size will cause outgoing GIOP 00270 * fragmentation to be enabled. 00271 */ 00272 ACE_CDR::ULong max_message_size_; 00273 00274 /// For selecting a liteweight version of the GIOP protocol. 00275 int use_lite_protocol_; 00276 00277 /// For selecting a address notation 00278 int use_dotted_decimal_addresses_; 00279 00280 /// If incoming connections should be cached against IP (true) or 00281 /// hostname (false). 00282 int cache_incoming_by_dotted_decimal_address_; 00283 00284 /// For setting the SO_LINGER option 00285 int linger_; 00286 00287 /// If true then the standard OMG components are not generated. 00288 int std_profile_components_; 00289 00290 /// Scheduling policy. 00291 /** 00292 * Scheduling policy specified by the user through the 00293 * -ORBSchedPolicy option. This value is typically used by 00294 * functions like ACE_OS::thr_setprio() and 00295 * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR, 00296 * ACE_SCHED_FIFO, and ACE_SCHED_OTHER. 00297 */ 00298 int ace_sched_policy_; 00299 00300 /// Scheduling policy flag. 00301 /** 00302 * Scheduling policy specified by the user through the 00303 * -ORBSchedPolicy option. This value is typically used by ACE 00304 * thread creation functions. Legal values are THR_SCHED_RR, 00305 * THR_SCHED_FIFO, and THR_SCHED_DEFAULT. 00306 */ 00307 long sched_policy_; 00308 00309 /// Scheduling scope flag. 00310 /** 00311 * Scheduling policy specified by the user through the 00312 * -ORBScopePolicy option. This value is typically used by ACE 00313 * thread creation functions. Legal values are THR_SCOPE_SYSTEM and 00314 * THR_SCOPE_PROCESS. 00315 */ 00316 long scope_policy_; 00317 00318 /// Single read optimization. 00319 int single_read_optimization_; 00320 00321 /// Shared Profile - Use the same profile for multiple endpoints 00322 int shared_profile_; 00323 00324 /// Use Parallel Connects - Try to connect to all endpoints in a 00325 /// shared profile at once, use the first to complete. 00326 int use_parallel_connects_; 00327 00328 /// When using parallel connects, this delay is used to stagger connection 00329 /// attempts. This gives a trade-off between opening more potential 00330 /// connections than necessary vs increasing the potential time before 00331 /// a good connection is discovered. Time is expressed in milliseconds. 00332 unsigned long parallel_connect_delay_; 00333 00334 /// Preferred network interfaces as a string 00335 ACE_CString pref_network_; 00336 00337 /// Default collocation resolver 00338 /** 00339 * The vanilla ORB has only one collocation resolver. But if the 00340 * RTORB is in place, the RTORB can get in a new collocation 00341 * resolver. There are some applications that would like to use the 00342 * default collocation resolver with the RTORB. This boolean is the 00343 * value of the option that the application passes in to enable/disable 00344 * the use of RT collocation resolver with the RTORB. The default value 00345 * is false to indicate that the RT_Collocation_Resolver will be 00346 * loaded if the RTORB is used. 00347 */ 00348 bool disable_rt_collocation_resolver_; 00349 00350 bool enforce_preferred_interfaces_; 00351 00352 #if defined (ACE_HAS_IPV6) 00353 /// Prefer to connect IPv6 over IPv4 Yes or No. 00354 bool prefer_ipv6_interfaces_; 00355 00356 /** 00357 * Only connect to (client) or listen on and accept from (server) 00358 * IPv6 interfaces Yes or No. 00359 */ 00360 bool connect_ipv6_only_; 00361 #endif /* ACE_HAS_IPV6 */ 00362 00363 /// Enable the use of codeset negotiation 00364 bool negotiate_codesets_; 00365 }; 00366 00367 TAO_END_VERSIONED_NAMESPACE_DECL 00368 00369 #if defined (__ACE_INLINE__) 00370 # include "tao/params.i" 00371 #endif /* __ACE_INLINE__ */ 00372 00373 #include /**/ "ace/post.h" 00374 00375 #endif /* TAO_PARAMS_H */