[omniORB] Extending a union by a member - is a mismatch btw. server and client IDL allowed?

Duncan Grisby duncan at grisby.org
Tue Aug 21 10:23:58 BST 2012


On Mon, 2012-08-20 at 12:24 +0200, Martin B. wrote:

> Is a client compiled with v1-1.idl supposed to be able to talk to a 
> server compiled with v1-2.idl -- where the definition of the union (and 
> the enum) differ but are a pure addition to the existing interface?
> 
> Can a client correctly invoke GetValue() as long as this function 
> doesn't return a unknown datatype?
> 
> Is this covered by the CORBA spec at all?

The CORBA spec says that it is illegal to have differing IDL on client
and server. However, as long as they are communicating with GIOP, you
will get away with it. The on-the-wire format for unions just sends the
discriminator followed by the value associated with that discriminator.
As long as the receiver gets a discriminator and value it knows, it will
never know that the sender had a different definition.

With an enum discriminator, you must extend it by adding items to the
end of the enum. Enums are sent by numerical value, so if you modify the
order of the enum, the values will be misinterpreted.

You will of course be in real trouble if the receiver gets a union value
with a discriminator it didn't expect. Exactly what will happen depends
on the IDL definitions and how the receiving ORB handles the unexpected
marshalled data. You may get various different exceptions or even crash.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --





More information about the omniORB-list mailing list