
Richard W.M. Jones wrote:
3 Client-side -------------
A src/remote_internal.c A src/remote_internal.h M src/driver.h M src/libvirt.c
This is the code which serialises requests on the client side. First up is a small patch against driver.h and libvirt.c which just declares and registers the new driver. Secondly, the driver itself (remote_internal.h / remote_internal.c) which I will describe in more detail. The header file is small and I think non-controversial. It just declares the remoteRegister function and a handful of constants like paths and port numbers. The driver itself (remote_internal.c) consists of the following parts, arranged here in the same order that they appear in the file: (1) remoteOpen and associated, GnuTLS initialisation This function and associated functions deals with parsing the remote URI, deciding which transport to use, deciding the URI to forward to the remote end, creating the transport (including initialising GnuTLS, forking ssh, ...), and verifying the server's certificate. (2) The driver functions, remoteClose, remoteType, etc. etc. (3) The network driver functions, remoteNetworkOpen, etc. etc. For each function we serialise the parameters as an XDR remote_foo_args object, use the generic "call" function to dispatch the call, then deserialise the XDR remote_foo_ret return value. Most of the heavy lifting for the RPC is done in the "call" function itself ... (4) The RPC implementation (function "call"), error handling, serialisation of virDomainPtr and virNetworkPtr. ... which also deals with making error handling transparent. There are also some functions at the bottom to handle serialising and deserialising virDomainPtr and virNetworkPtr. We do this by essentially translating them into (name, UUID) pairs. (5) Table of functions and registration. And finally comes the table of functions and declaration of remoteRegister. If you're having difficulty following XDR code, it may help to read this first: http://et.redhat.com/~rjones/xdr_tests/ Rich. -- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland)