--- libvirt-gconfig/Makefile.am | 2 + .../libvirt-gconfig-domain-graphics-rdp.c | 130 +++++++++++++++++++++ .../libvirt-gconfig-domain-graphics-rdp.h | 79 +++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 7 ++ 5 files changed, 219 insertions(+) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 6b3b2cb..acd5289 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -39,6 +39,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ + libvirt-gconfig-domain-graphics-rdp.h \ libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ libvirt-gconfig-domain-graphics-vnc.h \ @@ -116,6 +117,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ + libvirt-gconfig-domain-graphics-rdp.c \ libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ libvirt-gconfig-domain-graphics-vnc.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c new file mode 100644 index 0000000..8a4084e --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c @@ -0,0 +1,130 @@ +/* + * libvirt-gconfig-domain-graphics-rdp.c: libvirt domain RDP configuration + * + * Copyright (C) 2011 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: Daniel P. Berrange <berrange@xxxxxxxxxx> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_RDP_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, GVirConfigDomainGraphicsRdpPrivate)) + +struct _GVirConfigDomainGraphicsRdpPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsRdp, gvir_config_domain_graphics_rdp, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_rdp_class_init(GVirConfigDomainGraphicsRdpClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsRdpPrivate)); +} + + +static void gvir_config_domain_graphics_rdp_init(GVirConfigDomainGraphicsRdp *graphics_rdp) +{ + g_debug("Init GVirConfigDomainGraphicsRdp=%p", graphics_rdp); + + graphics_rdp->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_RDP_GET_PRIVATE(graphics_rdp); +} + + +GVirConfigDomainGraphicsRdp *gvir_config_domain_graphics_rdp_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "rdp", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_RDP(object); +} + +GVirConfigDomainGraphicsRdp * +gvir_config_domain_graphics_rdp_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, + "graphics", NULL, xml, error); + if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "rdp") != 0) { + g_object_unref(G_OBJECT(object)); + return NULL; + } + return GVIR_CONFIG_DOMAIN_GRAPHICS_RDP(object); +} + +void gvir_config_domain_graphics_rdp_set_autoport(GVirConfigDomainGraphicsRdp *graphics, + gboolean autoport) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "autoport", G_TYPE_BOOLEAN, autoport, + NULL); +} + +int gvir_config_domain_graphics_rdp_get_port(GVirConfigDomainGraphicsRdp *graphics) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics), 0); + + return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics), + NULL, "port", 0); +} + +void gvir_config_domain_graphics_rdp_set_port(GVirConfigDomainGraphicsRdp *graphics, + int port) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "port", G_TYPE_INT, port, + NULL); +} + + +void gvir_config_domain_graphics_rdp_set_replace_user(GVirConfigDomainGraphicsRdp *graphics, + gboolean replace_user) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "replaceUser", + G_TYPE_BOOLEAN, + replace_user, + NULL); +} + + +void gvir_config_domain_graphics_rdp_set_multi_user(GVirConfigDomainGraphicsRdp *graphics, + gboolean multi_user) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "multiUser", + G_TYPE_BOOLEAN, + multi_user, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h new file mode 100644 index 0000000..fb47834 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h @@ -0,0 +1,79 @@ +/* + * libvirt-gconfig-domain-graphics-rdp.h: libvirt domain RDP graphics configuration + * + * Copyright (C) 2011 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: Daniel P. Berrange <berrange@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_RDP_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_RDP_H__ + +G_BEGIN_DECLS + +#define GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP (gvir_config_domain_graphics_rdp_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_RDP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, GVirConfigDomainGraphicsRdp)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_RDP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, GVirConfigDomainGraphicsRdpClass)) +#define GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP)) +#define GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_RDP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, GVirConfigDomainGraphicsRdpClass)) + +typedef struct _GVirConfigDomainGraphicsRdp GVirConfigDomainGraphicsRdp; +typedef struct _GVirConfigDomainGraphicsRdpPrivate GVirConfigDomainGraphicsRdpPrivate; +typedef struct _GVirConfigDomainGraphicsRdpClass GVirConfigDomainGraphicsRdpClass; + +struct _GVirConfigDomainGraphicsRdp +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsRdpPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsRdpClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_rdp_get_type(void); + +GVirConfigDomainGraphicsRdp *gvir_config_domain_graphics_rdp_new(void); +GVirConfigDomainGraphicsRdp *gvir_config_domain_graphics_rdp_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_graphics_rdp_set_autoport(GVirConfigDomainGraphicsRdp *graphics, + gboolean autoport); + +int gvir_config_domain_graphics_rdp_get_port(GVirConfigDomainGraphicsRdp *graphics); +void gvir_config_domain_graphics_rdp_set_port(GVirConfigDomainGraphicsRdp *graphics, + int port); + +void gvir_config_domain_graphics_rdp_set_multi_user(GVirConfigDomainGraphicsRdp *graphics, + gboolean multi_user); +void gvir_config_domain_graphics_rdp_set_replace_user(GVirConfigDomainGraphicsRdp *graphics, + gboolean replace_user); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_RDP_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index d31b610..678389a 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -56,6 +56,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.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> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index ccda4c0..d06408f 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -515,6 +515,13 @@ LIBVIRT_GCONFIG_0.1.6 { LIBVIRT_GCONFIG_0.1.7 { global: gvir_config_domain_graphics_sdl_set_fullscreen; + + gvir_config_domain_graphics_rdp_get_type; + gvir_config_domain_graphics_rdp_new; + gvir_config_domain_graphics_rdp_new_from_xml; + gvir_config_domain_graphics_rdp_set_autoport; + gvir_config_domain_graphics_rdp_get_port; + gvir_config_domain_graphics_rdp_set_port; } LIBVIRT_GCONFIG_0.1.6; # .... define new API here using predicted next version number .... -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list