--- libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 17 +++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 2 ++ libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c | 17 +++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h | 2 ++ libvirt-gconfig/libvirt-gconfig.sym | 2 ++ tests/test-gconfig.c | 10 ++++++++++ tests/xml/gconfig-domain-device-graphics-listen.xml | 2 ++ 7 files changed, 52 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c index 7e0bd9f..88dd757 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c @@ -186,6 +186,23 @@ void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice } } +/** + * gvir_config_domain_graphics_spice_add_listen: + * @graphics: a #GVirConfigDomainGraphicsSpice + * @listens: a #GVirConfigDomainGraphicsListen + * + * This method is used to add a listen node to a #GVirConfigDomainGraphicsSpice + * device can handle. +*/ +void gvir_config_domain_graphics_spice_add_listen(GVirConfigDomainGraphicsSpice *graphics, + GVirConfigDomainGraphicsListen *listen) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics)); + + gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics), + GVIR_CONFIG_OBJECT(listen)); +} + struct ListenData { GVirConfigXmlDoc *doc; const gchar *schema; diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h index 1632cc9..468ead6 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h @@ -97,6 +97,8 @@ void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *gra void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics, GList *listens); +void gvir_config_domain_graphics_spice_add_listen(GVirConfigDomainGraphicsSpice *graphics, + GVirConfigDomainGraphicsListen *listen); GList *gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice *graphics); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c index bc229bd..17fce67 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c @@ -149,6 +149,23 @@ void gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc *gra } } +/** + * gvir_config_domain_graphics_vnc_add_listen: + * @graphics: a #GVirConfigDomainGraphicsVnc + * @listens: a #GVirConfigDomainGraphicsListen + * + * This method is used to add a listen node to a #GVirConfigDomainGraphicsVnc + * device can handle. +*/ +void gvir_config_domain_graphics_vnc_add_listen(GVirConfigDomainGraphicsVnc *graphics, + GVirConfigDomainGraphicsListen *listen) +{ + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_VNC(graphics)); + + gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics), + GVIR_CONFIG_OBJECT(listen)); +} + struct ListenData { GVirConfigXmlDoc *doc; const gchar *schema; diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h index df21bd6..e4d4fc3 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h @@ -75,6 +75,8 @@ void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph void gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc *graphics, GList *listens); +void gvir_config_domain_graphics_vnc_add_listen(GVirConfigDomainGraphicsVnc *graphics, + GVirConfigDomainGraphicsListen *listen); GList *gvir_config_domain_graphics_vnc_get_listen(GVirConfigDomainGraphicsVnc *graphics); void gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc *graphics, diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index c07de56..aef53cd 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -757,9 +757,11 @@ global: 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_add_listen; gvir_config_domain_graphics_spice_get_listen; gvir_config_domain_graphics_spice_set_gl; gvir_config_domain_graphics_spice_set_listen; + gvir_config_domain_graphics_vnc_add_listen; gvir_config_domain_graphics_vnc_get_listen; gvir_config_domain_graphics_vnc_set_listen; diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c index 97275a1..7fc0704 100644 --- a/tests/test-gconfig.c +++ b/tests/test-gconfig.c @@ -501,6 +501,11 @@ static void test_domain_device_graphics_listen(void) g_object_unref(inet_address); g_object_unref(ret_inet_address); + GVirConfigDomainGraphicsListenNone *none_listen = gvir_config_domain_graphics_listen_none_new(); + GVirConfigDomainGraphicsListenUnix *unix_listen = gvir_config_domain_graphics_listen_unix_new(); + gvir_config_domain_graphics_listen_unix_set_path(unix_listen, "/tmp/bar.sock"); + g_assert_cmpstr("/tmp/bar.sock", ==, gvir_config_domain_graphics_listen_unix_get_path(unix_listen)); + gvir_config_domain_graphics_listen_address_set_address(address_listen, "127.0.0.1"); const gchar *ret_address = gvir_config_domain_graphics_listen_address_get_address(address_listen); g_assert_cmpstr("127.0.0.1", ==, ret_address); @@ -511,6 +516,11 @@ static void test_domain_device_graphics_listen(void) g_object_unref(G_OBJECT(address_listen)); g_list_free(listen_list); + gvir_config_domain_graphics_spice_add_listen(graphics, GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN(none_listen)); + gvir_config_domain_graphics_spice_add_listen(graphics, GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN(unix_listen)); + g_object_unref(none_listen); + g_object_unref(unix_listen); + gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE(graphics)); g_object_unref(G_OBJECT(graphics)); diff --git a/tests/xml/gconfig-domain-device-graphics-listen.xml b/tests/xml/gconfig-domain-device-graphics-listen.xml index 27200c4..6e53876 100644 --- a/tests/xml/gconfig-domain-device-graphics-listen.xml +++ b/tests/xml/gconfig-domain-device-graphics-listen.xml @@ -2,6 +2,8 @@ <devices> <graphics type="spice"> <listen type="address" address="127.0.0.1"/> + <listen type="none"/> + <listen type="socket" socket="/tmp/bar.sock"/> </graphics> </devices> </domain> -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list