]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add admin protocol
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 15 Apr 2015 14:13:22 +0000 (16:13 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 16 Jun 2015 11:46:20 +0000 (13:46 +0200)
For now there are only CONNECT_OPEN and CONNECT_CLOSE procedures.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
.gitignore
src/Makefile.am
src/admin/admin_protocol.x [new file with mode: 0644]
src/admin_protocol-structs [new file with mode: 0644]

index 1a5cf8e28cb65af54ff9258b4274bcc046ad6cf8..b60c16258739b1371ae1846010a50ce61cd81c7a 100644 (file)
 /src/access/viraccessapichecklxc.h
 /src/access/viraccessapicheckqemu.c
 /src/access/viraccessapicheckqemu.h
+/src/admin/admin_protocol.[ch]
 /src/esx/*.generated.*
 /src/hyperv/*.generated.*
 /src/libvirt*.def
index d71c31876f512633b56e8186276f4e17b7aff40f..87d2bc5efaa6a90e88de4ca3fb51bd75995c9127 100644 (file)
@@ -392,6 +392,16 @@ REMOTE_DRIVER_SOURCES =                                            \
 EXTRA_DIST +=  $(REMOTE_DRIVER_PROTOCOL) \
                $(REMOTE_DRIVER_GENERATED)
 
+ADMIN_PROTOCOL = $(srcdir)/admin/admin_protocol.x
+
+ADMIN_PROTOCOL_GENERATED = \
+               admin/admin_protocol.c  \
+               admin/admin_protocol.h
+
+EXTRA_DIST += $(ADMIN_PROTOCOL) $(ADMIN_PROTOCOL_GENERATED)
+BUILT_SOURCES += $(ADMIN_PROTOCOL_GENERATED)
+MAINTAINERCLEANFILES += $(ADMIN_PROTOCOL_GENERATED)
+
 # Ensure that we don't change the struct or member names or member ordering
 # in remote_protocol.x  The embedded perl below needs a few comments, and
 # presumes you know what pdwtags output looks like:
@@ -412,7 +422,9 @@ EXTRA_DIST +=  $(REMOTE_DRIVER_PROTOCOL) \
 # The alternation of the following regexps matches both cases.
 r1 = /\* \d+ \*/
 r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/
-struct_prefix = (remote_|qemu_|lxc_|keepalive|vir(Net|LockSpace|LXCMonitor))
+libs_prefix = remote_|qemu_|lxc_|admin_
+other_prefix = keepalive|vir(Net|LockSpace|LXCMonitor)
+struct_prefix = ($(libs_prefix)|$(other_prefix))
 
 # Depending on configure options, libtool creates one or both of
 # remote/{,.libs/}libvirt_driver_remote_la-remote_protocol.o.  We want
@@ -2078,7 +2090,8 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
                  $(srcdir)/remote/lxc_protocol.x \
                  $(srcdir)/remote/qemu_protocol.x \
                  $(srcdir)/lxc/lxc_monitor_protocol.x \
-                 $(srcdir)/locking/lock_protocol.x
+                 $(srcdir)/locking/lock_protocol.x \
+                 $(srcdir)/admin/admin_protocol.x
 
 libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
        $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
new file mode 100644 (file)
index 0000000..1a2e94e
--- /dev/null
@@ -0,0 +1,77 @@
+/* -*- c -*-
+ * admin_protocol.x: private protocol for communicating between
+ *   remote_internal driver and libvirtd.  This protocol is
+ *   internal and may change at any time.
+ *
+ * Copyright (C) 2014-2015 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Martin Kletzander <mkletzan@redhat.com>
+ */
+
+%#include "remote_protocol.h"
+
+/*----- Data types. -----*/
+
+/* Length of long, but not unbounded, strings.
+ * This is an arbitrary limit designed to stop the decoder from trying
+ * to allocate unbounded amounts of memory when fed with a bad message.
+ */
+const REMOTE_STRING_MAX = 4194304;
+
+/* A long string, which may NOT be NULL. */
+typedef string admin_nonnull_string<REMOTE_STRING_MAX>;
+
+/* A long string, which may be NULL. */
+typedef admin_nonnull_string *admin_string;
+
+/*----- Protocol. -----*/
+struct admin_connect_open_args {
+    unsigned int flags;
+};
+
+/* Define the program number, protocol version and procedure numbers here. */
+const ADMIN_PROGRAM = 0x06900690;
+const ADMIN_PROTOCOL_VERSION = 1;
+
+enum admin_procedure {
+    /* Each function must be preceded by a comment providing one or
+     * more annotations:
+     *
+     * - @generate: none|client|server|both
+     *
+     *   Whether to generate the dispatch stubs for the server
+     *   and/or client code.
+     *
+     * - @readstream: paramnumber
+     * - @writestream: paramnumber
+     *
+     *   The @readstream or @writestream annotations let daemon and src/remote
+     *   create a stream.  The direction is defined from the src/remote point
+     *   of view.  A readstream transfers data from daemon to src/remote.  The
+     *   <paramnumber> specifies at which offset the stream parameter is inserted
+     *   in the function parameter list.
+     */
+    /**
+     * @generate: client
+     */
+    ADMIN_PROC_CONNECT_OPEN = 1,
+
+    /**
+     * @generate: client
+     */
+    ADMIN_PROC_CONNECT_CLOSE = 2
+};
diff --git a/src/admin_protocol-structs b/src/admin_protocol-structs
new file mode 100644 (file)
index 0000000..3ac31fa
--- /dev/null
@@ -0,0 +1,8 @@
+/* -*- c -*- */
+struct admin_connect_open_args {
+        u_int                      flags;
+};
+enum admin_procedure {
+        ADMIN_PROC_CONNECT_OPEN = 1,
+        ADMIN_PROC_CONNECT_CLOSE = 2,
+};