From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> --- libvirt-gconfig/libvirt-gconfig-domain-interface.c | 35 ++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-interface.h | 4 ++ libvirt-gconfig/libvirt-gconfig.sym | 4 ++ 3 files changed, 43 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c b/libvirt-gconfig/libvirt-gconfig-domain-interface.c index 85cc194..61d35bd 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c @@ -96,6 +96,41 @@ void gvir_config_domain_interface_set_model(GVirConfigDomainInterface *interface "model", "type", model); } +const char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *interface) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL); + + return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface), + "target", "device"); +} + +GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), + GVIR_CONFIG_DOMAIN_INTERFACE_LINK_STATE_DEFAULT); + + return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(interface), + "link", "state", + GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_LINK_STATE, + GVIR_CONFIG_DOMAIN_INTERFACE_LINK_STATE_DEFAULT); +} + +const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL); + + return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface), + "mac", "address"); +} + +const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL); + + return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface), + "model", "type"); +} + G_GNUC_INTERNAL GVirConfigDomainDevice * gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc, xmlNodePtr tree) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.h b/libvirt-gconfig/libvirt-gconfig-domain-interface.h index 6e802fb..c8c4fb3 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-interface.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.h @@ -72,6 +72,10 @@ void gvir_config_domain_interface_set_mac(GVirConfigDomainInterface *interface, const char *mac_address); void gvir_config_domain_interface_set_model(GVirConfigDomainInterface *interface, const char *model); +const char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *interface); +GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface); +const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface); +const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 96ce58f..f91b8b0 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -145,6 +145,10 @@ LIBVIRT_GCONFIG_0.0.4 { gvir_config_domain_interface_set_link_state; gvir_config_domain_interface_set_mac; gvir_config_domain_interface_set_model; + gvir_config_domain_interface_get_ifname; + gvir_config_domain_interface_get_link_state; + gvir_config_domain_interface_get_mac; + gvir_config_domain_interface_get_model; gvir_config_domain_interface_bridge_get_type; gvir_config_domain_interface_bridge_new; -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list