[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-3.0.5-testing] Move all internal header files to a separate directory, so that it's clear what
# HG changeset patch # User ewan@xxxxxxxxxxxxxxxxxxxxx # Date 1177183266 25200 # Node ID 295858ddac8778d180a8e4e82642948890ff1743 # Parent 80304d79a78c0441411012dde6c188e854812a56 Move all internal header files to a separate directory, so that it's clear what forms the public API. Tidy up a couple of macros in xen_internal.h. Remove test_hvm_bindings, which no longer builds, and which has had its functionality subsumed into test_bindings. Bump the library version to 0.9. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/libxen/include/xen_common.h | 211 --- tools/libxen/include/xen_console.h | 247 ---- tools/libxen/include/xen_console_decl.h | 30 tools/libxen/include/xen_console_protocol.h | 82 - tools/libxen/include/xen_crashdump.h | 199 --- tools/libxen/include/xen_crashdump_decl.h | 30 tools/libxen/include/xen_event.h | 102 - tools/libxen/include/xen_event_decl.h | 25 tools/libxen/include/xen_event_operation.h | 82 - tools/libxen/include/xen_host.h | 497 -------- tools/libxen/include/xen_host_cpu.h | 247 ---- tools/libxen/include/xen_host_cpu_decl.h | 30 tools/libxen/include/xen_host_decl.h | 30 tools/libxen/include/xen_host_metrics.h | 199 --- tools/libxen/include/xen_host_metrics_decl.h | 30 tools/libxen/include/xen_int_float_map.h | 53 tools/libxen/include/xen_int_int_map.h | 53 tools/libxen/include/xen_int_string_set_map.h | 53 tools/libxen/include/xen_network.h | 276 ---- tools/libxen/include/xen_network_decl.h | 30 tools/libxen/include/xen_on_crash_behaviour.h | 97 - tools/libxen/include/xen_on_normal_exit.h | 77 - tools/libxen/include/xen_pbd.h | 223 --- tools/libxen/include/xen_pbd_decl.h | 30 tools/libxen/include/xen_pif.h | 277 ---- tools/libxen/include/xen_pif_decl.h | 30 tools/libxen/include/xen_pif_metrics.h | 198 --- tools/libxen/include/xen_pif_metrics_decl.h | 30 tools/libxen/include/xen_sr.h | 277 ---- tools/libxen/include/xen_sr_decl.h | 30 tools/libxen/include/xen_string_set.h | 47 tools/libxen/include/xen_string_string_map.h | 53 tools/libxen/include/xen_user.h | 204 --- tools/libxen/include/xen_user_decl.h | 30 tools/libxen/include/xen_vbd.h | 390 ------ tools/libxen/include/xen_vbd_decl.h | 30 tools/libxen/include/xen_vbd_metrics.h | 198 --- tools/libxen/include/xen_vbd_metrics_decl.h | 30 tools/libxen/include/xen_vbd_mode.h | 77 - tools/libxen/include/xen_vbd_type.h | 77 - tools/libxen/include/xen_vdi.h | 347 ----- tools/libxen/include/xen_vdi_decl.h | 30 tools/libxen/include/xen_vdi_type.h | 92 - tools/libxen/include/xen_vif.h | 365 ------ tools/libxen/include/xen_vif_decl.h | 30 tools/libxen/include/xen_vif_metrics.h | 198 --- tools/libxen/include/xen_vif_metrics_decl.h | 30 tools/libxen/include/xen_vm.h | 894 --------------- tools/libxen/include/xen_vm_decl.h | 30 tools/libxen/include/xen_vm_guest_metrics.h | 234 --- tools/libxen/include/xen_vm_guest_metrics_decl.h | 30 tools/libxen/include/xen_vm_metrics.h | 251 ---- tools/libxen/include/xen_vm_metrics_decl.h | 30 tools/libxen/include/xen_vm_power_state.h | 92 - tools/libxen/include/xen_vtpm.h | 198 --- tools/libxen/include/xen_vtpm_decl.h | 31 tools/libxen/test/test_hvm_bindings.c | 445 ------- tools/libxen/Makefile | 33 tools/libxen/include/xen/api/xen_all.h | 39 tools/libxen/include/xen/api/xen_common.h | 211 +++ tools/libxen/include/xen/api/xen_console.h | 247 ++++ tools/libxen/include/xen/api/xen_console_decl.h | 30 tools/libxen/include/xen/api/xen_console_protocol.h | 82 + tools/libxen/include/xen/api/xen_crashdump.h | 199 +++ tools/libxen/include/xen/api/xen_crashdump_decl.h | 30 tools/libxen/include/xen/api/xen_event.h | 102 + tools/libxen/include/xen/api/xen_event_decl.h | 25 tools/libxen/include/xen/api/xen_event_operation.h | 82 + tools/libxen/include/xen/api/xen_host.h | 497 ++++++++ tools/libxen/include/xen/api/xen_host_cpu.h | 247 ++++ tools/libxen/include/xen/api/xen_host_cpu_decl.h | 30 tools/libxen/include/xen/api/xen_host_decl.h | 30 tools/libxen/include/xen/api/xen_host_metrics.h | 199 +++ tools/libxen/include/xen/api/xen_host_metrics_decl.h | 30 tools/libxen/include/xen/api/xen_int_float_map.h | 53 tools/libxen/include/xen/api/xen_int_int_map.h | 53 tools/libxen/include/xen/api/xen_int_string_set_map.h | 53 tools/libxen/include/xen/api/xen_network.h | 276 ++++ tools/libxen/include/xen/api/xen_network_decl.h | 30 tools/libxen/include/xen/api/xen_on_crash_behaviour.h | 97 + tools/libxen/include/xen/api/xen_on_normal_exit.h | 77 + tools/libxen/include/xen/api/xen_pbd.h | 223 +++ tools/libxen/include/xen/api/xen_pbd_decl.h | 30 tools/libxen/include/xen/api/xen_pif.h | 277 ++++ tools/libxen/include/xen/api/xen_pif_decl.h | 30 tools/libxen/include/xen/api/xen_pif_metrics.h | 198 +++ tools/libxen/include/xen/api/xen_pif_metrics_decl.h | 30 tools/libxen/include/xen/api/xen_sr.h | 277 ++++ tools/libxen/include/xen/api/xen_sr_decl.h | 30 tools/libxen/include/xen/api/xen_string_set.h | 47 tools/libxen/include/xen/api/xen_string_string_map.h | 53 tools/libxen/include/xen/api/xen_user.h | 204 +++ tools/libxen/include/xen/api/xen_user_decl.h | 30 tools/libxen/include/xen/api/xen_vbd.h | 390 ++++++ tools/libxen/include/xen/api/xen_vbd_decl.h | 30 tools/libxen/include/xen/api/xen_vbd_metrics.h | 198 +++ tools/libxen/include/xen/api/xen_vbd_metrics_decl.h | 30 tools/libxen/include/xen/api/xen_vbd_mode.h | 77 + tools/libxen/include/xen/api/xen_vbd_type.h | 77 + tools/libxen/include/xen/api/xen_vdi.h | 347 +++++ tools/libxen/include/xen/api/xen_vdi_decl.h | 30 tools/libxen/include/xen/api/xen_vdi_type.h | 92 + tools/libxen/include/xen/api/xen_vif.h | 365 ++++++ tools/libxen/include/xen/api/xen_vif_decl.h | 30 tools/libxen/include/xen/api/xen_vif_metrics.h | 198 +++ tools/libxen/include/xen/api/xen_vif_metrics_decl.h | 30 tools/libxen/include/xen/api/xen_vm.h | 894 +++++++++++++++ tools/libxen/include/xen/api/xen_vm_decl.h | 30 tools/libxen/include/xen/api/xen_vm_guest_metrics.h | 234 +++ tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h | 30 tools/libxen/include/xen/api/xen_vm_metrics.h | 251 ++++ tools/libxen/include/xen/api/xen_vm_metrics_decl.h | 30 tools/libxen/include/xen/api/xen_vm_power_state.h | 92 + tools/libxen/include/xen/api/xen_vtpm.h | 199 +++ tools/libxen/include/xen/api/xen_vtpm_decl.h | 31 tools/libxen/include/xen_console_protocol_internal.h | 2 tools/libxen/include/xen_internal.h | 57 tools/libxen/include/xen_on_crash_behaviour_internal.h | 2 tools/libxen/include/xen_on_normal_exit_internal.h | 2 tools/libxen/include/xen_vbd_mode_internal.h | 2 tools/libxen/include/xen_vdi_type_internal.h | 2 tools/libxen/include/xen_vm_power_state_internal.h | 2 tools/libxen/src/xen_common.c | 12 tools/libxen/src/xen_console.c | 8 tools/libxen/src/xen_console_protocol.c | 4 tools/libxen/src/xen_crashdump.c | 8 tools/libxen/src/xen_event.c | 4 tools/libxen/src/xen_event_operation.c | 2 tools/libxen/src/xen_host.c | 18 tools/libxen/src/xen_host_cpu.c | 6 tools/libxen/src/xen_host_metrics.c | 4 tools/libxen/src/xen_int_float_map.c | 6 tools/libxen/src/xen_int_int_map.c | 4 tools/libxen/src/xen_int_string_set_map.c | 6 tools/libxen/src/xen_network.c | 10 tools/libxen/src/xen_on_crash_behaviour.c | 4 tools/libxen/src/xen_on_normal_exit.c | 4 tools/libxen/src/xen_pbd.c | 10 tools/libxen/src/xen_pif.c | 10 tools/libxen/src/xen_pif_metrics.c | 4 tools/libxen/src/xen_sr.c | 8 tools/libxen/src/xen_string_set.c | 2 tools/libxen/src/xen_string_string_map.c | 6 tools/libxen/src/xen_user.c | 4 tools/libxen/src/xen_vbd.c | 12 tools/libxen/src/xen_vbd_metrics.c | 4 tools/libxen/src/xen_vbd_mode.c | 4 tools/libxen/src/xen_vbd_type.c | 2 tools/libxen/src/xen_vdi.c | 12 tools/libxen/src/xen_vdi_type.c | 4 tools/libxen/src/xen_vif.c | 12 tools/libxen/src/xen_vif_metrics.c | 4 tools/libxen/src/xen_vm.c | 24 tools/libxen/src/xen_vm_guest_metrics.c | 6 tools/libxen/src/xen_vm_metrics.c | 12 tools/libxen/src/xen_vm_power_state.c | 4 tools/libxen/src/xen_vtpm.c | 8 tools/libxen/test/test_bindings.c | 9 tools/libxen/test/test_event_handling.c | 3 159 files changed, 8011 insertions(+), 8426 deletions(-) diff -r 80304d79a78c -r 295858ddac87 tools/libxen/Makefile --- a/tools/libxen/Makefile Mon Apr 16 19:19:07 2007 -0400 +++ b/tools/libxen/Makefile Sat Apr 21 12:21:06 2007 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, XenSource Inc. +# Copyright (c) 2006-2007, XenSource Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,20 +18,21 @@ XEN_ROOT=../.. XEN_ROOT=../.. include $(XEN_ROOT)/tools/Rules.mk -MAJOR = 0.1 -MINOR = 0 +MAJOR = 0.9 +MINOR = 1 CFLAGS = -Iinclude \ - $(shell xml2-config --cflags) \ + $(shell xml2-config --cflags) \ $(shell curl-config --cflags) \ -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC LDFLAGS = $(shell xml2-config --libs) \ $(shell curl-config --libs) -LIBXENAPI_HDRS = $(wildcard include/*.h) +LIBXENAPI_HDRS = $(wildcard include/xen/api/*.h) include/xen/api/xen_all.h LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c)) +TEST_PROGRAMS = test/test_bindings test/test_event_handling .PHONY: all all: libxenapi.so libxenapi.a @@ -48,13 +49,7 @@ libxenapi.a: $(LIBXENAPI_OBJS) libxenapi.a: $(LIBXENAPI_OBJS) $(AR) rcs libxenapi.a $^ -test/test_bindings: test/test_bindings.o libxenapi.so - $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi - -test/test_event_handling: test/test_event_handling.o libxenapi.so - $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi - -test/test_hvm_bindings: test/test_hvm_bindings.o libxenapi.so +$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi @@ -70,9 +65,21 @@ install: all $(INSTALL_DATA) $$i $(DESTDIR)/usr/include/xen/api; \ done + .PHONY: clean clean: rm -f `find -name *.o` rm -f libxenapi.so* rm -f libxenapi.a - rm -f test/test_bindings + rm -f $(TEST_PROGRAMS) + + +.PHONY: uberheader +uberheader: include/xen/api/xen_all.h +include/xen/api/xen_all.h:: + echo "/* This file is autogenerated */" >$@ + echo "#ifndef XEN_API_XEN_ALL_H" >>$@ + echo "#define XEN_API_XEN_ALL_H" >>$@ + ls include/xen/api/*.h | grep -v xen_all.h | grep -v _decl.h | \ + sed 's,^include/\(.*\)$$,#include <\1>,g' >>$@ + echo "#endif" >>$@ diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_all.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_all.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,39 @@ +/* This file is autogenerated */ +#ifndef XEN_API_XEN_ALL_H +#define XEN_API_XEN_ALL_H +#include <xen/api/xen_common.h> +#include <xen/api/xen_console.h> +#include <xen/api/xen_console_protocol.h> +#include <xen/api/xen_crashdump.h> +#include <xen/api/xen_event.h> +#include <xen/api/xen_event_operation.h> +#include <xen/api/xen_host_cpu.h> +#include <xen/api/xen_host.h> +#include <xen/api/xen_host_metrics.h> +#include <xen/api/xen_int_float_map.h> +#include <xen/api/xen_int_int_map.h> +#include <xen/api/xen_int_string_set_map.h> +#include <xen/api/xen_network.h> +#include <xen/api/xen_on_crash_behaviour.h> +#include <xen/api/xen_on_normal_exit.h> +#include <xen/api/xen_pbd.h> +#include <xen/api/xen_pif.h> +#include <xen/api/xen_pif_metrics.h> +#include <xen/api/xen_sr.h> +#include <xen/api/xen_string_set.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_user.h> +#include <xen/api/xen_vbd.h> +#include <xen/api/xen_vbd_metrics.h> +#include <xen/api/xen_vbd_mode.h> +#include <xen/api/xen_vbd_type.h> +#include <xen/api/xen_vdi.h> +#include <xen/api/xen_vdi_type.h> +#include <xen/api/xen_vif.h> +#include <xen/api/xen_vif_metrics.h> +#include <xen/api/xen_vm_guest_metrics.h> +#include <xen/api/xen_vm.h> +#include <xen/api/xen_vm_metrics.h> +#include <xen/api/xen_vm_power_state.h> +#include <xen/api/xen_vtpm.h> +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_common.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,211 @@ +/* + * 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/api/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; + + +typedef struct xen_session_record +{ + char *uuid; + struct xen_host_record_opt *this_host; + char *this_user; + time_t last_active; +} xen_session_record; + + +/** + * Allocate a xen_session_record. + */ +extern xen_session_record * +xen_session_record_alloc(void); + + +/** + * Free the given xen_session_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_session_record_free(xen_session_record *record); + + +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); + + +/** + * Clear any error condition recorded on this session. + */ +void +xen_session_clear_error(xen_session *session); + + +/** + * Get the UUID of the second given session. Set *result to point at a + * string, yours to free. + */ +extern bool +xen_session_get_uuid(xen_session *session, char **result, + xen_session *self_session); + + +/** + * Get the this_host field of the second given session. Set *result to be a + * handle to that host. + */ +extern bool +xen_session_get_this_host(xen_session *session, xen_host *result, + xen_session *self_session); + + +/** + * Get the this_user field of the second given session. Set *result to point + * at a string, yours to free. + */ +extern bool +xen_session_get_this_user(xen_session *session, char **result, + xen_session *self_session); + + +/** + * Get the last_active field of the given session, and place it in *result. + */ +extern bool +xen_session_get_last_active(xen_session *session, time_t *result, + xen_session *self_session); + +/** + * Get a record containing the current state of the second given session. + */ +extern bool +xen_session_get_record(xen_session *session, xen_session_record **result, + xen_session *self_session); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_console.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_console.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2006-2007, 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_CONSOLE_H +#define XEN_CONSOLE_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_console_decl.h> +#include <xen/api/xen_console_protocol.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vm_decl.h> + + +/* + * The console class. + * + * A console. + */ + + +/** + * Free the given xen_console. The given handle must have been + * allocated by this library. + */ +extern void +xen_console_free(xen_console console); + + +typedef struct xen_console_set +{ + size_t size; + xen_console *contents[]; +} xen_console_set; + +/** + * Allocate a xen_console_set of the given size. + */ +extern xen_console_set * +xen_console_set_alloc(size_t size); + +/** + * Free the given xen_console_set. The given set must have been + * allocated by this library. + */ +extern void +xen_console_set_free(xen_console_set *set); + + +typedef struct xen_console_record +{ + xen_console handle; + char *uuid; + enum xen_console_protocol protocol; + char *location; + struct xen_vm_record_opt *vm; + xen_string_string_map *other_config; +} xen_console_record; + +/** + * Allocate a xen_console_record. + */ +extern xen_console_record * +xen_console_record_alloc(void); + +/** + * Free the given xen_console_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_console_record_free(xen_console_record *record); + + +typedef struct xen_console_record_opt +{ + bool is_record; + union + { + xen_console handle; + xen_console_record *record; + } u; +} xen_console_record_opt; + +/** + * Allocate a xen_console_record_opt. + */ +extern xen_console_record_opt * +xen_console_record_opt_alloc(void); + +/** + * Free the given xen_console_record_opt, and all referenced values. + * The given record_opt must have been allocated by this library. + */ +extern void +xen_console_record_opt_free(xen_console_record_opt *record_opt); + + +typedef struct xen_console_record_set +{ + size_t size; + xen_console_record *contents[]; +} xen_console_record_set; + +/** + * Allocate a xen_console_record_set of the given size. + */ +extern xen_console_record_set * +xen_console_record_set_alloc(size_t size); + +/** + * Free the given xen_console_record_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_console_record_set_free(xen_console_record_set *set); + + + +typedef struct xen_console_record_opt_set +{ + size_t size; + xen_console_record_opt *contents[]; +} xen_console_record_opt_set; + +/** + * Allocate a xen_console_record_opt_set of the given size. + */ +extern xen_console_record_opt_set * +xen_console_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_console_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_console_record_opt_set_free(xen_console_record_opt_set *set); + + +/** + * Get a record containing the current state of the given console. + */ +extern bool +xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console); + + +/** + * Get a reference to the console instance with the specified UUID. + */ +extern bool +xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid); + + +/** + * Create a new console instance, and return its handle. + */ +extern bool +xen_console_create(xen_session *session, xen_console *result, xen_console_record *record); + + +/** + * Destroy the specified console instance. + */ +extern bool +xen_console_destroy(xen_session *session, xen_console console); + + +/** + * Get the uuid field of the given console. + */ +extern bool +xen_console_get_uuid(xen_session *session, char **result, xen_console console); + + +/** + * Get the protocol field of the given console. + */ +extern bool +xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console); + + +/** + * Get the location field of the given console. + */ +extern bool +xen_console_get_location(xen_session *session, char **result, xen_console console); + + +/** + * Get the VM field of the given console. + */ +extern bool +xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console); + + +/** + * Get the other_config field of the given console. + */ +extern bool +xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console); + + +/** + * Set the other_config field of the given console. + */ +extern bool +xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config); + + +/** + * Add the given key-value pair to the other_config field of the given + * console. + */ +extern bool +xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * other_config field of the given console. If the key is not in that Map, + * then do nothing. + */ +extern bool +xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key); + + +/** + * Return a list of all the consoles known to the system. + */ +extern bool +xen_console_get_all(xen_session *session, struct xen_console_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_console_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_console_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_CONSOLE_DECL_H +#define XEN_CONSOLE_DECL_H + +typedef void *xen_console; + +struct xen_console_set; +struct xen_console_record; +struct xen_console_record_set; +struct xen_console_record_opt; +struct xen_console_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_console_protocol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_console_protocol.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2006-2007, 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_CONSOLE_PROTOCOL_H +#define XEN_CONSOLE_PROTOCOL_H + + +#include <xen/api/xen_common.h> + + +enum xen_console_protocol +{ + /** + * VT100 terminal + */ + XEN_CONSOLE_PROTOCOL_VT100, + + /** + * Remote FrameBuffer protocol (as used in VNC) + */ + XEN_CONSOLE_PROTOCOL_RFB, + + /** + * Remote Desktop Protocol + */ + XEN_CONSOLE_PROTOCOL_RDP +}; + + +typedef struct xen_console_protocol_set +{ + size_t size; + enum xen_console_protocol contents[]; +} xen_console_protocol_set; + +/** + * Allocate a xen_console_protocol_set of the given size. + */ +extern xen_console_protocol_set * +xen_console_protocol_set_alloc(size_t size); + +/** + * Free the given xen_console_protocol_set. The given set must have + * been allocated by this library. + */ +extern void +xen_console_protocol_set_free(xen_console_protocol_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_console_protocol_to_string(enum xen_console_protocol 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_console_protocol +xen_console_protocol_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_crashdump.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_crashdump.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2006-2007, 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_CRASHDUMP_H +#define XEN_CRASHDUMP_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_crashdump_decl.h> +#include <xen/api/xen_vdi_decl.h> +#include <xen/api/xen_vm_decl.h> + + +/* + * The crashdump class. + * + * A VM crashdump. + */ + + +/** + * Free the given xen_crashdump. The given handle must have been + * allocated by this library. + */ +extern void +xen_crashdump_free(xen_crashdump crashdump); + + +typedef struct xen_crashdump_set +{ + size_t size; + xen_crashdump *contents[]; +} xen_crashdump_set; + +/** + * Allocate a xen_crashdump_set of the given size. + */ +extern xen_crashdump_set * +xen_crashdump_set_alloc(size_t size); + +/** + * Free the given xen_crashdump_set. The given set must have been + * allocated by this library. + */ +extern void +xen_crashdump_set_free(xen_crashdump_set *set); + + +typedef struct xen_crashdump_record +{ + xen_crashdump handle; + char *uuid; + struct xen_vm_record_opt *vm; + struct xen_vdi_record_opt *vdi; +} xen_crashdump_record; + +/** + * Allocate a xen_crashdump_record. + */ +extern xen_crashdump_record * +xen_crashdump_record_alloc(void); + +/** + * Free the given xen_crashdump_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_crashdump_record_free(xen_crashdump_record *record); + + +typedef struct xen_crashdump_record_opt +{ + bool is_record; + union + { + xen_crashdump handle; + xen_crashdump_record *record; + } u; +} xen_crashdump_record_opt; + +/** + * Allocate a xen_crashdump_record_opt. + */ +extern xen_crashdump_record_opt * +xen_crashdump_record_opt_alloc(void); + +/** + * Free the given xen_crashdump_record_opt, and all referenced values. + * The given record_opt must have been allocated by this library. + */ +extern void +xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt); + + +typedef struct xen_crashdump_record_set +{ + size_t size; + xen_crashdump_record *contents[]; +} xen_crashdump_record_set; + +/** + * Allocate a xen_crashdump_record_set of the given size. + */ +extern xen_crashdump_record_set * +xen_crashdump_record_set_alloc(size_t size); + +/** + * Free the given xen_crashdump_record_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_crashdump_record_set_free(xen_crashdump_record_set *set); + + + +typedef struct xen_crashdump_record_opt_set +{ + size_t size; + xen_crashdump_record_opt *contents[]; +} xen_crashdump_record_opt_set; + +/** + * Allocate a xen_crashdump_record_opt_set of the given size. + */ +extern xen_crashdump_record_opt_set * +xen_crashdump_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_crashdump_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set); + + +/** + * Get a record containing the current state of the given crashdump. + */ +extern bool +xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump); + + +/** + * Get a reference to the crashdump instance with the specified UUID. + */ +extern bool +xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid); + + +/** + * Get the uuid field of the given crashdump. + */ +extern bool +xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump); + + +/** + * Get the VM field of the given crashdump. + */ +extern bool +xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump); + + +/** + * Get the VDI field of the given crashdump. + */ +extern bool +xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump); + + +/** + * Destroy the specified crashdump. + */ +extern bool +xen_crashdump_destroy(xen_session *session, xen_crashdump self); + + +/** + * Return a list of all the crashdumps known to the system. + */ +extern bool +xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_crashdump_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_crashdump_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_CRASHDUMP_DECL_H +#define XEN_CRASHDUMP_DECL_H + +typedef void *xen_crashdump; + +struct xen_crashdump_set; +struct xen_crashdump_record; +struct xen_crashdump_record_set; +struct xen_crashdump_record_opt; +struct xen_crashdump_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_event.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_event.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2006-2007, 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_EVENT_H +#define XEN_EVENT_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_event_decl.h> +#include <xen/api/xen_event_operation.h> +#include <xen/api/xen_string_set.h> + + +/* + * The event class. + * + * Asynchronous event registration and handling. + */ + + + +typedef struct xen_event_record +{ + int64_t id; + time_t timestamp; + char *class; + enum xen_event_operation operation; + char *ref; + char *obj_uuid; +} xen_event_record; + +/** + * Allocate a xen_event_record. + */ +extern xen_event_record * +xen_event_record_alloc(void); + +/** + * Free the given xen_event_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_event_record_free(xen_event_record *record); + + +typedef struct xen_event_record_set +{ + size_t size; + xen_event_record *contents[]; +} xen_event_record_set; + +/** + * Allocate a xen_event_record_set of the given size. + */ +extern xen_event_record_set * +xen_event_record_set_alloc(size_t size); + +/** + * Free the given xen_event_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_event_record_set_free(xen_event_record_set *set); + + +/** + * Registers this session with the event system. Specifying the empty + * list will register for all classes. + */ +extern bool +xen_event_register(xen_session *session, struct xen_string_set *classes); + + +/** + * Unregisters this session with the event system. + */ +extern bool +xen_event_unregister(xen_session *session, struct xen_string_set *classes); + + +/** + * Blocking call which returns a (possibly empty) batch of events. + */ +extern bool +xen_event_next(xen_session *session, struct xen_event_record_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_event_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_event_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2006-2007, 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_EVENT_DECL_H +#define XEN_EVENT_DECL_H + +struct xen_event_record; +struct xen_event_record_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_event_operation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_event_operation.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2006-2007, 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_EVENT_OPERATION_H +#define XEN_EVENT_OPERATION_H + + +#include <xen/api/xen_common.h> + + +enum xen_event_operation +{ + /** + * An object has been created + */ + XEN_EVENT_OPERATION_ADD, + + /** + * An object has been deleted + */ + XEN_EVENT_OPERATION_DEL, + + /** + * An object has been modified + */ + XEN_EVENT_OPERATION_MOD +}; + + +typedef struct xen_event_operation_set +{ + size_t size; + enum xen_event_operation contents[]; +} xen_event_operation_set; + +/** + * Allocate a xen_event_operation_set of the given size. + */ +extern xen_event_operation_set * +xen_event_operation_set_alloc(size_t size); + +/** + * Free the given xen_event_operation_set. The given set must have + * been allocated by this library. + */ +extern void +xen_event_operation_set_free(xen_event_operation_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_event_operation_to_string(enum xen_event_operation 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_event_operation +xen_event_operation_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_host.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_host.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,497 @@ +/* + * Copyright (c) 2006-2007, 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_HOST_H +#define XEN_HOST_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_host_cpu_decl.h> +#include <xen/api/xen_host_decl.h> +#include <xen/api/xen_host_metrics_decl.h> +#include <xen/api/xen_pbd_decl.h> +#include <xen/api/xen_pif_decl.h> +#include <xen/api/xen_sr_decl.h> +#include <xen/api/xen_string_set.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vm_decl.h> + + +/* + * The host class. + * + * A physical host. + */ + + +/** + * Free the given xen_host. The given handle must have been allocated + * by this library. + */ +extern void +xen_host_free(xen_host host); + + +typedef struct xen_host_set +{ + size_t size; + xen_host *contents[]; +} xen_host_set; + +/** + * Allocate a xen_host_set of the given size. + */ +extern xen_host_set * +xen_host_set_alloc(size_t size); + +/** + * Free the given xen_host_set. The given set must have been allocated + * by this library. + */ +extern void +xen_host_set_free(xen_host_set *set); + + +typedef struct xen_host_record +{ + xen_host handle; + char *uuid; + char *name_label; + char *name_description; + int64_t api_version_major; + int64_t api_version_minor; + char *api_version_vendor; + xen_string_string_map *api_version_vendor_implementation; + bool enabled; + xen_string_string_map *software_version; + xen_string_string_map *other_config; + struct xen_string_set *capabilities; + xen_string_string_map *cpu_configuration; + char *sched_policy; + struct xen_string_set *supported_bootloaders; + struct xen_vm_record_opt_set *resident_vms; + xen_string_string_map *logging; + struct xen_pif_record_opt_set *pifs; + struct xen_sr_record_opt *suspend_image_sr; + struct xen_sr_record_opt *crash_dump_sr; + struct xen_pbd_record_opt_set *pbds; + struct xen_host_cpu_record_opt_set *host_cpus; + struct xen_host_metrics_record_opt *metrics; +} xen_host_record; + +/** + * Allocate a xen_host_record. + */ +extern xen_host_record * +xen_host_record_alloc(void); + +/** + * Free the given xen_host_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_host_record_free(xen_host_record *record); + + +typedef struct xen_host_record_opt +{ + bool is_record; + union + { + xen_host handle; + xen_host_record *record; + } u; +} xen_host_record_opt; + +/** + * Allocate a xen_host_record_opt. + */ +extern xen_host_record_opt * +xen_host_record_opt_alloc(void); + +/** + * Free the given xen_host_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_host_record_opt_free(xen_host_record_opt *record_opt); + + +typedef struct xen_host_record_set +{ + size_t size; + xen_host_record *contents[]; +} xen_host_record_set; + +/** + * Allocate a xen_host_record_set of the given size. + */ +extern xen_host_record_set * +xen_host_record_set_alloc(size_t size); + +/** + * Free the given xen_host_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_host_record_set_free(xen_host_record_set *set); + + + +typedef struct xen_host_record_opt_set +{ + size_t size; + xen_host_record_opt *contents[]; +} xen_host_record_opt_set; + +/** + * Allocate a xen_host_record_opt_set of the given size. + */ +extern xen_host_record_opt_set * +xen_host_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_host_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_host_record_opt_set_free(xen_host_record_opt_set *set); + + +/** + * Get a record containing the current state of the given host. + */ +extern bool +xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host); + + +/** + * Get a reference to the host instance with the specified UUID. + */ +extern bool +xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid); + + +/** + * Get all the host instances with the given label. + */ +extern bool +xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label); + + +/** + * Get the uuid field of the given host. + */ +extern bool +xen_host_get_uuid(xen_session *session, char **result, xen_host host); + + +/** + * Get the name/label field of the given host. + */ +extern bool +xen_host_get_name_label(xen_session *session, char **result, xen_host host); + + +/** + * Get the name/description field of the given host. + */ +extern bool +xen_host_get_name_description(xen_session *session, char **result, xen_host host); + + +/** + * Get the API_version/major field of the given host. + */ +extern bool +xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host); + + +/** + * Get the API_version/minor field of the given host. + */ +extern bool +xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host); + + +/** + * Get the API_version/vendor field of the given host. + */ +extern bool +xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host host); + + +/** + * Get the API_version/vendor_implementation field of the given host. + */ +extern bool +xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host); + + +/** + * Get the enabled field of the given host. + */ +extern bool +xen_host_get_enabled(xen_session *session, bool *result, xen_host host); + + +/** + * Get the software_version field of the given host. + */ +extern bool +xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host); + + +/** + * Get the other_config field of the given host. + */ +extern bool +xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host); + + +/** + * Get the capabilities field of the given host. + */ +extern bool +xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host); + + +/** + * Get the cpu_configuration field of the given host. + */ +extern bool +xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host); + + +/** + * Get the sched_policy field of the given host. + */ +extern bool +xen_host_get_sched_policy(xen_session *session, char **result, xen_host host); + + +/** + * Get the supported_bootloaders field of the given host. + */ +extern bool +xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host); + + +/** + * Get the resident_VMs field of the given host. + */ +extern bool +xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host); + + +/** + * Get the logging field of the given host. + */ +extern bool +xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host); + + +/** + * Get the PIFs field of the given host. + */ +extern bool +xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host); + + +/** + * Get the suspend_image_sr field of the given host. + */ +extern bool +xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host); + + +/** + * Get the crash_dump_sr field of the given host. + */ +extern bool +xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host); + + +/** + * Get the PBDs field of the given host. + */ +extern bool +xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host); + + +/** + * Get the host_CPUs field of the given host. + */ +extern bool +xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host); + + +/** + * Get the metrics field of the given host. + */ +extern bool +xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host); + + +/** + * Set the name/label field of the given host. + */ +extern bool +xen_host_set_name_label(xen_session *session, xen_host host, char *label); + + +/** + * Set the name/description field of the given host. + */ +extern bool +xen_host_set_name_description(xen_session *session, xen_host host, char *description); + + +/** + * Set the other_config field of the given host. + */ +extern bool +xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config); + + +/** + * Add the given key-value pair to the other_config field of the given + * host. + */ +extern bool +xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * other_config field of the given host. If the key is not in that Map, then + * do nothing. + */ +extern bool +xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key); + + +/** + * Set the logging field of the given host. + */ +extern bool +xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging); + + +/** + * Add the given key-value pair to the logging field of the given host. + */ +extern bool +xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the logging + * field of the given host. If the key is not in that Map, then do nothing. + */ +extern bool +xen_host_remove_from_logging(xen_session *session, xen_host host, char *key); + + +/** + * Set the suspend_image_sr field of the given host. + */ +extern bool +xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr); + + +/** + * Set the crash_dump_sr field of the given host. + */ +extern bool +xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr); + + +/** + * Puts the host into a state in which no new VMs can be started. + * Currently active VMs on the host continue to execute. + */ +extern bool +xen_host_disable(xen_session *session, xen_host host); + + +/** + * Puts the host into a state in which new VMs can be started. + */ +extern bool +xen_host_enable(xen_session *session, xen_host host); + + +/** + * Shutdown the host. (This function can only be called if there are no + * currently running VMs on the host and it is disabled.). + */ +extern bool +xen_host_shutdown(xen_session *session, xen_host host); + + +/** + * Reboot the host. (This function can only be called if there are no + * currently running VMs on the host and it is disabled.). + */ +extern bool +xen_host_reboot(xen_session *session, xen_host host); + + +/** + * Get the host xen dmesg. + */ +extern bool +xen_host_dmesg(xen_session *session, char **result, xen_host host); + + +/** + * Get the host xen dmesg, and clear the buffer. + */ +extern bool +xen_host_dmesg_clear(xen_session *session, char **result, xen_host host); + + +/** + * Get the host's log file. + */ +extern bool +xen_host_get_log(xen_session *session, char **result, xen_host host); + + +/** + * Inject the given string as debugging keys into Xen. + */ +extern bool +xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys); + + +/** + * List all supported methods. + */ +extern bool +xen_host_list_methods(xen_session *session, struct xen_string_set **result); + + +/** + * Return a list of all the hosts known to the system. + */ +extern bool +xen_host_get_all(xen_session *session, struct xen_host_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_host_cpu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_host_cpu.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2006-2007, 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_HOST_CPU_H +#define XEN_HOST_CPU_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_host_cpu_decl.h> +#include <xen/api/xen_host_decl.h> + + +/* + * The host_cpu class. + * + * A physical CPU. + */ + + +/** + * Free the given xen_host_cpu. The given handle must have been + * allocated by this library. + */ +extern void +xen_host_cpu_free(xen_host_cpu host_cpu); + + +typedef struct xen_host_cpu_set +{ + size_t size; + xen_host_cpu *contents[]; +} xen_host_cpu_set; + +/** + * Allocate a xen_host_cpu_set of the given size. + */ +extern xen_host_cpu_set * +xen_host_cpu_set_alloc(size_t size); + +/** + * Free the given xen_host_cpu_set. The given set must have been + * allocated by this library. + */ +extern void +xen_host_cpu_set_free(xen_host_cpu_set *set); + + +typedef struct xen_host_cpu_record +{ + xen_host_cpu handle; + char *uuid; + struct xen_host_record_opt *host; + int64_t number; + char *vendor; + int64_t speed; + char *modelname; + char *stepping; + char *flags; + char *features; + double utilisation; +} xen_host_cpu_record; + +/** + * Allocate a xen_host_cpu_record. + */ +extern xen_host_cpu_record * +xen_host_cpu_record_alloc(void); + +/** + * Free the given xen_host_cpu_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_host_cpu_record_free(xen_host_cpu_record *record); + + +typedef struct xen_host_cpu_record_opt +{ + bool is_record; + union + { + xen_host_cpu handle; + xen_host_cpu_record *record; + } u; +} xen_host_cpu_record_opt; + +/** + * Allocate a xen_host_cpu_record_opt. + */ +extern xen_host_cpu_record_opt * +xen_host_cpu_record_opt_alloc(void); + +/** + * Free the given xen_host_cpu_record_opt, and all referenced values. + * The given record_opt must have been allocated by this library. + */ +extern void +xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt); + + +typedef struct xen_host_cpu_record_set +{ + size_t size; + xen_host_cpu_record *contents[]; +} xen_host_cpu_record_set; + +/** + * Allocate a xen_host_cpu_record_set of the given size. + */ +extern xen_host_cpu_record_set * +xen_host_cpu_record_set_alloc(size_t size); + +/** + * Free the given xen_host_cpu_record_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_host_cpu_record_set_free(xen_host_cpu_record_set *set); + + + +typedef struct xen_host_cpu_record_opt_set +{ + size_t size; + xen_host_cpu_record_opt *contents[]; +} xen_host_cpu_record_opt_set; + +/** + * Allocate a xen_host_cpu_record_opt_set of the given size. + */ +extern xen_host_cpu_record_opt_set * +xen_host_cpu_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_host_cpu_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set); + + +/** + * Get a record containing the current state of the given host_cpu. + */ +extern bool +xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu); + + +/** + * Get a reference to the host_cpu instance with the specified UUID. + */ +extern bool +xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid); + + +/** + * Get the uuid field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the host field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu); + + +/** + * Get the number field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu); + + +/** + * Get the vendor field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the speed field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu); + + +/** + * Get the modelname field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the stepping field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the flags field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the features field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the utilisation field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu); + + +/** + * Return a list of all the host_cpus known to the system. + */ +extern bool +xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_host_cpu_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_host_cpu_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_HOST_CPU_DECL_H +#define XEN_HOST_CPU_DECL_H + +typedef void *xen_host_cpu; + +struct xen_host_cpu_set; +struct xen_host_cpu_record; +struct xen_host_cpu_record_set; +struct xen_host_cpu_record_opt; +struct xen_host_cpu_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_host_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_host_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_HOST_DECL_H +#define XEN_HOST_DECL_H + +typedef void *xen_host; + +struct xen_host_set; +struct xen_host_record; +struct xen_host_record_set; +struct xen_host_record_opt; +struct xen_host_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_host_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_host_metrics.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2006-2007, 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_HOST_METRICS_H +#define XEN_HOST_METRICS_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_host_metrics_decl.h> + + +/* + * The host_metrics class. + * + * The metrics associated with a host. + */ + + +/** + * Free the given xen_host_metrics. The given handle must have been + * allocated by this library. + */ +extern void +xen_host_metrics_free(xen_host_metrics host_metrics); + + +typedef struct xen_host_metrics_set +{ + size_t size; + xen_host_metrics *contents[]; +} xen_host_metrics_set; + +/** + * Allocate a xen_host_metrics_set of the given size. + */ +extern xen_host_metrics_set * +xen_host_metrics_set_alloc(size_t size); + +/** + * Free the given xen_host_metrics_set. The given set must have been + * allocated by this library. + */ +extern void +xen_host_metrics_set_free(xen_host_metrics_set *set); + + +typedef struct xen_host_metrics_record +{ + xen_host_metrics handle; + char *uuid; + int64_t memory_total; + int64_t memory_free; + time_t last_updated; +} xen_host_metrics_record; + +/** + * Allocate a xen_host_metrics_record. + */ +extern xen_host_metrics_record * +xen_host_metrics_record_alloc(void); + +/** + * Free the given xen_host_metrics_record, and all referenced values. + * The given record must have been allocated by this library. + */ +extern void +xen_host_metrics_record_free(xen_host_metrics_record *record); + + +typedef struct xen_host_metrics_record_opt +{ + bool is_record; + union + { + xen_host_metrics handle; + xen_host_metrics_record *record; + } u; +} xen_host_metrics_record_opt; + +/** + * Allocate a xen_host_metrics_record_opt. + */ +extern xen_host_metrics_record_opt * +xen_host_metrics_record_opt_alloc(void); + +/** + * Free the given xen_host_metrics_record_opt, and all referenced + * values. The given record_opt must have been allocated by this library. + */ +extern void +xen_host_metrics_record_opt_free(xen_host_metrics_record_opt *record_opt); + + +typedef struct xen_host_metrics_record_set +{ + size_t size; + xen_host_metrics_record *contents[]; +} xen_host_metrics_record_set; + +/** + * Allocate a xen_host_metrics_record_set of the given size. + */ +extern xen_host_metrics_record_set * +xen_host_metrics_record_set_alloc(size_t size); + +/** + * Free the given xen_host_metrics_record_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_host_metrics_record_set_free(xen_host_metrics_record_set *set); + + + +typedef struct xen_host_metrics_record_opt_set +{ + size_t size; + xen_host_metrics_record_opt *contents[]; +} xen_host_metrics_record_opt_set; + +/** + * Allocate a xen_host_metrics_record_opt_set of the given size. + */ +extern xen_host_metrics_record_opt_set * +xen_host_metrics_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_host_metrics_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_host_metrics_record_opt_set_free(xen_host_metrics_record_opt_set *set); + + +/** + * Get a record containing the current state of the given host_metrics. + */ +extern bool +xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics); + + +/** + * Get a reference to the host_metrics instance with the specified + * UUID. + */ +extern bool +xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid); + + +/** + * Get the uuid field of the given host_metrics. + */ +extern bool +xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics); + + +/** + * Get the memory/total field of the given host_metrics. + */ +extern bool +xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics); + + +/** + * Get the memory/free field of the given host_metrics. + */ +extern bool +xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics); + + +/** + * Get the last_updated field of the given host_metrics. + */ +extern bool +xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics); + + +/** + * Return a list of all the host_metrics instances known to the system. + */ +extern bool +xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_host_metrics_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_host_metrics_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_HOST_METRICS_DECL_H +#define XEN_HOST_METRICS_DECL_H + +typedef void *xen_host_metrics; + +struct xen_host_metrics_set; +struct xen_host_metrics_record; +struct xen_host_metrics_record_set; +struct xen_host_metrics_record_opt; +struct xen_host_metrics_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_int_float_map.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_int_float_map.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2006-2007, 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_INT_FLOAT_MAP_H +#define XEN_INT_FLOAT_MAP_H + + +#include <xen/api/xen_common.h> + + +typedef struct xen_int_float_map_contents +{ + int64_t key; + double val; +} xen_int_float_map_contents; + + +typedef struct xen_int_float_map +{ + size_t size; + xen_int_float_map_contents contents[]; +} xen_int_float_map; + +/** + * Allocate a xen_int_float_map of the given size. + */ +extern xen_int_float_map * +xen_int_float_map_alloc(size_t size); + +/** + * Free the given xen_int_float_map, and all referenced values. The + * given map must have been allocated by this library. + */ +extern void +xen_int_float_map_free(xen_int_float_map *map); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_int_int_map.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_int_int_map.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2006-2007, 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_INT_INT_MAP_H +#define XEN_INT_INT_MAP_H + + +#include <xen/api/xen_common.h> + + +typedef struct xen_int_int_map_contents +{ + int64_t key; + int64_t val; +} xen_int_int_map_contents; + + +typedef struct xen_int_int_map +{ + size_t size; + xen_int_int_map_contents contents[]; +} xen_int_int_map; + +/** + * Allocate a xen_int_int_map of the given size. + */ +extern xen_int_int_map * +xen_int_int_map_alloc(size_t size); + +/** + * Free the given xen_int_int_map, and all referenced values. The + * given map must have been allocated by this library. + */ +extern void +xen_int_int_map_free(xen_int_int_map *map); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_int_string_set_map.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_int_string_set_map.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2006-2007, 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_INT_STRING_SET_MAP_H +#define XEN_INT_STRING_SET_MAP_H + + +#include <xen/api/xen_common.h> + + +typedef struct xen_int_string_set_map_contents +{ + int64_t key; + struct xen_string_set *val; +} xen_int_string_set_map_contents; + + +typedef struct xen_int_string_set_map +{ + size_t size; + xen_int_string_set_map_contents contents[]; +} xen_int_string_set_map; + +/** + * Allocate a xen_int_string_set_map of the given size. + */ +extern xen_int_string_set_map * +xen_int_string_set_map_alloc(size_t size); + +/** + * Free the given xen_int_string_set_map, and all referenced values. + * The given map must have been allocated by this library. + */ +extern void +xen_int_string_set_map_free(xen_int_string_set_map *map); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_network.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_network.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2006-2007, 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_NETWORK_H +#define XEN_NETWORK_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_network_decl.h> +#include <xen/api/xen_pif_decl.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vif_decl.h> + + +/* + * The network class. + * + * A virtual network. + */ + + +/** + * Free the given xen_network. The given handle must have been + * allocated by this library. + */ +extern void +xen_network_free(xen_network network); + + +typedef struct xen_network_set +{ + size_t size; + xen_network *contents[]; +} xen_network_set; + +/** + * Allocate a xen_network_set of the given size. + */ +extern xen_network_set * +xen_network_set_alloc(size_t size); + +/** + * Free the given xen_network_set. The given set must have been + * allocated by this library. + */ +extern void +xen_network_set_free(xen_network_set *set); + + +typedef struct xen_network_record +{ + xen_network handle; + char *uuid; + char *name_label; + char *name_description; + struct xen_vif_record_opt_set *vifs; + struct xen_pif_record_opt_set *pifs; + xen_string_string_map *other_config; +} xen_network_record; + +/** + * Allocate a xen_network_record. + */ +extern xen_network_record * +xen_network_record_alloc(void); + +/** + * Free the given xen_network_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_network_record_free(xen_network_record *record); + + +typedef struct xen_network_record_opt +{ + bool is_record; + union + { + xen_network handle; + xen_network_record *record; + } u; +} xen_network_record_opt; + +/** + * Allocate a xen_network_record_opt. + */ +extern xen_network_record_opt * +xen_network_record_opt_alloc(void); + +/** + * Free the given xen_network_record_opt, and all referenced values. + * The given record_opt must have been allocated by this library. + */ +extern void +xen_network_record_opt_free(xen_network_record_opt *record_opt); + + +typedef struct xen_network_record_set +{ + size_t size; + xen_network_record *contents[]; +} xen_network_record_set; + +/** + * Allocate a xen_network_record_set of the given size. + */ +extern xen_network_record_set * +xen_network_record_set_alloc(size_t size); + +/** + * Free the given xen_network_record_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_network_record_set_free(xen_network_record_set *set); + + + +typedef struct xen_network_record_opt_set +{ + size_t size; + xen_network_record_opt *contents[]; +} xen_network_record_opt_set; + +/** + * Allocate a xen_network_record_opt_set of the given size. + */ +extern xen_network_record_opt_set * +xen_network_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_network_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_network_record_opt_set_free(xen_network_record_opt_set *set); + + +/** + * Get a record containing the current state of the given network. + */ +extern bool +xen_network_get_record(xen_session *session, xen_network_record **result, xen_network network); + + +/** + * Get a reference to the network instance with the specified UUID. + */ +extern bool +xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid); + + +/** + * Create a new network instance, and return its handle. + */ +extern bool +xen_network_create(xen_session *session, xen_network *result, xen_network_record *record); + + +/** + * Destroy the specified network instance. + */ +extern bool +xen_network_destroy(xen_session *session, xen_network network); + + +/** + * Get all the network instances with the given label. + */ +extern bool +xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label); + + +/** + * Get the uuid field of the given network. + */ +extern bool +xen_network_get_uuid(xen_session *session, char **result, xen_network network); + + +/** + * Get the name/label field of the given network. + */ +extern bool +xen_network_get_name_label(xen_session *session, char **result, xen_network network); + + +/** + * Get the name/description field of the given network. + */ +extern bool +xen_network_get_name_description(xen_session *session, char **result, xen_network network); + + +/** + * Get the VIFs field of the given network. + */ +extern bool +xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, xen_network network); + + +/** + * Get the PIFs field of the given network. + */ +extern bool +xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_network network); + + +/** + * Get the other_config field of the given network. + */ +extern bool +xen_network_get_other_config(xen_session *session, xen_string_string_map **result, xen_network network); + + +/** + * Set the name/label field of the given network. + */ +extern bool +xen_network_set_name_label(xen_session *session, xen_network network, char *label); + + +/** + * Set the name/description field of the given network. + */ +extern bool +xen_network_set_name_description(xen_session *session, xen_network network, char *description); + + +/** + * Set the other_config field of the given network. + */ +extern bool +xen_network_set_other_config(xen_session *session, xen_network network, xen_string_string_map *other_config); + + +/** + * Add the given key-value pair to the other_config field of the given + * network. + */ +extern bool +xen_network_add_to_other_config(xen_session *session, xen_network network, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * other_config field of the given network. If the key is not in that Map, + * then do nothing. + */ +extern bool +xen_network_remove_from_other_config(xen_session *session, xen_network network, char *key); + + +/** + * Return a list of all the networks known to the system. + */ +extern bool +xen_network_get_all(xen_session *session, struct xen_network_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_network_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_network_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_NETWORK_DECL_H +#define XEN_NETWORK_DECL_H + +typedef void *xen_network; + +struct xen_network_set; +struct xen_network_record; +struct xen_network_record_set; +struct xen_network_record_opt; +struct xen_network_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_on_crash_behaviour.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_on_crash_behaviour.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2006-2007, 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_ON_CRASH_BEHAVIOUR_H +#define XEN_ON_CRASH_BEHAVIOUR_H + + +#include <xen/api/xen_common.h> + + +enum xen_on_crash_behaviour +{ + /** + * destroy the VM state + */ + XEN_ON_CRASH_BEHAVIOUR_DESTROY, + + /** + * record a coredump and then destroy the VM state + */ + XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY, + + /** + * restart the VM + */ + XEN_ON_CRASH_BEHAVIOUR_RESTART, + + /** + * record a coredump and then restart the VM + */ + XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART, + + /** + * leave the crashed VM as-is + */ + XEN_ON_CRASH_BEHAVIOUR_PRESERVE, + + /** + * rename the crashed VM and start a new copy + */ + XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART +}; + + +typedef struct xen_on_crash_behaviour_set +{ + size_t size; + enum xen_on_crash_behaviour contents[]; +} xen_on_crash_behaviour_set; + +/** + * Allocate a xen_on_crash_behaviour_set of the given size. + */ +extern xen_on_crash_behaviour_set * +xen_on_crash_behaviour_set_alloc(size_t size); + +/** + * Free the given xen_on_crash_behaviour_set. The given set must have + * been allocated by this library. + */ +extern void +xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour 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_on_crash_behaviour +xen_on_crash_behaviour_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_on_normal_exit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_on_normal_exit.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2006-2007, 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_ON_NORMAL_EXIT_H +#define XEN_ON_NORMAL_EXIT_H + + +#include <xen/api/xen_common.h> + + +enum xen_on_normal_exit +{ + /** + * destroy the VM state + */ + XEN_ON_NORMAL_EXIT_DESTROY, + + /** + * restart the VM + */ + XEN_ON_NORMAL_EXIT_RESTART +}; + + +typedef struct xen_on_normal_exit_set +{ + size_t size; + enum xen_on_normal_exit contents[]; +} xen_on_normal_exit_set; + +/** + * Allocate a xen_on_normal_exit_set of the given size. + */ +extern xen_on_normal_exit_set * +xen_on_normal_exit_set_alloc(size_t size); + +/** + * Free the given xen_on_normal_exit_set. The given set must have been + * allocated by this library. + */ +extern void +xen_on_normal_exit_set_free(xen_on_normal_exit_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_on_normal_exit_to_string(enum xen_on_normal_exit 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_on_normal_exit +xen_on_normal_exit_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_pbd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_pbd.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2006-2007, 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_PBD_H +#define XEN_PBD_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_host_decl.h> +#include <xen/api/xen_pbd_decl.h> +#include <xen/api/xen_sr_decl.h> +#include <xen/api/xen_string_string_map.h> + + +/* + * The PBD class. + * + * The physical block devices through which hosts access SRs. + */ + + +/** + * Free the given xen_pbd. The given handle must have been allocated + * by this library. + */ +extern void +xen_pbd_free(xen_pbd pbd); + + +typedef struct xen_pbd_set +{ + size_t size; + xen_pbd *contents[]; +} xen_pbd_set; + +/** + * Allocate a xen_pbd_set of the given size. + */ +extern xen_pbd_set * +xen_pbd_set_alloc(size_t size); + +/** + * Free the given xen_pbd_set. The given set must have been allocated + * by this library. + */ +extern void +xen_pbd_set_free(xen_pbd_set *set); + + +typedef struct xen_pbd_record +{ + xen_pbd handle; + char *uuid; + struct xen_host_record_opt *host; + struct xen_sr_record_opt *sr; + xen_string_string_map *device_config; + bool currently_attached; +} xen_pbd_record; + +/** + * Allocate a xen_pbd_record. + */ +extern xen_pbd_record * +xen_pbd_record_alloc(void); + +/** + * Free the given xen_pbd_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_pbd_record_free(xen_pbd_record *record); + + +typedef struct xen_pbd_record_opt +{ + bool is_record; + union + { + xen_pbd handle; + xen_pbd_record *record; + } u; +} xen_pbd_record_opt; + +/** + * Allocate a xen_pbd_record_opt. + */ +extern xen_pbd_record_opt * +xen_pbd_record_opt_alloc(void); + +/** + * Free the given xen_pbd_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_pbd_record_opt_free(xen_pbd_record_opt *record_opt); + + +typedef struct xen_pbd_record_set +{ + size_t size; + xen_pbd_record *contents[]; +} xen_pbd_record_set; + +/** + * Allocate a xen_pbd_record_set of the given size. + */ +extern xen_pbd_record_set * +xen_pbd_record_set_alloc(size_t size); + +/** + * Free the given xen_pbd_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_pbd_record_set_free(xen_pbd_record_set *set); + + + +typedef struct xen_pbd_record_opt_set +{ + size_t size; + xen_pbd_record_opt *contents[]; +} xen_pbd_record_opt_set; + +/** + * Allocate a xen_pbd_record_opt_set of the given size. + */ +extern xen_pbd_record_opt_set * +xen_pbd_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_pbd_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_pbd_record_opt_set_free(xen_pbd_record_opt_set *set); + + +/** + * Get a record containing the current state of the given PBD. + */ +extern bool +xen_pbd_get_record(xen_session *session, xen_pbd_record **result, xen_pbd pbd); + + +/** + * Get a reference to the PBD instance with the specified UUID. + */ +extern bool +xen_pbd_get_by_uuid(xen_session *session, xen_pbd *result, char *uuid); + + +/** + * Create a new PBD instance, and return its handle. + */ +extern bool +xen_pbd_create(xen_session *session, xen_pbd *result, xen_pbd_record *record); + + +/** + * Destroy the specified PBD instance. + */ +extern bool +xen_pbd_destroy(xen_session *session, xen_pbd pbd); + + +/** + * Get the uuid field of the given PBD. + */ +extern bool +xen_pbd_get_uuid(xen_session *session, char **result, xen_pbd pbd); + + +/** + * Get the host field of the given PBD. + */ +extern bool +xen_pbd_get_host(xen_session *session, xen_host *result, xen_pbd pbd); + + +/** + * Get the SR field of the given PBD. + */ +extern bool +xen_pbd_get_sr(xen_session *session, xen_sr *result, xen_pbd pbd); + + +/** + * Get the device_config field of the given PBD. + */ +extern bool +xen_pbd_get_device_config(xen_session *session, xen_string_string_map **result, xen_pbd pbd); + + +/** + * Get the currently_attached field of the given PBD. + */ +extern bool +xen_pbd_get_currently_attached(xen_session *session, bool *result, xen_pbd pbd); + + +/** + * Return a list of all the PBDs known to the system. + */ +extern bool +xen_pbd_get_all(xen_session *session, struct xen_pbd_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_pbd_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_pbd_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_PBD_DECL_H +#define XEN_PBD_DECL_H + +typedef void *xen_pbd; + +struct xen_pbd_set; +struct xen_pbd_record; +struct xen_pbd_record_set; +struct xen_pbd_record_opt; +struct xen_pbd_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_pif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_pif.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2006-2007, 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_PIF_H +#define XEN_PIF_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_host_decl.h> +#include <xen/api/xen_network_decl.h> +#include <xen/api/xen_pif_decl.h> +#include <xen/api/xen_pif_metrics_decl.h> + + +/* + * The PIF class. + * + * A physical network interface (note separate VLANs are represented as + * several PIFs). + */ + + +/** + * Free the given xen_pif. The given handle must have been allocated + * by this library. + */ +extern void +xen_pif_free(xen_pif pif); + + +typedef struct xen_pif_set +{ + size_t size; + xen_pif *contents[]; +} xen_pif_set; + +/** + * Allocate a xen_pif_set of the given size. + */ +extern xen_pif_set * +xen_pif_set_alloc(size_t size); + +/** + * Free the given xen_pif_set. The given set must have been allocated + * by this library. + */ +extern void +xen_pif_set_free(xen_pif_set *set); + + +typedef struct xen_pif_record +{ + xen_pif handle; + char *uuid; + char *device; + struct xen_network_record_opt *network; + struct xen_host_record_opt *host; + char *mac; + int64_t mtu; + int64_t vlan; + struct xen_pif_metrics_record_opt *metrics; +} xen_pif_record; + +/** + * Allocate a xen_pif_record. + */ +extern xen_pif_record * +xen_pif_record_alloc(void); + +/** + * Free the given xen_pif_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_pif_record_free(xen_pif_record *record); + + +typedef struct xen_pif_record_opt +{ + bool is_record; + union + { + xen_pif handle; + xen_pif_record *record; + } u; +} xen_pif_record_opt; + +/** + * Allocate a xen_pif_record_opt. + */ +extern xen_pif_record_opt * +xen_pif_record_opt_alloc(void); + +/** + * Free the given xen_pif_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_pif_record_opt_free(xen_pif_record_opt *record_opt); + + +typedef struct xen_pif_record_set +{ + size_t size; + xen_pif_record *contents[]; +} xen_pif_record_set; + +/** + * Allocate a xen_pif_record_set of the given size. + */ +extern xen_pif_record_set * +xen_pif_record_set_alloc(size_t size); + +/** + * Free the given xen_pif_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_pif_record_set_free(xen_pif_record_set *set); + + + +typedef struct xen_pif_record_opt_set +{ + size_t size; + xen_pif_record_opt *contents[]; +} xen_pif_record_opt_set; + +/** + * Allocate a xen_pif_record_opt_set of the given size. + */ +extern xen_pif_record_opt_set * +xen_pif_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_pif_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_pif_record_opt_set_free(xen_pif_record_opt_set *set); + + +/** + * Get a record containing the current state of the given PIF. + */ +extern bool +xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif); + + +/** + * Get a reference to the PIF instance with the specified UUID. + */ +extern bool +xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid); + + +/** + * Get the uuid field of the given PIF. + */ +extern bool +xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif); + + +/** + * Get the device field of the given PIF. + */ +extern bool +xen_pif_get_device(xen_session *session, char **result, xen_pif pif); + + +/** + * Get the network field of the given PIF. + */ +extern bool +xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif); + + +/** + * Get the host field of the given PIF. + */ +extern bool +xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif); + + +/** + * Get the MAC field of the given PIF. + */ +extern bool +xen_pif_get_mac(xen_session *session, char **result, xen_pif pif); + + +/** + * Get the MTU field of the given PIF. + */ +extern bool +xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif); + + +/** + * Get the VLAN field of the given PIF. + */ +extern bool +xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif); + + +/** + * Get the metrics field of the given PIF. + */ +extern bool +xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif); + + +/** + * Set the device field of the given PIF. + */ +extern bool +xen_pif_set_device(xen_session *session, xen_pif pif, char *device); + + +/** + * Set the MAC field of the given PIF. + */ +extern bool +xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac); + + +/** + * Set the MTU field of the given PIF. + */ +extern bool +xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu); + + +/** + * Set the VLAN field of the given PIF. + */ +extern bool +xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan); + + +/** + * Create a VLAN interface from an existing physical interface. + */ +extern bool +xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan); + + +/** + * Destroy the interface (provided it is a synthetic interface like a + * VLAN; fail if it is a physical interface). + */ +extern bool +xen_pif_destroy(xen_session *session, xen_pif self); + + +/** + * Return a list of all the PIFs known to the system. + */ +extern bool +xen_pif_get_all(xen_session *session, struct xen_pif_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_pif_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_pif_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_PIF_DECL_H +#define XEN_PIF_DECL_H + +typedef void *xen_pif; + +struct xen_pif_set; +struct xen_pif_record; +struct xen_pif_record_set; +struct xen_pif_record_opt; +struct xen_pif_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_pif_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_pif_metrics.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2006-2007, 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_PIF_METRICS_H +#define XEN_PIF_METRICS_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_pif_metrics_decl.h> + + +/* + * The PIF_metrics class. + * + * The metrics associated with a physical network interface. + */ + + +/** + * Free the given xen_pif_metrics. The given handle must have been + * allocated by this library. + */ +extern void +xen_pif_metrics_free(xen_pif_metrics pif_metrics); + + +typedef struct xen_pif_metrics_set +{ + size_t size; + xen_pif_metrics *contents[]; +} xen_pif_metrics_set; + +/** + * Allocate a xen_pif_metrics_set of the given size. + */ +extern xen_pif_metrics_set * +xen_pif_metrics_set_alloc(size_t size); + +/** + * Free the given xen_pif_metrics_set. The given set must have been + * allocated by this library. + */ +extern void +xen_pif_metrics_set_free(xen_pif_metrics_set *set); + + +typedef struct xen_pif_metrics_record +{ + xen_pif_metrics handle; + char *uuid; + double io_read_kbs; + double io_write_kbs; + time_t last_updated; +} xen_pif_metrics_record; + +/** + * Allocate a xen_pif_metrics_record. + */ +extern xen_pif_metrics_record * +xen_pif_metrics_record_alloc(void); + +/** + * Free the given xen_pif_metrics_record, and all referenced values. + * The given record must have been allocated by this library. + */ +extern void +xen_pif_metrics_record_free(xen_pif_metrics_record *record); + + +typedef struct xen_pif_metrics_record_opt +{ + bool is_record; + union + { + xen_pif_metrics handle; + xen_pif_metrics_record *record; + } u; +} xen_pif_metrics_record_opt; + +/** + * Allocate a xen_pif_metrics_record_opt. + */ +extern xen_pif_metrics_record_opt * +xen_pif_metrics_record_opt_alloc(void); + +/** + * Free the given xen_pif_metrics_record_opt, and all referenced + * values. The given record_opt must have been allocated by this library. + */ +extern void +xen_pif_metrics_record_opt_free(xen_pif_metrics_record_opt *record_opt); + + +typedef struct xen_pif_metrics_record_set +{ + size_t size; + xen_pif_metrics_record *contents[]; +} xen_pif_metrics_record_set; + +/** + * Allocate a xen_pif_metrics_record_set of the given size. + */ +extern xen_pif_metrics_record_set * +xen_pif_metrics_record_set_alloc(size_t size); + +/** + * Free the given xen_pif_metrics_record_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_pif_metrics_record_set_free(xen_pif_metrics_record_set *set); + + + +typedef struct xen_pif_metrics_record_opt_set +{ + size_t size; + xen_pif_metrics_record_opt *contents[]; +} xen_pif_metrics_record_opt_set; + +/** + * Allocate a xen_pif_metrics_record_opt_set of the given size. + */ +extern xen_pif_metrics_record_opt_set * +xen_pif_metrics_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_pif_metrics_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_pif_metrics_record_opt_set_free(xen_pif_metrics_record_opt_set *set); + + +/** + * Get a record containing the current state of the given PIF_metrics. + */ +extern bool +xen_pif_metrics_get_record(xen_session *session, xen_pif_metrics_record **result, xen_pif_metrics pif_metrics); + + +/** + * Get a reference to the PIF_metrics instance with the specified UUID. + */ +extern bool +xen_pif_metrics_get_by_uuid(xen_session *session, xen_pif_metrics *result, char *uuid); + + +/** + * Get the uuid field of the given PIF_metrics. + */ +extern bool +xen_pif_metrics_get_uuid(xen_session *session, char **result, xen_pif_metrics pif_metrics); + + +/** + * Get the io/read_kbs field of the given PIF_metrics. + */ +extern bool +xen_pif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics); + + +/** + * Get the io/write_kbs field of the given PIF_metrics. + */ +extern bool +xen_pif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics); + + +/** + * Get the last_updated field of the given PIF_metrics. + */ +extern bool +xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, xen_pif_metrics pif_metrics); + + +/** + * Return a list of all the PIF_metrics instances known to the system. + */ +extern bool +xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_pif_metrics_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_pif_metrics_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_PIF_METRICS_DECL_H +#define XEN_PIF_METRICS_DECL_H + +typedef void *xen_pif_metrics; + +struct xen_pif_metrics_set; +struct xen_pif_metrics_record; +struct xen_pif_metrics_record_set; +struct xen_pif_metrics_record_opt; +struct xen_pif_metrics_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_sr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_sr.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2006-2007, 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_SR_H +#define XEN_SR_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_pbd_decl.h> +#include <xen/api/xen_sr_decl.h> +#include <xen/api/xen_string_set.h> +#include <xen/api/xen_vdi_decl.h> + + +/* + * The SR class. + * + * A storage repository. + */ + + +/** + * Free the given xen_sr. The given handle must have been allocated by + * this library. + */ +extern void +xen_sr_free(xen_sr sr); + + +typedef struct xen_sr_set +{ + size_t size; + xen_sr *contents[]; +} xen_sr_set; + +/** + * Allocate a xen_sr_set of the given size. + */ +extern xen_sr_set * +xen_sr_set_alloc(size_t size); + +/** + * Free the given xen_sr_set. The given set must have been allocated + * by this library. + */ +extern void +xen_sr_set_free(xen_sr_set *set); + + +typedef struct xen_sr_record +{ + xen_sr handle; + char *uuid; + char *name_label; + char *name_description; + struct xen_vdi_record_opt_set *vdis; + struct xen_pbd_record_opt_set *pbds; + int64_t virtual_allocation; + int64_t physical_utilisation; + int64_t physical_size; + char *type; + char *content_type; +} xen_sr_record; + +/** + * Allocate a xen_sr_record. + */ +extern xen_sr_record * +xen_sr_record_alloc(void); + +/** + * Free the given xen_sr_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_sr_record_free(xen_sr_record *record); + + +typedef struct xen_sr_record_opt +{ + bool is_record; + union + { + xen_sr handle; + xen_sr_record *record; + } u; +} xen_sr_record_opt; + +/** + * Allocate a xen_sr_record_opt. + */ +extern xen_sr_record_opt * +xen_sr_record_opt_alloc(void); + +/** + * Free the given xen_sr_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_sr_record_opt_free(xen_sr_record_opt *record_opt); + + +typedef struct xen_sr_record_set +{ + size_t size; + xen_sr_record *contents[]; +} xen_sr_record_set; + +/** + * Allocate a xen_sr_record_set of the given size. + */ +extern xen_sr_record_set * +xen_sr_record_set_alloc(size_t size); + +/** + * Free the given xen_sr_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_sr_record_set_free(xen_sr_record_set *set); + + + +typedef struct xen_sr_record_opt_set +{ + size_t size; + xen_sr_record_opt *contents[]; +} xen_sr_record_opt_set; + +/** + * Allocate a xen_sr_record_opt_set of the given size. + */ +extern xen_sr_record_opt_set * +xen_sr_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_sr_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_sr_record_opt_set_free(xen_sr_record_opt_set *set); + + +/** + * Get a record containing the current state of the given SR. + */ +extern bool +xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr); + + +/** + * Get a reference to the SR instance with the specified UUID. + */ +extern bool +xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid); + + +/** + * Get all the SR instances with the given label. + */ +extern bool +xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label); + + +/** + * Get the uuid field of the given SR. + */ +extern bool +xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr); + + +/** + * Get the name/label field of the given SR. + */ +extern bool +xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr); + + +/** + * Get the name/description field of the given SR. + */ +extern bool +xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr); + + +/** + * Get the VDIs field of the given SR. + */ +extern bool +xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr); + + +/** + * Get the PBDs field of the given SR. + */ +extern bool +xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr); + + +/** + * Get the virtual_allocation field of the given SR. + */ +extern bool +xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr sr); + + +/** + * Get the physical_utilisation field of the given SR. + */ +extern bool +xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr sr); + + +/** + * Get the physical_size field of the given SR. + */ +extern bool +xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr); + + +/** + * Get the type field of the given SR. + */ +extern bool +xen_sr_get_type(xen_session *session, char **result, xen_sr sr); + + +/** + * Get the content_type field of the given SR. + */ +extern bool +xen_sr_get_content_type(xen_session *session, char **result, xen_sr sr); + + +/** + * Set the name/label field of the given SR. + */ +extern bool +xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label); + + +/** + * Set the name/description field of the given SR. + */ +extern bool +xen_sr_set_name_description(xen_session *session, xen_sr sr, char *description); + + +/** + * Return a set of all the SR types supported by the system. + */ +extern bool +xen_sr_get_supported_types(xen_session *session, struct xen_string_set **result); + + +/** + * Return a list of all the SRs known to the system. + */ +extern bool +xen_sr_get_all(xen_session *session, struct xen_sr_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_sr_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_sr_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_SR_DECL_H +#define XEN_SR_DECL_H + +typedef void *xen_sr; + +struct xen_sr_set; +struct xen_sr_record; +struct xen_sr_record_set; +struct xen_sr_record_opt; +struct xen_sr_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_string_set.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_string_set.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2006-2007, 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_STRING_SET_H +#define XEN_STRING_SET_H + + +#include "xen_common.h" + + +typedef struct xen_string_set +{ + size_t size; + char *contents[]; +} xen_string_set; + + +/** + * Allocate a xen_string_set of the given size. + */ +extern xen_string_set * +xen_string_set_alloc(size_t size); + +/** + * Free the given xen_string_set. The given set must have been allocated + * by this library. + */ +extern void +xen_string_set_free(xen_string_set *set); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_string_string_map.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_string_string_map.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2006-2007, 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_STRING_STRING_MAP_H +#define XEN_STRING_STRING_MAP_H + + +#include <xen/api/xen_common.h> + + +typedef struct xen_string_string_map_contents +{ + char *key; + char *val; +} xen_string_string_map_contents; + + +typedef struct xen_string_string_map +{ + size_t size; + xen_string_string_map_contents contents[]; +} xen_string_string_map; + +/** + * Allocate a xen_string_string_map of the given size. + */ +extern xen_string_string_map * +xen_string_string_map_alloc(size_t size); + +/** + * Free the given xen_string_string_map, and all referenced values. + * The given map must have been allocated by this library. + */ +extern void +xen_string_string_map_free(xen_string_string_map *map); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_user.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_user.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2006-2007, 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_USER_H +#define XEN_USER_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_user_decl.h> + + +/* + * The user class. + * + * A user of the system. + */ + + +/** + * Free the given xen_user. The given handle must have been allocated + * by this library. + */ +extern void +xen_user_free(xen_user user); + + +typedef struct xen_user_set +{ + size_t size; + xen_user *contents[]; +} xen_user_set; + +/** + * Allocate a xen_user_set of the given size. + */ +extern xen_user_set * +xen_user_set_alloc(size_t size); + +/** + * Free the given xen_user_set. The given set must have been allocated + * by this library. + */ +extern void +xen_user_set_free(xen_user_set *set); + + +typedef struct xen_user_record +{ + xen_user handle; + char *uuid; + char *short_name; + char *fullname; +} xen_user_record; + +/** + * Allocate a xen_user_record. + */ +extern xen_user_record * +xen_user_record_alloc(void); + +/** + * Free the given xen_user_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_user_record_free(xen_user_record *record); + + +typedef struct xen_user_record_opt +{ + bool is_record; + union + { + xen_user handle; + xen_user_record *record; + } u; +} xen_user_record_opt; + +/** + * Allocate a xen_user_record_opt. + */ +extern xen_user_record_opt * +xen_user_record_opt_alloc(void); + +/** + * Free the given xen_user_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_user_record_opt_free(xen_user_record_opt *record_opt); + + +typedef struct xen_user_record_set +{ + size_t size; + xen_user_record *contents[]; +} xen_user_record_set; + +/** + * Allocate a xen_user_record_set of the given size. + */ +extern xen_user_record_set * +xen_user_record_set_alloc(size_t size); + +/** + * Free the given xen_user_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_user_record_set_free(xen_user_record_set *set); + + + +typedef struct xen_user_record_opt_set +{ + size_t size; + xen_user_record_opt *contents[]; +} xen_user_record_opt_set; + +/** + * Allocate a xen_user_record_opt_set of the given size. + */ +extern xen_user_record_opt_set * +xen_user_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_user_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_user_record_opt_set_free(xen_user_record_opt_set *set); + + +/** + * Get a record containing the current state of the given user. + */ +extern bool +xen_user_get_record(xen_session *session, xen_user_record **result, xen_user user); + + +/** + * Get a reference to the user instance with the specified UUID. + */ +extern bool +xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid); + + +/** + * Create a new user instance, and return its handle. + */ +extern bool +xen_user_create(xen_session *session, xen_user *result, xen_user_record *record); + + +/** + * Destroy the specified user instance. + */ +extern bool +xen_user_destroy(xen_session *session, xen_user user); + + +/** + * Get the uuid field of the given user. + */ +extern bool +xen_user_get_uuid(xen_session *session, char **result, xen_user user); + + +/** + * Get the short_name field of the given user. + */ +extern bool +xen_user_get_short_name(xen_session *session, char **result, xen_user user); + + +/** + * Get the fullname field of the given user. + */ +extern bool +xen_user_get_fullname(xen_session *session, char **result, xen_user user); + + +/** + * Set the fullname field of the given user. + */ +extern bool +xen_user_set_fullname(xen_session *session, xen_user user, char *fullname); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_user_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_user_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_USER_DECL_H +#define XEN_USER_DECL_H + +typedef void *xen_user; + +struct xen_user_set; +struct xen_user_record; +struct xen_user_record_set; +struct xen_user_record_opt; +struct xen_user_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vbd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vbd.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2006-2007, 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_VBD_H +#define XEN_VBD_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_string_set.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vbd_decl.h> +#include <xen/api/xen_vbd_metrics_decl.h> +#include <xen/api/xen_vbd_mode.h> +#include <xen/api/xen_vbd_type.h> +#include <xen/api/xen_vdi_decl.h> +#include <xen/api/xen_vm_decl.h> + + +/* + * The VBD class. + * + * A virtual block device. + */ + + +/** + * Free the given xen_vbd. The given handle must have been allocated + * by this library. + */ +extern void +xen_vbd_free(xen_vbd vbd); + + +typedef struct xen_vbd_set +{ + size_t size; + xen_vbd *contents[]; +} xen_vbd_set; + +/** + * Allocate a xen_vbd_set of the given size. + */ +extern xen_vbd_set * +xen_vbd_set_alloc(size_t size); + +/** + * Free the given xen_vbd_set. The given set must have been allocated + * by this library. + */ +extern void +xen_vbd_set_free(xen_vbd_set *set); + + +typedef struct xen_vbd_record +{ + xen_vbd handle; + char *uuid; + struct xen_vm_record_opt *vm; + struct xen_vdi_record_opt *vdi; + char *device; + bool bootable; + enum xen_vbd_mode mode; + enum xen_vbd_type type; + bool currently_attached; + int64_t status_code; + char *status_detail; + xen_string_string_map *runtime_properties; + char *qos_algorithm_type; + xen_string_string_map *qos_algorithm_params; + struct xen_string_set *qos_supported_algorithms; + struct xen_vbd_metrics_record_opt *metrics; +} xen_vbd_record; + +/** + * Allocate a xen_vbd_record. + */ +extern xen_vbd_record * +xen_vbd_record_alloc(void); + +/** + * Free the given xen_vbd_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_vbd_record_free(xen_vbd_record *record); + + +typedef struct xen_vbd_record_opt +{ + bool is_record; + union + { + xen_vbd handle; + xen_vbd_record *record; + } u; +} xen_vbd_record_opt; + +/** + * Allocate a xen_vbd_record_opt. + */ +extern xen_vbd_record_opt * +xen_vbd_record_opt_alloc(void); + +/** + * Free the given xen_vbd_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_vbd_record_opt_free(xen_vbd_record_opt *record_opt); + + +typedef struct xen_vbd_record_set +{ + size_t size; + xen_vbd_record *contents[]; +} xen_vbd_record_set; + +/** + * Allocate a xen_vbd_record_set of the given size. + */ +extern xen_vbd_record_set * +xen_vbd_record_set_alloc(size_t size); + +/** + * Free the given xen_vbd_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_vbd_record_set_free(xen_vbd_record_set *set); + + + +typedef struct xen_vbd_record_opt_set +{ + size_t size; + xen_vbd_record_opt *contents[]; +} xen_vbd_record_opt_set; + +/** + * Allocate a xen_vbd_record_opt_set of the given size. + */ +extern xen_vbd_record_opt_set * +xen_vbd_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vbd_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_vbd_record_opt_set_free(xen_vbd_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VBD. + */ +extern bool +xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd); + + +/** + * Get a reference to the VBD instance with the specified UUID. + */ +extern bool +xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid); + + +/** + * Create a new VBD instance, and return its handle. + */ +extern bool +xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record); + + +/** + * Destroy the specified VBD instance. + */ +extern bool +xen_vbd_destroy(xen_session *session, xen_vbd vbd); + + +/** + * Get the uuid field of the given VBD. + */ +extern bool +xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd); + + +/** + * Get the VM field of the given VBD. + */ +extern bool +xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd); + + +/** + * Get the VDI field of the given VBD. + */ +extern bool +xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd); + + +/** + * Get the device field of the given VBD. + */ +extern bool +xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd); + + +/** + * Get the bootable field of the given VBD. + */ +extern bool +xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd); + + +/** + * Get the mode field of the given VBD. + */ +extern bool +xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd); + + +/** + * Get the type field of the given VBD. + */ +extern bool +xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd); + + +/** + * Get the currently_attached field of the given VBD. + */ +extern bool +xen_vbd_get_currently_attached(xen_session *session, bool *result, xen_vbd vbd); + + +/** + * Get the status_code field of the given VBD. + */ +extern bool +xen_vbd_get_status_code(xen_session *session, int64_t *result, xen_vbd vbd); + + +/** + * Get the status_detail field of the given VBD. + */ +extern bool +xen_vbd_get_status_detail(xen_session *session, char **result, xen_vbd vbd); + + +/** + * Get the runtime_properties field of the given VBD. + */ +extern bool +xen_vbd_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vbd vbd); + + +/** + * Get the qos/algorithm_type field of the given VBD. + */ +extern bool +xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd); + + +/** + * Get the qos/algorithm_params field of the given VBD. + */ +extern bool +xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd); + + +/** + * Get the qos/supported_algorithms field of the given VBD. + */ +extern bool +xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd); + + +/** + * Get the metrics field of the given VBD. + */ +extern bool +xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd); + + +/** + * Set the device field of the given VBD. + */ +extern bool +xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device); + + +/** + * Set the bootable field of the given VBD. + */ +extern bool +xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable); + + +/** + * Set the mode field of the given VBD. + */ +extern bool +xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode); + + +/** + * Set the type field of the given VBD. + */ +extern bool +xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type); + + +/** + * Set the qos/algorithm_type field of the given VBD. + */ +extern bool +xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type); + + +/** + * Set the qos/algorithm_params field of the given VBD. + */ +extern bool +xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params); + + +/** + * Add the given key-value pair to the qos/algorithm_params field of + * the given VBD. + */ +extern bool +xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * qos/algorithm_params field of the given VBD. If the key is not in that + * Map, then do nothing. + */ +extern bool +xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key); + + +/** + * Change the media in the device for CDROM-like devices only. For + * other devices, detach the VBD and attach a new one. + */ +extern bool +xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi); + + +/** + * Hotplug the specified VBD, dynamically attaching it to the running + * VM. + */ +extern bool +xen_vbd_plug(xen_session *session, xen_vbd self); + + +/** + * Hot-unplug the specified VBD, dynamically unattaching it from the + * running VM. + */ +extern bool +xen_vbd_unplug(xen_session *session, xen_vbd self); + + +/** + * Return a list of all the VBDs known to the system. + */ +extern bool +xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vbd_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vbd_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VBD_DECL_H +#define XEN_VBD_DECL_H + +typedef void *xen_vbd; + +struct xen_vbd_set; +struct xen_vbd_record; +struct xen_vbd_record_set; +struct xen_vbd_record_opt; +struct xen_vbd_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vbd_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vbd_metrics.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2006-2007, 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_VBD_METRICS_H +#define XEN_VBD_METRICS_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_vbd_metrics_decl.h> + + +/* + * The VBD_metrics class. + * + * The metrics associated with a virtual block device. + */ + + +/** + * Free the given xen_vbd_metrics. The given handle must have been + * allocated by this library. + */ +extern void +xen_vbd_metrics_free(xen_vbd_metrics vbd_metrics); + + +typedef struct xen_vbd_metrics_set +{ + size_t size; + xen_vbd_metrics *contents[]; +} xen_vbd_metrics_set; + +/** + * Allocate a xen_vbd_metrics_set of the given size. + */ +extern xen_vbd_metrics_set * +xen_vbd_metrics_set_alloc(size_t size); + +/** + * Free the given xen_vbd_metrics_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vbd_metrics_set_free(xen_vbd_metrics_set *set); + + +typedef struct xen_vbd_metrics_record +{ + xen_vbd_metrics handle; + char *uuid; + double io_read_kbs; + double io_write_kbs; + time_t last_updated; +} xen_vbd_metrics_record; + +/** + * Allocate a xen_vbd_metrics_record. + */ +extern xen_vbd_metrics_record * +xen_vbd_metrics_record_alloc(void); + +/** + * Free the given xen_vbd_metrics_record, and all referenced values. + * The given record must have been allocated by this library. + */ +extern void +xen_vbd_metrics_record_free(xen_vbd_metrics_record *record); + + +typedef struct xen_vbd_metrics_record_opt +{ + bool is_record; + union + { + xen_vbd_metrics handle; + xen_vbd_metrics_record *record; + } u; +} xen_vbd_metrics_record_opt; + +/** + * Allocate a xen_vbd_metrics_record_opt. + */ +extern xen_vbd_metrics_record_opt * +xen_vbd_metrics_record_opt_alloc(void); + +/** + * Free the given xen_vbd_metrics_record_opt, and all referenced + * values. The given record_opt must have been allocated by this library. + */ +extern void +xen_vbd_metrics_record_opt_free(xen_vbd_metrics_record_opt *record_opt); + + +typedef struct xen_vbd_metrics_record_set +{ + size_t size; + xen_vbd_metrics_record *contents[]; +} xen_vbd_metrics_record_set; + +/** + * Allocate a xen_vbd_metrics_record_set of the given size. + */ +extern xen_vbd_metrics_record_set * +xen_vbd_metrics_record_set_alloc(size_t size); + +/** + * Free the given xen_vbd_metrics_record_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_vbd_metrics_record_set_free(xen_vbd_metrics_record_set *set); + + + +typedef struct xen_vbd_metrics_record_opt_set +{ + size_t size; + xen_vbd_metrics_record_opt *contents[]; +} xen_vbd_metrics_record_opt_set; + +/** + * Allocate a xen_vbd_metrics_record_opt_set of the given size. + */ +extern xen_vbd_metrics_record_opt_set * +xen_vbd_metrics_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vbd_metrics_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_vbd_metrics_record_opt_set_free(xen_vbd_metrics_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VBD_metrics. + */ +extern bool +xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record **result, xen_vbd_metrics vbd_metrics); + + +/** + * Get a reference to the VBD_metrics instance with the specified UUID. + */ +extern bool +xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, char *uuid); + + +/** + * Get the uuid field of the given VBD_metrics. + */ +extern bool +xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics vbd_metrics); + + +/** + * Get the io/read_kbs field of the given VBD_metrics. + */ +extern bool +xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics); + + +/** + * Get the io/write_kbs field of the given VBD_metrics. + */ +extern bool +xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics); + + +/** + * Get the last_updated field of the given VBD_metrics. + */ +extern bool +xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics); + + +/** + * Return a list of all the VBD_metrics instances known to the system. + */ +extern bool +xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vbd_metrics_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vbd_metrics_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VBD_METRICS_DECL_H +#define XEN_VBD_METRICS_DECL_H + +typedef void *xen_vbd_metrics; + +struct xen_vbd_metrics_set; +struct xen_vbd_metrics_record; +struct xen_vbd_metrics_record_set; +struct xen_vbd_metrics_record_opt; +struct xen_vbd_metrics_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vbd_mode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vbd_mode.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2006-2007, 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_VBD_MODE_H +#define XEN_VBD_MODE_H + + +#include <xen/api/xen_common.h> + + +enum xen_vbd_mode +{ + /** + * disk is mounted read-only + */ + XEN_VBD_MODE_RO, + + /** + * disk is mounted read-write + */ + XEN_VBD_MODE_RW +}; + + +typedef struct xen_vbd_mode_set +{ + size_t size; + enum xen_vbd_mode contents[]; +} xen_vbd_mode_set; + +/** + * Allocate a xen_vbd_mode_set of the given size. + */ +extern xen_vbd_mode_set * +xen_vbd_mode_set_alloc(size_t size); + +/** + * Free the given xen_vbd_mode_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vbd_mode_set_free(xen_vbd_mode_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_vbd_mode_to_string(enum xen_vbd_mode 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_vbd_mode +xen_vbd_mode_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vbd_type.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vbd_type.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2006-2007, 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_VBD_TYPE_H +#define XEN_VBD_TYPE_H + + +#include <xen/api/xen_common.h> + + +enum xen_vbd_type +{ + /** + * VBD will appear to guest as CD + */ + XEN_VBD_TYPE_CD, + + /** + * VBD will appear to guest as disk + */ + XEN_VBD_TYPE_DISK +}; + + +typedef struct xen_vbd_type_set +{ + size_t size; + enum xen_vbd_type contents[]; +} xen_vbd_type_set; + +/** + * Allocate a xen_vbd_type_set of the given size. + */ +extern xen_vbd_type_set * +xen_vbd_type_set_alloc(size_t size); + +/** + * Free the given xen_vbd_type_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vbd_type_set_free(xen_vbd_type_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_vbd_type_to_string(enum xen_vbd_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_vbd_type +xen_vbd_type_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vdi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vdi.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2006-2007, 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_VDI_H +#define XEN_VDI_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_crashdump_decl.h> +#include <xen/api/xen_sr_decl.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vbd_decl.h> +#include <xen/api/xen_vdi_decl.h> +#include <xen/api/xen_vdi_type.h> + + +/* + * The VDI class. + * + * A virtual disk image. + */ + + +/** + * Free the given xen_vdi. The given handle must have been allocated + * by this library. + */ +extern void +xen_vdi_free(xen_vdi vdi); + + +typedef struct xen_vdi_set +{ + size_t size; + xen_vdi *contents[]; +} xen_vdi_set; + +/** + * Allocate a xen_vdi_set of the given size. + */ +extern xen_vdi_set * +xen_vdi_set_alloc(size_t size); + +/** + * Free the given xen_vdi_set. The given set must have been allocated + * by this library. + */ +extern void +xen_vdi_set_free(xen_vdi_set *set); + + +typedef struct xen_vdi_record +{ + xen_vdi handle; + char *uuid; + char *name_label; + char *name_description; + struct xen_sr_record_opt *sr; + struct xen_vbd_record_opt_set *vbds; + struct xen_crashdump_record_opt_set *crash_dumps; + int64_t virtual_size; + int64_t physical_utilisation; + enum xen_vdi_type type; + bool sharable; + bool read_only; + xen_string_string_map *other_config; +} xen_vdi_record; + +/** + * Allocate a xen_vdi_record. + */ +extern xen_vdi_record * +xen_vdi_record_alloc(void); + +/** + * Free the given xen_vdi_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_vdi_record_free(xen_vdi_record *record); + + +typedef struct xen_vdi_record_opt +{ + bool is_record; + union + { + xen_vdi handle; + xen_vdi_record *record; + } u; +} xen_vdi_record_opt; + +/** + * Allocate a xen_vdi_record_opt. + */ +extern xen_vdi_record_opt * +xen_vdi_record_opt_alloc(void); + +/** + * Free the given xen_vdi_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_vdi_record_opt_free(xen_vdi_record_opt *record_opt); + + +typedef struct xen_vdi_record_set +{ + size_t size; + xen_vdi_record *contents[]; +} xen_vdi_record_set; + +/** + * Allocate a xen_vdi_record_set of the given size. + */ +extern xen_vdi_record_set * +xen_vdi_record_set_alloc(size_t size); + +/** + * Free the given xen_vdi_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_vdi_record_set_free(xen_vdi_record_set *set); + + + +typedef struct xen_vdi_record_opt_set +{ + size_t size; + xen_vdi_record_opt *contents[]; +} xen_vdi_record_opt_set; + +/** + * Allocate a xen_vdi_record_opt_set of the given size. + */ +extern xen_vdi_record_opt_set * +xen_vdi_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vdi_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_vdi_record_opt_set_free(xen_vdi_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VDI. + */ +extern bool +xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi); + + +/** + * Get a reference to the VDI instance with the specified UUID. + */ +extern bool +xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid); + + +/** + * Create a new VDI instance, and return its handle. + */ +extern bool +xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record); + + +/** + * Destroy the specified VDI instance. + */ +extern bool +xen_vdi_destroy(xen_session *session, xen_vdi vdi); + + +/** + * Get all the VDI instances with the given label. + */ +extern bool +xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, char *label); + + +/** + * Get the uuid field of the given VDI. + */ +extern bool +xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi); + + +/** + * Get the name/label field of the given VDI. + */ +extern bool +xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi); + + +/** + * Get the name/description field of the given VDI. + */ +extern bool +xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi); + + +/** + * Get the SR field of the given VDI. + */ +extern bool +xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi); + + +/** + * Get the VBDs field of the given VDI. + */ +extern bool +xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi vdi); + + +/** + * Get the crash_dumps field of the given VDI. + */ +extern bool +xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi); + + +/** + * Get the virtual_size field of the given VDI. + */ +extern bool +xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi); + + +/** + * Get the physical_utilisation field of the given VDI. + */ +extern bool +xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi); + + +/** + * Get the type field of the given VDI. + */ +extern bool +xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi); + + +/** + * Get the sharable field of the given VDI. + */ +extern bool +xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi); + + +/** + * Get the read_only field of the given VDI. + */ +extern bool +xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi); + + +/** + * Get the other_config field of the given VDI. + */ +extern bool +xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi); + + +/** + * Set the name/label field of the given VDI. + */ +extern bool +xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label); + + +/** + * Set the name/description field of the given VDI. + */ +extern bool +xen_vdi_set_name_description(xen_session *session, xen_vdi vdi, char *description); + + +/** + * Set the virtual_size field of the given VDI. + */ +extern bool +xen_vdi_set_virtual_size(xen_session *session, xen_vdi vdi, int64_t virtual_size); + + +/** + * Set the sharable field of the given VDI. + */ +extern bool +xen_vdi_set_sharable(xen_session *session, xen_vdi vdi, bool sharable); + + +/** + * Set the read_only field of the given VDI. + */ +extern bool +xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only); + + +/** + * Set the other_config field of the given VDI. + */ +extern bool +xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config); + + +/** + * Add the given key-value pair to the other_config field of the given + * VDI. + */ +extern bool +xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * other_config field of the given VDI. If the key is not in that Map, then + * do nothing. + */ +extern bool +xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key); + + +/** + * Return a list of all the VDIs known to the system. + */ +extern bool +xen_vdi_get_all(xen_session *session, struct xen_vdi_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vdi_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vdi_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VDI_DECL_H +#define XEN_VDI_DECL_H + +typedef void *xen_vdi; + +struct xen_vdi_set; +struct xen_vdi_record; +struct xen_vdi_record_set; +struct xen_vdi_record_opt; +struct xen_vdi_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vdi_type.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vdi_type.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2006-2007, 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_VDI_TYPE_H +#define XEN_VDI_TYPE_H + + +#include <xen/api/xen_common.h> + + +enum xen_vdi_type +{ + /** + * a disk that may be replaced on upgrade + */ + XEN_VDI_TYPE_SYSTEM, + + /** + * a disk that is always preserved on upgrade + */ + XEN_VDI_TYPE_USER, + + /** + * a disk that may be reformatted on upgrade + */ + XEN_VDI_TYPE_EPHEMERAL, + + /** + * a disk that stores a suspend image + */ + XEN_VDI_TYPE_SUSPEND, + + /** + * a disk that stores VM crashdump information + */ + XEN_VDI_TYPE_CRASHDUMP +}; + + +typedef struct xen_vdi_type_set +{ + size_t size; + enum xen_vdi_type contents[]; +} xen_vdi_type_set; + +/** + * Allocate a xen_vdi_type_set of the given size. + */ +extern xen_vdi_type_set * +xen_vdi_type_set_alloc(size_t size); + +/** + * Free the given xen_vdi_type_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vdi_type_set_free(xen_vdi_type_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_vdi_type_to_string(enum xen_vdi_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_vdi_type +xen_vdi_type_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vif.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2006-2007, 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_VIF_H +#define XEN_VIF_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_network_decl.h> +#include <xen/api/xen_string_set.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vif_decl.h> +#include <xen/api/xen_vif_metrics_decl.h> +#include <xen/api/xen_vm_decl.h> + + +/* + * The VIF class. + * + * A virtual network interface. + */ + + +/** + * Free the given xen_vif. The given handle must have been allocated + * by this library. + */ +extern void +xen_vif_free(xen_vif vif); + + +typedef struct xen_vif_set +{ + size_t size; + xen_vif *contents[]; +} xen_vif_set; + +/** + * Allocate a xen_vif_set of the given size. + */ +extern xen_vif_set * +xen_vif_set_alloc(size_t size); + +/** + * Free the given xen_vif_set. The given set must have been allocated + * by this library. + */ +extern void +xen_vif_set_free(xen_vif_set *set); + + +typedef struct xen_vif_record +{ + xen_vif handle; + char *uuid; + char *device; + struct xen_network_record_opt *network; + struct xen_vm_record_opt *vm; + char *mac; + int64_t mtu; + bool currently_attached; + int64_t status_code; + char *status_detail; + xen_string_string_map *runtime_properties; + char *qos_algorithm_type; + xen_string_string_map *qos_algorithm_params; + struct xen_string_set *qos_supported_algorithms; + struct xen_vif_metrics_record_opt *metrics; +} xen_vif_record; + +/** + * Allocate a xen_vif_record. + */ +extern xen_vif_record * +xen_vif_record_alloc(void); + +/** + * Free the given xen_vif_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_vif_record_free(xen_vif_record *record); + + +typedef struct xen_vif_record_opt +{ + bool is_record; + union + { + xen_vif handle; + xen_vif_record *record; + } u; +} xen_vif_record_opt; + +/** + * Allocate a xen_vif_record_opt. + */ +extern xen_vif_record_opt * +xen_vif_record_opt_alloc(void); + +/** + * Free the given xen_vif_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_vif_record_opt_free(xen_vif_record_opt *record_opt); + + +typedef struct xen_vif_record_set +{ + size_t size; + xen_vif_record *contents[]; +} xen_vif_record_set; + +/** + * Allocate a xen_vif_record_set of the given size. + */ +extern xen_vif_record_set * +xen_vif_record_set_alloc(size_t size); + +/** + * Free the given xen_vif_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_vif_record_set_free(xen_vif_record_set *set); + + + +typedef struct xen_vif_record_opt_set +{ + size_t size; + xen_vif_record_opt *contents[]; +} xen_vif_record_opt_set; + +/** + * Allocate a xen_vif_record_opt_set of the given size. + */ +extern xen_vif_record_opt_set * +xen_vif_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vif_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_vif_record_opt_set_free(xen_vif_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VIF. + */ +extern bool +xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif); + + +/** + * Get a reference to the VIF instance with the specified UUID. + */ +extern bool +xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid); + + +/** + * Create a new VIF instance, and return its handle. + */ +extern bool +xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record); + + +/** + * Destroy the specified VIF instance. + */ +extern bool +xen_vif_destroy(xen_session *session, xen_vif vif); + + +/** + * Get the uuid field of the given VIF. + */ +extern bool +xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif); + + +/** + * Get the device field of the given VIF. + */ +extern bool +xen_vif_get_device(xen_session *session, char **result, xen_vif vif); + + +/** + * Get the network field of the given VIF. + */ +extern bool +xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif); + + +/** + * Get the VM field of the given VIF. + */ +extern bool +xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif); + + +/** + * Get the MAC field of the given VIF. + */ +extern bool +xen_vif_get_mac(xen_session *session, char **result, xen_vif vif); + + +/** + * Get the MTU field of the given VIF. + */ +extern bool +xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif); + + +/** + * Get the currently_attached field of the given VIF. + */ +extern bool +xen_vif_get_currently_attached(xen_session *session, bool *result, xen_vif vif); + + +/** + * Get the status_code field of the given VIF. + */ +extern bool +xen_vif_get_status_code(xen_session *session, int64_t *result, xen_vif vif); + + +/** + * Get the status_detail field of the given VIF. + */ +extern bool +xen_vif_get_status_detail(xen_session *session, char **result, xen_vif vif); + + +/** + * Get the runtime_properties field of the given VIF. + */ +extern bool +xen_vif_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vif vif); + + +/** + * Get the qos/algorithm_type field of the given VIF. + */ +extern bool +xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif); + + +/** + * Get the qos/algorithm_params field of the given VIF. + */ +extern bool +xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif); + + +/** + * Get the qos/supported_algorithms field of the given VIF. + */ +extern bool +xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif); + + +/** + * Get the metrics field of the given VIF. + */ +extern bool +xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif); + + +/** + * Set the device field of the given VIF. + */ +extern bool +xen_vif_set_device(xen_session *session, xen_vif vif, char *device); + + +/** + * Set the MAC field of the given VIF. + */ +extern bool +xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac); + + +/** + * Set the MTU field of the given VIF. + */ +extern bool +xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu); + + +/** + * Set the qos/algorithm_type field of the given VIF. + */ +extern bool +xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type); + + +/** + * Set the qos/algorithm_params field of the given VIF. + */ +extern bool +xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params); + + +/** + * Add the given key-value pair to the qos/algorithm_params field of + * the given VIF. + */ +extern bool +xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * qos/algorithm_params field of the given VIF. If the key is not in that + * Map, then do nothing. + */ +extern bool +xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key); + + +/** + * Hotplug the specified VIF, dynamically attaching it to the running + * VM. + */ +extern bool +xen_vif_plug(xen_session *session, xen_vif self); + + +/** + * Hot-unplug the specified VIF, dynamically unattaching it from the + * running VM. + */ +extern bool +xen_vif_unplug(xen_session *session, xen_vif self); + + +/** + * Return a list of all the VIFs known to the system. + */ +extern bool +xen_vif_get_all(xen_session *session, struct xen_vif_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vif_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vif_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VIF_DECL_H +#define XEN_VIF_DECL_H + +typedef void *xen_vif; + +struct xen_vif_set; +struct xen_vif_record; +struct xen_vif_record_set; +struct xen_vif_record_opt; +struct xen_vif_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vif_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vif_metrics.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2006-2007, 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_VIF_METRICS_H +#define XEN_VIF_METRICS_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_vif_metrics_decl.h> + + +/* + * The VIF_metrics class. + * + * The metrics associated with a virtual network device. + */ + + +/** + * Free the given xen_vif_metrics. The given handle must have been + * allocated by this library. + */ +extern void +xen_vif_metrics_free(xen_vif_metrics vif_metrics); + + +typedef struct xen_vif_metrics_set +{ + size_t size; + xen_vif_metrics *contents[]; +} xen_vif_metrics_set; + +/** + * Allocate a xen_vif_metrics_set of the given size. + */ +extern xen_vif_metrics_set * +xen_vif_metrics_set_alloc(size_t size); + +/** + * Free the given xen_vif_metrics_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vif_metrics_set_free(xen_vif_metrics_set *set); + + +typedef struct xen_vif_metrics_record +{ + xen_vif_metrics handle; + char *uuid; + double io_read_kbs; + double io_write_kbs; + time_t last_updated; +} xen_vif_metrics_record; + +/** + * Allocate a xen_vif_metrics_record. + */ +extern xen_vif_metrics_record * +xen_vif_metrics_record_alloc(void); + +/** + * Free the given xen_vif_metrics_record, and all referenced values. + * The given record must have been allocated by this library. + */ +extern void +xen_vif_metrics_record_free(xen_vif_metrics_record *record); + + +typedef struct xen_vif_metrics_record_opt +{ + bool is_record; + union + { + xen_vif_metrics handle; + xen_vif_metrics_record *record; + } u; +} xen_vif_metrics_record_opt; + +/** + * Allocate a xen_vif_metrics_record_opt. + */ +extern xen_vif_metrics_record_opt * +xen_vif_metrics_record_opt_alloc(void); + +/** + * Free the given xen_vif_metrics_record_opt, and all referenced + * values. The given record_opt must have been allocated by this library. + */ +extern void +xen_vif_metrics_record_opt_free(xen_vif_metrics_record_opt *record_opt); + + +typedef struct xen_vif_metrics_record_set +{ + size_t size; + xen_vif_metrics_record *contents[]; +} xen_vif_metrics_record_set; + +/** + * Allocate a xen_vif_metrics_record_set of the given size. + */ +extern xen_vif_metrics_record_set * +xen_vif_metrics_record_set_alloc(size_t size); + +/** + * Free the given xen_vif_metrics_record_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_vif_metrics_record_set_free(xen_vif_metrics_record_set *set); + + + +typedef struct xen_vif_metrics_record_opt_set +{ + size_t size; + xen_vif_metrics_record_opt *contents[]; +} xen_vif_metrics_record_opt_set; + +/** + * Allocate a xen_vif_metrics_record_opt_set of the given size. + */ +extern xen_vif_metrics_record_opt_set * +xen_vif_metrics_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vif_metrics_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_vif_metrics_record_opt_set_free(xen_vif_metrics_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VIF_metrics. + */ +extern bool +xen_vif_metrics_get_record(xen_session *session, xen_vif_metrics_record **result, xen_vif_metrics vif_metrics); + + +/** + * Get a reference to the VIF_metrics instance with the specified UUID. + */ +extern bool +xen_vif_metrics_get_by_uuid(xen_session *session, xen_vif_metrics *result, char *uuid); + + +/** + * Get the uuid field of the given VIF_metrics. + */ +extern bool +xen_vif_metrics_get_uuid(xen_session *session, char **result, xen_vif_metrics vif_metrics); + + +/** + * Get the io/read_kbs field of the given VIF_metrics. + */ +extern bool +xen_vif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics); + + +/** + * Get the io/write_kbs field of the given VIF_metrics. + */ +extern bool +xen_vif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics); + + +/** + * Get the last_updated field of the given VIF_metrics. + */ +extern bool +xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, xen_vif_metrics vif_metrics); + + +/** + * Return a list of all the VIF_metrics instances known to the system. + */ +extern bool +xen_vif_metrics_get_all(xen_session *session, struct xen_vif_metrics_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vif_metrics_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vif_metrics_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VIF_METRICS_DECL_H +#define XEN_VIF_METRICS_DECL_H + +typedef void *xen_vif_metrics; + +struct xen_vif_metrics_set; +struct xen_vif_metrics_record; +struct xen_vif_metrics_record_set; +struct xen_vif_metrics_record_opt; +struct xen_vif_metrics_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,894 @@ +/* + * Copyright (c) 2006-2007, 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_VM_H +#define XEN_VM_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_console_decl.h> +#include <xen/api/xen_crashdump_decl.h> +#include <xen/api/xen_host_decl.h> +#include <xen/api/xen_on_crash_behaviour.h> +#include <xen/api/xen_on_normal_exit.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vbd_decl.h> +#include <xen/api/xen_vdi_decl.h> +#include <xen/api/xen_vif_decl.h> +#include <xen/api/xen_vm_decl.h> +#include <xen/api/xen_vm_guest_metrics_decl.h> +#include <xen/api/xen_vm_metrics_decl.h> +#include <xen/api/xen_vm_power_state.h> +#include <xen/api/xen_vtpm_decl.h> + + +/* + * The VM class. + * + * A virtual machine (or 'guest'). + */ + + +/** + * Free the given xen_vm. The given handle must have been allocated by + * this library. + */ +extern void +xen_vm_free(xen_vm vm); + + +typedef struct xen_vm_set +{ + size_t size; + xen_vm *contents[]; +} xen_vm_set; + +/** + * Allocate a xen_vm_set of the given size. + */ +extern xen_vm_set * +xen_vm_set_alloc(size_t size); + +/** + * Free the given xen_vm_set. The given set must have been allocated + * by this library. + */ +extern void +xen_vm_set_free(xen_vm_set *set); + + +typedef struct xen_vm_record +{ + xen_vm handle; + char *uuid; + enum xen_vm_power_state power_state; + char *name_label; + char *name_description; + int64_t user_version; + bool is_a_template; + bool auto_power_on; + struct xen_vdi_record_opt *suspend_vdi; + struct xen_host_record_opt *resident_on; + int64_t memory_static_max; + int64_t memory_dynamic_max; + int64_t memory_dynamic_min; + int64_t memory_static_min; + xen_string_string_map *vcpus_params; + int64_t vcpus_max; + int64_t vcpus_at_startup; + enum xen_on_normal_exit actions_after_shutdown; + enum xen_on_normal_exit actions_after_reboot; + enum xen_on_crash_behaviour actions_after_crash; + struct xen_console_record_opt_set *consoles; + struct xen_vif_record_opt_set *vifs; + struct xen_vbd_record_opt_set *vbds; + struct xen_crashdump_record_opt_set *crash_dumps; + struct xen_vtpm_record_opt_set *vtpms; + char *pv_bootloader; + char *pv_kernel; + char *pv_ramdisk; + char *pv_args; + char *pv_bootloader_args; + char *hvm_boot_policy; + xen_string_string_map *hvm_boot_params; + xen_string_string_map *platform; + char *pci_bus; + xen_string_string_map *other_config; + int64_t domid; + bool is_control_domain; + struct xen_vm_metrics_record_opt *metrics; + struct xen_vm_guest_metrics_record_opt *guest_metrics; +} xen_vm_record; + +/** + * Allocate a xen_vm_record. + */ +extern xen_vm_record * +xen_vm_record_alloc(void); + +/** + * Free the given xen_vm_record, and all referenced values. The given + * record must have been allocated by this library. + */ +extern void +xen_vm_record_free(xen_vm_record *record); + + +typedef struct xen_vm_record_opt +{ + bool is_record; + union + { + xen_vm handle; + xen_vm_record *record; + } u; +} xen_vm_record_opt; + +/** + * Allocate a xen_vm_record_opt. + */ +extern xen_vm_record_opt * +xen_vm_record_opt_alloc(void); + +/** + * Free the given xen_vm_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_vm_record_opt_free(xen_vm_record_opt *record_opt); + + +typedef struct xen_vm_record_set +{ + size_t size; + xen_vm_record *contents[]; +} xen_vm_record_set; + +/** + * Allocate a xen_vm_record_set of the given size. + */ +extern xen_vm_record_set * +xen_vm_record_set_alloc(size_t size); + +/** + * Free the given xen_vm_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_vm_record_set_free(xen_vm_record_set *set); + + + +typedef struct xen_vm_record_opt_set +{ + size_t size; + xen_vm_record_opt *contents[]; +} xen_vm_record_opt_set; + +/** + * Allocate a xen_vm_record_opt_set of the given size. + */ +extern xen_vm_record_opt_set * +xen_vm_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vm_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_vm_record_opt_set_free(xen_vm_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VM. + */ +extern bool +xen_vm_get_record(xen_session *session, xen_vm_record **result, xen_vm vm); + + +/** + * Get a reference to the VM instance with the specified UUID. + */ +extern bool +xen_vm_get_by_uuid(xen_session *session, xen_vm *result, char *uuid); + + +/** + * Create a new VM instance, and return its handle. + */ +extern bool +xen_vm_create(xen_session *session, xen_vm *result, xen_vm_record *record); + + +/** + * Destroy the specified VM. The VM is completely removed from the + * system. This function can only be called when the VM is in the Halted + * State. + */ +extern bool +xen_vm_destroy(xen_session *session, xen_vm vm); + + +/** + * Get all the VM instances with the given label. + */ +extern bool +xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, char *label); + + +/** + * Get the uuid field of the given VM. + */ +extern bool +xen_vm_get_uuid(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the power_state field of the given VM. + */ +extern bool +xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result, xen_vm vm); + + +/** + * Get the name/label field of the given VM. + */ +extern bool +xen_vm_get_name_label(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the name/description field of the given VM. + */ +extern bool +xen_vm_get_name_description(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the user_version field of the given VM. + */ +extern bool +xen_vm_get_user_version(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the is_a_template field of the given VM. + */ +extern bool +xen_vm_get_is_a_template(xen_session *session, bool *result, xen_vm vm); + + +/** + * Get the auto_power_on field of the given VM. + */ +extern bool +xen_vm_get_auto_power_on(xen_session *session, bool *result, xen_vm vm); + + +/** + * Get the suspend_VDI field of the given VM. + */ +extern bool +xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm); + + +/** + * Get the resident_on field of the given VM. + */ +extern bool +xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm); + + +/** + * Get the memory/static_max field of the given VM. + */ +extern bool +xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the memory/dynamic_max field of the given VM. + */ +extern bool +xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the memory/dynamic_min field of the given VM. + */ +extern bool +xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the memory/static_min field of the given VM. + */ +extern bool +xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the VCPUs/params field of the given VM. + */ +extern bool +xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm); + + +/** + * Get the VCPUs/max field of the given VM. + */ +extern bool +xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the VCPUs/at_startup field of the given VM. + */ +extern bool +xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the actions/after_shutdown field of the given VM. + */ +extern bool +xen_vm_get_actions_after_shutdown(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm); + + +/** + * Get the actions/after_reboot field of the given VM. + */ +extern bool +xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm); + + +/** + * Get the actions/after_crash field of the given VM. + */ +extern bool +xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm); + + +/** + * Get the consoles field of the given VM. + */ +extern bool +xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_vm vm); + + +/** + * Get the VIFs field of the given VM. + */ +extern bool +xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm); + + +/** + * Get the VBDs field of the given VM. + */ +extern bool +xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm); + + +/** + * Get the crash_dumps field of the given VM. + */ +extern bool +xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm); + + +/** + * Get the VTPMs field of the given VM. + */ +extern bool +xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm); + + +/** + * Get the PV/bootloader field of the given VM. + */ +extern bool +xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the PV/kernel field of the given VM. + */ +extern bool +xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the PV/ramdisk field of the given VM. + */ +extern bool +xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the PV/args field of the given VM. + */ +extern bool +xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the PV/bootloader_args field of the given VM. + */ +extern bool +xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the HVM/boot_policy field of the given VM. + */ +extern bool +xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the HVM/boot_params field of the given VM. + */ +extern bool +xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm); + + +/** + * Get the platform field of the given VM. + */ +extern bool +xen_vm_get_platform(xen_session *session, xen_string_string_map **result, xen_vm vm); + + +/** + * Get the PCI_bus field of the given VM. + */ +extern bool +xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm vm); + + +/** + * Get the other_config field of the given VM. + */ +extern bool +xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm); + + +/** + * Get the domid field of the given VM. + */ +extern bool +xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm); + + +/** + * Get the is_control_domain field of the given VM. + */ +extern bool +xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm); + + +/** + * Get the metrics field of the given VM. + */ +extern bool +xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm); + + +/** + * Get the guest_metrics field of the given VM. + */ +extern bool +xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, xen_vm vm); + + +/** + * Set the name/label field of the given VM. + */ +extern bool +xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label); + + +/** + * Set the name/description field of the given VM. + */ +extern bool +xen_vm_set_name_description(xen_session *session, xen_vm vm, char *description); + + +/** + * Set the user_version field of the given VM. + */ +extern bool +xen_vm_set_user_version(xen_session *session, xen_vm vm, int64_t user_version); + + +/** + * Set the is_a_template field of the given VM. + */ +extern bool +xen_vm_set_is_a_template(xen_session *session, xen_vm vm, bool is_a_template); + + +/** + * Set the auto_power_on field of the given VM. + */ +extern bool +xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on); + + +/** + * Set the memory/static_max field of the given VM. + */ +extern bool +xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max); + + +/** + * Set the memory/dynamic_max field of the given VM. + */ +extern bool +xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max); + + +/** + * Set the memory/dynamic_min field of the given VM. + */ +extern bool +xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min); + + +/** + * Set the memory/static_min field of the given VM. + */ +extern bool +xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min); + + +/** + * Set the VCPUs/params field of the given VM. + */ +extern bool +xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params); + + +/** + * Add the given key-value pair to the VCPUs/params field of the given + * VM. + */ +extern bool +xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * VCPUs/params field of the given VM. If the key is not in that Map, then do + * nothing. + */ +extern bool +xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key); + + +/** + * Set the VCPUs/max field of the given VM. + */ +extern bool +xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max); + + +/** + * Set the VCPUs/at_startup field of the given VM. + */ +extern bool +xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup); + + +/** + * Set the actions/after_shutdown field of the given VM. + */ +extern bool +xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_shutdown); + + +/** + * Set the actions/after_reboot field of the given VM. + */ +extern bool +xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_reboot); + + +/** + * Set the actions/after_crash field of the given VM. + */ +extern bool +xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_crash_behaviour after_crash); + + +/** + * Set the PV/bootloader field of the given VM. + */ +extern bool +xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader); + + +/** + * Set the PV/kernel field of the given VM. + */ +extern bool +xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel); + + +/** + * Set the PV/ramdisk field of the given VM. + */ +extern bool +xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk); + + +/** + * Set the PV/args field of the given VM. + */ +extern bool +xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args); + + +/** + * Set the PV/bootloader_args field of the given VM. + */ +extern bool +xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char *bootloader_args); + + +/** + * Set the HVM/boot_policy field of the given VM. + */ +extern bool +xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy); + + +/** + * Set the HVM/boot_params field of the given VM. + */ +extern bool +xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params); + + +/** + * Add the given key-value pair to the HVM/boot_params field of the + * given VM. + */ +extern bool +xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * HVM/boot_params field of the given VM. If the key is not in that Map, then + * do nothing. + */ +extern bool +xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key); + + +/** + * Set the platform field of the given VM. + */ +extern bool +xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map *platform); + + +/** + * Add the given key-value pair to the platform field of the given VM. + */ +extern bool +xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the platform + * field of the given VM. If the key is not in that Map, then do nothing. + */ +extern bool +xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key); + + +/** + * Set the PCI_bus field of the given VM. + */ +extern bool +xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus); + + +/** + * Set the other_config field of the given VM. + */ +extern bool +xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config); + + +/** + * Add the given key-value pair to the other_config field of the given + * VM. + */ +extern bool +xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * other_config field of the given VM. If the key is not in that Map, then do + * nothing. + */ +extern bool +xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key); + + +/** + * Clones the specified VM, making a new VM. Clone automatically + * exploits the capabilities of the underlying storage repository in which the + * VM's disk images are stored (e.g. Copy on Write). This function can only + * be called when the VM is in the Halted State. + */ +extern bool +xen_vm_clone(xen_session *session, xen_vm *result, xen_vm vm, char *new_name); + + +/** + * Start the specified VM. This function can only be called with the + * VM is in the Halted State. + */ +extern bool +xen_vm_start(xen_session *session, xen_vm vm, bool start_paused); + + +/** + * Pause the specified VM. This can only be called when the specified + * VM is in the Running state. + */ +extern bool +xen_vm_pause(xen_session *session, xen_vm vm); + + +/** + * Resume the specified VM. This can only be called when the specified + * VM is in the Paused state. + */ +extern bool +xen_vm_unpause(xen_session *session, xen_vm vm); + + +/** + * Attempt to cleanly shutdown the specified VM. (Note: this may not be + * supported---e.g. if a guest agent is not installed). + * + * Once shutdown has been completed perform poweroff action specified in guest + * configuration. + * + * This can only be called when the specified VM is in the Running state. + */ +extern bool +xen_vm_clean_shutdown(xen_session *session, xen_vm vm); + + +/** + * Attempt to cleanly shutdown the specified VM (Note: this may not be + * supported---e.g. if a guest agent is not installed). + * + * Once shutdown has been completed perform reboot action specified in guest + * configuration. + * + * This can only be called when the specified VM is in the Running state. + */ +extern bool +xen_vm_clean_reboot(xen_session *session, xen_vm vm); + + +/** + * Stop executing the specified VM without attempting a clean shutdown. + * Then perform poweroff action specified in VM configuration. + */ +extern bool +xen_vm_hard_shutdown(xen_session *session, xen_vm vm); + + +/** + * Stop executing the specified VM without attempting a clean shutdown. + * Then perform reboot action specified in VM configuration + */ +extern bool +xen_vm_hard_reboot(xen_session *session, xen_vm vm); + + +/** + * Suspend the specified VM to disk. This can only be called when the + * specified VM is in the Running state. + */ +extern bool +xen_vm_suspend(xen_session *session, xen_vm vm); + + +/** + * Awaken the specified VM and resume it. This can only be called when + * the specified VM is in the Suspended state. + */ +extern bool +xen_vm_resume(xen_session *session, xen_vm vm, bool start_paused); + + +/** + * Set this VM's VCPUs/at_startup value, and set the same value on the + * VM, if running + */ +extern bool +xen_vm_set_vcpus_number_live(xen_session *session, xen_vm self, int64_t nvcpu); + + +/** + * Add the given key-value pair to VM.VCPUs_params, and apply that + * value on the running VM. + */ +extern bool +xen_vm_add_to_vcpus_params_live(xen_session *session, xen_vm self, char *key, char *value); + + +/** + * Set memory_dynamic_max in database and on running VM. + */ +extern bool +xen_vm_set_memory_dynamic_max_live(xen_session *session, xen_vm self, int64_t max); + + +/** + * Set memory_dynamic_min in database and on running VM. + */ +extern bool +xen_vm_set_memory_dynamic_min_live(xen_session *session, xen_vm self, int64_t min); + + +/** + * Send the given key as a sysrq to this VM. The key is specified as a + * single character (a String of length 1). This can only be called when the + * specified VM is in the Running state. + */ +extern bool +xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key); + + +/** + * Send the named trigger to this VM. This can only be called when the + * specified VM is in the Running state. + */ +extern bool +xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger); + + +/** + * Migrate the VM to another host. This can only be called when the + * specified VM is in the Running state. + */ +extern bool +xen_vm_migrate(xen_session *session, xen_vm vm, char *dest, bool live, xen_string_string_map *options); + + +/** + * Return a list of all the VMs known to the system. + */ +extern bool +xen_vm_get_all(xen_session *session, struct xen_vm_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VM_DECL_H +#define XEN_VM_DECL_H + +typedef void *xen_vm; + +struct xen_vm_set; +struct xen_vm_record; +struct xen_vm_record_set; +struct xen_vm_record_opt; +struct xen_vm_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm_guest_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm_guest_metrics.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2006-2007, 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_VM_GUEST_METRICS_H +#define XEN_VM_GUEST_METRICS_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vm_guest_metrics_decl.h> + + +/* + * The VM_guest_metrics class. + * + * The metrics reported by the guest (as opposed to inferred from outside). + */ + + +/** + * Free the given xen_vm_guest_metrics. The given handle must have + * been allocated by this library. + */ +extern void +xen_vm_guest_metrics_free(xen_vm_guest_metrics vm_guest_metrics); + + +typedef struct xen_vm_guest_metrics_set +{ + size_t size; + xen_vm_guest_metrics *contents[]; +} xen_vm_guest_metrics_set; + +/** + * Allocate a xen_vm_guest_metrics_set of the given size. + */ +extern xen_vm_guest_metrics_set * +xen_vm_guest_metrics_set_alloc(size_t size); + +/** + * Free the given xen_vm_guest_metrics_set. The given set must have + * been allocated by this library. + */ +extern void +xen_vm_guest_metrics_set_free(xen_vm_guest_metrics_set *set); + + +typedef struct xen_vm_guest_metrics_record +{ + xen_vm_guest_metrics handle; + char *uuid; + xen_string_string_map *os_version; + xen_string_string_map *pv_drivers_version; + xen_string_string_map *memory; + xen_string_string_map *disks; + xen_string_string_map *networks; + xen_string_string_map *other; + time_t last_updated; +} xen_vm_guest_metrics_record; + +/** + * Allocate a xen_vm_guest_metrics_record. + */ +extern xen_vm_guest_metrics_record * +xen_vm_guest_metrics_record_alloc(void); + +/** + * Free the given xen_vm_guest_metrics_record, and all referenced + * values. The given record must have been allocated by this library. + */ +extern void +xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record); + + +typedef struct xen_vm_guest_metrics_record_opt +{ + bool is_record; + union + { + xen_vm_guest_metrics handle; + xen_vm_guest_metrics_record *record; + } u; +} xen_vm_guest_metrics_record_opt; + +/** + * Allocate a xen_vm_guest_metrics_record_opt. + */ +extern xen_vm_guest_metrics_record_opt * +xen_vm_guest_metrics_record_opt_alloc(void); + +/** + * Free the given xen_vm_guest_metrics_record_opt, and all referenced + * values. The given record_opt must have been allocated by this library. + */ +extern void +xen_vm_guest_metrics_record_opt_free(xen_vm_guest_metrics_record_opt *record_opt); + + +typedef struct xen_vm_guest_metrics_record_set +{ + size_t size; + xen_vm_guest_metrics_record *contents[]; +} xen_vm_guest_metrics_record_set; + +/** + * Allocate a xen_vm_guest_metrics_record_set of the given size. + */ +extern xen_vm_guest_metrics_record_set * +xen_vm_guest_metrics_record_set_alloc(size_t size); + +/** + * Free the given xen_vm_guest_metrics_record_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_vm_guest_metrics_record_set_free(xen_vm_guest_metrics_record_set *set); + + + +typedef struct xen_vm_guest_metrics_record_opt_set +{ + size_t size; + xen_vm_guest_metrics_record_opt *contents[]; +} xen_vm_guest_metrics_record_opt_set; + +/** + * Allocate a xen_vm_guest_metrics_record_opt_set of the given size. + */ +extern xen_vm_guest_metrics_record_opt_set * +xen_vm_guest_metrics_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vm_guest_metrics_record_opt_set, and all + * referenced values. The given set must have been allocated by this library. + */ +extern void +xen_vm_guest_metrics_record_opt_set_free(xen_vm_guest_metrics_record_opt_set *set); + + +/** + * Get a record containing the current state of the given + * VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_record(xen_session *session, xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get a reference to the VM_guest_metrics instance with the specified + * UUID. + */ +extern bool +xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics *result, char *uuid); + + +/** + * Get the uuid field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the os_version field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_os_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the PV_drivers_version field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the memory field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the disks field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the networks field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the other field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Get the last_updated field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_guest_metrics vm_guest_metrics); + + +/** + * Return a list of all the VM_guest_metrics instances known to the + * system. + */ +extern bool +xen_vm_guest_metrics_get_all(xen_session *session, struct xen_vm_guest_metrics_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VM_GUEST_METRICS_DECL_H +#define XEN_VM_GUEST_METRICS_DECL_H + +typedef void *xen_vm_guest_metrics; + +struct xen_vm_guest_metrics_set; +struct xen_vm_guest_metrics_record; +struct xen_vm_guest_metrics_record_set; +struct xen_vm_guest_metrics_record_opt; +struct xen_vm_guest_metrics_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm_metrics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm_metrics.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2006-2007, 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_VM_METRICS_H +#define XEN_VM_METRICS_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_int_float_map.h> +#include <xen/api/xen_int_int_map.h> +#include <xen/api/xen_int_string_set_map.h> +#include <xen/api/xen_string_set.h> +#include <xen/api/xen_string_string_map.h> +#include <xen/api/xen_vm_metrics_decl.h> + + +/* + * The VM_metrics class. + * + * The metrics associated with a VM. + */ + + +/** + * Free the given xen_vm_metrics. The given handle must have been + * allocated by this library. + */ +extern void +xen_vm_metrics_free(xen_vm_metrics vm_metrics); + + +typedef struct xen_vm_metrics_set +{ + size_t size; + xen_vm_metrics *contents[]; +} xen_vm_metrics_set; + +/** + * Allocate a xen_vm_metrics_set of the given size. + */ +extern xen_vm_metrics_set * +xen_vm_metrics_set_alloc(size_t size); + +/** + * Free the given xen_vm_metrics_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vm_metrics_set_free(xen_vm_metrics_set *set); + + +typedef struct xen_vm_metrics_record +{ + xen_vm_metrics handle; + char *uuid; + int64_t memory_actual; + int64_t vcpus_number; + xen_int_float_map *vcpus_utilisation; + xen_int_int_map *vcpus_cpu; + xen_string_string_map *vcpus_params; + xen_int_string_set_map *vcpus_flags; + struct xen_string_set *state; + time_t start_time; + time_t last_updated; +} xen_vm_metrics_record; + +/** + * Allocate a xen_vm_metrics_record. + */ +extern xen_vm_metrics_record * +xen_vm_metrics_record_alloc(void); + +/** + * Free the given xen_vm_metrics_record, and all referenced values. + * The given record must have been allocated by this library. + */ +extern void +xen_vm_metrics_record_free(xen_vm_metrics_record *record); + + +typedef struct xen_vm_metrics_record_opt +{ + bool is_record; + union + { + xen_vm_metrics handle; + xen_vm_metrics_record *record; + } u; +} xen_vm_metrics_record_opt; + +/** + * Allocate a xen_vm_metrics_record_opt. + */ +extern xen_vm_metrics_record_opt * +xen_vm_metrics_record_opt_alloc(void); + +/** + * Free the given xen_vm_metrics_record_opt, and all referenced values. + * The given record_opt must have been allocated by this library. + */ +extern void +xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt); + + +typedef struct xen_vm_metrics_record_set +{ + size_t size; + xen_vm_metrics_record *contents[]; +} xen_vm_metrics_record_set; + +/** + * Allocate a xen_vm_metrics_record_set of the given size. + */ +extern xen_vm_metrics_record_set * +xen_vm_metrics_record_set_alloc(size_t size); + +/** + * Free the given xen_vm_metrics_record_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set); + + + +typedef struct xen_vm_metrics_record_opt_set +{ + size_t size; + xen_vm_metrics_record_opt *contents[]; +} xen_vm_metrics_record_opt_set; + +/** + * Allocate a xen_vm_metrics_record_opt_set of the given size. + */ +extern xen_vm_metrics_record_opt_set * +xen_vm_metrics_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vm_metrics_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics); + + +/** + * Get a reference to the VM_metrics instance with the specified UUID. + */ +extern bool +xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid); + + +/** + * Get the uuid field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics); + + +/** + * Get the memory/actual field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics); + + +/** + * Get the VCPUs/number field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics); + + +/** + * Get the VCPUs/utilisation field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics); + + +/** + * Get the VCPUs/CPU field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, xen_vm_metrics vm_metrics); + + +/** + * Get the VCPUs/params field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm_metrics vm_metrics); + + +/** + * Get the VCPUs/flags field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_vcpus_flags(xen_session *session, xen_int_string_set_map **result, xen_vm_metrics vm_metrics); + + +/** + * Get the state field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics); + + +/** + * Get the start_time field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics); + + +/** + * Get the last_updated field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_metrics vm_metrics); + + +/** + * Return a list of all the VM_metrics instances known to the system. + */ +extern bool +xen_vm_metrics_get_all(xen_session *session, struct xen_vm_metrics_set **result); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm_metrics_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm_metrics_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2007, 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_VM_METRICS_DECL_H +#define XEN_VM_METRICS_DECL_H + +typedef void *xen_vm_metrics; + +struct xen_vm_metrics_set; +struct xen_vm_metrics_record; +struct xen_vm_metrics_record_set; +struct xen_vm_metrics_record_opt; +struct xen_vm_metrics_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vm_power_state.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vm_power_state.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2006-2007, 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_VM_POWER_STATE_H +#define XEN_VM_POWER_STATE_H + + +#include <xen/api/xen_common.h> + + +enum xen_vm_power_state +{ + /** + * Halted + */ + XEN_VM_POWER_STATE_HALTED, + + /** + * Paused + */ + XEN_VM_POWER_STATE_PAUSED, + + /** + * Running + */ + XEN_VM_POWER_STATE_RUNNING, + + /** + * Suspended + */ + XEN_VM_POWER_STATE_SUSPENDED, + + /** + * Some other unknown state + */ + XEN_VM_POWER_STATE_UNKNOWN +}; + + +typedef struct xen_vm_power_state_set +{ + size_t size; + enum xen_vm_power_state contents[]; +} xen_vm_power_state_set; + +/** + * Allocate a xen_vm_power_state_set of the given size. + */ +extern xen_vm_power_state_set * +xen_vm_power_state_set_alloc(size_t size); + +/** + * Free the given xen_vm_power_state_set. The given set must have been + * allocated by this library. + */ +extern void +xen_vm_power_state_set_free(xen_vm_power_state_set *set); + + +/** + * Return the name corresponding to the given code. This string must + * not be modified or freed. + */ +extern const char * +xen_vm_power_state_to_string(enum xen_vm_power_state 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_vm_power_state +xen_vm_power_state_from_string(xen_session *session, const char *str); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vtpm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vtpm.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2006-2007, XenSource Inc. + * Copyright (c) 2006, IBM Corp. + * + * 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_VTPM_H +#define XEN_VTPM_H + +#include <xen/api/xen_common.h> +#include <xen/api/xen_vm_decl.h> +#include <xen/api/xen_vtpm_decl.h> + + +/* + * The VTPM class. + * + * A virtual TPM device. + */ + + +/** + * Free the given xen_vtpm. The given handle must have been allocated + * by this library. + */ +extern void +xen_vtpm_free(xen_vtpm vtpm); + + +typedef struct xen_vtpm_set +{ + size_t size; + xen_vtpm *contents[]; +} xen_vtpm_set; + +/** + * Allocate a xen_vtpm_set of the given size. + */ +extern xen_vtpm_set * +xen_vtpm_set_alloc(size_t size); + +/** + * Free the given xen_vtpm_set. The given set must have been allocated + * by this library. + */ +extern void +xen_vtpm_set_free(xen_vtpm_set *set); + + +typedef struct xen_vtpm_record +{ + xen_vtpm handle; + char *uuid; + struct xen_vm_record_opt *vm; + struct xen_vm_record_opt *backend; +} xen_vtpm_record; + +/** + * Allocate a xen_vtpm_record. + */ +extern xen_vtpm_record * +xen_vtpm_record_alloc(void); + +/** + * Free the given xen_vtpm_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_vtpm_record_free(xen_vtpm_record *record); + + +typedef struct xen_vtpm_record_opt +{ + bool is_record; + union + { + xen_vtpm handle; + xen_vtpm_record *record; + } u; +} xen_vtpm_record_opt; + +/** + * Allocate a xen_vtpm_record_opt. + */ +extern xen_vtpm_record_opt * +xen_vtpm_record_opt_alloc(void); + +/** + * Free the given xen_vtpm_record_opt, and all referenced values. The + * given record_opt must have been allocated by this library. + */ +extern void +xen_vtpm_record_opt_free(xen_vtpm_record_opt *record_opt); + + +typedef struct xen_vtpm_record_set +{ + size_t size; + xen_vtpm_record *contents[]; +} xen_vtpm_record_set; + +/** + * Allocate a xen_vtpm_record_set of the given size. + */ +extern xen_vtpm_record_set * +xen_vtpm_record_set_alloc(size_t size); + +/** + * Free the given xen_vtpm_record_set, and all referenced values. The + * given set must have been allocated by this library. + */ +extern void +xen_vtpm_record_set_free(xen_vtpm_record_set *set); + + + +typedef struct xen_vtpm_record_opt_set +{ + size_t size; + xen_vtpm_record_opt *contents[]; +} xen_vtpm_record_opt_set; + +/** + * Allocate a xen_vtpm_record_opt_set of the given size. + */ +extern xen_vtpm_record_opt_set * +xen_vtpm_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_vtpm_record_opt_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_vtpm_record_opt_set_free(xen_vtpm_record_opt_set *set); + + +/** + * Get a record containing the current state of the given VTPM. + */ +extern bool +xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm); + + +/** + * Get a reference to the VTPM instance with the specified UUID. + */ +extern bool +xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid); + + +/** + * Create a new VTPM instance, and return its handle. + */ +extern bool +xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record); + + +/** + * Destroy the specified VTPM instance. + */ +extern bool +xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm); + + +/** + * Get the uuid field of the given VTPM. + */ +extern bool +xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm); + + +/** + * Get the VM field of the given VTPM. + */ +extern bool +xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm); + + +/** + * Get the backend field of the given VTPM. + */ +extern bool +xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm); + + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen/api/xen_vtpm_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen/api/xen_vtpm_decl.h Sat Apr 21 12:21:06 2007 -0700 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2006, XenSource Inc. + * Copyright (c) 2006, IBM Corp. + * + * 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_VTPM_DECL_H +#define XEN_VTPM_DECL_H + +typedef void *xen_vtpm; + +struct xen_vtpm_set; +struct xen_vtpm_record; +struct xen_vtpm_record_set; +struct xen_vtpm_record_opt; +struct xen_vtpm_record_opt_set; + +#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_common.h --- a/tools/libxen/include/xen_common.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* - * 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; - - -typedef struct xen_session_record -{ - char *uuid; - struct xen_host_record_opt *this_host; - char *this_user; - time_t last_active; -} xen_session_record; - - -/** - * Allocate a xen_session_record. - */ -extern xen_session_record * -xen_session_record_alloc(void); - - -/** - * Free the given xen_session_record, and all referenced values. The - * given record must have been allocated by this library. - */ -extern void -xen_session_record_free(xen_session_record *record); - - -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); - - -/** - * Clear any error condition recorded on this session. - */ -void -xen_session_clear_error(xen_session *session); - - -/** - * Get the UUID of the second given session. Set *result to point at a - * string, yours to free. - */ -extern bool -xen_session_get_uuid(xen_session *session, char **result, - xen_session *self_session); - - -/** - * Get the this_host field of the second given session. Set *result to be a - * handle to that host. - */ -extern bool -xen_session_get_this_host(xen_session *session, xen_host *result, - xen_session *self_session); - - -/** - * Get the this_user field of the second given session. Set *result to point - * at a string, yours to free. - */ -extern bool -xen_session_get_this_user(xen_session *session, char **result, - xen_session *self_session); - - -/** - * Get the last_active field of the given session, and place it in *result. - */ -extern bool -xen_session_get_last_active(xen_session *session, time_t *result, - xen_session *self_session); - -/** - * Get a record containing the current state of the second given session. - */ -extern bool -xen_session_get_record(xen_session *session, xen_session_record **result, - xen_session *self_session); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_console.h --- a/tools/libxen/include/xen_console.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_CONSOLE_H -#define XEN_CONSOLE_H - -#include "xen_common.h" -#include "xen_console_decl.h" -#include "xen_console_protocol.h" -#include "xen_string_string_map.h" -#include "xen_vm_decl.h" - - -/* - * The console class. - * - * A console. - */ - - -/** - * Free the given xen_console. The given handle must have been - * allocated by this library. - */ -extern void -xen_console_free(xen_console console); - - -typedef struct xen_console_set -{ - size_t size; - xen_console *contents[]; -} xen_console_set; - -/** - * Allocate a xen_console_set of the given size. - */ -extern xen_console_set * -xen_console_set_alloc(size_t size); - -/** - * Free the given xen_console_set. The given set must have been - * allocated by this library. - */ -extern void -xen_console_set_free(xen_console_set *set); - - -typedef struct xen_console_record -{ - xen_console handle; - char *uuid; - enum xen_console_protocol protocol; - char *location; - struct xen_vm_record_opt *vm; - xen_string_string_map *other_config; -} xen_console_record; - -/** - * Allocate a xen_console_record. - */ -extern xen_console_record * -xen_console_record_alloc(void); - -/** - * Free the given xen_console_record, and all referenced values. The - * given record must have been allocated by this library. - */ -extern void -xen_console_record_free(xen_console_record *record); - - -typedef struct xen_console_record_opt -{ - bool is_record; - union - { - xen_console handle; - xen_console_record *record; - } u; -} xen_console_record_opt; - -/** - * Allocate a xen_console_record_opt. - */ -extern xen_console_record_opt * -xen_console_record_opt_alloc(void); - -/** - * Free the given xen_console_record_opt, and all referenced values. - * The given record_opt must have been allocated by this library. - */ -extern void -xen_console_record_opt_free(xen_console_record_opt *record_opt); - - -typedef struct xen_console_record_set -{ - size_t size; - xen_console_record *contents[]; -} xen_console_record_set; - -/** - * Allocate a xen_console_record_set of the given size. - */ -extern xen_console_record_set * -xen_console_record_set_alloc(size_t size); - -/** - * Free the given xen_console_record_set, and all referenced values. - * The given set must have been allocated by this library. - */ -extern void -xen_console_record_set_free(xen_console_record_set *set); - - - -typedef struct xen_console_record_opt_set -{ - size_t size; - xen_console_record_opt *contents[]; -} xen_console_record_opt_set; - -/** - * Allocate a xen_console_record_opt_set of the given size. - */ -extern xen_console_record_opt_set * -xen_console_record_opt_set_alloc(size_t size); - -/** - * Free the given xen_console_record_opt_set, and all referenced - * values. The given set must have been allocated by this library. - */ -extern void -xen_console_record_opt_set_free(xen_console_record_opt_set *set); - - -/** - * Get a record containing the current state of the given console. - */ -extern bool -xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console); - - -/** - * Get a reference to the console instance with the specified UUID. - */ -extern bool -xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid); - - -/** - * Create a new console instance, and return its handle. - */ -extern bool -xen_console_create(xen_session *session, xen_console *result, xen_console_record *record); - - -/** - * Destroy the specified console instance. - */ -extern bool -xen_console_destroy(xen_session *session, xen_console console); - - -/** - * Get the uuid field of the given console. - */ -extern bool -xen_console_get_uuid(xen_session *session, char **result, xen_console console); - - -/** - * Get the protocol field of the given console. - */ -extern bool -xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console); - - -/** - * Get the location field of the given console. - */ -extern bool -xen_console_get_location(xen_session *session, char **result, xen_console console); - - -/** - * Get the VM field of the given console. - */ -extern bool -xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console); - - -/** - * Get the other_config field of the given console. - */ -extern bool -xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console); - - -/** - * Set the other_config field of the given console. - */ -extern bool -xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config); - - -/** - * Add the given key-value pair to the other_config field of the given - * console. - */ -extern bool -xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value); - - -/** - * Remove the given key and its corresponding value from the - * other_config field of the given console. If the key is not in that Map, - * then do nothing. - */ -extern bool -xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key); - - -/** - * Return a list of all the consoles known to the system. - */ -extern bool -xen_console_get_all(xen_session *session, struct xen_console_set **result); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_console_decl.h --- a/tools/libxen/include/xen_console_decl.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * 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_CONSOLE_DECL_H -#define XEN_CONSOLE_DECL_H - -typedef void *xen_console; - -struct xen_console_set; -struct xen_console_record; -struct xen_console_record_set; -struct xen_console_record_opt; -struct xen_console_record_opt_set; - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_console_protocol.h --- a/tools/libxen/include/xen_console_protocol.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * 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_CONSOLE_PROTOCOL_H -#define XEN_CONSOLE_PROTOCOL_H - - -#include "xen_common.h" - - -enum xen_console_protocol -{ - /** - * VT100 terminal - */ - XEN_CONSOLE_PROTOCOL_VT100, - - /** - * Remote FrameBuffer protocol (as used in VNC) - */ - XEN_CONSOLE_PROTOCOL_RFB, - - /** - * Remote Desktop Protocol - */ - XEN_CONSOLE_PROTOCOL_RDP -}; - - -typedef struct xen_console_protocol_set -{ - size_t size; - enum xen_console_protocol contents[]; -} xen_console_protocol_set; - -/** - * Allocate a xen_console_protocol_set of the given size. - */ -extern xen_console_protocol_set * -xen_console_protocol_set_alloc(size_t size); - -/** - * Free the given xen_console_protocol_set. The given set must have - * been allocated by this library. - */ -extern void -xen_console_protocol_set_free(xen_console_protocol_set *set); - - -/** - * Return the name corresponding to the given code. This string must - * not be modified or freed. - */ -extern const char * -xen_console_protocol_to_string(enum xen_console_protocol 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_console_protocol -xen_console_protocol_from_string(xen_session *session, const char *str); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_console_protocol_internal.h --- a/tools/libxen/include/xen_console_protocol_internal.h Mon Apr 16 19:19:07 2007 -0400 +++ b/tools/libxen/include/xen_console_protocol_internal.h Sat Apr 21 12:21:06 2007 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, XenSource Inc. + * Copyright (c) 2006-2007, XenSource Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_crashdump.h --- a/tools/libxen/include/xen_crashdump.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_CRASHDUMP_H -#define XEN_CRASHDUMP_H - -#include "xen_common.h" -#include "xen_crashdump_decl.h" -#include "xen_vdi_decl.h" -#include "xen_vm_decl.h" - - -/* - * The crashdump class. - * - * A VM crashdump. - */ - - -/** - * Free the given xen_crashdump. The given handle must have been - * allocated by this library. - */ -extern void -xen_crashdump_free(xen_crashdump crashdump); - - -typedef struct xen_crashdump_set -{ - size_t size; - xen_crashdump *contents[]; -} xen_crashdump_set; - -/** - * Allocate a xen_crashdump_set of the given size. - */ -extern xen_crashdump_set * -xen_crashdump_set_alloc(size_t size); - -/** - * Free the given xen_crashdump_set. The given set must have been - * allocated by this library. - */ -extern void -xen_crashdump_set_free(xen_crashdump_set *set); - - -typedef struct xen_crashdump_record -{ - xen_crashdump handle; - char *uuid; - struct xen_vm_record_opt *vm; - struct xen_vdi_record_opt *vdi; -} xen_crashdump_record; - -/** - * Allocate a xen_crashdump_record. - */ -extern xen_crashdump_record * -xen_crashdump_record_alloc(void); - -/** - * Free the given xen_crashdump_record, and all referenced values. The - * given record must have been allocated by this library. - */ -extern void -xen_crashdump_record_free(xen_crashdump_record *record); - - -typedef struct xen_crashdump_record_opt -{ - bool is_record; - union - { - xen_crashdump handle; - xen_crashdump_record *record; - } u; -} xen_crashdump_record_opt; - -/** - * Allocate a xen_crashdump_record_opt. - */ -extern xen_crashdump_record_opt * -xen_crashdump_record_opt_alloc(void); - -/** - * Free the given xen_crashdump_record_opt, and all referenced values. - * The given record_opt must have been allocated by this library. - */ -extern void -xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt); - - -typedef struct xen_crashdump_record_set -{ - size_t size; - xen_crashdump_record *contents[]; -} xen_crashdump_record_set; - -/** - * Allocate a xen_crashdump_record_set of the given size. - */ -extern xen_crashdump_record_set * -xen_crashdump_record_set_alloc(size_t size); - -/** - * Free the given xen_crashdump_record_set, and all referenced values. - * The given set must have been allocated by this library. - */ -extern void -xen_crashdump_record_set_free(xen_crashdump_record_set *set); - - - -typedef struct xen_crashdump_record_opt_set -{ - size_t size; - xen_crashdump_record_opt *contents[]; -} xen_crashdump_record_opt_set; - -/** - * Allocate a xen_crashdump_record_opt_set of the given size. - */ -extern xen_crashdump_record_opt_set * -xen_crashdump_record_opt_set_alloc(size_t size); - -/** - * Free the given xen_crashdump_record_opt_set, and all referenced - * values. The given set must have been allocated by this library. - */ -extern void -xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set); - - -/** - * Get a record containing the current state of the given crashdump. - */ -extern bool -xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump); - - -/** - * Get a reference to the crashdump instance with the specified UUID. - */ -extern bool -xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid); - - -/** - * Get the uuid field of the given crashdump. - */ -extern bool -xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump); - - -/** - * Get the VM field of the given crashdump. - */ -extern bool -xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump); - - -/** - * Get the VDI field of the given crashdump. - */ -extern bool -xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump); - - -/** - * Destroy the specified crashdump - */ -extern bool -xen_crashdump_destroy(xen_session *session, xen_crashdump self); - - -/** - * Return a list of all the crashdumps known to the system. - */ -extern bool -xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_crashdump_decl.h --- a/tools/libxen/include/xen_crashdump_decl.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * 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_CRASHDUMP_DECL_H -#define XEN_CRASHDUMP_DECL_H - -typedef void *xen_crashdump; - -struct xen_crashdump_set; -struct xen_crashdump_record; -struct xen_crashdump_record_set; -struct xen_crashdump_record_opt; -struct xen_crashdump_record_opt_set; - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_event.h --- a/tools/libxen/include/xen_event.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_EVENT_H -#define XEN_EVENT_H - -#include "xen_common.h" -#include "xen_event_decl.h" -#include "xen_event_operation.h" -#include "xen_string_set.h" - - -/* - * The event class. - * - * Asynchronous event registration and handling. - */ - - - -typedef struct xen_event_record -{ - int64_t id; - time_t timestamp; - char *class; - enum xen_event_operation operation; - char *ref; - char *obj_uuid; -} xen_event_record; - -/** - * Allocate a xen_event_record. - */ -extern xen_event_record * -xen_event_record_alloc(void); - -/** - * Free the given xen_event_record, and all referenced values. The - * given record must have been allocated by this library. - */ -extern void -xen_event_record_free(xen_event_record *record); - - -typedef struct xen_event_record_set -{ - size_t size; - xen_event_record *contents[]; -} xen_event_record_set; - -/** - * Allocate a xen_event_record_set of the given size. - */ -extern xen_event_record_set * -xen_event_record_set_alloc(size_t size); - -/** - * Free the given xen_event_record_set, and all referenced values. The - * given set must have been allocated by this library. - */ -extern void -xen_event_record_set_free(xen_event_record_set *set); - - -/** - * Registers this session with the event system. Specifying the empty - * list will register for all classes. - */ -extern bool -xen_event_register(xen_session *session, struct xen_string_set *classes); - - -/** - * Unregisters this session with the event system. - */ -extern bool -xen_event_unregister(xen_session *session, struct xen_string_set *classes); - - -/** - * Blocking call which returns a (possibly empty) batch of events. - */ -extern bool -xen_event_next(xen_session *session, struct xen_event_record_set **result); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_event_decl.h --- a/tools/libxen/include/xen_event_decl.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_EVENT_DECL_H -#define XEN_EVENT_DECL_H - -struct xen_event_record; -struct xen_event_record_set; - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_event_operation.h --- a/tools/libxen/include/xen_event_operation.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_EVENT_OPERATION_H -#define XEN_EVENT_OPERATION_H - - -#include "xen_common.h" - - -enum xen_event_operation -{ - /** - * An object has been created - */ - XEN_EVENT_OPERATION_ADD, - - /** - * An object has been deleted - */ - XEN_EVENT_OPERATION_DEL, - - /** - * An object has been modified - */ - XEN_EVENT_OPERATION_MOD -}; - - -typedef struct xen_event_operation_set -{ - size_t size; - enum xen_event_operation contents[]; -} xen_event_operation_set; - -/** - * Allocate a xen_event_operation_set of the given size. - */ -extern xen_event_operation_set * -xen_event_operation_set_alloc(size_t size); - -/** - * Free the given xen_event_operation_set. The given set must have - * been allocated by this library. - */ -extern void -xen_event_operation_set_free(xen_event_operation_set *set); - - -/** - * Return the name corresponding to the given code. This string must - * not be modified or freed. - */ -extern const char * -xen_event_operation_to_string(enum xen_event_operation 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_event_operation -xen_event_operation_from_string(xen_session *session, const char *str); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_host.h --- a/tools/libxen/include/xen_host.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_HOST_H -#define XEN_HOST_H - -#include "xen_common.h" -#include "xen_host_cpu_decl.h" -#include "xen_host_decl.h" -#include "xen_host_metrics_decl.h" -#include "xen_pbd_decl.h" -#include "xen_pif_decl.h" -#include "xen_sr_decl.h" -#include "xen_string_set.h" -#include "xen_string_string_map.h" -#include "xen_vm_decl.h" - - -/* - * The host class. - * - * A physical host. - */ - - -/** - * Free the given xen_host. The given handle must have been allocated - * by this library. - */ -extern void -xen_host_free(xen_host host); - - -typedef struct xen_host_set -{ - size_t size; - xen_host *contents[]; -} xen_host_set; - -/** - * Allocate a xen_host_set of the given size. - */ -extern xen_host_set * -xen_host_set_alloc(size_t size); - -/** - * Free the given xen_host_set. The given set must have been allocated - * by this library. - */ -extern void -xen_host_set_free(xen_host_set *set); - - -typedef struct xen_host_record -{ - xen_host handle; - char *uuid; - char *name_label; - char *name_description; - int64_t api_version_major; - int64_t api_version_minor; - char *api_version_vendor; - xen_string_string_map *api_version_vendor_implementation; - bool enabled; - xen_string_string_map *software_version; - xen_string_string_map *other_config; - struct xen_string_set *capabilities; - xen_string_string_map *cpu_configuration; - char *sched_policy; - struct xen_string_set *supported_bootloaders; - struct xen_vm_record_opt_set *resident_vms; - xen_string_string_map *logging; - struct xen_pif_record_opt_set *pifs; - struct xen_sr_record_opt *suspend_image_sr; - struct xen_sr_record_opt *crash_dump_sr; - struct xen_pbd_record_opt_set *pbds; - struct xen_host_cpu_record_opt_set *host_cpus; - struct xen_host_metrics_record_opt *metrics; -} xen_host_record; - -/** - * Allocate a xen_host_record. - */ -extern xen_host_record * -xen_host_record_alloc(void); - -/** - * Free the given xen_host_record, and all referenced values. The - * given record must have been allocated by this library. - */ -extern void -xen_host_record_free(xen_host_record *record); - - -typedef struct xen_host_record_opt -{ - bool is_record; - union - { - xen_host handle; - xen_host_record *record; - } u; -} xen_host_record_opt; - -/** - * Allocate a xen_host_record_opt. - */ -extern xen_host_record_opt * -xen_host_record_opt_alloc(void); - -/** - * Free the given xen_host_record_opt, and all referenced values. The - * given record_opt must have been allocated by this library. - */ -extern void -xen_host_record_opt_free(xen_host_record_opt *record_opt); - - -typedef struct xen_host_record_set -{ - size_t size; - xen_host_record *contents[]; -} xen_host_record_set; - -/** - * Allocate a xen_host_record_set of the given size. - */ -extern xen_host_record_set * -xen_host_record_set_alloc(size_t size); - -/** - * Free the given xen_host_record_set, and all referenced values. The - * given set must have been allocated by this library. - */ -extern void -xen_host_record_set_free(xen_host_record_set *set); - - - -typedef struct xen_host_record_opt_set -{ - size_t size; - xen_host_record_opt *contents[]; -} xen_host_record_opt_set; - -/** - * Allocate a xen_host_record_opt_set of the given size. - */ -extern xen_host_record_opt_set * -xen_host_record_opt_set_alloc(size_t size); - -/** - * Free the given xen_host_record_opt_set, and all referenced values. - * The given set must have been allocated by this library. - */ -extern void -xen_host_record_opt_set_free(xen_host_record_opt_set *set); - - -/** - * Get a record containing the current state of the given host. - */ -extern bool -xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host); - - -/** - * Get a reference to the host instance with the specified UUID. - */ -extern bool -xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid); - - -/** - * Get all the host instances with the given label. - */ -extern bool -xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label); - - -/** - * Get the uuid field of the given host. - */ -extern bool -xen_host_get_uuid(xen_session *session, char **result, xen_host host); - - -/** - * Get the name/label field of the given host. - */ -extern bool -xen_host_get_name_label(xen_session *session, char **result, xen_host host); - - -/** - * Get the name/description field of the given host. - */ -extern bool -xen_host_get_name_description(xen_session *session, char **result, xen_host host); - - -/** - * Get the API_version/major field of the given host. - */ -extern bool -xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host); - - -/** - * Get the API_version/minor field of the given host. - */ -extern bool -xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host); - - -/** - * Get the API_version/vendor field of the given host. - */ -extern bool -xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host host); - - -/** - * Get the API_version/vendor_implementation field of the given host. - */ -extern bool -xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host); - - -/** - * Get the enabled field of the given host. - */ -extern bool -xen_host_get_enabled(xen_session *session, bool *result, xen_host host); - - -/** - * Get the software_version field of the given host. - */ -extern bool -xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host); - - -/** - * Get the other_config field of the given host. - */ -extern bool -xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host); - - -/** - * Get the capabilities field of the given host. - */ -extern bool -xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host); - - -/** - * Get the cpu_configuration field of the given host. - */ -extern bool -xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host); - - -/** - * Get the sched_policy field of the given host. - */ -extern bool -xen_host_get_sched_policy(xen_session *session, char **result, xen_host host); - - -/** - * Get the supported_bootloaders field of the given host. - */ -extern bool -xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host); - - -/** - * Get the resident_VMs field of the given host. - */ -extern bool -xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host); - - -/** - * Get the logging field of the given host. - */ -extern bool -xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host); - - -/** - * Get the PIFs field of the given host. - */ -extern bool -xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host); - - -/** - * Get the suspend_image_sr field of the given host. - */ -extern bool -xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host); - - -/** - * Get the crash_dump_sr field of the given host. - */ -extern bool -xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host); - - -/** - * Get the PBDs field of the given host. - */ -extern bool -xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host); - - -/** - * Get the host_CPUs field of the given host. - */ -extern bool -xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host); - - -/** - * Get the metrics field of the given host. - */ -extern bool -xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host); - - -/** - * Set the name/label field of the given host. - */ -extern bool -xen_host_set_name_label(xen_session *session, xen_host host, char *label); - - -/** - * Set the name/description field of the given host. - */ -extern bool -xen_host_set_name_description(xen_session *session, xen_host host, char *description); - - -/** - * Set the other_config field of the given host. - */ -extern bool -xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config); - - -/** - * Add the given key-value pair to the other_config field of the given - * host. - */ -extern bool -xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value); - - -/** - * Remove the given key and its corresponding value from the - * other_config field of the given host. If the key is not in that Map, then - * do nothing. - */ -extern bool -xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key); - - -/** - * Set the logging field of the given host. - */ -extern bool -xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging); - - -/** - * Add the given key-value pair to the logging field of the given host. - */ -extern bool -xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value); - - -/** - * Remove the given key and its corresponding value from the logging - * field of the given host. If the key is not in that Map, then do nothing. - */ -extern bool -xen_host_remove_from_logging(xen_session *session, xen_host host, char *key); - - -/** - * Set the suspend_image_sr field of the given host. - */ -extern bool -xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr); - - -/** - * Set the crash_dump_sr field of the given host. - */ -extern bool -xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr); - - -/** - * Puts the host into a state in which no new VMs can be started. - * Currently active VMs on the host continue to execute. - */ -extern bool -xen_host_disable(xen_session *session, xen_host host); - - -/** - * Puts the host into a state in which new VMs can be started. - */ -extern bool -xen_host_enable(xen_session *session, xen_host host); - - -/** - * Shutdown the host. (This function can only be called if there are no - * currently running VMs on the host and it is disabled.). - */ -extern bool -xen_host_shutdown(xen_session *session, xen_host host); - - -/** - * Reboot the host. (This function can only be called if there are no - * currently running VMs on the host and it is disabled.). - */ -extern bool -xen_host_reboot(xen_session *session, xen_host host); - - -/** - * Get the host xen dmesg. - */ -extern bool -xen_host_dmesg(xen_session *session, char **result, xen_host host); - - -/** - * Get the host xen dmesg, and clear the buffer. - */ -extern bool -xen_host_dmesg_clear(xen_session *session, char **result, xen_host host); - - -/** - * Get the host's log file. - */ -extern bool -xen_host_get_log(xen_session *session, char **result, xen_host host); - - -/** - * Inject the given string as debugging keys into Xen. - */ -extern bool -xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys); - - -/** - * List all supported methods. - */ -extern bool -xen_host_list_methods(xen_session *session, struct xen_string_set **result); - - -/** - * Return a list of all the hosts known to the system. - */ -extern bool -xen_host_get_all(xen_session *session, struct xen_host_set **result); - - -#endif diff -r 80304d79a78c -r 295858ddac87 tools/libxen/include/xen_host_cpu.h --- a/tools/libxen/include/xen_host_cpu.h Mon Apr 16 19:19:07 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2006-2007, 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_HOST_CPU_H -#define XEN_HOST_CPU_H - -#include "xen_common.h" -#include "xen_host_cpu_decl.h" -#include "xen_host_decl.h" - - -/* - * The host_cpu class. - * - * A physical CPU. - */ - - -/** - * Free the given xen_host_cpu. The given handle must have been - * allocated by this library. - */ -extern void -xen_host_cpu_free(xen_host_cpu host_cpu); - - -typedef struct xen_host_cpu_set -{ - size_t size; - xen_host_cpu *contents[]; -} xen_host_cpu_set; - -/** - * Allocate a xen_host_cpu_set of the given size. - */ -extern xen_host_cpu_set * -xen_host_cpu_set_alloc(size_t size); - -/** - * Free the given xen_host_cpu_set. The given set must have been - * allocated by this library. - */ -extern void -xen_host_cpu_set_free(xen_host_cpu_set *set); - - -typedef struct xen_host_cpu_record -{ - xen_host_cpu handle; - char *uuid; - struct xen_host_record_opt *host; - int64_t number; - char *vendor; - int64_t speed; - char *modelname; - char *stepping; - char *flags; - char *features; - double utilisation; -} xen_host_cpu_record; - -/** - * Allocate a xen_host_cpu_record. - */ -extern xen_host_cpu_record * -xen_host_cpu_record_alloc(void); - -/** - * Free the given xen_host_cpu_record, and all referenced values. The - * given record must have been allocated by this library. - */ -extern void -xen_host_cpu_record_free(xen_host_cpu_record *record); - - -typedef struct xen_host_cpu_record_opt -{ - bool is_record; - union - { - xen_host_cpu handle; - xen_host_cpu_record *record; - } u; -} xen_host_cpu_record_opt; - -/** - * Allocate a xen_host_cpu_record_opt. - */ -extern xen_host_cpu_record_opt * -xen_host_cpu_record_opt_alloc(void); - -/** - * Free the given xen_host_cpu_record_opt, and all referenced values. - * The given record_opt must have been allocated by this library. - */ -extern void -xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt); - - -typedef struct xen_host_cpu_record_set -{ - size_t size; - xen_host_cpu_record *contents[]; -} xen_host_cpu_record_set; - -/** - * Allocate a xen_host_cpu_record_set of the given size. - */ -extern xen_host_cpu_record_set * -xen_host_cpu_record_set_alloc(size_t size); - -/** _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |