--- libvirt-gconfig/Makefile.am | 2 + .../libvirt-gconfig-domain-graphics-listen-unix.c | 98 ++++++++++++++++++++++ .../libvirt-gconfig-domain-graphics-listen-unix.h | 72 ++++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 5 ++ 5 files changed, 178 insertions(+) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index bdeac32..ba08a11 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -49,6 +49,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-graphics-listen.h \ libvirt-gconfig-domain-graphics-listen-address.h \ libvirt-gconfig-domain-graphics-listen-none.h \ + libvirt-gconfig-domain-graphics-listen-unix.h \ libvirt-gconfig-domain-graphics-rdp.h \ libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ @@ -145,6 +146,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-graphics-listen.c \ libvirt-gconfig-domain-graphics-listen-address.c \ libvirt-gconfig-domain-graphics-listen-none.c \ + libvirt-gconfig-domain-graphics-listen-unix.c \ libvirt-gconfig-domain-graphics-rdp.c \ libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c new file mode 100644 index 0000000..b16f52f --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c @@ -0,0 +1,98 @@ +/* + * libvirt-gconfig-domain-graphics-listen-unix.c: libvirt domain graphics listen unix socket configuration + * + * Copyright (C) 2016 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: Christophe Fergeau <cfergeau@xxxxxxxxxx> + */ + +#include <config.h> + +#include <gio/gio.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, GVirConfigDomainGraphicsListenUnixPrivate)) + +struct _GVirConfigDomainGraphicsListenUnixPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsListenUnix, gvir_config_domain_graphics_listen_unix, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN); + + +static void gvir_config_domain_graphics_listen_unix_class_init(GVirConfigDomainGraphicsListenUnixClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsListenUnixPrivate)); +} + + +static void gvir_config_domain_graphics_listen_unix_init(GVirConfigDomainGraphicsListenUnix *listen) +{ + listen->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_GET_PRIVATE(listen); +} + + +GVirConfigDomainGraphicsListenUnix *gvir_config_domain_graphics_listen_unix_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, "listen", NULL); + gvir_config_object_set_attribute(object, + "type", "socket", + NULL); + + return GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX(object); +} + + +GVirConfigDomainGraphicsListenUnix *gvir_config_domain_graphics_listen_unix_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, + "listen", NULL, xml, error); + if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "socket") != 0) { + g_object_unref(G_OBJECT(object)); + g_return_val_if_reached(NULL); + } + return GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX(object); +} + +void gvir_config_domain_graphics_listen_unix_set_path(GVirConfigDomainGraphicsListenUnix *listen, + const gchar *path) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_UNIX(listen)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen), + "socket", path, + NULL); +} + +const gchar * +gvir_config_domain_graphics_listen_unix_get_path(GVirConfigDomainGraphicsListenUnix *listen) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_UNIX(listen), NULL); + + return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(listen), + NULL, + "socket"); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.h new file mode 100644 index 0000000..9c91679 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.h @@ -0,0 +1,72 @@ +/* + * libvirt-gconfig-domain-graphics-listen-unix.h: libvirt domain graphics listen unix socket configuration + * + * Copyright (C) 2016 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: Christophe Fergeau <cfergeau@xxxxxxxxxx> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + +#define GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX (gvir_config_domain_graphics_listen_unix_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, GVirConfigDomainGraphicsListenUnix)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, GVirConfigDomainGraphicsListenUnixClass)) +#define GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_UNIX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX)) +#define GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, GVirConfigDomainGraphicsListenUnixClass)) + +typedef struct _GVirConfigDomainGraphicsListenUnix GVirConfigDomainGraphicsListenUnix; +typedef struct _GVirConfigDomainGraphicsListenUnixPrivate GVirConfigDomainGraphicsListenUnixPrivate; +typedef struct _GVirConfigDomainGraphicsListenUnixClass GVirConfigDomainGraphicsListenUnixClass; + +struct _GVirConfigDomainGraphicsListenUnix +{ + GVirConfigDomainGraphicsListen parent; + + GVirConfigDomainGraphicsListenUnixPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsListenUnixClass +{ + GVirConfigDomainGraphicsListenClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_graphics_listen_unix_get_type(void); + +GVirConfigDomainGraphicsListenUnix *gvir_config_domain_graphics_listen_unix_new(void); +GVirConfigDomainGraphicsListenUnix *gvir_config_domain_graphics_listen_unix_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_graphics_listen_unix_set_path(GVirConfigDomainGraphicsListenUnix *listen, + const gchar *path); +const gchar *gvir_config_domain_graphics_listen_unix_get_path(GVirConfigDomainGraphicsListenUnix *listen); + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index cd9d54e..45d3839 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -66,6 +66,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-none.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index a20c209..c07de56 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -752,6 +752,11 @@ global: gvir_config_domain_graphics_listen_none_get_type; gvir_config_domain_graphics_listen_none_new; gvir_config_domain_graphics_listen_none_new_from_xml; + gvir_config_domain_graphics_listen_unix_get_path; + gvir_config_domain_graphics_listen_unix_get_type; + gvir_config_domain_graphics_listen_unix_new; + gvir_config_domain_graphics_listen_unix_new_from_xml; + gvir_config_domain_graphics_listen_unix_set_path; gvir_config_domain_graphics_spice_get_listen; gvir_config_domain_graphics_spice_set_gl; gvir_config_domain_graphics_spice_set_listen; -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list