summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2005-12-08 15:08:46 +0000
committerDaniel Veillard <veillard@redhat.com>2005-12-08 15:08:46 +0000
commitded06db1e6f86c712ae4f002d86bdc0d5ed27099 (patch)
tree1d386c0c13134698126f434404ab0e3558757db4 /include
parent304e52d02df82cb87275d6f478c61df0b3526843 (diff)
downloadlibvirt-ded06db1e6f86c712ae4f002d86bdc0d5ed27099.tar.gz
* configure.in include/libvir.h.in include/libvir.h src/Makefile.am
include/Makefile.am: provide/fix library versionning information include/libvir.h is now generated ! * include/libvir.h.in src/libvir.c: revamp APIs and implement complete ones. * src/virsh.c: finish the version command and a bit of cleanup. Daniel
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am1
-rw-r--r--include/libvir.h18
-rw-r--r--include/libvir.h.in190
-rw-r--r--include/libvirt/Makefile.am1
4 files changed, 209 insertions, 1 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index ccbed6c0da..140485eda5 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -7,3 +7,4 @@ virinc_HEADERS = libvir.h
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(virincdir)
+EXTRA_DIST = libvir.h.in
diff --git a/include/libvir.h b/include/libvir.h
index 581d57ed1f..f7cba9d501 100644
--- a/include/libvir.h
+++ b/include/libvir.h
@@ -109,6 +109,21 @@ typedef enum {
VIR_DOMAIN_NONE = 0
} virDomainFlags;
+/* library versionning */
+
+/**
+ * LIBVIR_VERSION_NUMBER:
+ *
+ * Macro providing the version of the library as
+ * version * 1,000,000 + minor * 1000 + micro
+ */
+
+#define LIBVIR_VERSION_NUMBER 1
+
+int virGetVersion (unsigned long *libVer,
+ const char *type,
+ unsigned long *typeVer);
+
/*
* Connection and disconnections to the Hypervisor
*/
@@ -116,7 +131,8 @@ virConnectPtr virConnectOpen (const char *name);
virConnectPtr virConnectOpenReadOnly (const char *name);
int virConnectClose (virConnectPtr conn);
const char * virConnectGetType (virConnectPtr conn);
-unsigned long virConnectGetVersion (virConnectPtr conn);
+int virConnectGetVersion (virConnectPtr conn,
+ unsigned long *hvVer);
/*
* Gather list of running domains
diff --git a/include/libvir.h.in b/include/libvir.h.in
new file mode 100644
index 0000000000..4d900b4db3
--- /dev/null
+++ b/include/libvir.h.in
@@ -0,0 +1,190 @@
+/*
+ * libvir.h:
+ * Summary: core interfaces for the libvir library
+ * Description: Provides the interfaces of the libvir library to handle
+ * Xen domains from a process running in domain 0
+ *
+ * Copy: Copyright (C) 2005 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ *
+ * Author: Daniel Veillard <veillard@redhat.com>
+ */
+
+#ifndef __VIR_VIRLIB_H__
+#define __VIR_VIRLIB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * virConnect:
+ *
+ * a virConnect is a private structure representing a connection to
+ * the Xen Hypervisor.
+ */
+typedef struct _virConnect virConnect;
+
+/**
+ * virConnectPtr:
+ *
+ * a virConnectPtr is pointer to a virConnect private structure, this is the
+ * type used to reference a connection to the Xen Hypervisor in the API.
+ */
+typedef virConnect *virConnectPtr;
+
+/**
+ * virDomain:
+ *
+ * a virDomain is a private structure representing a Xen domain.
+ */
+typedef struct _virDomain virDomain;
+
+/**
+ * virDomainPtr:
+ *
+ * a virDomainPtr is pointer to a virDomain private structure, this is the
+ * type used to reference a Xen domain in the API.
+ */
+typedef virDomain *virDomainPtr;
+
+/**
+ * virDomainState:
+ *
+ * A domain may be in different states at a given point in time
+ */
+typedef enum {
+ VIR_DOMAIN_NOSTATE = 0, /* no state */
+ VIR_DOMAIN_RUNNING = 1, /* the domain is running */
+ VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
+ VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */
+ VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
+ VIR_DOMAIN_SHUTOFF = 5 /* the domain is shut off */
+} virDomainState;
+
+/**
+ * virDomainInfoPtr:
+ *
+ * a virDomainInfo is a structure filled by virDomainGetInfo()
+ */
+
+typedef struct _virDomainInfo virDomainInfo;
+
+struct _virDomainInfo {
+ unsigned char state; /* the running state, one of virDomainFlags */
+ unsigned long maxMem; /* the maximum memory in KBytes allowed */
+ unsigned long memory; /* the memory in KBytes used by the domain */
+ unsigned short nrVirtCpu; /* the number of virtual CPUs for the domain */
+
+ /*
+ * Informations below are only available to clients with a connection
+ * with full access to the hypervisor
+ */
+ unsigned long long cpuTime; /* the CPU time used in nanoseconds */
+
+ /*
+ * TODO:
+ * - check what can be extracted publicly from xenstore
+ * and what's private limited to the hypervisor call.
+ * - add padding to this structure for ABI long term protection
+ */
+};
+
+/**
+ * virDomainInfoPtr:
+ *
+ * a virDomainInfoPtr is a pointer to a virDomainInfo structure.
+ */
+
+typedef virDomainInfo *virDomainInfoPtr;
+
+/**
+ * virDomainFlags:
+ *
+ * Flags OR'ed together to provide specific behaviour when creating a
+ * Domain.
+ */
+typedef enum {
+ VIR_DOMAIN_NONE = 0
+} virDomainFlags;
+
+/* library versionning */
+
+/**
+ * LIBVIR_VERSION_NUMBER:
+ *
+ * Macro providing the version of the library as
+ * version * 1,000,000 + minor * 1000 + micro
+ */
+
+#define LIBVIR_VERSION_NUMBER @LIBVIR_VERSION_NUMBER@
+
+int virGetVersion (unsigned long *libVer,
+ const char *type,
+ unsigned long *typeVer);
+
+/*
+ * Connection and disconnections to the Hypervisor
+ */
+virConnectPtr virConnectOpen (const char *name);
+virConnectPtr virConnectOpenReadOnly (const char *name);
+int virConnectClose (virConnectPtr conn);
+const char * virConnectGetType (virConnectPtr conn);
+int virConnectGetVersion (virConnectPtr conn,
+ unsigned long *hvVer);
+
+/*
+ * Gather list of running domains
+ */
+int virConnectListDomains (virConnectPtr conn,
+ int *ids,
+ int maxids);
+
+/*
+ * Number of domains
+ */
+int virConnectNumOfDomains (virConnectPtr conn);
+
+
+/*
+ * Domain creation and destruction
+ */
+virDomainPtr virDomainCreateLinux (virConnectPtr conn,
+ const char *kernel_path,
+ const char *initrd_path,
+ const char *cmdline,
+ unsigned long memory,
+ unsigned int flags);
+virDomainPtr virDomainLookupByName (virConnectPtr conn,
+ const char *name);
+virDomainPtr virDomainLookupByID (virConnectPtr conn,
+ int id);
+int virDomainDestroy (virDomainPtr domain);
+
+/*
+ * Domain suspend/resume
+ */
+int virDomainSuspend (virDomainPtr domain);
+int virDomainResume (virDomainPtr domain);
+
+/*
+ * Domain runtime informations
+ */
+int virDomainGetInfo (virDomainPtr domain,
+ virDomainInfoPtr info);
+
+/*
+ * Dynamic control of domains
+ */
+const char * virDomainGetName (virDomainPtr domain);
+unsigned int virDomainGetID (virDomainPtr domain);
+unsigned long virDomainGetMaxMemory (virDomainPtr domain);
+int virDomainSetMaxMemory (virDomainPtr domain,
+ unsigned long memory);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VIR_VIRLIB_H__ */
diff --git a/include/libvirt/Makefile.am b/include/libvirt/Makefile.am
index ccbed6c0da..140485eda5 100644
--- a/include/libvirt/Makefile.am
+++ b/include/libvirt/Makefile.am
@@ -7,3 +7,4 @@ virinc_HEADERS = libvir.h
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(virincdir)
+EXTRA_DIST = libvir.h.in