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

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



From: Laine Stump <laine redhat com>

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

diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h
index 30f559d..91af6fd 100644
--- a/include/libvirt/libvirt.h
+++ b/include/libvirt/libvirt.h
@@ -854,6 +854,90 @@ 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);
+
+/*
+ * 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);
+/*
+ * 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 object memory management - you must call
+ * virInterfaceFree() once for each call to virInterfaceRef, or any
+ * API function that returns a virInterfacePtr.
+ */
+int                     virInterfaceRef           (virInterfacePtr interface);
+int                     virInterfaceFree          (virInterfacePtr interface);
 
 /**
  * virStoragePool:
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 2f7076f..cee3d94 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -854,6 +854,90 @@ 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);
+
+/*
+ * 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);
+/*
+ * 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 object memory management - you must call
+ * virInterfaceFree() once for each call to virInterfaceRef, or any
+ * API function that returns a virInterfacePtr.
+ */
+int                     virInterfaceRef           (virInterfacePtr interface);
+int                     virInterfaceFree          (virInterfacePtr interface);
 
 /**
  * virStoragePool:
-- 
1.6.0.6


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