First off we have the XDR definition file. This is basically a translation
of the original qemud/protocol.h into the XDR format. The important changes
are that
- Instead of a single enum of message types there are now two enums
- enum qemud_packet_client_data_type lists valid packets (ie method
calls) that a client can make
- enum qemud_packet_server_data_type lists valie packets (ie method
replies) that a server can make
There are two reasons for this split
- This lets us add in more server packets which are not neccessaril
method replies. ie async notifications ('domain foo start')
- We use the enum to discriminate two unions later and there is
actually already one type that's used by the server only
QEMU_SERVER_PACKET_FAILURE to indicate a method which failed.
- The big union qemud_packet_data is now split up
- The inline per-message type structs are now all represented
at the top level as fully named structs.
- There is a qemud_packet_client_data union which is the
union of all structs relevant to method calls
- There is a qemud_packet_server_data union which is the
union of all structs relevant to method replies
- Introduce the idea of serial numbers. A serial number allows a client
to track the incoming packet from the server which corresponds to a
message it just sent. This is because in the future a server may be
sending async notifications mixed inbetween method replies. So we have
- A qemud_packet_client struct which contains a serial
number & a qemud_packet_client_data struct.
- A qemud_packet_server struct which contains a serial
number, a replyto serial number & a qemud_packet_server_data struct.
- Finally there is a qemud_packet_header which contains a magic 4 byte
sequence and a length field. This is basically to make pulling the
variable length XDR payloads off the wire easier to deal with. The
header is always followed by a qemud_packet_client or qemud_packet_server
XDR payload. The header length field gives the size of the payload.
The magic byte sequence is just a sanity check, which is also useful
in debugging.
$ diffstat libvirt-qemu-xdr-protocol.patch
Makefile.am | 15 +
protocol.h | 329 --------------------------------
protocol.x | 608 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 620 insertions(+), 332 deletions(-)
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|