--- libvirt-gconfig/libvirt-gconfig-interface.c | 15 +++++++++++++++ libvirt-gconfig/libvirt-gconfig-interface.h | 11 +++++++++++ libvirt-gconfig/libvirt-gconfig.sym | 2 ++ 3 files changed, 28 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-interface.c b/libvirt-gconfig/libvirt-gconfig-interface.c index 5eece82..d112123 100644 --- a/libvirt-gconfig/libvirt-gconfig-interface.c +++ b/libvirt-gconfig/libvirt-gconfig-interface.c @@ -83,3 +83,18 @@ GVirConfigInterface *gvir_config_interface_new_from_xml(const gchar *xml, return GVIR_CONFIG_INTERFACE(object); } +void gvir_config_interface_set_network_type(GVirConfigInterface *interface, + GVirConfigInterfaceNetworkType type) +{ + xmlNodePtr node; + const char *type_str; + + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(interface)); + if (node == NULL) + return; + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_INTERFACE_NETWORK_TYPE, + type); + if (type_str != NULL) { + xmlNewProp(node, (xmlChar*)"type", (xmlChar*)type_str); + } +} diff --git a/libvirt-gconfig/libvirt-gconfig-interface.h b/libvirt-gconfig/libvirt-gconfig-interface.h index 0728c29..9618611 100644 --- a/libvirt-gconfig/libvirt-gconfig-interface.h +++ b/libvirt-gconfig/libvirt-gconfig-interface.h @@ -56,12 +56,23 @@ struct _GVirConfigInterfaceClass gpointer padding[20]; }; +typedef enum { + GVIR_CONFIG_INTERFACE_TYPE_NETWORK, + GVIR_CONFIG_INTERFACE_TYPE_BRIDGE, + GVIR_CONFIG_INTERFACE_TYPE_USER, + GVIR_CONFIG_INTERFACE_TYPE_ETHERNET, + GVIR_CONFIG_INTERFACE_TYPE_DIRECT, + GVIR_CONFIG_INTERFACE_TYPE_MCAST, + GVIR_CONFIG_INTERFACE_TYPE_SERVER +} GVirConfigInterfaceNetworkType; GType gvir_config_interface_get_type(void); GVirConfigInterface *gvir_config_interface_new(void); GVirConfigInterface *gvir_config_interface_new_from_xml(const gchar *xml, GError **error); +void gvir_config_interface_set_network_type(GVirConfigInterface *interface, + GVirConfigInterfaceNetworkType type); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index cb0d035..e9f1513 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -49,8 +49,10 @@ LIBVIRT_GOBJECT_0.0.1 { gvir_config_domain_snapshot_new_from_xml; gvir_config_interface_get_type; + gvir_config_interface_network_type_get_type; gvir_config_interface_new; gvir_config_interface_new_from_xml; + gvir_config_interface_set_network_type; gvir_config_network_get_type; gvir_config_network_new; -- 1.7.7 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list