From e83be1159570416909d74bca47175a30a13534f8 Mon Sep 17 00:00:00 2001 From: "ewan@localhost.localdomain" Date: Sat, 21 Apr 2007 12:21:06 -0700 Subject: 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 --- 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 + .../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 +++++ .../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 ++ .../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 + .../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 +++++ .../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 ++ .../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 +++++ .../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 +++++ .../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 + .../libxen/include/xen/api/xen_vm_guest_metrics.h | 234 ++++++ .../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_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 -- .../libxen/include/xen_console_protocol_internal.h | 2 +- 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_internal.h | 61 +- tools/libxen/include/xen_network.h | 276 ------- tools/libxen/include/xen_network_decl.h | 30 - tools/libxen/include/xen_on_crash_behaviour.h | 97 --- .../include/xen_on_crash_behaviour_internal.h | 2 +- tools/libxen/include/xen_on_normal_exit.h | 77 -- tools/libxen/include/xen_on_normal_exit_internal.h | 2 +- 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_mode_internal.h | 2 +- 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_vdi_type_internal.h | 2 +- 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_vm_power_state_internal.h | 2 +- tools/libxen/include/xen_vtpm.h | 198 ----- tools/libxen/include/xen_vtpm_decl.h | 31 - 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 +- tools/libxen/test/test_hvm_bindings.c | 445 ---------- 159 files changed, 8013 insertions(+), 8428 deletions(-) create mode 100644 tools/libxen/include/xen/api/xen_all.h create mode 100644 tools/libxen/include/xen/api/xen_common.h create mode 100644 tools/libxen/include/xen/api/xen_console.h create mode 100644 tools/libxen/include/xen/api/xen_console_decl.h create mode 100644 tools/libxen/include/xen/api/xen_console_protocol.h create mode 100644 tools/libxen/include/xen/api/xen_crashdump.h create mode 100644 tools/libxen/include/xen/api/xen_crashdump_decl.h create mode 100644 tools/libxen/include/xen/api/xen_event.h create mode 100644 tools/libxen/include/xen/api/xen_event_decl.h create mode 100644 tools/libxen/include/xen/api/xen_event_operation.h create mode 100644 tools/libxen/include/xen/api/xen_host.h create mode 100644 tools/libxen/include/xen/api/xen_host_cpu.h create mode 100644 tools/libxen/include/xen/api/xen_host_cpu_decl.h create mode 100644 tools/libxen/include/xen/api/xen_host_decl.h create mode 100644 tools/libxen/include/xen/api/xen_host_metrics.h create mode 100644 tools/libxen/include/xen/api/xen_host_metrics_decl.h create mode 100644 tools/libxen/include/xen/api/xen_int_float_map.h create mode 100644 tools/libxen/include/xen/api/xen_int_int_map.h create mode 100644 tools/libxen/include/xen/api/xen_int_string_set_map.h create mode 100644 tools/libxen/include/xen/api/xen_network.h create mode 100644 tools/libxen/include/xen/api/xen_network_decl.h create mode 100644 tools/libxen/include/xen/api/xen_on_crash_behaviour.h create mode 100644 tools/libxen/include/xen/api/xen_on_normal_exit.h create mode 100644 tools/libxen/include/xen/api/xen_pbd.h create mode 100644 tools/libxen/include/xen/api/xen_pbd_decl.h create mode 100644 tools/libxen/include/xen/api/xen_pif.h create mode 100644 tools/libxen/include/xen/api/xen_pif_decl.h create mode 100644 tools/libxen/include/xen/api/xen_pif_metrics.h create mode 100644 tools/libxen/include/xen/api/xen_pif_metrics_decl.h create mode 100644 tools/libxen/include/xen/api/xen_sr.h create mode 100644 tools/libxen/include/xen/api/xen_sr_decl.h create mode 100644 tools/libxen/include/xen/api/xen_string_set.h create mode 100644 tools/libxen/include/xen/api/xen_string_string_map.h create mode 100644 tools/libxen/include/xen/api/xen_user.h create mode 100644 tools/libxen/include/xen/api/xen_user_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vbd.h create mode 100644 tools/libxen/include/xen/api/xen_vbd_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vbd_metrics.h create mode 100644 tools/libxen/include/xen/api/xen_vbd_metrics_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vbd_mode.h create mode 100644 tools/libxen/include/xen/api/xen_vbd_type.h create mode 100644 tools/libxen/include/xen/api/xen_vdi.h create mode 100644 tools/libxen/include/xen/api/xen_vdi_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vdi_type.h create mode 100644 tools/libxen/include/xen/api/xen_vif.h create mode 100644 tools/libxen/include/xen/api/xen_vif_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vif_metrics.h create mode 100644 tools/libxen/include/xen/api/xen_vif_metrics_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vm.h create mode 100644 tools/libxen/include/xen/api/xen_vm_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vm_guest_metrics.h create mode 100644 tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vm_metrics.h create mode 100644 tools/libxen/include/xen/api/xen_vm_metrics_decl.h create mode 100644 tools/libxen/include/xen/api/xen_vm_power_state.h create mode 100644 tools/libxen/include/xen/api/xen_vtpm.h create mode 100644 tools/libxen/include/xen/api/xen_vtpm_decl.h delete mode 100644 tools/libxen/include/xen_common.h delete mode 100644 tools/libxen/include/xen_console.h delete mode 100644 tools/libxen/include/xen_console_decl.h delete mode 100644 tools/libxen/include/xen_console_protocol.h delete mode 100644 tools/libxen/include/xen_crashdump.h delete mode 100644 tools/libxen/include/xen_crashdump_decl.h delete mode 100644 tools/libxen/include/xen_event.h delete mode 100644 tools/libxen/include/xen_event_decl.h delete mode 100644 tools/libxen/include/xen_event_operation.h delete mode 100644 tools/libxen/include/xen_host.h delete mode 100644 tools/libxen/include/xen_host_cpu.h delete mode 100644 tools/libxen/include/xen_host_cpu_decl.h delete mode 100644 tools/libxen/include/xen_host_decl.h delete mode 100644 tools/libxen/include/xen_host_metrics.h delete mode 100644 tools/libxen/include/xen_host_metrics_decl.h delete mode 100644 tools/libxen/include/xen_int_float_map.h delete mode 100644 tools/libxen/include/xen_int_int_map.h delete mode 100644 tools/libxen/include/xen_int_string_set_map.h delete mode 100644 tools/libxen/include/xen_network.h delete mode 100644 tools/libxen/include/xen_network_decl.h delete mode 100644 tools/libxen/include/xen_on_crash_behaviour.h delete mode 100644 tools/libxen/include/xen_on_normal_exit.h delete mode 100644 tools/libxen/include/xen_pbd.h delete mode 100644 tools/libxen/include/xen_pbd_decl.h delete mode 100644 tools/libxen/include/xen_pif.h delete mode 100644 tools/libxen/include/xen_pif_decl.h delete mode 100644 tools/libxen/include/xen_pif_metrics.h delete mode 100644 tools/libxen/include/xen_pif_metrics_decl.h delete mode 100644 tools/libxen/include/xen_sr.h delete mode 100644 tools/libxen/include/xen_sr_decl.h delete mode 100644 tools/libxen/include/xen_string_set.h delete mode 100644 tools/libxen/include/xen_string_string_map.h delete mode 100644 tools/libxen/include/xen_user.h delete mode 100644 tools/libxen/include/xen_user_decl.h delete mode 100644 tools/libxen/include/xen_vbd.h delete mode 100644 tools/libxen/include/xen_vbd_decl.h delete mode 100644 tools/libxen/include/xen_vbd_metrics.h delete mode 100644 tools/libxen/include/xen_vbd_metrics_decl.h delete mode 100644 tools/libxen/include/xen_vbd_mode.h delete mode 100644 tools/libxen/include/xen_vbd_type.h delete mode 100644 tools/libxen/include/xen_vdi.h delete mode 100644 tools/libxen/include/xen_vdi_decl.h delete mode 100644 tools/libxen/include/xen_vdi_type.h delete mode 100644 tools/libxen/include/xen_vif.h delete mode 100644 tools/libxen/include/xen_vif_decl.h delete mode 100644 tools/libxen/include/xen_vif_metrics.h delete mode 100644 tools/libxen/include/xen_vif_metrics_decl.h delete mode 100644 tools/libxen/include/xen_vm.h delete mode 100644 tools/libxen/include/xen_vm_decl.h delete mode 100644 tools/libxen/include/xen_vm_guest_metrics.h delete mode 100644 tools/libxen/include/xen_vm_guest_metrics_decl.h delete mode 100644 tools/libxen/include/xen_vm_metrics.h delete mode 100644 tools/libxen/include/xen_vm_metrics_decl.h delete mode 100644 tools/libxen/include/xen_vm_power_state.h delete mode 100644 tools/libxen/include/xen_vtpm.h delete mode 100644 tools/libxen/include/xen_vtpm_decl.h delete mode 100644 tools/libxen/test/test_hvm_bindings.c (limited to 'tools/libxen') diff --git a/tools/libxen/Makefile b/tools/libxen/Makefile index 51062d7c5b..d91be3c33d 100644 --- a/tools/libxen/Makefile +++ b/tools/libxen/Makefile @@ -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=../.. 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.so.$(MAJOR).$(MINOR): $(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 --git a/tools/libxen/include/xen/api/xen_all.h b/tools/libxen/include/xen/api/xen_all.h new file mode 100644 index 0000000000..8f0c1b83bc --- /dev/null +++ b/tools/libxen/include/xen/api/xen_all.h @@ -0,0 +1,39 @@ +/* This file is autogenerated */ +#ifndef XEN_API_XEN_ALL_H +#define XEN_API_XEN_ALL_H +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif diff --git a/tools/libxen/include/xen/api/xen_common.h b/tools/libxen/include/xen/api/xen_common.h new file mode 100644 index 0000000000..89d92cacc4 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_common.h @@ -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 +#include +#include +#include + +#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 --git a/tools/libxen/include/xen/api/xen_console.h b/tools/libxen/include/xen/api/xen_console.h new file mode 100644 index 0000000000..19bfdeb082 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_console.h @@ -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 +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_console_decl.h b/tools/libxen/include/xen/api/xen_console_decl.h new file mode 100644 index 0000000000..432ff76919 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_console_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_console_protocol.h b/tools/libxen/include/xen/api/xen_console_protocol.h new file mode 100644 index 0000000000..413ad7aa9b --- /dev/null +++ b/tools/libxen/include/xen/api/xen_console_protocol.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_crashdump.h b/tools/libxen/include/xen/api/xen_crashdump.h new file mode 100644 index 0000000000..145e0419a7 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_crashdump.h @@ -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 +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_crashdump_decl.h b/tools/libxen/include/xen/api/xen_crashdump_decl.h new file mode 100644 index 0000000000..4eb6d5493f --- /dev/null +++ b/tools/libxen/include/xen/api/xen_crashdump_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_event.h b/tools/libxen/include/xen/api/xen_event.h new file mode 100644 index 0000000000..6a2845b4b2 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_event.h @@ -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 +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_event_decl.h b/tools/libxen/include/xen/api/xen_event_decl.h new file mode 100644 index 0000000000..856991fd09 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_event_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_event_operation.h b/tools/libxen/include/xen/api/xen_event_operation.h new file mode 100644 index 0000000000..31cce20b8a --- /dev/null +++ b/tools/libxen/include/xen/api/xen_event_operation.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_host.h b/tools/libxen/include/xen/api/xen_host.h new file mode 100644 index 0000000000..9ca40d700e --- /dev/null +++ b/tools/libxen/include/xen/api/xen_host.h @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_host_cpu.h b/tools/libxen/include/xen/api/xen_host_cpu.h new file mode 100644 index 0000000000..f1bdb7134f --- /dev/null +++ b/tools/libxen/include/xen/api/xen_host_cpu.h @@ -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 +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_host_cpu_decl.h b/tools/libxen/include/xen/api/xen_host_cpu_decl.h new file mode 100644 index 0000000000..1e9be29004 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_host_cpu_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_host_decl.h b/tools/libxen/include/xen/api/xen_host_decl.h new file mode 100644 index 0000000000..79d974b471 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_host_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_host_metrics.h b/tools/libxen/include/xen/api/xen_host_metrics.h new file mode 100644 index 0000000000..2055362672 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_host_metrics.h @@ -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 +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_host_metrics_decl.h b/tools/libxen/include/xen/api/xen_host_metrics_decl.h new file mode 100644 index 0000000000..8b73554e69 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_host_metrics_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_int_float_map.h b/tools/libxen/include/xen/api/xen_int_float_map.h new file mode 100644 index 0000000000..058c45e459 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_int_float_map.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_int_int_map.h b/tools/libxen/include/xen/api/xen_int_int_map.h new file mode 100644 index 0000000000..71295a62b8 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_int_int_map.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_int_string_set_map.h b/tools/libxen/include/xen/api/xen_int_string_set_map.h new file mode 100644 index 0000000000..bca1a6bb7e --- /dev/null +++ b/tools/libxen/include/xen/api/xen_int_string_set_map.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_network.h b/tools/libxen/include/xen/api/xen_network.h new file mode 100644 index 0000000000..bf8295afe0 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_network.h @@ -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 +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_network_decl.h b/tools/libxen/include/xen/api/xen_network_decl.h new file mode 100644 index 0000000000..dbfb3e919e --- /dev/null +++ b/tools/libxen/include/xen/api/xen_network_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_on_crash_behaviour.h b/tools/libxen/include/xen/api/xen_on_crash_behaviour.h new file mode 100644 index 0000000000..47792c6a01 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_on_crash_behaviour.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_on_normal_exit.h b/tools/libxen/include/xen/api/xen_on_normal_exit.h new file mode 100644 index 0000000000..cd5a813ff0 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_on_normal_exit.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_pbd.h b/tools/libxen/include/xen/api/xen_pbd.h new file mode 100644 index 0000000000..224d2d4a40 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_pbd.h @@ -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 +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_pbd_decl.h b/tools/libxen/include/xen/api/xen_pbd_decl.h new file mode 100644 index 0000000000..c7e324e94e --- /dev/null +++ b/tools/libxen/include/xen/api/xen_pbd_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_pif.h b/tools/libxen/include/xen/api/xen_pif.h new file mode 100644 index 0000000000..d36efd0699 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_pif.h @@ -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 +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_pif_decl.h b/tools/libxen/include/xen/api/xen_pif_decl.h new file mode 100644 index 0000000000..6d49bdb6c3 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_pif_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_pif_metrics.h b/tools/libxen/include/xen/api/xen_pif_metrics.h new file mode 100644 index 0000000000..06b9d268b4 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_pif_metrics.h @@ -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 +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_pif_metrics_decl.h b/tools/libxen/include/xen/api/xen_pif_metrics_decl.h new file mode 100644 index 0000000000..f6ef2fd276 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_pif_metrics_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_sr.h b/tools/libxen/include/xen/api/xen_sr.h new file mode 100644 index 0000000000..08204a29f6 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_sr.h @@ -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 +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_sr_decl.h b/tools/libxen/include/xen/api/xen_sr_decl.h new file mode 100644 index 0000000000..ae7d4f6b1c --- /dev/null +++ b/tools/libxen/include/xen/api/xen_sr_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_string_set.h b/tools/libxen/include/xen/api/xen_string_set.h new file mode 100644 index 0000000000..a14af9412b --- /dev/null +++ b/tools/libxen/include/xen/api/xen_string_set.h @@ -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 --git a/tools/libxen/include/xen/api/xen_string_string_map.h b/tools/libxen/include/xen/api/xen_string_string_map.h new file mode 100644 index 0000000000..d800442c90 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_string_string_map.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_user.h b/tools/libxen/include/xen/api/xen_user.h new file mode 100644 index 0000000000..a6d9dd99e5 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_user.h @@ -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 +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_user_decl.h b/tools/libxen/include/xen/api/xen_user_decl.h new file mode 100644 index 0000000000..723a8bfa68 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_user_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vbd.h b/tools/libxen/include/xen/api/xen_vbd.h new file mode 100644 index 0000000000..9806c5ee73 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vbd.h @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vbd_decl.h b/tools/libxen/include/xen/api/xen_vbd_decl.h new file mode 100644 index 0000000000..018af3b85d --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vbd_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vbd_metrics.h b/tools/libxen/include/xen/api/xen_vbd_metrics.h new file mode 100644 index 0000000000..1cb1a2bc85 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vbd_metrics.h @@ -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 +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vbd_metrics_decl.h b/tools/libxen/include/xen/api/xen_vbd_metrics_decl.h new file mode 100644 index 0000000000..501aa8f60c --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vbd_metrics_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vbd_mode.h b/tools/libxen/include/xen/api/xen_vbd_mode.h new file mode 100644 index 0000000000..8cab27ec73 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vbd_mode.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_vbd_type.h b/tools/libxen/include/xen/api/xen_vbd_type.h new file mode 100644 index 0000000000..d19aef83bf --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vbd_type.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_vdi.h b/tools/libxen/include/xen/api/xen_vdi.h new file mode 100644 index 0000000000..c40dcfc4be --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vdi.h @@ -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 +#include +#include +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vdi_decl.h b/tools/libxen/include/xen/api/xen_vdi_decl.h new file mode 100644 index 0000000000..13a328e044 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vdi_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vdi_type.h b/tools/libxen/include/xen/api/xen_vdi_type.h new file mode 100644 index 0000000000..d98a2abc51 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vdi_type.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_vif.h b/tools/libxen/include/xen/api/xen_vif.h new file mode 100644 index 0000000000..26608f0af9 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vif.h @@ -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 +#include +#include +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vif_decl.h b/tools/libxen/include/xen/api/xen_vif_decl.h new file mode 100644 index 0000000000..0d4c59d668 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vif_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vif_metrics.h b/tools/libxen/include/xen/api/xen_vif_metrics.h new file mode 100644 index 0000000000..a363137816 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vif_metrics.h @@ -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 +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vif_metrics_decl.h b/tools/libxen/include/xen/api/xen_vif_metrics_decl.h new file mode 100644 index 0000000000..5734723adf --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vif_metrics_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vm.h b/tools/libxen/include/xen/api/xen_vm.h new file mode 100644 index 0000000000..35448afd9f --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm.h @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vm_decl.h b/tools/libxen/include/xen/api/xen_vm_decl.h new file mode 100644 index 0000000000..f4ca986b62 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vm_guest_metrics.h b/tools/libxen/include/xen/api/xen_vm_guest_metrics.h new file mode 100644 index 0000000000..fd4d23a24c --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm_guest_metrics.h @@ -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 +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h b/tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h new file mode 100644 index 0000000000..837528b919 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vm_metrics.h b/tools/libxen/include/xen/api/xen_vm_metrics.h new file mode 100644 index 0000000000..128c1a3a3a --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm_metrics.h @@ -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 +#include +#include +#include +#include +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vm_metrics_decl.h b/tools/libxen/include/xen/api/xen_vm_metrics_decl.h new file mode 100644 index 0000000000..76810b5ba6 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm_metrics_decl.h @@ -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 --git a/tools/libxen/include/xen/api/xen_vm_power_state.h b/tools/libxen/include/xen/api/xen_vm_power_state.h new file mode 100644 index 0000000000..649f49a7f1 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vm_power_state.h @@ -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 + + +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 --git a/tools/libxen/include/xen/api/xen_vtpm.h b/tools/libxen/include/xen/api/xen_vtpm.h new file mode 100644 index 0000000000..920948d134 --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vtpm.h @@ -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 +#include +#include + + +/* + * 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 --git a/tools/libxen/include/xen/api/xen_vtpm_decl.h b/tools/libxen/include/xen/api/xen_vtpm_decl.h new file mode 100644 index 0000000000..7798e3856d --- /dev/null +++ b/tools/libxen/include/xen/api/xen_vtpm_decl.h @@ -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 --git a/tools/libxen/include/xen_common.h b/tools/libxen/include/xen_common.h deleted file mode 100644 index fc8d092e74..0000000000 --- a/tools/libxen/include/xen_common.h +++ /dev/null @@ -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 -#include -#include -#include - -#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 --git a/tools/libxen/include/xen_console.h b/tools/libxen/include/xen_console.h deleted file mode 100644 index 5402ae9fbe..0000000000 --- a/tools/libxen/include/xen_console.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_console_decl.h b/tools/libxen/include/xen_console_decl.h deleted file mode 100644 index 1392164593..0000000000 --- a/tools/libxen/include/xen_console_decl.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_console_protocol.h b/tools/libxen/include/xen_console_protocol.h deleted file mode 100644 index e6fcf62b4a..0000000000 --- a/tools/libxen/include/xen_console_protocol.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_console_protocol_internal.h b/tools/libxen/include/xen_console_protocol_internal.h index 70cdae37af..d2ddaa0319 100644 --- a/tools/libxen/include/xen_console_protocol_internal.h +++ b/tools/libxen/include/xen_console_protocol_internal.h @@ -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 --git a/tools/libxen/include/xen_crashdump.h b/tools/libxen/include/xen_crashdump.h deleted file mode 100644 index 00869dbb4c..0000000000 --- a/tools/libxen/include/xen_crashdump.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_crashdump_decl.h b/tools/libxen/include/xen_crashdump_decl.h deleted file mode 100644 index 3087715c4f..0000000000 --- a/tools/libxen/include/xen_crashdump_decl.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_event.h b/tools/libxen/include/xen_event.h deleted file mode 100644 index 1e171b8d26..0000000000 --- a/tools/libxen/include/xen_event.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_event_decl.h b/tools/libxen/include/xen_event_decl.h deleted file mode 100644 index 856991fd09..0000000000 --- a/tools/libxen/include/xen_event_decl.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_event_operation.h b/tools/libxen/include/xen_event_operation.h deleted file mode 100644 index 05319ef58a..0000000000 --- a/tools/libxen/include/xen_event_operation.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_host.h b/tools/libxen/include/xen_host.h deleted file mode 100644 index cb2c447fc4..0000000000 --- a/tools/libxen/include/xen_host.h +++ /dev/null @@ -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 --git a/tools/libxen/include/xen_host_cpu.h b/tools/libxen/include/xen_host_cpu.h deleted file mode 100644 index b484793782..0000000000 --- a/tools/libxen/include/xen_host_cpu.h +++ /dev/null @@ -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); - -/** - * 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 --git a/tools/libxen/include/xen_host_cpu_decl.h b/tools/libxen/include/xen_host_cpu_decl.h deleted file mode 100644 index 1d24953ecc..0000000000 --- a/tools/libxen/include/xen_host_cpu_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_host_decl.h b/tools/libxen/include/xen_host_decl.h deleted file mode 100644 index affb676869..0000000000 --- a/tools/libxen/include/xen_host_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_host_metrics.h b/tools/libxen/include/xen_host_metrics.h deleted file mode 100644 index 84121332c7..0000000000 --- a/tools/libxen/include/xen_host_metrics.h +++ /dev/null @@ -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_HOST_METRICS_H -#define XEN_HOST_METRICS_H - -#include "xen_common.h" -#include "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 --git a/tools/libxen/include/xen_host_metrics_decl.h b/tools/libxen/include/xen_host_metrics_decl.h deleted file mode 100644 index e9137160ed..0000000000 --- a/tools/libxen/include/xen_host_metrics_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_int_float_map.h b/tools/libxen/include/xen_int_float_map.h deleted file mode 100644 index 9cc4769d48..0000000000 --- a/tools/libxen/include/xen_int_float_map.h +++ /dev/null @@ -1,53 +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_INT_FLOAT_MAP_H -#define XEN_INT_FLOAT_MAP_H - - -#include "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 --git a/tools/libxen/include/xen_int_int_map.h b/tools/libxen/include/xen_int_int_map.h deleted file mode 100644 index 5d11e146b0..0000000000 --- a/tools/libxen/include/xen_int_int_map.h +++ /dev/null @@ -1,53 +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_INT_INT_MAP_H -#define XEN_INT_INT_MAP_H - - -#include "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 --git a/tools/libxen/include/xen_int_string_set_map.h b/tools/libxen/include/xen_int_string_set_map.h deleted file mode 100644 index 7a784fd070..0000000000 --- a/tools/libxen/include/xen_int_string_set_map.h +++ /dev/null @@ -1,53 +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_INT_STRING_SET_MAP_H -#define XEN_INT_STRING_SET_MAP_H - - -#include "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 --git a/tools/libxen/include/xen_internal.h b/tools/libxen/include/xen_internal.h index ea326b29de..21f75de5fe 100644 --- a/tools/libxen/include/xen_internal.h +++ b/tools/libxen/include/xen_internal.h @@ -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 @@ -24,7 +24,7 @@ #include #include -#include "xen_common.h" +#include enum abstract_typename @@ -147,7 +147,12 @@ type__ ## _free(type__ handle) \ } \ -#define XEN_SET_ALLOC_FREE(type__) \ +#define XEN_SET_ALLOC_FREE(type__) \ + XEN_SET_ALLOC(type__) \ + XEN_SET_FREE(type__) + + +#define XEN_SET_ALLOC(type__) \ type__ ## _set * \ type__ ## _set_alloc(size_t size) \ { \ @@ -155,43 +160,29 @@ type__ ## _set_alloc(size_t size) \ size * sizeof(type__)); \ result->size = size; \ return result; \ -} \ - \ -void \ -type__ ## _set_free(type__ ## _set *set) \ +} + + +#define XEN_SET_FREE(type__) \ +void type__ ## _set_free(type__ ## _set *set) \ { \ if (set == NULL) \ - { \ return; \ - } \ - size_t n = set->size; \ - for (size_t i = 0; i < n; i++) \ - { \ + for (size_t i = 0; i < set->size; i++) \ type__ ## _free(set->contents[i]); \ - } \ - \ free(set); \ -} \ - - -#define XEN_RECORD_OPT_FREE(type__) \ -void \ -type__ ## _record_opt_free(type__ ## _record_opt *opt) \ -{ \ - if (opt == NULL) \ - { \ - return; \ - } \ - if (opt->is_record) \ - { \ - type__ ## _record_free(opt->u.record); \ - } \ - else \ - { \ - type__ ## _free(opt->u.handle); \ - } \ - free(opt); \ -} \ +} + + +#define XEN_RECORD_OPT_FREE(type__) \ +void type__ ## _record_opt_free(type__ ## _record_opt *opt) { \ + if (opt == NULL) return; \ + if (opt->is_record) \ + type__ ## _record_free(opt->u.record); \ + else \ + type__ ## _free(opt->u.handle); \ + free(opt); \ +} #endif diff --git a/tools/libxen/include/xen_network.h b/tools/libxen/include/xen_network.h deleted file mode 100644 index 988495f2f4..0000000000 --- a/tools/libxen/include/xen_network.h +++ /dev/null @@ -1,276 +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_NETWORK_H -#define XEN_NETWORK_H - -#include "xen_common.h" -#include "xen_network_decl.h" -#include "xen_pif_decl.h" -#include "xen_string_string_map.h" -#include "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 --git a/tools/libxen/include/xen_network_decl.h b/tools/libxen/include/xen_network_decl.h deleted file mode 100644 index d970c2af15..0000000000 --- a/tools/libxen/include/xen_network_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_on_crash_behaviour.h b/tools/libxen/include/xen_on_crash_behaviour.h deleted file mode 100644 index 8286488659..0000000000 --- a/tools/libxen/include/xen_on_crash_behaviour.h +++ /dev/null @@ -1,97 +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_ON_CRASH_BEHAVIOUR_H -#define XEN_ON_CRASH_BEHAVIOUR_H - - -#include "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 --git a/tools/libxen/include/xen_on_crash_behaviour_internal.h b/tools/libxen/include/xen_on_crash_behaviour_internal.h index 012398b814..bd6f1faa7a 100644 --- a/tools/libxen/include/xen_on_crash_behaviour_internal.h +++ b/tools/libxen/include/xen_on_crash_behaviour_internal.h @@ -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 --git a/tools/libxen/include/xen_on_normal_exit.h b/tools/libxen/include/xen_on_normal_exit.h deleted file mode 100644 index 3897fef24c..0000000000 --- a/tools/libxen/include/xen_on_normal_exit.h +++ /dev/null @@ -1,77 +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_ON_NORMAL_EXIT_H -#define XEN_ON_NORMAL_EXIT_H - - -#include "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 --git a/tools/libxen/include/xen_on_normal_exit_internal.h b/tools/libxen/include/xen_on_normal_exit_internal.h index 3a94f8919c..ffff46a869 100644 --- a/tools/libxen/include/xen_on_normal_exit_internal.h +++ b/tools/libxen/include/xen_on_normal_exit_internal.h @@ -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 --git a/tools/libxen/include/xen_pbd.h b/tools/libxen/include/xen_pbd.h deleted file mode 100644 index 335d20b2ff..0000000000 --- a/tools/libxen/include/xen_pbd.h +++ /dev/null @@ -1,223 +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_PBD_H -#define XEN_PBD_H - -#include "xen_common.h" -#include "xen_host_decl.h" -#include "xen_pbd_decl.h" -#include "xen_sr_decl.h" -#include "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 --git a/tools/libxen/include/xen_pbd_decl.h b/tools/libxen/include/xen_pbd_decl.h deleted file mode 100644 index 81f8f4b300..0000000000 --- a/tools/libxen/include/xen_pbd_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_pif.h b/tools/libxen/include/xen_pif.h deleted file mode 100644 index 63fc88477b..0000000000 --- a/tools/libxen/include/xen_pif.h +++ /dev/null @@ -1,277 +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_PIF_H -#define XEN_PIF_H - -#include "xen_common.h" -#include "xen_host_decl.h" -#include "xen_network_decl.h" -#include "xen_pif_decl.h" -#include "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 --git a/tools/libxen/include/xen_pif_decl.h b/tools/libxen/include/xen_pif_decl.h deleted file mode 100644 index b326bea3bc..0000000000 --- a/tools/libxen/include/xen_pif_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_pif_metrics.h b/tools/libxen/include/xen_pif_metrics.h deleted file mode 100644 index 970700feb1..0000000000 --- a/tools/libxen/include/xen_pif_metrics.h +++ /dev/null @@ -1,198 +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_PIF_METRICS_H -#define XEN_PIF_METRICS_H - -#include "xen_common.h" -#include "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 --git a/tools/libxen/include/xen_pif_metrics_decl.h b/tools/libxen/include/xen_pif_metrics_decl.h deleted file mode 100644 index 71afe69d53..0000000000 --- a/tools/libxen/include/xen_pif_metrics_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_sr.h b/tools/libxen/include/xen_sr.h deleted file mode 100644 index 39a8dd6650..0000000000 --- a/tools/libxen/include/xen_sr.h +++ /dev/null @@ -1,277 +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_SR_H -#define XEN_SR_H - -#include "xen_common.h" -#include "xen_pbd_decl.h" -#include "xen_sr_decl.h" -#include "xen_string_set.h" -#include "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 --git a/tools/libxen/include/xen_sr_decl.h b/tools/libxen/include/xen_sr_decl.h deleted file mode 100644 index 533e90c49e..0000000000 --- a/tools/libxen/include/xen_sr_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_string_set.h b/tools/libxen/include/xen_string_set.h deleted file mode 100644 index a14af9412b..0000000000 --- a/tools/libxen/include/xen_string_set.h +++ /dev/null @@ -1,47 +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_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 --git a/tools/libxen/include/xen_string_string_map.h b/tools/libxen/include/xen_string_string_map.h deleted file mode 100644 index e3e5f6890b..0000000000 --- a/tools/libxen/include/xen_string_string_map.h +++ /dev/null @@ -1,53 +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_STRING_STRING_MAP_H -#define XEN_STRING_STRING_MAP_H - - -#include "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 --git a/tools/libxen/include/xen_user.h b/tools/libxen/include/xen_user.h deleted file mode 100644 index 9669e07116..0000000000 --- a/tools/libxen/include/xen_user.h +++ /dev/null @@ -1,204 +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_USER_H -#define XEN_USER_H - -#include "xen_common.h" -#include "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 --git a/tools/libxen/include/xen_user_decl.h b/tools/libxen/include/xen_user_decl.h deleted file mode 100644 index e5caae473b..0000000000 --- a/tools/libxen/include/xen_user_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_vbd.h b/tools/libxen/include/xen_vbd.h deleted file mode 100644 index d40af36796..0000000000 --- a/tools/libxen/include/xen_vbd.h +++ /dev/null @@ -1,390 +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_VBD_H -#define XEN_VBD_H - -#include "xen_common.h" -#include "xen_string_set.h" -#include "xen_string_string_map.h" -#include "xen_vbd_decl.h" -#include "xen_vbd_metrics_decl.h" -#include "xen_vbd_mode.h" -#include "xen_vbd_type.h" -#include "xen_vdi_decl.h" -#include "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 --git a/tools/libxen/include/xen_vbd_decl.h b/tools/libxen/include/xen_vbd_decl.h deleted file mode 100644 index c6877866b6..0000000000 --- a/tools/libxen/include/xen_vbd_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_vbd_metrics.h b/tools/libxen/include/xen_vbd_metrics.h deleted file mode 100644 index f1aa420a34..0000000000 --- a/tools/libxen/include/xen_vbd_metrics.h +++ /dev/null @@ -1,198 +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_VBD_METRICS_H -#define XEN_VBD_METRICS_H - -#include "xen_common.h" -#include "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 --git a/tools/libxen/include/xen_vbd_metrics_decl.h b/tools/libxen/include/xen_vbd_metrics_decl.h deleted file mode 100644 index 501aa8f60c..0000000000 --- a/tools/libxen/include/xen_vbd_metrics_decl.h +++ /dev/null @@ -1,30 +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_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 --git a/tools/libxen/include/xen_vbd_mode.h b/tools/libxen/include/xen_vbd_mode.h deleted file mode 100644 index b0cd1c2cf3..0000000000 --- a/tools/libxen/include/xen_vbd_mode.h +++ /dev/null @@ -1,77 +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_VBD_MODE_H -#define XEN_VBD_MODE_H - - -#include "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 --git a/tools/libxen/include/xen_vbd_mode_internal.h b/tools/libxen/include/xen_vbd_mode_internal.h index 3efd4a63d5..4f05681118 100644 --- a/tools/libxen/include/xen_vbd_mode_internal.h +++ b/tools/libxen/include/xen_vbd_mode_internal.h @@ -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 --git a/tools/libxen/include/xen_vbd_type.h b/tools/libxen/include/xen_vbd_type.h deleted file mode 100644 index 656fa16316..0000000000 --- a/tools/libxen/include/xen_vbd_type.h +++ /dev/null @@ -1,77 +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_VBD_TYPE_H -#define XEN_VBD_TYPE_H - - -#include "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 --git a/tools/libxen/include/xen_vdi.h b/tools/libxen/include/xen_vdi.h deleted file mode 100644 index 74b63542e6..0000000000 --- a/tools/libxen/include/xen_vdi.h +++ /dev/null @@ -1,347 +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_VDI_H -#define XEN_VDI_H - -#include "xen_common.h" -#include "xen_crashdump_decl.h" -#include "xen_sr_decl.h" -#include "xen_string_string_map.h" -#include "xen_vbd_decl.h" -#include "xen_vdi_decl.h" -#include "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 --git a/tools/libxen/include/xen_vdi_decl.h b/tools/libxen/include/xen_vdi_decl.h deleted file mode 100644 index 34692a2495..0000000000 --- a/tools/libxen/include/xen_vdi_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_vdi_type.h b/tools/libxen/include/xen_vdi_type.h deleted file mode 100644 index 01168491ee..0000000000 --- a/tools/libxen/include/xen_vdi_type.h +++ /dev/null @@ -1,92 +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_VDI_TYPE_H -#define XEN_VDI_TYPE_H - - -#include "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 --git a/tools/libxen/include/xen_vdi_type_internal.h b/tools/libxen/include/xen_vdi_type_internal.h index 1de23c8c83..9c575ffaab 100644 --- a/tools/libxen/include/xen_vdi_type_internal.h +++ b/tools/libxen/include/xen_vdi_type_internal.h @@ -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 --git a/tools/libxen/include/xen_vif.h b/tools/libxen/include/xen_vif.h deleted file mode 100644 index e9ad6b4369..0000000000 --- a/tools/libxen/include/xen_vif.h +++ /dev/null @@ -1,365 +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_VIF_H -#define XEN_VIF_H - -#include "xen_common.h" -#include "xen_network_decl.h" -#include "xen_string_set.h" -#include "xen_string_string_map.h" -#include "xen_vif_decl.h" -#include "xen_vif_metrics_decl.h" -#include "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 --git a/tools/libxen/include/xen_vif_decl.h b/tools/libxen/include/xen_vif_decl.h deleted file mode 100644 index 6a130f7154..0000000000 --- a/tools/libxen/include/xen_vif_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_vif_metrics.h b/tools/libxen/include/xen_vif_metrics.h deleted file mode 100644 index 2febab468d..0000000000 --- a/tools/libxen/include/xen_vif_metrics.h +++ /dev/null @@ -1,198 +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_VIF_METRICS_H -#define XEN_VIF_METRICS_H - -#include "xen_common.h" -#include "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 --git a/tools/libxen/include/xen_vif_metrics_decl.h b/tools/libxen/include/xen_vif_metrics_decl.h deleted file mode 100644 index 5734723adf..0000000000 --- a/tools/libxen/include/xen_vif_metrics_decl.h +++ /dev/null @@ -1,30 +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_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 --git a/tools/libxen/include/xen_vm.h b/tools/libxen/include/xen_vm.h deleted file mode 100644 index d33f31b860..0000000000 --- a/tools/libxen/include/xen_vm.h +++ /dev/null @@ -1,894 +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_VM_H -#define XEN_VM_H - -#include "xen_common.h" -#include "xen_console_decl.h" -#include "xen_crashdump_decl.h" -#include "xen_host_decl.h" -#include "xen_on_crash_behaviour.h" -#include "xen_on_normal_exit.h" -#include "xen_string_string_map.h" -#include "xen_vbd_decl.h" -#include "xen_vdi_decl.h" -#include "xen_vif_decl.h" -#include "xen_vm_decl.h" -#include "xen_vm_guest_metrics_decl.h" -#include "xen_vm_metrics_decl.h" -#include "xen_vm_power_state.h" -#include "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 --git a/tools/libxen/include/xen_vm_decl.h b/tools/libxen/include/xen_vm_decl.h deleted file mode 100644 index 815b036ea5..0000000000 --- a/tools/libxen/include/xen_vm_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_vm_guest_metrics.h b/tools/libxen/include/xen_vm_guest_metrics.h deleted file mode 100644 index 2734764526..0000000000 --- a/tools/libxen/include/xen_vm_guest_metrics.h +++ /dev/null @@ -1,234 +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_VM_GUEST_METRICS_H -#define XEN_VM_GUEST_METRICS_H - -#include "xen_common.h" -#include "xen_string_string_map.h" -#include "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 --git a/tools/libxen/include/xen_vm_guest_metrics_decl.h b/tools/libxen/include/xen_vm_guest_metrics_decl.h deleted file mode 100644 index 837528b919..0000000000 --- a/tools/libxen/include/xen_vm_guest_metrics_decl.h +++ /dev/null @@ -1,30 +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_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 --git a/tools/libxen/include/xen_vm_metrics.h b/tools/libxen/include/xen_vm_metrics.h deleted file mode 100644 index 3350a66807..0000000000 --- a/tools/libxen/include/xen_vm_metrics.h +++ /dev/null @@ -1,251 +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_VM_METRICS_H -#define XEN_VM_METRICS_H - -#include "xen_common.h" -#include "xen_int_float_map.h" -#include "xen_int_int_map.h" -#include "xen_int_string_set_map.h" -#include "xen_string_set.h" -#include "xen_string_string_map.h" -#include "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 --git a/tools/libxen/include/xen_vm_metrics_decl.h b/tools/libxen/include/xen_vm_metrics_decl.h deleted file mode 100644 index ea1bcb51f7..0000000000 --- a/tools/libxen/include/xen_vm_metrics_decl.h +++ /dev/null @@ -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_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 --git a/tools/libxen/include/xen_vm_power_state.h b/tools/libxen/include/xen_vm_power_state.h deleted file mode 100644 index c5404b89cf..0000000000 --- a/tools/libxen/include/xen_vm_power_state.h +++ /dev/null @@ -1,92 +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_VM_POWER_STATE_H -#define XEN_VM_POWER_STATE_H - - -#include "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 --git a/tools/libxen/include/xen_vm_power_state_internal.h b/tools/libxen/include/xen_vm_power_state_internal.h index 2c88856c08..a3f5af114c 100644 --- a/tools/libxen/include/xen_vm_power_state_internal.h +++ b/tools/libxen/include/xen_vm_power_state_internal.h @@ -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 --git a/tools/libxen/include/xen_vtpm.h b/tools/libxen/include/xen_vtpm.h deleted file mode 100644 index add504221f..0000000000 --- a/tools/libxen/include/xen_vtpm.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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_H -#define XEN_VTPM_H - -#include "xen_common.h" -#include "xen_vm_decl.h" -#include "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 --git a/tools/libxen/include/xen_vtpm_decl.h b/tools/libxen/include/xen_vtpm_decl.h deleted file mode 100644 index 7798e3856d..0000000000 --- a/tools/libxen/include/xen_vtpm_decl.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 --git a/tools/libxen/src/xen_common.c b/tools/libxen/src/xen_common.c index f0fc4cce33..1819381640 100644 --- a/tools/libxen/src/xen_common.c +++ b/tools/libxen/src/xen_common.c @@ -31,13 +31,13 @@ #include #include -#include "xen_common.h" -#include "xen_host.h" +#include "xen/api/xen_common.h" +#include "xen/api/xen_host.h" #include "xen_internal.h" -#include "xen_int_float_map.h" -#include "xen_int_int_map.h" -#include "xen_int_string_set_map.h" -#include "xen_string_string_map.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_string_map.h" /* diff --git a/tools/libxen/src/xen_console.c b/tools/libxen/src/xen_console.c index 9d0764a2d6..2b45498295 100644 --- a/tools/libxen/src/xen_console.c +++ b/tools/libxen/src/xen_console.c @@ -20,12 +20,12 @@ #include #include -#include "xen_common.h" -#include "xen_console.h" #include "xen_console_protocol_internal.h" #include "xen_internal.h" -#include "xen_string_string_map.h" -#include "xen_vm.h" +#include +#include +#include +#include XEN_FREE(xen_console) diff --git a/tools/libxen/src/xen_console_protocol.c b/tools/libxen/src/xen_console_protocol.c index cb87ac01c9..031d64d9a5 100644 --- a/tools/libxen/src/xen_console_protocol.c +++ b/tools/libxen/src/xen_console_protocol.c @@ -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 @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_console_protocol.h" +#include #include "xen_console_protocol_internal.h" diff --git a/tools/libxen/src/xen_crashdump.c b/tools/libxen/src/xen_crashdump.c index 5d8f70a2ea..ba2121bcde 100644 --- a/tools/libxen/src/xen_crashdump.c +++ b/tools/libxen/src/xen_crashdump.c @@ -20,11 +20,11 @@ #include #include -#include "xen_common.h" -#include "xen_crashdump.h" #include "xen_internal.h" -#include "xen_vdi.h" -#include "xen_vm.h" +#include +#include +#include +#include XEN_FREE(xen_crashdump) diff --git a/tools/libxen/src/xen_event.c b/tools/libxen/src/xen_event.c index 3022caffed..30e8d60820 100644 --- a/tools/libxen/src/xen_event.c +++ b/tools/libxen/src/xen_event.c @@ -20,10 +20,10 @@ #include #include -#include "xen_common.h" -#include "xen_event.h" #include "xen_event_operation_internal.h" #include "xen_internal.h" +#include +#include XEN_ALLOC(xen_event_record) diff --git a/tools/libxen/src/xen_event_operation.c b/tools/libxen/src/xen_event_operation.c index c338af0930..48a7c362ac 100644 --- a/tools/libxen/src/xen_event_operation.c +++ b/tools/libxen/src/xen_event_operation.c @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_event_operation.h" +#include #include "xen_event_operation_internal.h" diff --git a/tools/libxen/src/xen_host.c b/tools/libxen/src/xen_host.c index 331ed2105b..0739c4fe4e 100644 --- a/tools/libxen/src/xen_host.c +++ b/tools/libxen/src/xen_host.c @@ -20,16 +20,16 @@ #include #include -#include "xen_common.h" -#include "xen_host.h" -#include "xen_host_cpu.h" -#include "xen_host_metrics.h" #include "xen_internal.h" -#include "xen_pbd.h" -#include "xen_pif.h" -#include "xen_sr.h" -#include "xen_string_string_map.h" -#include "xen_vm.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include XEN_FREE(xen_host) diff --git a/tools/libxen/src/xen_host_cpu.c b/tools/libxen/src/xen_host_cpu.c index 9509c570e4..6e84b49f63 100644 --- a/tools/libxen/src/xen_host_cpu.c +++ b/tools/libxen/src/xen_host_cpu.c @@ -20,10 +20,10 @@ #include #include -#include "xen_common.h" -#include "xen_host.h" -#include "xen_host_cpu.h" #include "xen_internal.h" +#include +#include +#include XEN_FREE(xen_host_cpu) diff --git a/tools/libxen/src/xen_host_metrics.c b/tools/libxen/src/xen_host_metrics.c index 203f25ed0a..976f4c5e40 100644 --- a/tools/libxen/src/xen_host_metrics.c +++ b/tools/libxen/src/xen_host_metrics.c @@ -20,9 +20,9 @@ #include #include -#include "xen_common.h" -#include "xen_host_metrics.h" #include "xen_internal.h" +#include +#include XEN_FREE(xen_host_metrics) diff --git a/tools/libxen/src/xen_int_float_map.c b/tools/libxen/src/xen_int_float_map.c index 33ff29de62..ed3bf48243 100644 --- a/tools/libxen/src/xen_int_float_map.c +++ b/tools/libxen/src/xen_int_float_map.c @@ -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 @@ -17,9 +17,9 @@ */ -#include "xen_common.h" -#include "xen_int_float_map.h" #include "xen_internal.h" +#include +#include xen_int_float_map * diff --git a/tools/libxen/src/xen_int_int_map.c b/tools/libxen/src/xen_int_int_map.c index b7eeba6e96..3d87c22885 100644 --- a/tools/libxen/src/xen_int_int_map.c +++ b/tools/libxen/src/xen_int_int_map.c @@ -17,9 +17,9 @@ */ -#include "xen_common.h" -#include "xen_int_int_map.h" #include "xen_internal.h" +#include +#include xen_int_int_map * diff --git a/tools/libxen/src/xen_int_string_set_map.c b/tools/libxen/src/xen_int_string_set_map.c index 1b37927034..ba61c81268 100644 --- a/tools/libxen/src/xen_int_string_set_map.c +++ b/tools/libxen/src/xen_int_string_set_map.c @@ -17,10 +17,10 @@ */ -#include "xen_common.h" -#include "xen_int_string_set_map.h" #include "xen_internal.h" -#include "xen_string_set.h" +#include +#include +#include xen_int_string_set_map * diff --git a/tools/libxen/src/xen_network.c b/tools/libxen/src/xen_network.c index 01393f6773..4b03ead0e4 100644 --- a/tools/libxen/src/xen_network.c +++ b/tools/libxen/src/xen_network.c @@ -20,12 +20,12 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_network.h" -#include "xen_pif.h" -#include "xen_string_string_map.h" -#include "xen_vif.h" +#include +#include +#include +#include +#include XEN_FREE(xen_network) diff --git a/tools/libxen/src/xen_on_crash_behaviour.c b/tools/libxen/src/xen_on_crash_behaviour.c index cb1d0deca9..abd25db47e 100644 --- a/tools/libxen/src/xen_on_crash_behaviour.c +++ b/tools/libxen/src/xen_on_crash_behaviour.c @@ -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 @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_on_crash_behaviour.h" +#include #include "xen_on_crash_behaviour_internal.h" diff --git a/tools/libxen/src/xen_on_normal_exit.c b/tools/libxen/src/xen_on_normal_exit.c index 3cfe09766b..bbb4e276dc 100644 --- a/tools/libxen/src/xen_on_normal_exit.c +++ b/tools/libxen/src/xen_on_normal_exit.c @@ -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 @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_on_normal_exit.h" +#include #include "xen_on_normal_exit_internal.h" diff --git a/tools/libxen/src/xen_pbd.c b/tools/libxen/src/xen_pbd.c index 2b8bbd5b44..d3702ef4e2 100644 --- a/tools/libxen/src/xen_pbd.c +++ b/tools/libxen/src/xen_pbd.c @@ -20,12 +20,12 @@ #include #include -#include "xen_common.h" -#include "xen_host.h" #include "xen_internal.h" -#include "xen_pbd.h" -#include "xen_sr.h" -#include "xen_string_string_map.h" +#include +#include +#include +#include +#include XEN_FREE(xen_pbd) diff --git a/tools/libxen/src/xen_pif.c b/tools/libxen/src/xen_pif.c index 9dfaec7b51..7cf9a744ab 100644 --- a/tools/libxen/src/xen_pif.c +++ b/tools/libxen/src/xen_pif.c @@ -20,12 +20,12 @@ #include #include -#include "xen_common.h" -#include "xen_host.h" #include "xen_internal.h" -#include "xen_network.h" -#include "xen_pif.h" -#include "xen_pif_metrics.h" +#include +#include +#include +#include +#include XEN_FREE(xen_pif) diff --git a/tools/libxen/src/xen_pif_metrics.c b/tools/libxen/src/xen_pif_metrics.c index c1413442ca..f150f7f5e9 100644 --- a/tools/libxen/src/xen_pif_metrics.c +++ b/tools/libxen/src/xen_pif_metrics.c @@ -20,9 +20,9 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_pif_metrics.h" +#include +#include XEN_FREE(xen_pif_metrics) diff --git a/tools/libxen/src/xen_sr.c b/tools/libxen/src/xen_sr.c index 5220fa3019..b2ff310f7e 100644 --- a/tools/libxen/src/xen_sr.c +++ b/tools/libxen/src/xen_sr.c @@ -20,11 +20,11 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_pbd.h" -#include "xen_sr.h" -#include "xen_vdi.h" +#include +#include +#include +#include XEN_FREE(xen_sr) diff --git a/tools/libxen/src/xen_string_set.c b/tools/libxen/src/xen_string_set.c index 882943356c..7af0f882a6 100644 --- a/tools/libxen/src/xen_string_set.c +++ b/tools/libxen/src/xen_string_set.c @@ -18,7 +18,7 @@ #include "xen_internal.h" -#include "xen_string_set.h" +#include xen_string_set * diff --git a/tools/libxen/src/xen_string_string_map.c b/tools/libxen/src/xen_string_string_map.c index b07acfbf7c..84ae0fcd19 100644 --- a/tools/libxen/src/xen_string_string_map.c +++ b/tools/libxen/src/xen_string_string_map.c @@ -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 @@ -17,9 +17,9 @@ */ -#include "xen_common.h" #include "xen_internal.h" -#include "xen_string_string_map.h" +#include +#include xen_string_string_map * diff --git a/tools/libxen/src/xen_user.c b/tools/libxen/src/xen_user.c index b4dde9d74e..377f8f89ca 100644 --- a/tools/libxen/src/xen_user.c +++ b/tools/libxen/src/xen_user.c @@ -20,9 +20,9 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_user.h" +#include +#include XEN_FREE(xen_user) diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c index facedad94f..85b034b45a 100644 --- a/tools/libxen/src/xen_vbd.c +++ b/tools/libxen/src/xen_vbd.c @@ -20,15 +20,15 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_string_string_map.h" -#include "xen_vbd.h" -#include "xen_vbd_metrics.h" #include "xen_vbd_mode_internal.h" #include "xen_vbd_type_internal.h" -#include "xen_vdi.h" -#include "xen_vm.h" +#include +#include +#include +#include +#include +#include XEN_FREE(xen_vbd) diff --git a/tools/libxen/src/xen_vbd_metrics.c b/tools/libxen/src/xen_vbd_metrics.c index fb5395d309..c4f336c82e 100644 --- a/tools/libxen/src/xen_vbd_metrics.c +++ b/tools/libxen/src/xen_vbd_metrics.c @@ -20,9 +20,9 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_vbd_metrics.h" +#include +#include XEN_FREE(xen_vbd_metrics) diff --git a/tools/libxen/src/xen_vbd_mode.c b/tools/libxen/src/xen_vbd_mode.c index e9fa71140a..71abc42465 100644 --- a/tools/libxen/src/xen_vbd_mode.c +++ b/tools/libxen/src/xen_vbd_mode.c @@ -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 @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_vbd_mode.h" +#include #include "xen_vbd_mode_internal.h" diff --git a/tools/libxen/src/xen_vbd_type.c b/tools/libxen/src/xen_vbd_type.c index 874eb096ef..0572635ffb 100644 --- a/tools/libxen/src/xen_vbd_type.c +++ b/tools/libxen/src/xen_vbd_type.c @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_vbd_type.h" +#include #include "xen_vbd_type_internal.h" diff --git a/tools/libxen/src/xen_vdi.c b/tools/libxen/src/xen_vdi.c index 66a524c9c3..9c161a4c8d 100644 --- a/tools/libxen/src/xen_vdi.c +++ b/tools/libxen/src/xen_vdi.c @@ -20,14 +20,14 @@ #include #include -#include "xen_common.h" -#include "xen_crashdump.h" #include "xen_internal.h" -#include "xen_sr.h" -#include "xen_string_string_map.h" -#include "xen_vbd.h" -#include "xen_vdi.h" #include "xen_vdi_type_internal.h" +#include +#include +#include +#include +#include +#include XEN_FREE(xen_vdi) diff --git a/tools/libxen/src/xen_vdi_type.c b/tools/libxen/src/xen_vdi_type.c index 79e855fa59..4f0bda7b3a 100644 --- a/tools/libxen/src/xen_vdi_type.c +++ b/tools/libxen/src/xen_vdi_type.c @@ -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 @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_vdi_type.h" +#include #include "xen_vdi_type_internal.h" diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c index b0ea376a4b..bc9dd0dd2f 100644 --- a/tools/libxen/src/xen_vif.c +++ b/tools/libxen/src/xen_vif.c @@ -20,13 +20,13 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_network.h" -#include "xen_string_string_map.h" -#include "xen_vif.h" -#include "xen_vif_metrics.h" -#include "xen_vm.h" +#include +#include +#include +#include +#include +#include XEN_FREE(xen_vif) diff --git a/tools/libxen/src/xen_vif_metrics.c b/tools/libxen/src/xen_vif_metrics.c index 7c101f8933..9b876e52f8 100644 --- a/tools/libxen/src/xen_vif_metrics.c +++ b/tools/libxen/src/xen_vif_metrics.c @@ -20,9 +20,9 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_vif_metrics.h" +#include +#include XEN_FREE(xen_vif_metrics) diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c index d2a4309a0d..495103c9a9 100644 --- a/tools/libxen/src/xen_vm.c +++ b/tools/libxen/src/xen_vm.c @@ -20,22 +20,22 @@ #include #include -#include "xen_common.h" -#include "xen_console.h" -#include "xen_crashdump.h" -#include "xen_host.h" #include "xen_internal.h" #include "xen_on_crash_behaviour_internal.h" #include "xen_on_normal_exit_internal.h" -#include "xen_string_string_map.h" -#include "xen_vbd.h" -#include "xen_vdi.h" -#include "xen_vif.h" -#include "xen_vm.h" -#include "xen_vm_guest_metrics.h" -#include "xen_vm_metrics.h" #include "xen_vm_power_state_internal.h" -#include "xen_vtpm.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include XEN_FREE(xen_vm) diff --git a/tools/libxen/src/xen_vm_guest_metrics.c b/tools/libxen/src/xen_vm_guest_metrics.c index 0e60926bab..251b65e1b5 100644 --- a/tools/libxen/src/xen_vm_guest_metrics.c +++ b/tools/libxen/src/xen_vm_guest_metrics.c @@ -20,10 +20,10 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_string_string_map.h" -#include "xen_vm_guest_metrics.h" +#include +#include +#include XEN_FREE(xen_vm_guest_metrics) diff --git a/tools/libxen/src/xen_vm_metrics.c b/tools/libxen/src/xen_vm_metrics.c index 267393a935..7f2ab94441 100644 --- a/tools/libxen/src/xen_vm_metrics.c +++ b/tools/libxen/src/xen_vm_metrics.c @@ -20,13 +20,13 @@ #include #include -#include "xen_common.h" -#include "xen_int_float_map.h" -#include "xen_int_int_map.h" -#include "xen_int_string_set_map.h" #include "xen_internal.h" -#include "xen_string_string_map.h" -#include "xen_vm_metrics.h" +#include +#include +#include +#include +#include +#include XEN_FREE(xen_vm_metrics) diff --git a/tools/libxen/src/xen_vm_power_state.c b/tools/libxen/src/xen_vm_power_state.c index 9f96f34f9b..9797e63163 100644 --- a/tools/libxen/src/xen_vm_power_state.c +++ b/tools/libxen/src/xen_vm_power_state.c @@ -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 @@ -19,7 +19,7 @@ #include #include "xen_internal.h" -#include "xen_vm_power_state.h" +#include #include "xen_vm_power_state_internal.h" diff --git a/tools/libxen/src/xen_vtpm.c b/tools/libxen/src/xen_vtpm.c index 28d849ae1c..5ed3692234 100644 --- a/tools/libxen/src/xen_vtpm.c +++ b/tools/libxen/src/xen_vtpm.c @@ -21,10 +21,10 @@ #include #include -#include "xen_common.h" #include "xen_internal.h" -#include "xen_vm.h" -#include "xen_vtpm.h" +#include +#include +#include XEN_FREE(xen_vtpm) @@ -46,7 +46,7 @@ static const struct_member xen_vtpm_record_struct_members[] = .offset = offsetof(xen_vtpm_record, vm) }, { .key = "backend", .type = &abstract_type_ref, - .offset = offsetof(xen_vtpm_record, backend) }, + .offset = offsetof(xen_vtpm_record, backend) } }; const abstract_type xen_vtpm_record_abstract_type_ = diff --git a/tools/libxen/test/test_bindings.c b/tools/libxen/test/test_bindings.c index 0659cd89e1..566a0388fa 100644 --- a/tools/libxen/test/test_bindings.c +++ b/tools/libxen/test/test_bindings.c @@ -25,14 +25,7 @@ #include #include - -#include "xen_host.h" -#include "xen_sr.h" -#include "xen_vbd.h" -#include "xen_vdi.h" -#include "xen_console.h" -#include "xen_vm.h" -#include "xen_vm_metrics.h" +#include //#define PRINT_XML diff --git a/tools/libxen/test/test_event_handling.c b/tools/libxen/test/test_event_handling.c index 16ba293da6..188b585d0b 100644 --- a/tools/libxen/test/test_event_handling.c +++ b/tools/libxen/test/test_event_handling.c @@ -25,8 +25,7 @@ #include #include - -#include "xen_event.h" +#include //#define PRINT_XML diff --git a/tools/libxen/test/test_hvm_bindings.c b/tools/libxen/test/test_hvm_bindings.c deleted file mode 100644 index 8bc8e7c347..0000000000 --- a/tools/libxen/test/test_hvm_bindings.c +++ /dev/null @@ -1,445 +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 - */ - -#define _GNU_SOURCE -#include -#include -#include -#include - -#include -#include - -#include "xen_host.h" -#include "xen_sr.h" -#include "xen_vbd.h" -#include "xen_vdi.h" -#include "xen_vm.h" - - -static void usage() -{ - fprintf(stderr, -"Usage:\n" -"\n" -" test_bindings \n" -"\n" -"where\n" -" is a fragment of the server's URL, e.g. localhost:8005/RPC2;\n" -" is the username to use at the server; and\n" -" is the password.\n"); - - exit(EXIT_FAILURE); -} - - -static char *url; - - -typedef struct -{ - xen_result_func func; - void *handle; -} xen_comms; - - -static xen_vm create_new_vm(xen_session *session); -static void print_vm_power_state(xen_session *session, xen_vm vm); - - -static size_t -write_func(void *ptr, size_t size, size_t nmemb, xen_comms *comms) -{ - size_t n = size * nmemb; - return comms->func(ptr, n, comms->handle) ? n : 0; -} - - -static int -call_func(const void *data, size_t len, void *user_handle, - void *result_handle, xen_result_func result_func) -{ - (void)user_handle; - - CURL *curl = curl_easy_init(); - if (!curl) { - return -1; - } - - xen_comms comms = { - .func = result_func, - .handle = result_handle - }; - - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); - curl_easy_setopt(curl, CURLOPT_MUTE, 1); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_func); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &comms); - curl_easy_setopt(curl, CURLOPT_POST, 1); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, len); - - CURLcode result = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - return result; -} - - -static void print_error(xen_session *session) -{ - fprintf(stderr, "Error: %d", session->error_description_count); - for (int i = 0; i < session->error_description_count; i++) - { - fprintf(stderr, "%s ", session->error_description[i]); - } - fprintf(stderr, "\n"); -} - - -int main(int argc, char **argv) -{ - if (argc != 4) - { - usage(); - } - - url = argv[1]; - char *username = argv[2]; - char *password = argv[3]; - - xmlInitParser(); - xen_init(); - curl_global_init(CURL_GLOBAL_ALL); - -#define CLEANUP \ - do { \ - xen_session_logout(session); \ - curl_global_cleanup(); \ - xen_fini(); \ - xmlCleanupParser(); \ - } while(0) \ - - - xen_session *session = - xen_session_login_with_password(call_func, NULL, username, password); - - xen_vm vm; - if (!xen_vm_get_by_uuid(session, &vm, - "00000000-0000-0000-0000-000000000000")) - { - print_error(session); - CLEANUP; - return 1; - } - - char *vm_uuid; - if (!xen_vm_get_uuid(session, &vm_uuid, vm)) - { - print_error(session); - xen_vm_free(vm); - CLEANUP; - return 1; - } - - char *vm_uuid_bytes; - if (!xen_uuid_string_to_bytes(vm_uuid, &vm_uuid_bytes)) - { - fprintf(stderr, "xen_uuid_string_to_bytes failed.\n"); - xen_uuid_free(vm_uuid); - xen_vm_free(vm); - CLEANUP; - return 1; - } - - xen_vm_record *vm_record; - if (!xen_vm_get_record(session, &vm_record, vm)) - { - print_error(session); - xen_uuid_bytes_free(vm_uuid_bytes); - xen_uuid_free(vm_uuid); - xen_vm_free(vm); - CLEANUP; - return 1; - } - - xen_host host; - if (!xen_session_get_this_host(session, &host)) - { - print_error(session); - xen_vm_record_free(vm_record); - xen_uuid_bytes_free(vm_uuid_bytes); - xen_uuid_free(vm_uuid); - xen_vm_free(vm); - CLEANUP; - return 1; - } - - xen_string_string_map *versions; - if (!xen_host_get_software_version(session, &versions, host)) - { - print_error(session); - xen_host_free(host); - xen_vm_record_free(vm_record); - xen_uuid_bytes_free(vm_uuid_bytes); - xen_uuid_free(vm_uuid); - xen_vm_free(vm); - CLEANUP; - return 1; - } - - printf("%s.\n", vm_uuid); - - fprintf(stderr, "In bytes, the VM UUID is "); - for (int i = 0; i < 15; i++) - { - fprintf(stderr, "%x, ", (unsigned int)vm_uuid_bytes[i]); - } - fprintf(stderr, "%x.\n", (unsigned int)vm_uuid_bytes[15]); - - printf("%zd.\n", versions->size); - - for (size_t i = 0; i < versions->size; i++) - { - printf("%s -> %s.\n", versions->contents[i].key, - versions->contents[i].val); - } - - printf("%s.\n", vm_record->uuid); - - printf("Resident on %s.\n", (char *)vm_record->resident_on->u.handle); - - printf("%s.\n", xen_vm_power_state_to_string(vm_record->power_state)); - - for (size_t i = 0; i < vm_record->vcpus_utilisation->size; i++) - { - printf("%"PRId64" -> %lf.\n", - vm_record->vcpus_utilisation->contents[i].key, - vm_record->vcpus_utilisation->contents[i].val); - } - - xen_uuid_bytes_free(vm_uuid_bytes); - xen_uuid_free(vm_uuid); - xen_vm_free(vm); - - xen_vm_record_free(vm_record); - - xen_host_free(host); - xen_string_string_map_free(versions); - - - xen_vm new_vm = create_new_vm(session); - if (!session->ok) - { - /* Error has been logged, just clean up. */ - CLEANUP; - return 1; - } - - print_vm_power_state(session, new_vm); - if (!session->ok) - { - /* Error has been logged, just clean up. */ - xen_vm_free(new_vm); - CLEANUP; - return 1; - } - - xen_vm_free(new_vm); - CLEANUP; - - return 0; -} - - -/** - * Creation of a new VM, using the Named Parameters idiom. Allocate the - * xen_vm_record here, but the sets through the library. Either - * allocation patterns can be used, as long as the allocation and free are - * paired correctly. - */ -static xen_vm create_new_vm(xen_session *session) -{ - xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1); - xen_vm_record vm_record = - { - .name_label = "NewHVM", - .name_description = "New HVM Description", - .user_version = 1, - .is_a_template = false, - .memory_static_max = 256, - .memory_dynamic_max = 256, - .memory_dynamic_min = 128, - .memory_static_min = 128, - .vcpus_policy = "credit", - .vcpus_params = vcpus_params, - .vcpus_number = 2, - .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY, - .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART, - .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE, - .hvm_boot = "cda", - }; - - - xen_vm vm; - xen_vm_create(session, &vm, &vm_record); - - if (!session->ok) - { - fprintf(stderr, "VM creation failed.\n"); - print_error(session); - return NULL; - } - - - /* - * Create a new disk for the new VM. - */ - xen_sr_set *srs; - if (!xen_sr_get_by_name_label(session, &srs, "Local") || - srs->size < 1) - { - fprintf(stderr, "SR lookup failed.\n"); - print_error(session); - xen_vm_free(vm); - return NULL; - } - - xen_sr_record_opt sr_record = - { - .u.handle = srs->contents[0] - }; - xen_vdi_record vdi0_record = - { - .name_label = "MyRootFS", - .name_description = "MyRootFS description", - .sr = &sr_record, - .virtual_size = (1 << 21), // 1GiB / 512 bytes/sector - .sector_size = 512, - .location = "file:/root/gentoo.amd64.hvm.img", - .type = XEN_VDI_TYPE_SYSTEM, - .sharable = false, - .read_only = false - }; - - xen_vdi vdi0; - if (!xen_vdi_create(session, &vdi0, &vdi0_record)) - { - fprintf(stderr, "VDI creation failed.\n"); - print_error(session); - - xen_sr_set_free(srs); - xen_vm_free(vm); - return NULL; - } - - - xen_vm_record_opt vm_record_opt = - { - .u.handle = vm - }; - xen_vdi_record_opt vdi0_record_opt = - { - .u.handle = vdi0 - }; - xen_vbd_record vbd0_record = - { - .vm = &vm_record_opt, - .vdi = &vdi0_record_opt, - .device = "xvda1", - .mode = XEN_VBD_MODE_RW - }; - - xen_vbd vbd0; - if (!xen_vbd_create(session, &vbd0, &vbd0_record)) - { - fprintf(stderr, "VBD creation failed.\n"); - print_error(session); - - xen_vdi_free(vdi0); - xen_sr_set_free(srs); - xen_vm_free(vm); - return NULL; - } - - char *vm_uuid; - char *vdi0_uuid; - char *vbd0_uuid; - - xen_vm_get_uuid(session, &vm_uuid, vm); - xen_vdi_get_uuid(session, &vdi0_uuid, vdi0); - xen_vbd_get_uuid(session, &vbd0_uuid, vbd0); - - if (!session->ok) - { - fprintf(stderr, "get_uuid call failed.\n"); - print_error(session); - - xen_uuid_free(vm_uuid); - xen_uuid_free(vdi0_uuid); - xen_uuid_free(vbd0_uuid); - xen_vbd_free(vbd0); - xen_vdi_free(vdi0); - xen_sr_set_free(srs); - xen_vm_free(vm); - return NULL; - } - - fprintf(stderr, - "Created a new VM, with UUID %s, VDI UUID %s, and VBD UUID %s.\n", - vm_uuid, vdi0_uuid, vbd0_uuid); - - xen_uuid_free(vm_uuid); - xen_uuid_free(vdi0_uuid); - xen_uuid_free(vbd0_uuid); - xen_vbd_free(vbd0); - xen_vdi_free(vdi0); - xen_sr_set_free(srs); - - return vm; -} - - -/** - * Print the power state for the given VM. - */ -static void print_vm_power_state(xen_session *session, xen_vm vm) -{ - char *vm_uuid; - enum xen_vm_power_state power_state; - - if (!xen_vm_get_uuid(session, &vm_uuid, vm)) - { - print_error(session); - return; - } - - if (!xen_vm_get_power_state(session, &power_state, vm)) - { - xen_uuid_free(vm_uuid); - print_error(session); - return; - } - - printf("VM %s power state is %s.\n", vm_uuid, - xen_vm_power_state_to_string(power_state)); - - xen_uuid_free(vm_uuid); -} -- cgit v1.2.3