[libvirt] [PATCH 6/8] Introduce generic RPC client objects
Eric Blake
eblake at redhat.com
Thu Dec 9 23:25:32 UTC 2010
On 12/01/2010 10:26 AM, Daniel P. Berrange wrote:
> To facilitate creation of new clients using XDR RPC services,
> pull alot of the remote driver code into a set of reusable
s/alot/a lot/
> objects.
>
> - virNetClient: Encapsulates a socket connection to a
> remote RPC server. Handles all the network I/O for
> reading/writing RPC messages. Delegates RPC encoding
> and decoding to the registered programs
>
> - virNetClientProgram: Handles processing and dispatch
> of RPC messages for a single RPC (program,version).
> A program can register to receive async events
> from a client
> - virNetClientSASLContext: Handles everything todo with
> SASL authentication and encryption. The callers no
> longer need directly call any cyrus-sasl APIs, which
> means error handling is simpler & alternative SASL
> impls can be provided for Win32
>
> Each new client program now merely needs to define the list of
> RPC procedures & events it wants and their handlers. It does
> not need to deal with any of the network I/O functionality at
> all.
> +++ b/src/Makefile.am
> @@ -1117,7 +1117,7 @@ libvirt_qemu_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
> EXTRA_DIST += $(LIBVIRT_QEMU_SYMBOL_FILE)
>
>
> -noinst_LTLIBRARIES += libvirt-net-rpc.la libvirt-net-rpc-server.la
> +noinst_LTLIBRARIES += libvirt-net-rpc.la libvirt-net-rpc-server.la libvirt-net-rpc-client.la
Wrap at 80 columns.
>
> libvirt_net_rpc_la_SOURCES = \
> ../daemon/event.c \
> @@ -1153,6 +1153,18 @@ libvirt_net_server_la_LDFLAGS = \
> libvirt_net_server_la_LIBADD = \
> $(CYGWIN_EXTRA_LIBADD)
>
> +libvirt_net_client_la_SOURCES = \
> + rpc/virnetclientsaslcontext.h rpc/virnetclientsaslcontext.c \
> + rpc/virnetclientprogram.h rpc/virnetclientprogram.c \
> + rpc/virnetclient.h rpc/virnetclient.c
> +libvirt_net_client_la_CFLAGS = \
> + $(AM_CFLAGS)
> +libvirt_net_client_la_LDFLAGS = \
> + $(AM_LDFLAGS) \
> + $(CYGWIN_EXTRA_LDFLAGS) \
> + $(MINGW_EXTRA_LDFLAGS)l
s/l$//
> +++ b/src/rpc/virnetclient.c
> @@ -0,0 +1,1237 @@
> +
> +
Copyright header? Probably affects multiple new files across multiple
of these patches.
> +
> +#ifdef WIN32
> +# define pipe(fds) _pipe(fds,4096, _O_BINARY)
> +#endif
Yuck. Gnulib should really take care of this for us. But for now, we
have to keep it.
> +
> +virNetClientPtr virNetClientNewCommand(const char **cmdargv,
> + const char **cmdenv)
> +{
If virNetSocketNewConnectCommand is rewritten around virCommand, then
this should be updated as well.
> +
> +static int virNetClientCallDispatchStream(virNetClientPtr client ATTRIBUTE_UNUSED)
> +{
> +#if 0
> + struct private_stream_data *privst;
You weren't kidding about this being an incomplete RFC series.
> +#define __VIR_NET_CLIENT_H__
> +
> +#if HAVE_SASL
'make syntax-check' won't like this if you have cppi installed.
Again, mostly okay; just copying existing code and renaming into new
API. Overall, I'm liking the direction this series is heading.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101209/e7714cc7/attachment-0001.sig>
More information about the libvir-list
mailing list