qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] New Migration Protocol using Visitor Interface


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC] New Migration Protocol using Visitor Interface
Date: Mon, 03 Oct 2011 11:02:47 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13

On 10/03/2011 10:58 AM, Michael S. Tsirkin wrote:
On Mon, Oct 03, 2011 at 10:44:45AM -0500, Anthony Liguori wrote:
Specifically
the case where first field in a sequence tells
you the meaning of the following ones?

Can you give me the example in ASN.1?

Regards,

Anthony Liguori

That would be a selection from CHOICE.
Note that CHOICE doesn't affect encoding on the wire:
BER just uses the underlying type.

Ah, so that's a union value.  I think we would have to decide how we
wanted to model unions.

IMHO it's easier to use if a visitor for the right type
is called, not a top level one for the union.

  Presumably, the selected CHOICE is
indicated by some other field?

Exactly. Some function of some other field :)

I would think it's a good idea to
use the type information to identify which selection of a CHOICE was
chosen.

Not sure what this means. We really need to look at the
serialized field to know which selection was chose.
In theory the field that dictates the meaning might come
after the choice, but I think we don't limit outselves
too much if we require it to come before in a sequence.

Yeah, you can certainly open code it..

if (s->some_field == FOO) {
   visit_type_int(...);
} else if (s->some_field == BAR) {
   visit_type_str(...);
}

Personally, I'm inclined to just go with that strategy unless it becomes pervasive. If so, I think it's worth abstracting to a higher level concept.

What that means for having a multi-Visitor system is that the protocol layer would accept any valid choice and the Device layer would validate that the selected choice is valid based on the field contents.

Regards,

Anthony Liguori



I had implemented a union type in the old glib branch but that was
based on a struct with an enum element and then the appropriate
value element.

Regards,

Anthony Liguori

Yes, this seems limiting.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]