1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
|
#include "tao/params.h"
#include "tao/orbconf.h"
#include "tao/Version.h"
#if !defined (__ACE_INLINE__)
# include "tao/params.inl"
#endif /* __ACE_INLINE__ */
#include "ace/OS_NS_Thread.h"
#include "ace/Service_Config.h"
#include "tao/Invocation_Utils.h"
#if !defined (TAO_ALLOW_ZIOP_NO_SERVER_POLICIES_DEFAULT)
# define TAO_ALLOW_ZIOP_NO_SERVER_POLICIES_DEFAULT false
#endif /* !TAO_ALLOW_ZIOP_NO_SERVER_POLICIES_DEFAULT */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_ORB_Parameters::TAO_ORB_Parameters (void)
: endpoints_map_ (10)
, mcast_discovery_endpoint_ ()
, default_init_ref_ (TAO_DEFAULT_INIT_REFERENCE_INITIALIZER)
, sock_rcvbuf_size_ (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
, sock_sndbuf_size_ (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
, nodelay_ (1)
, sock_keepalive_ (0)
, sock_dontroute_ (0)
, ip_hoplimit_ (-1)
, ip_multicastloop_ (true)
, iiop_client_port_base_ (0)
, iiop_client_port_span_ (0)
, cdr_memcpy_tradeoff_ (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF)
, max_message_size_ (0) // Disable outgoing GIOP fragments by default
, use_dotted_decimal_addresses_ (0)
, cache_incoming_by_dotted_decimal_address_ (0)
, linger_ (-1)
, accept_error_delay_ (0)
, std_profile_components_ (1)
, ace_sched_policy_ (ACE_SCHED_OTHER)
, sched_policy_ (THR_SCHED_DEFAULT)
, scope_policy_ (THR_SCOPE_PROCESS)
, single_read_optimization_ (1)
, shared_profile_ (0)
, use_parallel_connects_ (false)
, parallel_connect_delay_ (0)
, pref_network_ ()
, disable_rt_collocation_resolver_ (false)
, enforce_preferred_interfaces_ (false)
#if defined (ACE_HAS_IPV6)
, prefer_ipv6_interfaces_ (false)
, connect_ipv6_only_ (false)
, use_ipv6_link_local_ (false)
#endif /* ACE_HAS_IPV6 */
, negotiate_codesets_ (true)
, ami_collication_ (true)
, protocols_hooks_name_ ("Protocols_Hooks")
, stub_factory_name_ ("Default_Stub_Factory")
, endpoint_selector_factory_name_ ("Default_Endpoint_Selector_Factory")
, thread_lane_resources_manager_factory_name_ ("Default_Thread_Lane_Resources_Manager_Factory")
, dynamic_thread_pool_config_name_ ()
, poa_factory_name_ ("TAO_Object_Adapter_Factory")
, poa_factory_directive_
(ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TAO_Object_Adapter_Factory",
"TAO_PortableServer",
TAO_VERSION,
"_make_TAO_Object_Adapter_Factory",
""))
, forward_invocation_on_object_not_exist_ (false)
, forward_once_exception_ (0)
, collocation_resolver_name_ ("Default_Collocation_Resolver")
, allow_ziop_no_server_policies_ (!!TAO_ALLOW_ZIOP_NO_SERVER_POLICIES_DEFAULT)
{
for (int i = 0; i != TAO_NO_OF_MCAST_SERVICES; ++i)
{
this->service_port_[i] = 0;
}
}
void
TAO_ORB_Parameters::get_endpoint_set (const ACE_CString &lane,
TAO_EndpointSet &endpoint_set)
{
// Look for the lane in the endpoints map.
endpoints_map_type::iterator const endpoints =
this->endpoints_map_.find (lane);
// If lane is not in the map, endpoint_set remains empty
if (endpoints == this->endpoints_map_.end ())
return;
// At this point, the parsing should not fail since they have been
// parsed successfully before.
int const result =
this->parse_and_add_endpoints ((*endpoints).second, endpoint_set);
ACE_ASSERT (result == 0);
ACE_UNUSED_ARG (result);
}
int
TAO_ORB_Parameters::add_endpoints (const ACE_CString &lane,
const ACE_CString &additional_endpoints)
{
TAO_EndpointSet endpoint_set;
// Parse the additional endpoints.
int const result =
this->parse_and_add_endpoints (additional_endpoints, endpoint_set);
// Parse failure.
if (result != 0)
return result;
// Look for the lane in the endpoints map.
//
// Return reference to endpoints string corresponding to lane
// string. If none, a default constructed string is inserted into
// the map and returned.
ACE_CString & existing_endpoints = this->endpoints_map_[lane];
// Create the resulting endpoints string.
if (existing_endpoints.length () != 0)
{
existing_endpoints += ";";
}
existing_endpoints += additional_endpoints;
return 0;
}
int
TAO_ORB_Parameters::parse_and_add_endpoints (const ACE_CString &endpoints,
TAO_EndpointSet &endpoint_set)
{
// Parse the string into separate endpoints, where `endpoints' is of
// the form:
//
// protocol1://V,v@addr1,...,addrN;protocol2://addr1,...,W.w@addrN;...
//
// A single endpoint, instead of several, can be added just as well.
static char const endpoints_delimiter = ';';
size_t const length = endpoints.length ();
if (endpoints[0] == endpoints_delimiter ||
endpoints[length - 1] == endpoints_delimiter)
{
return -1;
// Failure: endpoints string has an empty endpoint at the
// beginning or the end of the string
// (e.g. ";uiop://foo;iiop://1.3@bar")
}
int status = 0;
// Return code: 0 = success, -1 = failure
if (length > 0)
{
int endpoints_count = 1;
for (size_t j = 0; j != length; ++j)
{
if (endpoints[j] == endpoints_delimiter)
{
++endpoints_count;
}
}
ssize_t begin = 0;
ssize_t end = endpoints.find (endpoints_delimiter);
for (int i = 0; i < endpoints_count; ++i)
{
if (end == 0)
{
// Handle case where two consecutive endpoints `;;'
// delimiters are found within the endpoints set.
//
// Is it enough to just skip over it or should we return an
// error?
continue;
}
ACE_CString const endpt =
endpoints.substring (begin, end - begin);
// The substring call will work even if `end' is equal to
// ACE_CString::npos since that will just extract the substring
// from the offset `begin' to the end of the string.
// Check for a valid URL style endpoint set
ACE_CString::size_type const check_offset = endpt.find ("://");
if (check_offset > 0 &&
check_offset != endpt.npos)
{
endpoint_set.enqueue_tail (endpt);
// Insert endpoint into list
}
else
{
status = -1; // Error: invalid URL style endpoint set
}
begin = end + 1;
end = endpoints.find (endpoints_delimiter, begin);
}
}
else
{
status = -1;
// Failure: Empty string
}
return status;
}
bool
TAO_ORB_Parameters::check_preferred_interfaces_string (const char *s)
{
// Validates that s contains one or more comma separated
// interfaces each consisting of a string with a single
// assignment separator ('=' or ':')
// Any other char is legal, although '*' and '?' will be
// treated as wildcards.
bool expect_assign = false;
bool expect_comma = false;
bool expect_wild = true;
bool found_remote = false;
for (const char *p = s; *p; ++p) switch (*p)
{
#if !defined (ACE_HAS_IPV6)
// Can't use this as assignment operator when IPv6 decimal
// addresses may be involved.
case ':':
#endif /* ACE_HAS_IPV6 */
case '=':
if (!expect_assign)
return false;
found_remote = true;
expect_assign = false;
expect_comma = false;
expect_wild = true;
break;
case ',':
if (!expect_comma)
return false;
found_remote = false;
expect_assign = false;
expect_comma = false;
expect_wild = true;
break;
case '*':
case '?':
if (!expect_wild)
return false;
expect_assign = !found_remote;
expect_comma = found_remote;
expect_wild = false;
break;
default:
expect_assign = !found_remote;
expect_comma = found_remote;
expect_wild = true;
break;
}
return expect_comma && !expect_assign;
}
bool
TAO_ORB_Parameters::preferred_interfaces (const char *s)
{
const bool valid= check_preferred_interfaces_string (s);
if (valid)
{
// Append any valid string to those already specified
// (by other -ORBPreferredInterfaces options that have been
// seen previously)
if (this->pref_network_.length ())
this->pref_network_+= ',';
this->pref_network_+= s;
}
return valid;
}
const char *
TAO_ORB_Parameters::preferred_interfaces (void) const
{
return this->pref_network_.c_str ();
}
void
TAO_ORB_Parameters::enforce_pref_interfaces (bool p)
{
this->enforce_preferred_interfaces_ = p;
}
bool
TAO_ORB_Parameters::enforce_pref_interfaces (void) const
{
return this->enforce_preferred_interfaces_;
}
#if defined (ACE_HAS_IPV6)
void
TAO_ORB_Parameters::prefer_ipv6_interfaces (bool p)
{
this->prefer_ipv6_interfaces_ = p;
}
bool
TAO_ORB_Parameters::prefer_ipv6_interfaces (void) const
{
return this->prefer_ipv6_interfaces_;
}
void
TAO_ORB_Parameters::connect_ipv6_only (bool p)
{
this->connect_ipv6_only_ = p;
}
bool
TAO_ORB_Parameters::connect_ipv6_only (void) const
{
return this->connect_ipv6_only_;
}
void
TAO_ORB_Parameters::use_ipv6_link_local (bool p)
{
this->use_ipv6_link_local_ = p;
}
bool
TAO_ORB_Parameters::use_ipv6_link_local (void) const
{
return this->use_ipv6_link_local_;
}
#endif /* ACE_HAS_IPV6 */
void
TAO_ORB_Parameters::protocols_hooks_name (const char *s)
{
this->protocols_hooks_name_ = s;
}
const char *
TAO_ORB_Parameters::protocols_hooks_name (void) const
{
return this->protocols_hooks_name_.c_str ();
}
void
TAO_ORB_Parameters::thread_lane_resources_manager_factory_name (const char *s)
{
this->thread_lane_resources_manager_factory_name_ = s;
}
const char *
TAO_ORB_Parameters::thread_lane_resources_manager_factory_name (void) const
{
return this->thread_lane_resources_manager_factory_name_.c_str ();
}
void
TAO_ORB_Parameters::dynamic_thread_pool_config_name (const char *s)
{
this->dynamic_thread_pool_config_name_ = s;
}
const char *
TAO_ORB_Parameters::dynamic_thread_pool_config_name (void) const
{
return this->dynamic_thread_pool_config_name_.c_str ();
}
void
TAO_ORB_Parameters::stub_factory_name (const char *s)
{
this->stub_factory_name_ = s;
}
const char *
TAO_ORB_Parameters::stub_factory_name (void) const
{
return this->stub_factory_name_.c_str ();
}
void
TAO_ORB_Parameters::poa_factory_name (const char *s)
{
this->poa_factory_name_ = s;
}
const char *
TAO_ORB_Parameters::poa_factory_name (void) const
{
return this->poa_factory_name_.c_str ();
}
void
TAO_ORB_Parameters::poa_factory_directive (const ACE_TCHAR *s)
{
this->poa_factory_directive_ = s;
}
const ACE_TCHAR *
TAO_ORB_Parameters::poa_factory_directive (void) const
{
return this->poa_factory_directive_.c_str ();
}
void
TAO_ORB_Parameters::endpoint_selector_factory_name (const char *s)
{
this->endpoint_selector_factory_name_ = s;
}
const char *
TAO_ORB_Parameters::endpoint_selector_factory_name (void) const
{
return this->endpoint_selector_factory_name_.c_str ();
}
const TAO::Invocation_Retry_Params &
TAO_ORB_Parameters::invocation_retry_params (void) const
{
return this->invocation_retry_params_;
}
TAO::Invocation_Retry_Params &
TAO_ORB_Parameters::invocation_retry_params (void)
{
return this->invocation_retry_params_;
}
void
TAO_ORB_Parameters::forward_on_exception_limit (const int ef, const int limit)
{
this->invocation_retry_params_.forward_on_exception_limit_[ef] = limit;
}
void
TAO_ORB_Parameters::forward_on_exception_delay (const ACE_Time_Value &delay)
{
this->invocation_retry_params_.init_retry_delay_ = delay;
}
TAO_END_VERSIONED_NAMESPACE_DECL
|