[libvirt] [PATCH 1/3] Public API for new virInterface* functions, which facilitate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Laine Stump <laine@xxxxxxxxxx>

---
 include/libvirt/libvirt.h    |   77 ++++++++++++++++++++++++++++++++++++++++++
 include/libvirt/libvirt.h.in |   77 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 154 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h
index 779ea72..f2e695a 100644
--- a/include/libvirt/libvirt.h
+++ b/include/libvirt/libvirt.h
@@ -854,6 +854,83 @@ int                     virNetworkGetAutostart  (virNetworkPtr network,
 int                     virNetworkSetAutostart  (virNetworkPtr network,
                                                  int autostart);
 
+/*
+ * Physical host interface configuration API
+ */
+
+/**
+ * virInterface:
+ *
+ * a virInterface is a private structure representing a virtual interface.
+ */
+typedef struct _virInterface virInterface;
+
+/**
+ * virInterfacePtr:
+ *
+ * a virInterfacePtr is pointer to a virInterface private structure, this is the
+ * type used to reference a virtual interface in the API.
+ */
+typedef virInterface *virInterfacePtr;
+
+/*
+ * Get connection from interface.
+ */
+virConnectPtr           virInterfaceGetConnect    (virInterfacePtr interface);
+
+/*
+ * List defined interfaces
+ */
+int                     virConnectNumOfInterfaces (virConnectPtr conn);
+int                     virConnectListInterfaces  (virConnectPtr conn,
+                                                   char **const names,
+                                                   int maxnames);
+
+/*
+ * Lookup interface by name or MAC address
+ */
+virInterfacePtr         virInterfaceLookupByName  (virConnectPtr conn,
+                                                   const char *name);
+virInterfacePtr         virInterfaceLookupByMAC   (virConnectPtr conn,
+                                                   const unsigned char *mac);
+virInterfacePtr         virInterfaceLookupByMACString (virConnectPtr conn,
+                                                       const char *mac);
+
+/*
+ * Define interface (or modify existing interface configuration)
+ */
+virInterfacePtr         virInterfaceDefineXML     (virConnectPtr conn,
+                                                   const char *xmlDesc,
+                                                   int flags);
+
+/*
+ * Delete interface
+ */
+int                     virInterfaceUndefine      (virInterfacePtr interface);
+
+/*
+ * Activate interface (ie call "ifup")
+ */
+int                     virInterfaceCreate        (virInterfacePtr interface,
+                                                   int flags);
+
+/*
+ * De-activate interface (call "ifdown")
+ */
+int                     virInterfaceDestroy       (virInterfacePtr interface,
+                                                   int flags);
+
+/*
+ * Interface information
+ */
+const char*             virInterfaceGetName       (virInterfacePtr interface);
+int                     virInterfaceGetMAC        (virInterfacePtr interface,
+                                                   unsigned char *mac);
+int                     virInterfaceGetMACString  (virInterfacePtr interface,
+                                                   char *mac);
+
+char *                  virInterfaceGetXMLDesc    (virInterfacePtr interface,
+                                                   int flags);
 
 /**
  * virStoragePool:
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index a028b21..f2656a3 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -854,6 +854,83 @@ int                     virNetworkGetAutostart  (virNetworkPtr network,
 int                     virNetworkSetAutostart  (virNetworkPtr network,
                                                  int autostart);
 
+/*
+ * Physical host interface configuration API
+ */
+
+/**
+ * virInterface:
+ *
+ * a virInterface is a private structure representing a virtual interface.
+ */
+typedef struct _virInterface virInterface;
+
+/**
+ * virInterfacePtr:
+ *
+ * a virInterfacePtr is pointer to a virInterface private structure, this is the
+ * type used to reference a virtual interface in the API.
+ */
+typedef virInterface *virInterfacePtr;
+
+/*
+ * Get connection from interface.
+ */
+virConnectPtr           virInterfaceGetConnect    (virInterfacePtr interface);
+
+/*
+ * List defined interfaces
+ */
+int                     virConnectNumOfInterfaces (virConnectPtr conn);
+int                     virConnectListInterfaces  (virConnectPtr conn,
+                                                   char **const names,
+                                                   int maxnames);
+
+/*
+ * Lookup interface by name or MAC address
+ */
+virInterfacePtr         virInterfaceLookupByName  (virConnectPtr conn,
+                                                   const char *name);
+virInterfacePtr         virInterfaceLookupByMAC   (virConnectPtr conn,
+                                                   const unsigned char *mac);
+virInterfacePtr         virInterfaceLookupByMACString (virConnectPtr conn,
+                                                       const char *mac);
+
+/*
+ * Define interface (or modify existing interface configuration)
+ */
+virInterfacePtr         virInterfaceDefineXML     (virConnectPtr conn,
+                                                   const char *xmlDesc,
+                                                   int flags);
+
+/*
+ * Delete interface
+ */
+int                     virInterfaceUndefine      (virInterfacePtr interface);
+
+/*
+ * Activate interface (ie call "ifup")
+ */
+int                     virInterfaceCreate        (virInterfacePtr interface,
+                                                   int flags);
+
+/*
+ * De-activate interface (call "ifdown")
+ */
+int                     virInterfaceDestroy       (virInterfacePtr interface,
+                                                   int flags);
+
+/*
+ * Interface information
+ */
+const char*             virInterfaceGetName       (virInterfacePtr interface);
+int                     virInterfaceGetMAC        (virInterfacePtr interface,
+                                                   unsigned char *mac);
+int                     virInterfaceGetMACString  (virInterfacePtr interface,
+                                                   char *mac);
+
+char *                  virInterfaceGetXMLDesc    (virInterfacePtr interface,
+                                                   int flags);
 
 /**
  * virStoragePool:
-- 
1.6.0.6

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]