Commit f0850064 authored by ewan's avatar ewan

Import libxen-src-0.4.3-2.tar.bz2.

Signed-off-by: default avatarEwan Mellor <ewan@xensource.com>
parent b60ab075
This diff is collapsed.
#
# Copyright (c) 2006, XenSource Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
CFLAGS = -Iinclude \
$(shell xml2-config --cflags) \
$(shell curl-config --cflags) \
-W -Wall -Werror -std=c99 -O2 -fPIC
LDFLAGS = $(shell xml2-config --libs) \
$(shell curl-config --libs)
test/test_bindings: test/test_bindings.o src/libxen.so
$(CC) $(LDFLAGS) -o $@ $< -L src -lxen
src/libxen.so: $(patsubst %.c, %.o, $(wildcard src/*.c))
$(CC) -shared -o $@ $^
.PHONY: clean
clean:
rm -f `find -name *.o`
rm -f src/libxen.so
rm -f test/test_bindings
Xen API C Bindings
==================
This distribution is the source code to the proposed Xen API C bindings.
The Xen API project will define an XML-RPC protocol for remote and local
management of Xen-based systems, and a set of bindings for these XML-RPC calls
into a number of languages (this package contains those to the C language).
The intention is to standardise these XML-RPC calls, and then the Xen project
will guarantee that that wire protocol will be supported for the long term.
The bindings will also be supported in the Xen tree, giving a stable
foundation for Xen management tools and middlewares, in particular the Xen CIM
providers and libvirt.
THIS IS A WORK IN PROGRESS. The API and bindings are under active design and
development, and this is a snapshot release for developers only. Both the API
and the C bindings are scheduled to be stabilised by the Xen 3.0.4 release
i.e. October 2006 at the earliest.
These bindings are open-source (LGPL), and will be committed as libraries to
the Xen trees for all to use after the Xen 3.0.3 release.
We welcome any discussion about this library and the API in general. Please
join the Xen-API mailing list if you are interested in this project. I (Ewan
Mellor) will collate all the feedback from that list and push out new versions
of the document and the bindings as and when.
URLs
----
Xen-API wiki page:
http://wiki.xensource.com/xenwiki/XenApi
Xen-API mailing list:
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
Usage
-----
The bindings depend upon libxml2, the XML toolkit from the GNOME project; the
test program depends upon libcurl3 also. On Debian, you need the packages
libxml2-dev and libcurl3-dev.
To compile, type make.
To run the test, do
LD_LIBRARY_PATH=src ./test/test_bindings <url> <username> <password>
where <url> is the fragment of the server URL that follows the http://, for
example "localhost:8005/RPC2".
/*
* Copyright (c) 2006, XenSource Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef XEN_BOOT_TYPE_H
#define XEN_BOOT_TYPE_H
#include "xen_common.h"
enum xen_boot_type
{
/**
* boot an HVM guest using an emulated BIOS
*/
XEN_BOOT_TYPE_BIOS,
/**
* boot from inside the machine using grub
*/
XEN_BOOT_TYPE_GRUB,
/**
* boot from an external kernel
*/
XEN_BOOT_TYPE_KERNEL_EXTERNAL,
/**
* boot from a kernel inside the guest filesystem
*/
XEN_BOOT_TYPE_KERNEL_INTERNAL
};
typedef struct xen_boot_type_set
{
size_t size;
enum xen_boot_type contents[];
} xen_boot_type_set;
/**
* Allocate a xen_boot_type_set of the given size.
*/
extern xen_boot_type_set *
xen_boot_type_set_alloc(size_t size);
/**
* Free the given xen_boot_type_set. The given set must have been
* allocated by this library.
*/
extern void
xen_boot_type_set_free(xen_boot_type_set *set);
/**
* Return the name corresponding to the given code. This string must
* not be modified or freed.
*/
extern const char *
xen_boot_type_to_string(enum xen_boot_type val);
/**
* Return the correct code for the given string, or set the session
* object to failure and return an undefined value if the given string does
* not match a known code.
*/
extern enum xen_boot_type
xen_boot_type_from_string(xen_session *session, const char *str);
#endif
/*
* Copyright (c) 2006, XenSource Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Declarations of the abstract types used during demarshalling of enum
* xen_boot_type. Internal to this library -- do not use from outside.
*/
#ifndef XEN_BOOT_TYPE_INTERNAL_H
#define XEN_BOOT_TYPE_INTERNAL_H
#include "xen_internal.h"
extern const abstract_type xen_boot_type_abstract_type_;
extern const abstract_type xen_boot_type_set_abstract_type_;
#endif
/*
Copyright (c) 2006 XenSource, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef XEN_COMMON_H
#define XEN_COMMON_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include "xen_host_decl.h"
typedef bool (*xen_result_func)(const void *data, size_t len,
void *result_handle);
/**
* len does not include a terminating \0.
*/
typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
void *result_handle,
xen_result_func result_func);
typedef struct
{
xen_call_func call_func;
void *handle;
const char *session_id;
bool ok;
char **error_description;
int error_description_count;
} xen_session;
struct xen_task_;
typedef struct xen_task_ * xen_task_id;
typedef struct
{
int progress;
long eta;
/* !!! RESULT */
} xen_task_status;
typedef struct
{
int major;
int minor;
int patch;
char *extraversion;
} xen_version;
/**
* Free the given xen_version, and all referenced values.
*/
extern void xen_version_free(xen_version *version);
/**
* Return the version of this client-side library. This will be the major,
* minor, and extraversion of the Xen release with which it was released,
* plus the library's own version as the patch.
*/
extern xen_version *xen_get_client_side_version();
extern bool
xen_uuid_string_to_bytes(char *uuid, char **bytes);
extern bool
xen_uuid_bytes_to_string(char *bytes, char **uuid);
extern void
xen_uuid_free(char *uuid);
extern void
xen_uuid_bytes_free(char *bytes);
/**
* Initialise this library. Call this before starting to use this library.
* Note that since this library depends upon libxml2, you should also call
* xmlInitParser as appropriate for your program.
*/
extern
void xen_init(void);
/**
* Clear up this library. Call when you have finished using this library.
* Note that since this library depends upon libxml2, you should also call
* xmlCleanupParser as appropriate for your program.
*/
extern
void xen_fini(void);
/**
* Log in at the server, and allocate a xen_session to represent this session.
*/
extern xen_session *
xen_session_login_with_password(xen_call_func call_func, void *handle,
const char *uname, const char *pwd);
/**
* Log out at the server, and free the xen_session.
*/
extern void
xen_session_logout(xen_session *session);
/**
* Set *result to be a handle to the host to which this session is connected.
*/
extern int
xen_session_get_this_host(xen_session *session, xen_host *result);
#endif
/*
* Copyright (c) 2006, XenSource Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef XEN_CPU_FEATURE_H
#define XEN_CPU_FEATURE_H
#include "xen_common.h"
enum xen_cpu_feature
{
/**
* Onboard FPU
*/
XEN_CPU_FEATURE_FPU,
/**
* Virtual Mode Extensions
*/
XEN_CPU_FEATURE_VME,
/**
* Debugging Extensions
*/
XEN_CPU_FEATURE_DE,
/**
* Page Size Extensions
*/
XEN_CPU_FEATURE_PSE,
/**
* Time Stamp Counter
*/
XEN_CPU_FEATURE_TSC,
/**
* Model-Specific Registers, RDMSR, WRMSR
*/
XEN_CPU_FEATURE_MSR,
/**
* Physical Address Extensions
*/
XEN_CPU_FEATURE_PAE,
/**
* Machine Check Architecture
*/
XEN_CPU_FEATURE_MCE,
/**
* CMPXCHG8 instruction
*/
XEN_CPU_FEATURE_CX8,
/**
* Onboard APIC
*/
XEN_CPU_FEATURE_APIC,
/**
* SYSENTER/SYSEXIT
*/
XEN_CPU_FEATURE_SEP,
/**
* Memory Type Range Registers
*/
XEN_CPU_FEATURE_MTRR,
/**
* Page Global Enable
*/
XEN_CPU_FEATURE_PGE,
/**
* Machine Check Architecture
*/
XEN_CPU_FEATURE_MCA,
/**
* CMOV instruction (FCMOVCC and FCOMI too if FPU present)
*/
XEN_CPU_FEATURE_CMOV,
/**
* Page Attribute Table
*/
XEN_CPU_FEATURE_PAT,
/**
* 36-bit PSEs
*/
XEN_CPU_FEATURE_PSE36,
/**
* Processor serial number
*/
XEN_CPU_FEATURE_PN,
/**
* Supports the CLFLUSH instruction
*/
XEN_CPU_FEATURE_CLFLSH,
/**
* Debug Trace Store
*/
XEN_CPU_FEATURE_DTES,
/**
* ACPI via MSR
*/
XEN_CPU_FEATURE_ACPI,
/**
* Multimedia Extensions
*/
XEN_CPU_FEATURE_MMX,
/**
* FXSAVE and FXRSTOR instructions (fast save and restore
*/
XEN_CPU_FEATURE_FXSR,
/**
* Streaming SIMD Extensions
*/
XEN_CPU_FEATURE_XMM,
/**
* Streaming SIMD Extensions-2
*/
XEN_CPU_FEATURE_XMM2,
/**
* CPU self snoop
*/
XEN_CPU_FEATURE_SELFSNOOP,
/**
* Hyper-Threading
*/
XEN_CPU_FEATURE_HT,
/**
* Automatic clock control
*/
XEN_CPU_FEATURE_ACC,
/**
* IA-64 processor
*/
XEN_CPU_FEATURE_IA64,
/**
* SYSCALL/SYSRET
*/
XEN_CPU_FEATURE_SYSCALL,
/**
* MP Capable.
*/
XEN_CPU_FEATURE_MP,
/**
* Execute Disable
*/
XEN_CPU_FEATURE_NX,
/**
* AMD MMX extensions
*/
XEN_CPU_FEATURE_MMXEXT,
/**
* Long Mode (x86-64)
*/
XEN_CPU_FEATURE_LM,
/**
* AMD 3DNow! extensions
*/
XEN_CPU_FEATURE_3DNOWEXT,
/**
* 3DNow!
*/
XEN_CPU_FEATURE_3DNOW,
/**
* CPU in recovery mode
*/
XEN_CPU_FEATURE_RECOVERY,
/**
* Longrun power control
*/
XEN_CPU_FEATURE_LONGRUN,
/**
* LongRun table interface
*/
XEN_CPU_FEATURE_LRTI,
/**
* Cyrix MMX extensions
*/
XEN_CPU_FEATURE_CXMMX,
/**
* AMD K6 nonstandard MTRRs
*/
XEN_CPU_FEATURE_K6_MTRR,
/**
* Cyrix ARRs (= MTRRs)
*/
XEN_CPU_FEATURE_CYRIX_ARR,
/**
* Centaur MCRs (= MTRRs)
*/
XEN_CPU_FEATURE_CENTAUR_MCR,
/**
* Opteron, Athlon64
*/
XEN_CPU_FEATURE_K8,
/**
* Athlon
*/
XEN_CPU_FEATURE_K7,
/**
* P3
*/
XEN_CPU_FEATURE_P3,
/**
* P4
*/
XEN_CPU_FEATURE_P4,
/**
* TSC ticks at a constant rate
*/
XEN_CPU_FEATURE_CONSTANT_TSC,
/**
* FXSAVE leaks FOP/FIP/FOP
*/
XEN_CPU_FEATURE_FXSAVE_LEAK,
/**
* Streaming SIMD Extensions-3