Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
src/util.c | 13 +++++++++++++
src/util.h | 5 +++++
2 files changed, 18 insertions(+)
diff --git a/src/util.c b/src/util.c
index fe40a96..03a0f10 100644
--- a/src/util.c
+++ b/src/util.c
@@ -152,6 +152,19 @@ virtDBusUtilEnumFromString(const gchar *const *types,
return -1;
}
+virNetworkPtr
+virtDBusUtilVirNetworkFromBusPath(virConnectPtr connection,
+ const gchar *path,
+ const gchar *networkPath)
+{
+ g_autofree gchar *name = NULL;
+ gsize prefixLen = strlen(networkPath) + 1;
+
+ name = virtDBusUtilDecodeUUID(path+prefixLen);
+
+ return virNetworkLookupByUUIDString(connection, name);
+}
+
gchar *
virtDBusUtilBusPathForVirNetwork(virNetworkPtr network,
const gchar *networkPath)
diff --git a/src/util.h b/src/util.h
index fac080c..7bb4ad6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -66,6 +66,11 @@ virtDBusUtilEnumToString(const gchar *const *types,
const gchar *name ##TypeToString(gint type) G_GNUC_PURE; \
gint name ##TypeFromString(const gchar *type) G_GNUC_PURE;
+virNetworkPtr
+virtDBusUtilVirNetworkFromBusPath(virConnectPtr connection,
+ const gchar *path,
+ const gchar *networkPath);
+
gchar *
virtDBusUtilBusPathForVirNetwork(virNetworkPtr network,
const gchar *networkPath);
--
2.15.0