Make all relevant changes to admin interface and admin protocol, in order to
support typed parameters within admin API as well.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
cfg.mk | 2 +-
daemon/admin.c | 1 +
daemon/admin_server.c | 1 +
src/admin/admin_protocol.x | 24 ++++++++++++++++++++++++
src/admin/admin_remote.c | 1 +
src/admin_protocol-structs | 25 +++++++++++++++++++++++++
6 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/cfg.mk b/cfg.mk
index 8e8586f..61397e8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1227,7 +1227,7 @@
exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
^(tools/|examples/|include/libvirt/(virterror|libvirt(-(admin|qemu|lxc))?)\.h$$)
exclude_file_name_regexp--sc_prohibit_int_ijk = \
- ^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
+
^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/|src/admin_protocol-structs|src/admin/admin_protocol.x)$
exclude_file_name_regexp--sc_prohibit_getenv = \
^tests/.*\.[ch]$$
diff --git a/daemon/admin.c b/daemon/admin.c
index 3169cdd..18ac22b 100644
--- a/daemon/admin.c
+++ b/daemon/admin.c
@@ -37,6 +37,7 @@
#include "virnetserver.h"
#include "virstring.h"
#include "virthreadjob.h"
+#include "virtypedparam.h"
#define VIR_FROM_THIS VIR_FROM_ADMIN
diff --git a/daemon/admin_server.c b/daemon/admin_server.c
index 1d30ea5..e2ed1fe 100644
--- a/daemon/admin_server.c
+++ b/daemon/admin_server.c
@@ -31,6 +31,7 @@
#include "virnetdaemon.h"
#include "virnetserver.h"
#include "virstring.h"
+#include "virtypedparam.h"
#define VIR_FROM_THIS VIR_FROM_ADMIN
diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
index 6590980..57dbb6b 100644
--- a/src/admin/admin_protocol.x
+++ b/src/admin/admin_protocol.x
@@ -22,6 +22,7 @@
* Author: Martin Kletzander <mkletzan(a)redhat.com>
*/
+%#include <libvirt/libvirt-admin.h>
%#include "virxdrdefs.h"
/*----- Data types. -----*/
@@ -41,12 +42,35 @@ typedef string admin_nonnull_string<ADMIN_STRING_MAX>;
/* A long string, which may be NULL. */
typedef admin_nonnull_string *admin_string;
+union admin_typed_param_value switch (int type) {
+ case VIR_TYPED_PARAM_INT:
+ int i;
+ case VIR_TYPED_PARAM_UINT:
+ unsigned int ui;
+ case VIR_TYPED_PARAM_LLONG:
+ hyper l;
+ case VIR_TYPED_PARAM_ULLONG:
+ unsigned hyper ul;
+ case VIR_TYPED_PARAM_DOUBLE:
+ double d;
+ case VIR_TYPED_PARAM_BOOLEAN:
+ int b;
+ case VIR_TYPED_PARAM_STRING:
+ admin_nonnull_string s;
+};
+
+struct admin_typed_param {
+ admin_nonnull_string field;
+ admin_typed_param_value value;
+};
+
/* A server which may NOT be NULL */
struct admin_nonnull_server {
admin_nonnull_string name;
};
/*----- Protocol. -----*/
+
struct admin_connect_open_args {
unsigned int flags;
};
diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c
index 21e0dd3..a1b2f84 100644
--- a/src/admin/admin_remote.c
+++ b/src/admin/admin_remote.c
@@ -23,6 +23,7 @@
#include <config.h>
#include <rpc/rpc.h>
#include "admin_protocol.h"
+#include "virtypedparam.h"
typedef struct _remoteAdminPriv remoteAdminPriv;
typedef remoteAdminPriv *remoteAdminPrivPtr;
diff --git a/src/admin_protocol-structs b/src/admin_protocol-structs
index d8aca06..26c8443 100644
--- a/src/admin_protocol-structs
+++ b/src/admin_protocol-structs
@@ -1,4 +1,29 @@
/* -*- c -*- */
+enum {
+ VIR_TYPED_PARAM_INT = 1,
+ VIR_TYPED_PARAM_UINT = 2,
+ VIR_TYPED_PARAM_LLONG = 3,
+ VIR_TYPED_PARAM_ULLONG = 4,
+ VIR_TYPED_PARAM_DOUBLE = 5,
+ VIR_TYPED_PARAM_BOOLEAN = 6,
+ VIR_TYPED_PARAM_STRING = 7,
+};
+struct admin_typed_param_value {
+ int type;
+ union {
+ int i;
+ u_int ui;
+ int64_t l;
+ uint64_t ul;
+ double d;
+ int b;
+ admin_nonnull_string s;
+ } admin_typed_param_value_u;
+};
+struct admin_typed_param {
+ admin_nonnull_string field;
+ admin_typed_param_value value;
+};
struct admin_nonnull_server {
admin_nonnull_string name;
};
--
2.4.11