diff options
author | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-03-06 09:22:01 +0000 |
---|---|---|
committer | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-03-06 09:22:01 +0000 |
commit | 377c450aa4422f6142cfbff22f9cef33d5826a7b (patch) | |
tree | a1b75576eaa6a1d663bc6ba11b03480ca020dac2 /TAO | |
parent | 022162774da3acb231e3f1410efed6ebaee4fd8c (diff) | |
download | ATCD-377c450aa4422f6142cfbff22f9cef33d5826a7b.tar.gz |
Wed Mar 06 09:20:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com>
Diffstat (limited to 'TAO')
26 files changed, 942 insertions, 289 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 13a7d4e743d..a780cba24e8 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,51 @@ +Wed Mar 06 09:20:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com> + + * docs/Tags.html: + * tao/Invocation_Adapter.cpp: + * tao/LocateRequest_Invocation_Adapter.cpp: + * tao/Service_Callbacks.cpp: + * tao/Synch_Invocation.cpp: + * tao/Messaging/Asynch_Reply_Dispatcher.cpp: + * orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp: + + Correct minor error and location codes to reflect current code + and correct general errno copies where fixed error codes should + be thrown. + + * orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp: + * tao/PI_Server/ServerRequestInterceptorC.h: + * tao/AnyTypeCode/Any_Dual_Impl_T.cpp: + + Minor 64bit type warnings and unused variables, possiable + memory leaks under error conditions etc. + + * docs/Options.html: + * tao/ORB_Core.cpp: + * tao/IIOP_Endpoint.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Endpoint.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp: + + Add missing UIPMC factory section and -ORBListenOnAll parameter + to Options and fix -ORBEnforcePreferredInterfaces inversion + and allow multiple -ORBPreferredInterfaces strings to be + concatenated. Fix minor possiable memory leaks and processing, + general tidy up. + + * bin/tao_orb_tests.lst: + * TAO_IDL/be/be_visitor_typecode/union_typecode.cpp: + * tests/Bug_4097_Regression/Bug_4097_Regression.cpp: + * tests/Bug_4097_Regression/Bug_4097_Regression.idl: + * tests/Bug_4097_Regression/Bug_4097_Regression.mpc: + * tests/Bug_4097_Regression/README: + * tests/Bug_4097_Regression/run_test.pl: + + Bugzilla_4097 fix (Prismtech Jira TAO-69) + Typecodes for UNIONs with multiple labels per individual case were + generated incorrectly. Look at the tests README for details. + Tue Mar 5 21:47:07 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> * utils/logWalker/GIOP_Buffer.cpp: diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp index a9f8da196ef..40add10f044 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp @@ -118,7 +118,8 @@ TAO::be_visitor_union_typecode::visit_union (be_union * node) << "\"" << node->original_local_name () << "\"," << be_nl << "&" << discriminant_type->tc_name () << "," << be_nl << "_tao_cases_" << node->flat_name () << "," << be_nl - << node->nfields () << ", " + << "sizeof (_tao_cases_" << node->flat_name () << ")/" + "sizeof (_tao_cases_" << node->flat_name () << "[0])," << be_nl << node->default_index () << ");" << be_uidt_nl << be_uidt_nl; @@ -135,9 +136,9 @@ TAO::be_visitor_union_typecode::gen_case_typecodes (be_union * node) { AST_Field ** member_ptr = 0; - size_t const count = node->nfields (); + ACE_CDR::ULong const count = node->nfields (); - for (size_t i = 0; i < count; ++i) + for (ACE_CDR::ULong i = 0u; i < count; ++i) { node->field (member_ptr, i); @@ -184,15 +185,14 @@ TAO::be_visitor_union_typecode::visit_cases (be_union * node) const char *fields_name_str = fields_name.c_str (); TAO_OutStream & os = *this->ctx_->stream (); + ACE_CDR::ULong countLabels = 0u; // Start with static instances of each array element-to-be. - ACE_CDR::ULong const count = node->nfields (); - - for (ACE_CDR::ULong i = 0; i < count; ++i) + ACE_CDR::ULong const countFields = node->nfields (); + for (ACE_CDR::ULong fieldNumber = 0u; fieldNumber < countFields; ++fieldNumber) { AST_Field ** member_ptr = 0; - - node->field (member_ptr, i); + node->field (member_ptr, fieldNumber); be_type * const type = be_type::narrow_from_decl ((*member_ptr)->field_type ()); @@ -201,34 +201,53 @@ TAO::be_visitor_union_typecode::visit_cases (be_union * node) be_union_branch::narrow_from_decl (*member_ptr); ACE_ASSERT (branch != 0); - - os << "static TAO::TypeCode::Case_T<" - << discriminant_type->full_name () << ", " - << "char const *, ::CORBA::TypeCode_ptr const *> const " - << fields_name_str << "__" << i <<" ("; - - if (branch->label ()->label_kind () == AST_UnionLabel::UL_label) + ACE_CDR::ULong numberOfLabels = branch->label_list_length (); + + // Check for a default branch for the current union field. + ACE_CDR::ULong labelNumber; + for (labelNumber= 0u; labelNumber < numberOfLabels; ++labelNumber) + if (branch->label (labelNumber)->label_kind () + == AST_UnionLabel::UL_default) + { + // Generate the default branch ONLY for the current union field. + os << "static TAO::TypeCode::Case_T<" + << discriminant_type->full_name () << ", " + << "char const *, ::CORBA::TypeCode_ptr const *> const " + << fields_name_str << "__" << countLabels++ << " ("; + + branch->gen_default_label_value (&os, node); + + os << ", \"" << branch->original_local_name () << "\", " + << "&" << type->tc_name () + << ");" << be_nl; + + // Since we have just generated the default case, there is no + // point in generating the other alternative cases as they + // are all covered by this default anyway and any other + // cases covered by the default will take up extra static + // memory space for no reason. + numberOfLabels = 0u; + break; + } + + // Now we have handled the default case for this type (if any), + // generate all the other alternate case labels for the type. + for (labelNumber= 0u; labelNumber < numberOfLabels; ++labelNumber) { - // Non-default case. + ACE_ASSERT (branch->label (labelNumber)->label_kind () + == AST_UnionLabel::UL_label); - // Generate the label value. Only the first label value is - // used in the case where multiple labels are used for the - // same union branch/case. - branch->gen_label_value (&os, 0); - } - else - { - // Default case. + os << "static TAO::TypeCode::Case_T<" + << discriminant_type->full_name () << ", " + << "char const *, ::CORBA::TypeCode_ptr const *> const " + << fields_name_str << "__" << countLabels++ << " ("; - ACE_ASSERT (branch->label ()->label_kind () - == AST_UnionLabel::UL_default); + branch->gen_label_value (&os, labelNumber); - branch->gen_default_label_value (&os, node); + os << ", \"" << branch->original_local_name () << "\", " + << "&" << type->tc_name () + << ");" << be_nl; } - - os << ", \"" << branch->original_local_name () << "\", " - << "&" << type->tc_name () - << ");" << be_nl; } // Now generate the TAO::TypeCode::Case array. @@ -239,20 +258,21 @@ TAO::be_visitor_union_typecode::visit_cases (be_union * node) << "[] =" << be_idt_nl << "{" << be_idt_nl; - for (ACE_CDR::ULong n = 0; n < count; ++n) + for (ACE_CDR::ULong n = 0u; n < countLabels; ++n) { os << "&" << fields_name_str << "__" << n; - if (n < count - 1) + if (n < countLabels - 1u) { - os << ","; + os << "," << be_nl; + } + else + { + os << be_uidt_nl; } - - os << be_nl; } - os << be_uidt_nl - << "};" << be_uidt_nl << be_nl; + os << "};" << be_uidt_nl << be_nl; return 0; } diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index 100fdca0ce2..043d4543af5 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -209,6 +209,7 @@ TAO/tests/Bug_3954_Regression/run_test.pl: TAO/tests/Bug_4010_Regression/run_test.pl: TAO/tests/Bug_4059_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/Bug_4082_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO +TAO/tests/Bug_4097_Regression/run_test.pl: TAO/tests/DIOP/run_test.pl: !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO TAO/tests/DIOP/run_test_ipv6.pl: IPV6 !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO TAO/tests/RTCORBA/Activate_Object_Multiple_ORBs/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index 0161ad646bc..3054a84c53f 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -37,6 +37,7 @@ Selection </a> </li> </li> <li><a href="#TSSF">Server_Strategy_Factory </a> </li> <li><a href="#TCSF">Client_Strategy_Factory </a></li> + <li><a href="#TUPF">TAO_UIPMC_Protocol_Factory </a></li> <li><a href="#TMSF">MIOP_Strategy_Factory </a></li> <li><a href="#TTSM">Time_Policy_Manager</a></li> </ol> @@ -570,8 +571,8 @@ is <code>0</code>. This option is disabled (<code>0</code>) by default.</td> option instead. </font> </td> </tr> <tr> - <td><code>-ORBPreferredInterfaces</code> - <em>"targetNetwork:localNetwork,.."</em></td> + <td><code>‑ORBPreferredInterfaces</code> + <em>targetNetwork=localNetwork[,...]</em></td> <td><a name="-ORBPreferredInterfaces"></a> This option allows clients running on a multihomed host to pick a local network/interface to communicate with a remote target. @@ -579,11 +580,13 @@ is <code>0</code>. This option is disabled (<code>0</code>) by default.</td> matching targetNetwork, then it will use the local ip address matching localNetwork. Simple wildcards can be used for both parameters, and multiple preferred interfaces can be specified - using comma separators. For example, for a machine with two network cards + using comma separators (no embedded spaces allowed) or additional ‑ORBPreferredInterfaces directives. + For example, for a machine with two network cards identified by the ip addresses 192.168.1.10 and 192.168.1.20, you can - use -ORBPreferredInterfaces *=*10,*=*20. - Or to force all communication on the loopback address to try to first - use the loopback address, use -ORBPreferredInterfaces 127.0.0.1=127* . + use -ORBPreferredInterfaces *=*10,*=*20 (or the two directives + ‑ORBPreferredInterfaces *=*10 ‑ORBPreferredInterfaces *=*20). + Or to force all communication to first try to + use the loopback address, use <code>‑ORBPreferredInterfaces *=127.0.0.1</code> . <em>targetNetwork</em> can use any string, and must typically match with the value read from an IOR. <em>localNetwork</em> must use a dotted decimal address, because it @@ -867,15 +870,15 @@ is set. The default is true. </td> <tr> <td><code>-ORBAllowZiopNoServerPolicies</code> <em>boolean (0|1)</em></td> <td><a name="-ORBAllowZiopNoServerPolicies"></a> If this option is <CODE>1</CODE> - (true) it directs a client ORB to use any client-side configured ZIOP compression - without having seen any server-side ZIOP available compressor's list policies. + (true) it directs a client ORB to use any client-side (sender) configured ZIOP compression + without having seen any server-side (listener) ZIOP available compressor's list policies. The CORBA Compressed GIOP (ZIOP) V1.0 specification states that the Server publishes its available (i.e. allowable) compressors in the IOR of each server object. This option allows ZIOP to be used with MIOP and/or CORBALOCs that have no such compression list policies embedded. The client simply has to trust that the server is configured to allow its highest priority compressor to be used. Any servers that cannot decompress the client's used ZIOP compressor will reject the - request as they simply cannot decode or handle it (client-side comms will simply + request as they simply cannot decode or handle it (client-side (sender) comms will simply timeout or lock-up for any such incorrect two-way requests, or be oblivious to the failure for any such incorrect one-way requests). The default setting is <CODE>0</CODE> (false) i.e. to disallow compression in such cases @@ -1128,6 +1131,11 @@ creating strategies useful for clients such as request multiplexing strategies, wait strategies, connect strategies etc. <p></p> </li> + <li> <a href="#TUPF">TAO UIPMC Protocol Factory </a> This factory is +responsible for controlling the behavior of clients and servers that +use UDP sockets. + <p></p> + </li> <li> <a href="#TMSF">MIOP Strategy Factory.</a> This factory is responsible for controlling the behavior of clients and servers that use MIOP protocol. @@ -1800,14 +1808,61 @@ strategy. </table> </p> </blockquote> - <h4><a name="TMSF">4. MIOP_Strategy_Factory</a></h4> - This factory is located in the <code>TAO_PortableGroup</code> library and it - accepts the options below. This factory can be loaded dynamically using a + <h4><a name="TUPF">4. TAO_UIPMC_Protocol_Factory</a></h4> + This factory is located in the <code>TAO_PortableGroup</code> library and + is used with the DIOP and MIOP protocols managing the UDP connectionless + sockets (normally one-way calls only) instead of the standard IIOP TCP/IP + two-way connection based sockets. It accepts the options shown below. + (Any options required should be given + to the TAO_UIPMC_Protocol_Factory between the two double-quotes at the end + of the line as a space separated list; however none are required as all + options take default values if not specified.) This factory can be loaded + dynamically using service configurator directives of the form (all on one line): + <p><code>dynamic UIPMC_Factory Service_Object * + TAO_PortableGroup:_make_TAO_UIPMC_Protocol_Factory() ""</code></p> + <p>Normally however in order to set up the TAO_UIPMC_Protocol_Factory correctly, + the application will have to use other service configurator directives as well; + for example:</p> + <code>dynamic UIPMC_Factory Service_Object * + TAO_PortableGroup:_make_TAO_UIPMC_Protocol_Factory() ""<br> + static Resource_Factory "‑ORBProtocolFactory IIOP_Factory + ‑ORBProtocolFactory UIPMC_Factory"<br> + dynamic PortableGroup_Loader Service_Object * + TAO_PortableGroup:_make_TAO_PortableGroup_Loader() ""</code></p> + <blockquote> + <p></p> + <table border="2" cellpadding="0" cellspacing="2"> + <tbody> + <tr> + <th>Option</th> + <th>Description</th> + </tr> + <tr> + <td ALIGN="left"><code>‑ORBListenOnAll</code> <em>0 | 1</em></td> + <td ALIGN="left">This is a server-side (listener) option that by default is disabled. + <p>If disabled (<em>0</em>) the multicast address will be listened for only on the default multicast + interface associated with the <CODE>INADDR_ANY</CODE> local address (normally the first such + local interface on the system), the loopback interface is normally excluded.</p> + If enabled (<em>1</em>) the multicast address will be listened for on ALL the local network + interface(s) which are multicast enabled (again the loopback interface is normally excluded). + </td> + </tr> + </tbody> + </table> + </blockquote> + <h4><a name="TMSF">5. MIOP_Strategy_Factory</a></h4> + This factory is located in the <code>TAO_PortableGroup</code> library and + uses the <a href="#TUPF">TAO_UIPMC_Protocol_Factory</a> (see above) to + manage its UDP sockets, you should also look at that factories configuration + options. The MIOP factory accepts it own options detailed below which + should be specified between the two double-quotes shown here as a space + separated list; however none are required as all options take default + values if not specified. This factory can be loaded dynamically using a service configurator directive of the form (all on one line): <p><code>dynamic MIOP_Resource_Factory Service_Object * TAO_PortableGroup:_make_TAO_MIOP_Resource_Factory () ""</code></p> - Normally in order to set up the MIOP implementation correctly, the application - will have to use other service configurator directives as well (for example): + You would normally have to use other service configurator + directives as well; for example: <p><code>dynamic UIPMC_Factory Service_Object * TAO_PortableGroup:_make_TAO_UIPMC_Protocol_Factory() ""<br> static Resource_Factory "‑ORBProtocolFactory IIOP_Factory @@ -1816,9 +1871,6 @@ strategy. TAO_PortableGroup:_make_TAO_PortableGroup_Loader() ""<br> dynamic MIOP_Resource_Factory Service_Object * TAO_PortableGroup:_make_TAO_MIOP_Resource_Factory () ""</code></p> - Any options required to be given to the MIOP_Resource_Factory should be - specified between the two double-quotes shown above as a space separated list; - however none are required as all options take default values if not specified. Since MIOP uses UDP sockets (which is not a "reliable" transport unlike tcp/ip) it is easy to configure MIOP in such a way that messages will not actually reach the servant. The options below are intended to maximize MIOP reliability @@ -1835,7 +1887,7 @@ strategy. <li> The client sends too large a message fragment, or sends messages too fast, overwhelming the client socket's transmission buffer. (In which case the - client-side OS simply ignores the excess send requests and some of the + client-side (sender) OS simply ignores the excess send requests and some of the fragments are not actually sent on the wire.) <li> The server socket's receive buffer became too full to acquire the fragments off @@ -1866,7 +1918,7 @@ strategy. </tr> <tr> <td ALIGN="left"><code>‑ORBMaxFragments</code> <em>limit</em></td> - <td ALIGN="left">This is a client-side option used to limit the maximum number of + <td ALIGN="left">This is a client-side (sender) option used to limit the maximum number of fragments that a client can break the outgoing message up into. The limit must be a positive number or zero (indicating an unlimited number). The default is normally <em>0 (i.e. unlimited)</em>, but this default can be overriden when @@ -1884,7 +1936,7 @@ strategy. </tr> <tr> <td ALIGN="left"><code>‑ORBMaxFragmentSize</code> <em>bytes</em></td> - <td ALIGN="left">Another client-side option used to limit the number of bytes in + <td ALIGN="left">Another client-side (sender) option used to limit the number of bytes in each individual MIOP fragment, which must be between <em>272</em> and <em><code>ACE_MAX_UDP_PACKET_SIZE</code> (normally 65507)</em> bytes inclusive. Smaller values increase (and larger values decrease) the number of fragments required to send the actual payload @@ -1908,7 +1960,7 @@ strategy. <tr> <td ALIGN="left"><code>‑ORBMaxFragmentRate</code> <em>microseconds</em></td> <td ALIGN="left"> - <P>This client-side option (if enabled, see <code>‑ORBSendThrottling</code> below) + <P>This client-side (sender) option (if enabled, see <code>‑ORBSendThrottling</code> below) specifies a non-zero, positive amount of time (in uSec, i.e. microseconds) that it takes to transmit and process an individual message fragment of the maximum size; see the <code>‑ORBMaxFragmentSize</code> @@ -1930,7 +1982,7 @@ strategy. </tr> <tr> <td ALIGN="left"><code>‑ORBSendHighWaterMark</code> <em>bytes</em></td> - <td ALIGN="left">This client-side option (if enabled, see <code>‑ORBSendThrottling</code> below) + <td ALIGN="left">This client-side (sender) option (if enabled, see <code>‑ORBSendThrottling</code> below) is the usable size of the message buffer, i.e how much data can be sent without introducing delays into the transmition of individual MIOP fragments (due to the <code>‑ORBMaxFragmentRate</code> @@ -1947,7 +1999,7 @@ strategy. </tr> <tr> <td ALIGN="left"><code>‑ORBSendThrottling</code> <em>0 | 1</em></td> - <td ALIGN="left">This is a client-side option that is enabled by default; + <td ALIGN="left">This is a client-side (sender) option that is enabled by default; although this default can be overriden when the TAO libraries are built in the <CODE> ace/config.h</CODE>, by specifying the new default such as <CODE>#define TAO_DEFAULT_MIOP_SEND_THROTTLING false</CODE> which in this case would turn off throttling by default, unless specified in @@ -1957,12 +2009,12 @@ strategy. to maintain an average of <code>‑ORBMaxFragmentSize</code> bytes per <code>‑ORBMaxFragmentRate</code> microseconds once the threshold of <code>‑ORBSendHighWaterMark</code> bytes of data are currently being transmitted or are in progress via each individual transport - (i.e. each individual client-side connection to the server). + (i.e. each individual client-side (sender) connection to the server). </td> </tr> <tr> <td ALIGN="left"><code>‑ORBSndSock</code> <em>bytes</em></td> - <td ALIGN="left">This client-side option is the size of the outgoing socket's + <td ALIGN="left">This client-side (sender) option is the size of the outgoing socket's message buffer. If specified in the service configuration file, this value will override (for MIOP only) the value specified by the corresponding ORB_init parameter. If NOT specified in either place, the default value for the system @@ -1978,7 +2030,7 @@ strategy. </tr> <tr> <td ALIGN="left"><code>‑ORBRcvSock</code> <em>bytes</em></td> - <td ALIGN="left">This server-side option is the size of the incoming socket's + <td ALIGN="left">This server-side (listener) option is the size of the incoming socket's message buffer, i.e., how much data can be received directly off the wire by the server and queued for processing by the servant whilst it is busy. If specified in the service configuration file, this value will override (for MIOP only) the @@ -1996,7 +2048,7 @@ strategy. </tr> <tr> <td ALIGN="left"><code>‑ORBEagerDequeueing</code> <em>0 | 1</em></td> - <td ALIGN="left">This is a server-side option that is enabled by default; + <td ALIGN="left">This is a server-side (listener) option that is enabled by default; although this default can be overriden when the TAO libraries are built in the <CODE> ace/config.h</CODE>, by specifying the new default such as <CODE>#define TAO_DEFAULT_MIOP_EAGER_DEQUEUEING false</CODE> which in this case would turn this off by default, unless specified in the @@ -2043,7 +2095,7 @@ strategy. </table> </p> </blockquote> -<h4><a name="TTSM">5. Time_Policy_Manager</a></h4> +<h4><a name="TTSM">6. Time_Policy_Manager</a></h4> The TIME_POLICY manager controls the actual TIME_POLICY strategy used for ORB timers and countdowns. TAO provides a default strategy manager called <code>Time_Policy_Manager</code>. diff --git a/TAO/docs/Tags.html b/TAO/docs/Tags.html index 9411e61a277..f366600da61 100644 --- a/TAO/docs/Tags.html +++ b/TAO/docs/Tags.html @@ -160,8 +160,8 @@ bgcolor="#ffffff"> set to <CODE>0x54410</CODE>, the other 12 bits are used to describe more precisely the cause of the exception. - The lower 4 bits encode the errno that caused the exception, - the 8 intermediate bits encode the location where the + The lower 7 bits encode the errno that caused the exception, + the 5 intermediate bits encode the location where the exception was raised. </TD> </TR> @@ -172,54 +172,244 @@ bgcolor="#ffffff"> <P><TABLE BORDER="2" CELLSPACING="2" CELLPADDING="0" > - <TR><TH>Errno Value</TH><TH>Description</TH></TR> - <TR> - <TD>0x00</TD><TD>The error was not caused by a failed system - call</TD> - </TR> - <TR><TD>0x01</TD><TD>ETIMEDTOUT</TD></TR> - <TR><TD>0x02</TD><TD>ENFILE</TD></TR> - <TR><TD>0x03</TD><TD>EMFILE</TD></TR> - <TR><TD>0x04</TD><TD>EPIPE</TD></TR> - <TR><TD>0x05</TD><TD>ECONNREFUSED</TD></TR> - <TR><TD>0x06</TD><TD>ENOENT</TD></TR> - <TR><TD>0x07</TD><TD>EBADF</TD></TR> - <TR><TD>0x08</TD><TD>ENOSYS</TD></TR> - <TR><TD>0x09</TD><TD>EPERM</TD></TR> - <TR><TD>0x0A</TD><TD>EAFNOSUPPORT</TD></TR> + <tr> + <th> + TAO (7-bit) Error Code</th> + <th> + Description</th> + <th> + Value</th> + </tr> + <tr> + <td>TAO_UNSPECIFIED_MINOR_CODE</td> + <td>Unspecified minor code</td> + <td>0x00u</td> + </tr> + <tr> + <td>TAO_ETIMEDOUT_MINOR_CODE</td> + <td>Connection timed out</td> + <td>0x01u</td> + </tr> + <tr> + <td>TAO_ENFILE_MINOR_CODE</td> + <td>Too many files open in system</td> + <td>0x02u</td> + </tr> + <tr> + <td>TAO_EMFILE_MINOR_CODE</td> + <td>Too many open files</td> + <td>0x03u</td> + </tr> + <tr> + <td>TAO_EPIPE_MINOR_CODE</td> + <td>Broken pipe</td> + <td>0x04u</td> + </tr> + <tr> + <td>TAO_ECONNREFUSED_MINOR_CODE</td> + <td>Connection refused</td> + <td>0x05u</td> + </tr> + <tr> + <td>TAO_ENOENT_MINOR_CODE</td> + <td>No such file or directory</td> + <td>0x06u</td> + </tr> + <tr> + <td>TAO_EBADF_MINOR_CODE</td> + <td>Bad file descriptor</td> + <td>0x07u</td> + </tr> + <tr> + <td>TAO_ENOSYS_MINOR_CODE</td> + <td>Function not implemented</td> + <td>0x08u</td> + </tr> + <tr> + <td>TAO_EPERM_MINOR_CODE</td> + <td>Operation not permitted</td> + <td>0x09u</td> + </tr> + <tr> + <td>TAO_EAFNOSUPPORT_MINOR_CODE</td> + <td>Protocol family not supported</td> + <td>0x0au</td> + </tr> + <tr> + <td>TAO_EAGAIN_MINOR_CODE</td> + <td>Resource temporarily not available</td> + <td>0x0bu</td> + </tr> + <tr> + <td>TAO_ENOMEM_MINOR_CODE</td> + <td>Not enough space</td> + <td>0x0cu</td> + </tr> + <tr> + <td>TAO_EACCES_MINOR_CODE</td> + <td>Permission denied</td> + <td>0x0du</td> + </tr> + <tr> + <td>TAO_EFAULT_MINOR_CODE</td> + <td>Bad address</td> + <td>0x0eu</td> + </tr> + <tr> + <td>TAO_EBUSY_MINOR_CODE</td> + <td>Device or resource busy</td> + <td>0x0fu</td> + </tr> + <tr> + <td>TAO_EEXIST_MINOR_CODE</td> + <td>File exists</td> + <td>0x10u</td> + </tr> + <tr> + <td>TAO_EINVAL_MINOR_CODE</td> + <td>Invalid argument</td> + <td>0x11u</td> + </tr> + <tr> + <td>TAO_ECOMM_MINOR_CODE</td> + <td>Communication error on send</td> + <td>0x12u</td> + </tr> + <tr> + <td>TAO_ECONNRESET_MINOR_CODE</td> + <td>Connection reset</td> + <td>0x13u</td> + </tr> + <tr> + <td>TAO_ENOTSUP_MINOR_CODE</td> + <td>Operation not supported</td> + <td>0x14u</td> + </tr> </TABLE></P> <P>Please consult the documentation for your OS for more details about the errno meanings</P> <P><TABLE BORDER="2" CELLSPACING="2" CELLPADDING="0" > - <TR><TH>Location encoding</TH><TH>Description</TH></TR> - <TR><TD>0x01</TD> - <TD>Connect failed</TD></TR> - <TR><TD>0x02</TD> - <TD>Location forward failed</TD></TR> - <TR><TD>0x03</TD> - <TD>Send request failed</TD></TR> - <TR><TD>0x04</TD> - <TD>POA in discarding state</TD></TR> - <TR><TD>0x05</TD> - <TD>POA in holding state</TD></TR> - <TR><TD>0x06</TD> - <TD>Unhandled C++ exception in server side</TD></TR> - <TR><TD>0x07</TD> - <TD>Failure while reading the reply</TD></TR> - <TR><TD>0x08</TD> - <TD>All protocols failed to parse the IOR</TD></TR> - <TR><TD>0x09</TD> - <TD>Attempt to use null pointer</TD></TR> - <TR><TD>0x0A</TD> - <TD>Error during MProfile creation</TD></TR> - <TR><TD>0x0B</TD> - <TD>Timeout while trying to establish the connection</TD></TR> - <TR><TD>0x0C</TD> - <TD>Timeout while sending the request</TD></TR> - <TR><TD>0x0D</TD> - <TD>Timeout while waiting for the reply</TD></TR> + <tr> + <th> + TAO (5-bit) Location Code</th> + <th> + Description</th> + <th> + Value</th> + </tr> + <tr> + <td></td> + <td class="right">No specific location details indicated</td> + <td>(0x00u << 7)</td> + </tr> + <tr> + <td>TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE</td> + <td class="right">Location forward failed</td> + <td>(0x01u << 7)</td> + </tr> + <tr> + <td>TAO_INVOCATION_SEND_REQUEST_MINOR_CODE</td> + <td class="right">Send request failed</td> + <td>(0x02u << 7)</td> + </tr> + <tr> + <td>TAO_POA_DISCARDING</td> + <td class="right">POA in discarding state</td> + <td>(0x03u << 7)</td> + </tr> + <tr> + <td>TAO_POA_HOLDING</td> + <td class="right">POA in holding state</td> + <td>(0x04u << 7)</td> + </tr> + <tr> + <td>TAO_UNHANDLED_SERVER_CXX_EXCEPTION</td> + <td class="right">Unhandled C++ exception in server side</td> + <td>(0x05u << 7)</td> + </tr> + <tr> + <td>TAO_INVOCATION_RECV_REQUEST_MINOR_CODE</td> + <td class="right">Failed to receive request response</td> + <td>(0x06u << 7)</td> + </tr> + <tr> + <td>TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL + </td> + <td class="right">All protocols failed to parse the IOR</td> + <td>(0x07u << 7)</td> + </tr> + <tr> + <td>TAO_MPROFILE_CREATION_ERROR</td> + <td class="right">Error during MProfile creation</td> + <td>(0x08u << 7)</td> + </tr> + <tr> + <td>TAO_TIMEOUT_CONNECT_MINOR_CODE</td> + <td class="right">Timeout during connect</td> + <td>(0x09u << 7)</td> + </tr> + <tr> + <td>TAO_TIMEOUT_SEND_MINOR_CODE</td> + <td class="right">Timeout during send</td> + <td>(0x0au << 7)</td> + </tr> + <tr> + <td>TAO_TIMEOUT_RECV_MINOR_CODE</td> + <td class="right">Timeout during receive</td> + <td>(0x0bu << 7)</td> + </tr> + <tr> + <td>TAO_IMPLREPO_MINOR_CODE</td> + <td class="right">Implrepo server exception</td> + <td>(0x0cu << 7)</td> + </tr> + <tr> + <td>TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE</td> + <td class="right">Endpoint initialization failure in Acceptor Registry</td> + <td>(0x0du << 7)</td> + </tr> + <tr> + <td>TAO_ORB_CORE_INIT_LOCATION_CODE</td> + <td class="right">ORB core initialization failed</td> + <td>(0x0eu << 7)</td> + </tr> + <tr> + <td>TAO_POLICY_NARROW_CODE</td> + <td class="right">Failure when narrowing a Policy</td> + <td>(0x0fu << 7)</td> + </tr> + <tr> + <td>TAO_GUARD_FAILURE</td> + <td class="right">Failure when trying to acquire a guard/monitor</td> + <td>(0x10u << 7)</td> + </tr> + <tr> + <td>TAO_POA_BEING_DESTROYED</td> + <td class="right">POA has been destroyed or is currently being destroyed</td> + <td>(0x11u << 7)</td> + </tr> + <tr> + <td>TAO_POA_INACTIVE</td> + <td class="right">POA in inactive state</td> + <td>(0x12u << 7)</td> + </tr> + <tr> + <td>TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE</td> + <td class="right">Initialization failure in Connector Registry</td> + <td>(0x13u << 7)</td> + </tr> + <tr> + <td>TAO_AMH_REPLY_LOCATION_CODE</td> + <td class="right">Failure when trying to send AHM reply</td> + <td>(0x14u << 7)</td> + </tr> + <tr> + <td>TAO_RTCORBA_THREAD_CREATION_LOCATION_CODE</td> + <td class="right">Failure in thread creation for RTCORBA thread pool</td> + <td>(0x15u << 7)</td> + </tr> </TABLE></P> <P><HR></P> diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp index 4c936a7a8fd..ef4c9a87dc0 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp @@ -147,7 +147,7 @@ namespace TAO throw CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + ETIME), CORBA::COMPLETED_NO); } } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp index 107a4776314..29352fc2b30 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp @@ -273,7 +273,7 @@ int TAO::PG_FactoryRegistry::init (CORBA::ORB_ptr orb) */ TAO::PG_FactoryRegistry::RoleInfo::RoleInfo(size_t estimated_number_entries) - : infos_(estimated_number_entries) + : infos_(static_cast<CORBA::ULong> (estimated_number_entries)) { } @@ -311,8 +311,8 @@ void TAO::PG_FactoryRegistry::register_factory ( } PortableGroup::FactoryInfos & infos = role_info->infos_;; - size_t length = infos.length(); - for (size_t nInfo = 0; nInfo < length; ++nInfo) + CORBA::ULong length = infos.length(); + for (CORBA::ULong nInfo = 0u; nInfo < length; ++nInfo) { PortableGroup::FactoryInfo & info = infos[nInfo]; if (info.the_location == factory_info.the_location) @@ -356,8 +356,8 @@ void TAO::PG_FactoryRegistry::unregister_factory ( { PortableGroup::FactoryInfos & infos = role_info->infos_; int found = 0; - size_t length = infos.length(); - for (size_t nInfo = 0; !found && nInfo < length; ++nInfo) + CORBA::ULong length = infos.length(); + for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo) { PortableGroup::FactoryInfo & info = infos[nInfo]; if (info.the_location == location) @@ -500,8 +500,8 @@ void TAO::PG_FactoryRegistry::unregister_factory_by_location ( // ACE_ERROR((LM_INFO, "unregister_factory_by_location: Checking role %s\n", role.c_str() )); int found = 0; - size_t length = infos.length(); - for (size_t nInfo = 0; !found && nInfo < length; ++nInfo) + CORBA::ULong length = infos.length(); + for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo) { PortableGroup::FactoryInfo & info = infos[nInfo]; if (info.the_location == location) @@ -625,7 +625,10 @@ void TAO::PG_FactoryRegistry::unregister_factory_by_location ( { METHOD_ENTRY(TAO::PG_FactoryRegistry::list_factories_by_location); ::PortableGroup::FactoryInfos_var result; - ACE_NEW_THROW_EX (result, ::PortableGroup::FactoryInfos(this->registry_.current_size()), + ACE_NEW_THROW_EX ( + result, + ::PortableGroup::FactoryInfos( + static_cast<CORBA::ULong> (this->registry_.current_size())), CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO)); @@ -642,16 +645,16 @@ void TAO::PG_FactoryRegistry::unregister_factory_by_location ( PortableGroup::FactoryInfos & found_infos = role_info->infos_; // iterate through the entry for this type int found = 0; - size_t length = found_infos.length(); - for (size_t nInfo = 0; !found && nInfo < length; ++nInfo) + CORBA::ULong length = found_infos.length(); + for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo) { PortableGroup::FactoryInfo & info = found_infos[nInfo]; if (info.the_location == location) { found = 1; result_length += 1; - result->length(result_length); - (*result)[result_length-1] = info; + result->length (static_cast<CORBA::ULong> (result_length)); + (*result)[static_cast<CORBA::ULong> (result_length-1u)] = info; } } } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.cpp index 7ec47255288..480fd3dafb9 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Acceptor.cpp @@ -15,14 +15,15 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -TAO_UIPMC_Acceptor::TAO_UIPMC_Acceptor (bool listen_on_all_ifs) +TAO_UIPMC_Acceptor::TAO_UIPMC_Acceptor ( + bool listen_on_all_ifs) : TAO_Acceptor (IOP::TAG_UIPMC), addrs_ (0), hosts_ (0), endpoint_count_ (0), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), orb_core_ (0), - listen_on_all_(listen_on_all_ifs) + listen_on_all_ (listen_on_all_ifs) { } @@ -34,14 +35,15 @@ TAO_UIPMC_Acceptor::~TAO_UIPMC_Acceptor (void) delete [] this->addrs_; - for (size_t i = 0; i < this->endpoint_count_; ++i) + for (size_t i = 0u; i < this->endpoint_count_; ++i) CORBA::string_free (this->hosts_[i]); delete [] this->hosts_; } int -TAO_UIPMC_Acceptor::create_profile (const TAO::ObjectKey &, +TAO_UIPMC_Acceptor::create_profile ( + const TAO::ObjectKey &, TAO_MProfile &, CORBA::Short) { @@ -73,12 +75,13 @@ TAO_UIPMC_Acceptor::close (void) } int -TAO_UIPMC_Acceptor::open (TAO_ORB_Core *orb_core, - ACE_Reactor *reactor, - int major, - int minor, - const char *address, - const char *options) +TAO_UIPMC_Acceptor::open ( + TAO_ORB_Core *orb_core, + ACE_Reactor *reactor, + int major, + int minor, + const char *address, + const char *options) { this->orb_core_ = orb_core; @@ -142,15 +145,13 @@ TAO_UIPMC_Acceptor::open (TAO_ORB_Core *orb_core, } } else - { #endif /* ACE_HAS_IPV6 */ + { // Extract out just the host part of the address. size_t len = port_separator_loc - address; ACE_OS::memcpy (tmp_host, address, len); tmp_host[len] = '\0'; -#if defined (ACE_HAS_IPV6) } -#endif /* ACE_HAS_IPV6 */ // Both host and port have to be specified. if (port_separator_loc == 0) @@ -208,11 +209,12 @@ TAO_UIPMC_Acceptor::open (TAO_ORB_Core *orb_core, } int -TAO_UIPMC_Acceptor::open_default (TAO_ORB_Core *, - ACE_Reactor *, - int, - int, - const char *) +TAO_UIPMC_Acceptor::open_default ( + TAO_ORB_Core *, + ACE_Reactor *, + int, + int, + const char *) { // There is no such thing as a default multicast listen // port. The mechanism for choosing these ports is done @@ -221,23 +223,25 @@ TAO_UIPMC_Acceptor::open_default (TAO_ORB_Core *, } int -TAO_UIPMC_Acceptor::open_i (const ACE_INET_Addr& addr, - ACE_Reactor *reactor) +TAO_UIPMC_Acceptor::open_i ( + const ACE_INET_Addr &addr, + ACE_Reactor *reactor) { + // Create our connection handler and pass it our configurtion options. TAO_UIPMC_Mcast_Connection_Handler *connection_handler = 0; ACE_NEW_RETURN (connection_handler, TAO_UIPMC_Mcast_Connection_Handler (this->orb_core_), -1); - connection_handler->local_addr (addr); connection_handler->listen_on_all (this->listen_on_all_); if (connection_handler->open (0)) { - ACE_DEBUG ((LM_ERROR, - ACE_TEXT("TAO (%P|%t) - TAO_UIPMC_Acceptor::open_i, ") - ACE_TEXT("failed to open connection handler.\n") - )); - return -1; + ACE_DEBUG ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - TAO_UIPMC_Acceptor::open_i, ") + ACE_TEXT("failed to open connection handler.\n") + )); + delete connection_handler; + return -1; } int result = @@ -258,18 +262,16 @@ TAO_UIPMC_Acceptor::open_i (const ACE_INET_Addr& addr, // the same port. This is how a wildcard socket bind() is supposed // to work. u_short port = addr.get_port_number (); - for (size_t j = 0; j < this->endpoint_count_; ++j) - this->addrs_[j].set_port_number (port, 1); - - if (TAO_debug_level > 5) + for (size_t j = 0u; j < this->endpoint_count_; ++j) { - for (size_t i = 0; i < this->endpoint_count_; ++i) + this->addrs_[j].set_port_number (port, 1); + if (TAO_debug_level > 5) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - UIPMC_Acceptor::open_i, ") ACE_TEXT ("listening on: <%C:%u>\n"), - this->hosts_[i], - this->addrs_[i].get_port_number ())); + this->hosts_[j], + this->addrs_[j].get_port_number ())); } } @@ -277,18 +279,20 @@ TAO_UIPMC_Acceptor::open_i (const ACE_INET_Addr& addr, } int -TAO_UIPMC_Acceptor::hostname (TAO_ORB_Core *, - ACE_INET_Addr &addr, - char *&host, - const char *) +TAO_UIPMC_Acceptor::hostname ( + TAO_ORB_Core *, + ACE_INET_Addr &addr, + char *&host, + const char *) { // Only have dotted decimal addresses for multicast. return this->dotted_decimal_address (addr, host); } int -TAO_UIPMC_Acceptor::dotted_decimal_address (ACE_INET_Addr &addr, - char *&host) +TAO_UIPMC_Acceptor::dotted_decimal_address ( + ACE_INET_Addr &addr, + char *&host) { char tmp[INET6_ADDRSTRLEN]; if (!addr.get_host_addr (tmp, sizeof tmp)) @@ -297,7 +301,7 @@ TAO_UIPMC_Acceptor::dotted_decimal_address (ACE_INET_Addr &addr, ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - UIPMC_Acceptor::") ACE_TEXT ("dotted_decimal_address, cannot determine ") - ACE_TEXT ("hostname '%m'\n"))); + ACE_TEXT ("hostname (Errno: '%m')\n"))); return -1; } @@ -312,8 +316,9 @@ TAO_UIPMC_Acceptor::endpoint_count (void) } int -TAO_UIPMC_Acceptor::object_key (IOP::TaggedProfile &, - TAO::ObjectKey &) +TAO_UIPMC_Acceptor::object_key ( + IOP::TaggedProfile &, + TAO::ObjectKey &) { // No object key to extract. Just return success. return 1; @@ -355,7 +360,7 @@ TAO_UIPMC_Acceptor::parse_options (const char *str) ACE_CString::size_type begin = 0; ACE_CString::size_type end = 0; - for (CORBA::ULong j = 0; j < option_count;) + for (CORBA::ULong j = 0u; j < option_count;) { if (j < option_count - 1) end = options.find (option_delimiter, begin); diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp index 512c6a0abfa..0af78fdb3e4 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp @@ -58,7 +58,7 @@ TAO_UIPMC_Connection_Handler::~TAO_UIPMC_Connection_Handler (void) ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - UIPMC_Connection_Handler::") ACE_TEXT ("~UIPMC_Connection_Handler, ") - ACE_TEXT ("release_os_resources() failed %m\n"))); + ACE_TEXT ("release_os_resources() failed (Errno: '%m')\n"))); } } @@ -188,7 +188,7 @@ TAO_UIPMC_Connection_Handler::open (void*) { ACE_ERROR ((LM_ERROR, ACE_TEXT("TAO (%P|%t) - UIPMC_Connection_Handler::open, ") - ACE_TEXT("couldn't set hop limit '%m'\n"))); + ACE_TEXT("couldn't set hop limit (Errno: '%m')\n"))); } return -1; } @@ -240,7 +240,7 @@ TAO_UIPMC_Connection_Handler::open (void*) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - UIPMC_Connection_Handler::open, ") - ACE_TEXT ("couldn't %s multicast packets looping '%m'\n"), + ACE_TEXT ("couldn't %s multicast packets looping (Errno: '%m')\n"), protocol_properties.enable_multicast_loop_ ? ACE_TEXT ("enable") : ACE_TEXT ("disable") )); @@ -252,14 +252,14 @@ TAO_UIPMC_Connection_Handler::open (void*) if (!this->send_hi_water_mark_) { #if defined (ACE_LACKS_SO_SNDBUF) - // Assume a small buffer - this->send_hi_water_mark_ = 1024u; - if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) - UIPMC_Connection_Handler::") - ACE_TEXT ("open, -ORBSendHighWaterMark not specified ") - ACE_TEXT ("using %u bytes\n"), - this->send_hi_water_mark_)); + // Assume a small buffer + this->send_hi_water_mark_ = 1024u; + if (TAO_debug_level) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - UIPMC_Connection_Handler::") + ACE_TEXT ("open, -ORBSendHighWaterMark not specified ") + ACE_TEXT ("using %u bytes\n"), + this->send_hi_water_mark_)); #else int size = sizeof (this->send_hi_water_mark_); result = @@ -288,7 +288,7 @@ TAO_UIPMC_Connection_Handler::open (void*) ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - UIPMC_Connection_Handler::") ACE_TEXT ("open, -ORBSendHighWaterMark not specified ") - ACE_TEXT ("and getsockopt failed '%m', using %u bytes\n"), + ACE_TEXT ("and getsockopt failed (Errno: '%m'), using %u bytes\n"), this->send_hi_water_mark_)); return -1; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Endpoint.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Endpoint.cpp index a53d340898b..b8dbe540640 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Endpoint.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Endpoint.cpp @@ -58,12 +58,13 @@ TAO_UIPMC_Endpoint::TAO_UIPMC_Endpoint (const CORBA::Octet class_d_address[4], TAO_UIPMC_Endpoint::~TAO_UIPMC_Endpoint (void) { + delete this->next_; } void TAO_UIPMC_Endpoint::object_addr (const ACE_INET_Addr &addr) { - this->port_ = addr.get_port_number (); + this->port_ = addr.get_port_number(); char tmp[INET6_ADDRSTRLEN]; addr.get_host_addr (tmp, sizeof tmp); this->host_ = CORBA::string_dup (tmp); @@ -173,7 +174,7 @@ TAO_UIPMC_Endpoint::preferred_interfaces (TAO_ORB_Core *oc) preferred); TAO_UIPMC_Endpoint *latest = this; - CORBA::ULong count = preferred.size(); + CORBA::ULong count = static_cast<CORBA::ULong> (preferred.size()); CORBA::ULong i = 0; while (i < count) @@ -209,7 +210,12 @@ TAO_UIPMC_Endpoint::preferred_interfaces (TAO_ORB_Core *oc) TAO_Endpoint *tmp_ep = latest->duplicate (); latest->next_ = dynamic_cast<TAO_UIPMC_Endpoint *> (tmp_ep); - if (latest->next_ == 0) return i; + if (!latest->next_) + { + delete tmp_ep; + return i; + } + latest = latest->next_; } } @@ -218,13 +224,15 @@ TAO_UIPMC_Endpoint::preferred_interfaces (TAO_ORB_Core *oc) !oc->orb_params ()->enforce_pref_interfaces ()) { TAO_Endpoint *tmp_ep = latest->duplicate (); - latest->next_ = dynamic_cast<TAO_UIPMC_Endpoint *> (tmp_ep); + if (!latest->next_) + { + delete tmp_ep; + return count; + } - if (latest->next_ == 0) return count; - - latest->next_->preferred_path_.host = (const char *) 0; + latest->next_->preferred_path_.host = static_cast<const char *> (0); ++count; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp index 8c11cccec13..96c9e0bcfff 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp @@ -342,7 +342,7 @@ TAO_UIPMC_Mcast_Transport::recv_all (TAO_Resume_Handle &rh) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - UIPMC_Mcast_Transport[%d]::") - ACE_TEXT ("recv_all, unexpected failure of recv_packet '%m'\n"), + ACE_TEXT ("recv_all, unexpected failure of recv_packet (Errno: '%m')\n"), this->id ())); } break; @@ -386,7 +386,7 @@ TAO_UIPMC_Mcast_Transport::recv_all (TAO_Resume_Handle &rh) } } - // We have incomplete packet so add a new data to it. + // We have incomplete packet so add the new data to it. // add_fragment returns 1 iff the packet is complete. if (1 == packet->add_fragment (start_data, packet_length, packet_number, stop_packet)) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp index 2b986c4afd9..e09c374446f 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp @@ -366,7 +366,7 @@ TAO_UIPMC_Transport::send ( { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - UIPMC_Transport[%d]::send, ") - ACE_TEXT ("error sending data '%m'\n"), + ACE_TEXT ("error sending data (Errno: '%m')\n"), this->id ())); return -1; } @@ -487,7 +487,7 @@ TAO_UIPMC_Transport::send_message ( ACE_DEBUG ((LM_ERROR, ACE_TEXT ("TAO: (%P|%t) - UIPMC_Transport[%d]::") ACE_TEXT ("send_message, closing transport %d after ") - ACE_TEXT ("fault '%m'\n"), + ACE_TEXT ("fault (Errno: '%m')\n"), this->id ())); return -1; } diff --git a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp index 9c743e8f007..66206f5c18b 100644 --- a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp @@ -160,6 +160,7 @@ TAO::Any_Dual_Impl_T<T>::replace (TAO_InputCDR &cdr, ACE_NEW_RETURN (empty_value, T, false); + auto_ptr<T> empty_value_safety (empty_value); TAO::Any_Dual_Impl_T<T> *replacement = 0; ACE_NEW_RETURN (replacement, TAO::Any_Dual_Impl_T<T> (destructor, @@ -176,6 +177,7 @@ TAO::Any_Dual_Impl_T<T>::replace (TAO_InputCDR &cdr, _tao_elem = replacement->value_; const_cast<CORBA::Any &> (any).replace (replacement); replacement_safety.release (); + empty_value_safety.release (); return true; } diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp index 1ac2e830bc0..ee04a5cb407 100644 --- a/TAO/tao/IIOP_Endpoint.cpp +++ b/TAO/tao/IIOP_Endpoint.cpp @@ -399,18 +399,6 @@ TAO_IIOP_Endpoint::object_addr_i (void) const } } -static ACE_CString find_local(const ACE_Vector<ACE_CString>& local_ips, - const ACE_CString& pattern) -{ - for (size_t i = 0; i < local_ips.size(); ++i) - { - ACE_CString ret = local_ips[i]; - if (ACE::wild_match(ret.c_str(), pattern.c_str())) - return ret; - } - return ""; -} - TAO_IIOP_Endpoint * TAO_IIOP_Endpoint::add_local_endpoint (TAO_IIOP_Endpoint *ep, const char *local, @@ -423,11 +411,12 @@ TAO_IIOP_Endpoint::add_local_endpoint (TAO_IIOP_Endpoint *ep, return tmp; } +// local helper function for TAO_IIOP_Endpoint::find_preferred_interfaces static void -get_ip_interfaces(ACE_Vector<ACE_CString>& local_ips) +TAO_IIOP_Endpoint_get_ip_interfaces (ACE_Vector<ACE_CString> &local_ips) { ACE_INET_Addr* tmp = 0; - size_t cnt = 0; + size_t cnt = 0u; int err = ACE::get_ip_interfaces (cnt, tmp); if (err != 0) return; @@ -436,97 +425,119 @@ get_ip_interfaces(ACE_Vector<ACE_CString>& local_ips) #else /* ACE_HAS_IPV6 */ char buf[32]; #endif /* !ACE_HAS_IPV6 */ - for (size_t i = 0; i < cnt; ++i) + for (size_t i = 0u; i < cnt; ++i) { - const char *s_if = tmp[i].get_host_addr(buf, sizeof (buf)); - ACE_ASSERT(s_if != 0); - ACE_CString tmp(s_if); - //ssize_t pos = tmp.find(':'); - //if (pos != ACE_CString::npos) - // tmp = tmp.substr(0, pos); - local_ips.push_back(tmp); + const char *s_if = tmp[i].get_host_addr (buf, sizeof (buf)); + ACE_ASSERT (s_if != 0); + ACE_CString tmp (s_if); + local_ips.push_back (tmp); } delete[] tmp; } +// local helper function for TAO_IIOP_Endpoint::find_preferred_interfaces +static void +TAO_IIOP_Endpoint_none_duplicate_insert ( + const ACE_CString &value, + ACE_Vector<ACE_CString> &vector) +{ + bool found= false; + for (size_t x= 0u; x < vector.size (); ++x) + if (vector[x] == value) + { + found= true; + break; + } + if (!found) + vector.push_back (value); +} + // Given a comma separated list of preferred interface directives, which // are of the form <wild_remote>=<wild_local>, this function will retrieve // the list of preferred local ip addresses by matching wild_local against // the list of all local ip interfaces, for any directive where wild_remote // matches the host from our endpoint. void -TAO_IIOP_Endpoint::find_preferred_interfaces (const ACE_CString& host, - const ACE_CString& csvPreferred, - ACE_Vector<ACE_CString>& preferred) +TAO_IIOP_Endpoint::find_preferred_interfaces ( + const ACE_CString &host, + const ACE_CString &csvPreferred, + ACE_Vector<ACE_CString> &preferred) { ACE_Vector<ACE_CString> local_ips; - get_ip_interfaces(local_ips); - if (local_ips.size() == 0) + TAO_IIOP_Endpoint_get_ip_interfaces (local_ips); + if (local_ips.size () == 0) return; // The outer loop steps through each preferred interface directive // and chains a new endpoint if the remote interface matches the // current endpoint. ACE_CString::size_type index = 0; - while (index < csvPreferred.length()) - { - ACE_CString::size_type comma = csvPreferred.find(',', index); - ACE_CString::size_type assign = csvPreferred.find('=', index); - - if (assign == ACE_CString::npos) + while (index < csvPreferred.length ()) { - assign = csvPreferred.find(':', index); - if (assign == ACE_CString::npos) - { - ACE_ASSERT(assign != ACE_CString::npos); - return; - } - } + ACE_CString::size_type comma = csvPreferred.find (',', index); + ACE_CString::size_type assign = csvPreferred.find ('=', index); - ACE_CString wild_local; - if (comma == ACE_CString::npos) - wild_local = csvPreferred.substr(assign + 1); - else - wild_local = csvPreferred.substr(assign + 1, comma - assign - 1); - ACE_CString wild_remote = csvPreferred.substr(index, assign - index); - - index = comma + 1; + if (assign == ACE_CString::npos) + { + assign = csvPreferred.find (':', index); + if (assign == ACE_CString::npos) + { + ACE_ASSERT (assign != ACE_CString::npos); + return; + } + } - // For now, we just try to match against the host literally. In - // the future it might be worthwhile to resolve some aliases for - // this->host_ using DNS (and possibly reverse DNS) lookups. Then we - // could try matching against those too. - if (ACE::wild_match(host.c_str(), wild_remote.c_str(), false)) - { - // If it's a match, then it means we need to use a - // local interface that matches wild_local. - ACE_CString local = find_local(local_ips, wild_local); - if (local.length() > 0) - { - preferred.push_back(local); - } + ACE_CString wild_local; + if (comma == ACE_CString::npos) + wild_local = csvPreferred.substr (assign + 1); else - { + wild_local = csvPreferred.substr (assign + 1, comma - assign - 1); + ACE_CString wild_remote = csvPreferred.substr (index, assign - index); + index = comma + 1; + + // For now, we just try to match against the host literally. In + // the future it might be worthwhile to resolve some aliases for + // this->host_ using DNS (and possibly reverse DNS) lookups. Then we + // could try matching against those too. + if (ACE::wild_match (host.c_str (), wild_remote.c_str (), false)) + { + // If it's a match, then it means we need to use any/all + // local interface(s) that matches wild_local. + const char *const wild_local_cstr = wild_local.c_str (); + bool found= false; + for (size_t i = 0u; i < local_ips.size (); ++i) + { + ACE_CString &ret = local_ips[i]; + if (ACE::wild_match (ret.c_str (), wild_local_cstr)) + { + found= true; + TAO_IIOP_Endpoint_none_duplicate_insert (ret, preferred); + } + } + + if (!found) + { #if defined (ACE_HAS_IPV6) - // We interpret the preferred wild_local as an actual interface name/id. - // This is useful for link local IPv6 multicast - ACE_CString if_name("if="); - if_name += wild_local; - preferred.push_back(if_name); + // We interpret the preferred wild_local as an actual interface name/id. + // This is useful for link local IPv6 multicast + + ACE_CString if_name ("if="); + if_name += wild_local; + TAO_IIOP_Endpoint_none_duplicate_insert (if_name, preferred); #else - // There is no matching local interface, so we can skip - // to the next preferred interface directive. + // There is no matching local interface, so we can skip + // to the next preferred interface directive. #endif - } - } - else - { - // The preferred interface directive is for a different - // remote endpoint. + } + } + else + { + // The preferred interface directive is for a different + // remote endpoint. + } + if (comma == ACE_CString::npos) + break; } - if (comma == ACE_CString::npos) - break; - } } CORBA::ULong @@ -536,7 +547,7 @@ TAO_IIOP_Endpoint::preferred_interfaces (const char *csv, { ACE_Vector<ACE_CString> preferred; find_preferred_interfaces(this->host_.in(), csv, preferred); - CORBA::ULong count = preferred.size(); + CORBA::ULong count = static_cast<CORBA::ULong> (preferred.size()); size_t i = 0; while (i < count && ACE_OS::strstr (preferred[i].c_str(), "if=") != 0) { diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp index 310cec2dad1..cccf024bcfb 100644 --- a/TAO/tao/Invocation_Adapter.cpp +++ b/TAO/tao/Invocation_Adapter.cpp @@ -376,14 +376,14 @@ namespace TAO throw ::CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + 0), CORBA::COMPLETED_NO); if (stubobj == 0) throw ::CORBA::INTERNAL ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + EINVAL), CORBA::COMPLETED_NO); // Reset the profile in the stubs @@ -393,7 +393,7 @@ namespace TAO throw ::CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + 0), CORBA::COMPLETED_NO); } diff --git a/TAO/tao/LocateRequest_Invocation_Adapter.cpp b/TAO/tao/LocateRequest_Invocation_Adapter.cpp index 524a199e272..04851e0dc85 100644 --- a/TAO/tao/LocateRequest_Invocation_Adapter.cpp +++ b/TAO/tao/LocateRequest_Invocation_Adapter.cpp @@ -145,14 +145,14 @@ namespace TAO throw ::CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + 0), CORBA::COMPLETED_NO); if (stubobj == 0) throw ::CORBA::INTERNAL ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + EINVAL), CORBA::COMPLETED_NO); // Reset the profile in the stubs @@ -162,7 +162,7 @@ namespace TAO throw ::CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + 0), CORBA::COMPLETED_NO); return; diff --git a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp index 1f1c099cb99..158005a98b5 100644 --- a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp +++ b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp @@ -230,7 +230,7 @@ TAO_Asynch_Reply_Dispatcher::reply_timed_out (void) CORBA::TIMEOUT timeout_failure ( CORBA::SystemException::_tao_minor_code ( TAO_TIMEOUT_RECV_MINOR_CODE, - errno), + ETIME), CORBA::COMPLETED_MAYBE); TAO_OutputCDR out_cdr; diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 01b62178735..9722a7162bc 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -659,7 +659,9 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) arg_shifter.consume_arg (); } else if (0 != (current_arg = arg_shifter.get_the_parameter - (ACE_TEXT("-ORBPreferredInterfaces")))) + (ACE_TEXT("-ORBPreferredInterfaces"))) || + 0 != (current_arg = arg_shifter.get_the_parameter + (ACE_TEXT("-ORBPreferredInterface"))) ) { if (this->orb_params ()->preferred_interfaces ( ACE_TEXT_ALWAYS_CHAR (current_arg)) == false) @@ -672,14 +674,12 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) arg_shifter.consume_arg (); } else if (0 != (current_arg = arg_shifter.get_the_parameter - (ACE_TEXT("-ORBEnforcePreferredInterfaces")))) + (ACE_TEXT("-ORBEnforcePreferredInterfaces"))) || + 0 != (current_arg = arg_shifter.get_the_parameter + (ACE_TEXT("-ORBEnforcePreferredInterface"))) ) { - int enforce_pref_interfaces = ACE_OS::atoi (current_arg); - if (enforce_pref_interfaces) - this->orb_params ()->enforce_pref_interfaces (false); - else - this->orb_params ()->enforce_pref_interfaces (true); - + this->orb_params ()->enforce_pref_interfaces ( + !!ACE_OS::atoi (current_arg)); arg_shifter.consume_arg (); } #if defined (ACE_HAS_IPV6) diff --git a/TAO/tao/PI_Server/ServerRequestInterceptorC.h b/TAO/tao/PI_Server/ServerRequestInterceptorC.h index be193508c93..b32e581367a 100644 --- a/TAO/tao/PI_Server/ServerRequestInterceptorC.h +++ b/TAO/tao/PI_Server/ServerRequestInterceptorC.h @@ -152,9 +152,8 @@ namespace PortableInterceptor #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 virtual void tao_ft_interception_point ( - ::PortableInterceptor::ServerRequestInfo_ptr ri, - ::CORBA::OctetSeq_out os - + ::PortableInterceptor::ServerRequestInfo_ptr, + ::CORBA::OctetSeq_out ) {} diff --git a/TAO/tao/Service_Callbacks.cpp b/TAO/tao/Service_Callbacks.cpp index a299d79d1be..2bffb937c81 100644 --- a/TAO/tao/Service_Callbacks.cpp +++ b/TAO/tao/Service_Callbacks.cpp @@ -57,7 +57,7 @@ TAO_Service_Callbacks::raise_comm_failure ( throw ::CORBA::COMM_FAILURE ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, - -1), + 0), CORBA::COMPLETED_MAYBE); } @@ -69,7 +69,7 @@ TAO_Service_Callbacks::raise_transient_failure ( throw ::CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_RECV_REQUEST_MINOR_CODE, - -1), + 0), CORBA::COMPLETED_MAYBE); } diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp index 2913c657d20..1429a1a678d 100644 --- a/TAO/tao/Synch_Invocation.cpp +++ b/TAO/tao/Synch_Invocation.cpp @@ -492,7 +492,7 @@ namespace TAO throw ::CORBA::MARSHAL ( CORBA::SystemException::_tao_minor_code ( TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, - errno), + EINVAL), CORBA::COMPLETED_NO); } diff --git a/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.cpp b/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.cpp new file mode 100644 index 00000000000..8be1eef0039 --- /dev/null +++ b/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.cpp @@ -0,0 +1,145 @@ +// $Id$ + +#include "Bug_4097_RegressionS.h" + +#include <tao/corba.h> +#include <tao/ORB.h> +#include <tao/Object.h> +#include <tao/Object_T.h> +#include <tao/ORB_Core.h> +#include <tao/CodecFactory/CodecFactory.h> + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" +#include "tao/AnyTypeCode/Any.h" + +namespace { +bool +checkResult (const CORBA::Any &any, const MultiLabelUnion &mlu) +{ + bool error = false; + const MultiLabelUnion *extracted = 0; + if (any >>= extracted) + { + if (extracted->_d () == mlu._d ()) + { + ACE_DEBUG ((LM_DEBUG, ". Extracted descriminant is correct (%d)\n", extracted->_d ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, ". Extracted descriminant is WRONG (%d)\n", extracted->_d ())); + error = true; + } + if (extracted->mlu_char () == mlu.mlu_char ()) + { + ACE_DEBUG ((LM_DEBUG, ". Extracted value is correct (%c)\n", extracted->mlu_char ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, ". Extracted value is WRONG (%c)\n", extracted->mlu_char ())); + error = true; + } + } + else + { + ACE_DEBUG ((LM_DEBUG, ". DID NOT Extract from any (Test Failure)\n")); + error = true; + } + + return error; +} +} // End of unnamed namespace + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + ACE_DEBUG ((LM_DEBUG, "Starting\n")); + CORBA::ORB_var orb (CORBA::ORB_init (argc, argv)); + + CORBA::Object_var obj (orb->resolve_initial_references ("CodecFactory")); + IOP::CodecFactory_var codecFactory (IOP::CodecFactory::_narrow (obj.in ())); + + IOP::Encoding cdr_encoding; + cdr_encoding.format = IOP::ENCODING_CDR_ENCAPS; + cdr_encoding.major_version = 1; + cdr_encoding.minor_version = 2; + IOP::Codec_var codec (codecFactory->create_codec (cdr_encoding)); + + // Test starts here with first case + + ACE_DEBUG ((LM_DEBUG, "Creating union using default descriminant of mlu_char type\n")); + MultiLabelUnion mlu; + mlu.mlu_char ('x'); + CORBA::Any any; + any <<= mlu; + bool error = checkResult (any, mlu); + + ACE_DEBUG ((LM_DEBUG, "Encode->Decode any with union using default descriminant of mlu_char type\n")); + CORBA::OctetSeq_var messageInCDR (codec->encode (any)); + ACE_DEBUG ((LM_DEBUG, ". Size of encoding is %d\n", messageInCDR->length ())); + CORBA::Any_var decoded = codec->decode (messageInCDR); + if (!decoded.ptr ()) + { + ACE_DEBUG ((LM_DEBUG, "No decoding\n")); + error = true; + } + else if (checkResult (decoded.in (), mlu)) + { + error = true; + } + + ACE_DEBUG ((LM_DEBUG, "Creating union using case 0\n")); + mlu.mlu_char ('y'); + mlu._d (static_cast<CORBA::Long> (0)); // Note first case label for type. + any <<= mlu; + if (checkResult (any, mlu)) + { + error = true; + } + + ACE_DEBUG ((LM_DEBUG, "Encode->Decode any with union using case 0\n")); + messageInCDR = codec->encode (any); + ACE_DEBUG ((LM_DEBUG, ". Size of encoding is %d\n", messageInCDR->length ())); + decoded = codec->decode (messageInCDR); + if (!decoded.ptr ()) + { + ACE_DEBUG ((LM_DEBUG, "No decoding\n")); + error = true; + } + else if (checkResult (decoded.in (), mlu)) + { + error = true; + } + + ACE_DEBUG ((LM_DEBUG, "Creating union using case 1\n")); + mlu.mlu_char ('z'); + mlu._d (static_cast<CORBA::Long> (1)); // Note second case label for same type as before + any <<= mlu; + if (checkResult (any, mlu)) + { + error = true; + } + + ACE_DEBUG ((LM_DEBUG, "Encode->Decode any with union using case 1\n")); + messageInCDR = codec->encode (any); + ACE_DEBUG ((LM_DEBUG, ". Size of encoding is %d\n", messageInCDR->length ())); + decoded = codec->decode (messageInCDR); + if (!decoded.ptr ()) + { + ACE_DEBUG ((LM_DEBUG, "No decoding\n")); + error = true; + } + else if (checkResult (decoded.in (), mlu)) + { + error = true; + } + + if (error) + { + ACE_DEBUG ((LM_DEBUG, "Test FAILED.\n")); + return 1; + } + + ACE_DEBUG ((LM_DEBUG, "Test SUCCEEDED.\n")); + return 0; +} diff --git a/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.idl b/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.idl new file mode 100644 index 00000000000..669e6a3f475 --- /dev/null +++ b/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.idl @@ -0,0 +1,7 @@ +union MultiLabelUnion switch (long) { + case 0: + case 1: + char mlu_char; + case 2: + long mlu_long; +}; diff --git a/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.mpc b/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.mpc new file mode 100644 index 00000000000..516a0bbe2d3 --- /dev/null +++ b/TAO/tests/Bug_4097_Regression/Bug_4097_Regression.mpc @@ -0,0 +1,23 @@ +// $Id$ + +project(*IDL): taoserver, messaging, gen_ostream { + custom_only=1 + IDL_Files { + idlflags += -as + Bug_4097_Regression.idl + } +} + +project(*Main): taoserver, messaging, gen_ostream { + exename = Bug_4097_Regression + after += *IDL + + IDL_Files { + } + + Source_Files { + Bug_4097_Regression.cpp + Bug_4097_RegressionC.cpp + Bug_4097_RegressionS.cpp + } +} diff --git a/TAO/tests/Bug_4097_Regression/README b/TAO/tests/Bug_4097_Regression/README new file mode 100644 index 00000000000..1a632b0ca69 --- /dev/null +++ b/TAO/tests/Bug_4097_Regression/README @@ -0,0 +1,119 @@ +This is Prismtech Jira TAO-69 and Bugzilla_4097 + +Typecodes for UNIONs with multiple labels per individual case are +generated incorrectly. + + + +For example the following legal IDL union declarion: + +union MultiLabelUnion switch (long) { + case 0: + case 1: + char mlu_char; + case 2: + long mlu_long; +}; + +Currently TAO (and a few other orbs including JacOrb and eOrb'C' eORB'C++') do +not handle the typecode generation correctly for this. Only one of the above +cases for the mlu_char member are dealt with in the typecode information, even +though the generated (de)marshaling code correctly handles all case labels. +This means that such unions sent inside anys are impossiable to decode at the +receiving end if the missing case label is being used for the union it holds. + +When using the typecode interface functions for the above it incorrectly gives: +tc->member_count () returns 2 (for the two types) +tc->member_label(0), tc->member_name(0) and tc->member_type(0) + returns 0, "mlu_char", and char +tc->member_label(1), tc->member_name(1) and tc->member_type(1) + returns 2, "mlu_long", and long + +The exact handling for the above is not actually dealt with in the CORBA spec +as far as I can see excepting that multiple case labels for a type are +perfectly valid for unions. BUT I've found a little passage detailing this in +the Henning and Vinoski "Advanced CORBA Programming with C++" bilble. See +page 700. (of the 16.3.2 Chapter "Type Code Parameters" page 698-700 +covering "Type Code Parameters for Unions"). This states that the +member_count for unions should actually be the number of case labels NOT the +number of types. This would make the typecode information that needs to be +generated for the above type produce: + +tc->member_count () returns 3 (for the the number of labels) +tc->member_label(0), tc->member_name(0) and tc->member_type(0) + returns 0, "mlu_char", and char +tc->member_label(1), tc->member_name(1) and tc->member_type(1) + returns 1, "mlu_char", and char +tc->member_label(2), tc->member_name(2) and tc->member_type(2) + returns 2, "mlu_long", and long + +This was found by a Prismtech customer who noted that inter-op with TIDorb +wasn't working correctly when extracting such a union from an any as generated +by TAO. As a work-a-round, if they modified the IDL for the type to: + +union MultiLabelUnion switch (long) { + case 0: + char mlu_char; + case 1: + char mlu_char; + case 2: + long mlu_long; +}; + +everything started working again, but that the normal IDL (that doesn't work) +should also work. + +---------------- +Failing test run: +---------------- + +Starting +Creating union using default descriminant of mlu_char type +. Extracted descriminant is correct (0) +. Extracted value is correct (x) +Encode->Decode any with union using default descriminant of mlu_char type +. Size of encoding is 129 +. Extracted descriminant is correct (0) +. Extracted value is correct (x) +Creating union using case 0 +. Extracted descriminant is correct (0) +. Extracted value is correct (y) +Encode->Decode any with union using case 0 +. Size of encoding is 129 +. Extracted descriminant is correct (0) +. Extracted value is correct (y) +Creating union using case 1 +. Extracted descriminant is correct (1) +. Extracted value is correct (z) +Encode->Decode any with union using case 1 +. Size of encoding is 129 +. DID NOT Extract from any (Test Failure) +Test FAILED. + +---------------- +Passing test run: +---------------- + +Starting +Creating union using default descriminant of mlu_char type +. Extracted descriminant is correct (0) +. Extracted value is correct (x) +Encode->Decode any with union using default descriminant of mlu_char type +. Size of encoding is 129 +. Extracted descriminant is correct (0) +. Extracted value is correct (x) +Creating union using case 0 +. Extracted descriminant is correct (0) +. Extracted value is correct (y) +Encode->Decode any with union using case 0 +. Size of encoding is 129 +. Extracted descriminant is correct (0) +. Extracted value is correct (y) +Creating union using case 1 +. Extracted descriminant is correct (1) +. Extracted value is correct (z) +Encode->Decode any with union using case 1 +. Size of encoding is 129 +. Extracted descriminant is correct (1) +. Extracted value is correct (z) +Test SUCCEEDED. diff --git a/TAO/tests/Bug_4097_Regression/run_test.pl b/TAO/tests/Bug_4097_Regression/run_test.pl new file mode 100755 index 00000000000..6304ab5e0bc --- /dev/null +++ b/TAO/tests/Bug_4097_Regression/run_test.pl @@ -0,0 +1,20 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +use strict; + +my $target = PerlACE::TestTarget::create_target(1) + or die "Create target failed\n"; +my $test = $target->CreateProcess("Bug_4097_Regression"); +my $result = $test->SpawnWaitKill($target->ProcessStartWaitInterval()); +if ($result != 0) { + print STDERR "ERROR: test returned $result\n"; + exit 1; +} +exit 0; |